diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d0ba8c413..da40a45d06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,17 @@ +## [1.34.0-dev.1](https://github.com/crimera/revanced-integrations/compare/v1.33.1-dev.1...v1.34.0-dev.1) (2024-11-12) + + +### Features + +* **Twitter:** Added `Customise post font size` patch ([e8706de](https://github.com/crimera/revanced-integrations/commit/e8706deb31ff479252727eea03c0bf738a006243)) + +## [1.33.1-dev.1](https://github.com/crimera/revanced-integrations/compare/v1.33.0...v1.33.1-dev.1) (2024-11-09) + + +### Refactors + +* **Twitter:** refactor values of list preference ([4d7cfcd](https://github.com/crimera/revanced-integrations/commit/4d7cfcd1fe3d5d951e6c36cd40e1729efcc46bc6)) + ## [1.33.0](https://github.com/crimera/revanced-integrations/compare/v1.32.0...v1.33.0) (2024-11-06) diff --git a/app/src/main/java/app/revanced/integrations/twitter/Pref.java b/app/src/main/java/app/revanced/integrations/twitter/Pref.java index 7d684ba87f..6ce9c09188 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/Pref.java +++ b/app/src/main/java/app/revanced/integrations/twitter/Pref.java @@ -8,9 +8,20 @@ @SuppressWarnings("unused") public class Pref { public static boolean ROUND_OFF_NUMBERS,ENABLE_FORCE_HD; + public static float POST_FONT_SIZE; static{ ROUND_OFF_NUMBERS = isRoundOffNumbersEnabled(); ENABLE_FORCE_HD = enableForceHD(); + POST_FONT_SIZE = setPostFontSize(); + } + public static float setPostFontSize() { + Float fontSize = 0.0f; + try{ + fontSize = Float.valueOf(Utils.getStringPref(Settings.CUSTOM_POST_FONT_SIZE)); + }catch (Exception ex){ + fontSize = app.revanced.integrations.shared.Utils.getResourceDimension("font_size_normal"); + } + return fontSize; } public static boolean enableNativeDownloader() { return Utils.getBooleanPerf(Settings.VID_NATIVE_DOWNLOADER); diff --git a/app/src/main/java/app/revanced/integrations/twitter/settings/ScreenBuilder.java b/app/src/main/java/app/revanced/integrations/twitter/settings/ScreenBuilder.java index 3c9b496a20..c6cf6ff780 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/settings/ScreenBuilder.java +++ b/app/src/main/java/app/revanced/integrations/twitter/settings/ScreenBuilder.java @@ -535,6 +535,15 @@ public void buildCustomiseSection(boolean buildCategory){ ); } + if(SettingsStatus.customPostFontSize) { + addPreference(category, + helper.editTextNumPreference( + strRes("piko_pref_customisation_post_font_size"), + String.valueOf(Pref.setPostFontSize()), + Settings.CUSTOM_POST_FONT_SIZE + )); + } + addPreference(category, helper.switchPreference( strRes("piko_pref_quick_settings"), diff --git a/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java b/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java index 8ac5630eeb..48c9f69430 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java +++ b/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java @@ -3,6 +3,7 @@ import app.revanced.integrations.shared.settings.BaseSettings; import app.revanced.integrations.shared.settings.BooleanSetting; import app.revanced.integrations.shared.settings.StringSetting; +import app.revanced.integrations.shared.Utils; public class Settings extends BaseSettings { public static final String SHARED_PREF_NAME = "piko_settings"; @@ -71,6 +72,7 @@ public class Settings extends BaseSettings { public static final StringSetting CUSTOM_INLINE_TABS = new StringSetting("customisation_inlinebar_tabs", ""); public static final StringSetting CUSTOM_DEF_REPLY_SORTING = new StringSetting("customisation_def_reply_sorting", "Likes"); public static final StringSetting REPLY_SORTING_LAST_FILTER = new StringSetting("reply_sorting_last_filter", "Likes"); + public static final StringSetting CUSTOM_POST_FONT_SIZE = new StringSetting("customisation_post_font_size", String.valueOf(Utils.getResourceDimension("font_size_normal"))); public static final BooleanSetting EXPORT_PREF = new BooleanSetting("export_pref", true); public static final BooleanSetting EXPORT_FLAGS = new BooleanSetting("export_flags", true); diff --git a/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsStatus.java b/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsStatus.java index 73cd117e5d..888cae8b82 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsStatus.java +++ b/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsStatus.java @@ -66,7 +66,11 @@ public class SettingsStatus { public static boolean nativeTranslator = false; public static boolean hideNudgeButton = false; public static boolean hideSocialProof = false; + public static boolean customPostFontSize = false; + public static void customPostFontSize() { + customPostFontSize = true; + } public static void hideSocialProof() { hideSocialProof = true; } @@ -319,7 +323,7 @@ public static boolean enablePremiumSection() { } public static boolean enableCustomisationSection() { - return (inlineBarCustomisation || navBarCustomisation || sideBarCustomisation || profileTabCustomisation || timelineTabCustomisation || defaultReplySortFilter); + return (customPostFontSize || inlineBarCustomisation || navBarCustomisation || sideBarCustomisation || profileTabCustomisation || timelineTabCustomisation || defaultReplySortFilter); } public static void load() { diff --git a/app/src/main/java/app/revanced/integrations/twitter/settings/fragments/SettingsAboutFragment.java b/app/src/main/java/app/revanced/integrations/twitter/settings/fragments/SettingsAboutFragment.java index 8185e5931a..cd53b9a4c9 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/settings/fragments/SettingsAboutFragment.java +++ b/app/src/main/java/app/revanced/integrations/twitter/settings/fragments/SettingsAboutFragment.java @@ -118,6 +118,7 @@ public void onCreate(@org.jetbrains.annotations.Nullable Bundle savedInstanceSta flags.put(strRes("piko_pref_hide_nudge_button"),SettingsStatus.hideNudgeButton); flags.put(strRes("piko_pref_hide_social_proof"),SettingsStatus.hideSocialProof); flags.put(strRes("translate_tweet_show"),SettingsStatus.nativeTranslator); + flags.put(strRes("piko_pref_customisation_post_font_size"),SettingsStatus.customPostFontSize); LegacyTwitterPreferenceCategory patPref = preferenceCategory(strRes("piko_pref_patches"), screen); diff --git a/app/src/main/java/app/revanced/integrations/twitter/settings/widgets/EditTextPref.java b/app/src/main/java/app/revanced/integrations/twitter/settings/widgets/EditTextPref.java index 3cf212e601..d3e9c5aa20 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/settings/widgets/EditTextPref.java +++ b/app/src/main/java/app/revanced/integrations/twitter/settings/widgets/EditTextPref.java @@ -5,9 +5,12 @@ import android.util.AttributeSet; import app.revanced.integrations.twitter.Utils; import android.preference.Preference; +import android.text.InputType; public class EditTextPref extends EditTextPreference { private static Helper helper; + private boolean numericOnly = false; + public EditTextPref(Context context) { super(context); helper = new Helper(context); @@ -24,6 +27,15 @@ public EditTextPref(Context context, AttributeSet attrs, int defStyleAttr) { helper = new Helper(context); init(); } + public void setNumericOnly(boolean numericOnly) { + this.numericOnly = numericOnly; + if (numericOnly) { + getEditText().setInputType(InputType.TYPE_CLASS_NUMBER); + getEditText().setSingleLine(true); + } else { + getEditText().setInputType(InputType.TYPE_CLASS_TEXT); + } + } private void init() { setOnPreferenceChangeListener(new OnPreferenceChangeListener() { diff --git a/app/src/main/java/app/revanced/integrations/twitter/settings/widgets/Helper.java b/app/src/main/java/app/revanced/integrations/twitter/settings/widgets/Helper.java index f60caac87b..24c737262c 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/settings/widgets/Helper.java +++ b/app/src/main/java/app/revanced/integrations/twitter/settings/widgets/Helper.java @@ -31,6 +31,12 @@ public Preference editTextPreference(String title, String summary, StringSetting return preference; } + public Preference editTextNumPreference(String title, String summary, StringSetting setting) { + EditTextPref preference = (EditTextPref)editTextPreference(title,summary,setting); + preference.setNumericOnly(true); + return preference; + } + public Preference switchPreference(String title, String summary, BooleanSetting setting) { SwitchPref preference = new SwitchPref(context); preference.setTitle(title); diff --git a/app/src/main/java/app/revanced/integrations/twitter/settings/widgets/ListPref.java b/app/src/main/java/app/revanced/integrations/twitter/settings/widgets/ListPref.java index a46821ed06..7f684f5ba2 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/settings/widgets/ListPref.java +++ b/app/src/main/java/app/revanced/integrations/twitter/settings/widgets/ListPref.java @@ -50,23 +50,23 @@ protected void onSetInitialValue(boolean restoreValue, Object defaultValue) { CharSequence[] entries = new CharSequence[]{}; CharSequence[] entriesValues = new CharSequence[]{}; if (key == Settings.VID_PUBLIC_FOLDER.key) { - entries = new CharSequence[]{"Movies", "DCIM", "Pictures", "Download"}; + entries = Utils.getResourceStringArray("piko_array_public_folder"); entriesValues = entries; }else if (key == Settings.CUSTOM_TIMELINE_TABS.key) { entries = Utils.getResourceStringArray("piko_array_timelinetabs"); - entriesValues = new CharSequence[]{"show_both","hide_forYou", "hide_following"}; + entriesValues = Utils.getResourceStringArray("piko_array_timelinetabs_val"); }else if (key == Settings.VID_MEDIA_HANDLE.key) { entries = Utils.getResourceStringArray("piko_array_download_media_handle"); - entriesValues = new CharSequence[]{"download_media","copy_media_link", "always_ask"}; + entriesValues = Utils.getResourceStringArray("piko_array_download_media_handle_val"); }else if (key == Settings.CUSTOM_INLINE_TABS.key) { entries = Utils.getResourceStringArray("piko_array_inlinetabs"); - entriesValues = new CharSequence[]{"Reply","Retweet", "Favorite","ViewCount","AddRemoveBookmarks", "TwitterShare"}; + entriesValues = Utils.getResourceStringArray("piko_array_inlinetabs_val"); }else if (key == Settings.CUSTOM_DEF_REPLY_SORTING.key) { entries = Utils.getResourceStringArray("piko_array_reply_sorting"); - entriesValues = new CharSequence[]{"Relevance","Recency", "Likes","LastPostion"}; + entriesValues = Utils.getResourceStringArray("piko_array_reply_sorting_val"); }else if (key == Settings.NATIVE_TRANSLATOR_PROVIDERS.key) { entries = Utils.getResourceStringArray("piko_array_translators"); - entriesValues = new CharSequence[]{"0", "1"}; + entriesValues = Utils.getResourceStringArray("piko_array_translators_val"); }else if (key == Settings.NATIVE_TRANSLATOR_LANG.key) { entries = Constants.displayNames; entriesValues = Constants.languageTags; diff --git a/gradle.properties b/gradle.properties index 13197eec5d..537a66ea34 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true android.useAndroidX = true -version = 1.33.0 +version = 1.34.0-dev.1