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

Commit 08c013e2 authored by Lucas Dupin's avatar Lucas Dupin
Browse files

Update clock format when locale list changes

Isolated clock refresh logic into refreshTime() and refreshFormat().

refreshFormat() makes 2 binder calls and should only called when
necessary: switching users, updating locale list or initialization.

Test: manual
Change-Id: Ia8a3a7655479d44b02c636c3c84ce8cc84e6f210
Fixes: 78535670
parent 3d7ccaf8
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -82,14 +82,14 @@ public class KeyguardStatusView extends GridLayout implements

        @Override
        public void onTimeChanged() {
            refresh();
            refreshTime();
        }

        @Override
        public void onKeyguardVisibilityChanged(boolean showing) {
            if (showing) {
                if (DEBUG) Slog.v(TAG, "refresh statusview showing:" + showing);
                refresh();
                refreshTime();
                updateOwnerInfo();
                updateLogoutView();
            }
@@ -107,7 +107,7 @@ public class KeyguardStatusView extends GridLayout implements

        @Override
        public void onUserSwitchComplete(int userId) {
            refresh();
            refreshFormat();
            updateOwnerInfo();
            updateLogoutView();
        }
@@ -184,7 +184,7 @@ public class KeyguardStatusView extends GridLayout implements

        boolean shouldMarquee = KeyguardUpdateMonitor.getInstance(mContext).isDeviceInteractive();
        setEnableMarquee(shouldMarquee);
        refresh();
        refreshFormat();
        updateOwnerInfo();
        updateLogoutView();
        updateDark();
@@ -289,9 +289,10 @@ public class KeyguardStatusView extends GridLayout implements
        mClockView.refresh();
    }

    private void refresh() {
    private void refreshFormat() {
        Patterns.update(mContext);
        refreshTime();
        mClockView.setFormat12Hour(Patterns.clockView12);
        mClockView.setFormat24Hour(Patterns.clockView24);
    }

    public int getLogoutButtonHeight() {
@@ -337,6 +338,11 @@ public class KeyguardStatusView extends GridLayout implements
        Dependency.get(ConfigurationController.class).removeCallback(this);
    }

    @Override
    public void onLocaleListChanged() {
        refreshFormat();
    }

    @Override
    public boolean hasOverlappingRendering() {
        return false;