Apply custom theme to settings page.

This commit is contained in:
Docile-Alligator 2022-08-15 21:10:42 +10:00
parent 2750636847
commit 7d8e32320f
77 changed files with 518 additions and 239 deletions

View File

@ -0,0 +1,7 @@
package ml.docilealligator.infinityforreddit;
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
public interface CustomThemeWrapperReceiver {
void setCustomThemeWrapper(CustomThemeWrapper customThemeWrapper);
}

View File

@ -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;

View File

@ -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());
}
}

View File

@ -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

View File

@ -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());
}
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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);

View File

@ -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);
}
}
}

View File

@ -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);
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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);

View File

@ -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) {

View File

@ -51,6 +51,8 @@ public class CrashReportsFragment extends Fragment {
recyclerView.setAdapter(new CrashReportsRecyclerViewAdapter(activity, CrashyReporter.INSTANCE.getLogsAsStrings()));
recyclerView.setBackgroundColor(activity.customThemeWrapper.getBackgroundColor());
return recyclerView;
}

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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) {

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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);
}
}
}

View File

@ -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);
}
}
}

View File

@ -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;
}
}

View File

@ -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);

View File

@ -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);

View File

@ -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);
}
}
}

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -45,6 +45,8 @@ public class TranslationFragment extends Fragment {
TranslationFragmentRecyclerViewAdapter adapter = new TranslationFragmentRecyclerViewAdapter(activity, customThemeWrapper);
recyclerView.setAdapter(adapter);
rootView.setBackgroundColor(customThemeWrapper.getBackgroundColor());
return rootView;
}

View File

@ -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);

View File

@ -18,11 +18,9 @@
android:padding="16dp"
android:drawablePadding="32dp"
android:text="@string/restart_app_see_changes"
android:textColor="@color/settingsSubtitleColor"
android:gravity="center_vertical"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family"
app:drawableStartCompat="@drawable/ic_info_preference_24dp" />
android:fontFamily="?attr/font_family" />
<View
android:layout_width="match_parent"
@ -37,7 +35,6 @@
android:paddingStart="72dp"
android:paddingEnd="16dp"
android:text="@string/settings_main_activity_bottom_app_bar_group_summary"
android:textColor="@color/colorAccent"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />
@ -55,6 +52,7 @@
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/main_activity_option_count_title_text_view_customize_bottom_app_bar_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
@ -90,6 +88,7 @@
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/main_activity_option_1_title_text_view_customize_bottom_app_bar_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
@ -123,6 +122,7 @@
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/main_activity_option_2_title_text_view_customize_bottom_app_bar_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
@ -156,6 +156,7 @@
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/main_activity_option_3_title_text_view_customize_bottom_app_bar_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
@ -189,6 +190,7 @@
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/main_activity_option_4_title_text_view_customize_bottom_app_bar_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
@ -222,6 +224,7 @@
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/main_activity_fab_title_text_view_customize_bottom_app_bar_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
@ -255,7 +258,6 @@
android:paddingStart="72dp"
android:paddingEnd="16dp"
android:text="@string/settings_other_activities_bottom_app_bar_group_summary"
android:textColor="@color/colorAccent"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />
@ -273,6 +275,7 @@
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/other_activities_option_count_title_text_view_customize_bottom_app_bar_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
@ -308,6 +311,7 @@
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/other_activities_option_1_title_text_view_customize_bottom_app_bar_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
@ -341,6 +345,7 @@
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/other_activities_option_2_title_text_view_customize_bottom_app_bar_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
@ -374,6 +379,7 @@
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/other_activities_option_3_title_text_view_customize_bottom_app_bar_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
@ -407,6 +413,7 @@
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/other_activities_option_4_title_text_view_customize_bottom_app_bar_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
@ -440,6 +447,7 @@
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/other_activities_fab_title_text_view_customize_bottom_app_bar_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"

View File

