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

Commit 9848b97d authored by d34d's avatar d34d Committed by Clark Scheff
Browse files

Themes: Call recreateTheme when theme changed

In order to pick up changes in styles and attributes it is necessary
to call recreateTheme() when a theme change occurs.

Change-Id: I7cd22ec09914c467710fbe76672e975b30c556b3
TICKET: CYNGNOS-1126
parent 5b5e5dee
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.content.res.ThemeConfig;
import android.os.SystemProperties;
import android.util.Log;

@@ -58,6 +59,7 @@ public class SystemUIApplication extends Application {
    private boolean mServicesStarted;
    private boolean mBootCompleted;
    private final Map<Class<?>, Object> mComponents = new HashMap<Class<?>, Object>();
    private Configuration mConfig;

    @Override
    public void onCreate() {
@@ -85,6 +87,7 @@ public class SystemUIApplication extends Application {
                }
            }
        }, filter);
        mConfig = new Configuration(getResources().getConfiguration());
    }

    /**
@@ -134,6 +137,12 @@ public class SystemUIApplication extends Application {

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        if (isThemeChange(mConfig, newConfig)) {
            // theme resource changed so recreate styles and attributes
            recreateTheme();
        }

        mConfig.setTo(newConfig);
        if (mServicesStarted) {
            int len = mServices.length;
            for (int i = 0; i < len; i++) {
@@ -150,4 +159,11 @@ public class SystemUIApplication extends Application {
    public SystemUI[] getServices() {
        return mServices;
    }

    private static boolean isThemeChange(Configuration oldConfig, Configuration newConfig) {
        final ThemeConfig oldThemeConfig = oldConfig != null ? oldConfig.themeConfig : null;
        final ThemeConfig newThemeConfig = newConfig != null ? newConfig.themeConfig : null;

        return newThemeConfig != null && !newThemeConfig.equals(oldThemeConfig);
    }
}
+0 −1
Original line number Diff line number Diff line
@@ -3776,7 +3776,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        final boolean updateNavBar = shouldUpdateNavbar(mCurrentTheme, newTheme);
        if (newTheme != null) mCurrentTheme = (ThemeConfig) newTheme.clone();
        if (updateStatusBar) {
            mContext.recreateTheme();
            recreateStatusBar();
        } else {
            loadDimens();