mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 19:22:14 -05:00
Fix for #347
This commit is contained in:
parent
0a0bdad5b5
commit
b29c430959
@ -353,12 +353,23 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer
|
||||
@Override
|
||||
public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) {
|
||||
// Get the searchview
|
||||
MenuItem searchItem = menu.findItem(R.id.menu_key_list_public_search);
|
||||
final MenuItem searchItem = menu.findItem(R.id.menu_key_list_public_search);
|
||||
|
||||
mSearchView = (SearchView) MenuItemCompat.getActionView(searchItem);
|
||||
|
||||
// Execute this when searching
|
||||
mSearchView.setOnQueryTextListener(this);
|
||||
|
||||
//Collapse the SearchView if it does not have focus
|
||||
mSearchView.setOnQueryTextFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
if (!hasFocus) {
|
||||
MenuItemCompat.collapseActionView(searchItem);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_key_list_public_import"
|
||||
app:showAsAction="always|withText"
|
||||
app:showAsAction="ifRoom|withText"
|
||||
android:icon="@drawable/ic_action_add_person"
|
||||
android:title="@string/menu_import" />
|
||||
<item
|
||||
@ -16,5 +16,5 @@
|
||||
android:title="@string/menu_search"
|
||||
android:icon="@drawable/ic_action_search"
|
||||
app:actionViewClass="android.support.v7.widget.SearchView"
|
||||
app:showAsAction="ifRoom" />
|
||||
app:showAsAction="collapseActionView|ifRoom" />
|
||||
</menu>
|
Loading…
Reference in New Issue
Block a user