am ed31bbf6: Clean up some edge cases in the compat mode UI:

* commit 'ed31bbf65267c1f383dd0dff37acd034f3b9b59f':
  Clean up some edge cases in the compat mode UI:
This commit is contained in:
Dianne Hackborn
2011-06-15 12:35:57 -07:00
committed by Android Git Automerger
2 changed files with 29 additions and 9 deletions

View File

@@ -107,9 +107,14 @@ public class CompatModePanel extends FrameLayout implements StatusBarPanel,
private void refresh() { private void refresh() {
int mode = mAM.getFrontActivityScreenCompatMode(); int mode = mAM.getFrontActivityScreenCompatMode();
if (mode == ActivityManager.COMPAT_MODE_ALWAYS
|| mode == ActivityManager.COMPAT_MODE_NEVER) {
// No longer have something to switch.
closePanel();
return;
}
final boolean on = (mode == ActivityManager.COMPAT_MODE_ENABLED); final boolean on = (mode == ActivityManager.COMPAT_MODE_ENABLED);
mOnButton.setChecked(on); mOnButton.setChecked(on);
mOffButton.setChecked(!on); mOffButton.setChecked(!on);
} }
} }

View File

@@ -165,6 +165,8 @@ public class TabletStatusBar extends StatusBar implements
View mFakeSpaceBar; View mFakeSpaceBar;
KeyEvent mSpaceBarKeyEvent = null; KeyEvent mSpaceBarKeyEvent = null;
View mCompatibilityHelpDialog = null;
// for disabling the status bar // for disabling the status bar
int mDisabled = 0; int mDisabled = 0;
@@ -1012,17 +1014,27 @@ public class TabletStatusBar extends StatusBar implements
if (! Prefs.read(mContext).getBoolean(Prefs.SHOWN_COMPAT_MODE_HELP, false)) { if (! Prefs.read(mContext).getBoolean(Prefs.SHOWN_COMPAT_MODE_HELP, false)) {
showCompatibilityHelp(); showCompatibilityHelp();
} }
} else {
hideCompatibilityHelp();
mCompatModePanel.closePanel();
} }
} }
private void showCompatibilityHelp() { private void showCompatibilityHelp() {
final View dlg = View.inflate(mContext, R.layout.compat_mode_help, null); if (mCompatibilityHelpDialog != null) {
View button = dlg.findViewById(R.id.button); return;
}
mCompatibilityHelpDialog = View.inflate(mContext, R.layout.compat_mode_help, null);
View button = mCompatibilityHelpDialog.findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() { button.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
WindowManagerImpl.getDefault().removeView(dlg); hideCompatibilityHelp();
SharedPreferences.Editor editor = Prefs.edit(mContext);
editor.putBoolean(Prefs.SHOWN_COMPAT_MODE_HELP, true);
editor.apply();
} }
}); });
@@ -1039,13 +1051,16 @@ public class TabletStatusBar extends StatusBar implements
| WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING; | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING;
lp.windowAnimations = com.android.internal.R.style.Animation_ZoomButtons; // simple fade lp.windowAnimations = com.android.internal.R.style.Animation_ZoomButtons; // simple fade
WindowManagerImpl.getDefault().addView(dlg, lp); WindowManagerImpl.getDefault().addView(mCompatibilityHelpDialog, lp);
SharedPreferences.Editor editor = Prefs.edit(mContext);
editor.putBoolean(Prefs.SHOWN_COMPAT_MODE_HELP, true);
editor.apply();
} }
private void hideCompatibilityHelp() {
if (mCompatibilityHelpDialog != null) {
WindowManagerImpl.getDefault().removeView(mCompatibilityHelpDialog);
mCompatibilityHelpDialog = null;
}
}
public void setImeWindowStatus(IBinder token, int vis, int backDisposition) { public void setImeWindowStatus(IBinder token, int vis, int backDisposition) {
mInputMethodSwitchButton.setImeWindowStatus(token, mInputMethodSwitchButton.setImeWindowStatus(token,
(vis & InputMethodService.IME_ACTIVE) != 0); (vis & InputMethodService.IME_ACTIVE) != 0);