aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java38
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomTheme.java60
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeSettingsItem.java10
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeWrapper.java32
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java13
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Utils/CustomThemeSharedPreferencesUtils.java2
6 files changed, 103 insertions, 52 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
index fd9b8f44..bce56b5c 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
@@ -2,7 +2,6 @@ package ml.docilealligator.infinityforreddit.Adapter;
import android.content.Intent;
import android.content.res.ColorStateList;
-import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
@@ -120,6 +119,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
private int mSpoilerTextColor;
private int mFlairBackgroundColor;
private int mFlairTextColor;
+ private int mAwardsBackgroundColor;
+ private int mAwardsTextColor;
private int mNSFWBackgroundColor;
private int mNSFWTextColor;
private int mArchivedIconTint;
@@ -182,6 +183,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
mSpoilerTextColor = customThemeWrapper.getSpoilerTextColor();
mFlairBackgroundColor = customThemeWrapper.getFlairBackgroundColor();
mFlairTextColor = customThemeWrapper.getFlairTextColor();
+ mAwardsBackgroundColor = customThemeWrapper.getAwardsBackgroundColor();
+ mAwardsTextColor = customThemeWrapper.getAwardsTextColor();
mNSFWBackgroundColor = customThemeWrapper.getNsfwBackgroundColor();
mNSFWTextColor = customThemeWrapper.getNsfwTextColor();
mArchivedIconTint = customThemeWrapper.getArchivedIconTint();
@@ -813,7 +816,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
boolean nsfw = post.isNSFW();
boolean spoiler = post.isSpoiler();
String flair = post.getFlair();
- String awards = post.getAwards();
+ int nAwards = post.getnAwards();
boolean isArchived = post.isArchived();
((PostCompactViewHolder) holder).itemView.setOnClickListener(view -> {
@@ -1006,26 +1009,12 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
if (flair != null && !flair.equals("")) {
((PostCompactViewHolder) holder).flairTextView.setVisibility(View.VISIBLE);
- Spannable flairHTML;
- GlideImageGetter glideImageGetter = new GlideImageGetter(((PostCompactViewHolder) holder).flairTextView);
- if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
- flairHTML = (Spannable) Html.fromHtml(flair, Html.FROM_HTML_MODE_LEGACY, glideImageGetter, null);
- } else {
- flairHTML = (Spannable) Html.fromHtml(flair, glideImageGetter, null);
- }
- ((PostCompactViewHolder) holder).flairTextView.setText(flairHTML);
+ Utils.setHTMLWithImageToTextView(((PostCompactViewHolder) holder).flairTextView, flair);
}
- if (awards != null && !awards.equals("")) {
+ if (nAwards > 0) {
((PostCompactViewHolder) holder).awardsTextView.setVisibility(View.VISIBLE);
- Spannable awardsHTML;
- GlideImageGetter glideImageGetter = new GlideImageGetter(((PostCompactViewHolder) holder).awardsTextView);
- if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
- awardsHTML = (Spannable) Html.fromHtml(awards, Html.FROM_HTML_MODE_LEGACY, glideImageGetter, null);
- } else {
- awardsHTML = (Spannable) Html.fromHtml(awards, glideImageGetter, null);
- }
- ((PostCompactViewHolder) holder).awardsTextView.setText(awardsHTML);
+ ((PostCompactViewHolder) holder).awardsTextView.setText(mActivity.getString(R.string.n_awards, post.getnAwards()));
}
switch (voteType) {
@@ -1682,11 +1671,12 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
flairTextView.setBackgroundColor(mFlairBackgroundColor);
flairTextView.setBorderColor(mFlairBackgroundColor);
flairTextView.setTextColor(mFlairTextColor);
+ awardsTextView.setBackgroundColor(mAwardsBackgroundColor);
+ awardsTextView.setBorderColor(mAwardsBackgroundColor);
+ awardsTextView.setTextColor(mAwardsTextColor);
archivedImageView.setColorFilter(mArchivedIconTint, PorterDuff.Mode.SRC_IN);
lockedImageView.setColorFilter(mLockedIconTint, PorterDuff.Mode.SRC_IN);
crosspostImageView.setColorFilter(mCrosspostIconTint, PorterDuff.Mode.SRC_IN);
- awardsTextView.setBackgroundColor(Color.parseColor("#EEAB02"));
- awardsTextView.setTextColor(Color.parseColor("#FFFFFF"));
linkTextView.setTextColor(mSecondaryTextColor);
progressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent));
noPreviewLinkImageView.setBackgroundColor(mNoPreviewLinkBackgroundColor);
@@ -1726,7 +1716,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
@BindView(R.id.flair_custom_text_view_item_post_compact)
CustomTextView flairTextView;
@BindView(R.id.awards_text_view_item_post_compact)
- TextView awardsTextView;
+ CustomTextView awardsTextView;
@BindView(R.id.link_text_view_item_post_compact)
TextView linkTextView;
@BindView(R.id.image_view_wrapper_item_post_compact)
@@ -1798,10 +1788,12 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
flairTextView.setBackgroundColor(mFlairBackgroundColor);
flairTextView.setBorderColor(mFlairBackgroundColor);
flairTextView.setTextColor(mFlairTextColor);
+ awardsTextView.setBackgroundColor(mAwardsBackgroundColor);
+ awardsTextView.setBorderColor(mAwardsBackgroundColor);
+ awardsTextView.setTextColor(mAwardsTextColor);
archivedImageView.setColorFilter(mArchivedIconTint, PorterDuff.Mode.SRC_IN);
lockedImageView.setColorFilter(mLockedIconTint, PorterDuff.Mode.SRC_IN);
crosspostImageView.setColorFilter(mCrosspostIconTint, PorterDuff.Mode.SRC_IN);
- awardsTextView.setTextColor(mPostTitleColor);
linkTextView.setTextColor(mSecondaryTextColor);
progressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent));
noPreviewLinkImageView.setBackgroundColor(mNoPreviewLinkBackgroundColor);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomTheme.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomTheme.java
index c05e79e0..1c105ad3 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomTheme.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomTheme.java
@@ -95,6 +95,10 @@ public class CustomTheme {
public int flairBackgroundColor;
@ColumnInfo(name = "flair_text_color")
public int flairTextColor;
+ @ColumnInfo(name = "awards_background_color")
+ public int awardsBackgroundColor;
+ @ColumnInfo(name = "awards_text_color")
+ public int awardsTextColor;
@ColumnInfo(name = "archived_tint")
public int archivedTint;
@ColumnInfo(name = "locked_icon_tint")
@@ -211,33 +215,35 @@ public class CustomTheme {
customTheme.nsfwTextColor = customThemeSettingsItems.get(38).colorValue;
customTheme.flairBackgroundColor = customThemeSettingsItems.get(39).colorValue;
customTheme.flairTextColor = customThemeSettingsItems.get(40).colorValue;
- customTheme.archivedTint = customThemeSettingsItems.get(41).colorValue;
- customTheme.lockedIconTint = customThemeSettingsItems.get(42).colorValue;
- customTheme.crosspostIconTint = customThemeSettingsItems.get(43).colorValue;
- customTheme.stickiedPostIconTint = customThemeSettingsItems.get(44).colorValue;
- customTheme.subscribed = customThemeSettingsItems.get(45).colorValue;
- customTheme.unsubscribed = customThemeSettingsItems.get(46).colorValue;
- customTheme.username = customThemeSettingsItems.get(47).colorValue;
- customTheme.subreddit = customThemeSettingsItems.get(48).colorValue;
- customTheme.authorFlairTextColor = customThemeSettingsItems.get(49).colorValue;
- customTheme.submitter = customThemeSettingsItems.get(50).colorValue;
- customTheme.moderator = customThemeSettingsItems.get(51).colorValue;
- customTheme.singleCommentThreadBackgroundColor = customThemeSettingsItems.get(52).colorValue;
- customTheme.unreadMessageBackgroundColor = customThemeSettingsItems.get(53).colorValue;
- customTheme.dividerColor = customThemeSettingsItems.get(54).colorValue;
- customTheme.noPreviewLinkBackgroundColor = customThemeSettingsItems.get(55).colorValue;
- customTheme.voteAndReplyUnavailableButtonColor = customThemeSettingsItems.get(56).colorValue;
- customTheme.commentVerticalBarColor1 = customThemeSettingsItems.get(57).colorValue;
- customTheme.commentVerticalBarColor2 = customThemeSettingsItems.get(58).colorValue;
- customTheme.commentVerticalBarColor3 = customThemeSettingsItems.get(59).colorValue;
- customTheme.commentVerticalBarColor4 = customThemeSettingsItems.get(60).colorValue;
- customTheme.commentVerticalBarColor5 = customThemeSettingsItems.get(61).colorValue;
- customTheme.commentVerticalBarColor6 = customThemeSettingsItems.get(62).colorValue;
- customTheme.commentVerticalBarColor7 = customThemeSettingsItems.get(63).colorValue;
- customTheme.navBarColor = customThemeSettingsItems.get(64).colorValue;
- customTheme.isLightStatusBar = customThemeSettingsItems.get(65).isEnabled;
- customTheme.isLightNavBar = customThemeSettingsItems.get(66).isEnabled;
- customTheme.isChangeStatusBarIconColorAfterToolbarCollapsedInImmersiveInterface = customThemeSettingsItems.get(67).isEnabled;
+ customTheme.awardsBackgroundColor = customThemeSettingsItems.get(41).colorValue;
+ customTheme.awardsTextColor = customThemeSettingsItems.get(42).colorValue;
+ customTheme.archivedTint = customThemeSettingsItems.get(43).colorValue;
+ customTheme.lockedIconTint = customThemeSettingsItems.get(44).colorValue;
+ customTheme.crosspostIconTint = customThemeSettingsItems.get(45).colorValue;
+ customTheme.stickiedPostIconTint = customThemeSettingsItems.get(46).colorValue;
+ customTheme.subscribed = customThemeSettingsItems.get(47).colorValue;
+ customTheme.unsubscribed = customThemeSettingsItems.get(48).colorValue;
+ customTheme.username = customThemeSettingsItems.get(49).colorValue;
+ customTheme.subreddit = customThemeSettingsItems.get(50).colorValue;
+ customTheme.authorFlairTextColor = customThemeSettingsItems.get(51).colorValue;
+ customTheme.submitter = customThemeSettingsItems.get(52).colorValue;
+ customTheme.moderator = customThemeSettingsItems.get(53).colorValue;
+ customTheme.singleCommentThreadBackgroundColor = customThemeSettingsItems.get(54).colorValue;
+ customTheme.unreadMessageBackgroundColor = customThemeSettingsItems.get(55).colorValue;
+ customTheme.dividerColor = customThemeSettingsItems.get(56).colorValue;
+ customTheme.noPreviewLinkBackgroundColor = customThemeSettingsItems.get(57).colorValue;
+ customTheme.voteAndReplyUnavailableButtonColor = customThemeSettingsItems.get(58).colorValue;
+ customTheme.commentVerticalBarColor1 = customThemeSettingsItems.get(59).colorValue;
+ customTheme.commentVerticalBarColor2 = customThemeSettingsItems.get(60).colorValue;
+ customTheme.commentVerticalBarColor3 = customThemeSettingsItems.get(61).colorValue;
+ customTheme.commentVerticalBarColor4 = customThemeSettingsItems.get(62).colorValue;
+ customTheme.commentVerticalBarColor5 = customThemeSettingsItems.get(63).colorValue;
+ customTheme.commentVerticalBarColor6 = customThemeSettingsItems.get(64).colorValue;
+ customTheme.commentVerticalBarColor7 = customThemeSettingsItems.get(65).colorValue;
+ customTheme.navBarColor = customThemeSettingsItems.get(66).colorValue;
+ customTheme.isLightStatusBar = customThemeSettingsItems.get(67).isEnabled;
+ customTheme.isLightNavBar = customThemeSettingsItems.get(68).isEnabled;
+ customTheme.isChangeStatusBarIconColorAfterToolbarCollapsedInImmersiveInterface = customThemeSettingsItems.get(69).isEnabled;
return customTheme;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeSettingsItem.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeSettingsItem.java
index 0dbf49de..531f6e8d 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeSettingsItem.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeSettingsItem.java
@@ -219,6 +219,16 @@ public class CustomThemeSettingsItem implements Parcelable {
context.getString(R.string.theme_item_flair_text_color_detail),
customTheme.flairTextColor));
customThemeSettingsItems.add(new CustomThemeSettingsItem(
+ context.getString(R.string.theme_item_awards_background_color),
+ context.getString(R.string.theme_item_awards_background_color_detail),
+ customTheme.awardsBackgroundColor
+ ));
+ customThemeSettingsItems.add(new CustomThemeSettingsItem(
+ context.getString(R.string.theme_item_awards_text_color),
+ context.getString(R.string.theme_item_awards_text_color_detail),
+ customTheme.awardsTextColor
+ ));
+ customThemeSettingsItems.add(new CustomThemeSettingsItem(
context.getString(R.string.theme_item_archived_tint),
context.getString(R.string.theme_item_archived_tint_detail),
customTheme.archivedTint));
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeWrapper.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeWrapper.java
index 3f167cd7..ff30966d 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeWrapper.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeWrapper.java
@@ -232,6 +232,16 @@ public class CustomThemeWrapper {
getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF"));
}
+ public int getAwardsBackgroundColor() {
+ return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.AWARDS_BACKGROUND_COLOR,
+ getDefaultColor("#EEAB02", "#EEAB02", "#EEAB02"));
+ }
+
+ public int getAwardsTextColor() {
+ return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.AWARDS_TEXT_COLOR,
+ getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF"));
+ }
+
public int getArchivedIconTint() {
return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.ARCHIVED_ICON_TINT,
getDefaultColor("#B4009F", "#B4009F", "#B4009F"));
@@ -460,6 +470,8 @@ public class CustomThemeWrapper {
customTheme.nsfwTextColor = Color.parseColor("#FFFFFF");
customTheme.flairBackgroundColor = Color.parseColor("#00AA8C");
customTheme.flairTextColor = Color.parseColor("#FFFFFF");
+ customTheme.awardsBackgroundColor = Color.parseColor("#EEAB02");
+ customTheme.awardsTextColor = Color.parseColor("#FFFFFF");
customTheme.archivedTint = Color.parseColor("#B4009F");
customTheme.lockedIconTint = Color.parseColor("#EE7302");
customTheme.crosspostIconTint = Color.parseColor("#FF4081");
@@ -534,6 +546,8 @@ public class CustomThemeWrapper {
customTheme.nsfwTextColor = Color.parseColor("#FFFFFF");
customTheme.flairBackgroundColor = Color.parseColor("#00AA8C");
customTheme.flairTextColor = Color.parseColor("#FFFFFF");
+ customTheme.awardsBackgroundColor = Color.parseColor("#EEAB02");
+ customTheme.awardsTextColor = Color.parseColor("#FFFFFF");
customTheme.archivedTint = Color.parseColor("#B4009F");
customTheme.lockedIconTint = Color.parseColor("#EE7302");
customTheme.crosspostIconTint = Color.parseColor("#FF4081");
@@ -608,6 +622,8 @@ public class CustomThemeWrapper {
customTheme.nsfwTextColor = Color.parseColor("#FFFFFF");
customTheme.flairBackgroundColor = Color.parseColor("#00AA8C");
customTheme.flairTextColor = Color.parseColor("#FFFFFF");
+ customTheme.awardsBackgroundColor = Color.parseColor("#EEAB02");
+ customTheme.awardsTextColor = Color.parseColor("#FFFFFF");
customTheme.archivedTint = Color.parseColor("#B4009F");
customTheme.lockedIconTint = Color.parseColor("#EE7302");
customTheme.crosspostIconTint = Color.parseColor("#FF4081");
@@ -682,6 +698,8 @@ public class CustomThemeWrapper {
customTheme.nsfwTextColor = Color.parseColor("#FFFFFF");
customTheme.flairBackgroundColor = Color.parseColor("#00AA8C");
customTheme.flairTextColor = Color.parseColor("#FFFFFF");
+ customTheme.awardsBackgroundColor = Color.parseColor("#EEAB02");
+ customTheme.awardsTextColor = Color.parseColor("#FFFFFF");
customTheme.archivedTint = Color.parseColor("#B4009F");
customTheme.lockedIconTint = Color.parseColor("#EE7302");
customTheme.crosspostIconTint = Color.parseColor("#FF4081");
@@ -756,6 +774,8 @@ public class CustomThemeWrapper {
customTheme.nsfwTextColor = Color.parseColor("#FFFFFF");
customTheme.flairBackgroundColor = Color.parseColor("#00AA8C");
customTheme.flairTextColor = Color.parseColor("#FFFFFF");
+ customTheme.awardsBackgroundColor = Color.parseColor("#EEAB02");
+ customTheme.awardsTextColor = Color.parseColor("#FFFFFF");
customTheme.archivedTint = Color.parseColor("#B4009F");
customTheme.lockedIconTint = Color.parseColor("#EE7302");
customTheme.crosspostIconTint = Color.parseColor("#FF4081");
@@ -830,6 +850,8 @@ public class CustomThemeWrapper {
customTheme.nsfwTextColor = Color.parseColor("#FFFFFF");
customTheme.flairBackgroundColor = Color.parseColor("#00AA8C");
customTheme.flairTextColor = Color.parseColor("#FFFFFF");
+ customTheme.awardsBackgroundColor = Color.parseColor("#EEAB02");
+ customTheme.awardsTextColor = Color.parseColor("#FFFFFF");
customTheme.archivedTint = Color.parseColor("#B4009F");
customTheme.lockedIconTint = Color.parseColor("#EE7302");
customTheme.crosspostIconTint = Color.parseColor("#FF4081");
@@ -904,6 +926,8 @@ public class CustomThemeWrapper {
customTheme.nsfwTextColor = Color.parseColor("#FFFFFF");
customTheme.flairBackgroundColor = Color.parseColor("#00AA8C");
customTheme.flairTextColor = Color.parseColor("#FFFFFF");
+ customTheme.awardsBackgroundColor = Color.parseColor("#EEAB02");
+ customTheme.awardsTextColor = Color.parseColor("#FFFFFF");
customTheme.archivedTint = Color.parseColor("#B4009F");
customTheme.lockedIconTint = Color.parseColor("#EE7302");
customTheme.crosspostIconTint = Color.parseColor("#FF4081");
@@ -978,6 +1002,8 @@ public class CustomThemeWrapper {
customTheme.nsfwTextColor = Color.parseColor("#FFFFFF");
customTheme.flairBackgroundColor = Color.parseColor("#00AA8C");
customTheme.flairTextColor = Color.parseColor("#FFFFFF");
+ customTheme.awardsBackgroundColor = Color.parseColor("#EEAB02");
+ customTheme.awardsTextColor = Color.parseColor("#FFFFFF");
customTheme.archivedTint = Color.parseColor("#B4009F");
customTheme.lockedIconTint = Color.parseColor("#EE7302");
customTheme.crosspostIconTint = Color.parseColor("#FF4081");
@@ -1052,6 +1078,8 @@ public class CustomThemeWrapper {
customTheme.nsfwTextColor = Color.parseColor("#FFFFFF");
customTheme.flairBackgroundColor = Color.parseColor("#00AA8C");
customTheme.flairTextColor = Color.parseColor("#FFFFFF");
+ customTheme.awardsBackgroundColor = Color.parseColor("#EEAB02");
+ customTheme.awardsTextColor = Color.parseColor("#FFFFFF");
customTheme.archivedTint = Color.parseColor("#B4009F");
customTheme.lockedIconTint = Color.parseColor("#EE7302");
customTheme.crosspostIconTint = Color.parseColor("#FF4081");
@@ -1126,6 +1154,8 @@ public class CustomThemeWrapper {
customTheme.nsfwTextColor = Color.parseColor("#FFFFFF");
customTheme.flairBackgroundColor = Color.parseColor("#00AA8C");
customTheme.flairTextColor = Color.parseColor("#FFFFFF");
+ customTheme.awardsBackgroundColor = Color.parseColor("#EEAB02");
+ customTheme.awardsTextColor = Color.parseColor("#FFFFFF");
customTheme.archivedTint = Color.parseColor("#B4009F");
customTheme.lockedIconTint = Color.parseColor("#EE7302");
customTheme.crosspostIconTint = Color.parseColor("#FF4081");
@@ -1200,6 +1230,8 @@ public class CustomThemeWrapper {
customTheme.nsfwTextColor = Color.parseColor("#FFFFFF");
customTheme.flairBackgroundColor = Color.parseColor("#00AA8C");
customTheme.flairTextColor = Color.parseColor("#FFFFFF");
+ customTheme.awardsBackgroundColor = Color.parseColor("#EEAB02");
+ customTheme.awardsTextColor = Color.parseColor("#FFFFFF");
customTheme.archivedTint = Color.parseColor("#B4009F");
customTheme.lockedIconTint = Color.parseColor("#EE7302");
customTheme.crosspostIconTint = Color.parseColor("#FF4081");
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java b/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java
index d9d9f393..539bd20e 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java
@@ -1,6 +1,7 @@
package ml.docilealligator.infinityforreddit;
import android.content.Context;
+import android.graphics.Color;
import androidx.annotation.NonNull;
import androidx.room.Database;
@@ -25,7 +26,7 @@ import ml.docilealligator.infinityforreddit.User.UserDao;
import ml.docilealligator.infinityforreddit.User.UserData;
@Database(entities = {Account.class, SubredditData.class, SubscribedSubredditData.class, UserData.class,
- SubscribedUserData.class, MultiReddit.class, CustomTheme.class}, version = 6)
+ SubscribedUserData.class, MultiReddit.class, CustomTheme.class}, version = 7)
public abstract class RedditDataRoomDatabase extends RoomDatabase {
private static RedditDataRoomDatabase INSTANCE;
@@ -36,7 +37,7 @@ public abstract class RedditDataRoomDatabase extends RoomDatabase {
INSTANCE = Room.databaseBuilder(context.getApplicationContext(),
RedditDataRoomDatabase.class, "reddit_data")
.addMigrations(MIGRATION_1_2, MIGRATION_2_3, MIGRATION_3_4, MIGRATION_4_5,
- MIGRATION_5_6)
+ MIGRATION_5_6, MIGRATION_6_7)
.build();
}
}
@@ -156,4 +157,12 @@ public abstract class RedditDataRoomDatabase extends RoomDatabase {
"is_change_status_bar_icon_color_after_toolbar_collapsed_in_immersive_interface INTEGER NOT NULL)");
}
};
+
+ private static final Migration MIGRATION_6_7 = new Migration(6, 7) {
+ @Override
+ public void migrate(@NonNull SupportSQLiteDatabase database) {
+ database.execSQL("ALTER TABLE custom_themes ADD COLUMN awards_background_color INTEGER DEFAULT " + Color.parseColor("#EEAB02") + " NOT NULL");
+ database.execSQL("ALTER TABLE custom_themes ADD COLUMN awards_text_color INTEGER DEFAULT " + Color.parseColor("#FFFFFF") + " NOT NULL");
+ }
+ };
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/CustomThemeSharedPreferencesUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/CustomThemeSharedPreferencesUtils.java
index 4a82a964..6e08559b 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/CustomThemeSharedPreferencesUtils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/CustomThemeSharedPreferencesUtils.java
@@ -51,6 +51,8 @@ public class CustomThemeSharedPreferencesUtils {
public static final String NSFW_TEXT_COLOR = "nsfwTextColor";
public static final String FLAIR_BACKGROUND_COLOR = "flairBackgroundColor";
public static final String FLAIR_TEXT_COLOR = "flairTextColor";
+ public static final String AWARDS_BACKGROUND_COLOR = "awardsBackgroundColor";
+ public static final String AWARDS_TEXT_COLOR = "awardsTextColor";
public static final String ARCHIVED_ICON_TINT = "archivedIconTint";
public static final String LOCKED_ICON_TINT = "lockedIconTint";
public static final String CROSSPOST_ICON_TINT = "crosspostIconTint";