Add Calm Pastel theme. Fix an fab icon color issue.

This commit is contained in:
Alex Ning 2020-04-05 12:04:35 +08:00
parent b92936b204
commit 28b9eb37da
10 changed files with 88 additions and 18 deletions

View File

@ -5,8 +5,6 @@ import android.content.SharedPreferences;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
@ -266,14 +264,8 @@ public abstract class BaseActivity extends AppCompatActivity {
customThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTextColor());
}
protected void applyFABTheme(FloatingActionButton fab, int drawableId) {
protected void applyFABTheme(FloatingActionButton fab) {
fab.setBackgroundTintList(ColorStateList.valueOf(customThemeWrapper.getColorPrimaryLightTheme()));
fab.setImageTintList(ColorStateList.valueOf(customThemeWrapper.getFABIconColor()));
Drawable myFabSrc = getResources().getDrawable(drawableId);
if (myFabSrc.getConstantState() != null) {
Drawable willBeWhite = myFabSrc.getConstantState().newDrawable();
willBeWhite.mutate().setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_IN);
fab.setImageDrawable(willBeWhite);
}
}
}

View File

@ -311,7 +311,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
applyAppBarLayoutAndToolbarTheme(appBarLayout, toolbar);
applyTabLayoutTheme(tabLayout);
bottomNavigationView.setBackgroundTint(ColorStateList.valueOf(mCustomThemeWrapper.getBottomAppBarBackgroundColor()));
applyFABTheme(fab, R.drawable.ic_add_day_night_24dp);
applyFABTheme(fab);
}
private void getCurrentAccountAndBindView() {

View File

@ -258,6 +258,6 @@ public class MultiRedditListingActivity extends BaseActivity {
mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(mCustomThemeWrapper.getCircularProgressBarBackground());
mSwipeRefreshLayout.setColorSchemeColors(mCustomThemeWrapper.getColorAccent());
mErrorTextView.setTextColor(mCustomThemeWrapper.getSecondaryTextColor());
applyFABTheme(fab, R.drawable.ic_add_day_night_24dp);
applyFABTheme(fab);
}
}

View File

@ -392,8 +392,8 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
nsfwBackgroundColor = mCustomThemeWrapper.getNsfwBackgroundColor();
nsfwTextColor = mCustomThemeWrapper.getNsfwTextColor();
titleEditText.setTextColor(primaryTextColor);
applyFABTheme(captureFab, R.drawable.ic_outline_add_a_photo_24dp);
applyFABTheme(selectFromLibraryFab, R.drawable.ic_outline_select_photo_24dp);
applyFABTheme(captureFab);
applyFABTheme(selectFromLibraryFab);
selectAgainTextView.setTextColor(mCustomThemeWrapper.getColorAccent());
}

View File

@ -397,8 +397,8 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF
nsfwBackgroundColor = mCustomThemeWrapper.getNsfwBackgroundColor();
nsfwTextColor = mCustomThemeWrapper.getNsfwTextColor();
titleEditText.setTextColor(primaryTextColor);
applyFABTheme(captureFab, R.drawable.ic_outline_add_a_photo_24dp);
applyFABTheme(selectFromLibraryFab, R.drawable.ic_outline_select_photo_24dp);
applyFABTheme(captureFab);
applyFABTheme(selectFromLibraryFab);
selectAgainTextView.setTextColor(mCustomThemeWrapper.getColorAccent());
}

View File

@ -141,6 +141,6 @@ public class SelectedSubredditsActivity extends BaseActivity {
protected void applyCustomTheme() {
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
applyAppBarLayoutAndToolbarTheme(appBarLayout, toolbar);
applyFABTheme(fab, R.drawable.ic_add_24dp);
applyFABTheme(fab);
}
}

View File

