diff options
Diffstat (limited to 'app')
61 files changed, 738 insertions, 671 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountPostsActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountPostsActivity.java index 721fddfb..6a8aa025 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountPostsActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountPostsActivity.java @@ -156,9 +156,8 @@ public class AccountPostsActivity extends BaseActivity implements SortTypeSelect @Override protected void applyCustomTheme() { - int themeType = mCustomThemeWrapper.getThemeType(); - coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); - appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); + coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor()); } private void getCurrentAccountAndInitializeFragment() { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountSavedThingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountSavedThingActivity.java index 0606920c..a89a451a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountSavedThingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountSavedThingActivity.java @@ -155,10 +155,9 @@ public class AccountSavedThingActivity extends BaseActivity { @Override protected void applyCustomTheme() { - int themeType = mCustomThemeWrapper.getThemeType(); - coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); - appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); - applyTabLayoutTheme(tabLayout, mCustomThemeWrapper, themeType); + coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor()); + applyTabLayoutTheme(tabLayout); } private void getCurrentAccountAndInitializeViewPager() { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java index 86a73107..7cdec427 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java @@ -4,6 +4,9 @@ import android.content.SharedPreferences; import android.content.res.ColorStateList; import android.content.res.Configuration; import android.content.res.Resources; +import android.graphics.Color; +import android.graphics.PorterDuff; +import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Bundle; import android.view.View; @@ -25,6 +28,7 @@ import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.FontStyle; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.TitleFontStyle; +import ml.docilealligator.infinityforreddit.Utils.CustomThemeSharedPreferencesUtils; import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; 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 { private boolean immersiveInterface; - private boolean lightStatusbar; private boolean changeStatusBarIconColor = true; private boolean transparentStatusBarAfterToolbarCollapsed; - private int systemVisibilityToolbarExpanded; - private int systemVisibilityToolbarCollapsed; + private int systemVisibilityToolbarExpanded = 0; + private int systemVisibilityToolbarCollapsed = 0; + private CustomThemeWrapper customThemeWrapper; @Override 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")); immersiveInterface = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && mSharedPreferences.getBoolean(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY, true); + customThemeWrapper = getCustomThemeWrapper(); switch (systemThemeType) { case 0: AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO); getTheme().applyStyle(R.style.Theme_Purple, true); changeStatusBarIconColor = immersiveInterface; + customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.NORMAL); break; case 1: AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES); if(mSharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) { getTheme().applyStyle(R.style.Theme_Default_AmoledDark, true); + customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.AMOLED_DARK); } else { getTheme().applyStyle(R.style.Theme_Default_NormalDark, true); + customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.DARK); } changeStatusBarIconColor = false; 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) { getTheme().applyStyle(R.style.Theme_Purple, true); changeStatusBarIconColor = immersiveInterface; + customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.NORMAL); } else { if(mSharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) { getTheme().applyStyle(R.style.Theme_Default_AmoledDark, true); + customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.AMOLED_DARK); } else { getTheme().applyStyle(R.style.Theme_Default_NormalDark, true); + customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.DARK); } changeStatusBarIconColor = false; } @@ -92,33 +103,49 @@ public abstract class BaseActivity extends AppCompatActivity { getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences .getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true); - CustomThemeWrapper customThemeWrapper = getCustomThemeWrapper(); - int themeType = customThemeWrapper.getThemeType(); Window window = getWindow(); 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 (lightStatusbar) { - decorView.setSystemUiVisibility(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) { - systemVisibilityToolbarCollapsed = View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR; + if (isLightStatusbar) { + if (isLightNavBar) { + systemVisibilityToolbarExpanded = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR; + if (changeStatusBarIconColor) { + 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 { - decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR); - systemVisibilityToolbarExpanded = View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR; - if (changeStatusBarIconColor) { - systemVisibilityToolbarCollapsed = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR; + if (isLightNavBar) { + systemVisibilityToolbarExpanded = View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR; + if (changeStatusBarIconColor) { + 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) { - if (lightStatusbar) { + if (isLightStatusbar) { decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); systemVisibilityToolbarExpanded = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; - } - if (changeStatusBarIconColor) { - systemVisibilityToolbarCollapsed = 0; + if (!changeStatusBarIconColor) { + systemVisibilityToolbarCollapsed = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; + } + } else if (changeStatusBarIconColor) { + systemVisibilityToolbarCollapsed = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; } } } @@ -181,20 +208,26 @@ public abstract class BaseActivity extends AppCompatActivity { this.transparentStatusBarAfterToolbarCollapsed = true; } - protected void applyTabLayoutTheme(TabLayout tabLayout, CustomThemeWrapper customThemeWrapper, int themeType) { - int toolbarAndTabBackgroundColor = customThemeWrapper.getToolbarAndTabBackgroundColor(themeType); + protected void applyToolbarTheme(Toolbar toolbar) { + toolbar.setTitleTextColor(customThemeWrapper.getToolbarPrimaryTextAndIconColor()); + } + + protected void applyTabLayoutTheme(TabLayout tabLayout) { + int toolbarAndTabBackgroundColor = customThemeWrapper.getToolbarAndTabBackgroundColor(); tabLayout.setBackgroundColor(toolbarAndTabBackgroundColor); - tabLayout.setSelectedTabIndicatorColor(customThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTabIndicator(themeType)); - tabLayout.setTabTextColors(customThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTextColor(themeType), - customThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTextColor(themeType)); + tabLayout.setSelectedTabIndicatorColor(customThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTabIndicator()); + tabLayout.setTabTextColors(customThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTextColor(), + customThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTextColor()); } - protected void applyFABTheme(FloatingActionButton fab, CustomThemeWrapper customThemeWrapper, int themeType) { - fab.setBackgroundTintList(ColorStateList.valueOf(customThemeWrapper.getColorPrimaryLightTheme(themeType))); - fab.setImageTintList(ColorStateList.valueOf(customThemeWrapper.getFABIconColor(themeType))); - /*Drawable myFabSrc = getResources().getDrawable(R.drawable.ic_add_bottom_app_bar_24dp); - Drawable willBeWhite = myFabSrc.getConstantState().newDrawable(); - willBeWhite.mutate().setColorFilter(Color.WHITE, PorterDuff.Mode.MULTIPLY); - 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); + } } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CommentActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CommentActivity.java index 27c2695e..515fe2b3 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CommentActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CommentActivity.java @@ -232,13 +232,12 @@ public class CommentActivity extends BaseActivity { @Override protected void applyCustomTheme() { - int themeType = mCustomThemeWrapper.getThemeType(); - coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); - appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); - commentParentMarkwonView.setTextColor(mCustomThemeWrapper.getCommentColor(themeType)); - divider.setBackgroundColor(mCustomThemeWrapper.getDividerColor(themeType)); - commentEditText.setTextColor(mCustomThemeWrapper.getCommentColor(themeType)); - markdownColor = mCustomThemeWrapper.getSecondaryTextColor(themeType); + coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor()); + commentParentMarkwonView.setTextColor(mCustomThemeWrapper.getCommentColor()); + divider.setBackgroundColor(mCustomThemeWrapper.getDividerColor()); + commentEditText.setTextColor(mCustomThemeWrapper.getCommentColor()); + markdownColor = mCustomThemeWrapper.getSecondaryTextColor(); } private void getCurrentAccount() { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CreateMultiRedditActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CreateMultiRedditActivity.java index 464e69af..1f5f39a4 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CreateMultiRedditActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CreateMultiRedditActivity.java @@ -244,11 +244,10 @@ public class CreateMultiRedditActivity extends BaseActivity { @Override protected void applyCustomTheme() { - int themeType = mCustomThemeWrapper.getThemeType(); - appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); - int primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor(themeType); + appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor()); + int primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor(); nameEditText.setTextColor(primaryTextColor); - int dividerColor = mCustomThemeWrapper.getDividerColor(themeType); + int dividerColor = mCustomThemeWrapper.getDividerColor(); divider1.setBackgroundColor(dividerColor); divider2.setBackgroundColor(dividerColor); descriptionEditText.setTextColor(primaryTextColor); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditCommentActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditCommentActivity.java index de67e642..abcc5382 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditCommentActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditCommentActivity.java @@ -118,10 +118,9 @@ public class EditCommentActivity extends BaseActivity { @Override protected void applyCustomTheme() { - int themeType = mCustomThemeWrapper.getThemeType(); - coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); - appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); - contentEditText.setTextColor(mCustomThemeWrapper.getCommentColor(themeType)); + coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor()); + contentEditText.setTextColor(mCustomThemeWrapper.getCommentColor()); } @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditPostActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditPostActivity.java index cd9ac208..a86d72ff 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditPostActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditPostActivity.java @@ -121,12 +121,11 @@ public class EditPostActivity extends BaseActivity { @Override protected void applyCustomTheme() { - int themeType = mCustomThemeWrapper.getThemeType(); - coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); - appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); - titleTextView.setTextColor(mCustomThemeWrapper.getPostTitleColor(themeType)); - divider.setBackgroundColor(mCustomThemeWrapper.getPostTitleColor(themeType)); - contentEditText.setTextColor(mCustomThemeWrapper.getPostContentColor(themeType)); + coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor()); + titleTextView.setTextColor(mCustomThemeWrapper.getPostTitleColor()); + divider.setBackgroundColor(mCustomThemeWrapper.getPostTitleColor()); + contentEditText.setTextColor(mCustomThemeWrapper.getPostContentColor()); } @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/FilteredThingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/FilteredThingActivity.java index 791fbb9c..995a3227 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/FilteredThingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/FilteredThingActivity.java @@ -175,9 +175,8 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec @Override protected void applyCustomTheme() { - int themeType = mCustomThemeWrapper.getThemeType(); - coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); - appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); + coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor()); } private void getCurrentAccountAndBindView(int filter) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java index 4dd5afb7..2cd62f20 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java @@ -6,12 +6,10 @@ import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.net.Uri; -import android.os.Build; import android.os.Bundle; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.app.AppCompatDelegate; import androidx.browser.customtabs.CustomTabsIntent; import java.util.ArrayList; @@ -25,10 +23,6 @@ import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; 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; public class LinkResolverActivity extends AppCompatActivity { @@ -60,24 +54,6 @@ public class LinkResolverActivity extends AppCompatActivity { ((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(); if (uri == null) { 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(); // add share action to menu list builder.addDefaultShareMenuItem(); - builder.setToolbarColor(mCustomThemeWrapper.getColorPrimary(mCustomThemeWrapper.getThemeType())); + builder.setToolbarColor(mCustomThemeWrapper.getColorPrimary()); CustomTabsIntent customTabsIntent = builder.build(); customTabsIntent.intent.setPackage(resolveInfos.get(0).activityInfo.packageName); if (uri.getScheme() == null) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LoginActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LoginActivity.java index a6d7eaad..e750359d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LoginActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LoginActivity.java @@ -222,9 +222,8 @@ public class LoginActivity extends BaseActivity { @Override protected void applyCustomTheme() { - int themeType = mCustomThemeWrapper.getThemeType(); - coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); - appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); + coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor()); } @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java index 5ae60914..03a489d5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java @@ -3,6 +3,7 @@ package ml.docilealligator.infinityforreddit.Activity; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; +import android.content.res.ColorStateList; import android.os.Build; import android.os.Bundle; 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.SubscribedSubredditViewModel; import ml.docilealligator.infinityforreddit.SubscribedUserDatabase.SubscribedUserData; +import ml.docilealligator.infinityforreddit.Utils.CustomThemeSharedPreferencesUtils; import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; import retrofit2.Retrofit; @@ -288,14 +290,13 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb @Override protected void applyCustomTheme() { - int themeType = mCustomThemeWrapper.getThemeType(); - int backgroundColor = mCustomThemeWrapper.getBackgroundColor(themeType); + int backgroundColor = mCustomThemeWrapper.getBackgroundColor(); drawer.setBackgroundColor(backgroundColor); navigationView.setBackgroundColor(backgroundColor); - appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); - applyTabLayoutTheme(tabLayout, mCustomThemeWrapper, themeType); - bottomNavigationView.setBackgroundColor(backgroundColor); - applyFABTheme(fab, mCustomThemeWrapper, themeType); + appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor()); + applyTabLayoutTheme(tabLayout); + bottomNavigationView.setBackgroundTint(ColorStateList.valueOf(backgroundColor)); + applyFABTheme(fab, R.drawable.ic_add_bottom_app_bar_24dp); } private void getCurrentAccountAndBindView() { @@ -486,14 +487,17 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb mSharedPreferences.edit().putString(SharedPreferencesUtils.THEME_KEY, "0").apply(); AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO); getTheme().applyStyle(R.style.Theme_Default, true); + mCustomThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.NORMAL); break; case R.string.dark_theme: mSharedPreferences.edit().putString(SharedPreferencesUtils.THEME_KEY, "1").apply(); AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES); if (mSharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) { getTheme().applyStyle(R.style.Theme_Default_AmoledDark, true); + mCustomThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.AMOLED_DARK); } else { getTheme().applyStyle(R.style.Theme_Default_NormalDark, true); + mCustomThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.DARK); } break; case R.string.enable_nsfw: diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MultiRedditListingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MultiRedditListingActivity.java index 90a66e8a..8d5ce877 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MultiRedditListingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MultiRedditListingActivity.java @@ -253,12 +253,11 @@ public class MultiRedditListingActivity extends BaseActivity { @Override protected void applyCustomTheme() { - int themeType = mCustomThemeWrapper.getThemeType(); - mCoordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); - mAppBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); - mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(mCustomThemeWrapper.getCardViewBackgroundColor(themeType)); - mSwipeRefreshLayout.setColorSchemeColors(mCustomThemeWrapper.getColorAccent(themeType)); - mErrorTextView.setTextColor(mCustomThemeWrapper.getSecondaryTextColor(themeType)); - applyFABTheme(fab, mCustomThemeWrapper, themeType); + mCoordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + mAppBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor()); + mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(mCustomThemeWrapper.getCircularProgressBarBackground()); + mSwipeRefreshLayout.setColorSchemeColors(mCustomThemeWrapper.getColorAccent()); + mErrorTextView.setTextColor(mCustomThemeWrapper.getSecondaryTextColor()); + applyFABTheme(fab, R.drawable.ic_add_bottom_app_bar_24dp); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostImageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostImageActivity.java index e37a0269..ebb0760f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostImageActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostImageActivity.java @@ -144,9 +144,12 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF private boolean isPosting; private Uri imageUri; private int primaryTextColor; - private int flairColor; - private int spoilerColor; - private int nsfwColor; + private int flairBackgroundColor; + private int flairTextColor; + private int spoilerBackgroundColor; + private int spoilerTextColor; + private int nsfwBackgroundColor; + private int nsfwTextColor; private Flair flair; private boolean isSpoiler = false; private boolean isNSFW = false; @@ -223,16 +226,19 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF if (flair != null) { flairTextView.setText(flair.getText()); - flairTextView.setBackgroundColor(flairColor); - flairTextView.setBorderColor(flairColor); + flairTextView.setBackgroundColor(flairBackgroundColor); + flairTextView.setBorderColor(flairBackgroundColor); + flairTextView.setTextColor(flairTextColor); } if (isSpoiler) { - spoilerTextView.setBackgroundColor(spoilerColor); - spoilerTextView.setBorderColor(spoilerColor); + spoilerTextView.setBackgroundColor(spoilerBackgroundColor); + spoilerTextView.setBorderColor(spoilerBackgroundColor); + spoilerTextView.setTextColor(spoilerTextColor); } if (isNSFW) { - nsfwTextView.setBackgroundColor(nsfwColor); - nsfwTextView.setBorderColor(nsfwColor); + nsfwTextView.setBackgroundColor(nsfwBackgroundColor); + nsfwTextView.setBorderColor(nsfwBackgroundColor); + nsfwTextView.setTextColor(nsfwTextColor); } } else { getCurrentAccount(); @@ -292,6 +298,7 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF flairSelectionBottomSheetFragment.show(getSupportFragmentManager(), flairSelectionBottomSheetFragment.getTag()); } else { flairTextView.setBackgroundColor(resources.getColor(android.R.color.transparent)); + flairTextView.setTextColor(primaryTextColor); flairTextView.setText(getString(R.string.flair)); flair = null; } @@ -299,22 +306,26 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF spoilerTextView.setOnClickListener(view -> { if (!isSpoiler) { - spoilerTextView.setBackgroundColor(spoilerColor); - spoilerTextView.setBorderColor(spoilerColor); + spoilerTextView.setBackgroundColor(spoilerBackgroundColor); + spoilerTextView.setBorderColor(spoilerBackgroundColor); + spoilerTextView.setTextColor(spoilerTextColor); isSpoiler = true; } else { spoilerTextView.setBackgroundColor(resources.getColor(android.R.color.transparent)); + spoilerTextView.setTextColor(primaryTextColor); isSpoiler = false; } }); nsfwTextView.setOnClickListener(view -> { if (!isNSFW) { - nsfwTextView.setBackgroundColor(nsfwColor); - nsfwTextView.setBorderColor(nsfwColor); + nsfwTextView.setBackgroundColor(nsfwBackgroundColor); + nsfwTextView.setBorderColor(nsfwBackgroundColor); + nsfwTextView.setTextColor(nsfwTextColor); isNSFW = true; } else { nsfwTextView.setBackgroundColor(resources.getColor(android.R.color.transparent)); + nsfwTextView.setTextColor(primaryTextColor); isNSFW = false; } }); @@ -363,35 +374,25 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF @Override protected void applyCustomTheme() { - int themeType = mCustomThemeWrapper.getThemeType(); - coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); - appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); - rulesButton.setTextColor(mCustomThemeWrapper.getButtonTextColor(themeType)); - rulesButton.setBackgroundTintList(ColorStateList.valueOf(mCustomThemeWrapper.getColorPrimaryLightTheme(themeType))); - int dividerColor = mCustomThemeWrapper.getDividerColor(themeType); + coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor()); + rulesButton.setTextColor(mCustomThemeWrapper.getButtonTextColor()); + rulesButton.setBackgroundTintList(ColorStateList.valueOf(mCustomThemeWrapper.getColorPrimaryLightTheme())); + int dividerColor = mCustomThemeWrapper.getDividerColor(); divider1.setBackgroundColor(dividerColor); divider2.setBackgroundColor(dividerColor); divider3.setBackgroundColor(dividerColor); - /*int flairColor = mCustomThemeWrapper.getFlairColor(themeType); - flairTextView.setBackgroundColor(flairColor); - flairTextView.setBorderColor(flairColor); - flairTextView.setTextColor(primaryTextColor); - int spoilerColor = mCustomThemeWrapper.getSpoilerColor(themeType); - spoilerTextView.setBackgroundColor(spoilerColor); - spoilerTextView.setBorderColor(spoilerColor); - 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); + primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor(); + flairBackgroundColor = mCustomThemeWrapper.getFlairBackgroundColor(); + flairTextColor = mCustomThemeWrapper.getFlairTextColor(); + spoilerBackgroundColor = mCustomThemeWrapper.getSpoilerBackgroundColor(); + spoilerTextColor = mCustomThemeWrapper.getSpoilerTextColor(); + nsfwBackgroundColor = mCustomThemeWrapper.getNsfwBackgroundColor(); + nsfwTextColor = mCustomThemeWrapper.getNsfwTextColor(); titleEditText.setTextColor(primaryTextColor); - applyFABTheme(captureFab, mCustomThemeWrapper, themeType); - applyFABTheme(selectFromLibraryFab, mCustomThemeWrapper, themeType); - selectAgainTextView.setTextColor(mCustomThemeWrapper.getColorAccent(themeType)); + applyFABTheme(captureFab, R.drawable.ic_outline_add_a_photo_24dp); + applyFABTheme(selectFromLibraryFab, R.drawable.ic_outline_select_photo_24dp); + selectAgainTextView.setTextColor(mCustomThemeWrapper.getColorAccent()); } private void getCurrentAccount() { @@ -572,6 +573,7 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF flairTextView.setVisibility(View.VISIBLE); flairTextView.setBackgroundColor(resources.getColor(android.R.color.transparent)); + flairTextView.setTextColor(primaryTextColor); flairTextView.setText(getString(R.string.flair)); flair = null; } @@ -602,8 +604,9 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF public void flairSelected(Flair flair) { this.flair = flair; flairTextView.setText(flair.getText()); - flairTextView.setBackgroundColor(flairColor); - flairTextView.setBorderColor(flairColor); + flairTextView.setBackgroundColor(flairBackgroundColor); + flairTextView.setBorderColor(flairBackgroundColor); + flairTextView.setTextColor(flairTextColor); } @Subscribe diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostLinkActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostLinkActivity.java index b9d64913..91586388 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostLinkActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostLinkActivity.java @@ -119,9 +119,12 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr private boolean loadSubredditIconSuccessful = true; private boolean isPosting; private int primaryTextColor; - private int flairColor; - private int spoilerColor; - private int nsfwColor; + private int flairBackgroundColor; + private int flairTextColor; + private int spoilerBackgroundColor; + private int spoilerTextColor; + private int nsfwBackgroundColor; + private int nsfwTextColor; private Flair flair; private boolean isSpoiler = false; private boolean isNSFW = false; @@ -192,16 +195,19 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr if (flair != null) { flairTextView.setText(flair.getText()); - flairTextView.setBackgroundColor(flairColor); - flairTextView.setBorderColor(flairColor); + flairTextView.setBackgroundColor(flairBackgroundColor); + flairTextView.setBorderColor(flairBackgroundColor); + flairTextView.setTextColor(flairTextColor); } if (isSpoiler) { - spoilerTextView.setBackgroundColor(spoilerColor); - spoilerTextView.setBorderColor(spoilerColor); + spoilerTextView.setBackgroundColor(spoilerBackgroundColor); + spoilerTextView.setBorderColor(spoilerBackgroundColor); + spoilerTextView.setTextColor(spoilerTextColor); } if (isNSFW) { - nsfwTextView.setBackgroundColor(nsfwColor); - nsfwTextView.setBorderColor(nsfwColor); + nsfwTextView.setBackgroundColor(nsfwBackgroundColor); + nsfwTextView.setBorderColor(nsfwBackgroundColor); + nsfwTextView.setTextColor(nsfwTextColor); } } else { getCurrentAccount(); @@ -262,6 +268,7 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr flairSelectionBottomSheetFragment.show(getSupportFragmentManager(), flairSelectionBottomSheetFragment.getTag()); } else { flairTextView.setBackgroundColor(resources.getColor(android.R.color.transparent)); + flairTextView.setTextColor(primaryTextColor); flairTextView.setText(getString(R.string.flair)); flair = null; } @@ -269,22 +276,26 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr spoilerTextView.setOnClickListener(view -> { if (!isSpoiler) { - spoilerTextView.setBackgroundColor(spoilerColor); - spoilerTextView.setBorderColor(spoilerColor); + spoilerTextView.setBackgroundColor(spoilerBackgroundColor); + spoilerTextView.setBorderColor(spoilerBackgroundColor); + spoilerTextView.setTextColor(spoilerTextColor); isSpoiler = true; } else { spoilerTextView.setBackgroundColor(resources.getColor(android.R.color.transparent)); + spoilerTextView.setTextColor(primaryTextColor); isSpoiler = false; } }); nsfwTextView.setOnClickListener(view -> { if (!isNSFW) { - nsfwTextView.setBackgroundColor(nsfwColor); - nsfwTextView.setBorderColor(nsfwColor); + nsfwTextView.setBackgroundColor(nsfwBackgroundColor); + nsfwTextView.setBorderColor(nsfwBackgroundColor); + nsfwTextView.setTextColor(nsfwTextColor); isNSFW = true; } else { nsfwTextView.setBackgroundColor(resources.getColor(android.R.color.transparent)); + nsfwTextView.setTextColor(primaryTextColor); isNSFW = false; } }); @@ -302,31 +313,21 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr @Override protected void applyCustomTheme() { - int themeType = mCustomThemeWrapper.getThemeType(); - coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); - appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); - rulesButton.setTextColor(mCustomThemeWrapper.getButtonTextColor(themeType)); - rulesButton.setBackgroundTintList(ColorStateList.valueOf(mCustomThemeWrapper.getColorPrimaryLightTheme(themeType))); - int dividerColor = mCustomThemeWrapper.getDividerColor(themeType); + coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor()); + rulesButton.setTextColor(mCustomThemeWrapper.getButtonTextColor()); + rulesButton.setBackgroundTintList(ColorStateList.valueOf(mCustomThemeWrapper.getColorPrimaryLightTheme())); + int dividerColor = mCustomThemeWrapper.getDividerColor(); divider1.setBackgroundColor(dividerColor); divider2.setBackgroundColor(dividerColor); divider3.setBackgroundColor(dividerColor); - /*int flairColor = mCustomThemeWrapper.getFlairColor(themeType); - flairTextView.setBackgroundColor(flairColor); - flairTextView.setBorderColor(flairColor); - flairTextView.setTextColor(primaryTextColor); - int spoilerColor = mCustomThemeWrapper.getSpoilerColor(themeType); - spoilerTextView.setBackgroundColor(spoilerColor); - spoilerTextView.setBorderColor(spoilerColor); - 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); + primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor(); + flairBackgroundColor = mCustomThemeWrapper.getFlairBackgroundColor(); + flairTextColor = mCustomThemeWrapper.getFlairTextColor(); + spoilerBackgroundColor = mCustomThemeWrapper.getSpoilerBackgroundColor(); + spoilerTextColor = mCustomThemeWrapper.getSpoilerTextColor(); + nsfwBackgroundColor = mCustomThemeWrapper.getNsfwBackgroundColor(); + nsfwTextColor = mCustomThemeWrapper.getNsfwTextColor(); titleEditText.setTextColor(primaryTextColor); linkEditText.setTextColor(primaryTextColor); } @@ -491,6 +492,7 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr flairTextView.setVisibility(View.VISIBLE); flairTextView.setBackgroundColor(resources.getColor(android.R.color.transparent)); + flairTextView.setTextColor(primaryTextColor); flairTextView.setText(getString(R.string.flair)); flair = null; } @@ -507,8 +509,9 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr public void flairSelected(Flair flair) { this.flair = flair; flairTextView.setText(flair.getText()); - flairTextView.setBackgroundColor(flairColor); - flairTextView.setBorderColor(flairColor); + flairTextView.setBackgroundColor(flairBackgroundColor); + flairTextView.setBorderColor(flairBackgroundColor); + flairTextView.setTextColor(flairTextColor); } @Subscribe diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostTextActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostTextActivity.java index 87903ab1..121cecb0 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostTextActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostTextActivity.java @@ -119,9 +119,12 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr private boolean loadSubredditIconSuccessful = true; private boolean isPosting; private int primaryTextColor; - private int flairColor; - private int spoilerColor; - private int nsfwColor; + private int flairBackgroundColor; + private int flairTextColor; + private int spoilerBackgroundColor; + private int spoilerTextColor; + private int nsfwBackgroundColor; + private int nsfwTextColor; private Flair flair; private boolean isSpoiler = false; private boolean isNSFW = false; @@ -192,16 +195,19 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr if (flair != null) { flairTextView.setText(flair.getText()); - flairTextView.setBackgroundColor(flairColor); - flairTextView.setBorderColor(flairColor); + flairTextView.setBackgroundColor(flairBackgroundColor); + flairTextView.setBorderColor(flairBackgroundColor); + flairTextView.setTextColor(flairTextColor); } if (isSpoiler) { - spoilerTextView.setBackgroundColor(spoilerColor); - spoilerTextView.setBorderColor(spoilerColor); + spoilerTextView.setBackgroundColor(spoilerBackgroundColor); + spoilerTextView.setBorderColor(spoilerBackgroundColor); + spoilerTextView.setTextColor(spoilerTextColor); } if (isNSFW) { - nsfwTextView.setBackgroundColor(nsfwColor); - nsfwTextView.setBorderColor(nsfwColor); + nsfwTextView.setBackgroundColor(nsfwBackgroundColor); + nsfwTextView.setBorderColor(nsfwBackgroundColor); + nsfwTextView.setTextColor(nsfwTextColor); } } else { getCurrentAccount(); @@ -266,6 +272,7 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr flairSelectionBottomSheetFragment.show(getSupportFragmentManager(), flairSelectionBottomSheetFragment.getTag()); } else { flairTextView.setBackgroundColor(resources.getColor(android.R.color.transparent)); + flairTextView.setTextColor(primaryTextColor); flairTextView.setText(getString(R.string.flair)); flair = null; } @@ -273,22 +280,26 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr spoilerTextView.setOnClickListener(view -> { if (!isSpoiler) { - spoilerTextView.setBackgroundColor(spoilerColor); - spoilerTextView.setBorderColor(spoilerColor); + spoilerTextView.setBackgroundColor(spoilerBackgroundColor); + spoilerTextView.setBorderColor(spoilerBackgroundColor); + spoilerTextView.setTextColor(spoilerTextColor); isSpoiler = true; } else { spoilerTextView.setBackgroundColor(resources.getColor(android.R.color.transparent)); + spoilerTextView.setTextColor(primaryTextColor); isSpoiler = false; } }); nsfwTextView.setOnClickListener(view -> { if (!isNSFW) { - nsfwTextView.setBackgroundColor(nsfwColor); - nsfwTextView.setBorderColor(nsfwColor); + nsfwTextView.setBackgroundColor(nsfwBackgroundColor); + nsfwTextView.setBorderColor(nsfwBackgroundColor); + nsfwTextView.setTextColor(nsfwTextColor); isNSFW = true; } else { nsfwTextView.setBackgroundColor(resources.getColor(android.R.color.transparent)); + nsfwTextView.setTextColor(primaryTextColor); isNSFW = false; } }); @@ -306,31 +317,21 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr @Override protected void applyCustomTheme() { - int themeType = mCustomThemeWrapper.getThemeType(); - coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); - appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); - rulesButton.setTextColor(mCustomThemeWrapper.getButtonTextColor(themeType)); - rulesButton.setBackgroundTintList(ColorStateList.valueOf(mCustomThemeWrapper.getColorPrimaryLightTheme(themeType))); - int dividerColor = mCustomThemeWrapper.getDividerColor(themeType); + coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor()); + rulesButton.setTextColor(mCustomThemeWrapper.getButtonTextColor()); + rulesButton.setBackgroundTintList(ColorStateList.valueOf(mCustomThemeWrapper.getColorPrimaryLightTheme())); + int dividerColor = mCustomThemeWrapper.getDividerColor(); divider1.setBackgroundColor(dividerColor); divider2.setBackgroundColor(dividerColor); divider3.setBackgroundColor(dividerColor); - /*int flairColor = mCustomThemeWrapper.getFlairColor(themeType); - flairTextView.setBackgroundColor(flairColor); - flairTextView.setBorderColor(flairColor); - flairTextView.setTextColor(primaryTextColor); - int spoilerColor = mCustomThemeWrapper.getSpoilerColor(themeType); - spoilerTextView.setBackgroundColor(spoilerColor); - spoilerTextView.setBorderColor(spoilerColor); - 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); + primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor(); + flairBackgroundColor = mCustomThemeWrapper.getFlairBackgroundColor(); + flairTextColor = mCustomThemeWrapper.getFlairTextColor(); + spoilerBackgroundColor = mCustomThemeWrapper.getSpoilerBackgroundColor(); + spoilerTextColor = mCustomThemeWrapper.getSpoilerTextColor(); + nsfwBackgroundColor = mCustomThemeWrapper.getNsfwBackgroundColor(); + nsfwTextColor = mCustomThemeWrapper.getNsfwTextColor(); titleEditText.setTextColor(primaryTextColor); contentEditText.setTextColor(primaryTextColor); } @@ -491,6 +492,7 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr flairTextView.setVisibility(View.VISIBLE); flairTextView.setBackgroundColor(resources.getColor(android.R.color.transparent)); + flairTextView.setTextColor(primaryTextColor); flairTextView.setText(getString(R.string.flair)); flair = null; } @@ -507,8 +509,9 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr public void flairSelected(Flair flair) { this.flair = flair; flairTextView.setText(flair.getText()); - flairTextView.setBackgroundColor(flairColor); - flairTextView.setBorderColor(flairColor); + flairTextView.setBackgroundColor(flairBackgroundColor); + flairTextView.setBorderColor(flairBackgroundColor); + flairTextView.setTextColor(flairTextColor); } @Subscribe diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostVideoActivity.java index d7853720..173ce21e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostVideoActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostVideoActivity.java @@ -150,9 +150,12 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF private boolean isPosting; private boolean wasPlaying; private int primaryTextColor; - private int flairColor; - private int spoilerColor; - private int nsfwColor; + private int flairBackgroundColor; + private int flairTextColor; + private int spoilerBackgroundColor; + private int spoilerTextColor; + private int nsfwBackgroundColor; + private int nsfwTextColor; private Flair flair; private boolean isSpoiler = false; private boolean isNSFW = false; @@ -236,16 +239,19 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF if (flair != null) { flairTextView.setText(flair.getText()); - flairTextView.setBackgroundColor(flairColor); - flairTextView.setBorderColor(flairColor); + flairTextView.setBackgroundColor(flairBackgroundColor); + flairTextView.setBorderColor(flairBackgroundColor); + flairTextView.setTextColor(flairTextColor); } if (isSpoiler) { - spoilerTextView.setBackgroundColor(spoilerColor); - spoilerTextView.setBorderColor(spoilerColor); + spoilerTextView.setBackgroundColor(spoilerBackgroundColor); + spoilerTextView.setBorderColor(spoilerBackgroundColor); + spoilerTextView.setTextColor(spoilerTextColor); } if (isNSFW) { - nsfwTextView.setBackgroundColor(nsfwColor); - nsfwTextView.setBorderColor(nsfwColor); + nsfwTextView.setBackgroundColor(nsfwBackgroundColor); + nsfwTextView.setBorderColor(nsfwBackgroundColor); + nsfwTextView.setTextColor(nsfwTextColor); } } else { getCurrentAccount(); @@ -305,6 +311,7 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF mFlairSelectionBottomSheetFragment.show(getSupportFragmentManager(), mFlairSelectionBottomSheetFragment.getTag()); } else { flairTextView.setBackgroundColor(resources.getColor(android.R.color.transparent)); + flairTextView.setTextColor(primaryTextColor); flairTextView.setText(getString(R.string.flair)); flair = null; } @@ -312,22 +319,26 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF spoilerTextView.setOnClickListener(view -> { if (!isSpoiler) { - spoilerTextView.setBackgroundColor(spoilerColor); - spoilerTextView.setBorderColor(spoilerColor); + spoilerTextView.setBackgroundColor(spoilerBackgroundColor); + spoilerTextView.setBorderColor(spoilerBackgroundColor); + spoilerTextView.setTextColor(spoilerTextColor); isSpoiler = true; } else { spoilerTextView.setBackgroundColor(resources.getColor(android.R.color.transparent)); + spoilerTextView.setTextColor(primaryTextColor); isSpoiler = false; } }); nsfwTextView.setOnClickListener(view -> { if (!isNSFW) { - nsfwTextView.setBackgroundColor(nsfwColor); - nsfwTextView.setBorderColor(nsfwColor); + nsfwTextView.setBackgroundColor(nsfwBackgroundColor); + nsfwTextView.setBorderColor(nsfwBackgroundColor); + nsfwTextView.setTextColor(nsfwTextColor); isNSFW = true; } else { nsfwTextView.setBackgroundColor(resources.getColor(android.R.color.transparent)); + nsfwTextView.setTextColor(primaryTextColor); isNSFW = false; } }); @@ -368,35 +379,25 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF @Override protected void applyCustomTheme() { - int themeType = mCustomThemeWrapper.getThemeType(); - coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); - appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); - rulesButton.setTextColor(mCustomThemeWrapper.getButtonTextColor(themeType)); - rulesButton.setBackgroundTintList(ColorStateList.valueOf(mCustomThemeWrapper.getColorPrimaryLightTheme(themeType))); - int dividerColor = mCustomThemeWrapper.getDividerColor(themeType); + coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor()); + rulesButton.setTextColor(mCustomThemeWrapper.getButtonTextColor()); + rulesButton.setBackgroundTintList(ColorStateList.valueOf(mCustomThemeWrapper.getColorPrimaryLightTheme())); + int dividerColor = mCustomThemeWrapper.getDividerColor(); divider1.setBackgroundColor(dividerColor); divider2.setBackgroundColor(dividerColor); divider3.setBackgroundColor(dividerColor); - /*int flairColor = mCustomThemeWrapper.getFlairColor(themeType); - flairTextView.setBackgroundColor(flairColor); - flairTextView.setBorderColor(flairColor); - flairTextView.setTextColor(primaryTextColor); - int spoilerColor = mCustomThemeWrapper.getSpoilerColor(themeType); - spoilerTextView.setBackgroundColor(spoilerColor); - spoilerTextView.setBorderColor(spoilerColor); - 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); + primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor(); + flairBackgroundColor = mCustomThemeWrapper.getFlairBackgroundColor(); + flairTextColor = mCustomThemeWrapper.getFlairTextColor(); + spoilerBackgroundColor = mCustomThemeWrapper.getSpoilerBackgroundColor(); + spoilerTextColor = mCustomThemeWrapper.getSpoilerTextColor(); + nsfwBackgroundColor = mCustomThemeWrapper.getNsfwBackgroundColor(); + nsfwTextColor = mCustomThemeWrapper.getNsfwTextColor(); titleEditText.setTextColor(primaryTextColor); - applyFABTheme(captureFab, mCustomThemeWrapper, themeType); - applyFABTheme(selectFromLibraryFab, mCustomThemeWrapper, themeType); - selectAgainTextView.setTextColor(mCustomThemeWrapper.getColorAccent(themeType)); + applyFABTheme(captureFab, R.drawable.ic_outline_add_a_photo_24dp); + applyFABTheme(selectFromLibraryFab, R.drawable.ic_outline_select_photo_24dp); + selectAgainTextView.setTextColor(mCustomThemeWrapper.getColorAccent()); } private void getCurrentAccount() { @@ -593,6 +594,7 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF flairTextView.setVisibility(View.VISIBLE); flairTextView.setBackgroundColor(resources.getColor(android.R.color.transparent)); + flairTextView.setTextColor(primaryTextColor); flairTextView.setText(getString(R.string.flair)); flair = null; } @@ -630,8 +632,9 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF public void flairSelected(Flair flair) { this.flair = flair; flairTextView.setText(flair.getText()); - flairTextView.setBackgroundColor(flairColor); - flairTextView.setBorderColor(flairColor); + flairTextView.setBackgroundColor(flairBackgroundColor); + flairTextView.setBorderColor(flairBackgroundColor); + flairTextView.setTextColor(flairTextColor); } @Subscribe diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/RulesActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/RulesActivity.java index fb337711..2fa2bff3 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/RulesActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/RulesActivity.java @@ -129,10 +129,9 @@ public class RulesActivity extends BaseActivity { @Override protected void applyCustomTheme() { - int themeType = mCustomThemeWrapper.getThemeType(); - coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); - appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); - errorTextView.setTextColor(mCustomThemeWrapper.getSecondaryTextColor(themeType)); + coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor()); + errorTextView.setTextColor(mCustomThemeWrapper.getSecondaryTextColor()); } private void fetchRules() { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchActivity.java index d0900491..9c4e77e2 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchActivity.java @@ -189,12 +189,11 @@ public class SearchActivity extends BaseActivity { @Override protected void applyCustomTheme() { - int themeType = mCustomThemeWrapper.getThemeType(); - coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); - appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); - simpleSearchView.setSearchBackground(new ColorDrawable(mCustomThemeWrapper.getColorPrimary(themeType))); - searchInTextView.setTextColor(mCustomThemeWrapper.getColorAccent(themeType)); - subredditNameTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor(themeType)); + coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor()); + simpleSearchView.setSearchBackground(new ColorDrawable(mCustomThemeWrapper.getColorPrimary())); + searchInTextView.setTextColor(mCustomThemeWrapper.getColorAccent()); + subredditNameTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor()); } @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchResultActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchResultActivity.java index fb2bd7f0..9edddbca 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchResultActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchResultActivity.java @@ -171,10 +171,9 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect @Override protected void applyCustomTheme() { - int themeType = mCustomThemeWrapper.getThemeType(); - coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); - appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); - applyTabLayoutTheme(tabLayout, mCustomThemeWrapper, themeType); + coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor()); + applyTabLayoutTheme(tabLayout); } private void getCurrentAccountAndInitializeViewPager() { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchSubredditsResultActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchSubredditsResultActivity.java index 8801f126..95cfc840 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchSubredditsResultActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchSubredditsResultActivity.java @@ -120,9 +120,8 @@ public class SearchSubredditsResultActivity extends BaseActivity { @Override protected void applyCustomTheme() { - int themeType = mCustomThemeWrapper.getThemeType(); - coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); - appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); + coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor()); } private void getCurrentAccountAndInitializeFragment(String query) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SettingsActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SettingsActivity.java index 84f6e15d..035b746c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SettingsActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SettingsActivity.java @@ -94,9 +94,8 @@ public class SettingsActivity extends BaseActivity implements @Override protected void applyCustomTheme() { - int themeType = mCustomThemeWrapper.getThemeType(); - coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); - appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); + coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor()); } @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubredditMultiselectionActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubredditMultiselectionActivity.java index 84db99aa..b3438e56 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubredditMultiselectionActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubredditMultiselectionActivity.java @@ -251,9 +251,8 @@ public class SubredditMultiselectionActivity extends BaseActivity { @Override protected void applyCustomTheme() { - int themeType = mCustomThemeWrapper.getThemeType(); - mCoordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); - mAppBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); - mErrorTextView.setTextColor(mCustomThemeWrapper.getSecondaryTextColor(themeType)); + mCoordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + mAppBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor()); + mErrorTextView.setTextColor(mCustomThemeWrapper.getSecondaryTextColor()); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubredditSelectionActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubredditSelectionActivity.java index fe4c0b70..73314489 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubredditSelectionActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubredditSelectionActivity.java @@ -142,9 +142,8 @@ public class SubredditSelectionActivity extends BaseActivity { @Override protected void applyCustomTheme() { - int themeType = mCustomThemeWrapper.getThemeType(); - coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); - appBarLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); + coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + appBarLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); } private void getCurrentAccountAndBindView() { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubscribedThingListingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubscribedThingListingActivity.java index d5d15dd0..fb80bd2f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubscribedThingListingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubscribedThingListingActivity.java @@ -136,10 +136,9 @@ public class SubscribedThingListingActivity extends BaseActivity { @Override protected void applyCustomTheme() { - int themeType = mCustomThemeWrapper.getThemeType(); - coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); - appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); - applyTabLayoutTheme(tabLayout, mCustomThemeWrapper, themeType); + coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor()); + applyTabLayoutTheme(tabLayout); } private void getCurrentAccountAndInitializeViewPager() { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMessageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMessageActivity.java index a13eef1d..64b60fd4 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMessageActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMessageActivity.java @@ -156,12 +156,11 @@ public class ViewMessageActivity extends BaseActivity { @Override protected void applyCustomTheme() { - int themeType = mCustomThemeWrapper.getThemeType(); - mCoordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); - mAppBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); - mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(mCustomThemeWrapper.getCardViewBackgroundColor(themeType)); - mSwipeRefreshLayout.setColorSchemeColors(mCustomThemeWrapper.getColorAccent(themeType)); - mFetchMessageInfoTextView.setTextColor(mCustomThemeWrapper.getSecondaryTextColor(themeType)); + mCoordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + mAppBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor()); + mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(mCustomThemeWrapper.getCircularProgressBarBackground()); + mSwipeRefreshLayout.setColorSchemeColors(mCustomThemeWrapper.getColorAccent()); + mFetchMessageInfoTextView.setTextColor(mCustomThemeWrapper.getSecondaryTextColor()); } private void getCurrentAccountAndFetchMessage() { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMultiRedditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMultiRedditDetailActivity.java index 94a40c85..b38611db 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMultiRedditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMultiRedditDetailActivity.java @@ -323,8 +323,7 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT @Override protected void applyCustomTheme() { - int themeType = mCustomThemeWrapper.getThemeType(); - coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); - appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); + coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor()); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java index 9437b2de..a56a534f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java @@ -368,13 +368,12 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS @Override protected void applyCustomTheme() { - int themeType = mCustomThemeWrapper.getThemeType(); - mCoordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); - mAppBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); - mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(mCustomThemeWrapper.getCardViewBackgroundColor(themeType)); - mSwipeRefreshLayout.setColorSchemeColors(mCustomThemeWrapper.getColorAccent(themeType)); - mFetchPostInfoTextView.setTextColor(mCustomThemeWrapper.getSecondaryTextColor(themeType)); - applyFABTheme(fab, mCustomThemeWrapper, themeType); + mCoordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + mAppBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor()); + mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(mCustomThemeWrapper.getCircularProgressBarBackground()); + mSwipeRefreshLayout.setColorSchemeColors(mCustomThemeWrapper.getColorAccent()); + mFetchPostInfoTextView.setTextColor(mCustomThemeWrapper.getSecondaryTextColor()); + applyFABTheme(fab, R.drawable.ic_keyboard_arrow_down_24dp); } private void getCurrentAccountAndBindView() { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSidebarActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSidebarActivity.java index c2679877..364b257b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSidebarActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSidebarActivity.java @@ -228,11 +228,10 @@ public class ViewSidebarActivity extends BaseActivity { @Override protected void applyCustomTheme() { - int themeType = mCustomThemeWrapper.getThemeType(); - coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); - appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); - swipeRefreshLayout.setProgressBackgroundColorSchemeColor(mCustomThemeWrapper.getCardViewBackgroundColor(themeType)); - swipeRefreshLayout.setColorSchemeColors(mCustomThemeWrapper.getColorAccent(themeType)); - markdownColor = mCustomThemeWrapper.getSecondaryTextColor(themeType); + coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor()); + swipeRefreshLayout.setProgressBackgroundColorSchemeColor(mCustomThemeWrapper.getCircularProgressBarBackground()); + swipeRefreshLayout.setColorSchemeColors(mCustomThemeWrapper.getColorAccent()); + markdownColor = mCustomThemeWrapper.getSecondaryTextColor(); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java index 1ccea602..412c4e60 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java @@ -344,21 +344,20 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp @Override protected void applyCustomTheme() { - int themeType = mCustomThemeWrapper.getThemeType(); - int backgroundColor = mCustomThemeWrapper.getBackgroundColor(themeType); + int backgroundColor = mCustomThemeWrapper.getBackgroundColor(); coordinatorLayout.setBackgroundColor(backgroundColor); - appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); + appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor()); linearLayout.setBackgroundColor(backgroundColor); - subredditNameTextView.setTextColor(mCustomThemeWrapper.getSubreddit(themeType)); - subscribeSubredditChip.setTextColor(mCustomThemeWrapper.getChipTextColor(themeType)); - int primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor(themeType); + subredditNameTextView.setTextColor(mCustomThemeWrapper.getSubreddit()); + subscribeSubredditChip.setTextColor(mCustomThemeWrapper.getChipTextColor()); + int primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor(); nSubscribersTextView.setTextColor(primaryTextColor); nOnlineSubscribersTextView.setTextColor(primaryTextColor); descriptionTextView.setTextColor(primaryTextColor); bottomNavigationView.setBackgroundColor(backgroundColor); - applyFABTheme(fab, mCustomThemeWrapper, themeType); - unsubscribedColor = mCustomThemeWrapper.getUnsubscribed(themeType); - subscribedColor = mCustomThemeWrapper.getSubscribed(themeType); + applyFABTheme(fab, R.drawable.ic_add_bottom_app_bar_24dp); + unsubscribedColor = mCustomThemeWrapper.getUnsubscribed(); + subscribedColor = mCustomThemeWrapper.getSubscribed(); } private void getCurrentAccountAndBindView() { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java index bc75db0a..253c38ec 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java @@ -409,21 +409,20 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele @Override protected void applyCustomTheme() { - int themeType = mCustomThemeWrapper.getThemeType(); - coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor(themeType)); - appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor(themeType)); - expandedTabTextColor = mCustomThemeWrapper.getTabLayoutWithExpandedCollapsingToolbarTextColor(themeType); - expandedTabIndicatorColor = mCustomThemeWrapper.getTabLayoutWithExpandedCollapsingToolbarTabIndicator(themeType); - expandedTabBackgroundColor = mCustomThemeWrapper.getTabLayoutWithExpandedCollapsingToolbarTabBackground(themeType); - collapsedTabTextColor = mCustomThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTextColor(themeType); - collapsedTabIndicatorColor = mCustomThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTabIndicator(themeType); - collapsedTabBackgroundColor = mCustomThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTabBackground(themeType); - unsubscribedColor = mCustomThemeWrapper.getUnsubscribed(themeType); - subscribedColor = mCustomThemeWrapper.getSubscribed(themeType); - userNameTextView.setTextColor(mCustomThemeWrapper.getUsername(themeType)); - karmaTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor(themeType)); - subscribeUserChip.setTextColor(mCustomThemeWrapper.getChipTextColor(themeType)); - applyTabLayoutTheme(tabLayout, mCustomThemeWrapper, themeType); + coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor()); + expandedTabTextColor = mCustomThemeWrapper.getTabLayoutWithExpandedCollapsingToolbarTextColor(); + expandedTabIndicatorColor = mCustomThemeWrapper.getTabLayoutWithExpandedCollapsingToolbarTabIndicator(); + expandedTabBackgroundColor = mCustomThemeWrapper.getTabLayoutWithExpandedCollapsingToolbarTabBackground(); + collapsedTabTextColor = mCustomThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTextColor(); + collapsedTabIndicatorColor = mCustomThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTabIndicator(); + collapsedTabBackgroundColor = mCustomThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTabBackground(); + unsubscribedColor = mCustomThemeWrapper.getUnsubscribed(); + subscribedColor = mCustomThemeWrapper.getSubscribed(); + userNameTextView.setTextColor(mCustomThemeWrapper.getUsername()); + karmaTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor()); + subscribeUserChip.setTextColor(mCustomThemeWrapper.getChipTextColor()); + applyTabLayoutTheme(tabLayout); } private void getCurrentAccountAndInitializeViewPager() { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java index d4ff5510..1bd656b4 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java @@ -140,15 +140,20 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy private int mPrimaryTextColor; private int mCommentTextColor; private int mCommentBackgroundColor; - private int mPostTypeColor; + private int mPostTypeBackgroundColor; + private int mPostTypeTextColor; private int mDividerColor; private int mSubredditColor; private int mUsernameColor; private int mSubmitterColor; private int mModeratorColor; - private int mSpoilerColor; - private int mFlairColor; - private int mNSFWColor; + private int mAuthorFlairTextColor; + private int mSpoilerBackgroundColor; + private int mSpoilerTextColor; + private int mFlairBackgroundColor; + private int mFlairTextColor; + private int mNSFWBackgroundColor; + private int mNSFWTextColor; private int mArchivedTintColor; private int mLockedTintColor; private int mCrosspostTintColor; @@ -184,9 +189,8 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy mOauthRetrofit = oauthRetrofit; mRedditDataRoomDatabase = redditDataRoomDatabase; mGlide = glide; - int themeType = customThemeWrapper.getThemeType(); - mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor(themeType); - int markdownColor = customThemeWrapper.getPostContentColor(themeType); + mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor(); + int markdownColor = customThemeWrapper.getPostContentColor(); mPostDetailMarkwon = Markwon.builder(mActivity) .usePlugin(new AbstractMarkwonPlugin() { @Override @@ -278,38 +282,43 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy loadMoreCommentsFailed = false; mScale = activity.getResources().getDisplayMetrics().density; - mColorPrimaryLightTheme = customThemeWrapper.getColorPrimaryLightTheme(themeType); - mColorAccent = customThemeWrapper.getColorAccent(themeType); - mCardViewColor = customThemeWrapper.getCardViewBackgroundColor(themeType); - mPostTitleColor = customThemeWrapper.getPostTitleColor(themeType); - mPrimaryTextColor = customThemeWrapper.getPrimaryTextColor(themeType); - mCommentTextColor = customThemeWrapper.getCommentColor(themeType); - mDividerColor = customThemeWrapper.getDividerColor(themeType); - mCommentBackgroundColor = customThemeWrapper.getCommentBackgroundColor(themeType); - mPostTypeColor = customThemeWrapper.getPostType(themeType); - mSubmitterColor = customThemeWrapper.getSubmitter(themeType); - mModeratorColor = customThemeWrapper.getModerator(themeType); - mSpoilerColor = customThemeWrapper.getSpoilerColor(themeType); - mNSFWColor = customThemeWrapper.getNsfwColor(themeType); - mArchivedTintColor = customThemeWrapper.getArchivedTint(themeType); - mLockedTintColor = customThemeWrapper.getLockedIconTint(themeType); - mCrosspostTintColor = customThemeWrapper.getCrosspost(themeType); - mNoPreviewLinkBackgroundColor = customThemeWrapper.getNoPreviewLinkBackgroundColor(themeType); - mFlairColor = customThemeWrapper.getFlairColor(themeType); - mSubredditColor = customThemeWrapper.getSubreddit(themeType); - mUsernameColor = customThemeWrapper.getUsername(themeType); - mUpvotedColor = customThemeWrapper.getUpvoted(themeType); - mDownvotedColor = customThemeWrapper.getDownvoted(themeType); - mCommentVerticalBarColor1 = customThemeWrapper.getCommentVerticalBarColor1(themeType); - mCommentVerticalBarColor2 = customThemeWrapper.getCommentVerticalBarColor2(themeType); - mCommentVerticalBarColor3 = customThemeWrapper.getCommentVerticalBarColor3(themeType); - mCommentVerticalBarColor4 = customThemeWrapper.getCommentVerticalBarColor4(themeType); - mCommentVerticalBarColor5 = customThemeWrapper.getCommentVerticalBarColor5(themeType); - mCommentVerticalBarColor6 = customThemeWrapper.getCommentVerticalBarColor6(themeType); - mCommentVerticalBarColor7 = customThemeWrapper.getCommentVerticalBarColor7(themeType); - mSingleCommentThreadBackgroundColor = customThemeWrapper.getSingleCommentThreadBackgroundColor(themeType); - mVoteAndReplyUnavailableVoteButtonColor = customThemeWrapper.getVoteAndReplyUnavailableVoteButtonColor(themeType); - mButtonTextColor = customThemeWrapper.getButtonTextColor(themeType); + mColorPrimaryLightTheme = customThemeWrapper.getColorPrimaryLightTheme(); + mColorAccent = customThemeWrapper.getColorAccent(); + mCardViewColor = customThemeWrapper.getCardViewBackgroundColor(); + mPostTitleColor = customThemeWrapper.getPostTitleColor(); + mPrimaryTextColor = customThemeWrapper.getPrimaryTextColor(); + mCommentTextColor = customThemeWrapper.getCommentColor(); + mDividerColor = customThemeWrapper.getDividerColor(); + mCommentBackgroundColor = customThemeWrapper.getCommentBackgroundColor(); + mPostTypeBackgroundColor = customThemeWrapper.getPostTypeBackgroundColor(); + mPostTypeTextColor = customThemeWrapper.getPostTypeTextColor(); + mSubmitterColor = customThemeWrapper.getSubmitter(); + mModeratorColor = customThemeWrapper.getModerator(); + mAuthorFlairTextColor = customThemeWrapper.getAuthorFlairTextColor(); + mSpoilerBackgroundColor = customThemeWrapper.getSpoilerBackgroundColor(); + mSpoilerTextColor = customThemeWrapper.getSpoilerTextColor(); + mNSFWBackgroundColor = customThemeWrapper.getNsfwBackgroundColor(); + mNSFWTextColor = customThemeWrapper.getNsfwTextColor(); + mArchivedTintColor = customThemeWrapper.getArchivedTint(); + mLockedTintColor = customThemeWrapper.getLockedIconTint(); + mCrosspostTintColor = customThemeWrapper.getCrosspostIconTint(); + mNoPreviewLinkBackgroundColor = customThemeWrapper.getNoPreviewLinkBackgroundColor(); + mFlairBackgroundColor = customThemeWrapper.getFlairBackgroundColor(); + mFlairTextColor = customThemeWrapper.getFlairTextColor(); + mSubredditColor = customThemeWrapper.getSubreddit(); + mUsernameColor = customThemeWrapper.getUsername(); + mUpvotedColor = customThemeWrapper.getUpvoted(); + mDownvotedColor = customThemeWrapper.getDownvoted(); + mCommentVerticalBarColor1 = customThemeWrapper.getCommentVerticalBarColor1(); + mCommentVerticalBarColor2 = customThemeWrapper.getCommentVerticalBarColor2(); + mCommentVerticalBarColor3 = customThemeWrapper.getCommentVerticalBarColor3(); + mCommentVerticalBarColor4 = customThemeWrapper.getCommentVerticalBarColor4(); + mCommentVerticalBarColor5 = customThemeWrapper.getCommentVerticalBarColor5(); + mCommentVerticalBarColor6 = customThemeWrapper.getCommentVerticalBarColor6(); + mCommentVerticalBarColor7 = customThemeWrapper.getCommentVerticalBarColor7(); + mSingleCommentThreadBackgroundColor = customThemeWrapper.getSingleCommentThreadBackgroundColor(); + mVoteAndReplyUnavailableVoteButtonColor = customThemeWrapper.getVoteAndReplyUnavailableVoteButtonColor(); + mButtonTextColor = customThemeWrapper.getButtonTextColor(); mShareLinkBottomSheetFragment = new ShareLinkBottomSheetFragment(); mCopyTextBottomSheetFragment = new CopyTextBottomSheetFragment(); @@ -2004,18 +2013,23 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy mUserTextView.setTextColor(mUsernameColor); mPostTimeTextView.setTextColor(mSecondaryTextColor); mTitleTextView.setTextColor(mPostTitleColor); - mTypeTextView.setBackgroundColor(mPostTypeColor); - mTypeTextView.setBorderColor(mPostTypeColor); - mSpoilerTextView.setBackgroundColor(mSpoilerColor); - mSpoilerTextView.setBorderColor(mSpoilerColor); - mNSFWTextView.setBackgroundColor(mNSFWColor); - mNSFWTextView.setBorderColor(mNSFWColor); - mFlairTextView.setBackgroundColor(mFlairColor); - mFlairTextView.setBorderColor(mFlairColor); + mTypeTextView.setBackgroundColor(mPostTypeBackgroundColor); + mTypeTextView.setBorderColor(mPostTypeBackgroundColor); + mTypeTextView.setTextColor(mPostTypeTextColor); + mSpoilerTextView.setBackgroundColor(mSpoilerBackgroundColor); + mSpoilerTextView.setBorderColor(mSpoilerBackgroundColor); + mSpoilerTextView.setTextColor(mSpoilerTextColor); + mNSFWTextView.setBackgroundColor(mNSFWBackgroundColor); + mNSFWTextView.setBorderColor(mNSFWBackgroundColor); + mNSFWTextView.setTextColor(mNSFWTextColor); + mFlairTextView.setBackgroundColor(mFlairBackgroundColor); + mFlairTextView.setBorderColor(mFlairBackgroundColor); + mFlairTextView.setTextColor(mFlairTextColor); mArchivedImageView.setColorFilter(mArchivedTintColor, PorterDuff.Mode.SRC_IN); mLockedImageView.setColorFilter(mLockedTintColor, PorterDuff.Mode.SRC_IN); mCrosspostImageView.setColorFilter(mCrosspostTintColor, PorterDuff.Mode.SRC_IN); mLinkTextView.setTextColor(mSecondaryTextColor); + mLoadImageProgressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent)); mNoPreviewLinkImageView.setBackgroundColor(mNoPreviewLinkBackgroundColor); mLoadImageErrorTextView.setTextColor(mPrimaryTextColor); } @@ -2086,7 +2100,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy authorTextView.setTextColor(mUsernameColor); commentTimeTextView.setTextColor(mSecondaryTextColor); commentMarkdownView.setTextColor(mCommentTextColor); - authorFlairTextView.setTextColor(mFlairColor); + authorFlairTextView.setTextColor(mAuthorFlairTextColor); commentDivider.setBackgroundColor(mDividerColor); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentsListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentsListingRecyclerViewAdapter.java index 9c5b6f2d..c66c04ba 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentsListingRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentsListingRecyclerViewAdapter.java @@ -127,18 +127,17 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment mShowCommentDivider = showCommentDivider; mShowAbsoluteNumberOfVotes = showAbsoluteNumberOfVotes; mRetryLoadingMoreCallback = retryLoadingMoreCallback; - int themeType = customThemeWrapper.getThemeType(); - mColorPrimaryLightTheme = customThemeWrapper.getColorPrimaryLightTheme(themeType); - mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor(themeType); - mCommentBackgroundColor = customThemeWrapper.getCommentBackgroundColor(themeType); - mCommentColor = customThemeWrapper.getCommentColor(themeType); - mDividerColor = customThemeWrapper.getDividerColor(themeType); - mSubredditColor = customThemeWrapper.getSubreddit(themeType); - mUsernameColor = customThemeWrapper.getUsername(themeType); - mUpvotedColor = customThemeWrapper.getUpvoted(themeType); - mDownvotedColor = customThemeWrapper.getDownvoted(themeType); - mButtonTextColor = customThemeWrapper.getButtonTextColor(themeType); - mColorAccent = customThemeWrapper.getColorAccent(themeType); + mColorPrimaryLightTheme = customThemeWrapper.getColorPrimaryLightTheme(); + mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor(); + mCommentBackgroundColor = customThemeWrapper.getCommentBackgroundColor(); + mCommentColor = customThemeWrapper.getCommentColor(); + mDividerColor = customThemeWrapper.getDividerColor(); + mSubredditColor = customThemeWrapper.getSubreddit(); + mUsernameColor = customThemeWrapper.getUsername(); + mUpvotedColor = customThemeWrapper.getUpvoted(); + mDownvotedColor = customThemeWrapper.getDownvoted(); + mButtonTextColor = customThemeWrapper.getButtonTextColor(); + mColorAccent = customThemeWrapper.getColorAccent(); } @NonNull diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/FlairBottomSheetRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/FlairBottomSheetRecyclerViewAdapter.java index 173b38f8..3f7f9892 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/FlairBottomSheetRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/FlairBottomSheetRecyclerViewAdapter.java @@ -32,7 +32,7 @@ public class FlairBottomSheetRecyclerViewAdapter extends RecyclerView.Adapter<Fl public FlairBottomSheetRecyclerViewAdapter(Context context, CustomThemeWrapper customThemeWrapper, ItemClickListener itemClickListener) { this.context = context; - flairColor = customThemeWrapper.getFlairColor(customThemeWrapper.getThemeType()); + flairColor = customThemeWrapper.getFlairBackgroundColor(); this.itemClickListener = itemClickListener; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/FollowedUsersRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/FollowedUsersRecyclerViewAdapter.java index 71166e3a..938e01c3 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/FollowedUsersRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/FollowedUsersRecyclerViewAdapter.java @@ -55,9 +55,8 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc mRedditDataRoomDatabase = redditDataRoomDatabase; mAccessToken = accessToken; glide = Glide.with(context.getApplicationContext()); - int themeType = customThemeWrapper.getThemeType(); - mUsernameColor = customThemeWrapper.getUsername(themeType); - mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor(themeType); + mUsernameColor = customThemeWrapper.getUsername(); + mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor(); } @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/MessageRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/MessageRecyclerViewAdapter.java index b1cfb9e7..91cae44a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/MessageRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/MessageRecyclerViewAdapter.java @@ -99,15 +99,14 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl .build(); mAccessToken = accessToken; - int themeType = customThemeWrapper.getThemeType(); - mColorAccent = customThemeWrapper.getColorAccent(themeType); - mMessageBackgroundColor = customThemeWrapper.getCardViewBackgroundColor(themeType); - mUsernameColor = customThemeWrapper.getUsername(themeType); - mPrimaryTextColor = customThemeWrapper.getPrimaryTextColor(themeType); - mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor(themeType); - mUnreadMessageBackgroundColor = customThemeWrapper.getUnreadMessageBackgroundColor(themeType); - mColorPrimaryLightTheme = customThemeWrapper.getColorPrimaryLightTheme(themeType); - mButtonTextColor = customThemeWrapper.getButtonTextColor(themeType); + mColorAccent = customThemeWrapper.getColorAccent(); + mMessageBackgroundColor = customThemeWrapper.getCardViewBackgroundColor(); + mUsernameColor = customThemeWrapper.getUsername(); + mPrimaryTextColor = customThemeWrapper.getPrimaryTextColor(); + mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor(); + mUnreadMessageBackgroundColor = customThemeWrapper.getUnreadMessageBackgroundColor(); + mColorPrimaryLightTheme = customThemeWrapper.getColorPrimaryLightTheme(); + mButtonTextColor = customThemeWrapper.getButtonTextColor(); } @NonNull diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/MultiRedditListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/MultiRedditListingRecyclerViewAdapter.java index 86222840..0022c7c5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/MultiRedditListingRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/MultiRedditListingRecyclerViewAdapter.java @@ -59,9 +59,8 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter< mRedditDataRoomDatabase = redditDataRoomDatabase; mAccessToken = accessToken; mAccountName = accountName; - int themeType = customThemeWrapper.getThemeType(); - mPrimaryTextColor = customThemeWrapper.getPrimaryTextColor(themeType); - mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor(themeType); + mPrimaryTextColor = customThemeWrapper.getPrimaryTextColor(); + mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor(); } @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/NavigationDrawerRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/NavigationDrawerRecyclerViewAdapter.java index 020367f8..87863c0d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/NavigationDrawerRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/NavigationDrawerRecyclerViewAdapter.java @@ -75,10 +75,9 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter<Re this.isNSFWEnabled = isNSFWEnabled; isLoggedIn = accountName != null; this.itemClickListener = itemClickListener; - int themeType = customThemeWrapper.getThemeType(); - primaryTextColor = customThemeWrapper.getPrimaryTextColor(themeType); - secondaryTextColor = customThemeWrapper.getSecondaryTextColor(themeType); - dividerColor = customThemeWrapper.getDividerColor(themeType); + primaryTextColor = customThemeWrapper.getPrimaryTextColor(); + secondaryTextColor = customThemeWrapper.getSecondaryTextColor(); + dividerColor = customThemeWrapper.getDividerColor(); } @Override @@ -448,8 +447,6 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter<Re NavHeaderViewHolder(@NonNull View itemView) { super(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) { super(itemView); titleTextView = (TextView) itemView; - titleTextView.setTextColor(primaryTextColor); + titleTextView.setTextColor(secondaryTextColor); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java index 17291ea4..8c0a2444 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java @@ -102,37 +102,28 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView private int mPostLayout; private int mColorPrimaryLightTheme; private int mColorAccent; - private int mCardViewColor; + private int mCardViewBackgroundColor; private int mSecondaryTextColor; private int mPostTitleColor; - private int mPrimaryTextColor; - private int mCommentTextColor; - private int mCommentBackgroundColor; - private int mPostTypeColor; - private int mDividerColor; + private int mPostContentColor; + private int mStickiedPostIconTint; + private int mPostTypeBackgroundColor; + private int mPostTypeTextColor; private int mSubredditColor; private int mUsernameColor; - private int mSubmitterColor; - private int mModeratorColor; - private int mSpoilerColor; - private int mFlairColor; - private int mNSFWColor; - private int mArchivedTintColor; - private int mLockedTintColor; - private int mCrosspostTintColor; + private int mSpoilerBackgroundColor; + private int mSpoilerTextColor; + private int mFlairBackgroundColor; + private int mFlairTextColor; + private int mNSFWBackgroundColor; + private int mNSFWTextColor; + private int mArchivedIconTint; + private int mLockedIconTint; + private int mCrosspostIconTint; private int mNoPreviewLinkBackgroundColor; private int mUpvotedColor; 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 mButtonBackgroundTint; private int mButtonTextColor; private float mScale; private boolean mDisplaySubredditName; @@ -168,16 +159,33 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView mShowDividerInCompactLayout = showDividerInCompactLayout; mShowAbsoluteNumberOfVotes = showAbsoluteNumberOfVotes; mPostLayout = postLayout; - int themeType = customThemeWrapper.getThemeType(); - mColorPrimaryLightTheme = customThemeWrapper.getColorPrimaryLightTheme(themeType); - mColorAccent = customThemeWrapper.getColorAccent(themeType); - mPrimaryTextColor = customThemeWrapper.getPrimaryTextColor(themeType); - mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor(themeType); - mSubredditColor = customThemeWrapper.getSubreddit(themeType); - mUsernameColor = customThemeWrapper.getUsername(themeType); - mUpvotedColor = customThemeWrapper.getUpvoted(themeType); - mDownvotedColor = customThemeWrapper.getDownvoted(themeType); - mVoteAndReplyUnavailableVoteButtonColor = customThemeWrapper.getVoteAndReplyUnavailableVoteButtonColor(themeType); + + mColorPrimaryLightTheme = customThemeWrapper.getColorPrimaryLightTheme(); + mColorAccent = customThemeWrapper.getColorAccent(); + mCardViewBackgroundColor = customThemeWrapper.getCardViewBackgroundColor(); + mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor(); + mPostTitleColor = customThemeWrapper.getPostTitleColor(); + mPostContentColor = customThemeWrapper.getPostContentColor(); + mStickiedPostIconTint = customThemeWrapper.getStickiedPostIconTint(); + mPostTypeBackgroundColor = customThemeWrapper.getPostTypeBackgroundColor(); + 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; mGlide = Glide.with(mActivity.getApplicationContext()); mRedditDataRoomDatabase = redditDataRoomDatabase; @@ -1621,22 +1629,30 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView constraintSet.applyTo(bottomConstraintLayout); } + itemView.setBackgroundTintList(ColorStateList.valueOf(mCardViewBackgroundColor)); subredditTextView.setTextColor(mSubredditColor); userTextView.setTextColor(mUsernameColor); postTimeTextView.setTextColor(mSecondaryTextColor); - titleTextView.setTextColor(mPrimaryTextColor); - typeTextView.setBackgroundColor(mPostTypeColor); - typeTextView.setBorderColor(mPostTypeColor); - spoilerTextView.setBackgroundColor(mSpoilerColor); - spoilerTextView.setBorderColor(mSpoilerColor); - nsfwTextView.setBackgroundColor(mNSFWColor); - nsfwTextView.setBorderColor(mNSFWColor); - flairTextView.setBackgroundColor(mFlairColor); - flairTextView.setBorderColor(mFlairColor); - archivedImageView.setColorFilter(mArchivedTintColor, PorterDuff.Mode.SRC_IN); - lockedImageView.setColorFilter(mLockedTintColor, PorterDuff.Mode.SRC_IN); - crosspostImageView.setColorFilter(mCrosspostTintColor, PorterDuff.Mode.SRC_IN); + titleTextView.setTextColor(mPostTitleColor); + contentTextView.setTextColor(mPostContentColor); + stickiedPostImageView.setColorFilter(mStickiedPostIconTint, PorterDuff.Mode.SRC_IN); + typeTextView.setBackgroundColor(mPostTypeBackgroundColor); + typeTextView.setBorderColor(mPostTypeBackgroundColor); + typeTextView.setTextColor(mPostTypeTextColor); + spoilerTextView.setBackgroundColor(mSpoilerBackgroundColor); + spoilerTextView.setBorderColor(mSpoilerBackgroundColor); + spoilerTextView.setTextColor(mSpoilerTextColor); + nsfwTextView.setBackgroundColor(mNSFWBackgroundColor); + nsfwTextView.setBorderColor(mNSFWBackgroundColor); + 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); + progressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent)); noPreviewLinkImageView.setBackgroundColor(mNoPreviewLinkBackgroundColor); } } @@ -1723,20 +1739,27 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView constraintSet.applyTo(bottomConstraintLayout); } + itemView.setBackgroundTintList(ColorStateList.valueOf(mCardViewBackgroundColor)); postTimeTextView.setTextColor(mSecondaryTextColor); - titleTextView.setTextColor(mPrimaryTextColor); - typeTextView.setBackgroundColor(mPostTypeColor); - typeTextView.setBorderColor(mPostTypeColor); - spoilerTextView.setBackgroundColor(mSpoilerColor); - spoilerTextView.setBorderColor(mSpoilerColor); - nsfwTextView.setBackgroundColor(mNSFWColor); - nsfwTextView.setBorderColor(mNSFWColor); - flairTextView.setBackgroundColor(mFlairColor); - flairTextView.setBorderColor(mFlairColor); - archivedImageView.setColorFilter(mArchivedTintColor, PorterDuff.Mode.SRC_IN); - lockedImageView.setColorFilter(mLockedTintColor, PorterDuff.Mode.SRC_IN); - crosspostImageView.setColorFilter(mCrosspostTintColor, PorterDuff.Mode.SRC_IN); + titleTextView.setTextColor(mPostTitleColor); + stickiedPostImageView.setColorFilter(mStickiedPostIconTint, PorterDuff.Mode.SRC_IN); + typeTextView.setBackgroundColor(mPostTypeBackgroundColor); + typeTextView.setBorderColor(mPostTypeBackgroundColor); + typeTextView.setTextColor(mPostTypeTextColor); + spoilerTextView.setBackgroundColor(mSpoilerBackgroundColor); + spoilerTextView.setBorderColor(mSpoilerBackgroundColor); + spoilerTextView.setTextColor(mSpoilerTextColor); + nsfwTextView.setBackgroundColor(mNSFWBackgroundColor); + nsfwTextView.setBorderColor(mNSFWBackgroundColor); + 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); + progressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent)); noPreviewLinkImageView.setBackgroundColor(mNoPreviewLinkBackgroundColor); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/RulesRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/RulesRecyclerViewAdapter.java index 80e246d6..5d23975d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/RulesRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/RulesRecyclerViewAdapter.java @@ -60,9 +60,8 @@ public class RulesRecyclerViewAdapter extends RecyclerView.Adapter<RulesRecycler ) ) .build(); - int themeType = customThemeWrapper.getThemeType(); - mPrimaryTextColor = customThemeWrapper.getPrimaryTextColor(themeType); - mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor(themeType); + mPrimaryTextColor = customThemeWrapper.getPrimaryTextColor(); + mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor(); } @NonNull diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/SubredditListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/SubredditListingRecyclerViewAdapter.java index 0ee42625..0ad06f02 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/SubredditListingRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/SubredditListingRecyclerViewAdapter.java @@ -81,13 +81,12 @@ public class SubredditListingRecyclerViewAdapter extends PagedListAdapter<Subred this.redditDataRoomDatabase = redditDataRoomDatabase; this.callback = callback; glide = Glide.with(context.getApplicationContext()); - int themeType = customThemeWrapper.getThemeType(); - colorPrimaryLightTheme = customThemeWrapper.getColorPrimaryLightTheme(themeType); - primaryTextColor = customThemeWrapper.getPrimaryTextColor(themeType); - secondaryTextColor = customThemeWrapper.getSecondaryTextColor(themeType); - colorAccent = customThemeWrapper.getColorAccent(themeType); - buttonTextColor = customThemeWrapper.getButtonTextColor(themeType); - unsubscribed = customThemeWrapper.getUnsubscribed(themeType); + colorPrimaryLightTheme = customThemeWrapper.getColorPrimaryLightTheme(); + primaryTextColor = customThemeWrapper.getPrimaryTextColor(); + secondaryTextColor = customThemeWrapper.getSecondaryTextColor(); + colorAccent = customThemeWrapper.getColorAccent(); + buttonTextColor = customThemeWrapper.getButtonTextColor(); + unsubscribed = customThemeWrapper.getUnsubscribed(); } @NonNull diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/SubredditMultiselectionRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/SubredditMultiselectionRecyclerViewAdapter.java index 477648af..63116bdb 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/SubredditMultiselectionRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/SubredditMultiselectionRecyclerViewAdapter.java @@ -62,9 +62,8 @@ public class SubredditMultiselectionRecyclerViewAdapter extends RecyclerView.Ada this.otherSubreddits.addAll(otherSubreddits); } - int themeType = customThemeWrapper.getThemeType(); - primaryTextColor = customThemeWrapper.getPrimaryTextColor(themeType); - colorAccent = customThemeWrapper.getColorAccent(themeType); + primaryTextColor = customThemeWrapper.getPrimaryTextColor(); + colorAccent = customThemeWrapper.getColorAccent(); } @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/SubscribedSubredditsRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/SubscribedSubredditsRecyclerViewAdapter.java index 9b9bdc92..a9500914 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/SubscribedSubredditsRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/SubscribedSubredditsRecyclerViewAdapter.java @@ -61,9 +61,8 @@ public class SubscribedSubredditsRecyclerViewAdapter extends RecyclerView.Adapte mOauthRetrofit = oauthRetrofit; mRedditDataRoomDatabase = redditDataRoomDatabase; this.accessToken = accessToken; - int themeType = customThemeWrapper.getThemeType(); - primaryTextColor = customThemeWrapper.getPrimaryTextColor(themeType); - secondaryTextColor = customThemeWrapper.getSecondaryTextColor(themeType); + primaryTextColor = customThemeWrapper.getPrimaryTextColor(); + secondaryTextColor = customThemeWrapper.getSecondaryTextColor(); } public SubscribedSubredditsRecyclerViewAdapter(Context context, Retrofit oauthRetrofit, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/UserListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/UserListingRecyclerViewAdapter.java index cf6771c0..f9c2cf35 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/UserListingRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/UserListingRecyclerViewAdapter.java @@ -82,12 +82,11 @@ public class UserListingRecyclerViewAdapter extends PagedListAdapter<UserData, R this.subscribedUserDao = subscribedUserDao; this.retryLoadingMoreCallback = retryLoadingMoreCallback; glide = Glide.with(context.getApplicationContext()); - int themeType = customThemeWrapper.getThemeType(); - primaryTextColor = customThemeWrapper.getPrimaryTextColor(themeType); - buttonTextColor = customThemeWrapper.getButtonTextColor(themeType); - colorPrimaryLightTheme = customThemeWrapper.getColorPrimaryLightTheme(themeType); - colorAccent = customThemeWrapper.getColorAccent(themeType); - unsubscribedColor = customThemeWrapper.getUnsubscribed(themeType); + primaryTextColor = customThemeWrapper.getPrimaryTextColor(); + buttonTextColor = customThemeWrapper.getButtonTextColor(); + colorPrimaryLightTheme = customThemeWrapper.getColorPrimaryLightTheme(); + colorAccent = customThemeWrapper.getColorAccent(); + unsubscribedColor = customThemeWrapper.getUnsubscribed(); } @NonNull diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java index efe1a48a..15f81b12 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java @@ -44,6 +44,7 @@ import ml.docilealligator.infinityforreddit.Fragment.SubscribedSubredditsListing import ml.docilealligator.infinityforreddit.Fragment.UserListingFragment; import ml.docilealligator.infinityforreddit.Service.SubmitPostService; import ml.docilealligator.infinityforreddit.Settings.GesturesAndButtonsPreferenceFragment; +import ml.docilealligator.infinityforreddit.Settings.InterfacePreferenceFragment; import ml.docilealligator.infinityforreddit.Settings.MainPreferenceFragment; import ml.docilealligator.infinityforreddit.Settings.NotificationPreferenceFragment; @@ -137,4 +138,6 @@ public interface AppComponent { void inject(CreateMultiRedditActivity createMultiRedditActivity); void inject(SubredditMultiselectionActivity subredditMultiselectionActivity); + + void inject(InterfacePreferenceFragment interfacePreferenceFragment); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeWrapper.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeWrapper.java index eae935a1..853ea446 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeWrapper.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeWrapper.java @@ -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.DARK; -import static ml.docilealligator.infinityforreddit.Utils.CustomThemeSharedPreferencesUtils.NORMAL; public class CustomThemeWrapper { private SharedPreferences themeSharedPreferences; + private int themeType; public CustomThemeWrapper(SharedPreferences 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) { case DARK: return Color.parseColor(darkHex); @@ -27,287 +27,310 @@ public class CustomThemeWrapper { } } - public int getThemeType() { - return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.THEME_TYPE_KEY, NORMAL); + public void setThemeType(int themeType) { + 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, - getDefaultColor(themeType, "#1565C0", "#242424", "#000000")); + getDefaultColor("#1565C0", "#242424", "#000000")); } - public int getColorPrimaryDark(int themeType) { + public int getColorPrimaryDark() { 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, - 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, - getDefaultColor(themeType, "#1565C0", "#1565C0", "#1565C0")); + getDefaultColor("#1565C0", "#1565C0", "#1565C0")); } - public int getPostTitleColor(int themeType) { + public int getPostTitleColor() { 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, - getDefaultColor(themeType, "#8A000000", "#B3FFFFFF", "#B3FFFFFF")); + getDefaultColor("#8A000000", "#B3FFFFFF", "#B3FFFFFF")); } - public int getCommentColor(int themeType) { + public int getCommentColor() { 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, - getDefaultColor(themeType, "#000000", "#FFFFFF", "#FFFFFF")); + getDefaultColor("#000000", "#FFFFFF", "#FFFFFF")); } - public int getSecondaryTextColor(int themeType) { + public int getSecondaryTextColor() { 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, - getDefaultColor(themeType, "#FFFFFF", "#FFFFFF", "#FFFFFF")); + getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF")); } - public int getBackgroundColor(int themeType) { + public int getBackgroundColor() { return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.BACKGROUND_COLOR, - getDefaultColor(themeType, "#FFFFFF", "#121212", "#000000")); + getDefaultColor("#FFFFFF", "#121212", "#000000")); } - public int getRoundedBottomSheetPrimaryBackground(int themeType) { - return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.ROUNDED_BOTTOM_SHEET_PRIMARY_BACKGROUND, - getDefaultColor(themeType, "#FFFFFF", "#242424", "#000000")); - } - - public int getCardViewBackgroundColor(int themeType) { + public int getCardViewBackgroundColor() { 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, - 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, - 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, - 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, - 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, - 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, - 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, - 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, - 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, - 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, - getDefaultColor(themeType, "#FFFFFF", "#FFFFFF", "#FFFFFF")); + getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF")); } - public int getNavBarColor(int themeType) { + public int getNavBarColor() { 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, - getDefaultColor(themeType, "#E91E63", "#E91E63", "#E91E63")); + getDefaultColor("#E91E63", "#E91E63", "#E91E63")); } - public int getDownvoted(int themeType) { + public int getDownvoted() { return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.DOWNVOTED, - getDefaultColor(themeType, "#007DDE", "#007DDE", "#007DDE")); + getDefaultColor("#007DDE", "#007DDE", "#007DDE")); + } + + public int getPostTypeBackgroundColor() { + return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.POST_TYPE_BACKGROUND_COLOR, + getDefaultColor("#0D47A1", "#1565C0", "#1565C0")); + } + + public int getPostTypeTextColor() { + return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.POST_TYPE_TEXT_COLOR, + getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF")); + } + + public int getSpoilerBackgroundColor() { + return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.SPOILER_BACKGROUND_COLOR, + getDefaultColor("#EE02EB", "#EE02EB", "#EE02EB")); + } + + public int getSpoilerTextColor() { + return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.SPOILER_TEXT_COLOR, + getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF")); } - public int getPostType(int themeType) { - return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.POST_TYPE, - getDefaultColor(themeType, "#0D47A1", "#1565C0", "#1565C0")); + public int getNsfwBackgroundColor() { + return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.NSFW_BACKGROUND_COLOR, + getDefaultColor("#FF4081", "#FF4081", "#FF4081")); } - public int getSpoilerColor(int themeType) { - return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.SPOILER_COLOR, - getDefaultColor(themeType, "#EE02EB", "#EE02EB", "#EE02EB")); + public int getNsfwTextColor() { + return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.NSFW_TEXT_COLOR, + getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF")); } - public int getNsfwColor(int themeType) { - return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.NSFW_COLOR, - getDefaultColor(themeType, "#FF4081", "#FF4081", "#FF4081")); + public int getFlairBackgroundColor() { + return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.FLAIR_BACKGROUND_COLOR, + getDefaultColor("#00AA8C", "#00AA8C", "#00AA8C")); } - public int getFlairColor(int themeType) { - return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.FLAIR_COLOR, - getDefaultColor(themeType, "#00AA8C", "#00AA8C", "#00AA8C")); + public int getFlairTextColor() { + return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.FLAIR_TEXT_COLOR, + getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF")); } - public int getArchivedTint(int themeType) { + public int getArchivedTint() { 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, - getDefaultColor(themeType, "#EE7302", "#EE7302", "#EE7302")); + getDefaultColor("#EE7302", "#EE7302", "#EE7302")); } - public int getCrosspost(int themeType) { - return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.CROSSPOST, - getDefaultColor(themeType, "#FF4081", "#FF4081", "#FF4081")); + public int getCrosspostIconTint() { + return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.CROSSPOST_ICON_TINT, + getDefaultColor("#FF4081", "#FF4081", "#FF4081")); } - public int getStickiedPost(int themeType) { - return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.STICKIED_POST, - getDefaultColor(themeType, "#0D47A1", "#1565C0", "#1565C0")); + public int getStickiedPostIconTint() { + return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.STICKIED_POST_ICON_TINT, + getDefaultColor("#0D47A1", "#1565C0", "#1565C0")); } - public int getSubscribed(int themeType) { + public int getSubscribed() { 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, - getDefaultColor(themeType, "#0D47A1", "#1565C0", "#1565C0")); + getDefaultColor("#0D47A1", "#1565C0", "#1565C0")); } - public int getUsername(int themeType) { + public int getUsername() { 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, - 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, - getDefaultColor(themeType, "#EE02C4", "#EE02C4", "#EE02C4")); + getDefaultColor("#EE02C4", "#EE02C4", "#EE02C4")); } - public int getSubmitter(int themeType) { + public int getSubmitter() { 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, - getDefaultColor(themeType, "#00BA81", "#00BA81", "#00BA81")); + getDefaultColor("#00BA81", "#00BA81", "#00BA81")); } - public int getNotificationIconColor(int themeType) { + public int getNotificationIconColor() { 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, - 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, - getDefaultColor(themeType, "#B3E5F9", "#123E77", "#123E77")); + getDefaultColor("#B3E5F9", "#123E77", "#123E77")); } - public int getDividerColor(int themeType) { + public int getDividerColor() { 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, - 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, - 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, - 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, - 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, - 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, - 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, - 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, - 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, - getDefaultColor(themeType, "#EE4602", "#EE4602", "#EE4602")); + getDefaultColor("#EE4602", "#EE4602", "#EE4602")); } - public int getFABIconColor(int themeType) { + public int getFABIconColor() { 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, - getDefaultColor(themeType, "#FFFFFF", "#FFFFFF", "#FFFFFF")); + getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF")); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/CommentsListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/CommentsListingFragment.java index 44e24f86..5b1b8359 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/CommentsListingFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/CommentsListingFragment.java @@ -246,10 +246,9 @@ public class CommentsListingFragment extends Fragment implements FragmentCommuni @Override public void applyTheme() { - int themeType = customThemeWrapper.getThemeType(); - mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(customThemeWrapper.getCardViewBackgroundColor(themeType)); - mSwipeRefreshLayout.setColorSchemeColors(customThemeWrapper.getColorAccent(themeType)); - mFetchCommentInfoTextView.setTextColor(customThemeWrapper.getSecondaryTextColor(themeType)); + mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(customThemeWrapper.getCircularProgressBarBackground()); + mSwipeRefreshLayout.setColorSchemeColors(customThemeWrapper.getColorAccent()); + mFetchCommentInfoTextView.setTextColor(customThemeWrapper.getSecondaryTextColor()); } private void showErrorView(int stringResId) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/FollowedUsersListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/FollowedUsersListingFragment.java index a57545fa..acee318a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/FollowedUsersListingFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/FollowedUsersListingFragment.java @@ -153,14 +153,13 @@ public class FollowedUsersListingFragment extends Fragment implements FragmentCo @Override public void applyTheme() { - int themeType = customThemeWrapper.getThemeType(); if (mActivity instanceof SubscribedThingListingActivity) { mSwipeRefreshLayout.setOnRefreshListener(() -> ((SubscribedThingListingActivity) mActivity).loadSubscriptions(true)); - mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(customThemeWrapper.getCardViewBackgroundColor(themeType)); - mSwipeRefreshLayout.setColorSchemeColors(customThemeWrapper.getColorAccent(themeType)); + mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(customThemeWrapper.getCircularProgressBarBackground()); + mSwipeRefreshLayout.setColorSchemeColors(customThemeWrapper.getColorAccent()); } else { mSwipeRefreshLayout.setEnabled(false); } - mErrorTextView.setTextColor(customThemeWrapper.getSecondaryTextColor(themeType)); + mErrorTextView.setTextColor(customThemeWrapper.getSecondaryTextColor()); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java index 8fdffdd1..40b10116 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java @@ -11,7 +11,6 @@ import android.os.Build; import android.os.Bundle; import android.os.CountDownTimer; import android.os.Handler; -import android.util.Log; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; @@ -72,7 +71,6 @@ import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; import ml.docilealligator.infinityforreddit.SortType; import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; -import ml.docilealligator.infinityforreddit.Utils.Utils; import retrofit2.Retrofit; @@ -731,10 +729,9 @@ public class PostFragment extends Fragment implements FragmentCommunicator { @Override public void applyTheme() { - int themeType = customThemeWrapper.getThemeType(); - mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(customThemeWrapper.getCardViewBackgroundColor(themeType)); - mSwipeRefreshLayout.setColorSchemeColors(customThemeWrapper.getColorAccent(themeType)); - mFetchPostInfoTextView.setTextColor(customThemeWrapper.getSecondaryTextColor(themeType)); + mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(customThemeWrapper.getCircularProgressBarBackground()); + mSwipeRefreshLayout.setColorSchemeColors(customThemeWrapper.getColorAccent()); + mFetchPostInfoTextView.setTextColor(customThemeWrapper.getSecondaryTextColor()); } @Subscribe diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SubredditListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SubredditListingFragment.java index 21842828..1b0f3401 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SubredditListingFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SubredditListingFragment.java @@ -214,9 +214,8 @@ public class SubredditListingFragment extends Fragment implements FragmentCommun @Override public void applyTheme() { - int themeType = customThemeWrapper.getThemeType(); - mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(customThemeWrapper.getCardViewBackgroundColor(themeType)); - mSwipeRefreshLayout.setColorSchemeColors(customThemeWrapper.getColorAccent(themeType)); - mFetchSubredditListingInfoTextView.setTextColor(customThemeWrapper.getSecondaryTextColor(themeType)); + mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(customThemeWrapper.getCircularProgressBarBackground()); + mSwipeRefreshLayout.setColorSchemeColors(customThemeWrapper.getColorAccent()); + mFetchSubredditListingInfoTextView.setTextColor(customThemeWrapper.getSecondaryTextColor()); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SubscribedSubredditsListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SubscribedSubredditsListingFragment.java index d5ca7545..42477f2c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SubscribedSubredditsListingFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SubscribedSubredditsListingFragment.java @@ -171,10 +171,9 @@ public class SubscribedSubredditsListingFragment extends Fragment implements Fra public void applyTheme() { if (mActivity instanceof SubscribedThingListingActivity) { mSwipeRefreshLayout.setOnRefreshListener(() -> ((SubscribedThingListingActivity) mActivity).loadSubscriptions(true)); - int themeType = customThemeWrapper.getThemeType(); - mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(customThemeWrapper.getCardViewBackgroundColor(themeType)); - mSwipeRefreshLayout.setColorSchemeColors(customThemeWrapper.getColorAccent(themeType)); - mErrorTextView.setTextColor(customThemeWrapper.getSecondaryTextColor(themeType)); + mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(customThemeWrapper.getCircularProgressBarBackground()); + mSwipeRefreshLayout.setColorSchemeColors(customThemeWrapper.getColorAccent()); + mErrorTextView.setTextColor(customThemeWrapper.getSecondaryTextColor()); } else { mSwipeRefreshLayout.setEnabled(false); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/UserListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/UserListingFragment.java index 311a7e56..07430235 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/UserListingFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/UserListingFragment.java @@ -194,9 +194,8 @@ public class UserListingFragment extends Fragment implements FragmentCommunicato @Override public void applyTheme() { - int themeType = customThemeWrapper.getThemeType(); - mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(customThemeWrapper.getCardViewBackgroundColor(themeType)); - mSwipeRefreshLayout.setColorSchemeColors(customThemeWrapper.getColorAccent(themeType)); - mFetchUserListingInfoTextView.setTextColor(customThemeWrapper.getSecondaryTextColor(themeType)); + mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(customThemeWrapper.getCircularProgressBarBackground()); + mSwipeRefreshLayout.setColorSchemeColors(customThemeWrapper.getColorAccent()); + mFetchUserListingInfoTextView.setTextColor(customThemeWrapper.getSecondaryTextColor()); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java index 97bd4bfa..311c88c6 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java @@ -63,7 +63,7 @@ public class PullNotificationWorker extends Worker { public Result doWork() { try { List<Account> accounts = mRedditDataRoomDatabase.accountDao().getAllAccounts(); - int color = mCustomThemeWrapper.getNotificationIconColor(mCustomThemeWrapper.getThemeType()); + int color = mCustomThemeWrapper.getNotificationIconColor(); for (int accountIndex = 0; accountIndex < accounts.size(); accountIndex++) { Account account = accounts.get(accountIndex); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Service/SubmitPostService.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Service/SubmitPostService.java index 88798143..cc851e99 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Service/SubmitPostService.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Service/SubmitPostService.java @@ -130,7 +130,7 @@ public class SubmitPostService extends Service { .setContentTitle(getString(stringResId)) .setContentText(getString(R.string.please_wait)) .setSmallIcon(R.drawable.ic_notification) - .setColor(mCustomThemeWrapper.getNotificationIconColor(mCustomThemeWrapper.getThemeType())) + .setColor(mCustomThemeWrapper.getNotificationIconColor()) .build(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/InterfacePreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/InterfacePreferenceFragment.java index 78634adf..5a4d0b4f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/InterfacePreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/InterfacePreferenceFragment.java @@ -16,13 +16,18 @@ import androidx.preference.SwitchPreference; 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.ChangeShowAbsoluteNumberOfVotesEvent; import ml.docilealligator.infinityforreddit.Event.ChangeShowElapsedTimeEvent; import ml.docilealligator.infinityforreddit.Event.ChangeVoteButtonsPositionEvent; import ml.docilealligator.infinityforreddit.Event.RecreateActivityEvent; import ml.docilealligator.infinityforreddit.Event.ShowDividerInCompactLayoutPreferenceEvent; +import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.Utils.CustomThemeSharedPreferencesUtils; import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; 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 { private Activity activity; + @Inject + CustomThemeWrapper customThemeWrapper; @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { setPreferencesFromResource(R.xml.interface_preference, rootKey); + ((Infinity) activity.getApplication()).getAppComponent().inject(this); + ListPreference themePreference = findPreference(SharedPreferencesUtils.THEME_KEY); SwitchPreference amoledDarkSwitch = findPreference(SharedPreferencesUtils.AMOLED_DARK_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; - if (themePreference != null) { + if (themePreference != null && amoledDarkSwitch != null) { if (systemDefault) { themePreference.setEntries(R.array.settings_theme_q); } else { @@ -65,9 +74,15 @@ public class InterfacePreferenceFragment extends PreferenceFragmentCompat { switch (option) { case 0: AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO); + customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.NORMAL); break; case 1: AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES); + if (amoledDarkSwitch.isChecked()) { + customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.AMOLED_DARK); + } else { + customThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.DARK); + } break; case 2: if (systemDefault) { @@ -75,6 +90,16 @@ public class InterfacePreferenceFragment extends PreferenceFragmentCompat { } else { 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; }); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/CustomThemeSharedPreferencesUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/CustomThemeSharedPreferencesUtils.java index 6bca6a51..2bed1bb6 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/CustomThemeSharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/CustomThemeSharedPreferencesUtils.java @@ -4,8 +4,9 @@ public class CustomThemeSharedPreferencesUtils { public static final int NORMAL = 0; public static final int DARK = 1; 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 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_DARK = "colorPrimaryDark"; 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 SECONDARY_TEXT_COLOR = "secondaryTextColor"; 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 ROUNDED_BOTTOM_SHEET_PRIMARY_BACKGROUND = "roundedBottomSheetPrimaryBackground"; public static final String CARD_VIEW_BACKGROUND_COLOR = "cardViewBackgroundColor"; public static final String COMMENT_BACKGROUND_COLOR = "commentBackgroundColor"; 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 UPVOTED = "upvoted"; public static final String DOWNVOTED = "downvoted"; - public static final String POST_TYPE = "postType"; - public static final String SPOILER_COLOR = "spoilerColor"; - public static final String NSFW_COLOR = "nsfwColor"; - public static final String FLAIR_COLOR = "flairColor"; + public static final String POST_TYPE_BACKGROUND_COLOR = "postTypeBackgroundColor"; + public static final String POST_TYPE_TEXT_COLOR = "postTypeTextColor"; + public static final String SPOILER_BACKGROUND_COLOR = "spoilerBackgroundColor"; + 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 LOCKED_ICON_TINT = "lockedIconTint"; - public static final String CROSSPOST = "crosspost"; - public static final String STICKIED_POST = "stickiedPost"; + public static final String CROSSPOST_ICON_TINT = "crosspostIconTint"; + public static final String STICKIED_POST_ICON_TINT = "stickiedPost"; public static final String SUBSCRIBED = "subscribed"; public static final String UNSUBSCRIBED = "unsubscribed"; public static final String USERNAME = "username"; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/Utils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/Utils.java index 1a40911b..552f8515 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/Utils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/Utils.java @@ -73,10 +73,4 @@ public class Utils { 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; - }*/ } diff --git a/app/src/main/res/drawable/ic_outline_add_a_photo_24px.xml b/app/src/main/res/drawable/ic_outline_add_a_photo_24dp.xml index 98c1ac80..98c1ac80 100644 --- a/app/src/main/res/drawable/ic_outline_add_a_photo_24px.xml +++ b/app/src/main/res/drawable/ic_outline_add_a_photo_24dp.xml diff --git a/app/src/main/res/drawable/ic_outline_select_photo_24px.xml b/app/src/main/res/drawable/ic_outline_select_photo_24dp.xml index 9551f621..9551f621 100644 --- a/app/src/main/res/drawable/ic_outline_select_photo_24px.xml +++ b/app/src/main/res/drawable/ic_outline_select_photo_24dp.xml diff --git a/app/src/main/res/layout/activity_post_image.xml b/app/src/main/res/layout/activity_post_image.xml index e49c9179..e73a08be 100644 --- a/app/src/main/res/layout/activity_post_image.xml +++ b/app/src/main/res/layout/activity_post_image.xml @@ -171,7 +171,7 @@ android:id="@+id/capture_fab_post_image_activity" android:layout_width="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_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" @@ -184,7 +184,7 @@ android:id="@+id/select_from_library_fab_post_image_activity" android:layout_width="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_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@+id/capture_fab_post_image_activity" diff --git a/app/src/main/res/layout/activity_post_video.xml b/app/src/main/res/layout/activity_post_video.xml index dd51f10e..2b322dcf 100644 --- a/app/src/main/res/layout/activity_post_video.xml +++ b/app/src/main/res/layout/activity_post_video.xml @@ -171,7 +171,7 @@ android:id="@+id/capture_fab_post_video_activity" android:layout_width="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_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" @@ -184,7 +184,7 @@ android:id="@+id/select_from_library_fab_post_video_activity" android:layout_width="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_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@+id/capture_fab_post_video_activity" diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 7055c73a..053435ec 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -108,7 +108,7 @@ <style name="FontStyle" /> - <style name="FontStyle.Small"> + <style name="FontStyle.Small" parent="TextAppearance.AppCompat.Body1"> <item name="font_default">12sp</item> <item name="font_10">10sp</item> <item name="font_12">12sp</item> |