diff options
Diffstat (limited to 'app/src/main/java/it/niedermann/nextcloud/deck/ui/theme/ThemeUtils.java')
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/ui/theme/ThemeUtils.java | 32 |
1 files changed, 4 insertions, 28 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/theme/ThemeUtils.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/theme/ThemeUtils.java index 3bd6c6bbf..45d4e25c1 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/theme/ThemeUtils.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/theme/ThemeUtils.java @@ -1,13 +1,11 @@ package it.niedermann.nextcloud.deck.ui.theme; -import static it.niedermann.nextcloud.deck.DeckApplication.isDarkTheme; +import static com.nextcloud.android.common.ui.util.PlatformThemeUtil.isDarkMode; import android.content.Context; import androidx.annotation.ColorInt; import androidx.annotation.NonNull; -import androidx.core.content.ContextCompat; -import androidx.preference.PreferenceManager; import com.nextcloud.android.common.ui.color.ColorUtil; import com.nextcloud.android.common.ui.theme.MaterialSchemes; @@ -20,8 +18,6 @@ import com.nextcloud.android.common.ui.theme.utils.MaterialViewThemeUtils; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; -import it.niedermann.nextcloud.deck.DeckLog; -import it.niedermann.nextcloud.deck.R; import scheme.Scheme; public class ThemeUtils extends ViewThemeUtilsBase { @@ -44,7 +40,7 @@ public class ThemeUtils extends ViewThemeUtilsBase { this.material = new MaterialViewThemeUtils(schemes, colorUtil); this.androidx = new AndroidXViewThemeUtils(schemes, this.platform); this.dialog = new DialogViewThemeUtils(schemes); - this.deck = new DeckViewThemeUtils(schemes, this.material); + this.deck = new DeckViewThemeUtils(schemes, this.material, this.platform); } public static ThemeUtils of(@ColorInt int color, @NonNull Context context) { @@ -54,28 +50,8 @@ public class ThemeUtils extends ViewThemeUtilsBase { )); } + @Deprecated public static Scheme createScheme(@ColorInt int color, @NonNull Context context) { - return isDarkTheme(context) ? Scheme.dark(color) : Scheme.light(color); - } - - @ColorInt - public static int readBrandMainColor(@NonNull Context context) { - final var sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext()); - DeckLog.log("--- Read:", context.getString(R.string.shared_preference_theme_main)); - return sharedPreferences.getInt(context.getString(R.string.shared_preference_theme_main), ContextCompat.getColor(context, R.color.defaultBrand)); - } - - public static void saveBrandColors(@NonNull Context context, @ColorInt int color) { - final var editor = PreferenceManager.getDefaultSharedPreferences(context).edit(); - DeckLog.log("--- Write:", context.getString(R.string.shared_preference_theme_main), "|", color); - editor.putInt(context.getString(R.string.shared_preference_theme_main), color); - editor.apply(); - } - - public static void clearBrandColors(@NonNull Context context) { - final var editor = PreferenceManager.getDefaultSharedPreferences(context).edit(); - DeckLog.log("--- Remove:", context.getString(R.string.shared_preference_theme_main)); - editor.remove(context.getString(R.string.shared_preference_theme_main)); - editor.apply(); + return isDarkMode(context) ? Scheme.dark(color) : Scheme.light(color); } } |