Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit abfb5f95 authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android Git Automerger
Browse files

am 27f889d0: am 3dc1b5e2: am ed31bbf6: Clean up some edge cases in the compat mode UI:

* commit '27f889d0':
  Clean up some edge cases in the compat mode UI:
parents 181aafd7 27f889d0
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -107,9 +107,14 @@ public class CompatModePanel extends FrameLayout implements StatusBarPanel,

    private void refresh() {
        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);
        mOnButton.setChecked(on);
        mOffButton.setChecked(!on);
    }

}
+23 −8
Original line number Diff line number Diff line
@@ -166,6 +166,8 @@ public class TabletStatusBar extends StatusBar implements
    View mFakeSpaceBar;
    KeyEvent mSpaceBarKeyEvent = null;

    View mCompatibilityHelpDialog = null;
    
    // for disabling the status bar
    int mDisabled = 0;

@@ -1013,17 +1015,27 @@ public class TabletStatusBar extends StatusBar implements
            if (! Prefs.read(mContext).getBoolean(Prefs.SHOWN_COMPAT_MODE_HELP, false)) {
                showCompatibilityHelp();
            }
        } else {
            hideCompatibilityHelp();
            mCompatModePanel.closePanel();
        }
    }

    private void showCompatibilityHelp() {
        final View dlg = View.inflate(mContext, R.layout.compat_mode_help, null);
        View button = dlg.findViewById(R.id.button);
        if (mCompatibilityHelpDialog != null) {
            return;
        }
        
        mCompatibilityHelpDialog = View.inflate(mContext, R.layout.compat_mode_help, null);
        View button = mCompatibilityHelpDialog.findViewById(R.id.button);

        button.setOnClickListener(new View.OnClickListener() {
            @Override
            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();
            }
        });

@@ -1040,11 +1052,14 @@ public class TabletStatusBar extends StatusBar implements
                | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING;
        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) {