From e6dd1c3aacfbb47380b775442e149d1d39f5266e Mon Sep 17 00:00:00 2001 From: Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> Date: Tue, 19 Sep 2023 15:08:46 -0400 Subject: New theme item: filled card view background color and read post filled card view background color. --- .../infinityforreddit/RedditDataRoomDatabase.java | 12 +- .../adapters/PostRecyclerViewAdapter.java | 17 +-- .../infinityforreddit/customtheme/CustomTheme.java | 136 +++++++++++---------- .../customtheme/CustomThemeSettingsItem.java | 8 ++ .../customtheme/CustomThemeWrapper.java | 32 +++++ .../utils/CustomThemeSharedPreferencesUtils.java | 4 + 6 files changed, 135 insertions(+), 74 deletions(-) (limited to 'app/src/main/java/ml/docilealligator') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java b/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java index 959330f7..e4fb282f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java @@ -38,7 +38,7 @@ import ml.docilealligator.infinityforreddit.user.UserData; @Database(entities = {Account.class, SubredditData.class, SubscribedSubredditData.class, UserData.class, SubscribedUserData.class, MultiReddit.class, CustomTheme.class, RecentSearchQuery.class, - ReadPost.class, PostFilter.class, PostFilterUsage.class, AnonymousMultiredditSubreddit.class}, version = 23) + ReadPost.class, PostFilter.class, PostFilterUsage.class, AnonymousMultiredditSubreddit.class}, version = 24) public abstract class RedditDataRoomDatabase extends RoomDatabase { public static RedditDataRoomDatabase create(final Context context) { @@ -49,7 +49,7 @@ public abstract class RedditDataRoomDatabase extends RoomDatabase { MIGRATION_9_10, MIGRATION_10_11, MIGRATION_11_12, MIGRATION_12_13, MIGRATION_13_14, MIGRATION_14_15, MIGRATION_15_16, MIGRATION_16_17, MIGRATION_17_18, MIGRATION_18_19, MIGRATION_19_20, MIGRATION_20_21, - MIGRATION_21_22, MIGRATION_22_23) + MIGRATION_21_22, MIGRATION_22_23, MIGRATION_23_24) .build(); } @@ -383,4 +383,12 @@ public abstract class RedditDataRoomDatabase extends RoomDatabase { } } }; + + private static final Migration MIGRATION_23_24 = new Migration(23, 24) { + @Override + public void migrate(@NonNull SupportSQLiteDatabase database) { + database.execSQL("ALTER TABLE custom_themes ADD COLUMN filled_card_view_background_color INTEGER DEFAULT " + Color.parseColor("#FFF6F5") + " NOT NULL"); + database.execSQL("ALTER TABLE custom_themes ADD COLUMN read_post_filled_card_view_background_color INTEGER DEFAULT " + Color.parseColor("#F5F5F5") + " NOT NULL"); + } + }; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java index 06d5bf82..1123188d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java @@ -5,7 +5,6 @@ import android.content.SharedPreferences; import android.content.res.ColorStateList; import android.content.res.Configuration; import android.content.res.Resources; -import android.graphics.Color; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; import android.net.Uri; @@ -182,6 +181,8 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter