Restore search

pull/196/head
M66B 4 years ago
parent 2b1b4c3a42
commit e4082dc33a

@ -236,7 +236,7 @@ public class AdapterAnswer extends RecyclerView.Adapter<AdapterAnswer.ViewHolder
}
public void set(@NonNull List<EntityAnswer> answers) {
Log.i("Set answers=" + answers.size());
Log.i("Set answers=" + answers.size() + " search=" + search);
all = answers;
@ -283,6 +283,7 @@ public class AdapterAnswer extends RecyclerView.Adapter<AdapterAnswer.ViewHolder
}
public void search(String query) {
Log.i("Answers query=" + query);
search = query;
set(all);
}

@ -363,7 +363,7 @@ public class AdapterContact extends RecyclerView.Adapter<AdapterContact.ViewHold
}
public void set(@NonNull List<TupleContactEx> contacts) {
Log.i("Set contacts=" + contacts.size());
Log.i("Set contacts=" + contacts.size() + " search=" + search);
all = contacts;
@ -408,6 +408,7 @@ public class AdapterContact extends RecyclerView.Adapter<AdapterContact.ViewHold
}
public void search(String query) {
Log.i("Contacts query=" + query);
search = query;
set(all);
}

@ -425,7 +425,7 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> {
public void set(int protocol, @NonNull List<TupleRuleEx> rules) {
this.protocol = protocol;
Log.i("Set protocol=" + protocol + " rules=" + rules.size());
Log.i("Set protocol=" + protocol + " rules=" + rules.size() + " search=" + search);
all = rules;
@ -484,6 +484,7 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> {
}
public void search(String query) {
Log.i("Rules query=" + query);
search = query;
set(protocol, all);
}

@ -128,10 +128,9 @@ public class FragmentAnswers extends FragmentBase {
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
if (savedInstanceState != null) {
if (savedInstanceState != null)
searching = savedInstanceState.getString("fair:searching");
adapter.search(searching);
}
adapter.search(searching);
DB db = DB.getInstance(getContext());
db.answer().liveAnswers().observe(getViewLifecycleOwner(), new Observer<List<EntityAnswer>>() {
@ -164,8 +163,10 @@ public class FragmentAnswers extends FragmentBase {
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextChange(String newText) {
searching = newText;
adapter.search(newText);
if (getView() != null) {
searching = newText;
adapter.search(newText);
}
return true;
}

@ -92,10 +92,9 @@ public class FragmentContacts extends FragmentBase {
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
if (savedInstanceState != null) {
if (savedInstanceState != null)
searching = savedInstanceState.getString("fair:searching");
adapter.search(searching);
}
adapter.search(searching);
DB db = DB.getInstance(getContext());
db.contact().liveContacts().observe(getViewLifecycleOwner(), new Observer<List<TupleContactEx>>() {
@ -130,8 +129,10 @@ public class FragmentContacts extends FragmentBase {
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextChange(String newText) {
searching = newText;
adapter.search(newText);
if (getView() != null) {
searching = newText;
adapter.search(newText);
}
return true;
}

@ -172,10 +172,9 @@ public class FragmentRules extends FragmentBase {
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
if (savedInstanceState != null) {
if (savedInstanceState != null)
searching = savedInstanceState.getString("fair:searching");
adapter.search(searching);
}
adapter.search(searching);
DB db = DB.getInstance(getContext());
db.rule().liveRules(folder).observe(getViewLifecycleOwner(), new Observer<List<TupleRuleEx>>() {
@ -236,8 +235,10 @@ public class FragmentRules extends FragmentBase {
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextChange(String newText) {
searching = newText;
adapter.search(newText);
if (getView() != null) {
searching = newText;
adapter.search(newText);
}
return true;
}

Loading…
Cancel
Save