/** * Start the dialog and display it on screen. The window is placed in the application layer and * opaque. Note that you should not override this method to do initialization when the dialog is * shown, instead implement that in {@link #onStart}. */ public void show() { if (mShowing) { if (mDecor != null) { mDecor.setVisibility(View.VISIBLE); } return; } if (!mCreated) { dispatchOnCreate(null); } onStart(); mDecor = mWindow.getDecorView(); // MayLoon: Let the dialog on top of the current Activity. mDecor.zIndex = mContext.getActivityManager().mCurActivity.mZIndex + 1; WindowManager.LayoutParams l = mWindow.getAttributes(); if ((l.softInputMode & WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION) == 0) { WindowManager.LayoutParams nl = new WindowManager.LayoutParams(); nl.copyFrom(l); nl.softInputMode |= WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION; l = nl; } try { mWindowManager.addView(mDecor, l); mShowing = true; ViewRoot.mDialogCount += 1; sendShowMessage(); } finally { } }
/** * Restore the state of the dialog from a previously saved bundle. * * <p>The default implementation restores the state of the dialog's view hierarchy that was saved * in the default implementation of {@link #onSaveInstanceState()}, so be sure to call through to * super when overriding unless you want to do all restoring of state yourself. * * @param savedInstanceState The state of the dialog previously saved by {@link * #onSaveInstanceState()}. */ public void onRestoreInstanceState(Bundle savedInstanceState) { final Bundle dialogHierarchyState = savedInstanceState.getBundle(DIALOG_HIERARCHY_TAG); if (dialogHierarchyState == null) { // dialog has never been shown, or onCreated, nothing to restore. return; } dispatchOnCreate(savedInstanceState); mWindow.restoreHierarchyState(dialogHierarchyState); if (savedInstanceState.getBoolean(DIALOG_SHOWING_TAG)) { show(); } }
/** * Start the dialog and display it on screen. The window is placed in the application layer and * opaque. Note that you should not override this method to do initialization when the dialog is * shown, instead implement that in {@link #onStart}. */ public void show() { if (mShowing) { if (mDecor != null) { if (mWindow.hasFeature(Window.FEATURE_ACTION_BAR)) { mWindow.invalidatePanelMenu(Window.FEATURE_ACTION_BAR); } mDecor.setVisibility(View.VISIBLE); } return; } mCanceled = false; if (!mCreated) { dispatchOnCreate(null); } onStart(); mDecor = mWindow.getDecorView(); if (mActionBar == null && mWindow.hasFeature(Window.FEATURE_ACTION_BAR)) { final ApplicationInfo info = mContext.getApplicationInfo(); mWindow.setDefaultIcon(info.icon); mWindow.setDefaultLogo(info.logo); mActionBar = new WindowDecorActionBar(this); } WindowManager.LayoutParams l = mWindow.getAttributes(); if ((l.softInputMode & WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION) == 0) { WindowManager.LayoutParams nl = new WindowManager.LayoutParams(); nl.copyFrom(l); nl.softInputMode |= WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION; l = nl; } try { mWindowManager.addView(mDecor, l); mShowing = true; Log.d(TAG, "show"); sendShowMessage(); } finally { } }
/** * Forces immediate creation of the dialog. * * <p>Note that you should not override this method to perform dialog creation. Rather, override * {@link #onCreate(Bundle)}. */ public void create() { if (!mCreated) { dispatchOnCreate(null); } }