diff options
Diffstat (limited to 'app')
14 files changed, 166 insertions, 79 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java index 434eaa87..ca7e42d2 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java @@ -302,11 +302,11 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb int backgroundColor = mCustomThemeWrapper.getBackgroundColor(); drawer.setBackgroundColor(backgroundColor); drawer.setStatusBarBackgroundColor(mCustomThemeWrapper.getColorPrimaryDark()); - int primaryIconColor = mCustomThemeWrapper.getPrimaryIconColor(); - subscriptionsBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN); - multiRedditBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN); - messageBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN); - profileBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN); + int bottomAppBarIconColor = mCustomThemeWrapper.getBottomAppBarIconColor(); + subscriptionsBottomAppBar.setColorFilter(bottomAppBarIconColor, android.graphics.PorterDuff.Mode.SRC_IN); + multiRedditBottomAppBar.setColorFilter(bottomAppBarIconColor, android.graphics.PorterDuff.Mode.SRC_IN); + messageBottomAppBar.setColorFilter(bottomAppBarIconColor, android.graphics.PorterDuff.Mode.SRC_IN); + profileBottomAppBar.setColorFilter(bottomAppBarIconColor, android.graphics.PorterDuff.Mode.SRC_IN); navigationView.setBackgroundColor(backgroundColor); applyAppBarLayoutAndToolbarTheme(appBarLayout, toolbar); applyTabLayoutTheme(tabLayout); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ThemePreviewActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ThemePreviewActivity.java index 83478a2f..f8275d66 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ThemePreviewActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ThemePreviewActivity.java @@ -323,11 +323,11 @@ public class ThemePreviewActivity extends AppCompatActivity { primaryTextView.setTextColor(customTheme.primaryTextColor); secondaryTextView.setTextColor(customTheme.secondaryTextColor); bottomNavigationView.setBackgroundTint(ColorStateList.valueOf(customTheme.bottomAppBarBackgroundColor)); - int primaryIconColor = customTheme.primaryIconColor; - subscriptionsBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN); - multiRedditBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN); - messageBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN); - profileBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN); + int bottomAppBarIconColor = customTheme.bottomAppBarIconColor; + subscriptionsBottomAppBar.setColorFilter(bottomAppBarIconColor, android.graphics.PorterDuff.Mode.SRC_IN); + multiRedditBottomAppBar.setColorFilter(bottomAppBarIconColor, android.graphics.PorterDuff.Mode.SRC_IN); + messageBottomAppBar.setColorFilter(bottomAppBarIconColor, android.graphics.PorterDuff.Mode.SRC_IN); + profileBottomAppBar.setColorFilter(bottomAppBarIconColor, android.graphics.PorterDuff.Mode.SRC_IN); applyTabLayoutTheme(tabLayout); applyFABTheme(fab); unsubscribedColor = customTheme.unsubscribed; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java index 419a5e08..b0148cdd 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java @@ -418,11 +418,11 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp nOnlineSubscribersTextView.setTextColor(primaryTextColor); descriptionTextView.setTextColor(primaryTextColor); bottomNavigationView.setBackgroundTint(ColorStateList.valueOf(mCustomThemeWrapper.getBottomAppBarBackgroundColor())); - int primaryIconColor = mCustomThemeWrapper.getPrimaryIconColor(); - subscriptionsBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN); - multiRedditBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN); - messageBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN); - profileBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN); + int bottomAppBarIconColor = mCustomThemeWrapper.getBottomAppBarIconColor(); + subscriptionsBottomAppBar.setColorFilter(bottomAppBarIconColor, android.graphics.PorterDuff.Mode.SRC_IN); + multiRedditBottomAppBar.setColorFilter(bottomAppBarIconColor, android.graphics.PorterDuff.Mode.SRC_IN); + messageBottomAppBar.setColorFilter(bottomAppBarIconColor, android.graphics.PorterDuff.Mode.SRC_IN); + profileBottomAppBar.setColorFilter(bottomAppBarIconColor, android.graphics.PorterDuff.Mode.SRC_IN); applyTabLayoutTheme(tabLayout); applyFABTheme(fab); unsubscribedColor = mCustomThemeWrapper.getUnsubscribed(); 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 1c105ad3..7fbd3359 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomTheme.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomTheme.java @@ -51,6 +51,8 @@ public class CustomTheme { public int bottomAppBarBackgroundColor; @ColumnInfo(name = "primary_icon_color") public int primaryIconColor; + @ColumnInfo(name = "bottom_app_bar_icon_color") + public int bottomAppBarIconColor; @ColumnInfo(name = "post_icon_and_info_color") public int postIconAndInfoColor; @ColumnInfo(name = "comment_icon_and_info_color") @@ -193,57 +195,58 @@ public class CustomTheme { customTheme.commentBackgroundColor = customThemeSettingsItems.get(16).colorValue; customTheme.bottomAppBarBackgroundColor = customThemeSettingsItems.get(17).colorValue; customTheme.primaryIconColor = customThemeSettingsItems.get(18).colorValue; - customTheme.postIconAndInfoColor = customThemeSettingsItems.get(19).colorValue; - customTheme.commentIconAndInfoColor = customThemeSettingsItems.get(20).colorValue; - customTheme.fabIconColor = customThemeSettingsItems.get(21).colorValue; - customTheme.toolbarPrimaryTextAndIconColor = customThemeSettingsItems.get(22).colorValue; - customTheme.toolbarSecondaryTextColor = customThemeSettingsItems.get(23).colorValue; - customTheme.circularProgressBarBackground = customThemeSettingsItems.get(24).colorValue; - customTheme.tabLayoutWithExpandedCollapsingToolbarTabBackground = customThemeSettingsItems.get(25).colorValue; - customTheme.tabLayoutWithExpandedCollapsingToolbarTextColor = customThemeSettingsItems.get(26).colorValue; - customTheme.tabLayoutWithExpandedCollapsingToolbarTabIndicator = customThemeSettingsItems.get(27).colorValue; - customTheme.tabLayoutWithCollapsedCollapsingToolbarTabBackground = customThemeSettingsItems.get(28).colorValue; - customTheme.tabLayoutWithCollapsedCollapsingToolbarTextColor = customThemeSettingsItems.get(29).colorValue; - customTheme.tabLayoutWithCollapsedCollapsingToolbarTabIndicator = customThemeSettingsItems.get(30).colorValue; - customTheme.upvoted = customThemeSettingsItems.get(31).colorValue; - customTheme.downvoted = customThemeSettingsItems.get(32).colorValue; - customTheme.postTypeBackgroundColor = customThemeSettingsItems.get(33).colorValue; - customTheme.postTypeTextColor = customThemeSettingsItems.get(34).colorValue; - customTheme.spoilerBackgroundColor = customThemeSettingsItems.get(35).colorValue; - customTheme.spoilerTextColor = customThemeSettingsItems.get(36).colorValue; - customTheme.nsfwBackgroundColor = customThemeSettingsItems.get(37).colorValue; - customTheme.nsfwTextColor = customThemeSettingsItems.get(38).colorValue; - customTheme.flairBackgroundColor = customThemeSettingsItems.get(39).colorValue; - customTheme.flairTextColor = customThemeSettingsItems.get(40).colorValue; - 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; + customTheme.bottomAppBarIconColor = customThemeSettingsItems.get(19).colorValue; + customTheme.postIconAndInfoColor = customThemeSettingsItems.get(20).colorValue; + customTheme.commentIconAndInfoColor = customThemeSettingsItems.get(21).colorValue; + customTheme.fabIconColor = customThemeSettingsItems.get(22).colorValue; + customTheme.toolbarPrimaryTextAndIconColor = customThemeSettingsItems.get(23).colorValue; + customTheme.toolbarSecondaryTextColor = customThemeSettingsItems.get(24).colorValue; + customTheme.circularProgressBarBackground = customThemeSettingsItems.get(25).colorValue; + customTheme.tabLayoutWithExpandedCollapsingToolbarTabBackground = customThemeSettingsItems.get(26).colorValue; + customTheme.tabLayoutWithExpandedCollapsingToolbarTextColor = customThemeSettingsItems.get(27).colorValue; + customTheme.tabLayoutWithExpandedCollapsingToolbarTabIndicator = customThemeSettingsItems.get(28).colorValue; + customTheme.tabLayoutWithCollapsedCollapsingToolbarTabBackground = customThemeSettingsItems.get(29).colorValue; + customTheme.tabLayoutWithCollapsedCollapsingToolbarTextColor = customThemeSettingsItems.get(30).colorValue; + customTheme.tabLayoutWithCollapsedCollapsingToolbarTabIndicator = customThemeSettingsItems.get(31).colorValue; + customTheme.upvoted = customThemeSettingsItems.get(32).colorValue; + customTheme.downvoted = customThemeSettingsItems.get(33).colorValue; + customTheme.postTypeBackgroundColor = customThemeSettingsItems.get(34).colorValue; + customTheme.postTypeTextColor = customThemeSettingsItems.get(35).colorValue; + customTheme.spoilerBackgroundColor = customThemeSettingsItems.get(36).colorValue; + customTheme.spoilerTextColor = customThemeSettingsItems.get(37).colorValue; + customTheme.nsfwBackgroundColor = customThemeSettingsItems.get(38).colorValue; + customTheme.nsfwTextColor = customThemeSettingsItems.get(39).colorValue; + customTheme.flairBackgroundColor = customThemeSettingsItems.get(40).colorValue; + customTheme.flairTextColor = customThemeSettingsItems.get(41).colorValue; + customTheme.awardsBackgroundColor = customThemeSettingsItems.get(42).colorValue; + customTheme.awardsTextColor = customThemeSettingsItems.get(43).colorValue; + customTheme.archivedTint = customThemeSettingsItems.get(44).colorValue; + customTheme.lockedIconTint = customThemeSettingsItems.get(45).colorValue; + customTheme.crosspostIconTint = customThemeSettingsItems.get(46).colorValue; + customTheme.stickiedPostIconTint = customThemeSettingsItems.get(47).colorValue; + customTheme.subscribed = customThemeSettingsItems.get(48).colorValue; + customTheme.unsubscribed = customThemeSettingsItems.get(49).colorValue; + customTheme.username = customThemeSettingsItems.get(50).colorValue; + customTheme.subreddit = customThemeSettingsItems.get(51).colorValue; + customTheme.authorFlairTextColor = customThemeSettingsItems.get(52).colorValue; + customTheme.submitter = customThemeSettingsItems.get(53).colorValue; + customTheme.moderator = customThemeSettingsItems.get(54).colorValue; + customTheme.singleCommentThreadBackgroundColor = customThemeSettingsItems.get(55).colorValue; + customTheme.unreadMessageBackgroundColor = customThemeSettingsItems.get(56).colorValue; + customTheme.dividerColor = customThemeSettingsItems.get(57).colorValue; + customTheme.noPreviewLinkBackgroundColor = customThemeSettingsItems.get(58).colorValue; + customTheme.voteAndReplyUnavailableButtonColor = customThemeSettingsItems.get(59).colorValue; + customTheme.commentVerticalBarColor1 = customThemeSettingsItems.get(60).colorValue; + customTheme.commentVerticalBarColor2 = customThemeSettingsItems.get(61).colorValue; + customTheme.commentVerticalBarColor3 = customThemeSettingsItems.get(62).colorValue; + customTheme.commentVerticalBarColor4 = customThemeSettingsItems.get(63).colorValue; + customTheme.commentVerticalBarColor5 = customThemeSettingsItems.get(64).colorValue; + customTheme.commentVerticalBarColor6 = customThemeSettingsItems.get(65).colorValue; + customTheme.commentVerticalBarColor7 = customThemeSettingsItems.get(66).colorValue; + customTheme.navBarColor = customThemeSettingsItems.get(67).colorValue; + customTheme.isLightStatusBar = customThemeSettingsItems.get(68).isEnabled; + customTheme.isLightNavBar = customThemeSettingsItems.get(69).isEnabled; + customTheme.isChangeStatusBarIconColorAfterToolbarCollapsedInImmersiveInterface = customThemeSettingsItems.get(70).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 531f6e8d..b32fcf1a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeSettingsItem.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeSettingsItem.java @@ -131,6 +131,10 @@ public class CustomThemeSettingsItem implements Parcelable { context.getString(R.string.theme_item_primary_icon_color_detail), customTheme.primaryIconColor)); customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_bottom_app_bar_icon_color), + context.getString(R.string.theme_item_bottom_app_bar_icon_color_detail), + customTheme.bottomAppBarIconColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( context.getString(R.string.theme_item_post_icon_and_info_color), context.getString(R.string.theme_item_post_icon_and_info_color_detail), customTheme.postIconAndInfoColor)); 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 ff30966d..aef072c9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeWrapper.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeWrapper.java @@ -127,6 +127,11 @@ public class CustomThemeWrapper { getDefaultColor("#000000", "#FFFFFF", "#FFFFFF")); } + public int getBottomAppBarIconColor() { + return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.BOTTOM_APP_BAR_ICON_COLOR, + getDefaultColor("#000000", "#FFFFFF", "#FFFFFF")); + } + public int getPostIconAndInfoColor() { return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.POST_ICON_AND_INFO_COLOR, getDefaultColor("#8A000000", "#B3FFFFFF", "#B3FFFFFF")); @@ -449,6 +454,7 @@ public class CustomThemeWrapper { customTheme.commentBackgroundColor = Color.parseColor("#FFFFFF"); customTheme.bottomAppBarBackgroundColor = Color.parseColor("#FFFFFF"); customTheme.primaryIconColor = Color.parseColor("#000000"); + customTheme.bottomAppBarIconColor = Color.parseColor("#000000"); customTheme.postIconAndInfoColor = Color.parseColor("#8A000000"); customTheme.commentIconAndInfoColor = Color.parseColor("#8A000000"); customTheme.toolbarPrimaryTextAndIconColor = Color.parseColor("#FFFFFF"); @@ -525,6 +531,7 @@ public class CustomThemeWrapper { customTheme.commentBackgroundColor = Color.parseColor("#242424"); customTheme.bottomAppBarBackgroundColor = Color.parseColor("#121212"); customTheme.primaryIconColor = Color.parseColor("#FFFFFF"); + customTheme.bottomAppBarIconColor = Color.parseColor("#FFFFFF"); customTheme.postIconAndInfoColor = Color.parseColor("#B3FFFFFF"); customTheme.commentIconAndInfoColor = Color.parseColor("#B3FFFFFF"); customTheme.toolbarPrimaryTextAndIconColor = Color.parseColor("#FFFFFF"); @@ -601,6 +608,7 @@ public class CustomThemeWrapper { customTheme.commentBackgroundColor = Color.parseColor("#000000"); customTheme.bottomAppBarBackgroundColor = Color.parseColor("#000000"); customTheme.primaryIconColor = Color.parseColor("#FFFFFF"); + customTheme.bottomAppBarIconColor = Color.parseColor("#FFFFFF"); customTheme.postIconAndInfoColor = Color.parseColor("#B3FFFFFF"); customTheme.commentIconAndInfoColor = Color.parseColor("#B3FFFFFF"); customTheme.toolbarPrimaryTextAndIconColor = Color.parseColor("#FFFFFF"); @@ -677,6 +685,7 @@ public class CustomThemeWrapper { customTheme.commentBackgroundColor = Color.parseColor("#FFFFFF"); customTheme.bottomAppBarBackgroundColor = Color.parseColor("#FFFFFF"); customTheme.primaryIconColor = Color.parseColor("#000000"); + customTheme.bottomAppBarIconColor = Color.parseColor("#000000"); customTheme.postIconAndInfoColor = Color.parseColor("#3C4043"); customTheme.commentIconAndInfoColor = Color.parseColor("#3C4043"); customTheme.toolbarPrimaryTextAndIconColor = Color.parseColor("#3C4043"); @@ -753,6 +762,7 @@ public class CustomThemeWrapper { customTheme.commentBackgroundColor = Color.parseColor("#242424"); customTheme.bottomAppBarBackgroundColor = Color.parseColor("#121212"); customTheme.primaryIconColor = Color.parseColor("#FFFFFF"); + customTheme.bottomAppBarIconColor = Color.parseColor("#FFFFFF"); customTheme.postIconAndInfoColor = Color.parseColor("#B3FFFFFF"); customTheme.commentIconAndInfoColor = Color.parseColor("#B3FFFFFF"); customTheme.toolbarPrimaryTextAndIconColor = Color.parseColor("#FFFFFF"); @@ -829,6 +839,7 @@ public class CustomThemeWrapper { customTheme.commentBackgroundColor = Color.parseColor("#000000"); customTheme.bottomAppBarBackgroundColor = Color.parseColor("#000000"); customTheme.primaryIconColor = Color.parseColor("#FFFFFF"); + customTheme.bottomAppBarIconColor = Color.parseColor("#FFFFFF"); customTheme.postIconAndInfoColor = Color.parseColor("#B3FFFFFF"); customTheme.commentIconAndInfoColor = Color.parseColor("#B3FFFFFF"); customTheme.toolbarPrimaryTextAndIconColor = Color.parseColor("#FFFFFF"); @@ -905,6 +916,7 @@ public class CustomThemeWrapper { customTheme.commentBackgroundColor = Color.parseColor("#FFFFFF"); customTheme.bottomAppBarBackgroundColor = Color.parseColor("#FFFFFF"); customTheme.primaryIconColor = Color.parseColor("#000000"); + customTheme.bottomAppBarIconColor = Color.parseColor("#000000"); customTheme.postIconAndInfoColor = Color.parseColor("#8A000000"); customTheme.commentIconAndInfoColor = Color.parseColor("#8A000000"); customTheme.toolbarPrimaryTextAndIconColor = Color.parseColor("#FFFFFF"); @@ -981,6 +993,7 @@ public class CustomThemeWrapper { customTheme.commentBackgroundColor = Color.parseColor("#242424"); customTheme.bottomAppBarBackgroundColor = Color.parseColor("#121212"); customTheme.primaryIconColor = Color.parseColor("#FFFFFF"); + customTheme.bottomAppBarIconColor = Color.parseColor("#FFFFFF"); customTheme.postIconAndInfoColor = Color.parseColor("#B3FFFFFF"); customTheme.commentIconAndInfoColor = Color.parseColor("#B3FFFFFF"); customTheme.toolbarPrimaryTextAndIconColor = Color.parseColor("#FFFFFF"); @@ -1057,6 +1070,7 @@ public class CustomThemeWrapper { customTheme.commentBackgroundColor = Color.parseColor("#000000"); customTheme.bottomAppBarBackgroundColor = Color.parseColor("#000000"); customTheme.primaryIconColor = Color.parseColor("#FFFFFF"); + customTheme.bottomAppBarIconColor = Color.parseColor("#FFFFFF"); customTheme.postIconAndInfoColor = Color.parseColor("#B3FFFFFF"); customTheme.commentIconAndInfoColor = Color.parseColor("#B3FFFFFF"); customTheme.toolbarPrimaryTextAndIconColor = Color.parseColor("#FFFFFF"); @@ -1133,6 +1147,7 @@ public class CustomThemeWrapper { customTheme.commentBackgroundColor = Color.parseColor("#393A59"); customTheme.bottomAppBarBackgroundColor = Color.parseColor("#393A59"); customTheme.primaryIconColor = Color.parseColor("#FFFFFF"); + customTheme.bottomAppBarIconColor = Color.parseColor("#FFFFFF"); customTheme.postIconAndInfoColor = Color.parseColor("#FFFFFF"); customTheme.commentIconAndInfoColor = Color.parseColor("#FFFFFF"); customTheme.toolbarPrimaryTextAndIconColor = Color.parseColor("#FFFFFF"); @@ -1209,6 +1224,7 @@ public class CustomThemeWrapper { customTheme.commentBackgroundColor = Color.parseColor("#C0F0F4"); customTheme.bottomAppBarBackgroundColor = Color.parseColor("#D48AE0"); customTheme.primaryIconColor = Color.parseColor("#000000"); + customTheme.bottomAppBarIconColor = Color.parseColor("#000000"); customTheme.postIconAndInfoColor = Color.parseColor("#000000"); customTheme.commentIconAndInfoColor = Color.parseColor("#000000"); customTheme.toolbarPrimaryTextAndIconColor = Color.parseColor("#3C4043"); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ParseSubredditData.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ParseSubredditData.java index bb64d7df..73854808 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ParseSubredditData.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ParseSubredditData.java @@ -25,6 +25,7 @@ class ParseSubredditData { String subredditFullName = subredditDataJsonObject.getString(JSONUtils.DISPLAY_NAME_KEY); String description = subredditDataJsonObject.getString(JSONUtils.PUBLIC_DESCRIPTION_KEY).trim(); String sidebarDescription = subredditDataJsonObject.getString(JSONUtils.DESCRIPTION_KEY).trim(); + long createdUTC = subredditDataJsonObject.getLong(JSONUtils.CREATED_UTC_KEY) * 1000; String bannerImageUrl; if (subredditDataJsonObject.isNull(JSONUtils.BANNER_BACKGROUND_IMAGE_KEY)) { @@ -52,7 +53,7 @@ class ParseSubredditData { } return new SubredditData(id, subredditFullName, iconUrl, bannerImageUrl, description, - sidebarDescription, nSubscribers); + sidebarDescription, nSubscribers, createdUTC); } interface ParseSubredditDataListener { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ParseSubscribedThing.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ParseSubscribedThing.java index 97827fc2..97da7db6 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ParseSubscribedThing.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ParseSubscribedThing.java @@ -99,9 +99,10 @@ class ParseSubscribedThing { String description = data.getString(JSONUtils.PUBLIC_DESCRIPTION_KEY).trim(); String sidebarDescription = data.getString(JSONUtils.DESCRIPTION_KEY); int nSubscribers = data.getInt(JSONUtils.SUBSCRIBERS_KEY); + long createdUTC = data.getLong(JSONUtils.CREATED_UTC_KEY); newSubscribedSubredditData.add(new SubscribedSubredditData(id, name, iconUrl, accountName, isFavorite)); newSubredditData.add(new SubredditData(id, subredditFullName, iconUrl, - bannerImageUrl, description, sidebarDescription, nSubscribers)); + bannerImageUrl, description, sidebarDescription, nSubscribers, createdUTC)); } } lastItem = jsonResponse.getJSONObject(JSONUtils.DATA_KEY).getString(JSONUtils.AFTER_KEY); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ParseUserData.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ParseUserData.java index 73932c34..87334324 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ParseUserData.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ParseUserData.java @@ -38,11 +38,13 @@ public class ParseUserData { } int linkKarma = userDataJson.getInt(JSONUtils.LINK_KARMA_KEY); int commentKarma = userDataJson.getInt(JSONUtils.COMMENT_KARMA_KEY); - int karma = linkKarma + commentKarma; + long cakeday = userDataJson.getLong(JSONUtils.CREATED_UTC_KEY) * 1000; boolean isGold = userDataJson.getBoolean(JSONUtils.IS_GOLD_KEY); boolean isFriend = userDataJson.getBoolean(JSONUtils.IS_FRIEND_KEY); + String description = userDataJson.getString(JSONUtils.PUBLIC_DESCRIPTION_KEY); - return new UserData(userName, iconImageUrl, bannerImageUrl, karma, isGold, isFriend, canBeFollowed); + return new UserData(userName, iconImageUrl, bannerImageUrl, linkKarma, commentKarma, cakeday, + isGold, isFriend, canBeFollowed, description); } interface ParseUserDataListener { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java b/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java index 539bd20e..8743c4c9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java @@ -26,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 = 7) + SubscribedUserData.class, MultiReddit.class, CustomTheme.class}, version = 8) public abstract class RedditDataRoomDatabase extends RoomDatabase { private static RedditDataRoomDatabase INSTANCE; @@ -37,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_6_7) + MIGRATION_5_6, MIGRATION_6_7, MIGRATION_7_8) .build(); } } @@ -165,4 +165,25 @@ public abstract class RedditDataRoomDatabase extends RoomDatabase { database.execSQL("ALTER TABLE custom_themes ADD COLUMN awards_text_color INTEGER DEFAULT " + Color.parseColor("#FFFFFF") + " NOT NULL"); } }; + + private static final Migration MIGRATION_7_8 = new Migration(7, 8) { + @Override + public void migrate(@NonNull SupportSQLiteDatabase database) { + database.execSQL("CREATE TABLE users_temp " + + "(name TEXT NOT NULL PRIMARY KEY, icon TEXT, banner TEXT, " + + "link_karma INTEGER NOT NULL, comment_karma INTEGER DEFAULT 0 NOT NULL, created_utc INTEGER DEFAULT 0 NOT NULL," + + "is_gold INTEGER NOT NULL, is_friend INTEGER NOT NULL, can_be_followed INTEGER NOT NULL," + + "description TEXT)"); + database.execSQL( + "INSERT INTO users_temp(name, icon, banner, link_karma, is_gold, is_friend, can_be_followed) SELECT * FROM users"); + database.execSQL("DROP TABLE users"); + database.execSQL("ALTER TABLE users_temp RENAME TO users"); + + database.execSQL("ALTER TABLE subreddits" + + " ADD COLUMN created_utc INTEGER DEFAULT 0 NOT NULL"); + + database.execSQL("ALTER TABLE custom_themes" + + " ADD COLUMN bottom_app_bar_icon_color INTEGER DEFAULT " + Color.parseColor("#000000") + " NOT NULL"); + } + }; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditDatabase/SubredditData.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditDatabase/SubredditData.java index 486bd0a7..6c73f459 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditDatabase/SubredditData.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditDatabase/SubredditData.java @@ -23,9 +23,11 @@ public class SubredditData { private String sidebarDescription; @ColumnInfo(name = "subscribers_count") private int nSubscribers; + @ColumnInfo(name = "created_utc") + private long createdUTC; public SubredditData(@NonNull String id, String name, String iconUrl, String bannerUrl, - String description, String sidebarDescription, int nSubscribers) { + String description, String sidebarDescription, int nSubscribers, long createdUTC) { this.id = id; this.name = name; this.iconUrl = iconUrl; @@ -33,6 +35,7 @@ public class SubredditData { this.description = description; this.sidebarDescription = sidebarDescription; this.nSubscribers = nSubscribers; + this.createdUTC = createdUTC; } @NonNull @@ -63,4 +66,8 @@ public class SubredditData { public int getNSubscribers() { return nSubscribers; } + + public long getCreatedUTC() { + return createdUTC; + } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/User/UserData.java b/app/src/main/java/ml/docilealligator/infinityforreddit/User/UserData.java index f207685e..8ad00b49 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/User/UserData.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/User/UserData.java @@ -15,23 +15,33 @@ public class UserData { private String iconUrl; @ColumnInfo(name = "banner") private String banner; - @ColumnInfo(name = "karma") - private int karma; + @ColumnInfo(name = "link_karma") + private int linkKarma; + @ColumnInfo(name = "comment_karma") + private int commentKarma; + @ColumnInfo(name = "created_utc") + private long cakeday; @ColumnInfo(name = "is_gold") private boolean isGold; @ColumnInfo(name = "is_friend") private boolean isFriend; @ColumnInfo(name = "can_be_followed") private boolean canBeFollowed; + @ColumnInfo(name = "description") + private String description; - public UserData(@NonNull String name, String iconUrl, String banner, int karma, boolean isGold, boolean isFriend, boolean canBeFollowed) { + public UserData(@NonNull String name, String iconUrl, String banner, int linkKarma, int commentKarma, + long cakeday, boolean isGold, boolean isFriend, boolean canBeFollowed, String description) { this.name = name; this.iconUrl = iconUrl; this.banner = banner; - this.karma = karma; + this.commentKarma = commentKarma; + this.linkKarma = linkKarma; + this.cakeday = cakeday; this.isGold = isGold; this.isFriend = isFriend; this.canBeFollowed = canBeFollowed; + this.description = description; } @NonNull @@ -47,8 +57,20 @@ public class UserData { return banner; } + public int getLinkKarma() { + return linkKarma; + } + + public int getCommentKarma() { + return commentKarma; + } + public int getKarma() { - return karma; + return linkKarma + commentKarma; + } + + public long getCakeday() { + return cakeday; } public boolean isGold() { @@ -62,4 +84,8 @@ public class UserData { public boolean isCanBeFollowed() { return canBeFollowed; } + + public String getDescription() { + return description; + } } 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 6e08559b..295013f1 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/CustomThemeSharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/CustomThemeSharedPreferencesUtils.java @@ -29,6 +29,7 @@ public class CustomThemeSharedPreferencesUtils { public static final String COMMENT_BACKGROUND_COLOR = "commentBackgroundColor"; public static final String BOTTOM_APP_BAR_BACKGROUND_COLOR = "bottomAppBarBackgroundColor"; public static final String PRIMARY_ICON_COLOR = "primaryIconColor"; + public static final String BOTTOM_APP_BAR_ICON_COLOR = "bottomAppBarIconColor"; public static final String POST_ICON_AND_INFO_COLOR = "postIconAndInfoColor"; public static final String COMMENT_ICON_AND_INFO_COLOR = "commentIconAndInfoColor"; public static final String TOOLBAR_PRIMARY_TEXT_AND_ICON_COLOR = "toolbarPrimaryTextAndIconColor"; @@ -96,6 +97,7 @@ public class CustomThemeSharedPreferencesUtils { editor.putInt(COMMENT_BACKGROUND_COLOR, customTheme.commentBackgroundColor); editor.putInt(BOTTOM_APP_BAR_BACKGROUND_COLOR, customTheme.bottomAppBarBackgroundColor); editor.putInt(PRIMARY_ICON_COLOR, customTheme.primaryIconColor); + editor.putInt(BOTTOM_APP_BAR_ICON_COLOR, customTheme.bottomAppBarIconColor); editor.putInt(POST_ICON_AND_INFO_COLOR, customTheme.postIconAndInfoColor); editor.putInt(COMMENT_ICON_AND_INFO_COLOR, customTheme.commentIconAndInfoColor); editor.putInt(TOOLBAR_PRIMARY_TEXT_AND_ICON_COLOR, customTheme.toolbarPrimaryTextAndIconColor); @@ -118,6 +120,8 @@ public class CustomThemeSharedPreferencesUtils { editor.putInt(NSFW_TEXT_COLOR, customTheme.nsfwTextColor); editor.putInt(FLAIR_BACKGROUND_COLOR, customTheme.flairBackgroundColor); editor.putInt(FLAIR_TEXT_COLOR, customTheme.flairTextColor); + editor.putInt(AWARDS_BACKGROUND_COLOR, customTheme.awardsBackgroundColor); + editor.putInt(AWARDS_TEXT_COLOR, customTheme.awardsTextColor); editor.putInt(ARCHIVED_ICON_TINT, customTheme.archivedTint); editor.putInt(LOCKED_ICON_TINT, customTheme.lockedIconTint); editor.putInt(CROSSPOST_ICON_TINT, customTheme.crosspostIconTint); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 35dadb3a..945805f1 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -525,7 +525,9 @@ <string name="theme_item_bottom_app_bar_background_color">Bottom Navigation Bar Color</string> <string name="theme_item_bottom_app_bar_background_color_detail">Applied to: Bottom navigation bar</string> <string name="theme_item_primary_icon_color">Primary Icon Color</string> - <string name="theme_item_primary_icon_color_detail">Applied to: Icons in the bottom navigation bar and the navigation drawer.</string> + <string name="theme_item_primary_icon_color_detail">Applied to: Icons in the navigation drawer.</string> + <string name="theme_item_bottom_app_bar_icon_color">Bottom Navigation Bar Icon Color</string> + <string name="theme_item_bottom_app_bar_icon_color_detail">Applied to: Icons in the bottom navigation bar</string> <string name="theme_item_post_icon_and_info_color">Post Icon and Info Color</string> <string name="theme_item_post_icon_and_info_color_detail">Applied to: Icons, score and the number of comments in posts</string> <string name="theme_item_comment_icon_and_info_color">Comment Icon and Info Color</string> |