Still implementing custom themes.

This commit is contained in:
Alex Ning 2020-03-15 23:34:23 +08:00
parent e076e2374f
commit fe658dd9e2
61 changed files with 739 additions and 672 deletions

View File

@ -156,9 +156,8 @@ public class AccountPostsActivity extends BaseActivity implements SortTypeSelect
@Override @Override
protected void applyCustomTheme() { protected void applyCustomTheme() {
int themeType = mCustomThemeWrapper.getThemeType(); coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor());
appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType));
} }
private void getCurrentAccountAndInitializeFragment() { private void getCurrentAccountAndInitializeFragment() {

View File

@ -155,10 +155,9 @@ public class AccountSavedThingActivity extends BaseActivity {
@Override @Override
protected void applyCustomTheme() { protected void applyCustomTheme() {
int themeType = mCustomThemeWrapper.getThemeType(); coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor());
appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); applyTabLayoutTheme(tabLayout);
applyTabLayoutTheme(tabLayout, mCustomThemeWrapper, themeType);
} }
private void getCurrentAccountAndInitializeViewPager() { private void getCurrentAccountAndInitializeViewPager() {

View File

@ -4,6 +4,9 @@ import android.content.SharedPreferences;
import android.content.res.ColorStateList; import android.content.res.ColorStateList;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.content.res.Resources; 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.Build;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
@ -25,6 +28,7 @@ import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.FontStyle; import ml.docilealligator.infinityforreddit.FontStyle;
import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.TitleFontStyle; import ml.docilealligator.infinityforreddit.TitleFontStyle;
import ml.docilealligator.infinityforreddit.Utils.CustomThemeSharedPreferencesUtils;
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY; import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
@ -34,11 +38,11 @@ import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
public abstract class BaseActivity extends AppCompatActivity { public abstract class BaseActivity extends AppCompatActivity {
private boolean immersiveInterface; private boolean immersiveInterface;
private boolean lightStatusbar;
private boolean changeStatusBarIconColor = true; private boolean changeStatusBarIconColor = true;
private boolean transparentStatusBarAfterToolbarCollapsed; private boolean transparentStatusBarAfterToolbarCollapsed;
private int systemVisibilityToolbarExpanded; private int systemVisibilityToolbarExpanded = 0;
private int systemVisibilityToolbarCollapsed; private int systemVisibilityToolbarCollapsed = 0;
private CustomThemeWrapper customThemeWrapper;
@Override @Override
protected void onCreate(@Nullable Bundle savedInstanceState) { protected void onCreate(@Nullable Bundle savedInstanceState) {
@ -49,18 +53,22 @@ public abstract class BaseActivity extends AppCompatActivity {
int systemThemeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2")); int systemThemeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
immersiveInterface = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && immersiveInterface = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O &&
mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true); mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true);
customThemeWrapper = getCustomThemeWrapper();
switch (systemThemeType) { switch (systemThemeType) {
case 0: case 0:
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO); AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
getTheme().applyStyle(R.style.Theme_Purple, true); getTheme().applyStyle(R.style.Theme_Purple, true);
changeStatusBarIconColor = immersiveInterface; changeStatusBarIconColor = immersiveInterface;
customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.NORMAL);
break; break;
case 1: case 1:
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES); AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
if(mSharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) { if(mSharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) {
getTheme().applyStyle(R.style.Theme_Default_AmoledDark, true); getTheme().applyStyle(R.style.Theme_Default_AmoledDark, true);
customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.AMOLED_DARK);
} else { } else {
getTheme().applyStyle(R.style.Theme_Default_NormalDark, true); getTheme().applyStyle(R.style.Theme_Default_NormalDark, true);
customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.DARK);
} }
changeStatusBarIconColor = false; changeStatusBarIconColor = false;
break; break;
@ -73,11 +81,14 @@ public abstract class BaseActivity extends AppCompatActivity {
if((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_NO) { if((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_NO) {
getTheme().applyStyle(R.style.Theme_Purple, true); getTheme().applyStyle(R.style.Theme_Purple, true);
changeStatusBarIconColor = immersiveInterface; changeStatusBarIconColor = immersiveInterface;
customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.NORMAL);
} else { } else {
if(mSharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) { if(mSharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) {
getTheme().applyStyle(R.style.Theme_Default_AmoledDark, true); getTheme().applyStyle(R.style.Theme_Default_AmoledDark, true);
customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.AMOLED_DARK);
} else { } else {
getTheme().applyStyle(R.style.Theme_Default_NormalDark, true); getTheme().applyStyle(R.style.Theme_Default_NormalDark, true);
customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.DARK);
} }
changeStatusBarIconColor = false; changeStatusBarIconColor = false;
} }
@ -92,33 +103,49 @@ public abstract class BaseActivity extends AppCompatActivity {
getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences
.getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true); .getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true);
CustomThemeWrapper customThemeWrapper = getCustomThemeWrapper();
int themeType = customThemeWrapper.getThemeType();
Window window = getWindow(); Window window = getWindow();
View decorView = window.getDecorView(); View decorView = window.getDecorView();
window.setStatusBarColor(customThemeWrapper.getColorPrimaryDark(themeType)); window.setStatusBarColor(customThemeWrapper.getColorPrimaryDark());
boolean isLightStatusbar = customThemeWrapper.isLightStatusBar();
boolean isLightNavBar = customThemeWrapper.isLightNavBar();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
if (lightStatusbar) { if (isLightStatusbar) {
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR); if (isLightNavBar) {
systemVisibilityToolbarExpanded = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR; systemVisibilityToolbarExpanded = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
if (changeStatusBarIconColor) { if (changeStatusBarIconColor) {
systemVisibilityToolbarCollapsed = View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR; systemVisibilityToolbarCollapsed = View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
} else {
systemVisibilityToolbarCollapsed = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
}
} else {
systemVisibilityToolbarExpanded = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
if (!changeStatusBarIconColor) {
systemVisibilityToolbarCollapsed = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
}
} }
} else { } else {
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR); if (isLightNavBar) {
systemVisibilityToolbarExpanded = View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR; systemVisibilityToolbarExpanded = View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
if (changeStatusBarIconColor) { if (changeStatusBarIconColor) {
systemVisibilityToolbarCollapsed = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR; systemVisibilityToolbarCollapsed = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
}
} else {
if (changeStatusBarIconColor) {
systemVisibilityToolbarCollapsed = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
}
} }
} }
window.setNavigationBarColor(customThemeWrapper.getNavBarColor(themeType)); decorView.setSystemUiVisibility(systemVisibilityToolbarExpanded);
window.setNavigationBarColor(customThemeWrapper.getNavBarColor());
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (lightStatusbar) { if (isLightStatusbar) {
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
systemVisibilityToolbarExpanded = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; systemVisibilityToolbarExpanded = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
} if (!changeStatusBarIconColor) {
if (changeStatusBarIconColor) { systemVisibilityToolbarCollapsed = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
systemVisibilityToolbarCollapsed = 0; }
} else if (changeStatusBarIconColor) {
systemVisibilityToolbarCollapsed = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
} }
} }
} }
@ -181,20 +208,26 @@ public abstract class BaseActivity extends AppCompatActivity {
this.transparentStatusBarAfterToolbarCollapsed = true; this.transparentStatusBarAfterToolbarCollapsed = true;
} }
protected void applyTabLayoutTheme(TabLayout tabLayout, CustomThemeWrapper customThemeWrapper, int themeType) { protected void applyToolbarTheme(Toolbar toolbar) {
int toolbarAndTabBackgroundColor = customThemeWrapper.getToolbarAndTabBackgroundColor(themeType); toolbar.setTitleTextColor(customThemeWrapper.getToolbarPrimaryTextAndIconColor());
tabLayout.setBackgroundColor(toolbarAndTabBackgroundColor);
tabLayout.setSelectedTabIndicatorColor(customThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTabIndicator(themeType));
tabLayout.setTabTextColors(customThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTextColor(themeType),
customThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTextColor(themeType));
} }
protected void applyFABTheme(FloatingActionButton fab, CustomThemeWrapper customThemeWrapper, int themeType) { protected void applyTabLayoutTheme(TabLayout tabLayout) {
fab.setBackgroundTintList(ColorStateList.valueOf(customThemeWrapper.getColorPrimaryLightTheme(themeType))); int toolbarAndTabBackgroundColor = customThemeWrapper.getToolbarAndTabBackgroundColor();
fab.setImageTintList(ColorStateList.valueOf(customThemeWrapper.getFABIconColor(themeType))); tabLayout.setBackgroundColor(toolbarAndTabBackgroundColor);
/*Drawable myFabSrc = getResources().getDrawable(R.drawable.ic_add_bottom_app_bar_24dp); tabLayout.setSelectedTabIndicatorColor(customThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTabIndicator());
Drawable willBeWhite = myFabSrc.getConstantState().newDrawable(); tabLayout.setTabTextColors(customThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTextColor(),
willBeWhite.mutate().setColorFilter(Color.WHITE, PorterDuff.Mode.MULTIPLY); customThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTextColor());
fab.setImageDrawable(willBeWhite);*/ }
protected void applyFABTheme(FloatingActionButton fab, int drawableId) {
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

@ -232,13 +232,12 @@ public class CommentActivity extends BaseActivity {
@Override @Override
protected void applyCustomTheme() { protected void applyCustomTheme() {
int themeType = mCustomThemeWrapper.getThemeType(); coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor());
appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); commentParentMarkwonView.setTextColor(mCustomThemeWrapper.getCommentColor());
commentParentMarkwonView.setTextColor(mCustomThemeWrapper.getCommentColor(themeType)); divider.setBackgroundColor(mCustomThemeWrapper.getDividerColor());
divider.setBackgroundColor(mCustomThemeWrapper.getDividerColor(themeType)); commentEditText.setTextColor(mCustomThemeWrapper.getCommentColor());
commentEditText.setTextColor(mCustomThemeWrapper.getCommentColor(themeType)); markdownColor = mCustomThemeWrapper.getSecondaryTextColor();
markdownColor = mCustomThemeWrapper.getSecondaryTextColor(themeType);
} }
private void getCurrentAccount() { private void getCurrentAccount() {

View File

@ -244,11 +244,10 @@ public class CreateMultiRedditActivity extends BaseActivity {
@Override @Override
protected void applyCustomTheme() { protected void applyCustomTheme() {
int themeType = mCustomThemeWrapper.getThemeType(); appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor());
appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); int primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor();
int primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor(themeType);
nameEditText.setTextColor(primaryTextColor); nameEditText.setTextColor(primaryTextColor);
int dividerColor = mCustomThemeWrapper.getDividerColor(themeType); int dividerColor = mCustomThemeWrapper.getDividerColor();
divider1.setBackgroundColor(dividerColor); divider1.setBackgroundColor(dividerColor);
divider2.setBackgroundColor(dividerColor); divider2.setBackgroundColor(dividerColor);
descriptionEditText.setTextColor(primaryTextColor); descriptionEditText.setTextColor(primaryTextColor);

View File

@ -118,10 +118,9 @@ public class EditCommentActivity extends BaseActivity {
@Override @Override
protected void applyCustomTheme() { protected void applyCustomTheme() {
int themeType = mCustomThemeWrapper.getThemeType(); coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor());
appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); contentEditText.setTextColor(mCustomThemeWrapper.getCommentColor());
contentEditText.setTextColor(mCustomThemeWrapper.getCommentColor(themeType));
} }
@Override @Override

View File

@ -121,12 +121,11 @@ public class EditPostActivity extends BaseActivity {
@Override @Override
protected void applyCustomTheme() { protected void applyCustomTheme() {
int themeType = mCustomThemeWrapper.getThemeType(); coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor());
appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); titleTextView.setTextColor(mCustomThemeWrapper.getPostTitleColor());
titleTextView.setTextColor(mCustomThemeWrapper.getPostTitleColor(themeType)); divider.setBackgroundColor(mCustomThemeWrapper.getPostTitleColor());
divider.setBackgroundColor(mCustomThemeWrapper.getPostTitleColor(themeType)); contentEditText.setTextColor(mCustomThemeWrapper.getPostContentColor());
contentEditText.setTextColor(mCustomThemeWrapper.getPostContentColor(themeType));
} }
@Override @Override

View File

@ -175,9 +175,8 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec
@Override @Override
protected void applyCustomTheme() { protected void applyCustomTheme() {
int themeType = mCustomThemeWrapper.getThemeType(); coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor());
appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType));
} }
private void getCurrentAccountAndBindView(int filter) { private void getCurrentAccountAndBindView(int filter) {

View File

@ -6,12 +6,10 @@ import android.content.SharedPreferences;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo; import android.content.pm.ResolveInfo;
import android.net.Uri; import android.net.Uri;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.widget.Toast; import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.browser.customtabs.CustomTabsIntent; import androidx.browser.customtabs.CustomTabsIntent;
import java.util.ArrayList; import java.util.ArrayList;
@ -25,10 +23,6 @@ import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
import static androidx.browser.customtabs.CustomTabsService.ACTION_CUSTOM_TABS_CONNECTION; import static androidx.browser.customtabs.CustomTabsService.ACTION_CUSTOM_TABS_CONNECTION;
public class LinkResolverActivity extends AppCompatActivity { public class LinkResolverActivity extends AppCompatActivity {
@ -60,24 +54,6 @@ public class LinkResolverActivity extends AppCompatActivity {
((Infinity) getApplication()).getAppComponent().inject(this); ((Infinity) getApplication()).getAppComponent().inject(this);
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
switch (themeType) {
case 0:
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
break;
case 1:
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
break;
case 2:
if (systemDefault) {
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
} else {
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
}
}
Uri uri = getIntent().getData(); Uri uri = getIntent().getData();
if (uri == null) { if (uri == null) {
Toast.makeText(this, R.string.no_link_available, Toast.LENGTH_SHORT).show(); Toast.makeText(this, R.string.no_link_available, Toast.LENGTH_SHORT).show();
@ -239,7 +215,7 @@ public class LinkResolverActivity extends AppCompatActivity {
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(); CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
// add share action to menu list // add share action to menu list
builder.addDefaultShareMenuItem(); builder.addDefaultShareMenuItem();
builder.setToolbarColor(mCustomThemeWrapper.getColorPrimary(mCustomThemeWrapper.getThemeType())); builder.setToolbarColor(mCustomThemeWrapper.getColorPrimary());
CustomTabsIntent customTabsIntent = builder.build(); CustomTabsIntent customTabsIntent = builder.build();
customTabsIntent.intent.setPackage(resolveInfos.get(0).activityInfo.packageName); customTabsIntent.intent.setPackage(resolveInfos.get(0).activityInfo.packageName);
if (uri.getScheme() == null) { if (uri.getScheme() == null) {

View File

@ -222,9 +222,8 @@ public class LoginActivity extends BaseActivity {
@Override @Override
protected void applyCustomTheme() { protected void applyCustomTheme() {
int themeType = mCustomThemeWrapper.getThemeType(); coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor());
appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType));
} }
@Override @Override

View File

@ -3,6 +3,7 @@ package ml.docilealligator.infinityforreddit.Activity;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.ColorStateList;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.view.Gravity; import android.view.Gravity;
@ -88,6 +89,7 @@ import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditData;
import ml.docilealligator.infinityforreddit.SubscribedSubredditDatabase.SubscribedSubredditData; import ml.docilealligator.infinityforreddit.SubscribedSubredditDatabase.SubscribedSubredditData;
import ml.docilealligator.infinityforreddit.SubscribedSubredditDatabase.SubscribedSubredditViewModel; import ml.docilealligator.infinityforreddit.SubscribedSubredditDatabase.SubscribedSubredditViewModel;
import ml.docilealligator.infinityforreddit.SubscribedUserDatabase.SubscribedUserData; import ml.docilealligator.infinityforreddit.SubscribedUserDatabase.SubscribedUserData;
import ml.docilealligator.infinityforreddit.Utils.CustomThemeSharedPreferencesUtils;
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
import retrofit2.Retrofit; import retrofit2.Retrofit;
@ -288,14 +290,13 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
@Override @Override
protected void applyCustomTheme() { protected void applyCustomTheme() {
int themeType = mCustomThemeWrapper.getThemeType(); int backgroundColor = mCustomThemeWrapper.getBackgroundColor();
int backgroundColor = mCustomThemeWrapper.getBackgroundColor(themeType);
drawer.setBackgroundColor(backgroundColor); drawer.setBackgroundColor(backgroundColor);
navigationView.setBackgroundColor(backgroundColor); navigationView.setBackgroundColor(backgroundColor);
appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor());
applyTabLayoutTheme(tabLayout, mCustomThemeWrapper, themeType); applyTabLayoutTheme(tabLayout);
bottomNavigationView.setBackgroundColor(backgroundColor); bottomNavigationView.setBackgroundTint(ColorStateList.valueOf(backgroundColor));
applyFABTheme(fab, mCustomThemeWrapper, themeType); applyFABTheme(fab, R.drawable.ic_add_bottom_app_bar_24dp);
} }
private void getCurrentAccountAndBindView() { private void getCurrentAccountAndBindView() {
@ -486,14 +487,17 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
mSharedPreferences.edit().putString(SharedPreferencesUtils.THEME_KEY, "0").apply(); mSharedPreferences.edit().putString(SharedPreferencesUtils.THEME_KEY, "0").apply();
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO); AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
getTheme().applyStyle(R.style.Theme_Default, true); getTheme().applyStyle(R.style.Theme_Default, true);
mCustomThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.NORMAL);
break; break;
case R.string.dark_theme: case R.string.dark_theme:
mSharedPreferences.edit().putString(SharedPreferencesUtils.THEME_KEY, "1").apply(); mSharedPreferences.edit().putString(SharedPreferencesUtils.THEME_KEY, "1").apply();
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES); AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
if (mSharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) { if (mSharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) {
getTheme().applyStyle(R.style.Theme_Default_AmoledDark, true); getTheme().applyStyle(R.style.Theme_Default_AmoledDark, true);
mCustomThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.AMOLED_DARK);
} else { } else {
getTheme().applyStyle(R.style.Theme_Default_NormalDark, true); getTheme().applyStyle(R.style.Theme_Default_NormalDark, true);
mCustomThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.DARK);
} }
break; break;
case R.string.enable_nsfw: case R.string.enable_nsfw:

View File

@ -253,12 +253,11 @@ public class MultiRedditListingActivity extends BaseActivity {
@Override @Override
protected void applyCustomTheme() { protected void applyCustomTheme() {
int themeType = mCustomThemeWrapper.getThemeType(); mCoordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
mCoordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); mAppBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor());
mAppBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(mCustomThemeWrapper.getCircularProgressBarBackground());
mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(mCustomThemeWrapper.getCardViewBackgroundColor(themeType)); mSwipeRefreshLayout.setColorSchemeColors(mCustomThemeWrapper.getColorAccent());
mSwipeRefreshLayout.setColorSchemeColors(mCustomThemeWrapper.getColorAccent(themeType)); mErrorTextView.setTextColor(mCustomThemeWrapper.getSecondaryTextColor());
mErrorTextView.setTextColor(mCustomThemeWrapper.getSecondaryTextColor(themeType)); applyFABTheme(fab, R.drawable.ic_add_bottom_app_bar_24dp);
applyFABTheme(fab, mCustomThemeWrapper, themeType);
} }
} }

View File

@ -144,9 +144,12 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
private boolean isPosting; private boolean isPosting;
private Uri imageUri; private Uri imageUri;
private int primaryTextColor; private int primaryTextColor;
private int flairColor; private int flairBackgroundColor;
private int spoilerColor; private int flairTextColor;
private int nsfwColor; private int spoilerBackgroundColor;
private int spoilerTextColor;
private int nsfwBackgroundColor;
private int nsfwTextColor;
private Flair flair; private Flair flair;
private boolean isSpoiler = false; private boolean isSpoiler = false;
private boolean isNSFW = false; private boolean isNSFW = false;
@ -223,16 +226,19 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
if (flair != null) { if (flair != null) {
flairTextView.setText(flair.getText()); flairTextView.setText(flair.getText());
flairTextView.setBackgroundColor(flairColor); flairTextView.setBackgroundColor(flairBackgroundColor);
flairTextView.setBorderColor(flairColor); flairTextView.setBorderColor(flairBackgroundColor);
flairTextView.setTextColor(flairTextColor);
} }
if (isSpoiler) { if (isSpoiler) {
spoilerTextView.setBackgroundColor(spoilerColor); spoilerTextView.setBackgroundColor(spoilerBackgroundColor);
spoilerTextView.setBorderColor(spoilerColor); spoilerTextView.setBorderColor(spoilerBackgroundColor);
spoilerTextView.setTextColor(spoilerTextColor);
} }
if (isNSFW) { if (isNSFW) {
nsfwTextView.setBackgroundColor(nsfwColor); nsfwTextView.setBackgroundColor(nsfwBackgroundColor);
nsfwTextView.setBorderColor(nsfwColor); nsfwTextView.setBorderColor(nsfwBackgroundColor);
nsfwTextView.setTextColor(nsfwTextColor);
} }
} else { } else {
getCurrentAccount(); getCurrentAccount();
@ -292,6 +298,7 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
flairSelectionBottomSheetFragment.show(getSupportFragmentManager(), flairSelectionBottomSheetFragment.getTag()); flairSelectionBottomSheetFragment.show(getSupportFragmentManager(), flairSelectionBottomSheetFragment.getTag());
} else { } else {
flairTextView.setBackgroundColor(resources.getColor(android.R.color.transparent)); flairTextView.setBackgroundColor(resources.getColor(android.R.color.transparent));
flairTextView.setTextColor(primaryTextColor);
flairTextView.setText(getString(R.string.flair)); flairTextView.setText(getString(R.string.flair));
flair = null; flair = null;
} }
@ -299,22 +306,26 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
spoilerTextView.setOnClickListener(view -> { spoilerTextView.setOnClickListener(view -> {
if (!isSpoiler) { if (!isSpoiler) {
spoilerTextView.setBackgroundColor(spoilerColor); spoilerTextView.setBackgroundColor(spoilerBackgroundColor);
spoilerTextView.setBorderColor(spoilerColor); spoilerTextView.setBorderColor(spoilerBackgroundColor);
spoilerTextView.setTextColor(spoilerTextColor);
isSpoiler = true; isSpoiler = true;
} else { } else {
spoilerTextView.setBackgroundColor(resources.getColor(android.R.color.transparent)); spoilerTextView.setBackgroundColor(resources.getColor(android.R.color.transparent));
spoilerTextView.setTextColor(primaryTextColor);
isSpoiler = false; isSpoiler = false;
} }
}); });
nsfwTextView.setOnClickListener(view -> { nsfwTextView.setOnClickListener(view -> {
if (!isNSFW) { if (!isNSFW) {
nsfwTextView.setBackgroundColor(nsfwColor); nsfwTextView.setBackgroundColor(nsfwBackgroundColor);
nsfwTextView.setBorderColor(nsfwColor); nsfwTextView.setBorderColor(nsfwBackgroundColor);
nsfwTextView.setTextColor(nsfwTextColor);
isNSFW = true; isNSFW = true;
} else { } else {
nsfwTextView.setBackgroundColor(resources.getColor(android.R.color.transparent)); nsfwTextView.setBackgroundColor(resources.getColor(android.R.color.transparent));
nsfwTextView.setTextColor(primaryTextColor);
isNSFW = false; isNSFW = false;
} }
}); });
@ -363,35 +374,25 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
@Override @Override
protected void applyCustomTheme() { protected void applyCustomTheme() {
int themeType = mCustomThemeWrapper.getThemeType(); coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor());
appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); rulesButton.setTextColor(mCustomThemeWrapper.getButtonTextColor());
rulesButton.setTextColor(mCustomThemeWrapper.getButtonTextColor(themeType)); rulesButton.setBackgroundTintList(ColorStateList.valueOf(mCustomThemeWrapper.getColorPrimaryLightTheme()));
rulesButton.setBackgroundTintList(ColorStateList.valueOf(mCustomThemeWrapper.getColorPrimaryLightTheme(themeType))); int dividerColor = mCustomThemeWrapper.getDividerColor();
int dividerColor = mCustomThemeWrapper.getDividerColor(themeType);
divider1.setBackgroundColor(dividerColor); divider1.setBackgroundColor(dividerColor);
divider2.setBackgroundColor(dividerColor); divider2.setBackgroundColor(dividerColor);
divider3.setBackgroundColor(dividerColor); divider3.setBackgroundColor(dividerColor);
/*int flairColor = mCustomThemeWrapper.getFlairColor(themeType); primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor();
flairTextView.setBackgroundColor(flairColor); flairBackgroundColor = mCustomThemeWrapper.getFlairBackgroundColor();
flairTextView.setBorderColor(flairColor); flairTextColor = mCustomThemeWrapper.getFlairTextColor();
flairTextView.setTextColor(primaryTextColor); spoilerBackgroundColor = mCustomThemeWrapper.getSpoilerBackgroundColor();
int spoilerColor = mCustomThemeWrapper.getSpoilerColor(themeType); spoilerTextColor = mCustomThemeWrapper.getSpoilerTextColor();
spoilerTextView.setBackgroundColor(spoilerColor); nsfwBackgroundColor = mCustomThemeWrapper.getNsfwBackgroundColor();
spoilerTextView.setBorderColor(spoilerColor); nsfwTextColor = mCustomThemeWrapper.getNsfwTextColor();
spoilerTextView.setTextColor(primaryTextColor);
int nsfwColor = mCustomThemeWrapper.getNsfwColor(themeType);
nsfwTextView.setBackgroundColor(nsfwColor);
nsfwTextView.setBorderColor(nsfwColor);
nsfwTextView.setTextColor(primaryTextColor);*/
primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor(themeType);
flairColor = mCustomThemeWrapper.getFlairColor(themeType);
spoilerColor = mCustomThemeWrapper.getSpoilerColor(themeType);
nsfwColor = mCustomThemeWrapper.getNsfwColor(themeType);
titleEditText.setTextColor(primaryTextColor); titleEditText.setTextColor(primaryTextColor);
applyFABTheme(captureFab, mCustomThemeWrapper, themeType); applyFABTheme(captureFab, R.drawable.ic_outline_add_a_photo_24dp);
applyFABTheme(selectFromLibraryFab, mCustomThemeWrapper, themeType); applyFABTheme(selectFromLibraryFab, R.drawable.ic_outline_select_photo_24dp);
selectAgainTextView.setTextColor(mCustomThemeWrapper.getColorAccent(themeType)); selectAgainTextView.setTextColor(mCustomThemeWrapper.getColorAccent());
} }
private void getCurrentAccount() { private void getCurrentAccount() {
@ -572,6 +573,7 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
flairTextView.setVisibility(View.VISIBLE); flairTextView.setVisibility(View.VISIBLE);
flairTextView.setBackgroundColor(resources.getColor(android.R.color.transparent)); flairTextView.setBackgroundColor(resources.getColor(android.R.color.transparent));
flairTextView.setTextColor(primaryTextColor);
flairTextView.setText(getString(R.string.flair)); flairTextView.setText(getString(R.string.flair));
flair = null; flair = null;
} }
@ -602,8 +604,9 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
public void flairSelected(Flair flair) { public void flairSelected(Flair flair) {
this.flair = flair; this.flair = flair;
flairTextView.setText(flair.getText()); flairTextView.setText(flair.getText());
flairTextView.setBackgroundColor(flairColor); flairTextView.setBackgroundColor(flairBackgroundColor);
flairTextView.setBorderColor(flairColor); flairTextView.setBorderColor(flairBackgroundColor);
flairTextView.setTextColor(flairTextColor);
} }
@Subscribe @Subscribe

