mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-06-13 05:37:41 +02:00
fix(TikTok - Settings): Use correct colors for dark mode (#4087)
This commit is contained in:

committed by
GitHub

parent
834ae2dd6f
commit
6bd22ffa7e
@ -6,6 +6,7 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
@ -499,6 +500,12 @@ public class Utils {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isDarkModeEnabled(Context context) {
|
||||||
|
Configuration config = context.getResources().getConfiguration();
|
||||||
|
final int currentNightMode = config.uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
||||||
|
return currentNightMode == Configuration.UI_MODE_NIGHT_YES;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Automatically logs any exceptions the runnable throws.
|
* Automatically logs any exceptions the runnable throws.
|
||||||
*
|
*
|
||||||
|
@ -54,9 +54,7 @@ public class ReVancedAboutPreference extends Preference {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isDarkModeEnabled() {
|
protected boolean isDarkModeEnabled() {
|
||||||
Configuration config = getContext().getResources().getConfiguration();
|
return Utils.isDarkModeEnabled(getContext());
|
||||||
final int currentNightMode = config.uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
|
||||||
return currentNightMode == Configuration.UI_MODE_NIGHT_YES;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,9 +1,20 @@
|
|||||||
package app.revanced.extension.tiktok;
|
package app.revanced.extension.tiktok;
|
||||||
|
|
||||||
|
import static app.revanced.extension.shared.Utils.isDarkModeEnabled;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.ColorInt;
|
||||||
|
|
||||||
import app.revanced.extension.shared.settings.StringSetting;
|
import app.revanced.extension.shared.settings.StringSetting;
|
||||||
|
|
||||||
public class Utils {
|
public class Utils {
|
||||||
|
|
||||||
|
private static final long[] DEFAULT_MIN_MAX_VALUES = {0L, Long.MAX_VALUE};
|
||||||
|
|
||||||
// Edit: This could be handled using a custom Setting<Long[]> class
|
// Edit: This could be handled using a custom Setting<Long[]> class
|
||||||
// that saves its value to preferences and JSON using the formatted String created here.
|
// that saves its value to preferences and JSON using the formatted String created here.
|
||||||
public static long[] parseMinMax(StringSetting setting) {
|
public static long[] parseMinMax(StringSetting setting) {
|
||||||
@ -20,6 +31,29 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setting.save("0-" + Long.MAX_VALUE);
|
setting.save("0-" + Long.MAX_VALUE);
|
||||||
return new long[]{0L, Long.MAX_VALUE};
|
return DEFAULT_MIN_MAX_VALUES;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Colors picked by hand. These should be replaced with the styled resources TikTok uses.
|
||||||
|
private static final @ColorInt int TEXT_DARK_MODE_TITLE = Color.WHITE;
|
||||||
|
private static final @ColorInt int TEXT_DARK_MODE_SUMMARY
|
||||||
|
= Color.argb(255, 170, 170, 170);
|
||||||
|
|
||||||
|
private static final @ColorInt int TEXT_LIGHT_MODE_TITLE = Color.BLACK;
|
||||||
|
private static final @ColorInt int TEXT_LIGHT_MODE_SUMMARY
|
||||||
|
= Color.argb(255, 80, 80, 80);
|
||||||
|
|
||||||
|
public static void setTitleAndSummaryColor(Context context, View view) {
|
||||||
|
final boolean darkModeEnabled = isDarkModeEnabled(context);
|
||||||
|
|
||||||
|
TextView title = view.findViewById(android.R.id.title);
|
||||||
|
title.setTextColor(darkModeEnabled
|
||||||
|
? TEXT_DARK_MODE_TITLE
|
||||||
|
: TEXT_LIGHT_MODE_TITLE);
|
||||||
|
|
||||||
|
TextView summary = view.findViewById(android.R.id.summary);
|
||||||
|
summary.setTextColor(darkModeEnabled
|
||||||
|
? TEXT_DARK_MODE_SUMMARY
|
||||||
|
: TEXT_LIGHT_MODE_SUMMARY);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,17 +1,18 @@
|
|||||||
package app.revanced.extension.tiktok.feedfilter;
|
package app.revanced.extension.tiktok.feedfilter;
|
||||||
|
|
||||||
import app.revanced.extension.tiktok.settings.Settings;
|
|
||||||
import com.ss.android.ugc.aweme.feed.model.Aweme;
|
import com.ss.android.ugc.aweme.feed.model.Aweme;
|
||||||
import com.ss.android.ugc.aweme.feed.model.AwemeStatistics;
|
import com.ss.android.ugc.aweme.feed.model.AwemeStatistics;
|
||||||
|
|
||||||
import static app.revanced.extension.tiktok.Utils.parseMinMax;
|
import app.revanced.extension.tiktok.Utils;
|
||||||
|
import app.revanced.extension.tiktok.settings.Settings;
|
||||||
|
|
||||||
public final class LikeCountFilter implements IFilter {
|
public final class LikeCountFilter implements IFilter {
|
||||||
|
|
||||||
final long minLike;
|
final long minLike;
|
||||||
final long maxLike;
|
final long maxLike;
|
||||||
|
|
||||||
LikeCountFilter() {
|
LikeCountFilter() {
|
||||||
long[] minMax = parseMinMax(Settings.MIN_MAX_LIKES);
|
long[] minMax = Utils.parseMinMax(Settings.MIN_MAX_LIKES);
|
||||||
minLike = minMax[0];
|
minLike = minMax[0];
|
||||||
maxLike = minMax[1];
|
maxLike = minMax[1];
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
package app.revanced.extension.tiktok.feedfilter;
|
package app.revanced.extension.tiktok.feedfilter;
|
||||||
|
|
||||||
|
import app.revanced.extension.tiktok.Utils;
|
||||||
import app.revanced.extension.tiktok.settings.Settings;
|
import app.revanced.extension.tiktok.settings.Settings;
|
||||||
import com.ss.android.ugc.aweme.feed.model.Aweme;
|
import com.ss.android.ugc.aweme.feed.model.Aweme;
|
||||||
import com.ss.android.ugc.aweme.feed.model.AwemeStatistics;
|
import com.ss.android.ugc.aweme.feed.model.AwemeStatistics;
|
||||||
|
|
||||||
import static app.revanced.extension.tiktok.Utils.parseMinMax;
|
|
||||||
|
|
||||||
public class ViewCountFilter implements IFilter {
|
public class ViewCountFilter implements IFilter {
|
||||||
final long minView;
|
final long minView;
|
||||||
final long maxView;
|
final long maxView;
|
||||||
|
|
||||||
ViewCountFilter() {
|
ViewCountFilter() {
|
||||||
long[] minMax = parseMinMax(Settings.MIN_MAX_VIEWS);
|
long[] minMax = Utils.parseMinMax(Settings.MIN_MAX_VIEWS);
|
||||||
minView = minMax[0];
|
minView = minMax[0];
|
||||||
maxView = minMax[1];
|
maxView = minMax[1];
|
||||||
}
|
}
|
||||||
|
@ -16,10 +16,10 @@ import android.widget.RadioButton;
|
|||||||
import android.widget.RadioGroup;
|
import android.widget.RadioGroup;
|
||||||
|
|
||||||
import app.revanced.extension.shared.settings.StringSetting;
|
import app.revanced.extension.shared.settings.StringSetting;
|
||||||
|
import app.revanced.extension.tiktok.Utils;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class DownloadPathPreference extends DialogPreference {
|
public class DownloadPathPreference extends DialogPreference {
|
||||||
private final Context context;
|
|
||||||
private final String[] entryValues = {"DCIM", "Movies", "Pictures"};
|
private final String[] entryValues = {"DCIM", "Movies", "Pictures"};
|
||||||
private String mValue;
|
private String mValue;
|
||||||
|
|
||||||
@ -29,11 +29,10 @@ public class DownloadPathPreference extends DialogPreference {
|
|||||||
|
|
||||||
public DownloadPathPreference(Context context, String title, StringSetting setting) {
|
public DownloadPathPreference(Context context, String title, StringSetting setting) {
|
||||||
super(context);
|
super(context);
|
||||||
this.context = context;
|
setTitle(title);
|
||||||
this.setTitle(title);
|
setSummary(Environment.getExternalStorageDirectory().getPath() + "/" + setting.get());
|
||||||
this.setSummary(Environment.getExternalStorageDirectory().getPath() + "/" + setting.get());
|
setKey(setting.key);
|
||||||
this.setKey(setting.key);
|
setValue(setting.get());
|
||||||
this.setValue(setting.get());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
@ -59,6 +58,7 @@ public class DownloadPathPreference extends DialogPreference {
|
|||||||
childDownloadPath = getValue().substring(getValue().indexOf("/") + 1);
|
childDownloadPath = getValue().substring(getValue().indexOf("/") + 1);
|
||||||
mediaPathIndex = findIndexOf(currentMedia);
|
mediaPathIndex = findIndexOf(currentMedia);
|
||||||
|
|
||||||
|
Context context = getContext();
|
||||||
LinearLayout dialogView = new LinearLayout(context);
|
LinearLayout dialogView = new LinearLayout(context);
|
||||||
RadioGroup mediaPath = new RadioGroup(context);
|
RadioGroup mediaPath = new RadioGroup(context);
|
||||||
mediaPath.setLayoutParams(new RadioGroup.LayoutParams(-1, -2));
|
mediaPath.setLayoutParams(new RadioGroup.LayoutParams(-1, -2));
|
||||||
@ -79,12 +79,10 @@ public class DownloadPathPreference extends DialogPreference {
|
|||||||
downloadPath.addTextChangedListener(new TextWatcher() {
|
downloadPath.addTextChangedListener(new TextWatcher() {
|
||||||
@Override
|
@Override
|
||||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -99,6 +97,13 @@ public class DownloadPathPreference extends DialogPreference {
|
|||||||
return dialogView;
|
return dialogView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onBindView(View view) {
|
||||||
|
super.onBindView(view);
|
||||||
|
|
||||||
|
Utils.setTitleAndSummaryColor(getContext(), view);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPrepareDialogBuilder(AlertDialog.Builder builder) {
|
protected void onPrepareDialogBuilder(AlertDialog.Builder builder) {
|
||||||
builder.setTitle("Download Path");
|
builder.setTitle("Download Path");
|
||||||
|
@ -2,16 +2,26 @@ package app.revanced.extension.tiktok.settings.preference;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.preference.EditTextPreference;
|
import android.preference.EditTextPreference;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
import app.revanced.extension.shared.settings.StringSetting;
|
import app.revanced.extension.shared.settings.StringSetting;
|
||||||
|
import app.revanced.extension.tiktok.Utils;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public class InputTextPreference extends EditTextPreference {
|
public class InputTextPreference extends EditTextPreference {
|
||||||
|
|
||||||
public InputTextPreference(Context context, String title, String summary, StringSetting setting) {
|
public InputTextPreference(Context context, String title, String summary, StringSetting setting) {
|
||||||
super(context);
|
super(context);
|
||||||
this.setTitle(title);
|
setTitle(title);
|
||||||
this.setSummary(summary);
|
setSummary(summary);
|
||||||
this.setKey(setting.key);
|
setKey(setting.key);
|
||||||
this.setText(setting.get());
|
setText(setting.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onBindView(View view) {
|
||||||
|
super.onBindView(view);
|
||||||
|
|
||||||
|
Utils.setTitleAndSummaryColor(getContext(), view);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package app.revanced.extension.tiktok.settings.preference;
|
package app.revanced.extension.tiktok.settings.preference;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
@ -14,11 +15,10 @@ import android.widget.LinearLayout;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import app.revanced.extension.shared.settings.StringSetting;
|
import app.revanced.extension.shared.settings.StringSetting;
|
||||||
|
import app.revanced.extension.tiktok.Utils;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class RangeValuePreference extends DialogPreference {
|
public class RangeValuePreference extends DialogPreference {
|
||||||
private final Context context;
|
|
||||||
|
|
||||||
private String minValue;
|
private String minValue;
|
||||||
|
|
||||||
private String maxValue;
|
private String maxValue;
|
||||||
@ -29,7 +29,6 @@ public class RangeValuePreference extends DialogPreference {
|
|||||||
|
|
||||||
public RangeValuePreference(Context context, String title, String summary, StringSetting setting) {
|
public RangeValuePreference(Context context, String title, String summary, StringSetting setting) {
|
||||||
super(context);
|
super(context);
|
||||||
this.context = context;
|
|
||||||
setTitle(title);
|
setTitle(title);
|
||||||
setSummary(summary);
|
setSummary(summary);
|
||||||
setKey(setting.key);
|
setKey(setting.key);
|
||||||
@ -53,41 +52,52 @@ public class RangeValuePreference extends DialogPreference {
|
|||||||
return mValue;
|
return mValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
@Override
|
@Override
|
||||||
protected View onCreateDialogView() {
|
protected View onCreateDialogView() {
|
||||||
minValue = getValue().split("-")[0];
|
minValue = getValue().split("-")[0];
|
||||||
maxValue = getValue().split("-")[1];
|
maxValue = getValue().split("-")[1];
|
||||||
|
|
||||||
|
Context context = getContext();
|
||||||
|
|
||||||
LinearLayout dialogView = new LinearLayout(context);
|
LinearLayout dialogView = new LinearLayout(context);
|
||||||
dialogView.setOrientation(LinearLayout.VERTICAL);
|
dialogView.setOrientation(LinearLayout.VERTICAL);
|
||||||
|
|
||||||
|
// Min view
|
||||||
LinearLayout minView = new LinearLayout(context);
|
LinearLayout minView = new LinearLayout(context);
|
||||||
minView.setOrientation(LinearLayout.HORIZONTAL);
|
minView.setOrientation(LinearLayout.HORIZONTAL);
|
||||||
|
dialogView.addView(minView);
|
||||||
|
|
||||||
TextView min = new TextView(context);
|
TextView min = new TextView(context);
|
||||||
min.setText("Min: ");
|
min.setText("Min: ");
|
||||||
minView.addView(min);
|
minView.addView(min);
|
||||||
|
|
||||||
EditText minEditText = new EditText(context);
|
EditText minEditText = new EditText(context);
|
||||||
minEditText.setInputType(InputType.TYPE_CLASS_NUMBER);
|
minEditText.setInputType(InputType.TYPE_CLASS_NUMBER);
|
||||||
minEditText.setText(minValue);
|
minEditText.setText(minValue);
|
||||||
minView.addView(minEditText);
|
minView.addView(minEditText);
|
||||||
dialogView.addView(minView);
|
|
||||||
|
// Max view
|
||||||
LinearLayout maxView = new LinearLayout(context);
|
LinearLayout maxView = new LinearLayout(context);
|
||||||
maxView.setOrientation(LinearLayout.HORIZONTAL);
|
maxView.setOrientation(LinearLayout.HORIZONTAL);
|
||||||
|
dialogView.addView(maxView);
|
||||||
|
|
||||||
TextView max = new TextView(context);
|
TextView max = new TextView(context);
|
||||||
max.setText("Max: ");
|
max.setText("Max: ");
|
||||||
maxView.addView(max);
|
maxView.addView(max);
|
||||||
|
|
||||||
EditText maxEditText = new EditText(context);
|
EditText maxEditText = new EditText(context);
|
||||||
maxEditText.setInputType(InputType.TYPE_CLASS_NUMBER);
|
maxEditText.setInputType(InputType.TYPE_CLASS_NUMBER);
|
||||||
maxEditText.setText(maxValue);
|
maxEditText.setText(maxValue);
|
||||||
maxView.addView(maxEditText);
|
maxView.addView(maxEditText);
|
||||||
dialogView.addView(maxView);
|
|
||||||
minEditText.addTextChangedListener(new TextWatcher() {
|
minEditText.addTextChangedListener(new TextWatcher() {
|
||||||
@Override
|
@Override
|
||||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -98,12 +108,10 @@ public class RangeValuePreference extends DialogPreference {
|
|||||||
maxEditText.addTextChangedListener(new TextWatcher() {
|
maxEditText.addTextChangedListener(new TextWatcher() {
|
||||||
@Override
|
@Override
|
||||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -111,12 +119,21 @@ public class RangeValuePreference extends DialogPreference {
|
|||||||
maxValue = editable.toString();
|
maxValue = editable.toString();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return dialogView;
|
return dialogView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onBindView(View view) {
|
||||||
|
super.onBindView(view);
|
||||||
|
|
||||||
|
Utils.setTitleAndSummaryColor(getContext(), view);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPrepareDialogBuilder(AlertDialog.Builder builder) {
|
protected void onPrepareDialogBuilder(AlertDialog.Builder builder) {
|
||||||
builder.setPositiveButton(android.R.string.ok, (dialog, which) -> this.onClick(dialog, DialogInterface.BUTTON_POSITIVE));
|
builder.setPositiveButton(android.R.string.ok, (dialog, which)
|
||||||
|
-> this.onClick(dialog, DialogInterface.BUTTON_POSITIVE));
|
||||||
builder.setNegativeButton(android.R.string.cancel, null);
|
builder.setNegativeButton(android.R.string.cancel, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,14 +18,12 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
public class ReVancedPreferenceFragment extends AbstractPreferenceFragment {
|
public class ReVancedPreferenceFragment extends AbstractPreferenceFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void syncSettingWithPreference(@NonNull @NotNull Preference pref,
|
protected void syncSettingWithPreference(@NonNull Preference pref,
|
||||||
@NonNull @NotNull Setting<?> setting,
|
@NonNull Setting<?> setting,
|
||||||
boolean applySettingToPreference) {
|
boolean applySettingToPreference) {
|
||||||
if (pref instanceof RangeValuePreference) {
|
if (pref instanceof RangeValuePreference rangeValuePref) {
|
||||||
RangeValuePreference rangeValuePref = (RangeValuePreference) pref;
|
|
||||||
Setting.privateSetValueFromString(setting, rangeValuePref.getValue());
|
Setting.privateSetValueFromString(setting, rangeValuePref.getValue());
|
||||||
} else if (pref instanceof DownloadPathPreference) {
|
} else if (pref instanceof DownloadPathPreference downloadPathPref) {
|
||||||
DownloadPathPreference downloadPathPref = (DownloadPathPreference) pref;
|
|
||||||
Setting.privateSetValueFromString(setting, downloadPathPref.getValue());
|
Setting.privateSetValueFromString(setting, downloadPathPref.getValue());
|
||||||
} else {
|
} else {
|
||||||
super.syncSettingWithPreference(pref, setting, applySettingToPreference);
|
super.syncSettingWithPreference(pref, setting, applySettingToPreference);
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
package app.revanced.extension.tiktok.settings.preference;
|
package app.revanced.extension.tiktok.settings.preference;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.AttributeSet;
|
import android.view.View;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import app.revanced.extension.shared.Logger;
|
import app.revanced.extension.shared.Logger;
|
||||||
import app.revanced.extension.shared.settings.preference.ReVancedAboutPreference;
|
import app.revanced.extension.shared.settings.preference.ReVancedAboutPreference;
|
||||||
|
import app.revanced.extension.tiktok.Utils;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public class ReVancedTikTokAboutPreference extends ReVancedAboutPreference {
|
public class ReVancedTikTokAboutPreference extends ReVancedAboutPreference {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -23,22 +25,11 @@ public class ReVancedTikTokAboutPreference extends ReVancedAboutPreference {
|
|||||||
"revanced_settings_about_links_header", "Official links"
|
"revanced_settings_about_links_header", "Official links"
|
||||||
);
|
);
|
||||||
|
|
||||||
{
|
|
||||||
//noinspection deprecation
|
|
||||||
setTitle("About");
|
|
||||||
}
|
|
||||||
|
|
||||||
public ReVancedTikTokAboutPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
|
||||||
super(context, attrs, defStyleAttr, defStyleRes);
|
|
||||||
}
|
|
||||||
public ReVancedTikTokAboutPreference(Context context, AttributeSet attrs, int defStyleAttr) {
|
|
||||||
super(context, attrs, defStyleAttr);
|
|
||||||
}
|
|
||||||
public ReVancedTikTokAboutPreference(Context context, AttributeSet attrs) {
|
|
||||||
super(context, attrs);
|
|
||||||
}
|
|
||||||
public ReVancedTikTokAboutPreference(Context context) {
|
public ReVancedTikTokAboutPreference(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
|
|
||||||
|
setTitle("About");
|
||||||
|
setSummary("About ReVanced");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -52,4 +43,11 @@ public class ReVancedTikTokAboutPreference extends ReVancedAboutPreference {
|
|||||||
|
|
||||||
return String.format(format, args);
|
return String.format(format, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onBindView(View view) {
|
||||||
|
super.onBindView(view);
|
||||||
|
|
||||||
|
Utils.setTitleAndSummaryColor(getContext(), view);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,16 +2,26 @@ package app.revanced.extension.tiktok.settings.preference;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.preference.SwitchPreference;
|
import android.preference.SwitchPreference;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
import app.revanced.extension.shared.settings.BooleanSetting;
|
import app.revanced.extension.shared.settings.BooleanSetting;
|
||||||
|
import app.revanced.extension.tiktok.Utils;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class TogglePreference extends SwitchPreference {
|
public class TogglePreference extends SwitchPreference {
|
||||||
|
|
||||||
public TogglePreference(Context context, String title, String summary, BooleanSetting setting) {
|
public TogglePreference(Context context, String title, String summary, BooleanSetting setting) {
|
||||||
super(context);
|
super(context);
|
||||||
this.setTitle(title);
|
setTitle(title);
|
||||||
this.setSummary(summary);
|
setSummary(summary);
|
||||||
this.setKey(setting.key);
|
setKey(setting.key);
|
||||||
this.setChecked(setting.get());
|
setChecked(setting.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onBindView(View view) {
|
||||||
|
super.onBindView(view);
|
||||||
|
|
||||||
|
Utils.setTitleAndSummaryColor(getContext(), view);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user