Update to ActionBarSherlock 4.1.0.
authorkruland2607 <kruland2607@180e2498-e6e9-4542-8430-84ac67f01cd8>
Thu, 14 Jun 2012 13:03:36 +0000 (13:03 +0000)
committerkruland2607 <kruland2607@180e2498-e6e9-4542-8430-84ac67f01cd8>
Thu, 14 Jun 2012 13:03:36 +0000 (13:03 +0000)
git-svn-id: https://openrocket.svn.sourceforge.net/svnroot/openrocket/trunk@777 180e2498-e6e9-4542-8430-84ac67f01cd8

20 files changed:
android-libraries/ActionBarSherlock/AndroidManifest.xml
android-libraries/ActionBarSherlock/bin/actionbarsherlock.jar
android-libraries/ActionBarSherlock/bin/classes/com/actionbarsherlock/internal/view/menu/MenuItemMule.class [deleted file]
android-libraries/ActionBarSherlock/bin/classes/com/actionbarsherlock/internal/view/menu/MenuMule.class [deleted file]
android-libraries/ActionBarSherlock/project.properties
android-libraries/ActionBarSherlock/src/android/support/v4/app/_ActionBarSherlockTrojanHorse.java [new file with mode: 0644]
android-libraries/ActionBarSherlock/src/com/actionbarsherlock/ActionBarSherlock.java
android-libraries/ActionBarSherlock/src/com/actionbarsherlock/app/SherlockActivity.java
android-libraries/ActionBarSherlock/src/com/actionbarsherlock/app/SherlockDialogFragment.java
android-libraries/ActionBarSherlock/src/com/actionbarsherlock/app/SherlockExpandableListActivity.java
android-libraries/ActionBarSherlock/src/com/actionbarsherlock/app/SherlockFragment.java
android-libraries/ActionBarSherlock/src/com/actionbarsherlock/app/SherlockFragmentActivity.java
android-libraries/ActionBarSherlock/src/com/actionbarsherlock/app/SherlockListActivity.java
android-libraries/ActionBarSherlock/src/com/actionbarsherlock/app/SherlockListFragment.java
android-libraries/ActionBarSherlock/src/com/actionbarsherlock/app/SherlockPreferenceActivity.java
android-libraries/ActionBarSherlock/src/com/actionbarsherlock/internal/ActionBarSherlockCompat.java
android-libraries/ActionBarSherlock/src/com/actionbarsherlock/internal/app/ActionBarWrapper.java
android-libraries/ActionBarSherlock/src/com/actionbarsherlock/internal/nineoldandroids/view/animation/AnimatorProxy.java
android-libraries/ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/MenuItemMule.java [deleted file]
android-libraries/ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/MenuMule.java [deleted file]

index 36ad7944040d522b57d046d7efd398e988b736e1..c4a75f32c28a22de256fe7924a8f954356649641 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="60" android:versionName="4.0.2" package="com.actionbarsherlock">
-       
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="90" android:versionName="4.1.0" package="com.actionbarsherlock">
+
     <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="15"/>
 
 </manifest>
index 1bddf7eb9051d07c58b07affcddd177acd363ffd..02f36678bbbaef6fe5235e8e75d6a8827d916640 100644 (file)
Binary files a/android-libraries/ActionBarSherlock/bin/actionbarsherlock.jar and b/android-libraries/ActionBarSherlock/bin/actionbarsherlock.jar differ
diff --git a/android-libraries/ActionBarSherlock/bin/classes/com/actionbarsherlock/internal/view/menu/MenuItemMule.class b/android-libraries/ActionBarSherlock/bin/classes/com/actionbarsherlock/internal/view/menu/MenuItemMule.class
deleted file mode 100644 (file)
index 028c621..0000000
Binary files a/android-libraries/ActionBarSherlock/bin/classes/com/actionbarsherlock/internal/view/menu/MenuItemMule.class and /dev/null differ
diff --git a/android-libraries/ActionBarSherlock/bin/classes/com/actionbarsherlock/internal/view/menu/MenuMule.class b/android-libraries/ActionBarSherlock/bin/classes/com/actionbarsherlock/internal/view/menu/MenuMule.class
deleted file mode 100644 (file)
index 0818741..0000000
Binary files a/android-libraries/ActionBarSherlock/bin/classes/com/actionbarsherlock/internal/view/menu/MenuMule.class and /dev/null differ
index fec2d6168dfba0670be135e57f6b0d9528eaa8f5..5ca7d6247a65da26ded588384775a78764af6dc0 100644 (file)
@@ -3,13 +3,10 @@
 #
 # This file must be checked in Version Control Systems.
 #
-# To customize properties used by the Ant build system edit
+# To customize properties used by the Ant build system use,
 # "ant.properties", and override values to adapt the script to your
 # project structure.
-#
-# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
-#proguard.config=${sdk.dir}\tools\proguard\proguard-android.txt:proguard-project.txt
 
-# Project target.
-target=android-15
 android.library=true