@ -18,11 +18,9 @@
android:padding="16dp"
android:drawablePadding="32dp"
android:text="@string/restart_app_see_changes"
android:textColor="@color/settingsSubtitleColor"
android:gravity="center_vertical"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family"
app:drawableStartCompat="@drawable/ic_info_preference_24dp" />
android:fontFamily="?attr/font_family" />
<View
android:layout_width="match_parent"
@ -43,12 +41,12 @@
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/tab_count_title_text_view_customize_main_page_tabs_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_gravity="center_vertical"
android:text="@string/settings_tab_count"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_16"
android:fontFamily="?attr/font_family" />
@ -58,7 +56,6 @@
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_gravity="center_vertical"
android:textColor="?attr/secondaryTextColor"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />
@ -77,13 +74,13 @@
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/show_tab_names_title_text_view_customize_main_page_tabs_fragment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginEnd="16dp"
android:layout_gravity="center_vertical"
android:text="@string/settings_show_tab_names"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_16"
android:fontFamily="?attr/font_family" />
@ -109,7 +106,6 @@
android:paddingStart="72dp"
android:paddingEnd="16dp"
android:text="@string/settings_tab_1_summary"
android:textColor="@color/colorAccent"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />
@ -127,10 +123,10 @@
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/tab_1_title_title_text_view_customize_main_page_tabs_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/settings_tab_title"
android:textColor="@color/primaryTextColor"
android:textSize="?attr/font_16"
android:fontFamily="?attr/font_family" />
@ -138,7 +134,6 @@
android:id="@+id/tab_1_title_summary_text_view_customize_main_page_tabs_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?attr/secondaryTextColor"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />
@ -158,10 +153,10 @@
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/tab_1_type_title_text_view_customize_main_page_tabs_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/settings_tab_post_type"
android:textColor="@color/primaryTextColor"
android:textSize="?attr/font_16"
android:fontFamily="?attr/font_family" />
@ -169,7 +164,6 @@
android:id="@+id/tab_1_type_summary_text_view_customize_main_page_tabs_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?attr/secondaryTextColor"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />
@ -194,7 +188,6 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:fontFamily="?attr/font_family"
android:textColor="@color/primaryTextColor"
android:textSize="?attr/font_16"
app:layout_constraintEnd_toStartOf="@id/tab_1_name_add_image_view_customize_main_page_tabs_fragment"
app:layout_constraintStart_toStartOf="parent"
@ -205,7 +198,6 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:fontFamily="?attr/font_family"
android:textColor="?attr/secondaryTextColor"
android:textSize="?attr/font_default"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/tab_1_name_add_image_view_customize_main_page_tabs_fragment"
@ -241,7 +233,6 @@
android:paddingStart="72dp"
android:paddingEnd="16dp"
android:text="@string/settings_tab_2_summary"
android:textColor="@color/colorAccent"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />
@ -259,10 +250,10 @@
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/tab_2_title_title_text_view_customize_main_page_tabs_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/settings_tab_title"
android:textColor="@color/primaryTextColor"
android:textSize="?attr/font_16"
android:fontFamily="?attr/font_family" />
@ -270,7 +261,6 @@
android:id="@+id/tab_2_title_summary_text_view_customize_main_page_tabs_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?attr/secondaryTextColor"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />
@ -290,10 +280,10 @@
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/tab_2_type_title_text_view_customize_main_page_tabs_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/settings_tab_post_type"
android:textColor="@color/primaryTextColor"
android:textSize="?attr/font_16"
android:fontFamily="?attr/font_family" />
@ -301,7 +291,6 @@
android:id="@+id/tab_2_type_summary_text_view_customize_main_page_tabs_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?attr/secondaryTextColor"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />
@ -325,7 +314,6 @@
android:id="@+id/tab_2_name_title_text_view_customize_main_page_tabs_fragment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="@color/primaryTextColor"
android:textSize="?attr/font_16"
android:fontFamily="?attr/font_family"
app:layout_constraintTop_toTopOf="parent"
@ -336,7 +324,6 @@
android:id="@+id/tab_2_name_summary_text_view_customize_main_page_tabs_fragment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="?attr/secondaryTextColor"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family"
app:layout_constraintTop_toBottomOf="@id/tab_2_name_title_text_view_customize_main_page_tabs_fragment"
@ -373,7 +360,6 @@
android:paddingStart="72dp"
android:paddingEnd="16dp"
android:text="@string/settings_tab_3_summary"
android:textColor="@color/colorAccent"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />
@ -391,10 +377,10 @@
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/tab_3_title_title_text_view_customize_main_page_tabs_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/settings_tab_title"
android:textColor="@color/primaryTextColor"
android:textSize="?attr/font_16"
android:fontFamily="?attr/font_family" />
@ -402,7 +388,6 @@
android:id="@+id/tab_3_title_summary_text_view_customize_main_page_tabs_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?attr/secondaryTextColor"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />
@ -422,10 +407,10 @@
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/tab_3_type_title_text_view_customize_main_page_tabs_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/settings_tab_post_type"
android:textColor="@color/primaryTextColor"
android:textSize="?attr/font_16"
android:fontFamily="?attr/font_family" />
@ -433,7 +418,6 @@
android:id="@+id/tab_3_type_summary_text_view_customize_main_page_tabs_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?attr/secondaryTextColor"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />
@ -457,7 +441,6 @@
android:id="@+id/tab_3_name_title_text_view_customize_main_page_tabs_fragment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="@color/primaryTextColor"
android:textSize="?attr/font_16"
android:fontFamily="?attr/font_family"
app:layout_constraintTop_toTopOf="parent"
@ -468,7 +451,6 @@
android:id="@+id/tab_3_name_summary_text_view_customize_main_page_tabs_fragment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="?attr/secondaryTextColor"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family"
app:layout_constraintTop_toBottomOf="@id/tab_3_name_title_text_view_customize_main_page_tabs_fragment"
@ -505,7 +487,6 @@
android:paddingStart="72dp"
android:paddingEnd="16dp"
android:text="@string/settings_more_tabs_summary"
android:textColor="@color/colorAccent"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />
@ -516,11 +497,9 @@
android:padding="16dp"
android:drawablePadding="32dp"
android:text="@string/settings_more_tabs_info_summary"
android:textColor="@color/settingsSubtitleColor"
android:gravity="center_vertical"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family"
app:drawableStartCompat="@drawable/ic_info_preference_24dp" />
android:fontFamily="?attr/font_family" />
<LinearLayout
android:id="@+id/show_favorite_multireddits_linear_layout_customize_main_page_tabs_fragment"
@ -535,13 +514,13 @@
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/show_favorite_multireddits_title_text_view_customize_main_page_tabs_fragment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginEnd="16dp"
android:layout_gravity="center_vertical"
android:text="@string/settings_more_tabs_show_favorite_multireddits_title"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_16"
android:fontFamily="?attr/font_family" />
@ -566,13 +545,13 @@
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/show_multireddits_title_text_view_customize_main_page_tabs_fragment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginEnd="16dp"
android:layout_gravity="center_vertical"
android:text="@string/settings_more_tabs_show_multireddits_title"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_16"
android:fontFamily="?attr/font_family" />
@ -597,13 +576,13 @@
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/show_favorite_subscribed_subreddits_title_text_view_customize_main_page_tabs_fragment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginEnd="16dp"
android:layout_gravity="center_vertical"
android:text="@string/settings_more_tabs_show_favorite_subscribed_subreddits_title"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_16"
android:fontFamily="?attr/font_family" />
@ -628,13 +607,13 @@
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/show_subscribed_subreddits_title_text_view_customize_main_page_tabs_fragment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginEnd="16dp"
android:layout_gravity="center_vertical"
android:text="@string/settings_more_tabs_show_subscribed_subreddits_title"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_16"
android:fontFamily="?attr/font_family" />