View File

@ -119,9 +119,12 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
private boolean loadSubredditIconSuccessful = true; private boolean loadSubredditIconSuccessful = true;
private boolean isPosting; private boolean isPosting;
private int primaryTextColor; private int primaryTextColor;
private int flairColor; private int flairBackgroundColor;
private int spoilerColor; private int flairTextColor;
private int nsfwColor; private int spoilerBackgroundColor;
private int spoilerTextColor;
private int nsfwBackgroundColor;
private int nsfwTextColor;
private Flair flair; private Flair flair;
private boolean isSpoiler = false; private boolean isSpoiler = false;
private boolean isNSFW = false; private boolean isNSFW = false;
@ -192,16 +195,19 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
if (flair != null) { if (flair != null) {
flairTextView.setText(flair.getText()); flairTextView.setText(flair.getText());
flairTextView.setBackgroundColor(flairColor); flairTextView.setBackgroundColor(flairBackgroundColor);
flairTextView.setBorderColor(flairColor); flairTextView.setBorderColor(flairBackgroundColor);
flairTextView.setTextColor(flairTextColor);
} }
if (isSpoiler) { if (isSpoiler) {
spoilerTextView.setBackgroundColor(spoilerColor); spoilerTextView.setBackgroundColor(spoilerBackgroundColor);
spoilerTextView.setBorderColor(spoilerColor); spoilerTextView.setBorderColor(spoilerBackgroundColor);
spoilerTextView.setTextColor(spoilerTextColor);
} }
if (isNSFW) { if (isNSFW) {
nsfwTextView.setBackgroundColor(nsfwColor); nsfwTextView.setBackgroundColor(nsfwBackgroundColor);
nsfwTextView.setBorderColor(nsfwColor); nsfwTextView.setBorderColor(nsfwBackgroundColor);
nsfwTextView.setTextColor(nsfwTextColor);
} }
} else { } else {
getCurrentAccount(); getCurrentAccount();
@ -262,6 +268,7 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
flairSelectionBottomSheetFragment.show(getSupportFragmentManager(), flairSelectionBottomSheetFragment.getTag()); flairSelectionBottomSheetFragment.show(getSupportFragmentManager(), flairSelectionBottomSheetFragment.getTag());
} else { } else {
flairTextView.setBackgroundColor(resources.getColor(android.R.color.transparent)); flairTextView.setBackgroundColor(resources.getColor(android.R.color.transparent));
flairTextView.setTextColor(primaryTextColor);
flairTextView.setText(getString(R.string.flair)); flairTextView.setText(getString(R.string.flair));
flair = null; flair = null;
} }
@ -269,22 +276,26 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
spoilerTextView.setOnClickListener(view -> { spoilerTextView.setOnClickListener(view -> {
if (!isSpoiler) { if (!isSpoiler) {
spoilerTextView.setBackgroundColor(spoilerColor); spoilerTextView.setBackgroundColor(spoilerBackgroundColor);
spoilerTextView.setBorderColor(spoilerColor); spoilerTextView.setBorderColor(spoilerBackgroundColor);
spoilerTextView.setTextColor(spoilerTextColor);
isSpoiler = true; isSpoiler = true;
} else { } else {
spoilerTextView.setBackgroundColor(resources.getColor(android.R.color.transparent)); spoilerTextView.setBackgroundColor(resources.getColor(android.R.color.transparent));
spoilerTextView.setTextColor(primaryTextColor);
isSpoiler = false; isSpoiler = false;
} }
}); });
nsfwTextView.setOnClickListener(view -> { nsfwTextView.setOnClickListener(view -> {
if (!isNSFW) { if (!isNSFW) {
nsfwTextView.setBackgroundColor(nsfwColor); nsfwTextView.setBackgroundColor(nsfwBackgroundColor);
nsfwTextView.setBorderColor(nsfwColor); nsfwTextView.setBorderColor(nsfwBackgroundColor);
nsfwTextView.setTextColor(nsfwTextColor);
isNSFW = true; isNSFW = true;
} else { } else {
nsfwTextView.setBackgroundColor(resources.getColor(android.R.color.transparent)); nsfwTextView.setBackgroundColor(resources.getColor(android.R.color.transparent));
nsfwTextView.setTextColor(primaryTextColor);
isNSFW = false; isNSFW = false;
} }
}); });
@ -302,31 +313,21 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
@Override @Override
protected void applyCustomTheme() { protected void applyCustomTheme() {
int themeType = mCustomThemeWrapper.getThemeType(); coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor());
appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); rulesButton.setTextColor(mCustomThemeWrapper.getButtonTextColor());
rulesButton.setTextColor(mCustomThemeWrapper.getButtonTextColor(themeType)); rulesButton.setBackgroundTintList(ColorStateList.valueOf(mCustomThemeWrapper.getColorPrimaryLightTheme()));
rulesButton.setBackgroundTintList(ColorStateList.valueOf(mCustomThemeWrapper.getColorPrimaryLightTheme(themeType))); int dividerColor = mCustomThemeWrapper.getDividerColor();
int dividerColor = mCustomThemeWrapper.getDividerColor(themeType);
divider1.setBackgroundColor(dividerColor); divider1.setBackgroundColor(dividerColor);
divider2.setBackgroundColor(dividerColor); divider2.setBackgroundColor(dividerColor);
divider3.setBackgroundColor(dividerColor); divider3.setBackgroundColor(dividerColor);
/*int flairColor = mCustomThemeWrapper.getFlairColor(themeType); primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor();
flairTextView.setBackgroundColor(flairColor); flairBackgroundColor = mCustomThemeWrapper.getFlairBackgroundColor();
flairTextView.setBorderColor(flairColor); flairTextColor = mCustomThemeWrapper.getFlairTextColor();
flairTextView.setTextColor(primaryTextColor); spoilerBackgroundColor = mCustomThemeWrapper.getSpoilerBackgroundColor();
int spoilerColor = mCustomThemeWrapper.getSpoilerColor(themeType); spoilerTextColor = mCustomThemeWrapper.getSpoilerTextColor();
spoilerTextView.setBackgroundColor(spoilerColor); nsfwBackgroundColor = mCustomThemeWrapper.getNsfwBackgroundColor();
spoilerTextView.setBorderColor(spoilerColor); nsfwTextColor = mCustomThemeWrapper.getNsfwTextColor();
spoilerTextView.setTextColor(primaryTextColor);
int nsfwColor = mCustomThemeWrapper.getNsfwColor(themeType);
nsfwTextView.setBackgroundColor(nsfwColor);
nsfwTextView.setBorderColor(nsfwColor);
nsfwTextView.setTextColor(primaryTextColor);*/
primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor(themeType);
flairColor = mCustomThemeWrapper.getFlairColor(themeType);
spoilerColor = mCustomThemeWrapper.getSpoilerColor(themeType);
nsfwColor = mCustomThemeWrapper.getNsfwColor(themeType);
titleEditText.setTextColor(primaryTextColor); titleEditText.setTextColor(primaryTextColor);
linkEditText.setTextColor(primaryTextColor); linkEditText.setTextColor(primaryTextColor);
} }
@ -491,6 +492,7 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
flairTextView.setVisibility(View.VISIBLE); flairTextView.setVisibility(View.VISIBLE);
flairTextView.setBackgroundColor(resources.getColor(android.R.color.transparent)); flairTextView.setBackgroundColor(resources.getColor(android.R.color.transparent));
flairTextView.setTextColor(primaryTextColor);
flairTextView.setText(getString(R.string.flair)); flairTextView.setText(getString(R.string.flair));
flair = null; flair = null;
} }
@ -507,8 +509,9 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
public void flairSelected(Flair flair) { public void flairSelected(Flair flair) {
this.flair = flair; this.flair = flair;
flairTextView.setText(flair.getText()); flairTextView.setText(flair.getText());
flairTextView.setBackgroundColor(flairColor); flairTextView.setBackgroundColor(flairBackgroundColor);
flairTextView.setBorderColor(flairColor); flairTextView.setBorderColor(flairBackgroundColor);
flairTextView.setTextColor(flairTextColor);
} }
@Subscribe @Subscribe

