File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
app/src/main/java/it/niedermann/owncloud/notes Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 2020
2121import androidx .appcompat .app .AppCompatDelegate ;
2222
23+ import it .niedermann .owncloud .notes .branding .BrandingUtil ;
2324import it .niedermann .owncloud .notes .preferences .DarkModeSetting ;
2425
2526public class NotesApplication extends Application {
@@ -31,6 +32,7 @@ public class NotesApplication extends Application {
3132 private static long lastInteraction = 0 ;
3233 private static String PREF_KEY_THEME ;
3334 private static boolean isGridViewEnabled = false ;
35+ private static BrandingUtil brandingUtil ;
3436
3537 @ Override
3638 public void onCreate () {
@@ -40,11 +42,16 @@ public void onCreate() {
4042 lockedPreference = prefs .getBoolean (getString (R .string .pref_key_lock ), false );
4143 isGridViewEnabled = getDefaultSharedPreferences (this ).getBoolean (getString (R .string .pref_key_gridview ), false );
4244 super .onCreate ();
45+ brandingUtil = BrandingUtil .getInstance (this );
4346 if (BuildConfig .DEBUG ) {
4447 WebView .setWebContentsDebuggingEnabled (true );
4548 }
4649 }
4750
51+ public static BrandingUtil brandingUtil () {
52+ return brandingUtil ;
53+ }
54+
4855 public static void setAppTheme (DarkModeSetting setting ) {
4956 AppCompatDelegate .setDefaultNightMode (setting .getModeId ());
5057 }
Original file line number Diff line number Diff line change @@ -54,6 +54,14 @@ private BrandingUtil(
5454 this .notes = new NotesViewThemeUtils (schemes );
5555 }
5656
57+ public static BrandingUtil getInstance (@ NonNull Context context ) {
58+ int color = BrandingUtil .readBrandMainColor (context );
59+ return new BrandingUtil (
60+ MaterialSchemes .Companion .fromColor (color ),
61+ new com .nextcloud .android .common .ui .color .ColorUtil (context )
62+ );
63+ }
64+
5765 public static BrandingUtil of (@ ColorInt int color , @ NonNull Context context ) {
5866 return CACHE .computeIfAbsent (color , c -> new BrandingUtil (
5967 MaterialSchemes .Companion .fromColor (c ),
You can’t perform that action at this time.
0 commit comments