Skip to content

Commit

Permalink
refactor(Twitter): refactor custom app icon and nav icons
Browse files Browse the repository at this point in the history
  • Loading branch information
swakwork committed Nov 24, 2024
1 parent fcbecce commit b5dc850
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ public class Utils {
private static final Context ctx = app.revanced.integrations.shared.Utils.getContext();
private static final SharedPrefCategory sp = new SharedPrefCategory(Settings.SHARED_PREF_NAME);

public static void openUrl(String url) {
Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse(url));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
ctx.startActivity(intent);
}

private static void startActivity(Class cls) {
Intent intent = new Intent(ctx, cls);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,25 @@ public void buildPremiumSection(boolean buildCategory){
);
}

if (SettingsStatus.customAppIcon || SettingsStatus.navBarCustomisation) {
if (SettingsStatus.customAppIcon) {
addPreference(category,
helper.buttonPreference(
strRes("piko_pref_icon_n_navbar_btn"),
strRes("app_icon"),
"",
Settings.PREMIUM_ICONS
)
);
}

if (SettingsStatus.navBarCustomisation) {
addPreference(category,
helper.buttonPreference(
strRes("custom_navigation"),
"",
Settings.PREMIUM_NAVBAR
)
);
}

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public class Settings extends BaseSettings {
public static final BooleanSetting PREMIUM_READER_MODE = new BooleanSetting("premium_reader_mode", false);
public static final BooleanSetting PREMIUM_UNDO_POSTS = new BooleanSetting("premium_undo_posts", false);
public static final BooleanSetting PREMIUM_ICONS = new BooleanSetting("premium_app_icon", true);
public static final BooleanSetting PREMIUM_NAVBAR = new BooleanSetting("premium_custom_navbar", true);
public static final BooleanSetting PREMIUM_ENABLE_FORCE_PIP = new BooleanSetting("premium_enable_force_pip", false);

public static final StringSetting CUSTOM_PROFILE_TABS = new StringSetting("customisation_profile_tabs", "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ public boolean onPreferenceClick(Preference preference) {
} else if (key.equals(Settings.PREMIUM_UNDO_POSTS.key)) {
Utils.startUndoPostActivity();
} else if (key.equals(Settings.PREMIUM_ICONS.key)) {
Utils.startAppIconNNavIconActivity();
Utils.openUrl("https://www.x.com/settings/app_icon");
} else if (key.equals(Settings.PREMIUM_NAVBAR.key)) {
Utils.openUrl("https://www.x.com/settings/custom_navigation");
} else if (key.equals(Settings.RESET_PREF.key)) {
Utils.deleteSharedPrefAB(context, false);
} else if (key.equals(Settings.RESET_FLAGS.key)) {
Expand Down

0 comments on commit b5dc850

Please sign in to comment.