diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2012-12-12 13:58:22 +0100 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2012-12-12 13:58:22 +0100 |
commit | e3fea30abe9f9f16dbfa5e989e7058842b085b7e (patch) | |
tree | 06c5bdcb4e8d18d315115a8a0fc414a1d0d64ccc /APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/ActionBarSherlockCompat.java | |
parent | a4ea3e65a7feb9175e206b4aa93662bf51457072 (diff) | |
download | open-keychain-e3fea30abe9f9f16dbfa5e989e7058842b085b7e.tar.gz open-keychain-e3fea30abe9f9f16dbfa5e989e7058842b085b7e.tar.bz2 open-keychain-e3fea30abe9f9f16dbfa5e989e7058842b085b7e.zip |
Update ActionBarSherlock
Diffstat (limited to 'APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/ActionBarSherlockCompat.java')
-rw-r--r-- | APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/ActionBarSherlockCompat.java | 44 |
1 files changed, 20 insertions, 24 deletions
diff --git a/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/ActionBarSherlockCompat.java b/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/ActionBarSherlockCompat.java index 05353d28c..5e69275c7 100644 --- a/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/ActionBarSherlockCompat.java +++ b/APG/android-libs/ActionBarSherlock/src/com/actionbarsherlock/internal/ActionBarSherlockCompat.java @@ -52,6 +52,7 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu /** Window features which are enabled by default. */ protected static final int DEFAULT_FEATURES = 0; + static private final String PANELS_TAG = "sherlock:Panels"; public ActionBarSherlockCompat(Activity activity, int flags) { super(activity, flags); @@ -71,8 +72,6 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu private MenuBuilder mMenu; /** Map between native options items and sherlock items. */ protected HashMap<android.view.MenuItem, MenuItemImpl> mNativeItemMap; - /** Indication of a long-press on the hardware menu key. */ - private boolean mMenuKeyIsLongPress = false; /** Parent view of the window decoration (action bar, mode, etc.). */ private ViewGroup mDecor; @@ -293,7 +292,10 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu return false; } - return wActionBar.hideOverflowMenu(); + if (wActionBar != null) { + return wActionBar.hideOverflowMenu(); + } + return false; } @Override @@ -424,27 +426,8 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu } } - boolean result = false; - if (keyCode == KeyEvent.KEYCODE_MENU && isReservingOverflow()) { - if (event.getAction() == KeyEvent.ACTION_DOWN && event.isLongPress()) { - mMenuKeyIsLongPress = true; - } else if (event.getAction() == KeyEvent.ACTION_UP) { - if (!mMenuKeyIsLongPress) { - if (mActionMode == null && wActionBar != null) { - if (wActionBar.isOverflowMenuShowing()) { - wActionBar.hideOverflowMenu(); - } else { - wActionBar.showOverflowMenu(); - } - } - result = true; - } - mMenuKeyIsLongPress = false; - } - } - - if (DEBUG) Log.d(TAG, "[dispatchKeyEvent] returning " + result); - return result; + if (DEBUG) Log.d(TAG, "[dispatchKeyEvent] returning false"); + return false; } @Override @@ -452,6 +435,19 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu mIsDestroyed = true; } + @Override + public void dispatchSaveInstanceState(Bundle outState) { + if (mMenu != null) { + mMenuFrozenActionViewState = new Bundle(); + mMenu.saveActionViewStates(mMenuFrozenActionViewState); + } + outState.putParcelable(PANELS_TAG, mMenuFrozenActionViewState); + } + + @Override + public void dispatchRestoreInstanceState(Bundle savedInstanceState) { + mMenuFrozenActionViewState = savedInstanceState.getParcelable(PANELS_TAG); + } /////////////////////////////////////////////////////////////////////////// // Menu callback lifecycle and creation |