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

Commit 07f82b79 authored by Jason Monk's avatar Jason Monk
Browse files

Don't stack toasts for every user press

Showing a toast on every press was adding up to a long list of
toasts to clear out of the display, now cancel the last so we
don't have that problem.

Also fix unlock strings to not use insertions because of problems
translating the context.

Bug: 16892731
Bug: 16366701
Change-Id: Ia523469089c9f8dd1f3e466a9d4ea901a376d1bc
parent c7f440dc
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -4859,15 +4859,12 @@
    <!-- Exting lock-to-app indication. -->
    <string name="lock_to_app_exit">Screen unpinned</string>

    <!-- Lock-to-app checkbox for lock on exit -->
    <string name="lock_to_app_use_screen_lock">Ask for %1$s before unpinning</string>

    <!-- Lock-to-app unlock pin string -->
    <string name="lock_to_app_unlock_pin">PIN</string>
    <string name="lock_to_app_unlock_pin">Ask for PIN before unpinning</string>
    <!-- Lock-to-app unlock pattern string -->
    <string name="lock_to_app_unlock_pattern">unlock pattern</string>
    <string name="lock_to_app_unlock_pattern">Ask for unlock pattern before unpinning</string>
    <!-- Lock-to-app unlock password string -->
    <string name="lock_to_app_unlock_password">password</string>
    <string name="lock_to_app_unlock_password">Ask for password before unpinning</string>

    <!-- [CHAR_LIMIT=NONE] Battery saver: Feature description -->
    <string name="battery_saver_description">To help improve battery life, battery saver reduces your device’s performance and limits vibration and most background data. Email, messaging, and other apps that rely on syncing may not update unless you open them.\n\nBattery saver turns off automatically when your device is charging</string>
+0 −1
Original line number Diff line number Diff line
@@ -622,7 +622,6 @@
  <java-symbol type="id" name="lock_to_app_checkbox" />
  <java-symbol type="string" name="lock_to_app_start" />
  <java-symbol type="string" name="lock_to_app_exit" />
  <java-symbol type="string" name="lock_to_app_use_screen_lock" />
  <java-symbol type="string" name="lock_to_app_unlock_pin" />
  <java-symbol type="string" name="lock_to_app_unlock_pattern" />
  <java-symbol type="string" name="lock_to_app_unlock_password" />
+6 −1
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ public class LockTaskNotify {
    private final Context mContext;
    private final H mHandler;
    private AccessibilityManager mAccessibilityManager;
    private Toast mLastToast;

    public LockTaskNotify(Context context) {
        mContext = context;
@@ -52,7 +53,11 @@ public class LockTaskNotify {
        if (!isLocked && mAccessibilityManager.isEnabled()) {
            text = mContext.getString(R.string.lock_to_app_toast_accessible);
        }
        Toast.makeText(mContext, text, Toast.LENGTH_LONG).show();
        if (mLastToast != null) {
            mLastToast.cancel();
        }
        mLastToast = Toast.makeText(mContext, text, Toast.LENGTH_LONG);
        mLastToast.show();
    }

    public void show(boolean starting) {
+1 −2
Original line number Diff line number Diff line
@@ -102,8 +102,7 @@ public class LockToAppRequestDialog implements OnClickListener {
        if (unlockStringId != 0) {
            String unlockString = mContext.getString(unlockStringId);
            mCheckbox = (CheckBox) mDialog.findViewById(R.id.lock_to_app_checkbox);
            mCheckbox.setText(mContext.getString(R.string.lock_to_app_use_screen_lock,
                    unlockString));
            mCheckbox.setText(unlockString);

            // Remember state.
            try {