mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-30 13:35:18 +00:00
parent
6980a32628
commit
715b1ea10d
@ -116,8 +116,7 @@ public class ConversationListActivity extends PassphraseRequiredActionBarActivit
|
|||||||
if (this.masterSecret != null) {
|
if (this.masterSecret != null) {
|
||||||
inflater.inflate(R.menu.conversation_list, menu);
|
inflater.inflate(R.menu.conversation_list, menu);
|
||||||
MenuItem menuItem = menu.findItem(R.id.menu_search);
|
MenuItem menuItem = menu.findItem(R.id.menu_search);
|
||||||
SearchView searchView = (SearchView) MenuItemCompat.getActionView(menuItem);
|
initializeSearch(menuItem);
|
||||||
initializeSearch(searchView);
|
|
||||||
} else {
|
} else {
|
||||||
inflater.inflate(R.menu.conversation_list_empty, menu);
|
inflater.inflate(R.menu.conversation_list_empty, menu);
|
||||||
}
|
}
|
||||||
@ -126,23 +125,40 @@ public class ConversationListActivity extends PassphraseRequiredActionBarActivit
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeSearch(SearchView searchView) {
|
private void initializeSearch(MenuItem searchViewItem) {
|
||||||
|
SearchView searchView = (SearchView)MenuItemCompat.getActionView(searchViewItem);
|
||||||
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onQueryTextSubmit(String query) {
|
public boolean onQueryTextSubmit(String query) {
|
||||||
ConversationListFragment fragment = (ConversationListFragment)getSupportFragmentManager()
|
|
||||||
.findFragmentById(R.id.fragment_content);
|
|
||||||
if (fragment != null) {
|
if (fragment != null) {
|
||||||
fragment.setQueryFilter(query);
|
fragment.setQueryFilter(query);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onQueryTextChange(String newText) {
|
public boolean onQueryTextChange(String newText) {
|
||||||
return onQueryTextSubmit(newText);
|
return onQueryTextSubmit(newText);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
MenuItemCompat.setOnActionExpandListener(searchViewItem, new MenuItemCompat.OnActionExpandListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onMenuItemActionExpand(MenuItem menuItem) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onMenuItemActionCollapse(MenuItem menuItem) {
|
||||||
|
if (fragment != null) {
|
||||||
|
fragment.resetQueryFilter();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user