View File

@ -119,9 +119,12 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr
private boolean loadSubredditIconSuccessful = true; private boolean loadSubredditIconSuccessful = true;
private boolean isPosting; private boolean isPosting;
private int primaryTextColor; private int primaryTextColor;
private int flairColor; private int flairBackgroundColor;
private int spoilerColor; private int flairTextColor;
private int nsfwColor; private int spoilerBackgroundColor;
private int spoilerTextColor;
private int nsfwBackgroundColor;
private int nsfwTextColor;
private Flair flair; private Flair flair;
private boolean isSpoiler = false; private boolean isSpoiler = false;
private boolean isNSFW = false; private boolean isNSFW = false;
@ -192,16 +195,19 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr
if (flair != null) { if (flair != null) {
flairTextView.setText(flair.getText()); flairTextView.setText(flair.getText());
flairTextView.setBackgroundColor(flairColor); flairTextView.setBackgroundColor(flairBackgroundColor);
flairTextView.setBorderColor(flairColor); flairTextView.setBorderColor(flairBackgroundColor);
flairTextView.setTextColor(flairTextColor);
} }
if (isSpoiler) { if (isSpoiler) {
spoilerTextView.setBackgroundColor(spoilerColor); spoilerTextView.setBackgroundColor(spoilerBackgroundColor);
spoilerTextView.setBorderColor(spoilerColor); spoilerTextView.setBorderColor(spoilerBackgroundColor);
spoilerTextView.setTextColor(spoilerTextColor);
} }
if (isNSFW) { if (isNSFW) {
nsfwTextView.setBackgroundColor(nsfwColor); nsfwTextView.setBackgroundColor(nsfwBackgroundColor);
nsfwTextView.setBorderColor(nsfwColor); nsfwTextView.setBorderColor(nsfwBackgroundColor);
nsfwTextView.setTextColor(nsfwTextColor);
} }
} else { } else {
getCurrentAccount(); getCurrentAccount();
@ -266,6 +272,7 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr
flairSelectionBottomSheetFragment.show(getSupportFragmentManager(), flairSelectionBottomSheetFragment.getTag()); flairSelectionBottomSheetFragment.show(getSupportFragmentManager(), flairSelectionBottomSheetFragment.getTag());
} else { } else {
flairTextView.setBackgroundColor(resources.getColor(android.R.color.transparent)); flairTextView.setBackgroundColor(resources.getColor(android.R.color.transparent));
flairTextView.setTextColor(primaryTextColor);
flairTextView.setText(getString(R.string.flair)); flairTextView.setText(getString(R.string.flair));
flair = null; flair = null;
} }
@ -273,22 +280,26 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr
spoilerTextView.setOnClickListener(view -> { spoilerTextView.setOnClickListener(view -> {
if (!isSpoiler) { if (!isSpoiler) {
spoilerTextView.setBackgroundColor(spoilerColor); spoilerTextView.setBackgroundColor(spoilerBackgroundColor);
spoilerTextView.setBorderColor(spoilerColor); spoilerTextView.setBorderColor(spoilerBackgroundColor);
spoilerTextView.setTextColor(spoilerTextColor);
isSpoiler = true; isSpoiler = true;
} else { } else {
spoilerTextView.setBackgroundColor(resources.getColor(android.R.color.transparent)); spoilerTextView.setBackgroundColor(resources.getColor(android.R.color.transparent));
spoilerTextView.setTextColor(primaryTextColor);
isSpoiler = false; isSpoiler = false;
} }
}); });
nsfwTextView.setOnClickListener(view -> { nsfwTextView.setOnClickListener(view -> {
if (!isNSFW) { if (!isNSFW) {
nsfwTextView.setBackgroundColor(nsfwColor); nsfwTextView.setBackgroundColor(nsfwBackgroundColor);
nsfwTextView.setBorderColor(nsfwColor); nsfwTextView.setBorderColor(nsfwBackgroundColor);
nsfwTextView.setTextColor(nsfwTextColor);
isNSFW = true; isNSFW = true;
} else { } else {
nsfwTextView.setBackgroundColor(resources.getColor(android.R.color.transparent)); nsfwTextView.setBackgroundColor(resources.getColor(android.R.color.transparent));
nsfwTextView.setTextColor(primaryTextColor);
isNSFW = false; isNSFW = false;
} }
}); });
@ -306,31 +317,21 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr
@Override @Override
protected void applyCustomTheme() { protected void applyCustomTheme() {
int themeType = mCustomThemeWrapper.getThemeType(); coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor());
appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); rulesButton.setTextColor(mCustomThemeWrapper.getButtonTextColor());
rulesButton.setTextColor(mCustomThemeWrapper.getButtonTextColor(themeType)); rulesButton.setBackgroundTintList(ColorStateList.valueOf(mCustomThemeWrapper.getColorPrimaryLightTheme()));
rulesButton.setBackgroundTintList(ColorStateList.valueOf(mCustomThemeWrapper.getColorPrimaryLightTheme(themeType))); int dividerColor = mCustomThemeWrapper.getDividerColor();
int dividerColor = mCustomThemeWrapper.getDividerColor(themeType);
divider1.setBackgroundColor(dividerColor); divider1.setBackgroundColor(dividerColor);
divider2.setBackgroundColor(dividerColor); divider2.setBackgroundColor(dividerColor);
divider3.setBackgroundColor(dividerColor); divider3.setBackgroundColor(dividerColor);
/*int flairColor = mCustomThemeWrapper.getFlairColor(themeType); primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor();
flairTextView.setBackgroundColor(flairColor); flairBackgroundColor = mCustomThemeWrapper.getFlairBackgroundColor();
flairTextView.setBorderColor(flairColor); flairTextColor = mCustomThemeWrapper.getFlairTextColor();
flairTextView.setTextColor(primaryTextColor); spoilerBackgroundColor = mCustomThemeWrapper.getSpoilerBackgroundColor();
int spoilerColor = mCustomThemeWrapper.getSpoilerColor(themeType); spoilerTextColor = mCustomThemeWrapper.getSpoilerTextColor();
spoilerTextView.setBackgroundColor(spoilerColor); nsfwBackgroundColor = mCustomThemeWrapper.getNsfwBackgroundColor();
spoilerTextView.setBorderColor(spoilerColor); nsfwTextColor = mCustomThemeWrapper.getNsfwTextColor();
spoilerTextView.setTextColor(primaryTextColor);
int nsfwColor = mCustomThemeWrapper.getNsfwColor(themeType);
nsfwTextView.setBackgroundColor(nsfwColor);
nsfwTextView.setBorderColor(nsfwColor);
nsfwTextView.setTextColor(primaryTextColor);*/
primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor(themeType);
flairColor = mCustomThemeWrapper.getFlairColor(themeType);
spoilerColor = mCustomThemeWrapper.getSpoilerColor(themeType);
nsfwColor = mCustomThemeWrapper.getNsfwColor(themeType);
titleEditText.setTextColor(primaryTextColor); titleEditText.setTextColor(primaryTextColor);
contentEditText.setTextColor(primaryTextColor); contentEditText.setTextColor(primaryTextColor);
} }
@ -491,6 +492,7 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr
flairTextView.setVisibility(View.VISIBLE); flairTextView.setVisibility(View.VISIBLE);
flairTextView.setBackgroundColor(resources.getColor(android.R.color.transparent)); flairTextView.setBackgroundColor(resources.getColor(android.R.color.transparent));
flairTextView.setTextColor(primaryTextColor);
flairTextView.setText(getString(R.string.flair)); flairTextView.setText(getString(R.string.flair));
flair = null; flair = null;
} }
@ -507,8 +509,9 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr
public void flairSelected(Flair flair) { public void flairSelected(Flair flair) {
this.flair = flair; this.flair = flair;
flairTextView.setText(flair.getText()); flairTextView.setText(flair.getText());
flairTextView.setBackgroundColor(flairColor); flairTextView.setBackgroundColor(flairBackgroundColor);
flairTextView.setBorderColor(flairColor); flairTextView.setBorderColor(flairBackgroundColor);
flairTextView.setTextColor(flairTextColor);
} }
@Subscribe @Subscribe

View File

@ -150,9 +150,12 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF
private boolean isPosting; private boolean isPosting;
private boolean wasPlaying; private boolean wasPlaying;
private int primaryTextColor; private int primaryTextColor;
private int flairColor; private int flairBackgroundColor;
private int spoilerColor; private int flairTextColor;
private int nsfwColor; private int spoilerBackgroundColor;
private int spoilerTextColor;
private int nsfwBackgroundColor;
private int nsfwTextColor;
private Flair flair; private Flair flair;
private boolean isSpoiler = false; private boolean isSpoiler = false;
private boolean isNSFW = false; private boolean isNSFW = false;
@ -236,16 +239,19 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF
if (flair != null) { if (flair != null) {
flairTextView.setText(flair.getText()); flairTextView.setText(flair.getText());
flairTextView.setBackgroundColor(flairColor); flairTextView.setBackgroundColor(flairBackgroundColor);
flairTextView.setBorderColor(flairColor); flairTextView.setBorderColor(flairBackgroundColor);
flairTextView.setTextColor(flairTextColor);
} }
if (isSpoiler) { if (isSpoiler) {
spoilerTextView.setBackgroundColor(spoilerColor); spoilerTextView.setBackgroundColor(spoilerBackgroundColor);
spoilerTextView.setBorderColor(spoilerColor); spoilerTextView.setBorderColor(spoilerBackgroundColor);
spoilerTextView.setTextColor(spoilerTextColor);
} }
if (isNSFW) { if (isNSFW) {
nsfwTextView.setBackgroundColor(nsfwColor); nsfwTextView.setBackgroundColor(nsfwBackgroundColor);
nsfwTextView.setBorderColor(nsfwColor); nsfwTextView.setBorderColor(nsfwBackgroundColor);
nsfwTextView.setTextColor(nsfwTextColor);
} }
} else { } else {
getCurrentAccount(); getCurrentAccount();
@ -305,6 +311,7 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF
mFlairSelectionBottomSheetFragment.show(getSupportFragmentManager(), mFlairSelectionBottomSheetFragment.getTag()); mFlairSelectionBottomSheetFragment.show(getSupportFragmentManager(), mFlairSelectionBottomSheetFragment.getTag());
} else { } else {
flairTextView.setBackgroundColor(resources.getColor(android.R.color.transparent)); flairTextView.setBackgroundColor(resources.getColor(android.R.color.transparent));
flairTextView.setTextColor(primaryTextColor);
flairTextView.setText(getString(R.string.flair)); flairTextView.setText(getString(R.string.flair));
flair = null; flair = null;
} }
@ -312,22 +319,26 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF
spoilerTextView.setOnClickListener(view -> { spoilerTextView.setOnClickListener(view -> {
if (!isSpoiler) { if (!isSpoiler) {
spoilerTextView.setBackgroundColor(spoilerColor); spoilerTextView.setBackgroundColor(spoilerBackgroundColor);
spoilerTextView.setBorderColor(spoilerColor); spoilerTextView.setBorderColor(spoilerBackgroundColor);
spoilerTextView.setTextColor(spoilerTextColor);
isSpoiler = true; isSpoiler = true;
} else { } else {
spoilerTextView.setBackgroundColor(resources.getColor(android.R.color.transparent)); spoilerTextView.setBackgroundColor(resources.getColor(android.R.color.transparent));
spoilerTextView.setTextColor(primaryTextColor);
isSpoiler = false; isSpoiler = false;
} }
}); });
nsfwTextView.setOnClickListener(view -> { nsfwTextView.setOnClickListener(view -> {
if (!isNSFW) { if (!isNSFW) {
nsfwTextView.setBackgroundColor(nsfwColor); nsfwTextView.setBackgroundColor(nsfwBackgroundColor);
nsfwTextView.setBorderColor(nsfwColor); nsfwTextView.setBorderColor(nsfwBackgroundColor);
nsfwTextView.setTextColor(nsfwTextColor);
isNSFW = true; isNSFW = true;
} else { } else {
nsfwTextView.setBackgroundColor(resources.getColor(android.R.color.transparent)); nsfwTextView.setBackgroundColor(resources.getColor(android.R.color.transparent));
nsfwTextView.setTextColor(primaryTextColor);
isNSFW = false; isNSFW = false;
} }
}); });
@ -368,35 +379,25 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF
@Override @Override
protected void applyCustomTheme() { protected void applyCustomTheme() {
int themeType = mCustomThemeWrapper.getThemeType(); coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor());
appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); rulesButton.setTextColor(mCustomThemeWrapper.getButtonTextColor());
rulesButton.setTextColor(mCustomThemeWrapper.getButtonTextColor(themeType)); rulesButton.setBackgroundTintList(ColorStateList.valueOf(mCustomThemeWrapper.getColorPrimaryLightTheme()));
rulesButton.setBackgroundTintList(ColorStateList.valueOf(mCustomThemeWrapper.getColorPrimaryLightTheme(themeType))); int dividerColor = mCustomThemeWrapper.getDividerColor();
int dividerColor = mCustomThemeWrapper.getDividerColor(themeType);
divider1.setBackgroundColor(dividerColor); divider1.setBackgroundColor(dividerColor);
divider2.setBackgroundColor(dividerColor); divider2.setBackgroundColor(dividerColor);
divider3.setBackgroundColor(dividerColor); divider3.setBackgroundColor(dividerColor);
/*int flairColor = mCustomThemeWrapper.getFlairColor(themeType); primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor();
flairTextView.setBackgroundColor(flairColor); flairBackgroundColor = mCustomThemeWrapper.getFlairBackgroundColor();
flairTextView.setBorderColor(flairColor); flairTextColor = mCustomThemeWrapper.getFlairTextColor();
flairTextView.setTextColor(primaryTextColor); spoilerBackgroundColor = mCustomThemeWrapper.getSpoilerBackgroundColor();
int spoilerColor = mCustomThemeWrapper.getSpoilerColor(themeType); spoilerTextColor = mCustomThemeWrapper.getSpoilerTextColor();
spoilerTextView.setBackgroundColor(spoilerColor); nsfwBackgroundColor = mCustomThemeWrapper.getNsfwBackgroundColor();
spoilerTextView.setBorderColor(spoilerColor); nsfwTextColor = mCustomThemeWrapper.getNsfwTextColor();
spoilerTextView.setTextColor(primaryTextColor);
int nsfwColor = mCustomThemeWrapper.getNsfwColor(themeType);
nsfwTextView.setBackgroundColor(nsfwColor);
nsfwTextView.setBorderColor(nsfwColor);
nsfwTextView.setTextColor(primaryTextColor);*/
primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor(themeType);
flairColor = mCustomThemeWrapper.getFlairColor(themeType);
spoilerColor = mCustomThemeWrapper.getSpoilerColor(themeType);
nsfwColor = mCustomThemeWrapper.getNsfwColor(themeType);
titleEditText.setTextColor(primaryTextColor); titleEditText.setTextColor(primaryTextColor);
applyFABTheme(captureFab, mCustomThemeWrapper, themeType); applyFABTheme(captureFab, R.drawable.ic_outline_add_a_photo_24dp);
applyFABTheme(selectFromLibraryFab, mCustomThemeWrapper, themeType); applyFABTheme(selectFromLibraryFab, R.drawable.ic_outline_select_photo_24dp);
selectAgainTextView.setTextColor(mCustomThemeWrapper.getColorAccent(themeType)); selectAgainTextView.setTextColor(mCustomThemeWrapper.getColorAccent());
} }
private void getCurrentAccount() { private void getCurrentAccount() {
@ -593,6 +594,7 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF
flairTextView.setVisibility(View.VISIBLE); flairTextView.setVisibility(View.VISIBLE);
flairTextView.setBackgroundColor(resources.getColor(android.R.color.transparent)); flairTextView.setBackgroundColor(resources.getColor(android.R.color.transparent));
flairTextView.setTextColor(primaryTextColor);
flairTextView.setText(getString(R.string.flair)); flairTextView.setText(getString(R.string.flair));
flair = null; flair = null;
} }
@ -630,8 +632,9 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF
public void flairSelected(Flair flair) { public void flairSelected(Flair flair) {
this.flair = flair; this.flair = flair;
flairTextView.setText(flair.getText()); flairTextView.setText(flair.getText());
flairTextView.setBackgroundColor(flairColor); flairTextView.setBackgroundColor(flairBackgroundColor);
flairTextView.setBorderColor(flairColor); flairTextView.setBorderColor(flairBackgroundColor);
flairTextView.setTextColor(flairTextColor);
} }
@Subscribe @Subscribe

