Add white themes.

This commit is contained in:
Alex Ning 2020-04-01 22:39:38 +08:00
parent 3feee882c6
commit 5f7ac4349f
3 changed files with 239 additions and 9 deletions

View File

@ -215,18 +215,14 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
if (viewType == VIEW_TYPE_DATA) {
if (mPostLayout == SharedPreferencesUtils.POST_LAYOUT_CARD) {
MaterialCardView cardView = (MaterialCardView) LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post, parent, false);
return new PostViewHolder(cardView);
return new PostViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post, parent, false));
} else {
MaterialCardView cardView = (MaterialCardView) LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_compact, parent, false);
return new PostCompactViewHolder(cardView);
return new PostCompactViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_compact, parent, false));
}
} else if (viewType == VIEW_TYPE_ERROR) {
RelativeLayout relativeLayout = (RelativeLayout) LayoutInflater.from(parent.getContext()).inflate(R.layout.item_footer_error, parent, false);
return new ErrorViewHolder(relativeLayout);
return new ErrorViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_footer_error, parent, false));
} else {
RelativeLayout relativeLayout = (RelativeLayout) LayoutInflater.from(parent.getContext()).inflate(R.layout.item_footer_loading, parent, false);
return new LoadingViewHolder(relativeLayout);
return new LoadingViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_footer_loading, parent, false));
}
}

View File

@ -382,6 +382,12 @@ public class CustomThemeWrapper {
return getIndigoDark(context);
} else if (name.equals(context.getString(R.string.theme_name_indigo_amoled))) {
return getIndigoAmoled(context);
} else if (name.equals(context.getString(R.string.theme_name_white))) {
return getWhite(context);
} else if (name.equals(context.getString(R.string.theme_name_white_dark))) {
return getWhiteDark(context);
} else if (name.equals(context.getString(R.string.theme_name_white_amoled))) {
return getWhiteAmoled(context);
} else {
return getIndigo(context);
}
@ -392,6 +398,9 @@ public class CustomThemeWrapper {
customThemes.add(getIndigo(context));
customThemes.add(getIndigoDark(context));
customThemes.add(getIndigoAmoled(context));
customThemes.add(getWhite(context));
customThemes.add(getWhiteDark(context));
customThemes.add(getWhiteAmoled(context));
return customThemes;
}
@ -616,4 +625,226 @@ public class CustomThemeWrapper {
return customTheme;
}
public static CustomTheme getWhite(Context context) {
CustomTheme customTheme = new CustomTheme(context.getString(R.string.theme_name_white));
customTheme.isLightTheme = true;
customTheme.isDarkTheme = false;
customTheme.isAmoledTheme = false;
customTheme.colorPrimary = Color.parseColor("#FFFFFF");
customTheme.colorPrimaryDark = Color.parseColor("#FFFFFF");
customTheme.colorAccent = Color.parseColor("#000000");
customTheme.colorPrimaryLightTheme = Color.parseColor("#FFFFFF");
customTheme.primaryTextColor = Color.parseColor("#000000");
customTheme.secondaryTextColor = Color.parseColor("#8A000000");
customTheme.postTitleColor = Color.parseColor("#000000");
customTheme.postContentColor = Color.parseColor("#8A000000");
customTheme.commentColor = Color.parseColor("#000000");
customTheme.buttonTextColor = Color.parseColor("#FFFFFF");
customTheme.backgroundColor = Color.parseColor("#FFFFFF");
customTheme.cardViewBackgroundColor = Color.parseColor("#FFFFFF");
customTheme.commentBackgroundColor = Color.parseColor("#FFFFFF");
customTheme.bottomAppBarBackgroundColor = Color.parseColor("#FFFFFF");
customTheme.primaryIconColor = Color.parseColor("#000000");
customTheme.postIconAndInfoColor = Color.parseColor("#3C4043");
customTheme.commentIconAndInfoColor = Color.parseColor("#3C4043");
customTheme.toolbarPrimaryTextAndIconColor = Color.parseColor("#3C4043");
customTheme.toolbarSecondaryTextColor = Color.parseColor("#3C4043");
customTheme.circularProgressBarBackground = Color.parseColor("#FFFFFF");
customTheme.tabLayoutWithExpandedCollapsingToolbarTabBackground = Color.parseColor("#FFFFFF");
customTheme.tabLayoutWithExpandedCollapsingToolbarTextColor = Color.parseColor("#3C4043");
customTheme.tabLayoutWithExpandedCollapsingToolbarTabIndicator = Color.parseColor("#3C4043");
customTheme.tabLayoutWithCollapsedCollapsingToolbarTabBackground = Color.parseColor("#FFFFFF");
customTheme.tabLayoutWithCollapsedCollapsingToolbarTextColor = Color.parseColor("#3C4043");
customTheme.tabLayoutWithCollapsedCollapsingToolbarTabIndicator = Color.parseColor("#3C4043");
customTheme.upvoted = Color.parseColor("#E91E63");
customTheme.downvoted = Color.parseColor("#007DDE");
customTheme.postTypeBackgroundColor = Color.parseColor("#0D47A1");
customTheme.postTypeTextColor = Color.parseColor("#FFFFFF");
customTheme.spoilerBackgroundColor = Color.parseColor("#EE02EB");
customTheme.spoilerTextColor = Color.parseColor("#FFFFFF");
customTheme.nsfwBackgroundColor = Color.parseColor("#FF4081");
customTheme.nsfwTextColor = Color.parseColor("#FFFFFF");
customTheme.flairBackgroundColor = Color.parseColor("#00AA8C");
customTheme.flairTextColor = Color.parseColor("#FFFFFF");
customTheme.archivedTint = Color.parseColor("#B4009F");
customTheme.lockedIconTint = Color.parseColor("#EE7302");
customTheme.crosspostIconTint = Color.parseColor("#FF4081");
customTheme.stickiedPostIconTint = Color.parseColor("#0D47A1");
customTheme.subscribed = Color.parseColor("#FF4081");
customTheme.unsubscribed = Color.parseColor("#0D47A1");
customTheme.username = Color.parseColor("#0D47A1");
customTheme.subreddit = Color.parseColor("#E91E63");
customTheme.authorFlairTextColor = Color.parseColor("#EE02C4");
customTheme.submitter = Color.parseColor("#EE8A02");
customTheme.moderator = Color.parseColor("#00BA81");
customTheme.singleCommentThreadBackgroundColor = Color.parseColor("#B3E5F9");
customTheme.unreadMessageBackgroundColor = Color.parseColor("#B3E5F9");
customTheme.dividerColor = Color.parseColor("#E0E0E0");
customTheme.noPreviewLinkBackgroundColor = Color.parseColor("#000000");
customTheme.voteAndReplyUnavailableButtonColor = Color.parseColor("#F0F0F0");
customTheme.commentVerticalBarColor1 = Color.parseColor("#1565C0");
customTheme.commentVerticalBarColor2 = Color.parseColor("#EE02BE");
customTheme.commentVerticalBarColor3 = Color.parseColor("#02DFEE");
customTheme.commentVerticalBarColor4 = Color.parseColor("#EED502");
customTheme.commentVerticalBarColor5 = Color.parseColor("#EE0220");
customTheme.commentVerticalBarColor6 = Color.parseColor("#02EE6E");
customTheme.commentVerticalBarColor7 = Color.parseColor("#EE4602");
customTheme.fabIconColor = Color.parseColor("#000000");
customTheme.chipTextColor = Color.parseColor("#FFFFFF");
customTheme.navBarColor = Color.parseColor("#FFFFFF");
customTheme.isLightStatusBar = true;
customTheme.isLightNavBar = true;
customTheme.isChangeStatusBarIconColorAfterToolbarCollapsedInImmersiveInterface = false;
return customTheme;
}
public static CustomTheme getWhiteDark(Context context) {
CustomTheme customTheme = new CustomTheme(context.getString(R.string.theme_name_white_dark));
customTheme.isLightTheme = false;
customTheme.isDarkTheme = true;
customTheme.isAmoledTheme = false;
customTheme.colorPrimary = Color.parseColor("#242424");
customTheme.colorPrimaryDark = Color.parseColor("#121212");
customTheme.colorAccent = Color.parseColor("#FFFFFF");
customTheme.colorPrimaryLightTheme = Color.parseColor("#121212");
customTheme.primaryTextColor = Color.parseColor("#FFFFFF");
customTheme.secondaryTextColor = Color.parseColor("#B3FFFFFF");
customTheme.postTitleColor = Color.parseColor("#FFFFFF");
customTheme.postContentColor = Color.parseColor("#B3FFFFFF");
customTheme.commentColor = Color.parseColor("#FFFFFF");
customTheme.buttonTextColor = Color.parseColor("#FFFFFF");
customTheme.backgroundColor = Color.parseColor("#121212");
customTheme.cardViewBackgroundColor = Color.parseColor("#242424");
customTheme.commentBackgroundColor = Color.parseColor("#242424");
customTheme.bottomAppBarBackgroundColor = Color.parseColor("#121212");
customTheme.primaryIconColor = Color.parseColor("#FFFFFF");
customTheme.postIconAndInfoColor = Color.parseColor("#B3FFFFFF");
customTheme.commentIconAndInfoColor = Color.parseColor("#B3FFFFFF");
customTheme.toolbarPrimaryTextAndIconColor = Color.parseColor("#FFFFFF");
customTheme.toolbarSecondaryTextColor = Color.parseColor("#FFFFFF");
customTheme.circularProgressBarBackground = Color.parseColor("#242424");
customTheme.tabLayoutWithExpandedCollapsingToolbarTabBackground = Color.parseColor("#242424");
customTheme.tabLayoutWithExpandedCollapsingToolbarTextColor = Color.parseColor("#FFFFFF");
customTheme.tabLayoutWithExpandedCollapsingToolbarTabIndicator = Color.parseColor("#FFFFFF");
customTheme.tabLayoutWithCollapsedCollapsingToolbarTabBackground = Color.parseColor("#242424");
customTheme.tabLayoutWithCollapsedCollapsingToolbarTextColor = Color.parseColor("#FFFFFF");
customTheme.tabLayoutWithCollapsedCollapsingToolbarTabIndicator = Color.parseColor("#FFFFFF");
customTheme.upvoted = Color.parseColor("#E91E63");
customTheme.downvoted = Color.parseColor("#007DDE");
customTheme.postTypeBackgroundColor = Color.parseColor("#1565C0");
customTheme.postTypeTextColor = Color.parseColor("#FFFFFF");
customTheme.spoilerBackgroundColor = Color.parseColor("#EE02EB");
customTheme.spoilerTextColor = Color.parseColor("#FFFFFF");
customTheme.nsfwBackgroundColor = Color.parseColor("#FF4081");
customTheme.nsfwTextColor = Color.parseColor("#FFFFFF");
customTheme.flairBackgroundColor = Color.parseColor("#00AA8C");
customTheme.flairTextColor = Color.parseColor("#FFFFFF");
customTheme.archivedTint = Color.parseColor("#B4009F");
customTheme.lockedIconTint = Color.parseColor("#EE7302");
customTheme.crosspostIconTint = Color.parseColor("#FF4081");
customTheme.stickiedPostIconTint = Color.parseColor("#1565C0");
customTheme.subscribed = Color.parseColor("#FF4081");
customTheme.unsubscribed = Color.parseColor("#1565C0");
customTheme.username = Color.parseColor("#1E88E5");
customTheme.subreddit = Color.parseColor("#E91E63");
customTheme.authorFlairTextColor = Color.parseColor("#EE02C4");
customTheme.submitter = Color.parseColor("#EE8A02");
customTheme.moderator = Color.parseColor("#00BA81");
customTheme.singleCommentThreadBackgroundColor = Color.parseColor("#123E77");
customTheme.unreadMessageBackgroundColor = Color.parseColor("#123E77");
customTheme.dividerColor = Color.parseColor("#69666C");
customTheme.noPreviewLinkBackgroundColor = Color.parseColor("#000000");
customTheme.voteAndReplyUnavailableButtonColor = Color.parseColor("#3C3C3C");
customTheme.commentVerticalBarColor1 = Color.parseColor("#1565C0");
customTheme.commentVerticalBarColor2 = Color.parseColor("#C300B3");
customTheme.commentVerticalBarColor3 = Color.parseColor("#00B8DA");
customTheme.commentVerticalBarColor4 = Color.parseColor("#EDCA00");
customTheme.commentVerticalBarColor5 = Color.parseColor("#EE0219");
customTheme.commentVerticalBarColor6 = Color.parseColor("#00B925");
customTheme.commentVerticalBarColor7 = Color.parseColor("#EE4602");
customTheme.fabIconColor = Color.parseColor("#FFFFFF");
customTheme.chipTextColor = Color.parseColor("#FFFFFF");
customTheme.navBarColor = Color.parseColor("#121212");
customTheme.isLightStatusBar = false;
customTheme.isLightNavBar = false;
customTheme.isChangeStatusBarIconColorAfterToolbarCollapsedInImmersiveInterface = false;
return customTheme;
}
public static CustomTheme getWhiteAmoled(Context context) {
CustomTheme customTheme = new CustomTheme(context.getString(R.string.theme_name_white_amoled));
customTheme.isLightTheme = false;
customTheme.isDarkTheme = false;
customTheme.isAmoledTheme = true;
customTheme.colorPrimary = Color.parseColor("#000000");
customTheme.colorPrimaryDark = Color.parseColor("#000000");
customTheme.colorAccent = Color.parseColor("#FFFFFF");
customTheme.colorPrimaryLightTheme = Color.parseColor("#000000");
customTheme.primaryTextColor = Color.parseColor("#FFFFFF");
customTheme.secondaryTextColor = Color.parseColor("#B3FFFFFF");
customTheme.postTitleColor = Color.parseColor("#FFFFFF");
customTheme.postContentColor = Color.parseColor("#B3FFFFFF");
customTheme.commentColor = Color.parseColor("#FFFFFF");
customTheme.buttonTextColor = Color.parseColor("#FFFFFF");
customTheme.backgroundColor = Color.parseColor("#000000");
customTheme.cardViewBackgroundColor = Color.parseColor("#000000");
customTheme.commentBackgroundColor = Color.parseColor("#000000");
customTheme.bottomAppBarBackgroundColor = Color.parseColor("#000000");
customTheme.primaryIconColor = Color.parseColor("#FFFFFF");
customTheme.postIconAndInfoColor = Color.parseColor("#B3FFFFFF");
customTheme.commentIconAndInfoColor = Color.parseColor("#B3FFFFFF");
customTheme.toolbarPrimaryTextAndIconColor = Color.parseColor("#FFFFFF");
customTheme.toolbarSecondaryTextColor = Color.parseColor("#FFFFFF");
customTheme.circularProgressBarBackground = Color.parseColor("#000000");
customTheme.tabLayoutWithExpandedCollapsingToolbarTabBackground = Color.parseColor("#000000");
customTheme.tabLayoutWithExpandedCollapsingToolbarTextColor = Color.parseColor("#FFFFFF");
customTheme.tabLayoutWithExpandedCollapsingToolbarTabIndicator = Color.parseColor("#FFFFFF");
customTheme.tabLayoutWithCollapsedCollapsingToolbarTabBackground = Color.parseColor("#000000");
customTheme.tabLayoutWithCollapsedCollapsingToolbarTextColor = Color.parseColor("#FFFFFF");
customTheme.tabLayoutWithCollapsedCollapsingToolbarTabIndicator = Color.parseColor("#FFFFFF");
customTheme.upvoted = Color.parseColor("#E91E63");
customTheme.downvoted = Color.parseColor("#007DDE");
customTheme.postTypeBackgroundColor = Color.parseColor("#1565C0");
customTheme.postTypeTextColor = Color.parseColor("#FFFFFF");
customTheme.spoilerBackgroundColor = Color.parseColor("#EE02EB");
customTheme.spoilerTextColor = Color.parseColor("#FFFFFF");
customTheme.nsfwBackgroundColor = Color.parseColor("#FF4081");
customTheme.nsfwTextColor = Color.parseColor("#FFFFFF");
customTheme.flairBackgroundColor = Color.parseColor("#00AA8C");
customTheme.flairTextColor = Color.parseColor("#FFFFFF");
customTheme.archivedTint = Color.parseColor("#B4009F");
customTheme.lockedIconTint = Color.parseColor("#EE7302");
customTheme.crosspostIconTint = Color.parseColor("#FF4081");
customTheme.stickiedPostIconTint = Color.parseColor("#1565C0");
customTheme.subscribed = Color.parseColor("#FF4081");
customTheme.unsubscribed = Color.parseColor("#1565C0");
customTheme.username = Color.parseColor("#1E88E5");
customTheme.subreddit = Color.parseColor("#E91E63");
customTheme.authorFlairTextColor = Color.parseColor("#EE02C4");
customTheme.submitter = Color.parseColor("#EE8A02");
customTheme.moderator = Color.parseColor("#00BA81");
customTheme.singleCommentThreadBackgroundColor = Color.parseColor("#123E77");
customTheme.unreadMessageBackgroundColor = Color.parseColor("#123E77");
customTheme.dividerColor = Color.parseColor("#69666C");
customTheme.noPreviewLinkBackgroundColor = Color.parseColor("#000000");
customTheme.voteAndReplyUnavailableButtonColor = Color.parseColor("#3C3C3C");
customTheme.commentVerticalBarColor1 = Color.parseColor("#1565C0");
customTheme.commentVerticalBarColor2 = Color.parseColor("#C300B3");
customTheme.commentVerticalBarColor3 = Color.parseColor("#00B8DA");
customTheme.commentVerticalBarColor4 = Color.parseColor("#EDCA00");
customTheme.commentVerticalBarColor5 = Color.parseColor("#EE0219");
customTheme.commentVerticalBarColor6 = Color.parseColor("#00B925");
customTheme.commentVerticalBarColor7 = Color.parseColor("#EE4602");
customTheme.fabIconColor = Color.parseColor("#FFFFFF");
customTheme.chipTextColor = Color.parseColor("#FFFFFF");
customTheme.navBarColor = Color.parseColor("#000000");
customTheme.isLightStatusBar = false;
customTheme.isLightNavBar = false;
customTheme.isChangeStatusBarIconColorAfterToolbarCollapsedInImmersiveInterface = false;
return customTheme;
}
}

View File

@ -490,7 +490,7 @@
<string name="theme_item_color_accent">Color Accent</string>
<string name="theme_item_color_accent_detail">Applied to: Progress Bar, etc</string>
<string name="theme_item_color_primary_light_theme">Color Primary Light Theme</string>
<string name="theme_item_color_primary_light_theme_detail">Has effect only when this theme is set as light theme.\nApplied to: background of Floating Action Button and Button</string>
<string name="theme_item_color_primary_light_theme_detail">Applied to: background of Floating Action Button and Button</string>
<string name="theme_item_primary_text_color">Primary Text Color</string>
<string name="theme_item_primary_text_color_detail">Applied to: Primary text</string>
<string name="theme_item_secondary_text_color">Secondary Text Color</string>
@ -620,6 +620,9 @@
<string name="theme_name_indigo">Indigo</string>
<string name="theme_name_indigo_dark">Indigo Dark</string>
<string name="theme_name_indigo_amoled">Indigo Amoled</string>
<string name="theme_name_white">White</string>
<string name="theme_name_white_dark">White Dark</string>
<string name="theme_name_white_amoled">White Amoled</string>
<string name="create_light_theme">Create a Light Theme\nBase on Indigo Theme</string>
<string name="create_dark_theme">Create a Dark Theme\nBase on Indigo Dark Theme</string>
<string name="create_amoled_theme">Create an Amoled Theme\nBase on Indigo Amoled Theme</string>