mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 11:12:15 -05:00
Fix SearchView
This commit is contained in:
parent
99361bdcff
commit
c94ef60c5d
@ -110,8 +110,6 @@ public class KeyListFragment extends LoaderFragment
|
||||
private String mQuery;
|
||||
private SearchView mSearchView;
|
||||
|
||||
boolean hideMenu = false;
|
||||
|
||||
/**
|
||||
* Load custom layout with StickyListView from library
|
||||
*/
|
||||
@ -172,8 +170,8 @@ public class KeyListFragment extends LoaderFragment
|
||||
TextView title = (TextView) getActivity().findViewById(R.id.custom_actionbar_text);
|
||||
title.setText(R.string.swipe_to_update);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
hideMenu = true;
|
||||
activity.invalidateOptionsMenu();
|
||||
// hideMenu = true;
|
||||
// activity.invalidateOptionsMenu();
|
||||
}
|
||||
} else {
|
||||
bar.setTitle(getActivity().getTitle());
|
||||
@ -184,8 +182,8 @@ public class KeyListFragment extends LoaderFragment
|
||||
bar.setDisplayShowCustomEnabled(false);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
hideMenu = false;
|
||||
activity.invalidateOptionsMenu();
|
||||
// hideMenu = false;
|
||||
// activity.invalidateOptionsMenu();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -470,10 +468,6 @@ public class KeyListFragment extends LoaderFragment
|
||||
MenuItemCompat.setOnActionExpandListener(searchItem, new MenuItemCompat.OnActionExpandListener() {
|
||||
@Override
|
||||
public boolean onMenuItemActionExpand(MenuItem item) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
hideMenu = true;
|
||||
getActivity().invalidateOptionsMenu();
|
||||
}
|
||||
|
||||
// disable swipe-to-refresh
|
||||
// mSwipeRefreshLayout.setIsLocked(true);
|
||||
@ -485,22 +479,12 @@ public class KeyListFragment extends LoaderFragment
|
||||
mQuery = null;
|
||||
getLoaderManager().restartLoader(0, null, KeyListFragment.this);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
hideMenu = false;
|
||||
getActivity().invalidateOptionsMenu();
|
||||
}
|
||||
// enable swipe-to-refresh
|
||||
// mSwipeRefreshLayout.setIsLocked(false);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
if (hideMenu) {
|
||||
for (int i = 0; i < menu.size(); i++) {
|
||||
menu.getItem(i).setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimaryDark"
|
||||
android:elevation="4dp"
|
||||
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
|
||||
tools:ignore="UnusedAttribute" />
|
@ -11,53 +11,53 @@
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_key_list_search_cloud"
|
||||
app:showAsAction="always|withText"
|
||||
android:icon="@drawable/ic_action_search_cloud"
|
||||
android:title="@string/menu_add_keys" />
|
||||
android:title="@string/menu_search_cloud"
|
||||
app:showAsAction="ifRoom|withText" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_key_list_add"
|
||||
app:showAsAction="always|withText"
|
||||
android:icon="@drawable/ic_action_qr_code"
|
||||
android:title="@string/import_qr_code_button" />
|
||||
android:title="@string/import_qr_code_button"
|
||||
app:showAsAction="ifRoom|withText" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_key_list_export"
|
||||
app:showAsAction="never"
|
||||
android:title="@string/menu_export_all_keys" />
|
||||
android:title="@string/menu_export_all_keys"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_key_list_create"
|
||||
app:showAsAction="never"
|
||||
android:title="@string/menu_create_key" />
|
||||
android:title="@string/menu_create_key"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_key_list_import_existing_key"
|
||||
app:showAsAction="never"
|
||||
android:title="@string/menu_import_existing_key" />
|
||||
android:title="@string/menu_import_existing_key"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_key_list_debug_cons"
|
||||
app:showAsAction="never"
|
||||
android:title="Debug / Consolidate"
|
||||
android:visible="false" />
|
||||
android:visible="false"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_key_list_debug_read"
|
||||
app:showAsAction="never"
|
||||
android:title="Debug / DB restore"
|
||||
android:visible="false" />
|
||||
android:visible="false"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_key_list_debug_write"
|
||||
app:showAsAction="never"
|
||||
android:title="Debug / DB backup"
|
||||
android:visible="false" />
|
||||
android:visible="false"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_key_list_debug_first_time"
|
||||
app:showAsAction="never"
|
||||
android:title="Debug / Show first time screen"
|
||||
android:visible="false" />
|
||||
android:visible="false"
|
||||
app:showAsAction="never" />
|
||||
|
||||
</menu>
|
||||
|
@ -98,6 +98,7 @@
|
||||
<string name="menu_encrypt_to">"Encrypt to…"</string>
|
||||
<string name="menu_select_all">"Select all"</string>
|
||||
<string name="menu_add_keys">"Add keys"</string>
|
||||
<string name="menu_search_cloud">"Search cloud"</string>
|
||||
<string name="menu_export_all_keys">"Export all keys"</string>
|
||||
<string name="menu_advanced">"Show advanced info"</string>
|
||||
|
||||
|
@ -8,5 +8,26 @@
|
||||
<item name="colorPrimaryDark">@color/colorPrimary</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="searchViewStyle">@style/MySearchViewStyle</item>
|
||||
</style>
|
||||
|
||||
<!-- http://android-developers.blogspot.de/2014/10/appcompat-v21-material-design-for-pre.html -->
|
||||
<style name="MySearchViewStyle" parent="Widget.AppCompat.SearchView">
|
||||
<!-- Background for the search query section (e.g. EditText) -->
|
||||
<!--<item name="queryBackground">...</item>-->
|
||||
<!-- Background for the actions section (e.g. voice, submit) -->
|
||||
<!--<item name="submitBackground">...</item>-->
|
||||
<!-- Close button icon -->
|
||||
<!--<item name="closeIcon">...</item>-->
|
||||
<!-- Search button icon -->
|
||||
<!--<item name="searchIcon">...</item>-->
|
||||
<!-- Go/commit button icon -->
|
||||
<!--<item name="goIcon">...</item>-->
|
||||
<!-- Voice search button icon -->
|
||||
<!--<item name="voiceIcon">...</item>-->
|
||||
<!-- Commit icon shown in the query suggestion row -->
|
||||
<!--<item name="commitIcon">...</item>-->
|
||||
<!-- Layout for query suggestion rows -->
|
||||
<!--<item name="suggestionRowLayout">...</item>-->
|
||||
</style>
|
||||
</resources>
|
Loading…
Reference in New Issue
Block a user