View File

@ -129,10 +129,9 @@ public class RulesActivity extends BaseActivity {
@Override @Override
protected void applyCustomTheme() { protected void applyCustomTheme() {
int themeType = mCustomThemeWrapper.getThemeType(); coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor());
appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); errorTextView.setTextColor(mCustomThemeWrapper.getSecondaryTextColor());
errorTextView.setTextColor(mCustomThemeWrapper.getSecondaryTextColor(themeType));
} }
private void fetchRules() { private void fetchRules() {

View File

@ -189,12 +189,11 @@ public class SearchActivity extends BaseActivity {
@Override @Override
protected void applyCustomTheme() { protected void applyCustomTheme() {
int themeType = mCustomThemeWrapper.getThemeType(); coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor());
appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); simpleSearchView.setSearchBackground(new ColorDrawable(mCustomThemeWrapper.getColorPrimary()));
simpleSearchView.setSearchBackground(new ColorDrawable(mCustomThemeWrapper.getColorPrimary(themeType))); searchInTextView.setTextColor(mCustomThemeWrapper.getColorAccent());
searchInTextView.setTextColor(mCustomThemeWrapper.getColorAccent(themeType)); subredditNameTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor());
subredditNameTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor(themeType));
} }
@Override @Override

View File

@ -171,10 +171,9 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect
@Override @Override
protected void applyCustomTheme() { protected void applyCustomTheme() {
int themeType = mCustomThemeWrapper.getThemeType(); coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor());
appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); applyTabLayoutTheme(tabLayout);
applyTabLayoutTheme(tabLayout, mCustomThemeWrapper, themeType);
} }
private void getCurrentAccountAndInitializeViewPager() { private void getCurrentAccountAndInitializeViewPager() {

View File

@ -120,9 +120,8 @@ public class SearchSubredditsResultActivity extends BaseActivity {
@Override @Override
protected void applyCustomTheme() { protected void applyCustomTheme() {
int themeType = mCustomThemeWrapper.getThemeType(); coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor());
appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType));
} }
private void getCurrentAccountAndInitializeFragment(String query) { private void getCurrentAccountAndInitializeFragment(String query) {

View File

@ -94,9 +94,8 @@ public class SettingsActivity extends BaseActivity implements
@Override @Override
protected void applyCustomTheme() { protected void applyCustomTheme() {
int themeType = mCustomThemeWrapper.getThemeType(); coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor());
appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType));
} }
@Override @Override

View File

@ -251,9 +251,8 @@ public class SubredditMultiselectionActivity extends BaseActivity {
@Override @Override
protected void applyCustomTheme() { protected void applyCustomTheme() {
int themeType = mCustomThemeWrapper.getThemeType(); mCoordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
mCoordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); mAppBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor());
mAppBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); mErrorTextView.setTextColor(mCustomThemeWrapper.getSecondaryTextColor());
mErrorTextView.setTextColor(mCustomThemeWrapper.getSecondaryTextColor(themeType));
} }
} }

View File

@ -142,9 +142,8 @@ public class SubredditSelectionActivity extends BaseActivity {
@Override @Override
protected void applyCustomTheme() { protected void applyCustomTheme() {
int themeType = mCustomThemeWrapper.getThemeType(); coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); appBarLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
appBarLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType));
} }
private void getCurrentAccountAndBindView() { private void getCurrentAccountAndBindView() {

View File

@ -136,10 +136,9 @@ public class SubscribedThingListingActivity extends BaseActivity {
@Override @Override
protected void applyCustomTheme() { protected void applyCustomTheme() {
int themeType = mCustomThemeWrapper.getThemeType(); coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor());
appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); applyTabLayoutTheme(tabLayout);
applyTabLayoutTheme(tabLayout, mCustomThemeWrapper, themeType);
} }
private void getCurrentAccountAndInitializeViewPager() { private void getCurrentAccountAndInitializeViewPager() {

View File

@ -156,12 +156,11 @@ public class ViewMessageActivity extends BaseActivity {
@Override @Override
protected void applyCustomTheme() { protected void applyCustomTheme() {
int themeType = mCustomThemeWrapper.getThemeType(); mCoordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
mCoordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); mAppBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor());
mAppBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(mCustomThemeWrapper.getCircularProgressBarBackground());
mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(mCustomThemeWrapper.getCardViewBackgroundColor(themeType)); mSwipeRefreshLayout.setColorSchemeColors(mCustomThemeWrapper.getColorAccent());
mSwipeRefreshLayout.setColorSchemeColors(mCustomThemeWrapper.getColorAccent(themeType)); mFetchMessageInfoTextView.setTextColor(mCustomThemeWrapper.getSecondaryTextColor());
mFetchMessageInfoTextView.setTextColor(mCustomThemeWrapper.getSecondaryTextColor(themeType));
} }
private void getCurrentAccountAndFetchMessage() { private void getCurrentAccountAndFetchMessage() {

View File

@ -323,8 +323,7 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT
@Override @Override
protected void applyCustomTheme() { protected void applyCustomTheme() {
int themeType = mCustomThemeWrapper.getThemeType(); coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor());
appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType));
} }
} }

View File

@ -368,13 +368,12 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
@Override @Override
protected void applyCustomTheme() { protected void applyCustomTheme() {
int themeType = mCustomThemeWrapper.getThemeType(); mCoordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
mCoordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); mAppBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor());
mAppBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(mCustomThemeWrapper.getCircularProgressBarBackground());
mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(mCustomThemeWrapper.getCardViewBackgroundColor(themeType)); mSwipeRefreshLayout.setColorSchemeColors(mCustomThemeWrapper.getColorAccent());
mSwipeRefreshLayout.setColorSchemeColors(mCustomThemeWrapper.getColorAccent(themeType)); mFetchPostInfoTextView.setTextColor(mCustomThemeWrapper.getSecondaryTextColor());
mFetchPostInfoTextView.setTextColor(mCustomThemeWrapper.getSecondaryTextColor(themeType)); applyFABTheme(fab, R.drawable.ic_keyboard_arrow_down_24dp);
applyFABTheme(fab, mCustomThemeWrapper, themeType);
} }
private void getCurrentAccountAndBindView() { private void getCurrentAccountAndBindView() {

View File

@ -228,11 +228,10 @@ public class ViewSidebarActivity extends BaseActivity {
@Override @Override
protected void applyCustomTheme() { protected void applyCustomTheme() {
int themeType = mCustomThemeWrapper.getThemeType(); coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor());
appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); swipeRefreshLayout.setProgressBackgroundColorSchemeColor(mCustomThemeWrapper.getCircularProgressBarBackground());
swipeRefreshLayout.setProgressBackgroundColorSchemeColor(mCustomThemeWrapper.getCardViewBackgroundColor(themeType)); swipeRefreshLayout.setColorSchemeColors(mCustomThemeWrapper.getColorAccent());
swipeRefreshLayout.setColorSchemeColors(mCustomThemeWrapper.getColorAccent(themeType)); markdownColor = mCustomThemeWrapper.getSecondaryTextColor();
markdownColor = mCustomThemeWrapper.getSecondaryTextColor(themeType);
} }
} }

View File

@ -344,21 +344,20 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
@Override @Override
protected void applyCustomTheme() { protected void applyCustomTheme() {
int themeType = mCustomThemeWrapper.getThemeType(); int backgroundColor = mCustomThemeWrapper.getBackgroundColor();
int backgroundColor = mCustomThemeWrapper.getBackgroundColor(themeType);
coordinatorLayout.setBackgroundColor(backgroundColor); coordinatorLayout.setBackgroundColor(backgroundColor);
appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor());
linearLayout.setBackgroundColor(backgroundColor); linearLayout.setBackgroundColor(backgroundColor);
subredditNameTextView.setTextColor(mCustomThemeWrapper.getSubreddit(themeType)); subredditNameTextView.setTextColor(mCustomThemeWrapper.getSubreddit());
subscribeSubredditChip.setTextColor(mCustomThemeWrapper.getChipTextColor(themeType)); subscribeSubredditChip.setTextColor(mCustomThemeWrapper.getChipTextColor());
int primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor(themeType); int primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor();
nSubscribersTextView.setTextColor(primaryTextColor); nSubscribersTextView.setTextColor(primaryTextColor);
nOnlineSubscribersTextView.setTextColor(primaryTextColor); nOnlineSubscribersTextView.setTextColor(primaryTextColor);
descriptionTextView.setTextColor(primaryTextColor); descriptionTextView.setTextColor(primaryTextColor);
bottomNavigationView.setBackgroundColor(backgroundColor); bottomNavigationView.setBackgroundColor(backgroundColor);
applyFABTheme(fab, mCustomThemeWrapper, themeType); applyFABTheme(fab, R.drawable.ic_add_bottom_app_bar_24dp);
unsubscribedColor = mCustomThemeWrapper.getUnsubscribed(themeType); unsubscribedColor = mCustomThemeWrapper.getUnsubscribed();
subscribedColor = mCustomThemeWrapper.getSubscribed(themeType); subscribedColor = mCustomThemeWrapper.getSubscribed();
} }
private void getCurrentAccountAndBindView() { private void getCurrentAccountAndBindView() {

View File

@ -409,21 +409,20 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
@Override @Override
protected void applyCustomTheme() { protected void applyCustomTheme() {
int themeType = mCustomThemeWrapper.getThemeType(); coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor());
appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); expandedTabTextColor = mCustomThemeWrapper.getTabLayoutWithExpandedCollapsingToolbarTextColor();
expandedTabTextColor = mCustomThemeWrapper.getTabLayoutWithExpandedCollapsingToolbarTextColor(themeType); expandedTabIndicatorColor = mCustomThemeWrapper.getTabLayoutWithExpandedCollapsingToolbarTabIndicator();
expandedTabIndicatorColor = mCustomThemeWrapper.getTabLayoutWithExpandedCollapsingToolbarTabIndicator(themeType); expandedTabBackgroundColor = mCustomThemeWrapper.getTabLayoutWithExpandedCollapsingToolbarTabBackground();
expandedTabBackgroundColor = mCustomThemeWrapper.getTabLayoutWithExpandedCollapsingToolbarTabBackground(themeType); collapsedTabTextColor = mCustomThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTextColor();
collapsedTabTextColor = mCustomThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTextColor(themeType); collapsedTabIndicatorColor = mCustomThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTabIndicator();
collapsedTabIndicatorColor = mCustomThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTabIndicator(themeType); collapsedTabBackgroundColor = mCustomThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTabBackground();
collapsedTabBackgroundColor = mCustomThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTabBackground(themeType); unsubscribedColor = mCustomThemeWrapper.getUnsubscribed();
unsubscribedColor = mCustomThemeWrapper.getUnsubscribed(themeType); subscribedColor = mCustomThemeWrapper.getSubscribed();
subscribedColor = mCustomThemeWrapper.getSubscribed(themeType); userNameTextView.setTextColor(mCustomThemeWrapper.getUsername());
userNameTextView.setTextColor(mCustomThemeWrapper.getUsername(themeType)); karmaTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor());
karmaTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor(themeType)); subscribeUserChip.setTextColor(mCustomThemeWrapper.getChipTextColor());
subscribeUserChip.setTextColor(mCustomThemeWrapper.getChipTextColor(themeType)); applyTabLayoutTheme(tabLayout);
applyTabLayoutTheme(tabLayout, mCustomThemeWrapper, themeType);
} }
private void getCurrentAccountAndInitializeViewPager() { private void getCurrentAccountAndInitializeViewPager() {

View File

@ -140,15 +140,20 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
private int mPrimaryTextColor; private int mPrimaryTextColor;
private int mCommentTextColor; private int mCommentTextColor;
private int mCommentBackgroundColor; private int mCommentBackgroundColor;
private int mPostTypeColor; private int mPostTypeBackgroundColor;
private int mPostTypeTextColor;
private int mDividerColor; private int mDividerColor;
private int mSubredditColor; private int mSubredditColor;
private int mUsernameColor; private int mUsernameColor;
private int mSubmitterColor; private int mSubmitterColor;
private int mModeratorColor; private int mModeratorColor;
private int mSpoilerColor; private int mAuthorFlairTextColor;
private int mFlairColor; private int mSpoilerBackgroundColor;
private int mNSFWColor; private int mSpoilerTextColor;
private int mFlairBackgroundColor;
private int mFlairTextColor;
private int mNSFWBackgroundColor;
private int mNSFWTextColor;
private int mArchivedTintColor; private int mArchivedTintColor;
private int mLockedTintColor; private int mLockedTintColor;
private int mCrosspostTintColor; private int mCrosspostTintColor;
@ -184,9 +189,8 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
mOauthRetrofit = oauthRetrofit; mOauthRetrofit = oauthRetrofit;
mRedditDataRoomDatabase = redditDataRoomDatabase; mRedditDataRoomDatabase = redditDataRoomDatabase;
mGlide = glide; mGlide = glide;
int themeType = customThemeWrapper.getThemeType(); mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor();
mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor(themeType); int markdownColor = customThemeWrapper.getPostContentColor();
int markdownColor = customThemeWrapper.getPostContentColor(themeType);
mPostDetailMarkwon = Markwon.builder(mActivity) mPostDetailMarkwon = Markwon.builder(mActivity)
.usePlugin(new AbstractMarkwonPlugin() { .usePlugin(new AbstractMarkwonPlugin() {
@Override @Override
@ -278,38 +282,43 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
loadMoreCommentsFailed = false; loadMoreCommentsFailed = false;
mScale = activity.getResources().getDisplayMetrics().density; mScale = activity.getResources().getDisplayMetrics().density;
mColorPrimaryLightTheme = customThemeWrapper.getColorPrimaryLightTheme(themeType); mColorPrimaryLightTheme = customThemeWrapper.getColorPrimaryLightTheme();
mColorAccent = customThemeWrapper.getColorAccent(themeType); mColorAccent = customThemeWrapper.getColorAccent();
mCardViewColor = customThemeWrapper.getCardViewBackgroundColor(themeType); mCardViewColor = customThemeWrapper.getCardViewBackgroundColor();
mPostTitleColor = customThemeWrapper.getPostTitleColor(themeType); mPostTitleColor = customThemeWrapper.getPostTitleColor();
mPrimaryTextColor = customThemeWrapper.getPrimaryTextColor(themeType); mPrimaryTextColor = customThemeWrapper.getPrimaryTextColor();
mCommentTextColor = customThemeWrapper.getCommentColor(themeType); mCommentTextColor = customThemeWrapper.getCommentColor();
mDividerColor = customThemeWrapper.getDividerColor(themeType); mDividerColor = customThemeWrapper.getDividerColor();
mCommentBackgroundColor = customThemeWrapper.getCommentBackgroundColor(themeType); mCommentBackgroundColor = customThemeWrapper.getCommentBackgroundColor();
mPostTypeColor = customThemeWrapper.getPostType(themeType); mPostTypeBackgroundColor = customThemeWrapper.getPostTypeBackgroundColor();
mSubmitterColor = customThemeWrapper.getSubmitter(themeType); mPostTypeTextColor = customThemeWrapper.getPostTypeTextColor();
mModeratorColor = customThemeWrapper.getModerator(themeType); mSubmitterColor = customThemeWrapper.getSubmitter();
mSpoilerColor = customThemeWrapper.getSpoilerColor(themeType); mModeratorColor = customThemeWrapper.getModerator();
mNSFWColor = customThemeWrapper.getNsfwColor(themeType); mAuthorFlairTextColor = customThemeWrapper.getAuthorFlairTextColor();
mArchivedTintColor = customThemeWrapper.getArchivedTint(themeType); mSpoilerBackgroundColor = customThemeWrapper.getSpoilerBackgroundColor();
mLockedTintColor = customThemeWrapper.getLockedIconTint(themeType); mSpoilerTextColor = customThemeWrapper.getSpoilerTextColor();
mCrosspostTintColor = customThemeWrapper.getCrosspost(themeType); mNSFWBackgroundColor = customThemeWrapper.getNsfwBackgroundColor();
mNoPreviewLinkBackgroundColor = customThemeWrapper.getNoPreviewLinkBackgroundColor(themeType); mNSFWTextColor = customThemeWrapper.getNsfwTextColor();
mFlairColor = customThemeWrapper.getFlairColor(themeType); mArchivedTintColor = customThemeWrapper.getArchivedTint();
mSubredditColor = customThemeWrapper.getSubreddit(themeType); mLockedTintColor = customThemeWrapper.getLockedIconTint();
mUsernameColor = customThemeWrapper.getUsername(themeType); mCrosspostTintColor = customThemeWrapper.getCrosspostIconTint();
mUpvotedColor = customThemeWrapper.getUpvoted(themeType); mNoPreviewLinkBackgroundColor = customThemeWrapper.getNoPreviewLinkBackgroundColor();
mDownvotedColor = customThemeWrapper.getDownvoted(themeType); mFlairBackgroundColor = customThemeWrapper.getFlairBackgroundColor();
mCommentVerticalBarColor1 = customThemeWrapper.getCommentVerticalBarColor1(themeType); mFlairTextColor = customThemeWrapper.getFlairTextColor();
mCommentVerticalBarColor2 = customThemeWrapper.getCommentVerticalBarColor2(themeType); mSubredditColor = customThemeWrapper.getSubreddit();
mCommentVerticalBarColor3 = customThemeWrapper.getCommentVerticalBarColor3(themeType); mUsernameColor = customThemeWrapper.getUsername();
mCommentVerticalBarColor4 = customThemeWrapper.getCommentVerticalBarColor4(themeType); mUpvotedColor = customThemeWrapper.getUpvoted();
mCommentVerticalBarColor5 = customThemeWrapper.getCommentVerticalBarColor5(themeType); mDownvotedColor = customThemeWrapper.getDownvoted();
mCommentVerticalBarColor6 = customThemeWrapper.getCommentVerticalBarColor6(themeType); mCommentVerticalBarColor1 = customThemeWrapper.getCommentVerticalBarColor1();
mCommentVerticalBarColor7 = customThemeWrapper.getCommentVerticalBarColor7(themeType); mCommentVerticalBarColor2 = customThemeWrapper.getCommentVerticalBarColor2();
mSingleCommentThreadBackgroundColor = customThemeWrapper.getSingleCommentThreadBackgroundColor(themeType); mCommentVerticalBarColor3 = customThemeWrapper.getCommentVerticalBarColor3();
mVoteAndReplyUnavailableVoteButtonColor = customThemeWrapper.getVoteAndReplyUnavailableVoteButtonColor(themeType); mCommentVerticalBarColor4 = customThemeWrapper.getCommentVerticalBarColor4();
mButtonTextColor = customThemeWrapper.getButtonTextColor(themeType); mCommentVerticalBarColor5 = customThemeWrapper.getCommentVerticalBarColor5();
mCommentVerticalBarColor6 = customThemeWrapper.getCommentVerticalBarColor6();
mCommentVerticalBarColor7 = customThemeWrapper.getCommentVerticalBarColor7();
mSingleCommentThreadBackgroundColor = customThemeWrapper.getSingleCommentThreadBackgroundColor();
mVoteAndReplyUnavailableVoteButtonColor = customThemeWrapper.getVoteAndReplyUnavailableVoteButtonColor();
mButtonTextColor = customThemeWrapper.getButtonTextColor();
mShareLinkBottomSheetFragment = new ShareLinkBottomSheetFragment(); mShareLinkBottomSheetFragment = new ShareLinkBottomSheetFragment();
mCopyTextBottomSheetFragment = new CopyTextBottomSheetFragment(); mCopyTextBottomSheetFragment = new CopyTextBottomSheetFragment();
@ -2004,18 +2013,23 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
mUserTextView.setTextColor(mUsernameColor); mUserTextView.setTextColor(mUsernameColor);
mPostTimeTextView.setTextColor(mSecondaryTextColor); mPostTimeTextView.setTextColor(mSecondaryTextColor);
mTitleTextView.setTextColor(mPostTitleColor); mTitleTextView.setTextColor(mPostTitleColor);
mTypeTextView.setBackgroundColor(mPostTypeColor); mTypeTextView.setBackgroundColor(mPostTypeBackgroundColor);
mTypeTextView.setBorderColor(mPostTypeColor); mTypeTextView.setBorderColor(mPostTypeBackgroundColor);
mSpoilerTextView.setBackgroundColor(mSpoilerColor); mTypeTextView.setTextColor(mPostTypeTextColor);
mSpoilerTextView.setBorderColor(mSpoilerColor); mSpoilerTextView.setBackgroundColor(mSpoilerBackgroundColor);
mNSFWTextView.setBackgroundColor(mNSFWColor); mSpoilerTextView.setBorderColor(mSpoilerBackgroundColor);
mNSFWTextView.setBorderColor(mNSFWColor); mSpoilerTextView.setTextColor(mSpoilerTextColor);
mFlairTextView.setBackgroundColor(mFlairColor); mNSFWTextView.setBackgroundColor(mNSFWBackgroundColor);
mFlairTextView.setBorderColor(mFlairColor); mNSFWTextView.setBorderColor(mNSFWBackgroundColor);
mNSFWTextView.setTextColor(mNSFWTextColor);
mFlairTextView.setBackgroundColor(mFlairBackgroundColor);
mFlairTextView.setBorderColor(mFlairBackgroundColor);
mFlairTextView.setTextColor(mFlairTextColor);
mArchivedImageView.setColorFilter(mArchivedTintColor, PorterDuff.Mode.SRC_IN); mArchivedImageView.setColorFilter(mArchivedTintColor, PorterDuff.Mode.SRC_IN);
mLockedImageView.setColorFilter(mLockedTintColor, PorterDuff.Mode.SRC_IN); mLockedImageView.setColorFilter(mLockedTintColor, PorterDuff.Mode.SRC_IN);
mCrosspostImageView.setColorFilter(mCrosspostTintColor, PorterDuff.Mode.SRC_IN); mCrosspostImageView.setColorFilter(mCrosspostTintColor, PorterDuff.Mode.SRC_IN);
mLinkTextView.setTextColor(mSecondaryTextColor); mLinkTextView.setTextColor(mSecondaryTextColor);
mLoadImageProgressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent));
mNoPreviewLinkImageView.setBackgroundColor(mNoPreviewLinkBackgroundColor); mNoPreviewLinkImageView.setBackgroundColor(mNoPreviewLinkBackgroundColor);
mLoadImageErrorTextView.setTextColor(mPrimaryTextColor); mLoadImageErrorTextView.setTextColor(mPrimaryTextColor);
} }
@ -2086,7 +2100,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
authorTextView.setTextColor(mUsernameColor); authorTextView.setTextColor(mUsernameColor);
commentTimeTextView.setTextColor(mSecondaryTextColor); commentTimeTextView.setTextColor(mSecondaryTextColor);
commentMarkdownView.setTextColor(mCommentTextColor); commentMarkdownView.setTextColor(mCommentTextColor);
authorFlairTextView.setTextColor(mFlairColor); authorFlairTextView.setTextColor(mAuthorFlairTextColor);
commentDivider.setBackgroundColor(mDividerColor); commentDivider.setBackgroundColor(mDividerColor);
} }
} }