View File

@ -6,6 +6,7 @@
tools:context=".settings.FontPreviewFragment">
<LinearLayout
android:id="@+id/linear_layout_font_preview_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

View File

@ -26,12 +26,12 @@
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/enable_nsfw_text_view_nsfw_and_spoiler_fragment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginEnd="16dp"
android:layout_gravity="center_vertical"
app:drawableStartCompat="@drawable/ic_nsfw_on_24dp"
android:drawablePadding="32dp"
android:text="@string/settings_enable_nsfw_title"
android:textColor="?attr/primaryTextColor"
@ -60,6 +60,7 @@
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/blur_nsfw_text_view_nsfw_and_spoiler_fragment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
@ -92,6 +93,7 @@
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/do_not_blur_nsfw_text_view_nsfw_and_spoiler_fragment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
@ -123,6 +125,7 @@
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/blur_spoiler_text_view_nsfw_and_spoiler_fragment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
@ -147,6 +150,7 @@
android:background="@color/dividerColor" />
<TextView
android:id="@+id/dangerous_text_view_nsfw_and_spoiler_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="16dp"

View File

@ -18,11 +18,9 @@
android:padding="16dp"
android:drawablePadding="32dp"
android:text="@string/restart_app_see_changes"
android:textColor="@color/settingsSubtitleColor"
android:gravity="center_vertical"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family"
app:drawableStartCompat="@drawable/ic_info_preference_24dp" />
android:fontFamily="?attr/font_family" />
<View
android:layout_width="match_parent"
@ -42,6 +40,7 @@
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/mark_posts_as_read_text_view_post_history_fragment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
@ -74,6 +73,7 @@
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/mark_posts_as_read_after_voting_text_view_post_history_fragment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
@ -105,6 +105,7 @@
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/mark_posts_as_read_on_scroll_text_view_post_history_fragment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
@ -136,6 +137,7 @@
android:background="?attr/selectableItemBackground">
<TextView
android:id="@+id/hide_read_posts_automatically_text_view_post_history_fragment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"

