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

Commit 93bd046b authored by Aaron Liu's avatar Aaron Liu
Browse files

[Bouncer] destroy and recreate view when...

Reloading color. In consequence, I removed as many reloadColor methods
from within the bouncer hierarchy as I could that were safe to remove.
By destroying the view, the newly inflated view should have the updated
colors.

Fixes: 260095692
Test: View pattern view after setting dark theme on and off.
Change-Id: Ic7037b06fc9b870fb9cb31af1bd7fdca0a12dbc0
parent e7aef726
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ import android.widget.Button;

import com.android.internal.util.EmergencyAffordanceManager;
import com.android.internal.widget.LockPatternUtils;
import com.android.settingslib.Utils;

/**
 * This class implements a smart emergency button that updates itself based
@@ -91,17 +90,6 @@ public class EmergencyButton extends Button {
        return super.onTouchEvent(event);
    }

    /**
     * Reload colors from resources.
     **/
    public void reloadColors() {
        int color = Utils.getColorAttrDefaultColor(getContext(),
                com.android.internal.R.attr.textColorOnAccent);
        setTextColor(color);
        setBackground(getContext()
                .getDrawable(com.android.systemui.R.drawable.kg_emergency_button_background));
    }

    @Override
    public boolean performLongClick() {
        return super.performLongClick();
+0 −8
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import static com.android.internal.util.LatencyTracker.ACTION_CHECK_CREDENTIAL;
import static com.android.internal.util.LatencyTracker.ACTION_CHECK_CREDENTIAL_UNLOCKED;
import static com.android.keyguard.KeyguardAbsKeyInputView.MINIMUM_PASSWORD_LENGTH_BEFORE_REPORT;

import android.annotation.CallSuper;
import android.content.res.ColorStateList;
import android.os.AsyncTask;
import android.os.CountDownTimer;
@@ -117,13 +116,6 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey
        }
    }

    @CallSuper
    @Override
    public void reloadColors() {
        super.reloadColors();
        mMessageAreaController.reloadColors();
    }

    @Override
    public boolean needsInput() {
        return false;
+0 −11
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.keyguard;

import android.annotation.CallSuper;
import android.annotation.Nullable;
import android.content.res.ColorStateList;
import android.content.res.Resources;
@@ -142,16 +141,6 @@ public abstract class KeyguardInputViewController<T extends KeyguardInputView>
    public void showMessage(CharSequence message, ColorStateList colorState) {
    }

    /**
     * Reload colors from resources.
     **/
    @CallSuper
    public void reloadColors() {
        if (mEmergencyButton != null) {
            mEmergencyButton.reloadColors();
        }
    }

    public void startAppearAnimation() {
        if (TextUtils.isEmpty(mMessageAreaController.getMessage())) {
            mMessageAreaController.setMessage(getInitialMessageResId());
+0 −7
Original line number Diff line number Diff line
@@ -116,13 +116,6 @@ public class KeyguardMessageAreaController<T extends KeyguardMessageArea>
        return mView.getText();
    }

    /**
     * Reload colors from resources.
     **/
    public void reloadColors() {
        mView.reloadColor();
    }

    /** Factory for creating {@link com.android.keyguard.KeyguardMessageAreaController}. */
    public static class Factory {
        private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
+0 −14
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.keyguard;

import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.os.UserHandle;
import android.text.Editable;
@@ -39,7 +38,6 @@ import android.widget.TextView.OnEditorActionListener;
import com.android.internal.util.LatencyTracker;
import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardSecurityModel.SecurityMode;
import com.android.settingslib.Utils;
import com.android.systemui.R;
import com.android.systemui.classifier.FalsingCollector;
import com.android.systemui.dagger.qualifiers.Main;
@@ -95,18 +93,6 @@ public class KeyguardPasswordViewController
        }
    };

    @Override
    public void reloadColors() {
        super.reloadColors();
        int textColor = Utils.getColorAttr(mView.getContext(),
                android.R.attr.textColorPrimary).getDefaultColor();
        mPasswordEntry.setTextColor(textColor);
        mPasswordEntry.setHighlightColor(textColor);
        mPasswordEntry.setBackgroundTintList(ColorStateList.valueOf(textColor));
        mPasswordEntry.setForegroundTintList(ColorStateList.valueOf(textColor));
        mSwitchImeButton.setImageTintList(ColorStateList.valueOf(textColor));
    }

    protected KeyguardPasswordViewController(KeyguardPasswordView view,
            KeyguardUpdateMonitor keyguardUpdateMonitor,
            SecurityMode securityMode,
Loading