View File

@ -127,18 +127,17 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
mShowCommentDivider = showCommentDivider; mShowCommentDivider = showCommentDivider;
mShowAbsoluteNumberOfVotes = showAbsoluteNumberOfVotes; mShowAbsoluteNumberOfVotes = showAbsoluteNumberOfVotes;
mRetryLoadingMoreCallback = retryLoadingMoreCallback; mRetryLoadingMoreCallback = retryLoadingMoreCallback;
int themeType = customThemeWrapper.getThemeType(); mColorPrimaryLightTheme = customThemeWrapper.getColorPrimaryLightTheme();
mColorPrimaryLightTheme = customThemeWrapper.getColorPrimaryLightTheme(themeType); mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor();
mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor(themeType); mCommentBackgroundColor = customThemeWrapper.getCommentBackgroundColor();
mCommentBackgroundColor = customThemeWrapper.getCommentBackgroundColor(themeType); mCommentColor = customThemeWrapper.getCommentColor();
mCommentColor = customThemeWrapper.getCommentColor(themeType); mDividerColor = customThemeWrapper.getDividerColor();
mDividerColor = customThemeWrapper.getDividerColor(themeType); mSubredditColor = customThemeWrapper.getSubreddit();
mSubredditColor = customThemeWrapper.getSubreddit(themeType); mUsernameColor = customThemeWrapper.getUsername();
mUsernameColor = customThemeWrapper.getUsername(themeType); mUpvotedColor = customThemeWrapper.getUpvoted();
mUpvotedColor = customThemeWrapper.getUpvoted(themeType); mDownvotedColor = customThemeWrapper.getDownvoted();
mDownvotedColor = customThemeWrapper.getDownvoted(themeType); mButtonTextColor = customThemeWrapper.getButtonTextColor();
mButtonTextColor = customThemeWrapper.getButtonTextColor(themeType); mColorAccent = customThemeWrapper.getColorAccent();
mColorAccent = customThemeWrapper.getColorAccent(themeType);
} }
@NonNull @NonNull

View File

@ -32,7 +32,7 @@ public class FlairBottomSheetRecyclerViewAdapter extends RecyclerView.Adapter<Fl
public FlairBottomSheetRecyclerViewAdapter(Context context, CustomThemeWrapper customThemeWrapper, public FlairBottomSheetRecyclerViewAdapter(Context context, CustomThemeWrapper customThemeWrapper,
ItemClickListener itemClickListener) { ItemClickListener itemClickListener) {
this.context = context; this.context = context;
flairColor = customThemeWrapper.getFlairColor(customThemeWrapper.getThemeType()); flairColor = customThemeWrapper.getFlairBackgroundColor();
this.itemClickListener = itemClickListener; this.itemClickListener = itemClickListener;
} }

View File

@ -55,9 +55,8 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc
mRedditDataRoomDatabase = redditDataRoomDatabase; mRedditDataRoomDatabase = redditDataRoomDatabase;
mAccessToken = accessToken; mAccessToken = accessToken;
glide = Glide.with(context.getApplicationContext()); glide = Glide.with(context.getApplicationContext());
int themeType = customThemeWrapper.getThemeType(); mUsernameColor = customThemeWrapper.getUsername();
mUsernameColor = customThemeWrapper.getUsername(themeType); mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor();
mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor(themeType);
} }
@Override @Override

View File

@ -99,15 +99,14 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl
.build(); .build();
mAccessToken = accessToken; mAccessToken = accessToken;
int themeType = customThemeWrapper.getThemeType(); mColorAccent = customThemeWrapper.getColorAccent();
mColorAccent = customThemeWrapper.getColorAccent(themeType); mMessageBackgroundColor = customThemeWrapper.getCardViewBackgroundColor();
mMessageBackgroundColor = customThemeWrapper.getCardViewBackgroundColor(themeType); mUsernameColor = customThemeWrapper.getUsername();
mUsernameColor = customThemeWrapper.getUsername(themeType); mPrimaryTextColor = customThemeWrapper.getPrimaryTextColor();
mPrimaryTextColor = customThemeWrapper.getPrimaryTextColor(themeType); mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor();
mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor(themeType); mUnreadMessageBackgroundColor = customThemeWrapper.getUnreadMessageBackgroundColor();
mUnreadMessageBackgroundColor = customThemeWrapper.getUnreadMessageBackgroundColor(themeType); mColorPrimaryLightTheme = customThemeWrapper.getColorPrimaryLightTheme();
mColorPrimaryLightTheme = customThemeWrapper.getColorPrimaryLightTheme(themeType); mButtonTextColor = customThemeWrapper.getButtonTextColor();
mButtonTextColor = customThemeWrapper.getButtonTextColor(themeType);
} }
@NonNull @NonNull

View File

@ -59,9 +59,8 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter<
mRedditDataRoomDatabase = redditDataRoomDatabase; mRedditDataRoomDatabase = redditDataRoomDatabase;
mAccessToken = accessToken; mAccessToken = accessToken;
mAccountName = accountName; mAccountName = accountName;
int themeType = customThemeWrapper.getThemeType(); mPrimaryTextColor = customThemeWrapper.getPrimaryTextColor();
mPrimaryTextColor = customThemeWrapper.getPrimaryTextColor(themeType); mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor();
mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor(themeType);
} }
@Override @Override

View File

@ -75,10 +75,9 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter<Re
this.isNSFWEnabled = isNSFWEnabled; this.isNSFWEnabled = isNSFWEnabled;
isLoggedIn = accountName != null; isLoggedIn = accountName != null;
this.itemClickListener = itemClickListener; this.itemClickListener = itemClickListener;
int themeType = customThemeWrapper.getThemeType(); primaryTextColor = customThemeWrapper.getPrimaryTextColor();
primaryTextColor = customThemeWrapper.getPrimaryTextColor(themeType); secondaryTextColor = customThemeWrapper.getSecondaryTextColor();
secondaryTextColor = customThemeWrapper.getSecondaryTextColor(themeType); dividerColor = customThemeWrapper.getDividerColor();
dividerColor = customThemeWrapper.getDividerColor(themeType);
} }
@Override @Override
@ -448,8 +447,6 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter<Re
NavHeaderViewHolder(@NonNull View itemView) { NavHeaderViewHolder(@NonNull View itemView) {
super(itemView); super(itemView);
ButterKnife.bind(this, itemView); ButterKnife.bind(this, itemView);
accountNameTextView.setTextColor(secondaryTextColor);
karmaTextView.setTextColor(secondaryTextColor);
} }
} }
@ -459,7 +456,7 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter<Re
MenuGroupTitleViewHolder(@NonNull View itemView) { MenuGroupTitleViewHolder(@NonNull View itemView) {
super(itemView); super(itemView);
titleTextView = (TextView) itemView; titleTextView = (TextView) itemView;
titleTextView.setTextColor(primaryTextColor); titleTextView.setTextColor(secondaryTextColor);
} }
} }

View File

