From 9dbf824432c0d1c045d307d651c7b2656113458f Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Tue, 7 Apr 2020 13:20:22 +0200 Subject: [PATCH] add result counter to local-help-search --- res/menu/local_help.xml | 5 +++ .../securesms/LocalHelpActivity.java | 43 ++++++++++++++++--- 2 files changed, 41 insertions(+), 7 deletions(-) diff --git a/res/menu/local_help.xml b/res/menu/local_help.xml index b3fd9ecad..66b171b9b 100644 --- a/res/menu/local_help.xml +++ b/res/menu/local_help.xml @@ -7,6 +7,11 @@ app:actionViewClass="androidx.appcompat.widget.SearchView" app:showAsAction="collapseActionView|never" /> + + 0) { + updateResultCounter(activeMatchOrdinal, numberOfMatches); + } else { + if (lastQuery.isEmpty()) { + updateResultCounter(-1, 0); // hide + } else { + String msg = getString(R.string.search_no_result_for_x, lastQuery); + if (lastToast != null) { + lastToast.cancel(); + } + lastToast = Toast.makeText(this, msg, Toast.LENGTH_SHORT); + lastToast.show(); + updateResultCounter(0, 0); // show as "0/0" + } } - lastToast = Toast.makeText(this, msg, Toast.LENGTH_SHORT); - lastToast.show(); } } + + // other actions + @Override public boolean onOptionsItemSelected(MenuItem item) { super.onOptionsItemSelected(item);