X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=android-libraries%2FActionBarSherlock%2Fsrc%2Fcom%2Factionbarsherlock%2Fapp%2FSherlockDialogFragment.java;h=a7c856bf02f9a2c6602e9c551d78cf117570f03b;hb=09239de58836db2ec2417a602b45667b7f69d323;hp=4172888cc5cd8efb4a34233482522af8666c3e7b;hpb=907e5f821880bb0ba39f4cddeb3dfa05f3dfd83b;p=debian%2Fopenrocket diff --git a/android-libraries/ActionBarSherlock/src/com/actionbarsherlock/app/SherlockDialogFragment.java b/android-libraries/ActionBarSherlock/src/com/actionbarsherlock/app/SherlockDialogFragment.java index 4172888c..a7c856bf 100644 --- a/android-libraries/ActionBarSherlock/src/com/actionbarsherlock/app/SherlockDialogFragment.java +++ b/android-libraries/ActionBarSherlock/src/com/actionbarsherlock/app/SherlockDialogFragment.java @@ -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;