@ -102,37 +102,28 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
private int mPostLayout; private int mPostLayout;
private int mColorPrimaryLightTheme; private int mColorPrimaryLightTheme;
private int mColorAccent; private int mColorAccent;
private int mCardViewColor; private int mCardViewBackgroundColor;
private int mSecondaryTextColor; private int mSecondaryTextColor;
private int mPostTitleColor; private int mPostTitleColor;
private int mPrimaryTextColor; private int mPostContentColor;
private int mCommentTextColor; private int mStickiedPostIconTint;
private int mCommentBackgroundColor; private int mPostTypeBackgroundColor;
private int mPostTypeColor; private int mPostTypeTextColor;
private int mDividerColor;
private int mSubredditColor; private int mSubredditColor;
private int mUsernameColor; private int mUsernameColor;
private int mSubmitterColor; private int mSpoilerBackgroundColor;
private int mModeratorColor; private int mSpoilerTextColor;
private int mSpoilerColor; private int mFlairBackgroundColor;
private int mFlairColor; private int mFlairTextColor;
private int mNSFWColor; private int mNSFWBackgroundColor;
private int mArchivedTintColor; private int mNSFWTextColor;
private int mLockedTintColor; private int mArchivedIconTint;
private int mCrosspostTintColor; private int mLockedIconTint;
private int mCrosspostIconTint;
private int mNoPreviewLinkBackgroundColor; private int mNoPreviewLinkBackgroundColor;
private int mUpvotedColor; private int mUpvotedColor;
private int mDownvotedColor; private int mDownvotedColor;
private int mCommentVerticalBarColor1;
private int mCommentVerticalBarColor2;
private int mCommentVerticalBarColor3;
private int mCommentVerticalBarColor4;
private int mCommentVerticalBarColor5;
private int mCommentVerticalBarColor6;
private int mCommentVerticalBarColor7;
private int mSingleCommentThreadBackgroundColor;
private int mVoteAndReplyUnavailableVoteButtonColor; private int mVoteAndReplyUnavailableVoteButtonColor;
private int mButtonBackgroundTint;
private int mButtonTextColor; private int mButtonTextColor;
private float mScale; private float mScale;
private boolean mDisplaySubredditName; private boolean mDisplaySubredditName;
@ -168,16 +159,33 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
mShowDividerInCompactLayout = showDividerInCompactLayout; mShowDividerInCompactLayout = showDividerInCompactLayout;
mShowAbsoluteNumberOfVotes = showAbsoluteNumberOfVotes; mShowAbsoluteNumberOfVotes = showAbsoluteNumberOfVotes;
mPostLayout = postLayout; mPostLayout = postLayout;
int themeType = customThemeWrapper.getThemeType();
mColorPrimaryLightTheme = customThemeWrapper.getColorPrimaryLightTheme(themeType); mColorPrimaryLightTheme = customThemeWrapper.getColorPrimaryLightTheme();
mColorAccent = customThemeWrapper.getColorAccent(themeType); mColorAccent = customThemeWrapper.getColorAccent();
mPrimaryTextColor = customThemeWrapper.getPrimaryTextColor(themeType); mCardViewBackgroundColor = customThemeWrapper.getCardViewBackgroundColor();
mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor(themeType); mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor();
mSubredditColor = customThemeWrapper.getSubreddit(themeType); mPostTitleColor = customThemeWrapper.getPostTitleColor();
mUsernameColor = customThemeWrapper.getUsername(themeType); mPostContentColor = customThemeWrapper.getPostContentColor();
mUpvotedColor = customThemeWrapper.getUpvoted(themeType); mStickiedPostIconTint = customThemeWrapper.getStickiedPostIconTint();
mDownvotedColor = customThemeWrapper.getDownvoted(themeType); mPostTypeBackgroundColor = customThemeWrapper.getPostTypeBackgroundColor();
mVoteAndReplyUnavailableVoteButtonColor = customThemeWrapper.getVoteAndReplyUnavailableVoteButtonColor(themeType); mPostTypeTextColor = customThemeWrapper.getPostTypeTextColor();
mSubredditColor = customThemeWrapper.getSubreddit();
mUsernameColor = customThemeWrapper.getUsername();
mSpoilerBackgroundColor = customThemeWrapper.getSpoilerBackgroundColor();
mSpoilerTextColor = customThemeWrapper.getSpoilerTextColor();
mFlairBackgroundColor = customThemeWrapper.getFlairBackgroundColor();
mFlairTextColor = customThemeWrapper.getFlairTextColor();
mNSFWBackgroundColor = customThemeWrapper.getNsfwBackgroundColor();
mNSFWTextColor = customThemeWrapper.getNsfwTextColor();
mArchivedIconTint = customThemeWrapper.getArchivedTint();
mLockedIconTint = customThemeWrapper.getLockedIconTint();
mCrosspostIconTint = customThemeWrapper.getCrosspostIconTint();
mNoPreviewLinkBackgroundColor = customThemeWrapper.getNoPreviewLinkBackgroundColor();
mUpvotedColor = customThemeWrapper.getUpvoted();
mDownvotedColor = customThemeWrapper.getDownvoted();
mVoteAndReplyUnavailableVoteButtonColor = customThemeWrapper.getVoteAndReplyUnavailableVoteButtonColor();
mButtonTextColor = customThemeWrapper.getButtonTextColor();
mScale = activity.getResources().getDisplayMetrics().density; mScale = activity.getResources().getDisplayMetrics().density;
mGlide = Glide.with(mActivity.getApplicationContext()); mGlide = Glide.with(mActivity.getApplicationContext());
mRedditDataRoomDatabase = redditDataRoomDatabase; mRedditDataRoomDatabase = redditDataRoomDatabase;
@ -1621,22 +1629,30 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
constraintSet.applyTo(bottomConstraintLayout); constraintSet.applyTo(bottomConstraintLayout);
} }
itemView.setBackgroundTintList(ColorStateList.valueOf(mCardViewBackgroundColor));
subredditTextView.setTextColor(mSubredditColor); subredditTextView.setTextColor(mSubredditColor);
userTextView.setTextColor(mUsernameColor); userTextView.setTextColor(mUsernameColor);
postTimeTextView.setTextColor(mSecondaryTextColor); postTimeTextView.setTextColor(mSecondaryTextColor);
titleTextView.setTextColor(mPrimaryTextColor); titleTextView.setTextColor(mPostTitleColor);
typeTextView.setBackgroundColor(mPostTypeColor); contentTextView.setTextColor(mPostContentColor);
typeTextView.setBorderColor(mPostTypeColor); stickiedPostImageView.setColorFilter(mStickiedPostIconTint, PorterDuff.Mode.SRC_IN);
spoilerTextView.setBackgroundColor(mSpoilerColor); typeTextView.setBackgroundColor(mPostTypeBackgroundColor);
spoilerTextView.setBorderColor(mSpoilerColor); typeTextView.setBorderColor(mPostTypeBackgroundColor);
nsfwTextView.setBackgroundColor(mNSFWColor); typeTextView.setTextColor(mPostTypeTextColor);
nsfwTextView.setBorderColor(mNSFWColor); spoilerTextView.setBackgroundColor(mSpoilerBackgroundColor);
flairTextView.setBackgroundColor(mFlairColor); spoilerTextView.setBorderColor(mSpoilerBackgroundColor);
flairTextView.setBorderColor(mFlairColor); spoilerTextView.setTextColor(mSpoilerTextColor);
archivedImageView.setColorFilter(mArchivedTintColor, PorterDuff.Mode.SRC_IN); nsfwTextView.setBackgroundColor(mNSFWBackgroundColor);
lockedImageView.setColorFilter(mLockedTintColor, PorterDuff.Mode.SRC_IN); nsfwTextView.setBorderColor(mNSFWBackgroundColor);
crosspostImageView.setColorFilter(mCrosspostTintColor, PorterDuff.Mode.SRC_IN); nsfwTextView.setTextColor(mNSFWTextColor);
flairTextView.setBackgroundColor(mFlairBackgroundColor);
flairTextView.setBorderColor(mFlairBackgroundColor);
flairTextView.setTextColor(mFlairTextColor);
archivedImageView.setColorFilter(mArchivedIconTint, PorterDuff.Mode.SRC_IN);
lockedImageView.setColorFilter(mLockedIconTint, PorterDuff.Mode.SRC_IN);
crosspostImageView.setColorFilter(mCrosspostIconTint, PorterDuff.Mode.SRC_IN);
linkTextView.setTextColor(mSecondaryTextColor); linkTextView.setTextColor(mSecondaryTextColor);
progressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent));
noPreviewLinkImageView.setBackgroundColor(mNoPreviewLinkBackgroundColor); noPreviewLinkImageView.setBackgroundColor(mNoPreviewLinkBackgroundColor);
} }
} }
@ -1723,20 +1739,27 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
constraintSet.applyTo(bottomConstraintLayout); constraintSet.applyTo(bottomConstraintLayout);
} }
itemView.setBackgroundTintList(ColorStateList.valueOf(mCardViewBackgroundColor));
postTimeTextView.setTextColor(mSecondaryTextColor); postTimeTextView.setTextColor(mSecondaryTextColor);
titleTextView.setTextColor(mPrimaryTextColor); titleTextView.setTextColor(mPostTitleColor);
typeTextView.setBackgroundColor(mPostTypeColor); stickiedPostImageView.setColorFilter(mStickiedPostIconTint, PorterDuff.Mode.SRC_IN);
typeTextView.setBorderColor(mPostTypeColor); typeTextView.setBackgroundColor(mPostTypeBackgroundColor);
spoilerTextView.setBackgroundColor(mSpoilerColor); typeTextView.setBorderColor(mPostTypeBackgroundColor);
spoilerTextView.setBorderColor(mSpoilerColor); typeTextView.setTextColor(mPostTypeTextColor);
nsfwTextView.setBackgroundColor(mNSFWColor); spoilerTextView.setBackgroundColor(mSpoilerBackgroundColor);
nsfwTextView.setBorderColor(mNSFWColor); spoilerTextView.setBorderColor(mSpoilerBackgroundColor);
flairTextView.setBackgroundColor(mFlairColor); spoilerTextView.setTextColor(mSpoilerTextColor);
flairTextView.setBorderColor(mFlairColor); nsfwTextView.setBackgroundColor(mNSFWBackgroundColor);
archivedImageView.setColorFilter(mArchivedTintColor, PorterDuff.Mode.SRC_IN); nsfwTextView.setBorderColor(mNSFWBackgroundColor);
lockedImageView.setColorFilter(mLockedTintColor, PorterDuff.Mode.SRC_IN); nsfwTextView.setTextColor(mNSFWTextColor);
crosspostImageView.setColorFilter(mCrosspostTintColor, PorterDuff.Mode.SRC_IN); flairTextView.setBackgroundColor(mFlairBackgroundColor);
flairTextView.setBorderColor(mFlairBackgroundColor);
flairTextView.setTextColor(mFlairTextColor);
archivedImageView.setColorFilter(mArchivedIconTint, PorterDuff.Mode.SRC_IN);
lockedImageView.setColorFilter(mLockedIconTint, PorterDuff.Mode.SRC_IN);
crosspostImageView.setColorFilter(mCrosspostIconTint, PorterDuff.Mode.SRC_IN);
linkTextView.setTextColor(mSecondaryTextColor); linkTextView.setTextColor(mSecondaryTextColor);
progressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent));
noPreviewLinkImageView.setBackgroundColor(mNoPreviewLinkBackgroundColor); noPreviewLinkImageView.setBackgroundColor(mNoPreviewLinkBackgroundColor);
} }
} }

View File

@ -60,9 +60,8 @@ public class RulesRecyclerViewAdapter extends RecyclerView.Adapter<RulesRecycler
) )
) )
.build(); .build();
int themeType = customThemeWrapper.getThemeType(); mPrimaryTextColor = customThemeWrapper.getPrimaryTextColor();
mPrimaryTextColor = customThemeWrapper.getPrimaryTextColor(themeType); mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor();
mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor(themeType);
} }
@NonNull @NonNull

View File

@ -81,13 +81,12 @@ public class SubredditListingRecyclerViewAdapter extends PagedListAdapter<Subred
this.redditDataRoomDatabase = redditDataRoomDatabase; this.redditDataRoomDatabase = redditDataRoomDatabase;
this.callback = callback; this.callback = callback;
glide = Glide.with(context.getApplicationContext()); glide = Glide.with(context.getApplicationContext());
int themeType = customThemeWrapper.getThemeType(); colorPrimaryLightTheme = customThemeWrapper.getColorPrimaryLightTheme();
colorPrimaryLightTheme = customThemeWrapper.getColorPrimaryLightTheme(themeType); primaryTextColor = customThemeWrapper.getPrimaryTextColor();
primaryTextColor = customThemeWrapper.getPrimaryTextColor(themeType); secondaryTextColor = customThemeWrapper.getSecondaryTextColor();
secondaryTextColor = customThemeWrapper.getSecondaryTextColor(themeType); colorAccent = customThemeWrapper.getColorAccent();
colorAccent = customThemeWrapper.getColorAccent(themeType); buttonTextColor = customThemeWrapper.getButtonTextColor();
buttonTextColor = customThemeWrapper.getButtonTextColor(themeType); unsubscribed = customThemeWrapper.getUnsubscribed();
unsubscribed = customThemeWrapper.getUnsubscribed(themeType);
} }
@NonNull @NonNull

View File

@ -62,9 +62,8 @@ public class SubredditMultiselectionRecyclerViewAdapter extends RecyclerView.Ada
this.otherSubreddits.addAll(otherSubreddits); this.otherSubreddits.addAll(otherSubreddits);
} }
int themeType = customThemeWrapper.getThemeType(); primaryTextColor = customThemeWrapper.getPrimaryTextColor();
primaryTextColor = customThemeWrapper.getPrimaryTextColor(themeType); colorAccent = customThemeWrapper.getColorAccent();
colorAccent = customThemeWrapper.getColorAccent(themeType);
} }
@Override @Override

View File

@ -61,9 +61,8 @@ public class SubscribedSubredditsRecyclerViewAdapter extends RecyclerView.Adapte
mOauthRetrofit = oauthRetrofit; mOauthRetrofit = oauthRetrofit;
mRedditDataRoomDatabase = redditDataRoomDatabase; mRedditDataRoomDatabase = redditDataRoomDatabase;
this.accessToken = accessToken; this.accessToken = accessToken;
int themeType = customThemeWrapper.getThemeType(); primaryTextColor = customThemeWrapper.getPrimaryTextColor();
primaryTextColor = customThemeWrapper.getPrimaryTextColor(themeType); secondaryTextColor = customThemeWrapper.getSecondaryTextColor();
secondaryTextColor = customThemeWrapper.getSecondaryTextColor(themeType);
} }
public SubscribedSubredditsRecyclerViewAdapter(Context context, Retrofit oauthRetrofit, public SubscribedSubredditsRecyclerViewAdapter(Context context, Retrofit oauthRetrofit,

View File

@ -82,12 +82,11 @@ public class UserListingRecyclerViewAdapter extends PagedListAdapter<UserData, R
this.subscribedUserDao = subscribedUserDao; this.subscribedUserDao = subscribedUserDao;
this.retryLoadingMoreCallback = retryLoadingMoreCallback; this.retryLoadingMoreCallback = retryLoadingMoreCallback;
glide = Glide.with(context.getApplicationContext()); glide = Glide.with(context.getApplicationContext());
int themeType = customThemeWrapper.getThemeType(); primaryTextColor = customThemeWrapper.getPrimaryTextColor();
primaryTextColor = customThemeWrapper.getPrimaryTextColor(themeType); buttonTextColor = customThemeWrapper.getButtonTextColor();
buttonTextColor = customThemeWrapper.getButtonTextColor(themeType); colorPrimaryLightTheme = customThemeWrapper.getColorPrimaryLightTheme();
colorPrimaryLightTheme = customThemeWrapper.getColorPrimaryLightTheme(themeType); colorAccent = customThemeWrapper.getColorAccent();
colorAccent = customThemeWrapper.getColorAccent(themeType); unsubscribedColor = customThemeWrapper.getUnsubscribed();
unsubscribedColor = customThemeWrapper.getUnsubscribed(themeType);
} }
@NonNull @NonNull

View File

@ -44,6 +44,7 @@ import ml.docilealligator.infinityforreddit.Fragment.SubscribedSubredditsListing
import ml.docilealligator.infinityforreddit.Fragment.UserListingFragment; import ml.docilealligator.infinityforreddit.Fragment.UserListingFragment;
import ml.docilealligator.infinityforreddit.Service.SubmitPostService; import ml.docilealligator.infinityforreddit.Service.SubmitPostService;
import ml.docilealligator.infinityforreddit.Settings.GesturesAndButtonsPreferenceFragment; import ml.docilealligator.infinityforreddit.Settings.GesturesAndButtonsPreferenceFragment;
import ml.docilealligator.infinityforreddit.Settings.InterfacePreferenceFragment;
import ml.docilealligator.infinityforreddit.Settings.MainPreferenceFragment; import ml.docilealligator.infinityforreddit.Settings.MainPreferenceFragment;
import ml.docilealligator.infinityforreddit.Settings.NotificationPreferenceFragment; import ml.docilealligator.infinityforreddit.Settings.NotificationPreferenceFragment;
@ -137,4 +138,6 @@ public interface AppComponent {
void inject(CreateMultiRedditActivity createMultiRedditActivity); void inject(CreateMultiRedditActivity createMultiRedditActivity);
void inject(SubredditMultiselectionActivity subredditMultiselectionActivity); void inject(SubredditMultiselectionActivity subredditMultiselectionActivity);
void inject(InterfacePreferenceFragment interfacePreferenceFragment);
} }

View File

