Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ public static BrandingUtil brandingUtil() {
return brandingUtil;
}

public static void reloadBrandingUtil(Context context) {
brandingUtil = BrandingUtil.getInstance(context.getApplicationContext());
}

public static void setAppTheme(DarkModeSetting setting) {
AppCompatDelegate.setDefaultNightMode(setting.getModeId());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.concurrent.ConcurrentMap;

import it.niedermann.android.sharedpreferences.SharedPreferenceIntLiveData;
import it.niedermann.owncloud.notes.NotesApplication;
import it.niedermann.owncloud.notes.R;

public class BrandingUtil extends ViewThemeUtilsBase {
Expand Down Expand Up @@ -88,9 +89,9 @@ public static void saveBrandColor(@NonNull Context context, @ColorInt int color)
Log.v(TAG, "--- Write: shared_preference_theme_main" + " | " + color);
editor.putInt(pref_key_branding_main, color);
editor.apply();
if (context instanceof BrandedActivity) {
if (color != previousMainColor) {
final var activity = (BrandedActivity) context;
if (color != previousMainColor) {
NotesApplication.reloadBrandingUtil(context);
if (context instanceof BrandedActivity activity) {
activity.runOnUiThread(() -> ActivityCompat.recreate(activity));
}
}
Expand Down