mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-30 12:32:17 -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
|
@Override
|
||||||
public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) {
|
public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) {
|
||||||
// Get the searchview
|
// 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);
|
mSearchView = (SearchView) MenuItemCompat.getActionView(searchItem);
|
||||||
|
|
||||||
// Execute this when searching
|
// Execute this when searching
|
||||||
mSearchView.setOnQueryTextListener(this);
|
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);
|
super.onCreateOptionsMenu(menu, inflater);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_key_list_public_import"
|
android:id="@+id/menu_key_list_public_import"
|
||||||
app:showAsAction="always|withText"
|
app:showAsAction="ifRoom|withText"
|
||||||
android:icon="@drawable/ic_action_add_person"
|
android:icon="@drawable/ic_action_add_person"
|
||||||
android:title="@string/menu_import" />
|
android:title="@string/menu_import" />
|
||||||
<item
|
<item
|
||||||
@ -16,5 +16,5 @@
|
|||||||
android:title="@string/menu_search"
|
android:title="@string/menu_search"
|
||||||
android:icon="@drawable/ic_action_search"
|
android:icon="@drawable/ic_action_search"
|
||||||
app:actionViewClass="android.support.v7.widget.SearchView"
|
app:actionViewClass="android.support.v7.widget.SearchView"
|
||||||
app:showAsAction="ifRoom" />
|
app:showAsAction="collapseActionView|ifRoom" />
|
||||||
</menu>
|
</menu>
|
Loading…
Reference in New Issue
Block a user