View File

@ -6,16 +6,15 @@
android:orientation="vertical">
<TextView
android:id="@+id/info_text_view_item_filter_fragment_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:drawablePadding="32dp"
android:text="@string/restart_app_see_changes"
android:textColor="@color/settingsSubtitleColor"
android:gravity="center_vertical"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family"
app:drawableStartCompat="@drawable/ic_info_preference_24dp" />
android:fontFamily="?attr/font_family" />
<View
android:layout_width="match_parent"

View File

@ -391,7 +391,6 @@
<string name="settings_customize_dark_theme_title">"Tmavý motiv"</string>
<string name="settings_customize_amoled_theme_title">"Amoled"</string>
<string name="settings_manage_themes_title">"Spravovat motivy"</string>
<string name="settings_custom_theme_cannot_apply_to_settings_page_summary">"Vlastní motivy nemohou být použity na stránku nastavení (kromě nástrojové lišty, stavové lišty a navigační lišty)."</string>
<string name="settings_advanced_master_title">"Pokročilé"</string>
<string name="settings_delete_all_subreddits_data_in_database_title">"Odstranit všechny subreddity v databázi"</string>
<string name="settings_delete_all_users_data_in_database_title">"Odstranit všechny uživatele v databázi"</string>

View File

@ -421,7 +421,6 @@ Tippen für Neuversuch."</string>
<string name="settings_customize_dark_theme_title">"Dunkles Thema"</string>
<string name="settings_customize_amoled_theme_title">"AMOLED-Thema"</string>
<string name="settings_manage_themes_title">"Themen verwalten"</string>
<string name="settings_custom_theme_cannot_apply_to_settings_page_summary">"Benutzerdefinierte Themen können nicht auf die Einstellungs-Seite angewandt werden (ausgenommen Werkzeug-, Status- und Navigationsleiste)."</string>
<string name="settings_advanced_master_title">"Erweitert"</string>
<string name="settings_delete_all_subreddits_data_in_database_title">"Alle Subreddits aus der Datenbank löschen"</string>
<string name="settings_delete_all_users_data_in_database_title">"Alle Benutzer aus der Datenbank löschen"</string>

View File

