diff options
Diffstat (limited to '')
48 files changed, 478 insertions, 164 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CustomThemeWrapperReceiver.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomThemeWrapperReceiver.java new file mode 100644 index 00000000..58ac1bd1 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CustomThemeWrapperReceiver.java @@ -0,0 +1,7 @@ +package ml.docilealligator.infinityforreddit; + +import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; + +public interface CustomThemeWrapperReceiver { + void setCustomThemeWrapper(CustomThemeWrapper customThemeWrapper); +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/BaseActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/BaseActivity.java index b0dec874..a839bc1e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/BaseActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/BaseActivity.java @@ -62,7 +62,7 @@ public abstract class BaseActivity extends AppCompatActivity implements CustomFo private boolean isImmersiveInterfaceApplicable = true; private int systemVisibilityToolbarExpanded = 0; private int systemVisibilityToolbarCollapsed = 0; - private CustomThemeWrapper customThemeWrapper; + public CustomThemeWrapper customThemeWrapper; public Typeface typeface; public Typeface titleTypeface; public Typeface contentTypeface; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizeThemeActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizeThemeActivity.java index 58dd009b..ddc0962d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizeThemeActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizeThemeActivity.java @@ -148,14 +148,14 @@ public class CustomizeThemeActivity extends BaseActivity { themeName = customTheme.name; } - adapter = new CustomizeThemeRecyclerViewAdapter(this, themeName, isPredefinedTheme); + adapter = new CustomizeThemeRecyclerViewAdapter(this, customThemeWrapper, themeName); recyclerView.setAdapter(adapter); adapter.setCustomThemeSettingsItem(customThemeSettingsItems); }); } else { isPredefinedTheme = getIntent().getBooleanExtra(EXTRA_IS_PREDEFIINED_THEME, false); themeName = getIntent().getStringExtra(EXTRA_THEME_NAME); - adapter = new CustomizeThemeRecyclerViewAdapter(this, themeName, isPredefinedTheme); + adapter = new CustomizeThemeRecyclerViewAdapter(this, customThemeWrapper, themeName); recyclerView.setAdapter(adapter); if (isPredefinedTheme) { customThemeSettingsItems = CustomThemeSettingsItem.convertCustomThemeToSettingsItem( @@ -163,7 +163,7 @@ public class CustomizeThemeActivity extends BaseActivity { CustomThemeWrapper.getPredefinedCustomTheme(this, themeName), androidVersion); - adapter = new CustomizeThemeRecyclerViewAdapter(this, themeName, isPredefinedTheme); + adapter = new CustomizeThemeRecyclerViewAdapter(this, customThemeWrapper, themeName); recyclerView.setAdapter(adapter); adapter.setCustomThemeSettingsItem(customThemeSettingsItems); } else { @@ -177,7 +177,7 @@ public class CustomizeThemeActivity extends BaseActivity { } } } else { - adapter = new CustomizeThemeRecyclerViewAdapter(this, themeName, isPredefinedTheme); + adapter = new CustomizeThemeRecyclerViewAdapter(this, customThemeWrapper, themeName); recyclerView.setAdapter(adapter); adapter.setCustomThemeSettingsItem(customThemeSettingsItems); } @@ -257,5 +257,6 @@ public class CustomizeThemeActivity extends BaseActivity { @Override protected void applyCustomTheme() { applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar); + coordinatorLayout.setBackgroundColor(customThemeWrapper.getBackgroundColor()); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterPreferenceActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterPreferenceActivity.java index ab96b850..a4a63b1b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterPreferenceActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterPreferenceActivity.java @@ -98,7 +98,7 @@ public class PostFilterPreferenceActivity extends BaseActivity { } }); - adapter = new PostFilterRecyclerViewAdapter(this, postFilter -> { + adapter = new PostFilterRecyclerViewAdapter(this, customThemeWrapper, postFilter -> { if (post != null) { showPostFilterOptions(post, postFilter); } else if (subredditName != null) { @@ -211,6 +211,8 @@ public class PostFilterPreferenceActivity extends BaseActivity { @Override protected void applyCustomTheme() { applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar); + applyFABTheme(fab); + coordinatorLayout.setBackgroundColor(customThemeWrapper.getBackgroundColor()); } @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterUsageListingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterUsageListingActivity.java index e24a47b9..4bef4cd7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterUsageListingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterUsageListingActivity.java @@ -94,7 +94,7 @@ public class PostFilterUsageListingActivity extends BaseActivity { newPostFilterUsageBottomSheetFragment.show(getSupportFragmentManager(), newPostFilterUsageBottomSheetFragment.getTag()); }); - adapter = new PostFilterUsageRecyclerViewAdapter(this, postFilterUsage -> { + adapter = new PostFilterUsageRecyclerViewAdapter(this, customThemeWrapper, postFilterUsage -> { PostFilterUsageOptionsBottomSheetFragment postFilterUsageOptionsBottomSheetFragment = new PostFilterUsageOptionsBottomSheetFragment(); Bundle bundle = new Bundle(); bundle.putParcelable(PostFilterUsageOptionsBottomSheetFragment.EXTRA_POST_FILTER_USAGE, postFilterUsage); @@ -213,5 +213,7 @@ public class PostFilterUsageListingActivity extends BaseActivity { @Override protected void applyCustomTheme() { applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar); + applyFABTheme(fab); + coordinatorLayout.setBackgroundColor(customThemeWrapper.getBackgroundColor()); } }
\ No newline at end of file diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AcknowledgementRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AcknowledgementRecyclerViewAdapter.java index 9e53600f..3cc05331 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AcknowledgementRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AcknowledgementRecyclerViewAdapter.java @@ -14,15 +14,15 @@ import java.util.ArrayList; import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.activities.BaseActivity; import ml.docilealligator.infinityforreddit.activities.LinkResolverActivity; +import ml.docilealligator.infinityforreddit.activities.SettingsActivity; import ml.docilealligator.infinityforreddit.settings.Acknowledgement; public class AcknowledgementRecyclerViewAdapter extends RecyclerView.Adapter<AcknowledgementRecyclerViewAdapter.AcknowledgementViewHolder> { private ArrayList<Acknowledgement> acknowledgements; - private BaseActivity activity; + private SettingsActivity activity; - public AcknowledgementRecyclerViewAdapter(BaseActivity activity, ArrayList<Acknowledgement> acknowledgements) { + public AcknowledgementRecyclerViewAdapter(SettingsActivity activity, ArrayList<Acknowledgement> acknowledgements) { this.activity = activity; this.acknowledgements = acknowledgements; } @@ -66,6 +66,9 @@ public class AcknowledgementRecyclerViewAdapter extends RecyclerView.Adapter<Ack ButterKnife.bind(this, itemView); this.itemView = itemView; + nameTextView.setTextColor(activity.customThemeWrapper.getPrimaryTextColor()); + introductionTextView.setTextColor(activity.customThemeWrapper.getSecondaryTextColor()); + if (activity.typeface != null) { nameTextView.setTypeface(activity.typeface); introductionTextView.setTypeface(activity.typeface); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CrashReportsRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CrashReportsRecyclerViewAdapter.java index 810f8648..03fe2f7d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CrashReportsRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CrashReportsRecyclerViewAdapter.java @@ -11,13 +11,13 @@ import androidx.recyclerview.widget.RecyclerView; import java.util.List; import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.activities.BaseActivity; +import ml.docilealligator.infinityforreddit.activities.SettingsActivity; public class CrashReportsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { - private BaseActivity activity; + private SettingsActivity activity; private List<String> crashReports; - public CrashReportsRecyclerViewAdapter(BaseActivity activity, List<String> crashReports) { + public CrashReportsRecyclerViewAdapter(SettingsActivity activity, List<String> crashReports) { this.activity = activity; this.crashReports = crashReports; } @@ -44,6 +44,8 @@ public class CrashReportsRecyclerViewAdapter extends RecyclerView.Adapter<Recycl super(itemView); crashReportTextView = (TextView) itemView; + crashReportTextView.setTextColor(activity.customThemeWrapper.getPrimaryTextColor()); + if (activity.typeface != null) { crashReportTextView.setTypeface(activity.typeface); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CustomizeThemeRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CustomizeThemeRecyclerViewAdapter.java index 1cf3879c..5c31046b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CustomizeThemeRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CustomizeThemeRecyclerViewAdapter.java @@ -22,6 +22,7 @@ import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.activities.BaseActivity; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeSettingsItem; +import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.customviews.ColorPickerDialog; public class CustomizeThemeRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { @@ -29,16 +30,16 @@ public class CustomizeThemeRecyclerViewAdapter extends RecyclerView.Adapter<Recy private static final int VIEW_TYPE_SWITCH = 2; private static final int VIEW_TYPE_THEME_NAME = 3; private BaseActivity activity; + private CustomThemeWrapper customThemeWrapper; private ArrayList<CustomThemeSettingsItem> customThemeSettingsItems; private String themeName; - private boolean isPredefinedTheme; - public CustomizeThemeRecyclerViewAdapter(BaseActivity activity, String themeName, - boolean isPredefinedTheme) { + public CustomizeThemeRecyclerViewAdapter(BaseActivity activity, CustomThemeWrapper customThemeWrapper, + String themeName) { this.activity = activity; + this.customThemeWrapper = customThemeWrapper; customThemeSettingsItems = new ArrayList<>(); this.themeName = themeName; - this.isPredefinedTheme = isPredefinedTheme; } @Override @@ -148,6 +149,10 @@ public class CustomizeThemeRecyclerViewAdapter extends RecyclerView.Adapter<Recy ThemeColorItemViewHolder(@NonNull View itemView) { super(itemView); ButterKnife.bind(this, itemView); + + themeItemNameTextView.setTextColor(customThemeWrapper.getPrimaryTextColor()); + themeItemInfoTextView.setTextColor(customThemeWrapper.getSecondaryTextColor()); + if (activity.typeface != null) { themeItemNameTextView.setTypeface(activity.typeface); themeItemInfoTextView.setTypeface(activity.typeface); @@ -166,6 +171,10 @@ public class CustomizeThemeRecyclerViewAdapter extends RecyclerView.Adapter<Recy ThemeSwitchItemViewHolder(@NonNull View itemView) { super(itemView); ButterKnife.bind(this, itemView); + + themeItemNameTextView.setTextColor(customThemeWrapper.getPrimaryTextColor()); + themeItemInfoTextView.setTextColor(customThemeWrapper.getSecondaryTextColor()); + if (activity.typeface != null) { themeItemNameTextView.setTypeface(activity.typeface); themeItemInfoTextView.setTypeface(activity.typeface); @@ -181,6 +190,10 @@ public class CustomizeThemeRecyclerViewAdapter extends RecyclerView.Adapter<Recy public ThemeNameItemViewHolder(@NonNull View itemView) { super(itemView); ButterKnife.bind(this, itemView); + + themeNameTextView.setTextColor(customThemeWrapper.getPrimaryTextColor()); + descriptionTextView.setTextColor(customThemeWrapper.getSecondaryTextColor()); + if (activity.typeface != null) { themeNameTextView.setTypeface(activity.typeface); descriptionTextView.setTypeface(activity.typeface); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterRecyclerViewAdapter.java index 9b6b2bd5..d2c3eabf 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterRecyclerViewAdapter.java @@ -12,7 +12,9 @@ import java.util.List; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.activities.BaseActivity; +import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.postfilter.PostFilter; +import ml.docilealligator.infinityforreddit.utils.Utils; public class PostFilterRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { @@ -20,6 +22,7 @@ public class PostFilterRecyclerViewAdapter extends RecyclerView.Adapter<Recycler private static final int VIEW_TYPE_POST_FILTER = 2; private BaseActivity activity; + private CustomThemeWrapper customThemeWrapper; private final OnItemClickListener onItemClickListener; private List<PostFilter> postFilterList; @@ -27,8 +30,10 @@ public class PostFilterRecyclerViewAdapter extends RecyclerView.Adapter<Recycler void onItemClick(PostFilter postFilter); } - public PostFilterRecyclerViewAdapter(BaseActivity activity, OnItemClickListener onItemClickListener) { + public PostFilterRecyclerViewAdapter(BaseActivity activity, CustomThemeWrapper customThemeWrapper, + OnItemClickListener onItemClickListener) { this.activity = activity; + this.customThemeWrapper = customThemeWrapper; this.onItemClickListener = onItemClickListener; } @@ -74,6 +79,8 @@ public class PostFilterRecyclerViewAdapter extends RecyclerView.Adapter<Recycler super(itemView); textView = (TextView) itemView; + textView.setTextColor(customThemeWrapper.getPrimaryTextColor()); + if (activity.typeface != null) { textView.setTypeface(activity.typeface); } @@ -84,10 +91,13 @@ public class PostFilterRecyclerViewAdapter extends RecyclerView.Adapter<Recycler } } - private static class HeaderViewHolder extends RecyclerView.ViewHolder { + private class HeaderViewHolder extends RecyclerView.ViewHolder { public HeaderViewHolder(@NonNull View itemView) { super(itemView); + TextView infoTextView = itemView.findViewById(R.id.info_text_view_item_filter_fragment_header); + infoTextView.setTextColor(customThemeWrapper.getSecondaryTextColor()); + infoTextView.setCompoundDrawablesWithIntrinsicBounds(Utils.getTintedDrawable(activity, R.drawable.ic_info_preference_24dp, activity.customThemeWrapper.getPrimaryIconColor()), null, null, null); } } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterUsageRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterUsageRecyclerViewAdapter.java index fe0c3002..3f0db0e5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterUsageRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterUsageRecyclerViewAdapter.java @@ -12,20 +12,23 @@ import java.util.List; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.activities.BaseActivity; +import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.postfilter.PostFilterUsage; public class PostFilterUsageRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { private List<PostFilterUsage> postFilterUsages; - private OnItemClickListener onItemClickListener; private BaseActivity activity; + private CustomThemeWrapper customThemeWrapper; + private OnItemClickListener onItemClickListener; public interface OnItemClickListener { void onClick(PostFilterUsage postFilterUsage); } - public PostFilterUsageRecyclerViewAdapter(BaseActivity activity, + public PostFilterUsageRecyclerViewAdapter(BaseActivity activity, CustomThemeWrapper customThemeWrapper, OnItemClickListener onItemClickListener) { this.activity = activity; + this.customThemeWrapper = customThemeWrapper; this.onItemClickListener = onItemClickListener; } @@ -85,6 +88,8 @@ public class PostFilterUsageRecyclerViewAdapter extends RecyclerView.Adapter<Rec super(itemView); usageTextView = (TextView) itemView; + usageTextView.setTextColor(customThemeWrapper.getPrimaryTextColor()); + if (activity.typeface != null) { usageTextView.setTypeface(activity.typeface); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontEditTextPreference.java b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontEditTextPreference.java index bbdb1f80..49e8e438 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontEditTextPreference.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontEditTextPreference.java @@ -4,14 +4,18 @@ import android.content.Context; import android.graphics.Typeface; import android.util.AttributeSet; import android.view.View; +import android.widget.ImageView; import android.widget.TextView; import androidx.preference.EditTextPreference; import androidx.preference.PreferenceViewHolder; import ml.docilealligator.infinityforreddit.CustomFontReceiver; +import ml.docilealligator.infinityforreddit.CustomThemeWrapperReceiver; +import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; -public class CustomFontEditTextPreference extends EditTextPreference implements CustomFontReceiver { +public class CustomFontEditTextPreference extends EditTextPreference implements CustomFontReceiver, CustomThemeWrapperReceiver { + private CustomThemeWrapper customThemeWrapper; private Typeface typeface; public CustomFontEditTextPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { @@ -33,12 +37,30 @@ public class CustomFontEditTextPreference extends EditTextPreference implements @Override public void onBindViewHolder(PreferenceViewHolder holder) { super.onBindViewHolder(holder); + View iconImageView = holder.findViewById(android.R.id.icon); + View titleTextView = holder.findViewById(android.R.id.title); + View summaryTextView = holder.findViewById(android.R.id.summary); + + if (customThemeWrapper != null) { + if (iconImageView instanceof ImageView) { + if (isEnabled()) { + ((ImageView) iconImageView).setColorFilter(customThemeWrapper.getPrimaryIconColor(), android.graphics.PorterDuff.Mode.SRC_IN); + } else { + ((ImageView) iconImageView).setColorFilter(customThemeWrapper.getSecondaryTextColor(), android.graphics.PorterDuff.Mode.SRC_IN); + } + } + if (titleTextView instanceof TextView) { + ((TextView) titleTextView).setTextColor(customThemeWrapper.getPrimaryTextColor()); + } + if (summaryTextView instanceof TextView) { + ((TextView) summaryTextView).setTextColor(customThemeWrapper.getSecondaryTextColor()); + } + } + if (typeface != null) { - View titleTextView = holder.findViewById(android.R.id.title); if (titleTextView instanceof TextView) { ((TextView) titleTextView).setTypeface(typeface); } - View summaryTextView = holder.findViewById(android.R.id.summary); if (summaryTextView instanceof TextView) { ((TextView) summaryTextView).setTypeface(typeface); } @@ -49,4 +71,9 @@ public class CustomFontEditTextPreference extends EditTextPreference implements public void setCustomFont(Typeface typeface, Typeface titleTypeface, Typeface contentTypeface) { this.typeface = typeface; } + + @Override + public void setCustomThemeWrapper(CustomThemeWrapper customThemeWrapper) { + this.customThemeWrapper = customThemeWrapper; + } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontListPreference.java b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontListPreference.java index ac4b2771..f7159828 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontListPreference.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontListPreference.java @@ -4,14 +4,18 @@ import android.content.Context; import android.graphics.Typeface; import android.util.AttributeSet; import android.view.View; +import android.widget.ImageView; import android.widget.TextView; import androidx.preference.ListPreference; import androidx.preference.PreferenceViewHolder; import ml.docilealligator.infinityforreddit.CustomFontReceiver; +import ml.docilealligator.infinityforreddit.CustomThemeWrapperReceiver; +import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; -public class CustomFontListPreference extends ListPreference implements CustomFontReceiver { +public class CustomFontListPreference extends ListPreference implements CustomFontReceiver, CustomThemeWrapperReceiver { + private CustomThemeWrapper customThemeWrapper; private Typeface typeface; public CustomFontListPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { @@ -33,12 +37,30 @@ public class CustomFontListPreference extends ListPreference implements CustomFo @Override public void onBindViewHolder(PreferenceViewHolder holder) { super.onBindViewHolder(holder); + View iconImageView = holder.findViewById(android.R.id.icon); + View titleTextView = holder.findViewById(android.R.id.title); + View summaryTextView = holder.findViewById(android.R.id.summary); + + if (customThemeWrapper != null) { + if (iconImageView instanceof ImageView) { + if (isEnabled()) { + ((ImageView) iconImageView).setColorFilter(customThemeWrapper.getPrimaryIconColor(), android.graphics.PorterDuff.Mode.SRC_IN); + } else { + ((ImageView) iconImageView).setColorFilter(customThemeWrapper.getSecondaryTextColor(), android.graphics.PorterDuff.Mode.SRC_IN); + } + } + if (titleTextView instanceof TextView) { + ((TextView) titleTextView).setTextColor(customThemeWrapper.getPrimaryTextColor()); + } + if (summaryTextView instanceof TextView) { + ((TextView) summaryTextView).setTextColor(customThemeWrapper.getSecondaryTextColor()); + } + } + if (typeface != null) { - View titleTextView = holder.findViewById(android.R.id.title); if (titleTextView instanceof TextView) { ((TextView) titleTextView).setTypeface(typeface); } - View summaryTextView = holder.findViewById(android.R.id.summary); if (summaryTextView instanceof TextView) { ((TextView) summaryTextView).setTypeface(typeface); } @@ -49,4 +71,9 @@ public class CustomFontListPreference extends ListPreference implements CustomFo public void setCustomFont(Typeface typeface, Typeface titleTypeface, Typeface contentTypeface) { this.typeface = typeface; } + + @Override + public void setCustomThemeWrapper(CustomThemeWrapper customThemeWrapper) { + this.customThemeWrapper = customThemeWrapper; + } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontPreference.java b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontPreference.java index e087b181..f08a157f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontPreference.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontPreference.java @@ -4,14 +4,18 @@ import android.content.Context; import android.graphics.Typeface; import android.util.AttributeSet; import android.view.View; +import android.widget.ImageView; import android.widget.TextView; import androidx.preference.Preference; import androidx.preference.PreferenceViewHolder; import ml.docilealligator.infinityforreddit.CustomFontReceiver; +import ml.docilealligator.infinityforreddit.CustomThemeWrapperReceiver; +import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; -public class CustomFontPreference extends Preference implements CustomFontReceiver { +public class CustomFontPreference extends Preference implements CustomFontReceiver, CustomThemeWrapperReceiver { + private CustomThemeWrapper customThemeWrapper; private Typeface typeface; public CustomFontPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { @@ -33,12 +37,30 @@ public class CustomFontPreference extends Preference implements CustomFontReceiv @Override public void onBindViewHolder(PreferenceViewHolder holder) { super.onBindViewHolder(holder); + View iconImageView = holder.findViewById(android.R.id.icon); + View titleTextView = holder.findViewById(android.R.id.title); + View summaryTextView = holder.findViewById(android.R.id.summary); + + if (customThemeWrapper != null) { + if (iconImageView instanceof ImageView) { + if (isEnabled()) { + ((ImageView) iconImageView).setColorFilter(customThemeWrapper.getPrimaryIconColor(), android.graphics.PorterDuff.Mode.SRC_IN); + } else { + ((ImageView) iconImageView).setColorFilter(customThemeWrapper.getSecondaryTextColor(), android.graphics.PorterDuff.Mode.SRC_IN); + } + } + if (titleTextView instanceof TextView) { + ((TextView) titleTextView).setTextColor(customThemeWrapper.getPrimaryTextColor()); + } + if (summaryTextView instanceof TextView) { + ((TextView) summaryTextView).setTextColor(customThemeWrapper.getSecondaryTextColor()); + } + } + if (typeface != null) { - View titleTextView = holder.findViewById(android.R.id.title); if (titleTextView instanceof TextView) { ((TextView) titleTextView).setTypeface(typeface); } - View summaryTextView = holder.findViewById(android.R.id.summary); if (summaryTextView instanceof TextView) { ((TextView) summaryTextView).setTypeface(typeface); } @@ -49,4 +71,9 @@ public class CustomFontPreference extends Preference implements CustomFontReceiv public void setCustomFont(Typeface typeface, Typeface titleTypeface, Typeface contentTypeface) { this.typeface = typeface; } + + @Override + public void setCustomThemeWrapper(CustomThemeWrapper customThemeWrapper) { + this.customThemeWrapper = customThemeWrapper; + } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontPreferenceCategory.java b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontPreferenceCategory.java index 2c7d6740..8514796d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontPreferenceCategory.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontPreferenceCategory.java @@ -10,8 +10,11 @@ import androidx.preference.PreferenceCategory; import androidx.preference.PreferenceViewHolder; import ml.docilealligator.infinityforreddit.CustomFontReceiver; +import ml.docilealligator.infinityforreddit.CustomThemeWrapperReceiver; +import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; -public class CustomFontPreferenceCategory extends PreferenceCategory implements CustomFontReceiver { +public class CustomFontPreferenceCategory extends PreferenceCategory implements CustomFontReceiver, CustomThemeWrapperReceiver { + private CustomThemeWrapper customThemeWrapper; private Typeface typeface; public CustomFontPreferenceCategory(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { @@ -33,15 +36,18 @@ public class CustomFontPreferenceCategory extends PreferenceCategory implements @Override public void onBindViewHolder(PreferenceViewHolder holder) { super.onBindViewHolder(holder); + View titleTextView = holder.findViewById(android.R.id.title); + + if (customThemeWrapper != null) { + if (titleTextView instanceof TextView) { + ((TextView) titleTextView).setTextColor(customThemeWrapper.getColorAccent()); + } + } + if (typeface != null) { - View titleTextView = holder.findViewById(android.R.id.title); if (titleTextView instanceof TextView) { ((TextView) titleTextView).setTypeface(typeface); } - View summaryTextView = holder.findViewById(android.R.id.summary); - if (summaryTextView instanceof TextView) { - ((TextView) summaryTextView).setTypeface(typeface); - } } } @@ -49,4 +55,9 @@ public class CustomFontPreferenceCategory extends PreferenceCategory implements public void setCustomFont(Typeface typeface, Typeface titleTypeface, Typeface contentTypeface) { this.typeface = typeface; } + + @Override + public void setCustomThemeWrapper(CustomThemeWrapper customThemeWrapper) { + this.customThemeWrapper = customThemeWrapper; + } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontPreferenceFragmentCompat.java b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontPreferenceFragmentCompat.java index 1984bb14..695131cf 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontPreferenceFragmentCompat.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontPreferenceFragmentCompat.java @@ -1,26 +1,37 @@ package ml.docilealligator.infinityforreddit.customviews; import android.content.Context; -import android.graphics.Typeface; +import android.os.Bundle; +import android.view.View; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import androidx.preference.Preference; import androidx.preference.PreferenceFragmentCompat; import ml.docilealligator.infinityforreddit.CustomFontReceiver; +import ml.docilealligator.infinityforreddit.CustomThemeWrapperReceiver; import ml.docilealligator.infinityforreddit.activities.SettingsActivity; public abstract class CustomFontPreferenceFragmentCompat extends PreferenceFragmentCompat { protected SettingsActivity activity; - protected void setFont(Typeface typeface) { + @Override + public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + int preferenceCount = getPreferenceScreen().getPreferenceCount(); for (int i = 0; i < preferenceCount; i++) { Preference preference = getPreferenceScreen().getPreference(i); + if (preference instanceof CustomThemeWrapperReceiver) { + ((CustomThemeWrapperReceiver) preference).setCustomThemeWrapper(activity.customThemeWrapper); + } if (preference instanceof CustomFontReceiver) { - ((CustomFontReceiver) preference).setCustomFont(typeface, null, null); + ((CustomFontReceiver) preference).setCustomFont(activity.typeface, null, null); } } + + view.setBackgroundColor(activity.customThemeWrapper.getBackgroundColor()); } @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontSeekBarPreference.java b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontSeekBarPreference.java index d7d9454f..08a0477b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontSeekBarPreference.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontSeekBarPreference.java @@ -4,14 +4,18 @@ import android.content.Context; import android.graphics.Typeface; import android.util.AttributeSet; import android.view.View; +import android.widget.ImageView; import android.widget.TextView; import androidx.preference.PreferenceViewHolder; import androidx.preference.SeekBarPreference; import ml.docilealligator.infinityforreddit.CustomFontReceiver; +import ml.docilealligator.infinityforreddit.CustomThemeWrapperReceiver; +import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; -public class CustomFontSeekBarPreference extends SeekBarPreference implements CustomFontReceiver { +public class CustomFontSeekBarPreference extends SeekBarPreference implements CustomFontReceiver, CustomThemeWrapperReceiver { + private CustomThemeWrapper customThemeWrapper; private Typeface typeface; public CustomFontSeekBarPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { @@ -33,12 +37,30 @@ public class CustomFontSeekBarPreference extends SeekBarPreference implements Cu @Override public void onBindViewHolder(PreferenceViewHolder holder) { super.onBindViewHolder(holder); + View iconImageView = holder.findViewById(android.R.id.icon); + View titleTextView = holder.findViewById(android.R.id.title); + View summaryTextView = holder.findViewById(android.R.id.summary); + + if (customThemeWrapper != null) { + if (iconImageView instanceof ImageView) { + if (isEnabled()) { + ((ImageView) iconImageView).setColorFilter(customThemeWrapper.getPrimaryIconColor(), android.graphics.PorterDuff.Mode.SRC_IN); + } else { + ((ImageView) iconImageView).setColorFilter(customThemeWrapper.getSecondaryTextColor(), android.graphics.PorterDuff.Mode.SRC_IN); + } + } + if (titleTextView instanceof TextView) { + ((TextView) titleTextView).setTextColor(customThemeWrapper.getPrimaryTextColor()); + } + if (summaryTextView instanceof TextView) { + ((TextView) summaryTextView).setTextColor(customThemeWrapper.getSecondaryTextColor()); + } + } + if (typeface != null) { - View titleTextView = holder.findViewById(android.R.id.title); if (titleTextView instanceof TextView) { ((TextView) titleTextView).setTypeface(typeface); } - View summaryTextView = holder.findViewById(android.R.id.summary); if (summaryTextView instanceof TextView) { ((TextView) summaryTextView).setTypeface(typeface); } @@ -49,4 +71,9 @@ public class CustomFontSeekBarPreference extends SeekBarPreference implements Cu public void setCustomFont(Typeface typeface, Typeface titleTypeface, Typeface contentTypeface) { this.typeface = typeface; } + + @Override + public void setCustomThemeWrapper(CustomThemeWrapper customThemeWrapper) { + this.customThemeWrapper = customThemeWrapper; + } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontSwitchPreference.java b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontSwitchPreference.java index b7c62834..8a4ee1b8 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontSwitchPreference.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CustomFontSwitchPreference.java @@ -4,14 +4,18 @@ import android.content.Context; import android.graphics.Typeface; import android.util.AttributeSet; import android.view.View; +import android.widget.ImageView; import android.widget.TextView; import androidx.preference.PreferenceViewHolder; import androidx.preference.SwitchPreference; import ml.docilealligator.infinityforreddit.CustomFontReceiver; +import ml.docilealligator.infinityforreddit.CustomThemeWrapperReceiver; +import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; -public class CustomFontSwitchPreference extends SwitchPreference implements CustomFontReceiver { +public class CustomFontSwitchPreference extends SwitchPreference implements CustomFontReceiver, CustomThemeWrapperReceiver { + private CustomThemeWrapper customThemeWrapper; private Typeface typeface; public CustomFontSwitchPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { @@ -33,12 +37,30 @@ public class CustomFontSwitchPreference extends SwitchPreference implements Cust @Override public void onBindViewHolder(PreferenceViewHolder holder) { super.onBindViewHolder(holder); + View iconImageView = holder.findViewById(android.R.id.icon); + View titleTextView = holder.findViewById(android.R.id.title); + View summaryTextView = holder.findViewById(android.R.id.summary); + + if (customThemeWrapper != null) { + if (iconImageView instanceof ImageView) { + if (isEnabled()) { + ((ImageView) iconImageView).setColorFilter(customThemeWrapper.getPrimaryIconColor(), android.graphics.PorterDuff.Mode.SRC_IN); + } else { + ((ImageView) iconImageView).setColorFilter(customThemeWrapper.getSecondaryTextColor(), android.graphics.PorterDuff.Mode.SRC_IN); + } + } + if (titleTextView instanceof TextView) { + ((TextView) titleTextView).setTextColor(customThemeWrapper.getPrimaryTextColor()); + } + if (summaryTextView instanceof TextView) { + ((TextView) summaryTextView).setTextColor(customThemeWrapper.getSecondaryTextColor()); + } + } + if (typeface != null) { - View titleTextView = holder.findViewById(android.R.id.title); if (titleTextView instanceof TextView) { ((TextView) titleTextView).setTypeface(typeface); } - View summaryTextView = holder.findViewById(android.R.id.summary); if (summaryTextView instanceof TextView) { ((TextView) summaryTextView).setTypeface(typeface); } @@ -49,4 +71,9 @@ public class CustomFontSwitchPreference extends SwitchPreference implements Cust public void setCustomFont(Typeface typeface, Typeface titleTypeface, Typeface contentTypeface) { this.typeface = typeface; } + + @Override + public void setCustomThemeWrapper(CustomThemeWrapper customThemeWrapper) { + this.customThemeWrapper = customThemeWrapper; + } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/AboutPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/AboutPreferenceFragment.java index f746cf48..05be43a7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/AboutPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/AboutPreferenceFragment.java @@ -25,10 +25,6 @@ public class AboutPreferenceFragment extends CustomFontPreferenceFragmentCompat public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { setPreferencesFromResource(R.xml.about_preferences, rootKey); - if (activity.typeface != null) { - setFont(activity.typeface); - } - Preference openSourcePreference = findPreference(SharedPreferencesUtils.OPEN_SOURCE_KEY); Preference ratePreference = findPreference(SharedPreferencesUtils.RATE_KEY); Preference emailPreference = findPreference(SharedPreferencesUtils.EMAIL_KEY); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/AcknowledgementFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/AcknowledgementFragment.java index 0ea2cbba..89d3fcc6 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/AcknowledgementFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/AcknowledgementFragment.java @@ -17,7 +17,7 @@ import java.util.ArrayList; import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.activities.BaseActivity; +import ml.docilealligator.infinityforreddit.activities.SettingsActivity; import ml.docilealligator.infinityforreddit.adapters.AcknowledgementRecyclerViewAdapter; import ml.docilealligator.infinityforreddit.customviews.LinearLayoutManagerBugFixed; @@ -28,7 +28,7 @@ public class AcknowledgementFragment extends Fragment { @BindView(R.id.recycler_view_acknowledgement_fragment) RecyclerView recyclerView; - private BaseActivity activity; + private SettingsActivity activity; public AcknowledgementFragment() { // Required empty public constructor @@ -127,12 +127,14 @@ public class AcknowledgementFragment extends Fragment { recyclerView.setLayoutManager(new LinearLayoutManagerBugFixed(activity)); recyclerView.setAdapter(adapter); + rootView.setBackgroundColor(activity.customThemeWrapper.getBackgroundColor()); + return rootView; } @Override public void onAttach(@NonNull Context context) { super.onAttach(context); - activity = (BaseActivity) context; + activity = (SettingsActivity) context; } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/AdvancedPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/AdvancedPreferenceFragment.java index 5bc9fd91..359a95ff 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/AdvancedPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/AdvancedPreferenceFragment.java @@ -3,7 +3,6 @@ package ml.docilealligator.infinityforreddit.settings; import static android.app.Activity.RESULT_OK; import static android.content.Intent.ACTION_OPEN_DOCUMENT_TREE; -import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; @@ -11,7 +10,6 @@ import android.os.Bundle; import android.os.Handler; import android.widget.Toast; -import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.preference.Preference; @@ -28,7 +26,6 @@ import javax.inject.Named; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; -import ml.docilealligator.infinityforreddit.activities.SettingsActivity; import ml.docilealligator.infinityforreddit.asynctasks.BackupSettings; import ml.docilealligator.infinityforreddit.asynctasks.DeleteAllPostLayouts; import ml.docilealligator.infinityforreddit.asynctasks.DeleteAllReadPosts; @@ -92,10 +89,6 @@ public class AdvancedPreferenceFragment extends CustomFontPreferenceFragmentComp ((Infinity) activity.getApplication()).getAppComponent().inject(this); - if (activity.typeface != null) { - setFont(activity.typeface); - } - Preference deleteSubredditsPreference = findPreference(SharedPreferencesUtils.DELETE_ALL_SUBREDDITS_DATA_IN_DATABASE); Preference deleteUsersPreference = findPreference(SharedPreferencesUtils.DELETE_ALL_USERS_DATA_IN_DATABASE); Preference deleteSortTypePreference = findPreference(SharedPreferencesUtils.DELETE_ALL_SORT_TYPE_DATA_IN_DATABASE); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CommentPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CommentPreferenceFragment.java index 2baef8f2..f055e422 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CommentPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CommentPreferenceFragment.java @@ -26,10 +26,6 @@ public class CommentPreferenceFragment extends CustomFontPreferenceFragmentCompa ((Infinity) activity.getApplication()).getAppComponent().inject(this); - if (activity.typeface != null) { - setFont(activity.typeface); - } - SeekBarPreference showFewerToolbarOptionsThresholdSeekBarPreference = findPreference(SharedPreferencesUtils.SHOW_FEWER_TOOLBAR_OPTIONS_THRESHOLD); if (showFewerToolbarOptionsThresholdSeekBarPreference != null) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CrashReportsFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CrashReportsFragment.java index f49113fc..90ba39c5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CrashReportsFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CrashReportsFragment.java @@ -51,6 +51,8 @@ public class CrashReportsFragment extends Fragment { recyclerView.setAdapter(new CrashReportsRecyclerViewAdapter(activity, CrashyReporter.INSTANCE.getLogsAsStrings())); + recyclerView.setBackgroundColor(activity.customThemeWrapper.getBackgroundColor()); + return recyclerView; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CreditsPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CreditsPreferenceFragment.java index 81e11eea..f6db3220 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CreditsPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CreditsPreferenceFragment.java @@ -1,18 +1,15 @@ package ml.docilealligator.infinityforreddit.settings; -import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Bundle; -import androidx.annotation.NonNull; import androidx.preference.Preference; import androidx.preference.PreferenceFragmentCompat; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.activities.LinkResolverActivity; -import ml.docilealligator.infinityforreddit.activities.SettingsActivity; import ml.docilealligator.infinityforreddit.customviews.CustomFontPreferenceFragmentCompat; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; @@ -25,10 +22,6 @@ public class CreditsPreferenceFragment extends CustomFontPreferenceFragmentCompa public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { setPreferencesFromResource(R.xml.credits_preferences, rootKey); - if (activity.typeface != null) { - setFont(activity.typeface); - } - Preference iconForegroundPreference = findPreference(SharedPreferencesUtils.ICON_FOREGROUND_KEY); Preference iconBackgroundPreference = findPreference(SharedPreferencesUtils.ICON_BACKGROUND_KEY); Preference errorImagePreference = findPreference(SharedPreferencesUtils.ERROR_IMAGE_KEY); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CustomizeBottomAppBarFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CustomizeBottomAppBarFragment.java index 4a295880..cf6d9a64 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CustomizeBottomAppBarFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CustomizeBottomAppBarFragment.java @@ -3,6 +3,7 @@ package ml.docilealligator.infinityforreddit.settings; import android.content.Context; import android.content.SharedPreferences; import android.content.res.Resources; +import android.graphics.drawable.Drawable; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; @@ -25,7 +26,7 @@ import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.activities.BaseActivity; +import ml.docilealligator.infinityforreddit.activities.SettingsActivity; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; import ml.docilealligator.infinityforreddit.utils.Utils; @@ -39,26 +40,38 @@ public class CustomizeBottomAppBarFragment extends Fragment { TextView mainActivityGroupSummaryTextView; @BindView(R.id.main_activity_option_count_linear_layout_customize_bottom_app_bar_fragment) LinearLayout mainActivityOptionCountLinearLayout; + @BindView(R.id.main_activity_option_count_title_text_view_customize_bottom_app_bar_fragment) + TextView mainActivityOptionCountTitleTextView; @BindView(R.id.main_activity_option_count_text_view_customize_bottom_app_bar_fragment) TextView mainActivityOptionCountTextView; @BindView(R.id.main_activity_option_1_linear_layout_customize_bottom_app_bar_fragment) LinearLayout mainActivityOption1LinearLayout; + @BindView(R.id.main_activity_option_1_title_text_view_customize_bottom_app_bar_fragment) + TextView mainActivityOption1TitleTextView; @BindView(R.id.main_activity_option_1_text_view_customize_bottom_app_bar_fragment) TextView mainActivityOption1TextView; @BindView(R.id.main_activity_option_2_linear_layout_customize_bottom_app_bar_fragment) LinearLayout mainActivityOption2LinearLayout; + @BindView(R.id.main_activity_option_2_title_text_view_customize_bottom_app_bar_fragment) + TextView mainActivityOption2TitleTextView; @BindView(R.id.main_activity_option_2_text_view_customize_bottom_app_bar_fragment) TextView mainActivityOption2TextView; @BindView(R.id.main_activity_option_3_linear_layout_customize_bottom_app_bar_fragment) LinearLayout mainActivityOption3LinearLayout; + @BindView(R.id.main_activity_option_3_title_text_view_customize_bottom_app_bar_fragment) + TextView mainActivityOption3TitleTextView; @BindView(R.id.main_activity_option_3_text_view_customize_bottom_app_bar_fragment) TextView mainActivityOption3TextView; @BindView(R.id.main_activity_option_4_linear_layout_customize_bottom_app_bar_fragment) LinearLayout mainActivityOption4LinearLayout; + @BindView(R.id.main_activity_option_4_title_text_view_customize_bottom_app_bar_fragment) + TextView mainActivityOption4TitleTextView; @BindView(R.id.main_activity_option_4_text_view_customize_bottom_app_bar_fragment) TextView mainActivityOption4TextView; @BindView(R.id.main_activity_fab_linear_layout_customize_bottom_app_bar_fragment) LinearLayout mainActivityFABLinearLayout; + @BindView(R.id.main_activity_fab_title_text_view_customize_bottom_app_bar_fragment) + TextView mainActivityFABTitleTextView; @BindView(R.id.main_activity_fab_text_view_customize_bottom_app_bar_fragment) TextView mainActivityFABTextView; @@ -68,32 +81,44 @@ public class CustomizeBottomAppBarFragment extends Fragment { TextView otherActivitiesGroupSummaryTextView; @BindView(R.id.other_activities_option_count_linear_layout_customize_bottom_app_bar_fragment) LinearLayout otherActivitiesOptionCountLinearLayout; + @BindView(R.id.other_activities_option_count_title_text_view_customize_bottom_app_bar_fragment) + TextView otherActivitiesOptionCountTitleTextView; @BindView(R.id.other_activities_option_count_text_view_customize_bottom_app_bar_fragment) TextView otherActivitiesOptionCountTextView; @BindView(R.id.other_activities_option_1_linear_layout_customize_bottom_app_bar_fragment) LinearLayout otherActivitiesOption1LinearLayout; + @BindView(R.id.other_activities_option_1_title_text_view_customize_bottom_app_bar_fragment) + TextView otherActivitiesOption1TitleTextView; @BindView(R.id.other_activities_option_1_text_view_customize_bottom_app_bar_fragment) TextView otherActivitiesOption1TextView; @BindView(R.id.other_activities_option_2_linear_layout_customize_bottom_app_bar_fragment) LinearLayout otherActivitiesOption2LinearLayout; + @BindView(R.id.other_activities_option_2_title_text_view_customize_bottom_app_bar_fragment) + TextView otherActivitiesOption2TitleTextView; @BindView(R.id.other_activities_option_2_text_view_customize_bottom_app_bar_fragment) TextView otherActivitiesOption2TextView; @BindView(R.id.other_activities_option_3_linear_layout_customize_bottom_app_bar_fragment) LinearLayout otherActivitiesOption3LinearLayout; + @BindView(R.id.other_activities_option_3_title_text_view_customize_bottom_app_bar_fragment) + TextView otherActivitiesOption3TitleTextView; @BindView(R.id.other_activities_option_3_text_view_customize_bottom_app_bar_fragment) TextView otherActivitiesOption3TextView; @BindView(R.id.other_activities_option_4_linear_layout_customize_bottom_app_bar_fragment) LinearLayout otherActivitiesOption4LinearLayout; + @BindView(R.id.other_activities_option_4_title_text_view_customize_bottom_app_bar_fragment) + TextView otherActivitiesOption4TitleTextView; @BindView(R.id.other_activities_option_4_text_view_customize_bottom_app_bar_fragment) TextView otherActivitiesOption4TextView; @BindView(R.id.other_activities_fab_linear_layout_customize_bottom_app_bar_fragment) LinearLayout otherActivitiesFABLinearLayout; + @BindView(R.id.other_activities_fab_title_text_view_customize_bottom_app_bar_fragment) + TextView otherActivitiesFABTitleTextView; @BindView(R.id.other_activities_fab_text_view_customize_bottom_app_bar_fragment) TextView otherActivitiesFABTextView; @Inject @Named("bottom_app_bar") SharedPreferences sharedPreferences; - private BaseActivity activity; + private SettingsActivity activity; private int mainActivityOptionCount; private int mainActivityOption1; private int mainActivityOption2; @@ -121,6 +146,10 @@ public class CustomizeBottomAppBarFragment extends Fragment { ButterKnife.bind(this, rootView); + rootView.setBackgroundColor(activity.customThemeWrapper.getBackgroundColor()); + + applyCustomTheme(); + if (activity.typeface != null) { Utils.setFontToAllTextViews(rootView, activity.typeface); } @@ -359,9 +388,45 @@ public class CustomizeBottomAppBarFragment extends Fragment { return rootView; } + private void applyCustomTheme() { + int primaryTextColor = activity.customThemeWrapper.getPrimaryTextColor(); + int secondaryTextColor = activity.customThemeWrapper.getSecondaryTextColor(); + int accentColor = activity.customThemeWrapper.getColorAccent(); + infoTextView.setTextColor(secondaryTextColor); + Drawable infoDrawable = Utils.getTintedDrawable(activity, R.drawable.ic_info_preference_24dp, activity.customThemeWrapper.getPrimaryIconColor()); + infoTextView.setCompoundDrawablesWithIntrinsicBounds(infoDrawable, null, null, null); + mainActivityGroupSummaryTextView.setTextColor(accentColor); + mainActivityOptionCountTitleTextView.setTextColor(primaryTextColor); + mainActivityOptionCountTextView.setTextColor(secondaryTextColor); + mainActivityOption1TitleTextView.setTextColor(primaryTextColor); + mainActivityOption1TextView.setTextColor(secondaryTextColor); + mainActivityOption2TitleTextView.setTextColor(primaryTextColor); + mainActivityOption2TextView.setTextColor(secondaryTextColor); + mainActivityOption3TitleTextView.setTextColor(primaryTextColor); + mainActivityOption3TextView.setTextColor(secondaryTextColor); + mainActivityOption4TitleTextView.setTextColor(primaryTextColor); + mainActivityOption4TextView.setTextColor(secondaryTextColor); + mainActivityFABTitleTextView.setTextColor(primaryTextColor); + mainActivityFABTextView.setTextColor(secondaryTextColor); + + otherActivitiesGroupSummaryTextView.setTextColor(accentColor); + otherActivitiesOptionCountTitleTextView.setTextColor(primaryTextColor); + otherActivitiesOptionCountTextView.setTextColor(secondaryTextColor); + otherActivitiesOption1TitleTextView.setTextColor(primaryTextColor); + otherActivitiesOption1TextView.setTextColor(secondaryTextColor); + otherActivitiesOption2TitleTextView.setTextColor(primaryTextColor); + otherActivitiesOption2TextView.setTextColor(secondaryTextColor); + otherActivitiesOption3TitleTextView.setTextColor(primaryTextColor); + otherActivitiesOption3TextView.setTextColor(secondaryTextColor); + otherActivitiesOption4TitleTextView.setTextColor(primaryTextColor); + otherActivitiesOption4TextView.setTextColor(secondaryTextColor); + otherActivitiesFABTitleTextView.setTextColor(primaryTextColor); + otherActivitiesFABTextView.setTextColor(secondaryTextColor); + } + @Override public void onAttach(@NonNull Context context) { super.onAttach(context); - activity = (BaseActivity) context; + activity = (SettingsActivity) context; } }
\ No newline at end of file diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CustomizeMainPageTabsFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CustomizeMainPageTabsFragment.java index d593c6ba..1a5cab8a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CustomizeMainPageTabsFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CustomizeMainPageTabsFragment.java @@ -4,6 +4,7 @@ import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; +import android.graphics.drawable.Drawable; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; @@ -29,9 +30,9 @@ import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.activities.BaseActivity; import ml.docilealligator.infinityforreddit.activities.MultiredditSelectionActivity; import ml.docilealligator.infinityforreddit.activities.SearchActivity; +import ml.docilealligator.infinityforreddit.activities.SettingsActivity; import ml.docilealligator.infinityforreddit.activities.SubredditSelectionActivity; import ml.docilealligator.infinityforreddit.multireddit.MultiReddit; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; @@ -45,10 +46,14 @@ public class CustomizeMainPageTabsFragment extends Fragment { TextView infoTextView; @BindView(R.id.tab_count_linear_layout_customize_main_page_tabs_fragment) LinearLayout tabCountLinearLayout; + @BindView(R.id.tab_count_title_text_view_customize_main_page_tabs_fragment) + TextView tabCountTitleTextView; @BindView(R.id.tab_count_text_view_customize_main_page_tabs_fragment) TextView tabCountTextView; @BindView(R.id.show_tab_names_linear_layout_customize_main_page_tabs_fragment) LinearLayout showTabNamesLinearLayout; + @BindView(R.id.show_tab_names_title_text_view_customize_main_page_tabs_fragment) + TextView showTabNamesTitleTextView; @BindView(R.id.show_tab_names_switch_material_customize_main_page_tabs_fragment) SwitchMaterial showTabNamesSwitch; @BindView(R.id.divider_1_customize_main_page_tabs_fragment) @@ -57,10 +62,14 @@ public class CustomizeMainPageTabsFragment extends Fragment { TextView tab1GroupSummaryTextView; @BindView(R.id.tab_1_title_linear_layout_customize_main_page_tabs_fragment) LinearLayout tab1TitleLinearLayout; + @BindView(R.id.tab_1_title_title_text_view_customize_main_page_tabs_fragment) + TextView tab1TitleTitleTextView; @BindView(R.id.tab_1_title_summary_text_view_customize_main_page_tabs_fragment) TextView tab1TitleSummaryTextView; @BindView(R.id.tab_1_type_linear_layout_customize_main_page_tabs_fragment) LinearLayout tab1TypeLinearLayout; + @BindView(R.id.tab_1_type_title_text_view_customize_main_page_tabs_fragment) + TextView tab1TypeTitleTextView; @BindView(R.id.tab_1_type_summary_text_view_customize_main_page_tabs_fragment) TextView tab1TypeSummaryTextView; @BindView(R.id.tab_1_name_constraint_layout_customize_main_page_tabs_fragment) @@ -77,10 +86,14 @@ public class CustomizeMainPageTabsFragment extends Fragment { TextView tab2GroupSummaryTextView; @BindView(R.id.tab_2_title_linear_layout_customize_main_page_tabs_fragment) LinearLayout tab2TitleLinearLayout; + @BindView(R.id.tab_2_title_title_text_view_customize_main_page_tabs_fragment) + TextView tab2TitleTitleTextView; @BindView(R.id.tab_2_title_summary_text_view_customize_main_page_tabs_fragment) TextView tab2TitleSummaryTextView; @BindView(R.id.tab_2_type_linear_layout_customize_main_page_tabs_fragment) LinearLayout tab2TypeLinearLayout; + @BindView(R.id.tab_2_type_title_text_view_customize_main_page_tabs_fragment) + TextView tab2TypeTitleTextView; @BindView(R.id.tab_2_type_summary_text_view_customize_main_page_tabs_fragment) TextView tab2TypeSummaryTextView; @BindView(R.id.tab_2_name_constraint_layout_customize_main_page_tabs_fragment) @@ -97,10 +110,14 @@ public class CustomizeMainPageTabsFragment extends Fragment { TextView tab3GroupSummaryTextView; @BindView(R.id.tab_3_title_linear_layout_customize_main_page_tabs_fragment) LinearLayout tab3TitleLinearLayout; + @BindView(R.id.tab_3_title_title_text_view_customize_main_page_tabs_fragment) + TextView tab3TitleTitleTextView; @BindView(R.id.tab_3_title_summary_text_view_customize_main_page_tabs_fragment) TextView tab3TitleSummaryTextView; @BindView(R.id.tab_3_type_linear_layout_customize_main_page_tabs_fragment) LinearLayout tab3TypeLinearLayout; + @BindView(R.id.tab_3_type_title_text_view_customize_main_page_tabs_fragment) + TextView tab3TypeTitleTextView; @BindView(R.id.tab_3_type_summary_text_view_customize_main_page_tabs_fragment) TextView tab3TypeSummaryTextView; @BindView(R.id.tab_3_name_constraint_layout_customize_main_page_tabs_fragment) @@ -119,24 +136,32 @@ public class CustomizeMainPageTabsFragment extends Fragment { TextView moreTabsInfoTextView; @BindView(R.id.show_favorite_multireddits_linear_layout_customize_main_page_tabs_fragment) LinearLayout showFavoriteMultiredditsLinearLayout; + @BindView(R.id.show_favorite_multireddits_title_text_view_customize_main_page_tabs_fragment) + TextView showFavoriteMultiredditsTitleTextView; @BindView(R.id.show_favorite_multireddits_switch_material_customize_main_page_tabs_fragment) SwitchMaterial showFavoriteMultiredditsSwitchMaterial; @BindView(R.id.show_multireddits_linear_layout_customize_main_page_tabs_fragment) LinearLayout showMultiredditsLinearLayout; + @BindView(R.id.show_multireddits_title_text_view_customize_main_page_tabs_fragment) + TextView showMultiredditsTitleTextView; @BindView(R.id.show_multireddits_switch_material_customize_main_page_tabs_fragment) SwitchMaterial showMultiredditsSwitchMaterial; @BindView(R.id.show_subscribed_subreddits_linear_layout_customize_main_page_tabs_fragment) LinearLayout showSubscribedSubredditsLinearLayout; + @BindView(R.id.show_subscribed_subreddits_title_text_view_customize_main_page_tabs_fragment) + TextView showSubscribedSubredditsTitleTextView; @BindView(R.id.show_subscribed_subreddits_switch_material_customize_main_page_tabs_fragment) SwitchMaterial showSubscribedSubredditsSwitchMaterial; @BindView(R.id.show_favorite_subscribed_subreddits_linear_layout_customize_main_page_tabs_fragment) LinearLayout showFavoriteSubscribedSubredditsLinearLayout; + @BindView(R.id.show_favorite_subscribed_subreddits_title_text_view_customize_main_page_tabs_fragment) + TextView showFavoriteSubscribedSubredditsTitleTextView; @BindView(R.id.show_favorite_subscribed_subreddits_switch_material_customize_main_page_tabs_fragment) SwitchMaterial showFavoriteSubscribedSubredditsSwitchMaterial; @Inject @Named("main_activity_tabs") SharedPreferences mainActivityTabsSharedPreferences; - private BaseActivity activity; + private SettingsActivity activity; private String accountName; private int tabCount; private String tab1CurrentTitle; @@ -163,6 +188,9 @@ public class CustomizeMainPageTabsFragment extends Fragment { ButterKnife.bind(this, rootView); + rootView.setBackgroundColor(activity.customThemeWrapper.getBackgroundColor()); + applyCustomTheme(); + if (activity.typeface != null) { Utils.setFontToAllTextViews(rootView, activity.typeface); } @@ -525,6 +553,50 @@ public class CustomizeMainPageTabsFragment extends Fragment { return rootView; } + private void applyCustomTheme() { + int primaryTextColor = activity.customThemeWrapper.getPrimaryTextColor(); + int secondaryTextColor = activity.customThemeWrapper.getSecondaryTextColor(); + int colorAccent = activity.customThemeWrapper.getColorAccent(); + int primaryIconColor = activity.customThemeWrapper.getPrimaryIconColor(); + infoTextView.setTextColor(secondaryTextColor); + Drawable infoDrawable = Utils.getTintedDrawable(activity, R.drawable.ic_info_preference_24dp, secondaryTextColor); + infoTextView.setCompoundDrawablesWithIntrinsicBounds(infoDrawable, null, null, null); + tabCountTitleTextView.setTextColor(primaryTextColor); + tabCountTextView.setTextColor(secondaryTextColor); + showTabNamesTitleTextView.setTextColor(primaryTextColor); + tab1GroupSummaryTextView.setTextColor(colorAccent); + tab1TitleTitleTextView.setTextColor(primaryTextColor); + tab1TitleSummaryTextView.setTextColor(secondaryTextColor); + tab1TypeTitleTextView.setTextColor(primaryTextColor); + tab1TypeSummaryTextView.setTextColor(secondaryTextColor); + tab1NameTitleTextView.setTextColor(primaryTextColor); + tab1NameSummaryTextView.setTextColor(secondaryTextColor); + tab1AddImageView.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN); + tab2GroupSummaryTextView.setTextColor(colorAccent); + tab2TitleTitleTextView.setTextColor(primaryTextColor); + tab2TitleSummaryTextView.setTextColor(secondaryTextColor); + tab2TypeTitleTextView.setTextColor(primaryTextColor); + tab2TypeSummaryTextView.setTextColor(secondaryTextColor); + tab2NameTitleTextView.setTextColor(primaryTextColor); + tab2NameSummaryTextView.setTextColor(secondaryTextColor); + tab2AddImageView.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN); + tab3GroupSummaryTextView.setTextColor(colorAccent); + tab3TitleTitleTextView.setTextColor(primaryTextColor); + tab3TitleSummaryTextView.setTextColor(secondaryTextColor); + tab3TypeTitleTextView.setTextColor(primaryTextColor); + tab3TypeSummaryTextView.setTextColor(secondaryTextColor); + tab3NameTitleTextView.setTextColor(primaryTextColor); + tab3NameSummaryTextView.setTextColor(secondaryTextColor); + tab3AddImageView.setColorFilter(primaryIconColor, android.graphics.PorterDuff.Mode.SRC_IN); + moreTabsGroupSummaryTextView.setTextColor(colorAccent); + moreTabsInfoTextView.setTextColor(secondaryTextColor); + moreTabsInfoTextView.setCompoundDrawablesWithIntrinsicBounds(infoDrawable, null, null, null); + showFavoriteMultiredditsTitleTextView.setTextColor(primaryTextColor); + showMultiredditsTitleTextView.setTextColor(primaryTextColor); + showSubscribedSubredditsTitleTextView.setTextColor(primaryTextColor); + showFavoriteSubscribedSubredditsTitleTextView.setTextColor(primaryTextColor); + } + private void applyTab1NameView(ConstraintLayout constraintLayout, TextView titleTextView, int postType) { switch (postType) { case SharedPreferencesUtils.MAIN_PAGE_TAB_POST_TYPE_SUBREDDIT: @@ -713,6 +785,6 @@ public class CustomizeMainPageTabsFragment extends Fragment { @Override public void onAttach(@NonNull Context context) { super.onAttach(context); - activity = (BaseActivity) context; + activity = (SettingsActivity) context; } }
\ No newline at end of file diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/DataSavingModePreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/DataSavingModePreferenceFragment.java index 8ab39189..c513587e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/DataSavingModePreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/DataSavingModePreferenceFragment.java @@ -20,10 +20,6 @@ public class DataSavingModePreferenceFragment extends CustomFontPreferenceFragme public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { setPreferencesFromResource(R.xml.data_saving_mode_preferences, rootKey); - if (activity.typeface != null) { - setFont(activity.typeface); - } - ListPreference dataSavingModeListPreference = findPreference(SharedPreferencesUtils.DATA_SAVING_MODE); SwitchPreference disableImagePreviewPreference = findPreference(SharedPreferencesUtils.DISABLE_IMAGE_PREVIEW); SwitchPreference onlyDisablePreviewInVideoAndGifPostsPreference = findPreference(SharedPreferencesUtils.ONLY_DISABLE_PREVIEW_IN_VIDEO_AND_GIF_POSTS); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/DownloadLocationPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/DownloadLocationPreferenceFragment.java index e28f721c..8c717c5c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/DownloadLocationPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/DownloadLocationPreferenceFragment.java @@ -3,12 +3,10 @@ package ml.docilealligator.infinityforreddit.settings; import static android.content.Intent.ACTION_OPEN_DOCUMENT_TREE; import android.app.Activity; -import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; -import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.preference.Preference; @@ -17,7 +15,6 @@ import javax.inject.Named; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.activities.SettingsActivity; import ml.docilealligator.infinityforreddit.customviews.CustomFontPreferenceFragmentCompat; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; @@ -40,10 +37,6 @@ public class DownloadLocationPreferenceFragment extends CustomFontPreferenceFrag ((Infinity) activity.getApplication()).getAppComponent().inject(this); setPreferencesFromResource(R.xml.download_location_preferences, rootKey); - if (activity.typeface != null) { - setFont(activity.typeface); - } - imageDownloadLocationPreference = findPreference(SharedPreferencesUtils.IMAGE_DOWNLOAD_LOCATION); gifDownloadLocationPreference = findPreference(SharedPreferencesUtils.GIF_DOWNLOAD_LOCATION); videoDownloadLocationPreference = findPreference(SharedPreferencesUtils.VIDEO_DOWNLOAD_LOCATION); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/FontPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/FontPreferenceFragment.java index 42227646..5999df59 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/FontPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/FontPreferenceFragment.java @@ -56,10 +56,6 @@ public class FontPreferenceFragment extends CustomFontPreferenceFragmentCompat { ((Infinity) activity.getApplication()).getAppComponent().inject(this); - if (activity.typeface != null) { - setFont(activity.typeface); - } - ListPreference fontFamilyPreference = findPreference(SharedPreferencesUtils.FONT_FAMILY_KEY); customFontFamilyPreference = findPreference(SharedPreferencesUtils.CUSTOM_FONT_FAMILY_KEY); ListPreference titleFontFamilyPreference = findPreference(SharedPreferencesUtils.TITLE_FONT_FAMILY_KEY); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/FontPreviewFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/FontPreviewFragment.java index c059c737..171f9e33 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/FontPreviewFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/FontPreviewFragment.java @@ -1,16 +1,23 @@ package ml.docilealligator.infinityforreddit.settings; +import android.content.Context; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.LinearLayout; +import android.widget.TextView; +import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.activities.SettingsActivity; public class FontPreviewFragment extends Fragment { + private SettingsActivity activity; + public FontPreviewFragment() { // Required empty public constructor } @@ -19,6 +26,22 @@ public class FontPreviewFragment extends Fragment { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_font_preview, container, false); + + rootView.setBackgroundColor(activity.customThemeWrapper.getBackgroundColor()); + LinearLayout linearLayout = rootView.findViewById(R.id.linear_layout_font_preview_fragment); + int primaryTextColor = activity.customThemeWrapper.getPrimaryTextColor(); + for (int i = 0; i < linearLayout.getChildCount(); i++) { + View view = linearLayout.getChildAt(i); + if (view instanceof TextView) { + ((TextView) view).setTextColor(primaryTextColor); + } + } return rootView; } + + @Override + public void onAttach(@NonNull Context context) { + super.onAttach(context); + this.activity = (SettingsActivity) context; + } }
\ No newline at end of file diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/GesturesAndButtonsPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/GesturesAndButtonsPreferenceFragment.java index e32022c4..ddb45bf9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/GesturesAndButtonsPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/GesturesAndButtonsPreferenceFragment.java @@ -34,10 +34,6 @@ public class GesturesAndButtonsPreferenceFragment extends CustomFontPreferenceFr setPreferencesFromResource(R.xml.gestures_and_buttons_preferences, rootKey); ((Infinity) activity.getApplication()).getAppComponent().inject(this); - if (activity.typeface != null) { - setFont(activity.typeface); - } - SwitchPreference lockJumpToNextTopLevelCommentButtonSwitch = findPreference(SharedPreferencesUtils.LOCK_JUMP_TO_NEXT_TOP_LEVEL_COMMENT_BUTTON); SwitchPreference lockBottomAppBarSwitch = findPreference(SharedPreferencesUtils.LOCK_BOTTOM_APP_BAR); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/ImmersiveInterfacePreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/ImmersiveInterfacePreferenceFragment.java index c737e82a..df3d41fc 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/ImmersiveInterfacePreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/ImmersiveInterfacePreferenceFragment.java @@ -17,10 +17,6 @@ public class ImmersiveInterfacePreferenceFragment extends CustomFontPreferenceFr public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { setPreferencesFromResource(R.xml.immersive_interface_preferences, rootKey); - if (activity.typeface != null) { - setFont(activity.typeface); - } - SwitchPreference immersiveInterfaceSwitch = findPreference(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY); SwitchPreference immersiveInterfaceIgnoreNavBarSwitch = findPreference(SharedPreferencesUtils.IMMERSIVE_INTERFACE_IGNORE_NAV_BAR_KEY); SwitchPreference disableImmersiveInterfaceInLandscapeModeSwitch = findPreference(SharedPreferencesUtils.DISABLE_IMMERSIVE_INTERFACE_IN_LANDSCAPE_MODE); 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 0ad71c45..dc735462 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/InterfacePreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/InterfacePreferenceFragment.java @@ -20,10 +20,6 @@ public class InterfacePreferenceFragment extends CustomFontPreferenceFragmentCom public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { setPreferencesFromResource(R.xml.interface_preferences, rootKey); - if (activity.typeface != null) { - setFont(activity.typeface); - } - Preference immersiveInterfaceEntryPreference = findPreference(SharedPreferencesUtils.IMMERSIVE_INTERFACE_ENTRY_KEY); SwitchPreference bottomAppBarSwitch = findPreference(SharedPreferencesUtils.BOTTOM_APP_BAR_KEY); SwitchPreference voteButtonsOnTheRightSwitch = findPreference(SharedPreferencesUtils.VOTE_BUTTONS_ON_THE_RIGHT_KEY); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/MainPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/MainPreferenceFragment.java index 80ff74ab..ef64c33e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/MainPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/MainPreferenceFragment.java @@ -33,10 +33,6 @@ public class MainPreferenceFragment extends CustomFontPreferenceFragmentCompat { setPreferencesFromResource(R.xml.main_preferences, rootKey); ((Infinity) activity.getApplication()).getAppComponent().inject(this); - if (activity.typeface != null) { - setFont(activity.typeface); - } - Preference securityPreference = findPreference(SharedPreferencesUtils.SECURITY); Preference postFilterPreference = findPreference(SharedPreferencesUtils.POST_FILTER); Preference privacyPolicyPreference = findPreference(SharedPreferencesUtils.PRIVACY_POLICY_KEY); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/MiscellaneousPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/MiscellaneousPreferenceFragment.java index 9fef58ab..9ce4f4cb 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/MiscellaneousPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/MiscellaneousPreferenceFragment.java @@ -37,10 +37,6 @@ public class MiscellaneousPreferenceFragment extends CustomFontPreferenceFragmen ((Infinity) activity.getApplication()).getAppComponent().inject(this); - if (activity.typeface != null) { - setFont(activity.typeface); - } - ListPreference mainPageBackButtonActionListPreference = findPreference(SharedPreferencesUtils.MAIN_PAGE_BACK_BUTTON_ACTION); SwitchPreference savePostFeedScrolledPositionSwitch = findPreference(SharedPreferencesUtils.SAVE_FRONT_PAGE_SCROLLED_POSITION); ListPreference languageListPreference = findPreference(SharedPreferencesUtils.LANGUAGE); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/NavigationDrawerPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/NavigationDrawerPreferenceFragment.java index 36ebd09b..883f2f80 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/NavigationDrawerPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/NavigationDrawerPreferenceFragment.java @@ -20,10 +20,6 @@ public class NavigationDrawerPreferenceFragment extends CustomFontPreferenceFrag preferenceManager.setSharedPreferencesName(SharedPreferencesUtils.NAVIGATION_DRAWER_SHARED_PREFERENCES_FILE); setPreferencesFromResource(R.xml.navigation_drawer_preferences, rootKey); - if (activity.typeface != null) { - setFont(activity.typeface); - } - SwitchPreference showAvatarOnTheRightSwitch = findPreference(SharedPreferencesUtils.SHOW_AVATAR_ON_THE_RIGHT); if (showAvatarOnTheRightSwitch != null) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/NotificationPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/NotificationPreferenceFragment.java index 6f4c5313..5316a4fc 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/NotificationPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/NotificationPreferenceFragment.java @@ -39,10 +39,6 @@ public class NotificationPreferenceFragment extends CustomFontPreferenceFragment @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { setPreferencesFromResource(R.xml.notification_preferences, rootKey); - - if (activity.typeface != null) { - setFont(activity.typeface); - } workManager = WorkManager.getInstance(activity); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/NsfwAndSpoilerFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/NsfwAndSpoilerFragment.java index 10b81408..b61f4635 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/NsfwAndSpoilerFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/NsfwAndSpoilerFragment.java @@ -10,7 +10,6 @@ import android.widget.LinearLayout; import android.widget.TextView; import androidx.annotation.NonNull; -import androidx.core.content.ContextCompat; import androidx.fragment.app.Fragment; import com.google.android.material.dialog.MaterialAlertDialogBuilder; @@ -25,7 +24,7 @@ import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.activities.BaseActivity; +import ml.docilealligator.infinityforreddit.activities.SettingsActivity; import ml.docilealligator.infinityforreddit.events.ChangeNSFWBlurEvent; import ml.docilealligator.infinityforreddit.events.ChangeNSFWEvent; import ml.docilealligator.infinityforreddit.events.ChangeSpoilerBlurEvent; @@ -38,20 +37,30 @@ public class NsfwAndSpoilerFragment extends Fragment { @BindView(R.id.enable_nsfw_linear_layout_nsfw_and_spoiler_fragment) LinearLayout enableNsfwLinearLayout; + @BindView(R.id.enable_nsfw_text_view_nsfw_and_spoiler_fragment) + TextView enableNsfwTextView; @BindView(R.id.enable_nsfw_switch_nsfw_and_spoiler_fragment) SwitchMaterial enableNsfwSwitchMaterial; @BindView(R.id.blur_nsfw_linear_layout_nsfw_and_spoiler_fragment) LinearLayout blurNsfwLinearLayout; + @BindView(R.id.blur_nsfw_text_view_nsfw_and_spoiler_fragment) + TextView blurNsfwTextView; @BindView(R.id.blur_nsfw_switch_nsfw_and_spoiler_fragment) SwitchMaterial blurNsfwSwitchMaterial; @BindView(R.id.do_not_blur_nsfw_in_nsfw_subreddits_linear_layout_nsfw_and_spoiler_fragment) LinearLayout doNotBlurNsfwInNsfwSubredditsLinearLayout; + @BindView(R.id.do_not_blur_nsfw_text_view_nsfw_and_spoiler_fragment) + TextView doNotBlurNsfwInNsfwSubredditsTextView; @BindView(R.id.do_not_blur_nsfw_in_nsfw_subreddits_switch_nsfw_and_spoiler_fragment) SwitchMaterial doNotBlurNsfwInNsfwSubredditsSwitch; @BindView(R.id.blur_spoiler_linear_layout_nsfw_and_spoiler_fragment) LinearLayout blurSpoilerLinearLayout; + @BindView(R.id.blur_spoiler_text_view_nsfw_and_spoiler_fragment) + TextView blurSpoilerTextView; @BindView(R.id.blur_spoiler_switch_nsfw_and_spoiler_fragment) SwitchMaterial blurSpoilerSwitchMaterial; + @BindView(R.id.dangerous_text_view_nsfw_and_spoiler_fragment) + TextView dangerousTextView; @BindView(R.id.disable_nsfw_forever_linear_layout_nsfw_and_spoiler_fragment) LinearLayout disableNsfwForeverLinearLayout; @BindView(R.id.disable_nsfw_forever_text_view_nsfw_and_spoiler_fragment) @@ -65,7 +74,7 @@ public class NsfwAndSpoilerFragment extends Fragment { @Named("nsfw_and_spoiler") SharedPreferences nsfwAndBlurringSharedPreferences; - private BaseActivity activity; + private SettingsActivity activity; private boolean blurNsfw; private boolean doNotBlurNsfwInNsfwSubreddits; private boolean disableNsfwForever; @@ -85,6 +94,10 @@ public class NsfwAndSpoilerFragment extends Fragment { ButterKnife.bind(this, rootView); + applyCustomTheme(); + + rootView.setBackgroundColor(activity.customThemeWrapper.getBackgroundColor()); + if (activity.typeface != null) { Utils.setFontToAllTextViews(rootView, activity.typeface); } @@ -109,7 +122,7 @@ public class NsfwAndSpoilerFragment extends Fragment { disableNsfwForeverSwitchMaterial.setChecked(disableNsfwForever); disableNsfwForeverSwitchMaterial.setEnabled(!disableNsfwForever); if (disableNsfwForever) { - disableNsfwForeverTextView.setTextColor(ContextCompat.getColor(activity, R.color.settingsSubtitleColor)); + disableNsfwForeverTextView.setTextColor(activity.customThemeWrapper.getSecondaryTextColor()); disableNsfwForeverLinearLayout.setEnabled(false); } @@ -162,7 +175,7 @@ public class NsfwAndSpoilerFragment extends Fragment { disableNsfwForeverSwitchMaterial.setEnabled(false); disableNsfwForeverLinearLayout.setEnabled(false); disableNsfwForeverSwitchMaterial.setChecked(true); - disableNsfwForeverTextView.setTextColor(ContextCompat.getColor(activity, R.color.settingsSubtitleColor)); + disableNsfwForeverTextView.setTextColor(activity.customThemeWrapper.getSecondaryTextColor()); EventBus.getDefault().post(new ChangeNSFWEvent(false)); }) .setNegativeButton(R.string.no, (dialogInterface, i) -> { @@ -181,9 +194,20 @@ public class NsfwAndSpoilerFragment extends Fragment { return rootView; } + private void applyCustomTheme() { + int primaryTextColor = activity.customThemeWrapper.getPrimaryTextColor(); + enableNsfwTextView.setCompoundDrawablesWithIntrinsicBounds(Utils.getTintedDrawable(activity, R.drawable.ic_nsfw_on_24dp, activity.customThemeWrapper.getPrimaryIconColor()), null, null, null); + enableNsfwTextView.setTextColor(primaryTextColor); + blurNsfwTextView.setTextColor(primaryTextColor); + doNotBlurNsfwInNsfwSubredditsTextView.setTextColor(primaryTextColor); + blurSpoilerTextView.setTextColor(primaryTextColor); + dangerousTextView.setTextColor(primaryTextColor); + disableNsfwForeverTextView.setTextColor(primaryTextColor); + } + @Override public void onAttach(@NonNull Context context) { super.onAttach(context); - this.activity = (BaseActivity) context; + this.activity = (SettingsActivity) context; } }
\ No newline at end of file diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/NumberOfColumnsInPostFeedPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/NumberOfColumnsInPostFeedPreferenceFragment.java index 2ebb31a1..61a4b205 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/NumberOfColumnsInPostFeedPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/NumberOfColumnsInPostFeedPreferenceFragment.java @@ -9,9 +9,5 @@ public class NumberOfColumnsInPostFeedPreferenceFragment extends CustomFontPrefe @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { setPreferencesFromResource(R.xml.number_of_columns_in_post_feed_preferences, rootKey); - - if (activity.typeface != null) { - setFont(activity.typeface); - } } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/PostDetailsPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/PostDetailsPreferenceFragment.java index 224fffd5..5fe11360 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/PostDetailsPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/PostDetailsPreferenceFragment.java @@ -14,9 +14,5 @@ public class PostDetailsPreferenceFragment extends CustomFontPreferenceFragmentC PreferenceManager preferenceManager = getPreferenceManager(); preferenceManager.setSharedPreferencesName(SharedPreferencesUtils.POST_DETAILS_SHARED_PREFERENCES_FILE); setPreferencesFromResource(R.xml.post_details_preferences, rootKey); - - if (activity.typeface != null) { - setFont(activity.typeface); - } } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/PostHistoryFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/PostHistoryFragment.java index 878ead80..0384f050 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/PostHistoryFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/PostHistoryFragment.java @@ -2,6 +2,7 @@ package ml.docilealligator.infinityforreddit.settings; import android.content.Context; import android.content.SharedPreferences; +import android.graphics.drawable.Drawable; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; @@ -21,7 +22,7 @@ import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.activities.BaseActivity; +import ml.docilealligator.infinityforreddit.activities.SettingsActivity; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; import ml.docilealligator.infinityforreddit.utils.Utils; @@ -33,24 +34,32 @@ public class PostHistoryFragment extends Fragment { TextView infoTextView; @BindView(R.id.mark_posts_as_read_linear_layout_post_history_fragment) LinearLayout markPostsAsReadLinearLayout; + @BindView(R.id.mark_posts_as_read_text_view_post_history_fragment) + TextView markPostsAsReadTextView; @BindView(R.id.mark_posts_as_read_switch_post_history_fragment) SwitchMaterial markPostsAsReadSwitch; @BindView(R.id.mark_posts_as_read_after_voting_linear_layout_post_history_fragment) LinearLayout markPostsAsReadAfterVotingLinearLayout; + @BindView(R.id.mark_posts_as_read_after_voting_text_view_post_history_fragment) + TextView markPostsAsReadAfterVotingTextView; @BindView(R.id.mark_posts_as_read_after_voting_switch_post_history_fragment) SwitchMaterial markPostsAsReadAfterVotingSwitch; @BindView(R.id.mark_posts_as_read_on_scroll_linear_layout_post_history_fragment) LinearLayout markPostsAsReadOnScrollLinearLayout; + @BindView(R.id.mark_posts_as_read_on_scroll_text_view_post_history_fragment) + TextView markPostsAsReadOnScrollTextView; @BindView(R.id.mark_posts_as_read_on_scroll_switch_post_history_fragment) SwitchMaterial markPostsAsReadOnScrollSwitch; @BindView(R.id.hide_read_posts_automatically_linear_layout_post_history_fragment) LinearLayout hideReadPostsAutomaticallyLinearLayout; + @BindView(R.id.hide_read_posts_automatically_text_view_post_history_fragment) + TextView hideReadPostsAutomaticallyTextView; @BindView(R.id.hide_read_posts_automatically_switch_post_history_fragment) SwitchMaterial hideReadPostsAutomaticallySwitch; @Inject @Named("post_history") SharedPreferences postHistorySharedPreferences; - private BaseActivity activity; + private SettingsActivity activity; public PostHistoryFragment() { // Required empty public constructor @@ -66,6 +75,9 @@ public class PostHistoryFragment extends Fragment { ButterKnife.bind(this, rootView); + rootView.setBackgroundColor(activity.customThemeWrapper.getBackgroundColor()); + applyCustomTheme(); + if (activity.typeface != null) { Utils.setFontToAllTextViews(rootView, activity.typeface); } @@ -112,9 +124,20 @@ public class PostHistoryFragment extends Fragment { return rootView; } + private void applyCustomTheme() { + infoTextView.setTextColor(activity.customThemeWrapper.getSecondaryTextColor()); + Drawable infoDrawable = Utils.getTintedDrawable(activity, R.drawable.ic_info_preference_24dp, activity.customThemeWrapper.getPrimaryIconColor()); + infoTextView.setCompoundDrawablesWithIntrinsicBounds(infoDrawable, null, null, null); + int primaryTextColor = activity.customThemeWrapper.getPrimaryTextColor(); + markPostsAsReadTextView.setTextColor(primaryTextColor); + markPostsAsReadAfterVotingTextView.setTextColor(primaryTextColor); + markPostsAsReadOnScrollTextView.setTextColor(primaryTextColor); + hideReadPostsAutomaticallyTextView.setTextColor(primaryTextColor); + } + @Override public void onAttach(@NonNull Context context) { super.onAttach(context); - this.activity = (BaseActivity) context; + this.activity = (SettingsActivity) context; } }
\ No newline at end of file diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/PostPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/PostPreferenceFragment.java index cacdf83b..7f4fe935 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/PostPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/PostPreferenceFragment.java @@ -31,10 +31,6 @@ public class PostPreferenceFragment extends CustomFontPreferenceFragmentCompat { @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { setPreferencesFromResource(R.xml.post_preferences, rootKey); - - if (activity.typeface != null) { - setFont(activity.typeface); - } ListPreference defaultPostLayoutList = findPreference(SharedPreferencesUtils.DEFAULT_POST_LAYOUT_KEY); ListPreference defaultLinkPostLayoutList = findPreference(SharedPreferencesUtils.DEFAULT_LINK_POST_LAYOUT_KEY); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/SecurityPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/SecurityPreferenceFragment.java index 7bac9841..a1d49a82 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/SecurityPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/SecurityPreferenceFragment.java @@ -42,10 +42,6 @@ public class SecurityPreferenceFragment extends CustomFontPreferenceFragmentComp ((Infinity) activity.getApplication()).getAppComponent().inject(this); - if (activity.typeface != null) { - setFont(activity.typeface); - } - SwitchPreference requireAuthToAccountSectionSwitch = findPreference(SharedPreferencesUtils.REQUIRE_AUTHENTICATION_TO_GO_TO_ACCOUNT_SECTION_IN_NAVIGATION_DRAWER); SwitchPreference secureModeSwitch = findPreference(SharedPreferencesUtils.SECURE_MODE); SwitchPreference appLockSwitch = findPreference(SharedPreferencesUtils.APP_LOCK); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/SortTypePreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/SortTypePreferenceFragment.java index dbb3f615..e10d9e82 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/SortTypePreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/SortTypePreferenceFragment.java @@ -10,9 +10,5 @@ public class SortTypePreferenceFragment extends CustomFontPreferenceFragmentComp @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { setPreferencesFromResource(R.xml.sort_type_preferences, rootKey); - - if (activity.typeface != null) { - setFont(activity.typeface); - } } }
\ No newline at end of file diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/SwipeActionPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/SwipeActionPreferenceFragment.java index a7d03631..56da79d8 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/SwipeActionPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/SwipeActionPreferenceFragment.java @@ -22,10 +22,6 @@ public class SwipeActionPreferenceFragment extends CustomFontPreferenceFragmentC public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { setPreferencesFromResource(R.xml.swipe_action_preferences, rootKey); - if (activity.typeface != null) { - setFont(activity.typeface); - } - SwitchPreference enableSwipeActionSwitch = findPreference(SharedPreferencesUtils.ENABLE_SWIPE_ACTION); ListPreference swipeLeftActionListPreference = findPreference(SharedPreferencesUtils.SWIPE_LEFT_ACTION); ListPreference swipeRightActionListPreference = findPreference(SharedPreferencesUtils.SWIPE_RIGHT_ACTION); 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 65bea6ef..f2539426 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/ThemePreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/ThemePreferenceFragment.java @@ -71,10 +71,6 @@ public class ThemePreferenceFragment extends CustomFontPreferenceFragmentCompat ((Infinity) activity.getApplication()).getAppComponent().inject(this); - if (activity.typeface != null) { - setFont(activity.typeface); - } - ListPreference themePreference = findPreference(SharedPreferencesUtils.THEME_KEY); SwitchPreference amoledDarkSwitch = findPreference(SharedPreferencesUtils.AMOLED_DARK_KEY); Preference customizeLightThemePreference = findPreference(SharedPreferencesUtils.CUSTOMIZE_LIGHT_THEME); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/TimeFormatPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/TimeFormatPreferenceFragment.java index 21e190aa..b8b3b8cf 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/TimeFormatPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/TimeFormatPreferenceFragment.java @@ -18,10 +18,6 @@ public class TimeFormatPreferenceFragment extends CustomFontPreferenceFragmentCo public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { setPreferencesFromResource(R.xml.time_format_preferences, rootKey); - if (activity.typeface != null) { - setFont(activity.typeface); - } - SwitchPreference showElapsedTimeSwitch = findPreference(SharedPreferencesUtils.SHOW_ELAPSED_TIME_KEY); ListPreference timeFormatList = findPreference(SharedPreferencesUtils.TIME_FORMAT_KEY); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/TranslationFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/TranslationFragment.java index 576a6af1..41db0168 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/TranslationFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/TranslationFragment.java @@ -45,6 +45,8 @@ public class TranslationFragment extends Fragment { TranslationFragmentRecyclerViewAdapter adapter = new TranslationFragmentRecyclerViewAdapter(activity, customThemeWrapper); recyclerView.setAdapter(adapter); + rootView.setBackgroundColor(customThemeWrapper.getBackgroundColor()); + return rootView; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/VideoPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/VideoPreferenceFragment.java index 9802e3cb..e00dce6d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/VideoPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/VideoPreferenceFragment.java @@ -38,10 +38,6 @@ public class VideoPreferenceFragment extends CustomFontPreferenceFragmentCompat ((Infinity) activity.getApplication()).getAppComponent().inject(this); - if (activity.typeface != null) { - setFont(activity.typeface); - } - ListPreference videoAutoplayListPreference = findPreference(SharedPreferencesUtils.VIDEO_AUTOPLAY); SwitchPreference muteAutoplayingVideosSwitchPreference = findPreference(SharedPreferencesUtils.MUTE_AUTOPLAYING_VIDEOS); SwitchPreference rememberMutingOptionInPostFeedSwitchPreference = findPreference(SharedPreferencesUtils.REMEMBER_MUTING_OPTION_IN_POST_FEED); |