diff options
author | Alex Ning <chineseperson5@gmail.com> | 2020-03-19 04:20:23 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2020-03-19 04:20:23 +0000 |
commit | 012736bff62005c8c61f5844529fc5216af1e885 (patch) | |
tree | 61b483701631faabd73693483be9fff098042244 /app | |
parent | 71e22b3e364c75400ef380df1d53a83f9dbd3a1b (diff) | |
download | infinity-for-reddit-012736bff62005c8c61f5844529fc5216af1e885.tar infinity-for-reddit-012736bff62005c8c61f5844529fc5216af1e885.tar.gz infinity-for-reddit-012736bff62005c8c61f5844529fc5216af1e885.tar.bz2 infinity-for-reddit-012736bff62005c8c61f5844529fc5216af1e885.tar.lz infinity-for-reddit-012736bff62005c8c61f5844529fc5216af1e885.tar.xz infinity-for-reddit-012736bff62005c8c61f5844529fc5216af1e885.tar.zst infinity-for-reddit-012736bff62005c8c61f5844529fc5216af1e885.zip |
Start implementing custom theme settings.
Diffstat (limited to '')
29 files changed, 952 insertions, 42 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index e3283575..b13132c7 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -21,11 +21,14 @@ android:theme="@style/AppTheme" android:usesCleartextTraffic="true" tools:replace="android:label"> + <activity android:name=".Activity.CustomizeThemeActivity" + android:parentActivityName=".Activity.MainActivity" + android:theme="@style/AppTheme.NoActionBar" /> <activity android:name=".Activity.SubredditMultiselectionActivity" android:label="@string/subreddit_multiselection_activity_label" android:parentActivityName=".Activity.MainActivity" - android:theme="@style/AppTheme.NoActionBar"/> + android:theme="@style/AppTheme.NoActionBar" /> <activity android:name=".Activity.CreateMultiRedditActivity" android:label="@string/create_multi_reddit_activity_label" 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 3849e5f0..e1f87b21 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java @@ -230,7 +230,7 @@ public abstract class BaseActivity extends AppCompatActivity { } protected void applyAppBarLayoutAndToolbarTheme(AppBarLayout appBarLayout, Toolbar toolbar) { - appBarLayout.setBackgroundColor(customThemeWrapper.getToolbarAndTabBackgroundColor()); + appBarLayout.setBackgroundColor(customThemeWrapper.getColorPrimary()); toolbar.setTitleTextColor(customThemeWrapper.getToolbarPrimaryTextAndIconColor()); if (toolbar.getNavigationIcon() != null) { toolbar.getNavigationIcon().setColorFilter(customThemeWrapper.getToolbarPrimaryTextAndIconColor(), android.graphics.PorterDuff.Mode.SRC_IN); @@ -259,7 +259,7 @@ public abstract class BaseActivity extends AppCompatActivity { } protected void applyTabLayoutTheme(TabLayout tabLayout) { - int toolbarAndTabBackgroundColor = customThemeWrapper.getToolbarAndTabBackgroundColor(); + int toolbarAndTabBackgroundColor = customThemeWrapper.getColorPrimary(); tabLayout.setBackgroundColor(toolbarAndTabBackgroundColor); tabLayout.setSelectedTabIndicatorColor(customThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTabIndicator()); tabLayout.setTabTextColors(customThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTextColor(), diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CustomizeThemeActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CustomizeThemeActivity.java new file mode 100644 index 00000000..530d947a --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CustomizeThemeActivity.java @@ -0,0 +1,125 @@ +package ml.docilealligator.infinityforreddit.Activity; + +import android.content.SharedPreferences; +import android.os.Build; +import android.os.Bundle; + +import androidx.appcompat.widget.Toolbar; +import androidx.lifecycle.LiveData; +import androidx.lifecycle.Observer; +import androidx.lifecycle.ViewModelProvider; +import androidx.recyclerview.widget.RecyclerView; + +import com.google.android.material.appbar.AppBarLayout; + +import java.util.ArrayList; + +import javax.inject.Inject; +import javax.inject.Named; + +import butterknife.BindView; +import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.Adapter.CustomizeThemeRecyclerViewAdapter; +import ml.docilealligator.infinityforreddit.CustomTheme.CustomTheme; +import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeSettingsItem; +import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeViewModel; +import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; + +public class CustomizeThemeActivity extends BaseActivity { + + public static final String EXTRA_THEME_TYPE = "ETT"; + public static final int EXTRA_LIGHT_THEME = 0; + public static final int EXTRA_DARK_THEME = 1; + public static final int EXTRA_AMOLED_THEME = 2; + + @BindView(R.id.appbar_layout_customize_theme_activity) + AppBarLayout appBarLayout; + @BindView(R.id.toolbar_customize_theme_activity) + Toolbar toolbar; + @BindView(R.id.recycler_view_customize_theme_activity) + RecyclerView recyclerView; + @Inject + @Named("default") + SharedPreferences sharedPreferences; + @Inject + RedditDataRoomDatabase redditDataRoomDatabase; + @Inject + CustomThemeWrapper customThemeWrapper; + + public CustomThemeViewModel customThemeViewModel; + private CustomizeThemeRecyclerViewAdapter adapter; + private int themeType; + + @Override + protected void onCreate(Bundle savedInstanceState) { + ((Infinity) getApplication()).getAppComponent().inject(this); + + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_customize_theme); + + ButterKnife.bind(this); + + applyCustomTheme(); + + themeType = getIntent().getIntExtra(EXTRA_THEME_TYPE, EXTRA_LIGHT_THEME); + + setSupportActionBar(toolbar); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + + adapter = new CustomizeThemeRecyclerViewAdapter(); + + customThemeViewModel = new ViewModelProvider(this, new CustomThemeViewModel.Factory(redditDataRoomDatabase)) + .get(CustomThemeViewModel.class); + + LiveData<CustomTheme> customThemeLiveData; + switch (themeType) { + case EXTRA_DARK_THEME: + toolbar.setTitle(getString(R.string.customize_dark_theme_fragment_title)); + customThemeLiveData = customThemeViewModel.getDarkCustomTheme(); + break; + case EXTRA_AMOLED_THEME: + toolbar.setTitle(getString(R.string.customize_amoled_theme_fragment_title)); + customThemeLiveData = customThemeViewModel.getAmoledCustomTheme(); + break; + default: + toolbar.setTitle(getString(R.string.customize_light_theme_fragment_title)); + customThemeLiveData = customThemeViewModel.getLightCustomTheme(); + break; + } + + int androidVersion = Build.VERSION.SDK_INT; + customThemeLiveData.observe(this, new Observer<CustomTheme>() { + @Override + public void onChanged(CustomTheme customTheme) { + ArrayList<CustomThemeSettingsItem> customThemeSettingsItems = + CustomThemeSettingsItem.convertCustomTheme(CustomizeThemeActivity.this, customTheme); + if (androidVersion < Build.VERSION_CODES.O) { + customThemeSettingsItems.get(customThemeSettingsItems.size() - 2).itemDetails = getString(R.string.theme_item_available_on_android_8); + } + if (androidVersion < Build.VERSION_CODES.M) { + customThemeSettingsItems.get(customThemeSettingsItems.size() - 3).itemDetails = getString(R.string.theme_item_available_on_android_6); + } + + adapter.setCustomThemeSettingsItem(customThemeSettingsItems); + } + }); + } + + @Override + protected SharedPreferences getSharedPreferences() { + return sharedPreferences; + } + + @Override + protected CustomThemeWrapper getCustomThemeWrapper() { + return customThemeWrapper; + } + + @Override + protected void applyCustomTheme() { + applyAppBarLayoutAndToolbarTheme(appBarLayout, toolbar); + } +} 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 1a678afe..c8ad39c5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SettingsActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SettingsActivity.java @@ -7,7 +7,6 @@ import android.view.MenuItem; import androidx.annotation.NonNull; import androidx.appcompat.widget.Toolbar; -import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.fragment.app.Fragment; import androidx.preference.Preference; import androidx.preference.PreferenceFragmentCompat; @@ -31,8 +30,6 @@ public class SettingsActivity extends BaseActivity implements private static final String TITLE_STATE = "TS"; - @BindView(R.id.coordinator_layout_settings_activity) - CoordinatorLayout coordinatorLayout; @BindView(R.id.appbar_layout_settings_activity) AppBarLayout appBarLayout; @BindView(R.id.toolbar_settings_activity) @@ -96,7 +93,6 @@ public class SettingsActivity extends BaseActivity implements @Override protected void applyCustomTheme() { - coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); applyAppBarLayoutAndToolbarTheme(appBarLayout, toolbar); } 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 75564f05..7b89c940 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java @@ -303,7 +303,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy mSpoilerTextColor = customThemeWrapper.getSpoilerTextColor(); mNSFWBackgroundColor = customThemeWrapper.getNsfwBackgroundColor(); mNSFWTextColor = customThemeWrapper.getNsfwTextColor(); - mArchivedTintColor = customThemeWrapper.getArchivedTint(); + mArchivedTintColor = customThemeWrapper.getArchivedIconTint(); mLockedTintColor = customThemeWrapper.getLockedIconTint(); mCrosspostTintColor = customThemeWrapper.getCrosspostIconTint(); mNoPreviewLinkBackgroundColor = customThemeWrapper.getNoPreviewLinkBackgroundColor(); @@ -321,7 +321,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy mCommentVerticalBarColor6 = customThemeWrapper.getCommentVerticalBarColor6(); mCommentVerticalBarColor7 = customThemeWrapper.getCommentVerticalBarColor7(); mSingleCommentThreadBackgroundColor = customThemeWrapper.getSingleCommentThreadBackgroundColor(); - mVoteAndReplyUnavailableVoteButtonColor = customThemeWrapper.getVoteAndReplyUnavailableVoteButtonColor(); + mVoteAndReplyUnavailableVoteButtonColor = customThemeWrapper.getVoteAndReplyUnavailableButtonColor(); mButtonTextColor = customThemeWrapper.getButtonTextColor(); mPostIconAndInfoColor = customThemeWrapper.getPostIconAndInfoColor(); mCommentIconAndInfoColor = customThemeWrapper.getCommentIconAndInfoColor(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CustomizeThemeRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CustomizeThemeRecyclerViewAdapter.java new file mode 100644 index 00000000..5bb55eea --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CustomizeThemeRecyclerViewAdapter.java @@ -0,0 +1,107 @@ +package ml.docilealligator.infinityforreddit.Adapter; + +import android.content.res.ColorStateList; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Switch; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import java.util.ArrayList; + +import butterknife.BindView; +import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeSettingsItem; +import ml.docilealligator.infinityforreddit.R; + +public class CustomizeThemeRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { + private static final int VIEW_TYPE_COLOR = 1; + private static final int VIEW_TYPE_SWITCH = 2; + private ArrayList<CustomThemeSettingsItem> customThemeSettingsItems; + + public CustomizeThemeRecyclerViewAdapter() { + customThemeSettingsItems = new ArrayList<>(); + } + + @Override + public int getItemViewType(int position) { + if (position < customThemeSettingsItems.size() - 3) { + return VIEW_TYPE_COLOR; + } + + return VIEW_TYPE_SWITCH; + } + + @NonNull + @Override + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + if (viewType == VIEW_TYPE_SWITCH) { + return new ThemeSwitchItemViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_theme_color_item, parent, false)); + } + + return new ThemeColorItemViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_theme_color_item, parent, false)); + } + + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { + if (holder instanceof ThemeColorItemViewHolder) { + CustomThemeSettingsItem customThemeSettingsItem = customThemeSettingsItems.get(position); + ((ThemeColorItemViewHolder) holder).themeItemNameTextView.setText(customThemeSettingsItem.itemName); + ((ThemeColorItemViewHolder) holder).themeItemInfoTextView.setText(customThemeSettingsItem.itemDetails); + ((ThemeColorItemViewHolder) holder).colorImageView.setBackgroundTintList(ColorStateList.valueOf(customThemeSettingsItem.colorValue)); + holder.itemView.setOnClickListener(view -> { + + }); + } else if (holder instanceof ThemeSwitchItemViewHolder) { + CustomThemeSettingsItem customThemeSettingsItem = customThemeSettingsItems.get(position); + ((ThemeSwitchItemViewHolder) holder).themeItemNameTextView.setText(customThemeSettingsItem.itemName); + ((ThemeSwitchItemViewHolder) holder).themeItemInfoTextView.setText(customThemeSettingsItem.itemName); + ((ThemeSwitchItemViewHolder) holder).themeItemSwitch.setChecked(customThemeSettingsItem.isEnabled); + ((ThemeSwitchItemViewHolder) holder).themeItemSwitch.setOnClickListener(view -> customThemeSettingsItem.isEnabled = ((ThemeSwitchItemViewHolder) holder).themeItemSwitch.isChecked()); + holder.itemView.setOnClickListener(view -> ((ThemeSwitchItemViewHolder) holder).themeItemSwitch.performClick()); + } + } + + @Override + public int getItemCount() { + return customThemeSettingsItems.size(); + } + + public void setCustomThemeSettingsItem(ArrayList<CustomThemeSettingsItem> customThemeSettingsItems) { + this.customThemeSettingsItems.clear(); + notifyDataSetChanged(); + this.customThemeSettingsItems.addAll(customThemeSettingsItems); + notifyDataSetChanged(); + } + + class ThemeColorItemViewHolder extends RecyclerView.ViewHolder { + @BindView(R.id.color_image_view_item_theme_color_item) + View colorImageView; + @BindView(R.id.theme_item_name_text_view_item_theme_color_item) + TextView themeItemNameTextView; + @BindView(R.id.theme_item_info_text_view_item_theme_color_item) + TextView themeItemInfoTextView; + + ThemeColorItemViewHolder(@NonNull View itemView) { + super(itemView); + ButterKnife.bind(this, itemView); + } + } + + class ThemeSwitchItemViewHolder extends RecyclerView.ViewHolder { + @BindView(R.id.theme_item_name_text_view_item_theme_switch_item) + TextView themeItemNameTextView; + @BindView(R.id.theme_item_info_text_view_item_theme_switch_item) + TextView themeItemInfoTextView; + @BindView(R.id.theme_item_switch_item_theme_switch_item) + Switch themeItemSwitch; + + ThemeSwitchItemViewHolder(@NonNull View itemView) { + super(itemView); + ButterKnife.bind(this, itemView); + } + } +} 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 c374282d..a5504f4a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java @@ -180,13 +180,13 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView mFlairTextColor = customThemeWrapper.getFlairTextColor(); mNSFWBackgroundColor = customThemeWrapper.getNsfwBackgroundColor(); mNSFWTextColor = customThemeWrapper.getNsfwTextColor(); - mArchivedIconTint = customThemeWrapper.getArchivedTint(); + mArchivedIconTint = customThemeWrapper.getArchivedIconTint(); mLockedIconTint = customThemeWrapper.getLockedIconTint(); mCrosspostIconTint = customThemeWrapper.getCrosspostIconTint(); mNoPreviewLinkBackgroundColor = customThemeWrapper.getNoPreviewLinkBackgroundColor(); mUpvotedColor = customThemeWrapper.getUpvoted(); mDownvotedColor = customThemeWrapper.getDownvoted(); - mVoteAndReplyUnavailableVoteButtonColor = customThemeWrapper.getVoteAndReplyUnavailableVoteButtonColor(); + mVoteAndReplyUnavailableVoteButtonColor = customThemeWrapper.getVoteAndReplyUnavailableButtonColor(); mButtonTextColor = customThemeWrapper.getButtonTextColor(); mPostIconAndInfoColor = customThemeWrapper.getPostIconAndInfoColor(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java index c5c68959..80c6c6c7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java @@ -7,6 +7,7 @@ import ml.docilealligator.infinityforreddit.Activity.AccountPostsActivity; import ml.docilealligator.infinityforreddit.Activity.AccountSavedThingActivity; import ml.docilealligator.infinityforreddit.Activity.CommentActivity; import ml.docilealligator.infinityforreddit.Activity.CreateMultiRedditActivity; +import ml.docilealligator.infinityforreddit.Activity.CustomizeThemeActivity; import ml.docilealligator.infinityforreddit.Activity.EditCommentActivity; import ml.docilealligator.infinityforreddit.Activity.EditPostActivity; import ml.docilealligator.infinityforreddit.Activity.FilteredThingActivity; @@ -140,4 +141,6 @@ public interface AppComponent { void inject(SubredditMultiselectionActivity subredditMultiselectionActivity); void inject(ThemePreferenceFragment themePreferenceFragment); + + void inject(CustomizeThemeActivity customizeThemeActivity); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomTheme.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomTheme.java index 94f4bac9..bb7da9db 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomTheme.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomTheme.java @@ -47,12 +47,14 @@ public class CustomTheme { public int bottomAppBarBackgroundColor; @ColumnInfo(name = "primary_icon_color") public int primaryIconColor; + @ColumnInfo(name = "post_icon_and_info_color") + public int postIconAndInfoColor; @ColumnInfo(name = "comment_icon_and_info_color") public int commentIconAndInfoColor; @ColumnInfo(name = "toolbar_primary_text_and_icon_color") public int toolbarPrimaryTextAndIconColor; - @ColumnInfo(name = "toolbar_and_tab_background_color") - public int toolbarAndTabBackgroundColor; + @ColumnInfo(name = "toolbar_secondary_text_color") + public int toolbarSecondaryTextColor; @ColumnInfo(name = "circular_progress_bar_background") public int circularProgressBarBackground; @ColumnInfo(name = "tab_layout_with_expanded_collapsing_toolbar_tab_background") @@ -119,8 +121,8 @@ public class CustomTheme { public int dividerColor; @ColumnInfo(name = "no_preview_link_background_color") public int noPreviewLinkBackgroundColor; - @ColumnInfo(name = "vote_and_reply_unavailable_vote_button_color") - public int voteAndReplyUnavailableVoteButtonColor; + @ColumnInfo(name = "vote_and_reply_unavailable_button_color") + public int voteAndReplyUnavailableButtonColor; @ColumnInfo(name = "comment_vertical_bar_color_1") public int commentVerticalBarColor1; @ColumnInfo(name = "comment_vertical_bar_color_2") @@ -140,11 +142,11 @@ public class CustomTheme { @ColumnInfo(name = "chip_text_color") public int chipTextColor; @ColumnInfo(name = "is_light_status_bar") - public int isLightStatusBar; + public boolean isLightStatusBar; @ColumnInfo(name = "is_light_nav_bar") - public int isLightNavBar; + public boolean isLightNavBar; @ColumnInfo(name = "is_change_status_bar_icon_color_after_toolbar_collapsed_in_immersive_interface") - public int isChangeStatusBarIconColorAfterToolbarCollapsedInImmersiveInterface; + public boolean isChangeStatusBarIconColorAfterToolbarCollapsedInImmersiveInterface; public CustomTheme(@NonNull String name) { this.name = name; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeDao.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeDao.java index f1afb3c4..4525cf81 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeDao.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeDao.java @@ -16,6 +16,15 @@ public interface CustomThemeDao { @Query("SELECT * FROM custom_themes") LiveData<List<CustomTheme>> getAllCustomThemes(); + @Query("SELECT * FROM custom_themes WHERE is_light_theme = 1 LIMIT 1") + LiveData<CustomTheme> getLightCustomTheme(); + + @Query("SELECT * FROM custom_themes WHERE is_dark_theme = 1 LIMIT 1") + LiveData<CustomTheme> getDarkCustomTheme(); + + @Query("SELECT * FROM custom_themes WHERE is_amoled_theme = 1 LIMIT 1") + LiveData<CustomTheme> getAmoledCustomTheme(); + @Query("SELECT * FROM custom_themes WHERE name = :name AND username = :username COLLATE NOCASE LIMIT 1") CustomTheme getCustomTheme(String name, String username); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeRepository.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeRepository.java index e2c0b692..cedc4513 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeRepository.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeRepository.java @@ -8,12 +8,30 @@ import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; public class CustomThemeRepository { private LiveData<List<CustomTheme>> mAllCustomThemes; + private LiveData<CustomTheme> mLightCustomTheme; + private LiveData<CustomTheme> mDarkCustomTheme; + private LiveData<CustomTheme> mAmoledCustomTheme; CustomThemeRepository(RedditDataRoomDatabase redditDataRoomDatabase) { mAllCustomThemes = redditDataRoomDatabase.customThemeDao().getAllCustomThemes(); + mLightCustomTheme = redditDataRoomDatabase.customThemeDao().getLightCustomTheme(); + mDarkCustomTheme = redditDataRoomDatabase.customThemeDao().getDarkCustomTheme(); + mAmoledCustomTheme = redditDataRoomDatabase.customThemeDao().getAmoledCustomTheme(); } LiveData<List<CustomTheme>> getAllCustomThemes() { return mAllCustomThemes; } + + public LiveData<CustomTheme> getLightCustomTheme() { + return mLightCustomTheme; + } + + public LiveData<CustomTheme> getDarkCustomTheme() { + return mDarkCustomTheme; + } + + public LiveData<CustomTheme> getAmoledCustomTheme() { + return mAmoledCustomTheme; + } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeSettingsItem.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeSettingsItem.java new file mode 100644 index 00000000..1dfd7f59 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeSettingsItem.java @@ -0,0 +1,292 @@ +package ml.docilealligator.infinityforreddit.CustomTheme; + +import android.content.Context; + +import java.util.ArrayList; + +import ml.docilealligator.infinityforreddit.R; + +public class CustomThemeSettingsItem { + public String itemName; + public String itemDetails; + public int colorValue; + public boolean isEnabled; + + private CustomThemeSettingsItem(String itemName, String itemDetails, int colorValue) { + this.itemName = itemName; + this.itemDetails = itemDetails; + this.colorValue = colorValue; + } + + private CustomThemeSettingsItem(String itemName, boolean isEnabled) { + this.itemName = itemName; + this.isEnabled = isEnabled; + } + + public static ArrayList<CustomThemeSettingsItem> convertCustomTheme(Context context, CustomTheme customTheme) { + ArrayList<CustomThemeSettingsItem> customThemeSettingsItems = new ArrayList<>(); + + if (customTheme == null) { + return customThemeSettingsItems; + } + + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_color_primary), + context.getString(R.string.theme_item_color_primary_detail), + customTheme.colorPrimary)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_color_primary_dark), + context.getString(R.string.theme_item_color_primary_dark_detail), + customTheme.colorPrimaryDark)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_color_accent), + context.getString(R.string.theme_item_color_accent_detail), + customTheme.colorAccent)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_color_primary_light_theme), + context.getString(R.string.theme_item_color_primary_light_theme_detail), + customTheme.colorPrimaryLightTheme)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_primary_text_color), + context.getString(R.string.theme_item_primary_text_color_detail), + customTheme.primaryTextColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_secondary_text_color), + context.getString(R.string.theme_item_secondary_text_color_detail), + customTheme.secondaryTextColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_post_title_color), + context.getString(R.string.theme_item_post_title_color_detail), + customTheme.postTitleColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_post_content_color), + context.getString(R.string.theme_item_post_content_color_detail), + customTheme.postContentColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_comment_color), + context.getString(R.string.theme_item_comment_color_detail), + customTheme.commentColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_button_text_color), + context.getString(R.string.theme_item_button_text_color_detail), + customTheme.buttonTextColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_chip_text_color), + context.getString(R.string.theme_item_chip_text_color_detail), + customTheme.chipTextColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_background_color), + context.getString(R.string.theme_item_background_color_detail), + customTheme.backgroundColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_card_view_background_color), + context.getString(R.string.theme_item_card_view_background_color_detail), + customTheme.cardViewBackgroundColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_comment_background_color), + context.getString(R.string.theme_item_comment_background_color_detail), + customTheme.commentBackgroundColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_bottom_app_bar_background_color), + context.getString(R.string.theme_item_bottom_app_bar_background_color_detail), + customTheme.bottomAppBarBackgroundColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_primary_icon_color), + context.getString(R.string.theme_item_primary_icon_color_detail), + customTheme.primaryIconColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_post_icon_and_info_color), + context.getString(R.string.theme_item_post_icon_and_info_color_detail), + customTheme.postIconAndInfoColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_comment_icon_and_info_color), + context.getString(R.string.theme_item_comment_icon_and_info_color_detail), + customTheme.commentIconAndInfoColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_fab_icon_color), + context.getString(R.string.theme_item_fab_icon_color_detail), + customTheme.fabIconColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_toolbar_primary_text_and_icon_color), + context.getString(R.string.theme_item_toolbar_primary_text_and_icon_color_detail), + customTheme.toolbarPrimaryTextAndIconColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_toolbar_secondary_text_color), + context.getString(R.string.theme_item_toolbar_secondary_text_color_detail), + customTheme.toolbarSecondaryTextColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_circular_progress_bar_background_color), + context.getString(R.string.theme_item_circular_progress_bar_background_color_detail), + customTheme.circularProgressBarBackground)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_tab_layout_with_expanded_collapsing_toolbar_tab_background), + context.getString(R.string.theme_item_tab_layout_with_expanded_collapsing_toolbar_tab_background_detail), + customTheme.tabLayoutWithExpandedCollapsingToolbarTabBackground)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_tab_layout_with_expanded_collapsing_toolbar_text_color), + context.getString(R.string.theme_item_tab_layout_with_expanded_collapsing_toolbar_text_color_detail), + customTheme.tabLayoutWithExpandedCollapsingToolbarTextColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_tab_layout_with_expanded_collapsing_toolbar_tab_indicator), + context.getString(R.string.theme_item_tab_layout_with_expanded_collapsing_toolbar_tab_indicator_detail), + customTheme.tabLayoutWithExpandedCollapsingToolbarTabIndicator)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_tab_layout_with_collapsed_collapsing_toolbar_tab_background), + context.getString(R.string.theme_item_tab_layout_with_collapsed_collapsing_toolbar_tab_background_detail), + customTheme.tabLayoutWithCollapsedCollapsingToolbarTabBackground)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_tab_layout_with_collapsed_collapsing_toolbar_text_color), + context.getString(R.string.theme_item_tab_layout_with_collapsed_collapsing_toolbar_text_color_detail), + customTheme.tabLayoutWithCollapsedCollapsingToolbarTextColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_tab_layout_with_collapsed_collapsing_toolbar_tab_indicator), + context.getString(R.string.theme_item_tab_layout_with_collapsed_collapsing_toolbar_tab_indicator_detail), + customTheme.tabLayoutWithCollapsedCollapsingToolbarTabIndicator)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_upvoted_color), + context.getString(R.string.theme_item_upvoted_color_detail), + customTheme.upvoted)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_downvoted_color), + context.getString(R.string.theme_item_downvoted_color_detail), + customTheme.downvoted)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_post_type_background_color), + context.getString(R.string.theme_item_post_type_background_color_detail), + customTheme.postTypeBackgroundColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_post_type_text_color), + context.getString(R.string.theme_item_post_type_text_color_detail), + customTheme.postTypeTextColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_spoiler_background_color), + context.getString(R.string.theme_item_spoiler_background_color_detail), + customTheme.spoilerBackgroundColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_spoiler_text_color), + context.getString(R.string.theme_item_spoiler_text_color_detail), + customTheme.spoilerTextColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_nsfw_background_color), + context.getString(R.string.theme_item_nsfw_background_color_detail), + customTheme.nsfwBackgroundColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_nsfw_text_color), + context.getString(R.string.theme_item_nsfw_text_color_detail), + customTheme.nsfwTextColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_flair_background_color), + context.getString(R.string.theme_item_flair_background_color_detail), + customTheme.flairBackgroundColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_flair_text_color), + context.getString(R.string.theme_item_flair_text_color_detail), + customTheme.flairTextColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_archived_tint), + context.getString(R.string.theme_item_archived_tint_detail), + customTheme.archivedTint)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_locked_icon_tint), + context.getString(R.string.theme_item_locked_icon_tint_detail), + customTheme.lockedIconTint)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_crosspost_icon_tint), + context.getString(R.string.theme_item_crosspost_icon_tint_detail), + customTheme.crosspostIconTint)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_stickied_post_icon_tint), + context.getString(R.string.theme_item_stickied_post_icon_tint_detail), + customTheme.stickiedPostIconTint)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_subscribed_color), + context.getString(R.string.theme_item_subscribed_color_detail), + customTheme.subscribed)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_unsubscribed_color), + context.getString(R.string.theme_item_unsubscribed_color_detail), + customTheme.unsubscribed)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_username_color), + context.getString(R.string.theme_item_username_color_detail), + customTheme.username)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_subreddit_color), + context.getString(R.string.theme_item_subreddit_color_detail), + customTheme.subreddit)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_author_flair_text_color), + context.getString(R.string.theme_item_author_flair_text_color_detail), + customTheme.authorFlairTextColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_submitter_color), + context.getString(R.string.theme_item_submitter_color_detail), + customTheme.submitter)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_moderator_color), + context.getString(R.string.theme_item_moderator_color_detail), + customTheme.moderator)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_single_comment_thread_background_color), + context.getString(R.string.theme_item_single_comment_thread_background_color_detail), + customTheme.singleCommentThreadBackgroundColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_unread_message_background_color), + context.getString(R.string.theme_item_unread_message_background_color_detail), + customTheme.unreadMessageBackgroundColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_divider_color), + context.getString(R.string.theme_item_divider_color_detail), + customTheme.dividerColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_no_preview_link_background_color), + context.getString(R.string.theme_item_no_preview_link_background_color_detail), + customTheme.noPreviewLinkBackgroundColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_vote_and_reply_unavailable_button_color), + context.getString(R.string.theme_item_vote_and_reply_unavailable_button_color_detail), + customTheme.voteAndReplyUnavailableButtonColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_comment_vertical_bar_color_1), + context.getString(R.string.theme_item_comment_vertical_bar_color_1_detail), + customTheme.commentVerticalBarColor1)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_comment_vertical_bar_color_2), + context.getString(R.string.theme_item_comment_vertical_bar_color_2_detail), + customTheme.commentVerticalBarColor2)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_comment_vertical_bar_color_3), + context.getString(R.string.theme_item_comment_vertical_bar_color_3_detail), + customTheme.commentVerticalBarColor3)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_comment_vertical_bar_color_4), + context.getString(R.string.theme_item_comment_vertical_bar_color_4_detail), + customTheme.commentVerticalBarColor4)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_comment_vertical_bar_color_5), + context.getString(R.string.theme_item_comment_vertical_bar_color_5_detail), + customTheme.commentVerticalBarColor5)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_comment_vertical_bar_color_6), + context.getString(R.string.theme_item_comment_vertical_bar_color_6_detail), + customTheme.commentVerticalBarColor6)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_comment_vertical_bar_color_7), + context.getString(R.string.theme_item_comment_vertical_bar_color_7_detail), + customTheme.commentVerticalBarColor7)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_nav_bar_color), + context.getString(R.string.theme_item_nav_bar_color_detail), + customTheme.navBarColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_light_status_bar), + customTheme.isLightStatusBar)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_light_nav_bar), + customTheme.isLightNavBar)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_change_status_bar_icon_color_after_toolbar_collapsed_in_immersive_interface), + customTheme.isChangeStatusBarIconColorAfterToolbarCollapsedInImmersiveInterface)); + return customThemeSettingsItems; + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeViewModel.java index 44a43f23..227e641e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeViewModel.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeViewModel.java @@ -11,15 +11,34 @@ import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; public class CustomThemeViewModel extends ViewModel { private LiveData<List<CustomTheme>> mAllCustomThemes; + private LiveData<CustomTheme> mLightCustomTheme; + private LiveData<CustomTheme> mDarkCustomTheme; + private LiveData<CustomTheme> mAmoledCustomTheme; public CustomThemeViewModel(RedditDataRoomDatabase redditDataRoomDatabase) { - mAllCustomThemes = new CustomThemeRepository(redditDataRoomDatabase).getAllCustomThemes(); + CustomThemeRepository customThemeRepository = new CustomThemeRepository(redditDataRoomDatabase); + mAllCustomThemes = customThemeRepository.getAllCustomThemes(); + mLightCustomTheme = customThemeRepository.getLightCustomTheme(); + mDarkCustomTheme = customThemeRepository.getDarkCustomTheme(); + mAmoledCustomTheme = customThemeRepository.getAmoledCustomTheme(); } public LiveData<List<CustomTheme>> getAllCustomThemes() { return mAllCustomThemes; } + public LiveData<CustomTheme> getLightCustomTheme() { + return mLightCustomTheme; + } + + public LiveData<CustomTheme> getDarkCustomTheme() { + return mDarkCustomTheme; + } + + public LiveData<CustomTheme> getAmoledCustomTheme() { + return mAmoledCustomTheme; + } + public static class Factory extends ViewModelProvider.NewInstanceFactory { private RedditDataRoomDatabase mRedditDataRoomDatabase; 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 bcb46f7e..2546c9f2 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeWrapper.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomTheme/CustomThemeWrapper.java @@ -138,9 +138,9 @@ public class CustomThemeWrapper { getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF")); } - public int getToolbarAndTabBackgroundColor() { - return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.TOOLBAR_AND_TAB_BACKGROUND_COLOR, - getDefaultColor("#1565C0", "#282828", "#000000")); + public int getToolbarSecondaryTextColor() { + return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.TOOLBAR_SECONDARY_TEXT_COLOR, + getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF")); } public int getCircularProgressBarBackground() { @@ -178,11 +178,6 @@ public class CustomThemeWrapper { getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF")); } - public int getNavBarColor() { - return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.NAV_BAR_COLOR, - getDefaultColor("#FFFFFF", "#121212", "#000000")); - } - public int getUpvoted() { return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.UPVOTED, getDefaultColor("#E91E63", "#E91E63", "#E91E63")); @@ -233,8 +228,8 @@ public class CustomThemeWrapper { getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF")); } - public int getArchivedTint() { - return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.ARCHIVED_TINT, + public int getArchivedIconTint() { + return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.ARCHIVED_ICON_TINT, getDefaultColor("#B4009F", "#B4009F", "#B4009F")); } @@ -308,8 +303,8 @@ public class CustomThemeWrapper { getDefaultColor("#E0E0E0", "#424242", "#424242")); } - public int getVoteAndReplyUnavailableVoteButtonColor() { - return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.VOTE_AND_REPLY_UNAVAILABLE_VOTE_BUTTON_COLOR, + public int getVoteAndReplyUnavailableButtonColor() { + return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.VOTE_AND_REPLY_UNAVAILABLE_BUTTON_COLOR, getDefaultColor("#F0F0F0", "#3C3C3C", "#3C3C3C")); } @@ -358,6 +353,11 @@ public class CustomThemeWrapper { getDefaultColor("#FFFFFF", "#FFFFFF", "#FFFFFF")); } + public int getNavBarColor() { + return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.NAV_BAR_COLOR, + getDefaultColor("#FFFFFF", "#121212", "#000000")); + } + public boolean isLightStatusBar() { return getThemeSharedPreferences().getBoolean(CustomThemeSharedPreferencesUtils.LIGHT_STATUS_BAR, false); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java b/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java index e6d31728..0225d14a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java @@ -125,8 +125,9 @@ public abstract class RedditDataRoomDatabase extends RoomDatabase { "button_text_color INTEGER NOT NULL, background_color INTEGER NOT NULL," + "card_view_background_color INTEGER NOT NULL, comment_background_color INTEGER NOT NULL," + "bottom_app_bar_background_color INTEGER NOT NULL, primary_icon_color INTEGER NOT NULL," + + "post_icon_and_info_color INTEGER NOT NULL," + "comment_icon_and_info_color INTEGER NOT NULL, toolbar_primary_text_and_icon_color INTEGER NOT NULL," + - "toolbar_and_tab_background_color INTEGER NOT NULL, circular_progress_bar_background INTEGER NOT NULL," + + "toolbar_secondary_text_color INTEGER NOT NULL, circular_progress_bar_background INTEGER NOT NULL," + "tab_layout_with_expanded_collapsing_toolbar_tab_background INTEGER NOT NULL," + "tab_layout_with_expanded_collapsing_toolbar_text_color INTEGER NOT NULL," + "tab_layout_with_expanded_collapsing_toolbar_tab_indicator INTEGER NOT NULL," + @@ -146,7 +147,7 @@ public abstract class RedditDataRoomDatabase extends RoomDatabase { "single_comment_thread_background_color INTEGER NOT NULL," + "unread_message_background_color INTEGER NOT NULL, divider_color INTEGER NOT NULL," + "no_preview_link_background_color INTEGER NOT NULL," + - "vote_and_reply_unavailable_vote_button_color INTEGER NOT NULL," + + "vote_and_reply_unavailable_button_color INTEGER NOT NULL," + "comment_vertical_bar_color_1 INTEGER NOT NULL, comment_vertical_bar_color_2 INTEGER NOT NULL," + "comment_vertical_bar_color_3 INTEGER NOT NULL, comment_vertical_bar_color_4 INTEGER NOT NULL," + "comment_vertical_bar_color_5 INTEGER NOT NULL, comment_vertical_bar_color_6 INTEGER NOT NULL," + diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/ThemePreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/ThemePreferenceFragment.java index 516e3c93..58dbf619 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/ThemePreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/ThemePreferenceFragment.java @@ -1,15 +1,17 @@ package ml.docilealligator.infinityforreddit.Settings; -import android.app.Activity; import android.content.Context; +import android.content.Intent; import android.content.res.Configuration; import android.os.Build; import android.os.Bundle; import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatDelegate; import androidx.fragment.app.Fragment; import androidx.preference.ListPreference; +import androidx.preference.Preference; import androidx.preference.PreferenceFragmentCompat; import androidx.preference.SwitchPreference; @@ -17,6 +19,7 @@ import org.greenrobot.eventbus.EventBus; import javax.inject.Inject; +import ml.docilealligator.infinityforreddit.Activity.CustomizeThemeActivity; import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.Event.RecreateActivityEvent; import ml.docilealligator.infinityforreddit.Infinity; @@ -34,7 +37,7 @@ import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES; */ public class ThemePreferenceFragment extends PreferenceFragmentCompat { - private Activity activity; + private AppCompatActivity activity; @Inject CustomThemeWrapper customThemeWrapper; @@ -46,6 +49,9 @@ public class ThemePreferenceFragment extends PreferenceFragmentCompat { ListPreference themePreference = findPreference(SharedPreferencesUtils.THEME_KEY); SwitchPreference amoledDarkSwitch = findPreference(SharedPreferencesUtils.AMOLED_DARK_KEY); + Preference customizeLightThemePreference = findPreference(SharedPreferencesUtils.CUSTOMIZE_LIGHT_THEME); + Preference customizeDarkThemePreference = findPreference(SharedPreferencesUtils.CUSTOMIZE_DARK_THEME); + Preference customizeAmoledThemePreference = findPreference(SharedPreferencesUtils.CUSTOMIZE_AMOLED_THEME); boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q; if (themePreference != null && amoledDarkSwitch != null) { @@ -100,11 +106,38 @@ public class ThemePreferenceFragment extends PreferenceFragmentCompat { return true; }); } + + if (customizeLightThemePreference != null) { + customizeLightThemePreference.setOnPreferenceClickListener(preference -> { + Intent intent = new Intent(activity, CustomizeThemeActivity.class); + intent.putExtra(CustomizeThemeActivity.EXTRA_THEME_TYPE, CustomizeThemeActivity.EXTRA_LIGHT_THEME); + startActivity(intent); + return false; + }); + } + + if (customizeDarkThemePreference != null) { + customizeDarkThemePreference.setOnPreferenceClickListener(preference -> { + Intent intent = new Intent(activity, CustomizeThemeActivity.class); + intent.putExtra(CustomizeThemeActivity.EXTRA_THEME_TYPE, CustomizeThemeActivity.EXTRA_DARK_THEME); + startActivity(intent); + return false; + }); + } + + if (customizeAmoledThemePreference != null) { + customizeAmoledThemePreference.setOnPreferenceClickListener(preference -> { + Intent intent = new Intent(activity, CustomizeThemeActivity.class); + intent.putExtra(CustomizeThemeActivity.EXTRA_THEME_TYPE, CustomizeThemeActivity.EXTRA_AMOLED_THEME); + startActivity(intent); + return false; + }); + } } @Override public void onAttach(@NonNull Context context) { super.onAttach(context); - activity = (Activity) context; + activity = (AppCompatActivity) context; } } 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 44559721..a4631521 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/CustomThemeSharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/CustomThemeSharedPreferencesUtils.java @@ -28,7 +28,7 @@ public class CustomThemeSharedPreferencesUtils { public static final String POST_ICON_AND_INFO_COLOR = "postIconAndInfoColor"; public static final String COMMENT_ICON_AND_INFO_COLOR = "commentIconAndInfoColor"; public static final String TOOLBAR_PRIMARY_TEXT_AND_ICON_COLOR = "toolbarPrimaryTextAndIconColor"; - public static final String TOOLBAR_AND_TAB_BACKGROUND_COLOR = "toolbarAndTabBackgroundColor"; + public static final String TOOLBAR_SECONDARY_TEXT_COLOR = "toolbarSecondaryTextColor"; public static final String CIRCULAR_PROGRESS_BAR_BACKGROUND = "circularProgressBarBackground"; public static final String TAB_LAYOUT_WITH_EXPANDED_COLLAPSING_TOOLBAR_TAB_BACKGROUND = "tabLayoutWithExpandedCollapsingToolbarTabBackground"; public static final String TAB_LAYOUT_WITH_EXPANDED_COLLAPSING_TOOLBAR_TEXT_COLOR = "tabLayoutWithExpandedCollapsingToolbarTextColor"; @@ -47,7 +47,7 @@ public class CustomThemeSharedPreferencesUtils { public static final String NSFW_TEXT_COLOR = "nsfwTextColor"; public static final String FLAIR_BACKGROUND_COLOR = "flairBackgroundColor"; public static final String FLAIR_TEXT_COLOR = "flairTextColor"; - public static final String ARCHIVED_TINT = "archivedTint"; + public static final String ARCHIVED_ICON_TINT = "archivedIconTint"; public static final String LOCKED_ICON_TINT = "lockedIconTint"; public static final String CROSSPOST_ICON_TINT = "crosspostIconTint"; public static final String STICKIED_POST_ICON_TINT = "stickiedPost"; @@ -62,7 +62,7 @@ public class CustomThemeSharedPreferencesUtils { public static final String UNREAD_MESSAGE_BACKGROUND_COLOR = "unreadMessageBackgroundColor"; public static final String DIVIDER_COLOR = "dividerColor"; public static final String NO_PREVIEW_LINK_BACKGROUND_COLOR = "noPreviewLinkBackgroundColor"; - public static final String VOTE_AND_REPLY_UNAVAILABLE_VOTE_BUTTON_COLOR = "voteAndReplyUnavailableVoteButtonColor"; + public static final String VOTE_AND_REPLY_UNAVAILABLE_BUTTON_COLOR = "voteAndReplyUnavailableButtonColor"; public static final String COMMENT_VERTICAL_BAR_COLOR_1 = "commentVerticalBarColor1"; public static final String COMMENT_VERTICAL_BAR_COLOR_2 = "commentVerticalBarColor2"; public static final String COMMENT_VERTICAL_BAR_COLOR_3 = "commentVerticalBarColor3"; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java index 0ff474bd..ef15d5e6 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java @@ -77,4 +77,7 @@ public class SharedPreferencesUtils { public static final String LOCK_BOTTOM_APP_BAR = "lock_bottom_app_bar"; public static final String SHOW_COMMENT_DIVIDER = "show_comment_divider"; public static final String SHOW_ABSOLUTE_NUMBER_OF_VOTES = "show_absolute_number_of_votes"; + public static final String CUSTOMIZE_LIGHT_THEME = "customize_light_theme"; + public static final String CUSTOMIZE_DARK_THEME = "customize_dark_theme"; + public static final String CUSTOMIZE_AMOLED_THEME = "customize_amoled_theme"; } diff --git a/app/src/main/res/drawable-night/ic_dark_theme_preference_24dp.xml b/app/src/main/res/drawable-night/ic_dark_theme_preference_24dp.xml new file mode 100644 index 00000000..3ea2743e --- /dev/null +++ b/app/src/main/res/drawable-night/ic_dark_theme_preference_24dp.xml @@ -0,0 +1,9 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:fillColor="#FFFFFFFF" + android:pathData="M12.7,4.91C15.25,6.24 17,8.92 17,12s-1.75,5.76 -4.3,7.09c1.46,-2 2.3,-4.46 2.3,-7.09s-0.84,-5.09 -2.3,-7.09M9,2c-1.05,0 -2.05,0.16 -3,0.46 4.06,1.27 7,5.06 7,9.54s-2.94,8.27 -7,9.54c0.95,0.3 1.95,0.46 3,0.46 5.52,0 10,-4.48 10,-10S14.52,2 9,2z"/> +</vector> diff --git a/app/src/main/res/drawable-night/ic_light_theme_preference_24dp.xml b/app/src/main/res/drawable-night/ic_light_theme_preference_24dp.xml new file mode 100644 index 00000000..8a7d0fe8 --- /dev/null +++ b/app/src/main/res/drawable-night/ic_light_theme_preference_24dp.xml @@ -0,0 +1,9 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:fillColor="#FFFFFFFF" + android:pathData="M20,8.69L20,4h-4.69L12,0.69 8.69,4L4,4v4.69L0.69,12 4,15.31L4,20h4.69L12,23.31 15.31,20L20,20v-4.69L23.31,12 20,8.69zM18,14.48L18,18h-3.52L12,20.48 9.52,18L6,18v-3.52L3.52,12 6,9.52L6,6h3.52L12,3.52 14.48,6L18,6v3.52L20.48,12 18,14.48zM12,6.5c-3.03,0 -5.5,2.47 -5.5,5.5s2.47,5.5 5.5,5.5 5.5,-2.47 5.5,-5.5 -2.47,-5.5 -5.5,-5.5zM12,15.5c-1.93,0 -3.5,-1.57 -3.5,-3.5s1.57,-3.5 3.5,-3.5 3.5,1.57 3.5,3.5 -1.57,3.5 -3.5,3.5z"/> +</vector> diff --git a/app/src/main/res/drawable/circular_background.xml b/app/src/main/res/drawable/circular_background.xml new file mode 100644 index 00000000..5f6c58ee --- /dev/null +++ b/app/src/main/res/drawable/circular_background.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" > + <size android:width="24dp" android:height="24dp"/> +</shape>
\ No newline at end of file diff --git a/app/src/main/res/drawable/ic_dark_theme_preference_24dp.xml b/app/src/main/res/drawable/ic_dark_theme_preference_24dp.xml new file mode 100644 index 00000000..24ef45dd --- /dev/null +++ b/app/src/main/res/drawable/ic_dark_theme_preference_24dp.xml @@ -0,0 +1,9 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:fillColor="#FF000000" + android:pathData="M12.7,4.91C15.25,6.24 17,8.92 17,12s-1.75,5.76 -4.3,7.09c1.46,-2 2.3,-4.46 2.3,-7.09s-0.84,-5.09 -2.3,-7.09M9,2c-1.05,0 -2.05,0.16 -3,0.46 4.06,1.27 7,5.06 7,9.54s-2.94,8.27 -7,9.54c0.95,0.3 1.95,0.46 3,0.46 5.52,0 10,-4.48 10,-10S14.52,2 9,2z"/> +</vector> diff --git a/app/src/main/res/drawable/ic_light_theme_preference_24dp.xml b/app/src/main/res/drawable/ic_light_theme_preference_24dp.xml new file mode 100644 index 00000000..5eb72292 --- /dev/null +++ b/app/src/main/res/drawable/ic_light_theme_preference_24dp.xml @@ -0,0 +1,9 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:fillColor="#FF000000" + android:pathData="M20,8.69L20,4h-4.69L12,0.69 8.69,4L4,4v4.69L0.69,12 4,15.31L4,20h4.69L12,23.31 15.31,20L20,20v-4.69L23.31,12 20,8.69zM18,14.48L18,18h-3.52L12,20.48 9.52,18L6,18v-3.52L3.52,12 6,9.52L6,6h3.52L12,3.52 14.48,6L18,6v3.52L20.48,12 18,14.48zM12,6.5c-3.03,0 -5.5,2.47 -5.5,5.5s2.47,5.5 5.5,5.5 5.5,-2.47 5.5,-5.5 -2.47,-5.5 -5.5,-5.5zM12,15.5c-1.93,0 -3.5,-1.57 -3.5,-3.5s1.57,-3.5 3.5,-3.5 3.5,1.57 3.5,3.5 -1.57,3.5 -3.5,3.5z"/> +</vector> diff --git a/app/src/main/res/layout/activity_customize_theme.xml b/app/src/main/res/layout/activity_customize_theme.xml new file mode 100644 index 00000000..362772a1 --- /dev/null +++ b/app/src/main/res/layout/activity_customize_theme.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context=".Activity.CustomizeThemeActivity"> + + <com.google.android.material.appbar.AppBarLayout + android:id="@+id/appbar_layout_customize_theme_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="?attr/toolbarAndTabBackgroundColor" + android:theme="@style/AppTheme.AppBarOverlay"> + + <com.google.android.material.appbar.CollapsingToolbarLayout + android:id="@+id/collapsing_toolbar_layout_customize_theme_activity" + android:layout_width="match_parent" + android:layout_height="match_parent" + app:layout_scrollFlags="scroll|enterAlways" + app:titleEnabled="false" + app:toolbarId="@+id/toolbar_customize_theme_activity"> + + <androidx.appcompat.widget.Toolbar + android:id="@+id/toolbar_customize_theme_activity" + android:layout_width="match_parent" + android:layout_height="?attr/actionBarSize" + app:popupTheme="@style/AppTheme.PopupOverlay" + app:navigationIcon="?attr/homeAsUpIndicator" /> + + </com.google.android.material.appbar.CollapsingToolbarLayout> + + </com.google.android.material.appbar.AppBarLayout> + + <androidx.recyclerview.widget.RecyclerView + android:id="@+id/recycler_view_customize_theme_activity" + android:layout_width="match_parent" + android:layout_height="match_parent" + app:layout_behavior="@string/appbar_scrolling_view_behavior" /> + +</androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 50dd0290..7e10c9ad 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -2,7 +2,6 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" - android:id="@+id/coordinator_layout_settings_activity" android:background="?attr/backgroundColor"> <com.google.android.material.appbar.AppBarLayout diff --git a/app/src/main/res/layout/item_theme_color_item.xml b/app/src/main/res/layout/item_theme_color_item.xml new file mode 100644 index 00000000..6adc2d29 --- /dev/null +++ b/app/src/main/res/layout/item_theme_color_item.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <View + android:id="@+id/color_image_view_item_theme_color_item" + android:layout_width="24dp" + android:layout_height="24dp" + android:background="@drawable/circular_background" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/theme_item_name_text_view_item_theme_color_item" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintStart_toEndOf="@id/color_image_view_item_theme_color_item" + app:layout_constraintEnd_toEndOf="parent" /> + + <TextView + android:id="@+id/theme_item_info_text_view_item_theme_color_item" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + app:layout_constraintTop_toBottomOf="@id/theme_item_name_text_view_item_theme_color_item" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toEndOf="@id/color_image_view_item_theme_color_item" + app:layout_constraintEnd_toEndOf="parent" /> + +</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/item_theme_switch_item.xml b/app/src/main/res/layout/item_theme_switch_item.xml new file mode 100644 index 00000000..4b337fc8 --- /dev/null +++ b/app/src/main/res/layout/item_theme_switch_item.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + xmlns:app="http://schemas.android.com/apk/res-auto"> + + <TextView + android:id="@+id/theme_item_name_text_view_item_theme_switch_item" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toEndOf="parent" /> + + <TextView + android:id="@+id/theme_item_info_text_view_item_theme_switch_item" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + app:layout_constraintTop_toBottomOf="@id/theme_item_name_text_view_item_theme_switch_item" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toStartOf="@id/theme_item_switch_item_theme_switch_item" /> + + <Switch + android:id="@+id/theme_item_switch_item_theme_switch_item" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" /> + +</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 45f7b7e5..158495c7 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -357,6 +357,10 @@ <string name="settings_subreddit_summary">r/Infinity_For_Reddit</string> <string name="settings_share_title">Share</string> <string name="settings_share_summary">Share this app to other people if you enjoy it</string> + <string name="settings_category_customization_title">Customization</string> + <string name="settings_customize_light_theme_title">Light Theme</string> + <string name="settings_customize_dark_theme_title">Dark Theme</string> + <string name="settings_customize_amoled_theme_title">Amoled Theme</string> <string name="no_link_available">Cannot get the link</string> @@ -460,6 +464,138 @@ <string name="save_image_before_sharing">Saving the image. Please wait.</string> <string name="save_gif_before_sharing">Saving the gif. Please wait.</string> - <!-- TODO: Remove or change this placeholder text --> - <string name="hello_blank_fragment">Hello blank fragment</string> + <string name="customize_light_theme_fragment_title">Customize Light Theme</string> + <string name="customize_dark_theme_fragment_title">Customize Dark Theme</string> + <string name="customize_amoled_theme_fragment_title">Customize Amoled Theme</string> + + <string name="theme_item_color_primary">Color Primary</string> + <string name="theme_item_color_primary_detail">Applied to: Toolbar</string> + <string name="theme_item_color_primary_dark">Color Primary Dark</string> + <string name="theme_item_color_primary_dark_detail">Applied to: Status Bar</string> + <string name="theme_item_color_accent">Color Accent</string> + <string name="theme_item_color_accent_detail">Applied to: Progress Bar, etc</string> + <string name="theme_item_color_primary_light_theme">Color Primary Light Theme</string> + <string name="theme_item_color_primary_light_theme_detail">Has effect only when this theme is set as light theme.\nApplied to: background of Floating Action Button and Button</string> + <string name="theme_item_primary_text_color">Primary Text Color</string> + <string name="theme_item_primary_text_color_detail">Applied to: Primary text</string> + <string name="theme_item_secondary_text_color">Secondary Text Color</string> + <string name="theme_item_secondary_text_color_detail">Applied to: Secondary text</string> + <string name="theme_item_post_title_color">Post Title Color</string> + <string name="theme_item_post_title_color_detail">Applied to: Post title</string> + <string name="theme_item_post_content_color">Post Content Color</string> + <string name="theme_item_post_content_color_detail">Applied to: Post content</string> + <string name="theme_item_comment_color">Comment Color</string> + <string name="theme_item_comment_color_detail">Applied to: Comment</string> + <string name="theme_item_button_text_color">Button Text Color</string> + <string name="theme_item_button_text_color_detail">Applied to: Text on button</string> + <string name="theme_item_chip_text_color">Chip Text Color</string> + <string name="theme_item_chip_text_color_detail">Applied to: Subscribe Button</string> + <string name="theme_item_background_color">Background Color</string> + <string name="theme_item_background_color_detail">Applied to: Background of every page and navigation drawer</string> + <string name="theme_item_card_view_background_color">Card View Background Color</string> + <string name="theme_item_card_view_background_color_detail">Applied to: Post background and message background</string> + <string name="theme_item_comment_background_color">Comment Background Color</string> + <string name="theme_item_comment_background_color_detail">Applied to: Comment background</string> + <string name="theme_item_bottom_app_bar_background_color">Bottom Navigation Bar Color</string> + <string name="theme_item_bottom_app_bar_background_color_detail">Applied to: Bottom navigation bar</string> + <string name="theme_item_primary_icon_color">Primary Icon Color</string> + <string name="theme_item_primary_icon_color_detail">Applied to: Icons in the bottom navigation bar and the navigation drawer.</string> + <string name="theme_item_post_icon_and_info_color">Post Icon and Info Color</string> + <string name="theme_item_post_icon_and_info_color_detail">Applied to: Icons, score and the number of comments in posts</string> + <string name="theme_item_comment_icon_and_info_color">Comment Icon and Info Color</string> + <string name="theme_item_comment_icon_and_info_color_detail">Applied to: Icons and score in comments</string> + <string name="theme_item_fab_icon_color">Floating Action Button Icon Color</string> + <string name="theme_item_fab_icon_color_detail">Applied to: Floating action button icon</string> + <string name="theme_item_toolbar_primary_text_and_icon_color">Toolbar Primary Text and Icon Color</string> + <string name="theme_item_toolbar_primary_text_and_icon_color_detail">Applied to: Primary texts and icons in toolbars</string> + <string name="theme_item_toolbar_secondary_text_color">Toolbar Secondary Text Color</string> + <string name="theme_item_toolbar_secondary_text_color_detail">Applied to: Secondary texts in toolbars</string> + <string name="theme_item_circular_progress_bar_background_color">Circular Progress Bar Background Color</string> + <string name="theme_item_circular_progress_bar_background_color_detail">Applied to: Background of Circular progress bar</string> + <string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_tab_background">Background Color of Tab Layout in Expanded Toolbar</string> + <string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_tab_background_detail">Applied to: Tab layout background (expanded toolbar)</string> + <string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_text_color">Text Color of Tab Layout in Expanded Toolbar</string> + <string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_text_color_detail">Applied to: Tab layout text color (expanded toolbar)</string> + <string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_tab_indicator">Tab Indicator Color of Tab Layout in Expanded Toolbar</string> + <string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_tab_indicator_detail">Applied to: Tab indicator color in tab layout (expanded toolbar)</string> + <string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_tab_background">Background Color of Tab Layout in Collapsed Toolbar</string> + <string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_tab_background_detail">Applied to: Tab layout background (collapsed toolbar)</string> + <string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_text_color">Text Color of Tab Layout in Collapsed Toolbar</string> + <string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_text_color_detail">Applied to: Tab layout text color (collapsed toolbar)</string> + <string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_tab_indicator">Tab Indicator Color of Tab Layout in Collapsed Toolbar</string> + <string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_tab_indicator_detail">Applied to: Tab indicator color in tab layout (collapsed toolbar)</string> + <string name="theme_item_upvoted_color">Upvoted Color</string> + <string name="theme_item_upvoted_color_detail">Applied to: Vote buttons and scores (upvoted)</string> + <string name="theme_item_downvoted_color">Downvoted Color</string> + <string name="theme_item_downvoted_color_detail">Applied to: Vote buttons and scores (downvoted)</string> + <string name="theme_item_post_type_background_color">Post Type Background Color</string> + <string name="theme_item_post_type_background_color_detail">Applied to: Background of the post type (IMAGE, TEXT, VIDEO, GIF, LINK)</string> + <string name="theme_item_post_type_text_color">Post Type Text Color</string> + <string name="theme_item_post_type_text_color_detail">Applied to: Text color of the post type (IMAGE, TEXT, VIDEO, GIF LINK)</string> + <string name="theme_item_spoiler_background_color">Spoiler Background Color</string> + <string name="theme_item_spoiler_background_color_detail">Applied to: Background of the spoiler tag</string> + <string name="theme_item_spoiler_text_color">Spoiler Text Color</string> + <string name="theme_item_spoiler_text_color_detail">Applied to: Text color in the spoiler tag</string> + <string name="theme_item_nsfw_background_color">NSFW Background Color</string> + <string name="theme_item_nsfw_background_color_detail">Applied to: Background of the NSFW tag</string> + <string name="theme_item_nsfw_text_color">NSFW text color</string> + <string name="theme_item_nsfw_text_color_detail">Applied to: Text color of the NSFW tag</string> + <string name="theme_item_flair_background_color">Flair Background Color</string> + <string name="theme_item_flair_background_color_detail">Applied to: Background of the flair tag</string> + <string name="theme_item_flair_text_color">Flair Text Color</string> + <string name="theme_item_flair_text_color_detail">Applied to: Text color of the flair tag</string> + <string name="theme_item_archived_tint">Archived Icon Color</string> + <string name="theme_item_archived_tint_detail">Applied to: Archived icon</string> + <string name="theme_item_locked_icon_tint">Locked Icon Color</string> + <string name="theme_item_locked_icon_tint_detail">Applied to: Locked icon</string> + <string name="theme_item_crosspost_icon_tint">Crosspost Icon Color</string> + <string name="theme_item_crosspost_icon_tint_detail">Applied to: Crosspost icon</string> + <string name="theme_item_stickied_post_icon_tint">Stickied Post Icon Color</string> + <string name="theme_item_stickied_post_icon_tint_detail">Applied to: Stickied post icon</string> + <string name="theme_item_subscribed_color">Subscribed</string> + <string name="theme_item_subscribed_color_detail">Applied to: Unsubscribe button</string> + <string name="theme_item_unsubscribed_color">Unsubscribed</string> + <string name="theme_item_unsubscribed_color_detail">Applied to: Sbscribe button</string> + <string name="theme_item_username_color">Username Color</string> + <string name="theme_item_username_color_detail">Applied to: Username</string> + <string name="theme_item_subreddit_color">Subreddit Color</string> + <string name="theme_item_subreddit_color_detail">Applied to: Subreddit name</string> + <string name="theme_item_author_flair_text_color">Author Flair Color</string> + <string name="theme_item_author_flair_text_color_detail">Applied to: Author flair in comments</string> + <string name="theme_item_submitter_color">Submitter</string> + <string name="theme_item_submitter_color_detail">Applied to: Submitter in comments</string> + <string name="theme_item_moderator_color">Moderator</string> + <string name="theme_item_moderator_color_detail">Applied to: Moderator in comments</string> + <string name="theme_item_single_comment_thread_background_color">Single Comment Thread Background Color</string> + <string name="theme_item_single_comment_thread_background_color_detail">Applied to: Single Comment</string> + <string name="theme_item_unread_message_background_color">Unread Message Background Color</string> + <string name="theme_item_unread_message_background_color_detail">Applied to: Unread Message Background Color</string> + <string name="theme_item_divider_color">Divider Color</string> + <string name="theme_item_divider_color_detail">Applied to: Comment divider, dividers in pages for submitting posts, etc.</string> + <string name="theme_item_no_preview_link_background_color">No-Preview Link Background Color</string> + <string name="theme_item_no_preview_link_background_color_detail">Applied to: No-preview link placeholder</string> + <string name="theme_item_vote_and_reply_unavailable_button_color">Vote and Reply Unavailable Button Color</string> + <string name="theme_item_vote_and_reply_unavailable_button_color_detail">Applied to: Vote and reply buttons (Unavailable)</string> + <string name="theme_item_comment_vertical_bar_color_1">Comment Vertical Bar Color 1</string> + <string name="theme_item_comment_vertical_bar_color_1_detail">Applied to: Comment Vertical Bar (Level 1)</string> + <string name="theme_item_comment_vertical_bar_color_2">Comment Vertical Bar Color 2</string> + <string name="theme_item_comment_vertical_bar_color_2_detail">Applied to: Comment Vertical Bar (Level 2)</string> + <string name="theme_item_comment_vertical_bar_color_3">Comment Vertical Bar Color 3</string> + <string name="theme_item_comment_vertical_bar_color_3_detail">Applied to: Comment Vertical Bar (Level 3)</string> + <string name="theme_item_comment_vertical_bar_color_4">Comment Vertical Bar Color 4</string> + <string name="theme_item_comment_vertical_bar_color_4_detail">Applied to: Comment Vertical Bar (Level 4)</string> + <string name="theme_item_comment_vertical_bar_color_5">Comment Vertical Bar Color 5</string> + <string name="theme_item_comment_vertical_bar_color_5_detail">Applied to: Comment Vertical Bar (Level 5)</string> + <string name="theme_item_comment_vertical_bar_color_6">Comment Vertical Bar Color 6</string> + <string name="theme_item_comment_vertical_bar_color_6_detail">Applied to: Comment Vertical Bar (Level 6)</string> + <string name="theme_item_comment_vertical_bar_color_7">Comment Vertical Bar Color 7</string> + <string name="theme_item_comment_vertical_bar_color_7_detail">Applied to: Comment Vertical Bar (Level 7)</string> + <string name="theme_item_nav_bar_color">Navigation Bar Color</string> + <string name="theme_item_nav_bar_color_detail">Applied to: Navigation bar</string> + <string name="theme_item_light_status_bar">Dark Status Bar Icon Color</string> + <string name="theme_item_light_nav_bar">Dark Navigation Bar Icon Color</string> + <string name="theme_item_change_status_bar_icon_color_after_toolbar_collapsed_in_immersive_interface">Change Status Bar Icon Color After Toolbar Collapsed In Immersive Interface</string> + <string name="theme_item_available_on_android_8">Only available for Android 8.0 or above.</string> + <string name="theme_item_available_on_android_6">Only available for Android 6.0 or above.</string> + </resources> diff --git a/app/src/main/res/xml/theme_preferences.xml b/app/src/main/res/xml/theme_preferences.xml index 038485e0..e7d9c13f 100644 --- a/app/src/main/res/xml/theme_preferences.xml +++ b/app/src/main/res/xml/theme_preferences.xml @@ -15,4 +15,22 @@ app:key="amoled_dark" app:title="@string/settings_amoled_dark_title" /> + <PreferenceCategory + app:title="@string/settings_category_customization_title" /> + + <Preference + app:key="customize_light_theme" + app:icon="@drawable/ic_light_theme_preference_24dp" + app:title="@string/settings_customize_light_theme_title" /> + + <Preference + app:key="customize_dark_theme" + app:icon="@drawable/ic_dark_theme_preference_24dp" + app:title="@string/settings_customize_dark_theme_title" /> + + <Preference + app:key="customize_amoled_theme" + app:icon="@drawable/ic_dark_theme_preference_24dp" + app:title="@string/settings_customize_amoled_theme_title" /> + </PreferenceScreen>
\ No newline at end of file |