@ -411,7 +411,6 @@ Premio means prize, so it's better suited the first word instead of the second o
<string name="settings_customize_dark_theme_title">"Tema Oscuro"</string>
<string name="settings_customize_amoled_theme_title">"Tema AMOLED"</string>
<string name="settings_manage_themes_title">"Administrar Temas"</string>
<string name="settings_custom_theme_cannot_apply_to_settings_page_summary">"Los temas no pueden ser aplicados a la página de configuración (a excepción de la barra de herramientas, la barra de estado y la barra de navegación)."</string>
<string name="settings_advanced_master_title">"Avanzado"</string>
<string name="settings_delete_all_subreddits_data_in_database_title">"Borrar Todos los subreddits en la base de datos"</string>
<string name="settings_delete_all_users_data_in_database_title">"Borrar todos los usuarios en la base de datos"</string>

View File

@ -450,7 +450,6 @@ peut ne pas fonctionner sur Android 11"</string>
<string name="settings_customize_dark_theme_title">"Thème Sombre"</string>
<string name="settings_customize_amoled_theme_title">"Thème Amoled"</string>
<string name="settings_manage_themes_title">"Gérer les Thèmes"</string>
<string name="settings_custom_theme_cannot_apply_to_settings_page_summary">"Les thèmes personnalisés ne peuvent pas être appliqués à la page des paramètres (sauf la barre d'outils, la barre d'état et barre de navigation.)"</string>
<string name="settings_advanced_master_title">"Avancés"</string>
<string name="settings_delete_all_subreddits_data_in_database_title">"Supprimer Tous les Subreddits de la Base de Données"</string>
<string name="settings_delete_all_users_data_in_database_title">"Supprimer Tous les Utilisateurs de la Base de Données"</string>

View File

@ -440,7 +440,6 @@ Behavior -->
<string name="settings_customize_dark_theme_title">"गहरी थीम "</string>
<string name="settings_customize_amoled_theme_title">"अमोलेड थीम "</string>
<string name="settings_manage_themes_title">"थीम्स नियंत्रण "</string>
<string name="settings_custom_theme_cannot_apply_to_settings_page_summary">"अनुकूलित थीम सेटिंग्स पृष्ट(टूलबार, स्टैटस बार एवं नेवीगेशन बार के अलावा) पर लागू नहीं की जा सकती।"</string>
<string name="settings_advanced_master_title">"उन्नत "</string>
<string name="settings_delete_all_subreddits_data_in_database_title">"डेटाबेस से सभी सबरैडिट्स मिटा दें "</string>
<string name="settings_delete_all_users_data_in_database_title">"डेटाबेस से सभी यूजर्स हटा दें "</string>

View File

@ -410,7 +410,6 @@
<string name="settings_customize_dark_theme_title">"Tamna tema"</string>
<string name="settings_customize_amoled_theme_title">"Amoled tema"</string>
<string name="settings_manage_themes_title">"Upravljaj temama"</string>
<string name="settings_custom_theme_cannot_apply_to_settings_page_summary">"Vlastite teme se ne mogu primijeniti na stranicu postavki (osim alatne trake, trake statusa i navigacijske trake)"</string>
<string name="settings_advanced_master_title">"Napredno"</string>
<string name="settings_delete_all_subreddits_data_in_database_title">"Obriši sve podreddite u bazi podataka"</string>
<string name="settings_delete_all_users_data_in_database_title">"Obriši sve korisnike u bazi podataka"</string>

View File

@ -395,7 +395,6 @@
<string name="settings_customize_dark_theme_title">"Sötét téma"</string>
<string name="settings_customize_amoled_theme_title">"Amoled téma"</string>
<string name="settings_manage_themes_title">"Témák kezelése"</string>
<string name="settings_custom_theme_cannot_apply_to_settings_page_summary">"Egyedi témákat nem lehet használni a beállítások aldalán (kivéve az eszköztáron, státusz sávon és navigációs sávon)."</string>
<string name="settings_advanced_master_title">"Haladó"</string>
<string name="settings_delete_all_subreddits_data_in_database_title">"Adatbázisban szereplő összes subreddit törlése"</string>
<string name="settings_delete_all_users_data_in_database_title">"Adatbázisban szereplő összes felhasználó törlése"</string>