@ -7,16 +7,16 @@ import ml.docilealligator.infinityforreddit.Utils.CustomThemeSharedPreferencesUt
import static ml.docilealligator.infinityforreddit.Utils.CustomThemeSharedPreferencesUtils.AMOLED_DARK; import static ml.docilealligator.infinityforreddit.Utils.CustomThemeSharedPreferencesUtils.AMOLED_DARK;
import static ml.docilealligator.infinityforreddit.Utils.CustomThemeSharedPreferencesUtils.DARK; import static ml.docilealligator.infinityforreddit.Utils.CustomThemeSharedPreferencesUtils.DARK;
import static ml.docilealligator.infinityforreddit.Utils.CustomThemeSharedPreferencesUtils.NORMAL;
public class CustomThemeWrapper { public class CustomThemeWrapper {
private SharedPreferences themeSharedPreferences; private SharedPreferences themeSharedPreferences;
private int themeType;
public CustomThemeWrapper(SharedPreferences themeSharedPreferences) { public CustomThemeWrapper(SharedPreferences themeSharedPreferences) {
this.themeSharedPreferences = themeSharedPreferences; this.themeSharedPreferences = themeSharedPreferences;
} }
private int getDefaultColor(int themeType, String normalHex, String darkHex, String amoledDarkHex) { private int getDefaultColor(String normalHex, String darkHex, String amoledDarkHex) {
switch (themeType) { switch (themeType) {
case DARK: case DARK:
return Color.parseColor(darkHex); return Color.parseColor(darkHex);
@ -27,287 +27,310 @@ public class CustomThemeWrapper {
} }
} }
public int getThemeType() { public void setThemeType(int themeType) {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.THEME_TYPE_KEY, NORMAL); this.themeType = themeType;
} }
public int getColorPrimary(int themeType) { public boolean isLightStatusBar() {
return themeSharedPreferences.getBoolean(CustomThemeSharedPreferencesUtils.LIGHT_STATUS_BAR, false);
}
public boolean isLightNavBar() {
return themeSharedPreferences.getBoolean(CustomThemeSharedPreferencesUtils.LIGHT_NAV_BAR, false);
}
public int getColorPrimary() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COLOR_PRIMARY, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COLOR_PRIMARY,
getDefaultColor(themeType, "#1565C0", "#242424", "#000000")); getDefaultColor("#1565C0", "#242424", "#000000"));
} }
public int getColorPrimaryDark(int themeType) { public int getColorPrimaryDark() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COLOR_PRIMARY_DARK, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COLOR_PRIMARY_DARK,
getDefaultColor(themeType, "#0D47A1", "#121212", "#000000")); getDefaultColor("#0D47A1", "#121212", "#000000"));
} }
public int getColorAccent(int themeType) { public int getColorAccent() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COLOR_ACCENT, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COLOR_ACCENT,
getDefaultColor(themeType, "#FF4081", "#FF4081", "#FF4081")); getDefaultColor("#FF4081", "#FF4081", "#FF4081"));
} }
public int getColorPrimaryLightTheme(int themeType) { public int getColorPrimaryLightTheme() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COLOR_PRIMARY_LIGHT_THEME, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COLOR_PRIMARY_LIGHT_THEME,
getDefaultColor(themeType, "#1565C0", "#1565C0", "#1565C0")); getDefaultColor("#1565C0", "#1565C0", "#1565C0"));
} }
public int getPostTitleColor(int themeType) { public int getPostTitleColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.POST_TITLE_COLOR, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.POST_TITLE_COLOR,
getDefaultColor(themeType, "#000000", "#FFFFFF", "#FFFFFF")); getDefaultColor("#000000", "#FFFFFF", "#FFFFFF"));
} }
public int getPostContentColor(int themeType) { public int getPostContentColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.POST_CONTENT_COLOR, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.POST_CONTENT_COLOR,
getDefaultColor(themeType, "#8A000000", "#B3FFFFFF", "#B3FFFFFF")); getDefaultColor("#8A000000", "#B3FFFFFF", "#B3FFFFFF"));
} }
public int getCommentColor(int themeType) { public int getCommentColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COMMENT_COLOR, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COMMENT_COLOR,
getDefaultColor(themeType, "#000000", "#FFFFFF", "#FFFFFF")); getDefaultColor("#000000", "#FFFFFF", "#FFFFFF"));
} }
public int getPrimaryTextColor(int themeType) { public int getPrimaryTextColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.PRIMARY_TEXT_COLOR, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.PRIMARY_TEXT_COLOR,
getDefaultColor(themeType, "#000000", "#FFFFFF", "#FFFFFF")); getDefaultColor("#000000", "#FFFFFF", "#FFFFFF"));
} }
public int getSecondaryTextColor(int themeType) { public int getSecondaryTextColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.SECONDARY_TEXT_COLOR, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.SECONDARY_TEXT_COLOR,
getDefaultColor(themeType, "#8A000000", "#B3FFFFFF", "#B3FFFFFF")); getDefaultColor("#8A000000", "#B3FFFFFF", "#B3FFFFFF"));
} }
public int getButtonTextColor(int themeType) { public int getButtonTextColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.BUTTON_TEXT_COLOR, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.BUTTON_TEXT_COLOR,
getDefaultColor(themeType, "#FFFFFF", "#FFFFFF", "#FFFFFF")); getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF"));
} }
public int getBackgroundColor(int themeType) { public int getBackgroundColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.BACKGROUND_COLOR, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.BACKGROUND_COLOR,
getDefaultColor(themeType, "#FFFFFF", "#121212", "#000000")); getDefaultColor("#FFFFFF", "#121212", "#000000"));
} }
public int getRoundedBottomSheetPrimaryBackground(int themeType) { public int getCardViewBackgroundColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.ROUNDED_BOTTOM_SHEET_PRIMARY_BACKGROUND,
getDefaultColor(themeType, "#FFFFFF", "#242424", "#000000"));
}
public int getCardViewBackgroundColor(int themeType) {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.CARD_VIEW_BACKGROUND_COLOR, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.CARD_VIEW_BACKGROUND_COLOR,
getDefaultColor(themeType, "#FFFFFF", "#242424", "#000000")); getDefaultColor("#FFFFFF", "#242424", "#000000"));
} }
public int getCommentBackgroundColor(int themeType) { public int getCommentBackgroundColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COMMENT_BACKGROUND_COLOR, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COMMENT_BACKGROUND_COLOR,
getDefaultColor(themeType, "#FFFFFF", "#242424", "#000000")); getDefaultColor("#FFFFFF", "#242424", "#000000"));
} }
public int getToolbarPrimaryTextAndIconColor(int themeType) { public int getToolbarPrimaryTextAndIconColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.TOOLBAR_PRIMARY_TEXT_AND_ICON_COLOR, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.TOOLBAR_PRIMARY_TEXT_AND_ICON_COLOR,
getDefaultColor(themeType, "#FFFFFF", "#FFFFFF", "#FFFFFF")); getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF"));
} }
public int getToolbarAndTabBackgroundColor(int themeType) { public int getToolbarAndTabBackgroundColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.TOOLBAR_AND_TAB_BACKGROUND_COLOR, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.TOOLBAR_AND_TAB_BACKGROUND_COLOR,
getDefaultColor(themeType, "#1565C0", "#282828", "#000000")); getDefaultColor("#1565C0", "#282828", "#000000"));
} }
public int getCircularProgressBarBackground(int themeType) { public int getCircularProgressBarBackground() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.CIRCULAR_PROGRESS_BAR_BACKGROUND, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.CIRCULAR_PROGRESS_BAR_BACKGROUND,
getDefaultColor(themeType, "#FFFFFF", "#242424", "#000000")); getDefaultColor("#FFFFFF", "#242424", "#000000"));
} }
public int getTabLayoutWithExpandedCollapsingToolbarTabBackground(int themeType) { public int getTabLayoutWithExpandedCollapsingToolbarTabBackground() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.TAB_LAYOUT_WITH_EXPANDED_COLLAPSING_TOOLBAR_TAB_BACKGROUND, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.TAB_LAYOUT_WITH_EXPANDED_COLLAPSING_TOOLBAR_TAB_BACKGROUND,
getDefaultColor(themeType, "#FFFFFF", "#242424", "#000000")); getDefaultColor("#FFFFFF", "#242424", "#000000"));
} }
public int getTabLayoutWithExpandedCollapsingToolbarTextColor(int themeType) { public int getTabLayoutWithExpandedCollapsingToolbarTextColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.TAB_LAYOUT_WITH_EXPANDED_COLLAPSING_TOOLBAR_TEXT_COLOR, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.TAB_LAYOUT_WITH_EXPANDED_COLLAPSING_TOOLBAR_TEXT_COLOR,
getDefaultColor(themeType, "#1565C0", "#FFFFFF", "#FFFFFF")); getDefaultColor("#1565C0", "#FFFFFF", "#FFFFFF"));
} }
public int getTabLayoutWithExpandedCollapsingToolbarTabIndicator(int themeType) { public int getTabLayoutWithExpandedCollapsingToolbarTabIndicator() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.TAB_LAYOUT_WITH_EXPANDED_COLLAPSING_TOOLBAR_TAB_INDICATOR, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.TAB_LAYOUT_WITH_EXPANDED_COLLAPSING_TOOLBAR_TAB_INDICATOR,
getDefaultColor(themeType, "#1565C0", "#FFFFFF", "#FFFFFF")); getDefaultColor("#1565C0", "#FFFFFF", "#FFFFFF"));
} }
public int getTabLayoutWithCollapsedCollapsingToolbarTabBackground(int themeType) { public int getTabLayoutWithCollapsedCollapsingToolbarTabBackground() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.TAB_LAYOUT_WITH_COLLAPSED_COLLAPSING_TOOLBAR_TAB_BACKGROUND, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.TAB_LAYOUT_WITH_COLLAPSED_COLLAPSING_TOOLBAR_TAB_BACKGROUND,
getDefaultColor(themeType, "#1565C0", "#242424", "#000000")); getDefaultColor("#1565C0", "#242424", "#000000"));
} }
public int getTabLayoutWithCollapsedCollapsingToolbarTextColor(int themeType) { public int getTabLayoutWithCollapsedCollapsingToolbarTextColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.TAB_LAYOUT_WITH_COLLAPSED_COLLAPSING_TOOLBAR_TEXT_COLOR, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.TAB_LAYOUT_WITH_COLLAPSED_COLLAPSING_TOOLBAR_TEXT_COLOR,
getDefaultColor(themeType, "#FFFFFF", "#FFFFFF", "#FFFFFF")); getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF"));
} }
public int getTabLayoutWithCollapsedCollapsingToolbarTabIndicator(int themeType) { public int getTabLayoutWithCollapsedCollapsingToolbarTabIndicator() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.TAB_LAYOUT_WITH_COLLAPSED_COLLAPSING_TOOLBAR_TAB_INDICATOR, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.TAB_LAYOUT_WITH_COLLAPSED_COLLAPSING_TOOLBAR_TAB_INDICATOR,
getDefaultColor(themeType, "#FFFFFF", "#FFFFFF", "#FFFFFF")); getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF"));
} }
public int getNavBarColor(int themeType) { public int getNavBarColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.NAV_BAR_COLOR, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.NAV_BAR_COLOR,
getDefaultColor(themeType, "#FFFFFF", "#121212", "#000000")); getDefaultColor("#FFFFFF", "#121212", "#000000"));
} }
public int getUpvoted(int themeType) { public int getUpvoted() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.UPVOTED, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.UPVOTED,
getDefaultColor(themeType, "#E91E63", "#E91E63", "#E91E63")); getDefaultColor("#E91E63", "#E91E63", "#E91E63"));
} }
public int getDownvoted(int themeType) { public int getDownvoted() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.DOWNVOTED, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.DOWNVOTED,
getDefaultColor(themeType, "#007DDE", "#007DDE", "#007DDE")); getDefaultColor("#007DDE", "#007DDE", "#007DDE"));
} }
public int getPostType(int themeType) { public int getPostTypeBackgroundColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.POST_TYPE, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.POST_TYPE_BACKGROUND_COLOR,
getDefaultColor(themeType, "#0D47A1", "#1565C0", "#1565C0")); getDefaultColor("#0D47A1", "#1565C0", "#1565C0"));
} }
public int getSpoilerColor(int themeType) { public int getPostTypeTextColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.SPOILER_COLOR, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.POST_TYPE_TEXT_COLOR,
getDefaultColor(themeType, "#EE02EB", "#EE02EB", "#EE02EB")); getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF"));
} }
public int getNsfwColor(int themeType) { public int getSpoilerBackgroundColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.NSFW_COLOR, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.SPOILER_BACKGROUND_COLOR,
getDefaultColor(themeType, "#FF4081", "#FF4081", "#FF4081")); getDefaultColor("#EE02EB", "#EE02EB", "#EE02EB"));
} }
public int getFlairColor(int themeType) { public int getSpoilerTextColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.FLAIR_COLOR, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.SPOILER_TEXT_COLOR,
getDefaultColor(themeType, "#00AA8C", "#00AA8C", "#00AA8C")); getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF"));
} }
public int getArchivedTint(int themeType) { public int getNsfwBackgroundColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.NSFW_BACKGROUND_COLOR,
getDefaultColor("#FF4081", "#FF4081", "#FF4081"));
}
public int getNsfwTextColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.NSFW_TEXT_COLOR,
getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF"));
}
public int getFlairBackgroundColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.FLAIR_BACKGROUND_COLOR,
getDefaultColor("#00AA8C", "#00AA8C", "#00AA8C"));
}
public int getFlairTextColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.FLAIR_TEXT_COLOR,
getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF"));
}
public int getArchivedTint() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.ARCHIVED_TINT, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.ARCHIVED_TINT,
getDefaultColor(themeType, "#B4009F", "#B4009F", "#B4009F")); getDefaultColor("#B4009F", "#B4009F", "#B4009F"));
} }
public int getLockedIconTint(int themeType) { public int getLockedIconTint() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.LOCKED_ICON_TINT, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.LOCKED_ICON_TINT,
getDefaultColor(themeType, "#EE7302", "#EE7302", "#EE7302")); getDefaultColor("#EE7302", "#EE7302", "#EE7302"));
} }
public int getCrosspost(int themeType) { public int getCrosspostIconTint() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.CROSSPOST, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.CROSSPOST_ICON_TINT,
getDefaultColor(themeType, "#FF4081", "#FF4081", "#FF4081")); getDefaultColor("#FF4081", "#FF4081", "#FF4081"));
} }
public int getStickiedPost(int themeType) { public int getStickiedPostIconTint() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.STICKIED_POST, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.STICKIED_POST_ICON_TINT,
getDefaultColor(themeType, "#0D47A1", "#1565C0", "#1565C0")); getDefaultColor("#0D47A1", "#1565C0", "#1565C0"));
} }
public int getSubscribed(int themeType) { public int getSubscribed() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.SUBSCRIBED, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.SUBSCRIBED,
getDefaultColor(themeType, "#FF4081", "#FF4081", "#FF4081")); getDefaultColor("#FF4081", "#FF4081", "#FF4081"));
} }
public int getUnsubscribed(int themeType) { public int getUnsubscribed() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.UNSUBSCRIBED, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.UNSUBSCRIBED,
getDefaultColor(themeType, "#0D47A1", "#1565C0", "#1565C0")); getDefaultColor("#0D47A1", "#1565C0", "#1565C0"));
} }
public int getUsername(int themeType) { public int getUsername() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.USERNAME, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.USERNAME,
getDefaultColor(themeType, "#0D47A1", "#1E88E5", "#1E88E5")); getDefaultColor("#0D47A1", "#1E88E5", "#1E88E5"));
} }
public int getSubreddit(int themeType) { public int getSubreddit() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.SUBREDDIT, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.SUBREDDIT,
getDefaultColor(themeType, "#E91E63", "#E91E63", "#E91E63")); getDefaultColor("#E91E63", "#E91E63", "#E91E63"));
} }
public int getAuthorFlairTextColor(int themeType) { public int getAuthorFlairTextColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.AUTHOR_FLAIR_TEXT_COLOR, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.AUTHOR_FLAIR_TEXT_COLOR,
getDefaultColor(themeType, "#EE02C4", "#EE02C4", "#EE02C4")); getDefaultColor("#EE02C4", "#EE02C4", "#EE02C4"));
} }
public int getSubmitter(int themeType) { public int getSubmitter() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.SUBMITTER, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.SUBMITTER,
getDefaultColor(themeType, "#EE8A02", "#EE8A02", "#EE8A02")); getDefaultColor("#EE8A02", "#EE8A02", "#EE8A02"));
} }
public int getModerator(int themeType) { public int getModerator() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.MODERATOR, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.MODERATOR,
getDefaultColor(themeType, "#00BA81", "#00BA81", "#00BA81")); getDefaultColor("#00BA81", "#00BA81", "#00BA81"));
} }
public int getNotificationIconColor(int themeType) { public int getNotificationIconColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.NOTIFICATION_ICON_COLOR, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.NOTIFICATION_ICON_COLOR,
getDefaultColor(themeType, "#1565C0", "#1565C0", "#1565C0")); getDefaultColor("#1565C0", "#1565C0", "#1565C0"));
} }
public int getSingleCommentThreadBackgroundColor(int themeType) { public int getSingleCommentThreadBackgroundColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.SINGLE_COMMENT_THREAD_BACKGROUND, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.SINGLE_COMMENT_THREAD_BACKGROUND,
getDefaultColor(themeType, "#B3E5F9", "#123E77", "#123E77")); getDefaultColor("#B3E5F9", "#123E77", "#123E77"));
} }
public int getUnreadMessageBackgroundColor(int themeType) { public int getUnreadMessageBackgroundColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.UNREAD_MESSAGE_BACKGROUND_COLOR, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.UNREAD_MESSAGE_BACKGROUND_COLOR,
getDefaultColor(themeType, "#B3E5F9", "#123E77", "#123E77")); getDefaultColor("#B3E5F9", "#123E77", "#123E77"));
} }
public int getDividerColor(int themeType) { public int getDividerColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.DIVIDER_COLOR, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.DIVIDER_COLOR,
getDefaultColor(themeType, "#E0E0E0", "#69666C", "#69666C")); getDefaultColor("#E0E0E0", "#69666C", "#69666C"));
} }
public int getNoPreviewLinkBackgroundColor(int themeType) { public int getNoPreviewLinkBackgroundColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.NO_PREVIEW_LINK_BACKGROUND_COLOR, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.NO_PREVIEW_LINK_BACKGROUND_COLOR,
getDefaultColor(themeType, "#E0E0E0", "#424242", "#424242")); getDefaultColor("#E0E0E0", "#424242", "#424242"));
} }
public int getVoteAndReplyUnavailableVoteButtonColor(int themeType) { public int getVoteAndReplyUnavailableVoteButtonColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.VOTE_AND_REPLY_UNAVAILABLE_VOTE_BUTTON_COLOR, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.VOTE_AND_REPLY_UNAVAILABLE_VOTE_BUTTON_COLOR,
getDefaultColor(themeType, "#F0F0F0", "#3C3C3C", "#3C3C3C")); getDefaultColor("#F0F0F0", "#3C3C3C", "#3C3C3C"));
} }
public int getCommentVerticalBarColor1(int themeType) { public int getCommentVerticalBarColor1() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_1, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_1,
getDefaultColor(themeType, "#1565C0", "#1565C0", "#1565C0")); getDefaultColor("#1565C0", "#1565C0", "#1565C0"));
} }
public int getCommentVerticalBarColor2(int themeType) { public int getCommentVerticalBarColor2() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_2, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_2,
getDefaultColor(themeType, "#EE02BE", "#C300B3", "#C300B3")); getDefaultColor("#EE02BE", "#C300B3", "#C300B3"));
} }
public int getCommentVerticalBarColor3(int themeType) { public int getCommentVerticalBarColor3() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_3, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_3,
getDefaultColor(themeType, "#02DFEE", "#00B8DA", "#00B8DA")); getDefaultColor("#02DFEE", "#00B8DA", "#00B8DA"));
} }
public int getCommentVerticalBarColor4(int themeType) { public int getCommentVerticalBarColor4() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_4, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_4,
getDefaultColor(themeType, "#EED502", "#EDCA00", "#EDCA00")); getDefaultColor("#EED502", "#EDCA00", "#EDCA00"));
} }
public int getCommentVerticalBarColor5(int themeType) { public int getCommentVerticalBarColor5() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_5, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_5,
getDefaultColor(themeType, "#EE0220", "#EE0219", "#EE0219")); getDefaultColor("#EE0220", "#EE0219", "#EE0219"));
} }
public int getCommentVerticalBarColor6(int themeType) { public int getCommentVerticalBarColor6() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_6, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_6,
getDefaultColor(themeType, "#02EE6E", "#00B925", "#00B925")); getDefaultColor("#02EE6E", "#00B925", "#00B925"));
} }
public int getCommentVerticalBarColor7(int themeType) { public int getCommentVerticalBarColor7() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_7, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_7,
getDefaultColor(themeType, "#EE4602", "#EE4602", "#EE4602")); getDefaultColor("#EE4602", "#EE4602", "#EE4602"));
} }
public int getFABIconColor(int themeType) { public int getFABIconColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.FAB_ICON_COLOR, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.FAB_ICON_COLOR,
getDefaultColor(themeType, "#1565C0", "#1565C0", "#1565C0")); getDefaultColor("#1565C0", "#1565C0", "#1565C0"));
} }
public int getChipTextColor(int themeType) { public int getChipTextColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.CHIP_TEXT_COLOR, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.CHIP_TEXT_COLOR,
getDefaultColor(themeType, "#FFFFFF", "#FFFFFF", "#FFFFFF")); getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF"));
} }
} }

View File

