mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 12:44:42 +00:00
Show search index state
This commit is contained in:
parent
a395ad55b8
commit
13bc8a3d9b
1 changed files with 18 additions and 0 deletions
|
@ -48,6 +48,7 @@ import androidx.annotation.Nullable;
|
|||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.constraintlayout.widget.Group;
|
||||
import androidx.cursoradapter.widget.SimpleCursorAdapter;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import java.text.DateFormat;
|
||||
|
@ -540,6 +541,23 @@ public class FragmentDialogSearch extends FragmentDialogBase {
|
|||
}
|
||||
});
|
||||
|
||||
DB db = DB.getInstance(context);
|
||||
db.message().liveFts().observe(getViewLifecycleOwner(), new Observer<TupleFtsStats>() {
|
||||
private TupleFtsStats last = null;
|
||||
|
||||
@Override
|
||||
public void onChanged(TupleFtsStats stats) {
|
||||
if (stats == null)
|
||||
cbSearchIndex.setText(R.string.title_search_use_index);
|
||||
else if (last == null || !last.equals(stats)) {
|
||||
int perc = (int) (100 * stats.fts / (float) stats.total);
|
||||
cbSearchIndex.setText(getString(R.string.title_name_count,
|
||||
getString(R.string.title_search_use_index), perc + "%"));
|
||||
}
|
||||
last = stats;
|
||||
}
|
||||
});
|
||||
|
||||
return dialog;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue