Fix some issues in themeing. Add red themes.

This commit is contained in:
Alex Ning 2020-04-04 23:00:11 +08:00
parent 354298a6ed
commit b54909dd15
8 changed files with 248 additions and 11 deletions

View File

@ -319,13 +319,13 @@ public class ThemePreviewActivity extends AppCompatActivity {
collapsedTabTextColor = customTheme.tabLayoutWithCollapsedCollapsingToolbarTextColor;
collapsedTabIndicatorColor = customTheme.tabLayoutWithCollapsedCollapsingToolbarTabIndicator;
collapsedTabBackgroundColor = customTheme.tabLayoutWithCollapsedCollapsingToolbarTabBackground;
linearLayout.setBackgroundColor(customTheme.backgroundColor);
linearLayout.setBackgroundColor(customTheme.tabLayoutWithExpandedCollapsingToolbarTabBackground);
subredditNameTextView.setTextColor(customTheme.subreddit);
usernameTextView.setTextColor(customTheme.username);
subscribeSubredditChip.setTextColor(customTheme.chipTextColor);
primaryTextView.setTextColor(customTheme.primaryTextColor);
secondaryTextView.setTextColor(customTheme.secondaryTextColor);
bottomNavigationView.setBackgroundTint(ColorStateList.valueOf(customTheme.backgroundColor));
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);
@ -358,10 +358,8 @@ public class ThemePreviewActivity extends AppCompatActivity {
TypedValue tv = new TypedValue();
if (getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true))
{
int dp16 = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16, getResources().getDisplayMetrics());
linearLayout.setPadding(dp16,
TypedValue.complexToDimensionPixelSize(tv.data,getResources().getDisplayMetrics()) + statusBarHeight,
dp16, 0);
((ViewGroup.MarginLayoutParams)linearLayout.getLayoutParams()).setMargins(0,
TypedValue.complexToDimensionPixelSize(tv.data,getResources().getDisplayMetrics()) + statusBarHeight, 0, 0);
}
}
}

View File

@ -401,8 +401,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
@Override
protected void applyCustomTheme() {
int backgroundColor = mCustomThemeWrapper.getBackgroundColor();
coordinatorLayout.setBackgroundColor(backgroundColor);
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
collapsingToolbarLayout.setContentScrimColor(mCustomThemeWrapper.getColorPrimary());
applyAppBarLayoutAndToolbarTheme(appBarLayout, toolbar);
expandedTabTextColor = mCustomThemeWrapper.getTabLayoutWithExpandedCollapsingToolbarTextColor();
@ -411,14 +410,14 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
collapsedTabTextColor = mCustomThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTextColor();
collapsedTabIndicatorColor = mCustomThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTabIndicator();
collapsedTabBackgroundColor = mCustomThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTabBackground();
linearLayout.setBackgroundColor(backgroundColor);
linearLayout.setBackgroundColor(expandedTabBackgroundColor);
subredditNameTextView.setTextColor(mCustomThemeWrapper.getSubreddit());
subscribeSubredditChip.setTextColor(mCustomThemeWrapper.getChipTextColor());
int primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor();
nSubscribersTextView.setTextColor(primaryTextColor);
nOnlineSubscribersTextView.setTextColor(primaryTextColor);
descriptionTextView.setTextColor(primaryTextColor);
bottomNavigationView.setBackgroundTint(ColorStateList.valueOf(backgroundColor));
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);

View File

@ -14,6 +14,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
@ -99,6 +100,8 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
AppBarLayout appBarLayout;
@BindView(R.id.toolbar_view_user_detail_activity)
Toolbar toolbar;
@BindView(R.id.toolbar_linear_layout_view_user_detail_activity)
LinearLayout linearLayout;
@BindView(R.id.tab_layout_view_user_detail_activity)
TabLayout tabLayout;
@BindView(R.id.collapsing_toolbar_layout_view_user_detail_activity)
@ -424,6 +427,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
collapsedTabTextColor = mCustomThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTextColor();
collapsedTabIndicatorColor = mCustomThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTabIndicator();
collapsedTabBackgroundColor = mCustomThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTabBackground();
linearLayout.setBackgroundColor(expandedTabBackgroundColor);
unsubscribedColor = mCustomThemeWrapper.getUnsubscribed();
subscribedColor = mCustomThemeWrapper.getSubscribed();
userNameTextView.setTextColor(mCustomThemeWrapper.getUsername());

View File

@ -252,6 +252,7 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl
DataViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
itemView.setBackgroundColor(mMessageBackgroundColor);
authorTextView.setTextColor(mUsernameColor);
subjectTextView.setTextColor(mPrimaryTextColor);
titleTextView.setTextColor(mPrimaryTextColor);

View File

@ -388,6 +388,12 @@ public class CustomThemeWrapper {
return getWhiteDark(context);
} else if (name.equals(context.getString(R.string.theme_name_white_amoled))) {
return getWhiteAmoled(context);
} else if (name.equals(context.getString(R.string.theme_name_red))) {
return getRed(context);
} else if (name.equals(context.getString(R.string.theme_name_red_dark))) {
return getRedDark(context);
} else if (name.equals(context.getString(R.string.theme_name_red_amoled))) {
return getRedAmoled(context);
} else {
return getIndigo(context);
}
@ -401,6 +407,9 @@ public class CustomThemeWrapper {
customThemes.add(getWhite(context));
customThemes.add(getWhiteDark(context));
customThemes.add(getWhiteAmoled(context));
customThemes.add(getRed(context));
customThemes.add(getRedDark(context));
customThemes.add(getRedAmoled(context));
return customThemes;
}
@ -847,4 +856,226 @@ public class CustomThemeWrapper {
return customTheme;
}
public static CustomTheme getRed(Context context) {
CustomTheme customTheme = new CustomTheme(context.getString(R.string.theme_name_red));
customTheme.isLightTheme = true;
customTheme.isDarkTheme = false;
customTheme.isAmoledTheme = false;
customTheme.colorPrimary = Color.parseColor("#EE0270");
customTheme.colorPrimaryDark = Color.parseColor("#C60466");
customTheme.colorAccent = Color.parseColor("#02EE80");
customTheme.colorPrimaryLightTheme = Color.parseColor("#EE0270");
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("#8A000000");
customTheme.commentIconAndInfoColor = Color.parseColor("#8A000000");
customTheme.toolbarPrimaryTextAndIconColor = Color.parseColor("#FFFFFF");
customTheme.toolbarSecondaryTextColor = Color.parseColor("#FFFFFF");
customTheme.circularProgressBarBackground = Color.parseColor("#FFFFFF");
customTheme.tabLayoutWithExpandedCollapsingToolbarTabBackground = Color.parseColor("#FFFFFF");
customTheme.tabLayoutWithExpandedCollapsingToolbarTextColor = Color.parseColor("#EE0270");
customTheme.tabLayoutWithExpandedCollapsingToolbarTabIndicator = Color.parseColor("#EE0270");
customTheme.tabLayoutWithCollapsedCollapsingToolbarTabBackground = Color.parseColor("#EE0270");
customTheme.tabLayoutWithCollapsedCollapsingToolbarTextColor = Color.parseColor("#FFFFFF");
customTheme.tabLayoutWithCollapsedCollapsingToolbarTabIndicator = Color.parseColor("#FFFFFF");
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("#E0E0E0");
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("#FFFFFF");
customTheme.chipTextColor = Color.parseColor("#FFFFFF");
customTheme.navBarColor = Color.parseColor("#FFFFFF");
customTheme.isLightStatusBar = false;
customTheme.isLightNavBar = true;
customTheme.isChangeStatusBarIconColorAfterToolbarCollapsedInImmersiveInterface = true;
return customTheme;
}
public static CustomTheme getRedDark(Context context) {
CustomTheme customTheme = new CustomTheme(context.getString(R.string.theme_name_red_dark));
customTheme.isLightTheme = false;
customTheme.isDarkTheme = true;
customTheme.isAmoledTheme = false;
customTheme.colorPrimary = Color.parseColor("#242424");
customTheme.colorPrimaryDark = Color.parseColor("#121212");
customTheme.colorAccent = Color.parseColor("#02EE80");
customTheme.colorPrimaryLightTheme = Color.parseColor("#EE0270");
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("#424242");
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 getRedAmoled(Context context) {
CustomTheme customTheme = new CustomTheme(context.getString(R.string.theme_name_red_amoled));
customTheme.isLightTheme = false;
customTheme.isDarkTheme = false;
customTheme.isAmoledTheme = true;
customTheme.colorPrimary = Color.parseColor("#000000");
customTheme.colorPrimaryDark = Color.parseColor("#000000");
customTheme.colorAccent = Color.parseColor("#02EE80");
customTheme.colorPrimaryLightTheme = Color.parseColor("#EE0270");
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("#424242");
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

@ -32,7 +32,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="180dp"
android:paddingTop="16dp"
android:paddingStart="16dp"
android:paddingEnd="16dp">

View File

@ -51,6 +51,7 @@
android:elevation="4dp" />
<LinearLayout
android:id="@+id/toolbar_linear_layout_view_user_detail_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"

View File

@ -630,6 +630,9 @@
<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="theme_name_red">Red</string>
<string name="theme_name_red_dark">Red Dark</string>
<string name="theme_name_red_amoled">Red 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>