@ -389,7 +389,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(mCustomThemeWrapper.getCircularProgressBarBackground());
mSwipeRefreshLayout.setColorSchemeColors(mCustomThemeWrapper.getColorAccent());
mFetchPostInfoTextView.setTextColor(mCustomThemeWrapper.getSecondaryTextColor());
applyFABTheme(fab, R.drawable.ic_keyboard_arrow_down_24dp);
applyFABTheme(fab);
}
private void getCurrentAccountAndBindView() {

View File

@ -424,7 +424,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
messageBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
profileBottomAppBar.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN);
applyTabLayoutTheme(tabLayout);
applyFABTheme(fab, R.drawable.ic_add_day_night_24dp);
applyFABTheme(fab);
unsubscribedColor = mCustomThemeWrapper.getUnsubscribed();
subscribedColor = mCustomThemeWrapper.getSubscribed();
}

View File

@ -396,6 +396,8 @@ public class CustomThemeWrapper {
return getRedAmoled(context);
} else if (name.equals(context.getString(R.string.theme_name_dracula))) {
return getDracula(context);
} else if (name.equals(context.getString(R.string.theme_name_calm_pastel))) {
return getCalmPastel(context);
} else {
return getIndigo(context);
}
@ -413,6 +415,7 @@ public class CustomThemeWrapper {
customThemes.add(getRedDark(context));
customThemes.add(getRedAmoled(context));
customThemes.add(getDracula(context));
customThemes.add(getCalmPastel(context));
return customThemes;
}
@ -1155,4 +1158,78 @@ public class CustomThemeWrapper {
return customTheme;
}
public static CustomTheme getCalmPastel(Context context) {
CustomTheme customTheme = new CustomTheme(context.getString(R.string.theme_name_calm_pastel));
customTheme.isLightTheme = true;
customTheme.isDarkTheme = false;
customTheme.isAmoledTheme = false;
customTheme.colorPrimary = Color.parseColor("#D48AE0");
customTheme.colorPrimaryDark = Color.parseColor("#D476E0");
customTheme.colorAccent = Color.parseColor("#775EFF");
customTheme.colorPrimaryLightTheme = Color.parseColor("#D48AE0");
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("#DAD0DE");
customTheme.cardViewBackgroundColor = Color.parseColor("#C0F0F4");
customTheme.commentBackgroundColor = Color.parseColor("#C0F0F4");
customTheme.bottomAppBarBackgroundColor = Color.parseColor("#C0F0F4");
customTheme.primaryIconColor = Color.parseColor("#000000");
customTheme.postIconAndInfoColor = Color.parseColor("#000000");
customTheme.commentIconAndInfoColor = Color.parseColor("#000000");
customTheme.toolbarPrimaryTextAndIconColor = Color.parseColor("#3C4043");
customTheme.toolbarSecondaryTextColor = Color.parseColor("#3C4043");
customTheme.circularProgressBarBackground = Color.parseColor("#D48AE0");
customTheme.tabLayoutWithExpandedCollapsingToolbarTabBackground = Color.parseColor("#FFFFFF");
customTheme.tabLayoutWithExpandedCollapsingToolbarTextColor = Color.parseColor("#D48AE0");
customTheme.tabLayoutWithExpandedCollapsingToolbarTabIndicator = Color.parseColor("#D48AE0");
customTheme.tabLayoutWithCollapsedCollapsingToolbarTabBackground = Color.parseColor("#D48AE0");
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("#25D5E5");
customTheme.unreadMessageBackgroundColor = Color.parseColor("#25D5E5");
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("#000000");
customTheme.chipTextColor = Color.parseColor("#FFFFFF");
customTheme.navBarColor = Color.parseColor("#D48AE0");
customTheme.isLightStatusBar = false;
customTheme.isLightNavBar = true;
customTheme.isChangeStatusBarIconColorAfterToolbarCollapsedInImmersiveInterface = true;
return customTheme;
}
}

View File

@ -634,6 +634,7 @@
<string name="theme_name_red_dark">Red Dark</string>
<string name="theme_name_red_amoled">Red Amoled</string>
<string name="theme_name_dracula">Dracula</string>
<string name="theme_name_calm_pastel">Calm Pastel</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>