@ -246,10 +246,9 @@ public class CommentsListingFragment extends Fragment implements FragmentCommuni
@Override @Override
public void applyTheme() { public void applyTheme() {
int themeType = customThemeWrapper.getThemeType(); mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(customThemeWrapper.getCircularProgressBarBackground());
mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(customThemeWrapper.getCardViewBackgroundColor(themeType)); mSwipeRefreshLayout.setColorSchemeColors(customThemeWrapper.getColorAccent());
mSwipeRefreshLayout.setColorSchemeColors(customThemeWrapper.getColorAccent(themeType)); mFetchCommentInfoTextView.setTextColor(customThemeWrapper.getSecondaryTextColor());
mFetchCommentInfoTextView.setTextColor(customThemeWrapper.getSecondaryTextColor(themeType));
} }
private void showErrorView(int stringResId) { private void showErrorView(int stringResId) {

View File

@ -153,14 +153,13 @@ public class FollowedUsersListingFragment extends Fragment implements FragmentCo
@Override @Override
public void applyTheme() { public void applyTheme() {
int themeType = customThemeWrapper.getThemeType();
if (mActivity instanceof SubscribedThingListingActivity) { if (mActivity instanceof SubscribedThingListingActivity) {
mSwipeRefreshLayout.setOnRefreshListener(() -> ((SubscribedThingListingActivity) mActivity).loadSubscriptions(true)); mSwipeRefreshLayout.setOnRefreshListener(() -> ((SubscribedThingListingActivity) mActivity).loadSubscriptions(true));
mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(customThemeWrapper.getCardViewBackgroundColor(themeType)); mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(customThemeWrapper.getCircularProgressBarBackground());
mSwipeRefreshLayout.setColorSchemeColors(customThemeWrapper.getColorAccent(themeType)); mSwipeRefreshLayout.setColorSchemeColors(customThemeWrapper.getColorAccent());
} else { } else {
mSwipeRefreshLayout.setEnabled(false); mSwipeRefreshLayout.setEnabled(false);
} }
mErrorTextView.setTextColor(customThemeWrapper.getSecondaryTextColor(themeType)); mErrorTextView.setTextColor(customThemeWrapper.getSecondaryTextColor());
} }
} }

View File

@ -11,7 +11,6 @@ import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.CountDownTimer; import android.os.CountDownTimer;
import android.os.Handler; import android.os.Handler;
import android.util.Log;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -72,7 +71,6 @@ import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
import ml.docilealligator.infinityforreddit.SortType; import ml.docilealligator.infinityforreddit.SortType;
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
import ml.docilealligator.infinityforreddit.Utils.Utils;
import retrofit2.Retrofit; import retrofit2.Retrofit;
@ -731,10 +729,9 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
@Override @Override
public void applyTheme() { public void applyTheme() {
int themeType = customThemeWrapper.getThemeType(); mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(customThemeWrapper.getCircularProgressBarBackground());
mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(customThemeWrapper.getCardViewBackgroundColor(themeType)); mSwipeRefreshLayout.setColorSchemeColors(customThemeWrapper.getColorAccent());
mSwipeRefreshLayout.setColorSchemeColors(customThemeWrapper.getColorAccent(themeType)); mFetchPostInfoTextView.setTextColor(customThemeWrapper.getSecondaryTextColor());
mFetchPostInfoTextView.setTextColor(customThemeWrapper.getSecondaryTextColor(themeType));
} }
@Subscribe @Subscribe

View File

@ -214,9 +214,8 @@ public class SubredditListingFragment extends Fragment implements FragmentCommun
@Override @Override
public void applyTheme() { public void applyTheme() {
int themeType = customThemeWrapper.getThemeType(); mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(customThemeWrapper.getCircularProgressBarBackground());
mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(customThemeWrapper.getCardViewBackgroundColor(themeType)); mSwipeRefreshLayout.setColorSchemeColors(customThemeWrapper.getColorAccent());
mSwipeRefreshLayout.setColorSchemeColors(customThemeWrapper.getColorAccent(themeType)); mFetchSubredditListingInfoTextView.setTextColor(customThemeWrapper.getSecondaryTextColor());
mFetchSubredditListingInfoTextView.setTextColor(customThemeWrapper.getSecondaryTextColor(themeType));
} }
} }

View File

@ -171,10 +171,9 @@ public class SubscribedSubredditsListingFragment extends Fragment implements Fra
public void applyTheme() { public void applyTheme() {
if (mActivity instanceof SubscribedThingListingActivity) { if (mActivity instanceof SubscribedThingListingActivity) {
mSwipeRefreshLayout.setOnRefreshListener(() -> ((SubscribedThingListingActivity) mActivity).loadSubscriptions(true)); mSwipeRefreshLayout.setOnRefreshListener(() -> ((SubscribedThingListingActivity) mActivity).loadSubscriptions(true));
int themeType = customThemeWrapper.getThemeType(); mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(customThemeWrapper.getCircularProgressBarBackground());
mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(customThemeWrapper.getCardViewBackgroundColor(themeType)); mSwipeRefreshLayout.setColorSchemeColors(customThemeWrapper.getColorAccent());
mSwipeRefreshLayout.setColorSchemeColors(customThemeWrapper.getColorAccent(themeType)); mErrorTextView.setTextColor(customThemeWrapper.getSecondaryTextColor());
mErrorTextView.setTextColor(customThemeWrapper.getSecondaryTextColor(themeType));
} else { } else {
mSwipeRefreshLayout.setEnabled(false); mSwipeRefreshLayout.setEnabled(false);
} }

View File

@ -194,9 +194,8 @@ public class UserListingFragment extends Fragment implements FragmentCommunicato
@Override @Override
public void applyTheme() { public void applyTheme() {
int themeType = customThemeWrapper.getThemeType(); mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(customThemeWrapper.getCircularProgressBarBackground());
mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(customThemeWrapper.getCardViewBackgroundColor(themeType)); mSwipeRefreshLayout.setColorSchemeColors(customThemeWrapper.getColorAccent());
mSwipeRefreshLayout.setColorSchemeColors(customThemeWrapper.getColorAccent(themeType)); mFetchUserListingInfoTextView.setTextColor(customThemeWrapper.getSecondaryTextColor());
mFetchUserListingInfoTextView.setTextColor(customThemeWrapper.getSecondaryTextColor(themeType));
} }
} }

View File

@ -63,7 +63,7 @@ public class PullNotificationWorker extends Worker {
public Result doWork() { public Result doWork() {
try { try {
List<Account> accounts = mRedditDataRoomDatabase.accountDao().getAllAccounts(); List<Account> accounts = mRedditDataRoomDatabase.accountDao().getAllAccounts();
int color = mCustomThemeWrapper.getNotificationIconColor(mCustomThemeWrapper.getThemeType()); int color = mCustomThemeWrapper.getNotificationIconColor();
for (int accountIndex = 0; accountIndex < accounts.size(); accountIndex++) { for (int accountIndex = 0; accountIndex < accounts.size(); accountIndex++) {
Account account = accounts.get(accountIndex); Account account = accounts.get(accountIndex);

View File

@ -130,7 +130,7 @@ public class SubmitPostService extends Service {
.setContentTitle(getString(stringResId)) .setContentTitle(getString(stringResId))
.setContentText(getString(R.string.please_wait)) .setContentText(getString(R.string.please_wait))
.setSmallIcon(R.drawable.ic_notification) .setSmallIcon(R.drawable.ic_notification)
.setColor(mCustomThemeWrapper.getNotificationIconColor(mCustomThemeWrapper.getThemeType())) .setColor(mCustomThemeWrapper.getNotificationIconColor())
.build(); .build();
} }

View File

@ -16,13 +16,18 @@ import androidx.preference.SwitchPreference;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import javax.inject.Inject;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.Event.ChangeDefaultPostLayoutEvent; import ml.docilealligator.infinityforreddit.Event.ChangeDefaultPostLayoutEvent;
import ml.docilealligator.infinityforreddit.Event.ChangeShowAbsoluteNumberOfVotesEvent; import ml.docilealligator.infinityforreddit.Event.ChangeShowAbsoluteNumberOfVotesEvent;
import ml.docilealligator.infinityforreddit.Event.ChangeShowElapsedTimeEvent; import ml.docilealligator.infinityforreddit.Event.ChangeShowElapsedTimeEvent;
import ml.docilealligator.infinityforreddit.Event.ChangeVoteButtonsPositionEvent; import ml.docilealligator.infinityforreddit.Event.ChangeVoteButtonsPositionEvent;
import ml.docilealligator.infinityforreddit.Event.RecreateActivityEvent; import ml.docilealligator.infinityforreddit.Event.RecreateActivityEvent;
import ml.docilealligator.infinityforreddit.Event.ShowDividerInCompactLayoutPreferenceEvent; import ml.docilealligator.infinityforreddit.Event.ShowDividerInCompactLayoutPreferenceEvent;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.Utils.CustomThemeSharedPreferencesUtils;
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY; import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
@ -36,11 +41,15 @@ import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
public class InterfacePreferenceFragment extends PreferenceFragmentCompat { public class InterfacePreferenceFragment extends PreferenceFragmentCompat {
private Activity activity; private Activity activity;
@Inject
CustomThemeWrapper customThemeWrapper;
@Override @Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
setPreferencesFromResource(R.xml.interface_preference, rootKey); setPreferencesFromResource(R.xml.interface_preference, rootKey);
((Infinity) activity.getApplication()).getAppComponent().inject(this);
ListPreference themePreference = findPreference(SharedPreferencesUtils.THEME_KEY); ListPreference themePreference = findPreference(SharedPreferencesUtils.THEME_KEY);
SwitchPreference amoledDarkSwitch = findPreference(SharedPreferencesUtils.AMOLED_DARK_KEY); SwitchPreference amoledDarkSwitch = findPreference(SharedPreferencesUtils.AMOLED_DARK_KEY);
SwitchPreference immersiveInterfaceSwitch = findPreference(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY); SwitchPreference immersiveInterfaceSwitch = findPreference(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY);
@ -53,7 +62,7 @@ public class InterfacePreferenceFragment extends PreferenceFragmentCompat {
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q; boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
if (themePreference != null) { if (themePreference != null && amoledDarkSwitch != null) {
if (systemDefault) { if (systemDefault) {
themePreference.setEntries(R.array.settings_theme_q); themePreference.setEntries(R.array.settings_theme_q);
} else { } else {
@ -65,9 +74,15 @@ public class InterfacePreferenceFragment extends PreferenceFragmentCompat {
switch (option) { switch (option) {
case 0: case 0:
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO); AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.NORMAL);
break; break;
case 1: case 1:
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES); AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
if (amoledDarkSwitch.isChecked()) {
customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.AMOLED_DARK);
} else {
customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.DARK);
}
break; break;
case 2: case 2:
if (systemDefault) { if (systemDefault) {
@ -75,6 +90,16 @@ public class InterfacePreferenceFragment extends PreferenceFragmentCompat {
} else { } else {
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY); AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
} }
if((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_NO) {
customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.NORMAL);
} else {
if (amoledDarkSwitch.isChecked()) {
customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.AMOLED_DARK);
} else {
customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.DARK);
}
}
} }
return true; return true;
}); });

View File

@ -4,8 +4,9 @@ public class CustomThemeSharedPreferencesUtils {
public static final int NORMAL = 0; public static final int NORMAL = 0;
public static final int DARK = 1; public static final int DARK = 1;
public static final int AMOLED_DARK = 2; public static final int AMOLED_DARK = 2;
public static final String THEME_TYPE_KEY = "theme_type";
public static final String THEME_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.theme"; public static final String THEME_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.theme";
public static final String LIGHT_STATUS_BAR = "lightStatusBar";
public static final String LIGHT_NAV_BAR = "lightNavBar";
public static final String COLOR_PRIMARY = "colorPrimary"; public static final String COLOR_PRIMARY = "colorPrimary";
public static final String COLOR_PRIMARY_DARK = "colorPrimaryDark"; public static final String COLOR_PRIMARY_DARK = "colorPrimaryDark";
public static final String COLOR_ACCENT = "colorAccent"; public static final String COLOR_ACCENT = "colorAccent";
@ -16,9 +17,7 @@ public class CustomThemeSharedPreferencesUtils {
public static final String PRIMARY_TEXT_COLOR = "primaryTextColor"; public static final String PRIMARY_TEXT_COLOR = "primaryTextColor";
public static final String SECONDARY_TEXT_COLOR = "secondaryTextColor"; public static final String SECONDARY_TEXT_COLOR = "secondaryTextColor";
public static final String BUTTON_TEXT_COLOR = "buttonTextColor"; public static final String BUTTON_TEXT_COLOR = "buttonTextColor";
public static final String BUTTON_BACKGROUND_TINT = "buttonBackgroundTint";
public static final String BACKGROUND_COLOR = "backgroundColor"; public static final String BACKGROUND_COLOR = "backgroundColor";
public static final String ROUNDED_BOTTOM_SHEET_PRIMARY_BACKGROUND = "roundedBottomSheetPrimaryBackground";
public static final String CARD_VIEW_BACKGROUND_COLOR = "cardViewBackgroundColor"; public static final String CARD_VIEW_BACKGROUND_COLOR = "cardViewBackgroundColor";
public static final String COMMENT_BACKGROUND_COLOR = "commentBackgroundColor"; public static final String COMMENT_BACKGROUND_COLOR = "commentBackgroundColor";
public static final String TOOLBAR_PRIMARY_TEXT_AND_ICON_COLOR = "toolbarPrimaryTextAndIconColor"; public static final String TOOLBAR_PRIMARY_TEXT_AND_ICON_COLOR = "toolbarPrimaryTextAndIconColor";
@ -33,14 +32,18 @@ public class CustomThemeSharedPreferencesUtils {
public static final String NAV_BAR_COLOR = "navBarColor"; public static final String NAV_BAR_COLOR = "navBarColor";
public static final String UPVOTED = "upvoted"; public static final String UPVOTED = "upvoted";
public static final String DOWNVOTED = "downvoted"; public static final String DOWNVOTED = "downvoted";
public static final String POST_TYPE = "postType"; public static final String POST_TYPE_BACKGROUND_COLOR = "postTypeBackgroundColor";
public static final String SPOILER_COLOR = "spoilerColor"; public static final String POST_TYPE_TEXT_COLOR = "postTypeTextColor";
public static final String NSFW_COLOR = "nsfwColor"; public static final String SPOILER_BACKGROUND_COLOR = "spoilerBackgroundColor";
public static final String FLAIR_COLOR = "flairColor"; public static final String SPOILER_TEXT_COLOR = "spoilerTextColor";
public static final String NSFW_BACKGROUND_COLOR = "nsfwBackgroundColor";
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 ARCHIVED_TINT = "archivedTint"; public static final String ARCHIVED_TINT = "archivedTint";
public static final String LOCKED_ICON_TINT = "lockedIconTint"; public static final String LOCKED_ICON_TINT = "lockedIconTint";
public static final String CROSSPOST = "crosspost"; public static final String CROSSPOST_ICON_TINT = "crosspostIconTint";
public static final String STICKIED_POST = "stickiedPost"; public static final String STICKIED_POST_ICON_TINT = "stickiedPost";
public static final String SUBSCRIBED = "subscribed"; public static final String SUBSCRIBED = "subscribed";
public static final String UNSUBSCRIBED = "unsubscribed"; public static final String UNSUBSCRIBED = "unsubscribed";
public static final String USERNAME = "username"; public static final String USERNAME = "username";

View File

@ -73,10 +73,4 @@ public class Utils {
return String.format(Locale.US, "%.1f", (float) votes / 1000) + "K"; return String.format(Locale.US, "%.1f", (float) votes / 1000) + "K";
} }
} }
/*public static int getAttributeColor(Context context, int attrId) {
TypedValue typedValue = new TypedValue();
context.getTheme().resolveAttribute(attrId, typedValue, true);
return typedValue.data;
}*/
} }

View File

@ -171,7 +171,7 @@
android:id="@+id/capture_fab_post_image_activity" android:id="@+id/capture_fab_post_image_activity"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/ic_outline_add_a_photo_24px" android:src="@drawable/ic_outline_add_a_photo_24dp"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@ -184,7 +184,7 @@
android:id="@+id/select_from_library_fab_post_image_activity" android:id="@+id/select_from_library_fab_post_image_activity"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/ic_outline_select_photo_24px" android:src="@drawable/ic_outline_select_photo_24dp"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/capture_fab_post_image_activity" app:layout_constraintStart_toEndOf="@+id/capture_fab_post_image_activity"

View File

@ -171,7 +171,7 @@
android:id="@+id/capture_fab_post_video_activity" android:id="@+id/capture_fab_post_video_activity"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/ic_outline_add_a_photo_24px" android:src="@drawable/ic_outline_add_a_photo_24dp"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@ -184,7 +184,7 @@
android:id="@+id/select_from_library_fab_post_video_activity" android:id="@+id/select_from_library_fab_post_video_activity"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/ic_outline_select_photo_24px" android:src="@drawable/ic_outline_select_photo_24dp"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/capture_fab_post_video_activity" app:layout_constraintStart_toEndOf="@+id/capture_fab_post_video_activity"

View File

@ -108,7 +108,7 @@
<style name="FontStyle" /> <style name="FontStyle" />
<style name="FontStyle.Small"> <style name="FontStyle.Small" parent="TextAppearance.AppCompat.Body1">
<item name="font_default">12sp</item> <item name="font_default">12sp</item>
<item name="font_10">10sp</item> <item name="font_10">10sp</item>
<item name="font_12">12sp</item> <item name="font_12">12sp</item>