Skip to content

Commit

Permalink
Merge pull request #104 from crimera/dev
Browse files Browse the repository at this point in the history
chore: Merge branch `dev` to `main`
  • Loading branch information
crimera authored Nov 14, 2024
2 parents 53f25c4 + 1ffd22b commit 76f349d
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 8 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)


Expand Down
11 changes: 11 additions & 0 deletions app/src/main/java/app/revanced/integrations/twitter/Pref.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 76f349d

Please sign in to comment.