View File

@ -384,7 +384,6 @@ Tocca per riprovare."</string>
<string name="settings_customize_dark_theme_title">"Tema Scuro"</string>
<string name="settings_customize_amoled_theme_title">"Tema Amoled"</string>
<string name="settings_manage_themes_title">"Gestisci i temi"</string>
<string name="settings_custom_theme_cannot_apply_to_settings_page_summary">"I temi personalizzati non possono essere applicati alla pagina delle impostazioni (tranne barra degli strumenti, barra di stato e barra di navigazione)."</string>
<string name="settings_advanced_master_title">"Avanzate"</string>
<string name="settings_delete_all_subreddits_data_in_database_title">"Elimina Tutti i Subreddit nel Database"</string>
<string name="settings_delete_all_users_data_in_database_title">"Elimina Tutti gli Utenti nel Database"</string>

View File

@ -443,7 +443,6 @@
<string name="settings_customize_dark_theme_title">"ダークテーマ"</string>
<string name="settings_customize_amoled_theme_title">"AMOLEDテーマ"</string>
<string name="settings_manage_themes_title">"テーマの管理"</string>
<string name="settings_custom_theme_cannot_apply_to_settings_page_summary">"カスタムテーマは設定画面には適用できません (ツールバー、ステータスバー、ナビゲーションバーを除く)"</string>
<string name="settings_advanced_master_title">"高度な設定"</string>
<string name="settings_delete_all_subreddits_data_in_database_title">"データベース中の全てのSubreddit情報を削除"</string>
<string name="settings_delete_all_users_data_in_database_title">"データベース中の全てのユーザー情報を削除"</string>

View File

@ -8,6 +8,5 @@
<color name="playButtonBackgroundColor">#FFFFFF</color>
<color name="roundedBottomSheetPrimaryBackground">#242424</color>
<color name="primaryTextColor">#FFFFFF</color>
<color name="settingsSubtitleColor">#4DFFFFFF</color>
<color name="dividerColor">#69666c</color>
</resources>

View File

@ -394,7 +394,6 @@ Druk om opnieuw te proberen."</string>
<string name="settings_customize_dark_theme_title">"Donker thema"</string>
<string name="settings_customize_amoled_theme_title">"Amoled-thema"</string>
<string name="settings_manage_themes_title">"Thema's beheren"</string>
<string name="settings_custom_theme_cannot_apply_to_settings_page_summary">"Aangepaste thema's kunnen niet worden toegepast op de instellingenpagina (behalve de werkbalk, statusbalk en navigatiebalk)."</string>
<string name="settings_advanced_master_title">"Geavanceerd"</string>
<string name="settings_delete_all_subreddits_data_in_database_title">"Alle subreddits verwijderen uit databank"</string>
<string name="settings_delete_all_users_data_in_database_title">"Alle gebruikers verwijderen uit databank"</string>

View File

@ -389,8 +389,6 @@
<string name="settings_customize_dark_theme_title">"Ciemny motyw"</string>
<string name="settings_customize_amoled_theme_title">"Amoledowy motyw"</string>
<string name="settings_manage_themes_title">"Zarządzaj motywami"</string>
<string name="settings_custom_theme_cannot_apply_to_settings_page_summary">"Niestandardowe motywy nie mogą być zaaplikowane do strony ustawień
(z wyjątkiem paska narzędzi, paska stanu i paska nawigacji)."</string>
<string name="settings_advanced_master_title">"Zaawansowane"</string>
<string name="settings_delete_all_subreddits_data_in_database_title">"Usuń wszystkie Subreddity w bazie danych"</string>
<string name="settings_delete_all_users_data_in_database_title">"Usuń wszystkich użytkowników w bazie danych"</string>

View File

@ -393,7 +393,6 @@ Toque para tentar novamente."</string>
<string name="settings_customize_dark_theme_title">"Tema Escuro"</string>
<string name="settings_customize_amoled_theme_title">"Tema Amoled"</string>
<string name="settings_manage_themes_title">"Gerenciar Temas"</string>
<string name="settings_custom_theme_cannot_apply_to_settings_page_summary">"Temas personalizados não podem ser aplicados à página de configurações (exceto barra de ferramentas, barra de status e barra de navegação)."</string>
<string name="settings_advanced_master_title">"Avançado"</string>
<string name="settings_delete_all_subreddits_data_in_database_title">"Excluir Todos os Subreddits no Banco de Dados"</string>
<string name="settings_delete_all_users_data_in_database_title">"Excluir Todos os Usuários no Banco de Dados"</string>

View File

@ -398,7 +398,6 @@ Toque para tentar novamente."</string>
<string name="settings_customize_dark_theme_title">"Tema Escuro"</string>
<string name="settings_customize_amoled_theme_title">"Tema Amoled"</string>
<string name="settings_manage_themes_title">"Gerir Temas"</string>
<string name="settings_custom_theme_cannot_apply_to_settings_page_summary">"Temas personalizados não podem ser aplicados à página de definições (exceto à barra de ferramentas, barra de estado e barra de navegação)."</string>
<string name="settings_advanced_master_title">"Avançado"</string>
<string name="settings_delete_all_subreddits_data_in_database_title">"Eliminar Todas as Comunidades da BD"</string>
<string name="settings_delete_all_users_data_in_database_title">"Eliminar Todos os Utilizadores da BD"</string>

View File

@ -387,7 +387,6 @@ Atinge pentru a reîncerca."</string>
<string name="settings_customize_dark_theme_title">"Temă întunecată"</string>
<string name="settings_customize_amoled_theme_title">"Temă Amoled"</string>
<string name="settings_manage_themes_title">"Gestionați temele"</string>
<string name="settings_custom_theme_cannot_apply_to_settings_page_summary">"Temele personalizate nu pot fi aplicate la pagina de setări (cu excepția barei de instrumente, a barei de stare și a barei de navigare)."</string>
<string name="settings_advanced_master_title">"Avansat"</string>
<string name="settings_delete_all_subreddits_data_in_database_title">"Ștergeți toate subredditele din baza de date"</string>
<string name="settings_delete_all_users_data_in_database_title">"Ștergeți toți utilizatorii din baza de date"</string>

View File

@ -399,7 +399,6 @@
<string name="settings_customize_dark_theme_title">"Тёмная тема"</string>
<string name="settings_customize_amoled_theme_title">"Тема AMOLED"</string>
<string name="settings_manage_themes_title">"Менеджер тем"</string>
<string name="settings_custom_theme_cannot_apply_to_settings_page_summary">"Пользовательские темы не применяются к странице настроек (кроме панели инструментов, строки состояния и панели навигации)."</string>
<string name="settings_advanced_master_title">"Дополнительные"</string>
<string name="settings_delete_all_subreddits_data_in_database_title">"Удалить все сабреддиты из базы данных"</string>
<string name="settings_delete_all_users_data_in_database_title">"Удалить всех пользователей из базы данных"</string>

View File

@ -406,7 +406,6 @@ Tekrar denemek için tıklayın."</string>
<string name="settings_customize_dark_theme_title">"Koyu Tema"</string>
<string name="settings_customize_amoled_theme_title">"Amoled Tema"</string>
<string name="settings_manage_themes_title">"Temaları Yönetin"</string>
<string name="settings_custom_theme_cannot_apply_to_settings_page_summary">"Özel temalar ayarlar sayfasına uygulanamaz (araç çubuğu, durum çubuğu ve navigasyon çubuğu hariç)."</string>
<string name="settings_advanced_master_title">"Gelişmiş"</string>
<string name="settings_delete_all_subreddits_data_in_database_title">"Veritabanındaki Tüm Subredditleri Sil"</string>
<string name="settings_delete_all_users_data_in_database_title">"Veritabanındaki Tüm Kullanıcıları Sil"</string>