+# Project target.
+target=android-14
diff --git a/android-libraries/ActionBarSherlock/src/android/support/v4/app/_ActionBarSherlockTrojanHorse.java b/android-libraries/ActionBarSherlock/src/android/support/v4/app/_ActionBarSherlockTrojanHorse.java
new file mode 100644 (file)
index 0000000..3e3db62
--- /dev/null
@@ -0,0 +1,144 @@
+package android.support.v4.app;
+
+import android.util.Log;
+import android.view.View;
+import android.view.Window;
+import com.actionbarsherlock.ActionBarSherlock.OnCreatePanelMenuListener;
+import com.actionbarsherlock.ActionBarSherlock.OnMenuItemSelectedListener;
+import com.actionbarsherlock.ActionBarSherlock.OnPreparePanelListener;
+import com.actionbarsherlock.view.Menu;
+import com.actionbarsherlock.view.MenuInflater;
+import com.actionbarsherlock.view.MenuItem;
+
+import java.util.ArrayList;
+
+/** I'm in ur package. Stealing ur variables. */
+public abstract class _ActionBarSherlockTrojanHorse extends FragmentActivity implements OnCreatePanelMenuListener, OnPreparePanelListener, OnMenuItemSelectedListener {
+    private static final boolean DEBUG = false;
+    private static final String TAG = "_ActionBarSherlockTrojanHorse";
+
+    /** Fragment interface for menu creation callback. */
+    public interface OnCreateOptionsMenuListener {
+        public void onCreateOptionsMenu(Menu menu, MenuInflater inflater);
+    }
+    /** Fragment interface for menu preparation callback. */
+    public interface OnPrepareOptionsMenuListener {
+        public void onPrepareOptionsMenu(Menu menu);
+    }
+    /** Fragment interface for menu item selection callback. */
+    public interface OnOptionsItemSelectedListener {
+      public boolean onOptionsItemSelected(MenuItem item);
+    }
+
+    private ArrayList<Fragment> mCreatedMenus;
+
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Sherlock menu handling
+    ///////////////////////////////////////////////////////////////////////////
+
+    @Override
+    public boolean onCreatePanelMenu(int featureId, Menu menu) {
+        if (DEBUG) Log.d(TAG, "[onCreatePanelMenu] featureId: " + featureId + ", menu: " + menu);
+
+        if (featureId == Window.FEATURE_OPTIONS_PANEL) {
+            boolean result = onCreateOptionsMenu(menu);
+            if (DEBUG) Log.d(TAG, "[onCreatePanelMenu] activity create result: " + result);
+
+            MenuInflater inflater = getSupportMenuInflater();
+            boolean show = false;
+            ArrayList<Fragment> newMenus = null;
+            if (mFragments.mActive != null) {
+                for (int i = 0; i < mFragments.mAdded.size(); i++) {
+                    Fragment f = mFragments.mAdded.get(i);
+                    if (f != null && !f.mHidden && f.mHasMenu && f.mMenuVisible && f instanceof OnCreateOptionsMenuListener) {
+                        show = true;
+                        ((OnCreateOptionsMenuListener)f).onCreateOptionsMenu(menu, inflater);
+                        if (newMenus == null) {
+                            newMenus = new ArrayList<Fragment>();
+                        }
+                        newMenus.add(f);
+                    }
+                }
+            }
+
+            if (mCreatedMenus != null) {
+                for (int i = 0; i < mCreatedMenus.size(); i++) {
+                    Fragment f = mCreatedMenus.get(i);
+                    if (newMenus == null || !newMenus.contains(f)) {
+                        f.onDestroyOptionsMenu();
+                    }
+                }
+            }
+
+            mCreatedMenus = newMenus;
+
+            if (DEBUG) Log.d(TAG, "[onCreatePanelMenu] fragments create result: " + show);
+            result |= show;
+
+            if (DEBUG) Log.d(TAG, "[onCreatePanelMenu] returning " + result);
+            return result;
+        }
+        return false;
+    }
+
+    @Override
+    public boolean onPreparePanel(int featureId, View view, Menu menu) {
+        if (DEBUG) Log.d(TAG, "[onPreparePanel] featureId: " + featureId + ", view: " + view + " menu: " + menu);
+
+        if (featureId == Window.FEATURE_OPTIONS_PANEL) {
+            boolean result = onPrepareOptionsMenu(menu);
+            if (DEBUG) Log.d(TAG, "[onPreparePanel] activity prepare result: " + result);
+
+            boolean show = false;
+            if (mFragments.mActive != null) {
+                for (int i = 0; i < mFragments.mAdded.size(); i++) {
+                    Fragment f = mFragments.mAdded.get(i);
+                    if (f != null && !f.mHidden && f.mHasMenu && f.mMenuVisible && f instanceof OnPrepareOptionsMenuListener) {
+                        show = true;
+                        ((OnPrepareOptionsMenuListener)f).onPrepareOptionsMenu(menu);
+                    }
+                }
+            }
+
+            if (DEBUG) Log.d(TAG, "[onPreparePanel] fragments prepare result: " + show);
+            result |= show;
+
+            result &= menu.hasVisibleItems();
+            if (DEBUG) Log.d(TAG, "[onPreparePanel] returning " + result);
+            return result;
+        }
+        return false;
+    }
+
+    @Override
+    public boolean onMenuItemSelected(int featureId, MenuItem item) {
+        if (DEBUG) Log.d(TAG, "[onMenuItemSelected] featureId: " + featureId + ", item: " + item);
+
+        if (featureId == Window.FEATURE_OPTIONS_PANEL) {
+            if (onOptionsItemSelected(item)) {
+                return true;
+            }
+
+            if (mFragments.mActive != null) {
+                for (int i = 0; i < mFragments.mAdded.size(); i++) {
+                    Fragment f = mFragments.mAdded.get(i);
+                    if (f != null && !f.mHidden && f.mHasMenu && f.mMenuVisible && f instanceof OnOptionsItemSelectedListener) {
+                        if (((OnOptionsItemSelectedListener)f).onOptionsItemSelected(item)) {
+                            return true;
+                        }
+                    }
+                }
+            }
+        }
+        return false;
+    }
+
+    public abstract boolean onCreateOptionsMenu(Menu menu);
+
+    public abstract boolean onPrepareOptionsMenu(Menu menu);
+
+    public abstract boolean onOptionsItemSelected(MenuItem item);
+
+    public abstract MenuInflater getSupportMenuInflater();
+}
index a7cc25d3e0736c311ccb2bfa522791379234cda5..8340fb591bf855cf5799d408dd113987f43299e4 100644 (file)
@@ -523,6 +523,20 @@ public abstract class ActionBarSherlock {
      */\r
     public void dispatchPanelClosed(int featureId, android.view.Menu menu) {}\r
 \r
+    /**\r
+     * Notify the action bar that the activity has been destroyed. This method\r
+     * should be called before the superclass implementation.\r
+     *\r
+     * <blockquote><p>\r
+     * @Override\r
+     * public void onDestroy() {\r
+     *     mSherlock.dispatchDestroy();\r
+     *     super.onDestroy();\r
+     * }\r
+     * </p></blockquote>\r
+     */\r
+    public void dispatchDestroy() {}\r
+\r
 \r
     ///////////////////////////////////////////////////////////////////////////\r
     ///////////////////////////////////////////////////////////////////////////\r
index d0a6d81289d06a55119257f5c4972833d6240223..9cb57e95a2e6761f35f6ac3d622d5cdc2039ac3a 100644 (file)
@@ -76,6 +76,12 @@ public abstract class SherlockActivity extends Activity implements OnCreatePanel
         super.onStop();\r
     }\r
 \r
