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

Commit fc27d96b authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Status bar blacklist: fix items resetting" into nyc-mr1-dev

parents 8acb1a75 0570e36b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -47,9 +47,9 @@ public class BatteryPreference extends DropDownPreference implements TunerServic
    @Override
    public void onAttached() {
        super.onAttached();
        TunerService.get(getContext()).addTunable(this, StatusBarIconController.ICON_BLACKLIST);
        mHasPercentage = Settings.System.getInt(getContext().getContentResolver(),
                SHOW_PERCENT_SETTING, 0) != 0;
        TunerService.get(getContext()).addTunable(this, StatusBarIconController.ICON_BLACKLIST);
    }

    @Override
+5 −1
Original line number Diff line number Diff line
@@ -32,6 +32,8 @@ public class ClockPreference extends DropDownPreference implements TunerService.
    private boolean mHasSeconds;
    private ArraySet<String> mBlacklist;
    private boolean mHasSetValue;
    private boolean mReceivedSeconds;
    private boolean mReceivedClock;

    public ClockPreference(Context context, AttributeSet attrs) {
        super(context, attrs);
@@ -55,12 +57,14 @@ public class ClockPreference extends DropDownPreference implements TunerService.
    @Override
    public void onTuningChanged(String key, String newValue) {
        if (StatusBarIconController.ICON_BLACKLIST.equals(key)) {
            mReceivedClock = true;
            mBlacklist = StatusBarIconController.getIconBlacklist(newValue);
            mClockEnabled = !mBlacklist.contains(mClock);
        } else if (Clock.CLOCK_SECONDS.equals(key)) {
            mReceivedSeconds = true;
            mHasSeconds = newValue != null && Integer.parseInt(newValue) != 0;
        }
        if (!mHasSetValue) {
        if (!mHasSetValue && mReceivedClock && mReceivedSeconds) {
            // Because of the complicated tri-state it can end up looping and setting state back to
            // what the user didn't choose.  To avoid this, just set the state once and rely on the
            // preference to handle updates.