View File

@ -387,7 +387,6 @@
<string name="settings_customize_dark_theme_title">"Темна тема"</string>
<string name="settings_customize_amoled_theme_title">"Тема Amoled"</string>
<string name="settings_manage_themes_title">"Керувати темами"</string>
<string name="settings_custom_theme_cannot_apply_to_settings_page_summary">"Власні теми не застосовуються до сторінки налаштувань (окрім панелі засобів, стрічки стану і панелі переходів)."</string>
<string name="settings_advanced_master_title">"Розширені"</string>
<string name="settings_delete_all_subreddits_data_in_database_title">"Видалити всі сабредити з бази даних"</string>
<string name="settings_delete_all_users_data_in_database_title">"Видалити всіх користувачів із бази даних"</string>

View File

@ -400,7 +400,6 @@ Nhấn để thử lại."</string>
<string name="settings_customize_dark_theme_title">"Chủ đề tối"</string>
<string name="settings_customize_amoled_theme_title">"Chủ đề Amoled"</string>
<string name="settings_manage_themes_title">"Quản lý chủ đề"</string>
<string name="settings_custom_theme_cannot_apply_to_settings_page_summary">"Các chủ đề tuỳ chỉnh không thể được áp dụng cho trang cài đặt (trừ thanh công cụ, thanh trạng thái và thanh điều hướng)."</string>
<string name="settings_advanced_master_title">"Nâng cao"</string>
<string name="settings_delete_all_subreddits_data_in_database_title">"Xoá tất cả subreddit trong cơ sở dữ liệu"</string>
<string name="settings_delete_all_users_data_in_database_title">"Xoá tất cả người dùng trong cơ sở dữ liệu"</string>

View File

@ -405,7 +405,6 @@
<string name="settings_customize_dark_theme_title">"黑暗主题"</string>
<string name="settings_customize_amoled_theme_title">"Amoled 主题"</string>
<string name="settings_manage_themes_title">"管理主题"</string>
<string name="settings_custom_theme_cannot_apply_to_settings_page_summary">"自定义主题无法应用于设置页面(工具栏、状态栏和导航栏除外)"</string>
<string name="settings_advanced_master_title">"高级"</string>
<string name="settings_delete_all_subreddits_data_in_database_title">"删除数据库中的所有版块"</string>
<string name="settings_delete_all_users_data_in_database_title">"删除数据库中的所有用户"</string>

View File

@ -9,6 +9,5 @@
<color name="roundedBottomSheetPrimaryBackground">#FFFFFF</color>
<color name="roundedBottomSheetPrimaryNavigationBarColor">#000000</color>
<color name="primaryTextColor">#000000</color>
<color name="settingsSubtitleColor">#42000000</color>
<color name="dividerColor">#E0E0E0</color>
</resources>

View File

@ -490,7 +490,6 @@
<string name="settings_enable_material_you_summary">Personalize Infinity based on Your Wallpaper</string>
<string name="settings_apply_material_you_title">Apply Material You</string>
<string name="settings_apply_material_you_summary">In case Infinity did not change the theme</string>
<string name="settings_custom_theme_cannot_apply_to_settings_page_summary">Custom themes cannot be applied to settings page (except toolbar, status bar and navigation bar).</string>
<string name="settings_advanced_master_title">Advanced</string>
<string name="settings_delete_all_subreddits_data_in_database_title">Delete All Subreddits in Database</string>
<string name="settings_delete_all_users_data_in_database_title">Delete All Users in Database</string>

View File

@ -41,11 +41,6 @@
app:icon="@drawable/ic_edit_24dp"
app:title="@string/settings_manage_themes_title" />
<ml.docilealligator.infinityforreddit.customviews.CustomFontPreference
app:icon="@drawable/ic_info_preference_24dp"
app:summary="@string/settings_custom_theme_cannot_apply_to_settings_page_summary"
app:enabled="false" />
<ml.docilealligator.infinityforreddit.customviews.CustomFontPreferenceCategory
app:title="@string/settings_category_material_you_title" />