+    @Override\r
+    protected void onDestroy() {\r
+        getSherlock().dispatchDestroy();\r
+        super.onDestroy();\r
+    }\r
+\r
     @Override\r
     protected void onPostCreate(Bundle savedInstanceState) {\r
         getSherlock().dispatchPostCreate(savedInstanceState);\r
index 4172888cc5cd8efb4a34233482522af8666c3e7b..a7c856bf02f9a2c6602e9c551d78cf117570f03b 100644 (file)
@@ -1,18 +1,18 @@
 package com.actionbarsherlock.app;
 
-import static com.actionbarsherlock.app.SherlockFragmentActivity.DEBUG;
 import android.app.Activity;
 import android.support.v4.app.DialogFragment;
-import android.util.Log;
-import com.actionbarsherlock.internal.view.menu.MenuItemMule;
-import com.actionbarsherlock.internal.view.menu.MenuMule;
+import com.actionbarsherlock.internal.view.menu.MenuItemWrapper;
+import com.actionbarsherlock.internal.view.menu.MenuWrapper;
 import com.actionbarsherlock.view.Menu;
 import com.actionbarsherlock.view.MenuInflater;
 import com.actionbarsherlock.view.MenuItem;
 
-public class SherlockDialogFragment extends DialogFragment {
-    private static final String TAG = "SherlockDialogFragment";
+import static com.actionbarsherlock.app.SherlockFragmentActivity.OnCreateOptionsMenuListener;
+import static com.actionbarsherlock.app.SherlockFragmentActivity.OnOptionsItemSelectedListener;
+import static com.actionbarsherlock.app.SherlockFragmentActivity.OnPrepareOptionsMenuListener;
 
+public class SherlockDialogFragment extends DialogFragment implements OnCreateOptionsMenuListener, OnPrepareOptionsMenuListener, OnOptionsItemSelectedListener {
     private SherlockFragmentActivity mActivity;
 
     public SherlockFragmentActivity getSherlockActivity() {
@@ -22,7 +22,7 @@ public class SherlockDialogFragment extends DialogFragment {
     @Override
     public void onAttach(Activity activity) {
         if (!(activity instanceof SherlockFragmentActivity)) {
-            throw new IllegalStateException(TAG + " must be attached to a SherlockFragmentActivity.");
+            throw new IllegalStateException(getClass().getSimpleName() + " must be attached to a SherlockFragmentActivity.");
         }
         mActivity = (SherlockFragmentActivity)activity;
 
@@ -30,45 +30,37 @@ public class SherlockDialogFragment extends DialogFragment {
     }
 
     @Override
-    public final void onCreateOptionsMenu(android.view.Menu menu, android.view.MenuInflater inflater) {
-        if (DEBUG) Log.d(TAG, "[onCreateOptionsMenu] menu: " + menu + ", inflater: " + inflater);
+    public void onDetach() {
+        mActivity = null;
+        super.onDetach();
+    }
 
-        if (menu instanceof MenuMule) {
-            MenuMule mule = (MenuMule)menu;
-            mule.mDispatchShow = true;
-            onCreateOptionsMenu(mule.unwrap(), mActivity.getSupportMenuInflater());
-        }
+    @Override
+    public final void onCreateOptionsMenu(android.view.Menu menu, android.view.MenuInflater inflater) {
+        onCreateOptionsMenu(new MenuWrapper(menu), mActivity.getSupportMenuInflater());
     }
 
+    @Override
     public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
         //Nothing to see here.
     }
 
     @Override
     public final void onPrepareOptionsMenu(android.view.Menu menu) {
-        if (DEBUG) Log.d(TAG, "[onPrepareOptionsMenu] menu: " + menu);
-
-        if (menu instanceof MenuMule) {
-            MenuMule mule = (MenuMule)menu;
-            mule.mDispatchShow = true;
-            onPrepareOptionsMenu(mule.unwrap());
-        }
+        onPrepareOptionsMenu(new MenuWrapper(menu));
     }
 
+    @Override
     public void onPrepareOptionsMenu(Menu menu) {
         //Nothing to see here.
     }
 
     @Override
     public final boolean onOptionsItemSelected(android.view.MenuItem item) {
-        if (DEBUG) Log.d(TAG, "[onOptionsItemSelected] item: " + item);
-
-        if (item instanceof MenuItemMule) {
-            return onOptionsItemSelected(((MenuItemMule)item).unwrap());
-        }
-        return false;
+        return onOptionsItemSelected(new MenuItemWrapper(item));
     }
 
+    @Override
     public boolean onOptionsItemSelected(MenuItem item) {
         //Nothing to see here.
         return false;
index 3247c987c41fc516be5771c340a3bec1ffb2b606..078f9b0ca1605a5d8f18ee077c59b793eb8598cd 100644 (file)
@@ -76,6 +76,12 @@ public abstract class SherlockExpandableListActivity extends ExpandableListActiv
         super.onStop();\r
     }\r
 \r
+    @Override\r
+    protected void onDestroy() {\r
+        getSherlock().dispatchDestroy();\r
+        super.onDestroy();\r
+    }\r
+\r
     @Override\r
     protected void onPostCreate(Bundle savedInstanceState) {\r
         getSherlock().dispatchPostCreate(savedInstanceState);\r
index 10d673f9faf7ad7208a620c3ef160ac0cd53d603..0f24e9c85664c2851ef496bc94c8fe8e863aa75d 100644 (file)
@@ -1,18 +1,18 @@
 package com.actionbarsherlock.app;
 
-import static com.actionbarsherlock.app.SherlockFragmentActivity.DEBUG;
 import android.app.Activity;
 import android.support.v4.app.Fragment;
-import android.util.Log;
-import com.actionbarsherlock.internal.view.menu.MenuItemMule;
-import com.actionbarsherlock.internal.view.menu.MenuMule;
+import com.actionbarsherlock.internal.view.menu.MenuItemWrapper;
+import com.actionbarsherlock.internal.view.menu.MenuWrapper;
 import com.actionbarsherlock.view.Menu;
 import com.actionbarsherlock.view.MenuInflater;
 import com.actionbarsherlock.view.MenuItem;
 
-public class SherlockFragment extends Fragment {
-    private static final String TAG = "SherlockFragment";
+import static com.actionbarsherlock.app.SherlockFragmentActivity.OnCreateOptionsMenuListener;
+import static com.actionbarsherlock.app.SherlockFragmentActivity.OnOptionsItemSelectedListener;
+import static com.actionbarsherlock.app.SherlockFragmentActivity.OnPrepareOptionsMenuListener;
 
+public class SherlockFragment extends Fragment implements OnCreateOptionsMenuListener, OnPrepareOptionsMenuListener, OnOptionsItemSelectedListener {
     private SherlockFragmentActivity mActivity;
 
     public SherlockFragmentActivity getSherlockActivity() {
@@ -22,7 +22,7 @@ public class SherlockFragment extends Fragment {
     @Override
     public void onAttach(Activity activity) {
         if (!(activity instanceof SherlockFragmentActivity)) {
-            throw new IllegalStateException(TAG + " must be attached to a SherlockFragmentActivity.");
+            throw new IllegalStateException(getClass().getSimpleName() + " must be attached to a SherlockFragmentActivity.");
         }
         mActivity = (SherlockFragmentActivity)activity;
 
@@ -30,45 +30,37 @@ public class SherlockFragment extends Fragment {
     }
 
     @Override
-    public final void onCreateOptionsMenu(android.view.Menu menu, android.view.MenuInflater inflater) {
-        if (DEBUG) Log.d(TAG, "[onCreateOptionsMenu] menu: " + menu + ", inflater: " + inflater);
+    public void onDetach() {
+        mActivity = null;
+        super.onDetach();
+    }
 
-        if (menu instanceof MenuMule) {
-            MenuMule mule = (MenuMule)menu;
-            mule.mDispatchShow = true;
-            onCreateOptionsMenu(mule.unwrap(), mActivity.getSupportMenuInflater());
-        }
+    @Override
+    public final void onCreateOptionsMenu(android.view.Menu menu, android.view.MenuInflater inflater) {
+        onCreateOptionsMenu(new MenuWrapper(menu), mActivity.getSupportMenuInflater());
     }
 
+    @Override
     public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
         //Nothing to see here.
     }
 
     @Override
     public final void onPrepareOptionsMenu(android.view.Menu menu) {
-        if (DEBUG) Log.d(TAG, "[onPrepareOptionsMenu] menu: " + menu);
-
-        if (menu instanceof MenuMule) {
-            MenuMule mule = (MenuMule)menu;
-            mule.mDispatchShow = true;
-            onPrepareOptionsMenu(mule.unwrap());
-        }
+        onPrepareOptionsMenu(new MenuWrapper(menu));
     }
 
+    @Override
     public void onPrepareOptionsMenu(Menu menu) {
         //Nothing to see here.
     }
 
     @Override
     public final boolean onOptionsItemSelected(android.view.MenuItem item) {
-        if (DEBUG) Log.d(TAG, "[onOptionsItemSelected] item: " + item);
-
-        if (item instanceof MenuItemMule) {
-            return onOptionsItemSelected(((MenuItemMule)item).unwrap());
-        }
-        return false;
+        return onOptionsItemSelected(new MenuItemWrapper(item));
     }
 
+    @Override
     public boolean onOptionsItemSelected(MenuItem item) {
         //Nothing to see here.
         return false;
index 49a5c6ca9e6f09f83a9985c962448fbc7e46cf7c..5cd13ba7cbd96f5f2bab6305f29686979ab8ad78 100644 (file)
@@ -2,27 +2,24 @@ package com.actionbarsherlock.app;
 
 import android.content.res.Configuration;
 import android.os.Bundle;
-import android.support.v4.app.FragmentActivity;
+import android.support.v4.app._ActionBarSherlockTrojanHorse;
 import android.util.Log;
 import android.view.KeyEvent;
 import android.view.View;
 import android.view.ViewGroup.LayoutParams;
 import android.view.Window;
 import com.actionbarsherlock.ActionBarSherlock;
-import com.actionbarsherlock.ActionBarSherlock.OnActionModeFinishedListener;
-import com.actionbarsherlock.ActionBarSherlock.OnActionModeStartedListener;
-import com.actionbarsherlock.ActionBarSherlock.OnCreatePanelMenuListener;
-import com.actionbarsherlock.ActionBarSherlock.OnMenuItemSelectedListener;
-import com.actionbarsherlock.ActionBarSherlock.OnPreparePanelListener;
-import com.actionbarsherlock.internal.view.menu.MenuItemMule;
-import com.actionbarsherlock.internal.view.menu.MenuMule;
 import com.actionbarsherlock.view.ActionMode;
 import com.actionbarsherlock.view.Menu;
 import com.actionbarsherlock.view.MenuInflater;
 import com.actionbarsherlock.view.MenuItem;
 
-public abstract class SherlockFragmentActivity extends FragmentActivity implements OnCreatePanelMenuListener, OnPreparePanelListener, OnMenuItemSelectedListener, OnActionModeStartedListener, OnActionModeFinishedListener {
-    static final boolean DEBUG = false;
+import static com.actionbarsherlock.ActionBarSherlock.OnActionModeFinishedListener;
+import static com.actionbarsherlock.ActionBarSherlock.OnActionModeStartedListener;
+
+/** @see {@link _ActionBarSherlockTrojanHorse} */
+public class SherlockFragmentActivity extends _ActionBarSherlockTrojanHorse implements OnActionModeStartedListener, OnActionModeFinishedListener {
+    private static final boolean DEBUG = false;
     private static final String TAG = "SherlockFragmentActivity";
 
     private ActionBarSherlock mSherlock;
@@ -85,6 +82,12 @@ public abstract class SherlockFragmentActivity extends FragmentActivity implemen
         super.onStop();
     }
 
+    @Override
+    protected void onDestroy() {
+        getSherlock().dispatchDestroy();
+        super.onDestroy();
+    }
+
     @Override
     protected void onPostCreate(Bundle savedInstanceState) {
         getSherlock().dispatchPostCreate(savedInstanceState);
@@ -221,75 +224,14 @@ public abstract class SherlockFragmentActivity extends FragmentActivity implemen
     // Sherlock menu handling
     ///////////////////////////////////////////////////////////////////////////
 
-    @Override
-    public boolean onCreatePanelMenu(int featureId, Menu menu) {
-        if (DEBUG) Log.d(TAG, "[onCreatePanelMenu] featureId: " + featureId + ", menu: " + menu);
-
-        if (featureId == Window.FEATURE_OPTIONS_PANEL) {
-            boolean result = onCreateOptionsMenu(menu);
-            if (DEBUG) Log.d(TAG, "[onCreatePanelMenu] activity create result: " + result);
-
-            //Dispatch to parent panel creation for fragment dispatching
-            if (DEBUG) Log.d(TAG, "[onCreatePanelMenu] dispatching to native with mule");
-            MenuMule mule = new MenuMule(menu);
-            super.onCreatePanelMenu(featureId, mule);
-
-            if (DEBUG) Log.d(TAG, "[onCreatePanelMenu] fragments create result: " + mule.mDispatchShow);
-            result |= mule.mDispatchShow;
-
-            if (DEBUG) Log.d(TAG, "[onCreatePanelMenu] returning " + result);
-            return result;
-        }
-        return false;
-    }
-
     public boolean onCreateOptionsMenu(Menu menu) {
         return true;
     }
 
-    @Override
-    public boolean onPreparePanel(int featureId, View view, Menu menu) {
-        if (DEBUG) Log.d(TAG, "[onPreparePanel] featureId: " + featureId + ", view: " + view + " menu: " + menu);
-
-        if (featureId == Window.FEATURE_OPTIONS_PANEL) {
-            boolean result = onPrepareOptionsMenu(menu);
-            if (DEBUG) Log.d(TAG, "[onPreparePanel] activity prepare result: " + result);
-
-            //Dispatch to parent panel preparation for fragment dispatching
-            if (DEBUG) Log.d(TAG, "[onPreparePanel] dispatching to native with mule");
-            MenuMule mule = new MenuMule(menu);
-            super.onPreparePanel(featureId, view, mule);
-
-            if (DEBUG) Log.d(TAG, "[onPreparePanel] fragments prepare result: " + mule.mDispatchShow);
-            result |= mule.mDispatchShow;
-
-            result &= menu.hasVisibleItems();
-            if (DEBUG) Log.d(TAG, "[onPreparePanel] returning " + result);
-            return result;
-        }
-        return false;
-    }
-
     public boolean onPrepareOptionsMenu(Menu menu) {
         return true;
     }
 
-    @Override
-    public boolean onMenuItemSelected(int featureId, MenuItem item) {
-        if (DEBUG) Log.d(TAG, "[onMenuItemSelected] featureId: " + featureId + ", item: " + item);
-
-        if (featureId == Window.FEATURE_OPTIONS_PANEL) {
-            if (onOptionsItemSelected(item)) {
-                return true;
-            }
-
-            //Dispatch to parent panel selection for fragment dispatching
-            if (DEBUG) Log.d(TAG, "[onMenuItemSelected] dispatching to native with mule");
-            return super.onMenuItemSelected(featureId, new MenuItemMule(item));
-        }
-        return false;
-    }
-
     public boolean onOptionsItemSelected(MenuItem item) {
         return false;
     }
index 83114c3aacf38af8127d382979477cce072878e8..00c00fee52e3139477eaa9fec5b84cfcb21a49e4 100644 (file)
@@ -76,6 +76,12 @@ public abstract class SherlockListActivity extends ListActivity implements OnCre
         super.onStop();\r
     }\r
 \r
+    @Override\r
+    protected void onDestroy() {\r
+        getSherlock().dispatchDestroy();\r
+        super.onDestroy();\r
+    }\r
+\r
     @Override\r
     protected void onPostCreate(Bundle savedInstanceState) {\r
         getSherlock().dispatchPostCreate(savedInstanceState);\r
index 03a312b353adff5b9dcef0b8eb59283f20dbc1d1..13ca3c49fb9dd2f47f0ad1e44f128e218ae79a51 100644 (file)
@@ -1,18 +1,18 @@
 package com.actionbarsherlock.app;
 
-import static com.actionbarsherlock.app.SherlockFragmentActivity.DEBUG;
 import android.app.Activity;
 import android.support.v4.app.ListFragment;
-import android.util.Log;
-import com.actionbarsherlock.internal.view.menu.MenuItemMule;
-import com.actionbarsherlock.internal.view.menu.MenuMule;
+import com.actionbarsherlock.internal.view.menu.MenuItemWrapper;
+import com.actionbarsherlock.internal.view.menu.MenuWrapper;
 import com.actionbarsherlock.view.Menu;
 import com.actionbarsherlock.view.MenuInflater;
 import com.actionbarsherlock.view.MenuItem;
 
-public class SherlockListFragment extends ListFragment {
-    private static final String TAG = "SherlockListFragment";
+import static com.actionbarsherlock.app.SherlockFragmentActivity.OnCreateOptionsMenuListener;
+import static com.actionbarsherlock.app.SherlockFragmentActivity.OnOptionsItemSelectedListener;
+import static com.actionbarsherlock.app.SherlockFragmentActivity.OnPrepareOptionsMenuListener;
 
+public class SherlockListFragment extends ListFragment implements OnCreateOptionsMenuListener, OnPrepareOptionsMenuListener, OnOptionsItemSelectedListener {
     private SherlockFragmentActivity mActivity;
 
     public SherlockFragmentActivity getSherlockActivity() {
@@ -22,7 +22,7 @@ public class SherlockListFragment extends ListFragment {
     @Override
     public void onAttach(Activity activity) {
         if (!(activity instanceof SherlockFragmentActivity)) {
-            throw new IllegalStateException(TAG + " must be attached to a SherlockFragmentActivity.");
+            throw new IllegalStateException(getClass().getSimpleName() + " must be attached to a SherlockFragmentActivity.");
         }
         mActivity = (SherlockFragmentActivity)activity;
 
@@ -30,45 +30,37 @@ public class SherlockListFragment extends ListFragment {
     }
 
     @Override
-    public final void onCreateOptionsMenu(android.view.Menu menu, android.view.MenuInflater inflater) {
-        if (DEBUG) Log.d(TAG, "[onCreateOptionsMenu] menu: " + menu + ", inflater: " + inflater);
+    public void onDetach() {
+        mActivity = null;
+        super.onDetach();
+    }
 
-        if (menu instanceof MenuMule) {
-            MenuMule mule = (MenuMule)menu;
-            mule.mDispatchShow = true;
-            onCreateOptionsMenu(mule.unwrap(), mActivity.getSupportMenuInflater());
-        }
+    @Override
+    public final void onCreateOptionsMenu(android.view.Menu menu, android.view.MenuInflater inflater) {
+        onCreateOptionsMenu(new MenuWrapper(menu), mActivity.getSupportMenuInflater());
     }
 
+    @Override
     public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
         //Nothing to see here.
     }
 
     @Override
     public final void onPrepareOptionsMenu(android.view.Menu menu) {
-        if (DEBUG) Log.d(TAG, "[onPrepareOptionsMenu] menu: " + menu);
-
-        if (menu instanceof MenuMule) {
-            MenuMule mule = (MenuMule)menu;
-            mule.mDispatchShow = true;
-            onPrepareOptionsMenu(mule.unwrap());
-        }
+        onPrepareOptionsMenu(new MenuWrapper(menu));
     }
 
+    @Override
     public void onPrepareOptionsMenu(Menu menu) {
         //Nothing to see here.
     }
 
     @Override
     public final boolean onOptionsItemSelected(android.view.MenuItem item) {
-        if (DEBUG) Log.d(TAG, "[onOptionsItemSelected] item: " + item);
-
-        if (item instanceof MenuItemMule) {
-            return onOptionsItemSelected(((MenuItemMule)item).unwrap());
-        }
-        return false;
+        return onOptionsItemSelected(new MenuItemWrapper(item));
     }
 
+    @Override
     public boolean onOptionsItemSelected(MenuItem item) {
         //Nothing to see here.
         return false;
index 71e40300a1fb63f05cefd5f5c64b575e2a6680dd..4f80be5152c77db27e3cc87082b3de564d5c4b8f 100644 (file)
@@ -76,6 +76,12 @@ public abstract class SherlockPreferenceActivity extends PreferenceActivity impl
         super.onStop();\r
     }\r
 \r
+    @Override\r
+    protected void onDestroy() {\r
+        getSherlock().dispatchDestroy();\r
+        super.onDestroy();\r
+    }\r
+\r
     @Override\r
     protected void onPostCreate(Bundle savedInstanceState) {\r
         getSherlock().dispatchPostCreate(savedInstanceState);\r
index f080bfe95f9b038e48c206e57fda54d812c61adf..05353d28ca80fdf91cb91a01baf458911cd84a3f 100644 (file)
@@ -81,6 +81,8 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
 
     /** Whether or not the title is stable and can be displayed. */
     private boolean mIsTitleReady = false;
+    /** Whether or not the parent activity has been destroyed. */
+    private boolean mIsDestroyed = false;
 
     /* Emulate PanelFeatureState */
     private boolean mClosingActionMenu;
@@ -413,7 +415,7 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
             }
 
             // Next collapse any expanded action views.
-            if (aActionBar != null && wActionBar.hasExpandedActionView()) {
+            if (wActionBar != null && wActionBar.hasExpandedActionView()) {
                 if (action == KeyEvent.ACTION_UP) {
                     wActionBar.collapseActionView();
                 }
@@ -428,7 +430,7 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
                 mMenuKeyIsLongPress = true;
             } else if (event.getAction() == KeyEvent.ACTION_UP) {
                 if (!mMenuKeyIsLongPress) {
-                    if (mActionMode == null) {
+                    if (mActionMode == null && wActionBar != null) {
                         if (wActionBar.isOverflowMenuShowing()) {
                             wActionBar.hideOverflowMenu();
                         } else {
@@ -445,6 +447,11 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
         return result;
     }
 
+    @Override
+    public void dispatchDestroy() {
+        mIsDestroyed = true;
+    }
+
 
     ///////////////////////////////////////////////////////////////////////////
     // Menu callback lifecycle and creation
@@ -977,7 +984,7 @@ public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBu
                         @Override
                         public void run() {
                             //Invalidate if the panel menu hasn't been created before this.
-                            if (!mActivity.isFinishing() && mMenu == null) {
+                            if (!mIsDestroyed && !mActivity.isFinishing() && mMenu == null) {
                                 dispatchInvalidateOptionsMenu();
                             }
                         }
index 1bd0eaccb7f14fc7997966856d4b2635022c1fa4..e390ea42844850b6462caf90d57bc57313b42b64 100644 (file)
@@ -217,7 +217,6 @@ public class ActionBarWrapper extends ActionBar implements android.app.ActionBar
         public TabWrapper(android.app.ActionBar.Tab nativeTab) {
             mNativeTab = nativeTab;
             mNativeTab.setTag(this);
-            mNativeTab.setTabListener(this);
         }
 
         @Override
@@ -289,6 +288,7 @@ public class ActionBarWrapper extends ActionBar implements android.app.ActionBar
 
         @Override
         public Tab setTabListener(TabListener listener) {
+            mNativeTab.setTabListener(listener != null ? this : null);
             mListener = listener;
             return this;
         }
index e284604bb35e69ca87124dc9ce7de167adc806e6..067d0494ee784a49001d43ec0662a5a471a3cd4d 100644 (file)
@@ -140,6 +140,8 @@ public final class AnimatorProxy extends Animation {
             return;
         }
 
+        view.setAnimation(this);
+
         final RectF after = mAfter;
         computeRect(after, view);
         after.union(mBefore);
@@ -202,4 +204,9 @@ public final class AnimatorProxy extends Animation {
             transformMatrix(t.getMatrix(), view);
         }
     }
+
+    @Override
+    public void reset() {
+        /* Do nothing. */
+    }
 }
diff --git a/android-libraries/ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/MenuItemMule.java b/android-libraries/ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/MenuItemMule.java
deleted file mode 100644 (file)
index 5a80998..0000000
+++ /dev/null
@@ -1,234 +0,0 @@
-package com.actionbarsherlock.internal.view.menu;
-
-import android.content.Intent;
-import android.graphics.drawable.Drawable;
-import android.view.ActionProvider;
-import android.view.MenuItem;
-import android.view.SubMenu;
-import android.view.View;
-import android.view.ContextMenu.ContextMenuInfo;
-
-/** Used to carry an instance of our version of MenuItem through a native channel. */
-public class MenuItemMule implements MenuItem {
-    private static final String ERROR = "Cannot interact with object designed for temporary "
-            + "instance passing. Make sure you using both SherlockFragmentActivity and "
-            + "SherlockFragment.";
-
-
-    private final com.actionbarsherlock.view.MenuItem mItem;
-
-    public MenuItemMule(com.actionbarsherlock.view.MenuItem item) {
-        mItem = item;
-    }
-
-    public com.actionbarsherlock.view.MenuItem unwrap() {
-        return mItem;
-    }
-
-
-    @Override
-    public boolean collapseActionView() {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public boolean expandActionView() {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public ActionProvider getActionProvider() {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public View getActionView() {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public char getAlphabeticShortcut() {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public int getGroupId() {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public Drawable getIcon() {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public Intent getIntent() {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public int getItemId() {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public ContextMenuInfo getMenuInfo() {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public char getNumericShortcut() {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public int getOrder() {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public SubMenu getSubMenu() {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public CharSequence getTitle() {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public CharSequence getTitleCondensed() {
-        return mItem.getTitleCondensed();
-        //throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public boolean hasSubMenu() {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public boolean isActionViewExpanded() {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public boolean isCheckable() {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public boolean isChecked() {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public boolean isEnabled() {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public boolean isVisible() {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public MenuItem setActionProvider(ActionProvider arg0) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public MenuItem setActionView(View arg0) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public MenuItem setActionView(int arg0) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public MenuItem setAlphabeticShortcut(char arg0) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public MenuItem setCheckable(boolean arg0) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public MenuItem setChecked(boolean arg0) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public MenuItem setEnabled(boolean arg0) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public MenuItem setIcon(Drawable arg0) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public MenuItem setIcon(int arg0) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public MenuItem setIntent(Intent arg0) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public MenuItem setNumericShortcut(char arg0) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public MenuItem setOnActionExpandListener(OnActionExpandListener arg0) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public MenuItem setOnMenuItemClickListener(OnMenuItemClickListener arg0) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public MenuItem setShortcut(char arg0, char arg1) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public void setShowAsAction(int arg0) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public MenuItem setShowAsActionFlags(int arg0) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public MenuItem setTitle(CharSequence arg0) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public MenuItem setTitle(int arg0) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public MenuItem setTitleCondensed(CharSequence arg0) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public MenuItem setVisible(boolean arg0) {
-        throw new IllegalStateException(ERROR);
-    }
-}
diff --git a/android-libraries/ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/MenuMule.java b/android-libraries/ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/MenuMule.java
deleted file mode 100644 (file)
index b2385b9..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-package com.actionbarsherlock.internal.view.menu;
-
-import android.content.ComponentName;
-import android.content.Intent;
-import android.view.KeyEvent;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.SubMenu;
-
-/** Used to carry an instance of our version of Menu through a native channel. */
-public class MenuMule implements Menu {
-    private static final String ERROR = "Cannot interact with object designed for temporary "
-            + "instance passing. Make sure you using both SherlockFragmentActivity and "
-            + "SherlockFragment.";
-
-
-    private final com.actionbarsherlock.view.Menu mMenu;
-    public boolean mDispatchShow = false;
-
-    public MenuMule(com.actionbarsherlock.view.Menu menu) {
-        mMenu = menu;
-    }
-
-    public com.actionbarsherlock.view.Menu unwrap() {
-        return mMenu;
-    }
-
-
-    @Override
-    public MenuItem add(CharSequence arg0) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public MenuItem add(int arg0) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public MenuItem add(int arg0, int arg1, int arg2, CharSequence arg3) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public MenuItem add(int arg0, int arg1, int arg2, int arg3) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public int addIntentOptions(int arg0, int arg1, int arg2,
-            ComponentName arg3, Intent[] arg4, Intent arg5, int arg6,
-            MenuItem[] arg7) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public SubMenu addSubMenu(CharSequence arg0) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public SubMenu addSubMenu(int arg0) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public SubMenu addSubMenu(int arg0, int arg1, int arg2, CharSequence arg3) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public SubMenu addSubMenu(int arg0, int arg1, int arg2, int arg3) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public void clear() {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public void close() {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public MenuItem findItem(int arg0) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public MenuItem getItem(int arg0) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public boolean hasVisibleItems() {
-        return mMenu.hasVisibleItems();
-        //throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public boolean isShortcutKey(int arg0, KeyEvent arg1) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public boolean performIdentifierAction(int arg0, int arg1) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public boolean performShortcut(int arg0, KeyEvent arg1, int arg2) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public void removeGroup(int arg0) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public void removeItem(int arg0) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public void setGroupCheckable(int arg0, boolean arg1, boolean arg2) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public void setGroupEnabled(int arg0, boolean arg1) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public void setGroupVisible(int arg0, boolean arg1) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public void setQwertyMode(boolean arg0) {
-        throw new IllegalStateException(ERROR);
-    }
-
-    @Override
-    public int size() {
-        throw new IllegalStateException(ERROR);
-    }
-}