Skip to content

Commit

Permalink
feat(twitter): Switch back to java
Browse files Browse the repository at this point in the history
  • Loading branch information
crimera committed Mar 1, 2024
1 parent 9d14532 commit 1c38d00
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 33 deletions.
40 changes: 40 additions & 0 deletions app/src/main/java/app/revanced/integrations/twitter/Utils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package app.revanced.integrations.twitter;

import android.content.Context;
import android.content.Intent;
import android.preference.PreferenceManager;

import java.util.Arrays;

import app.revanced.integrations.shared.settings.Setting;
import app.revanced.integrations.twitter.settings.Settings;
import app.revanced.integrations.twitter.settings.SettingsActivity;

public class Utils {
private static final Context ctx = app.revanced.integrations.shared.Utils.getContext();

public static void startActivity() {
Intent intent = new Intent(ctx, SettingsActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
ctx.startActivity(intent);
}

@SuppressWarnings("deprecation")
private static String getStringPref(Setting<String> setting) {
String value = PreferenceManager.getDefaultSharedPreferences(ctx).getString(setting.key, setting.defaultValue);
if (value.isBlank()) {
return setting.defaultValue;
}
return setting.key;
}

public static String getVideoFolder(String filename) {
return getStringPref(Settings.VID_SUBFOLDER)+"/"+filename;
}

public static String[] addPref(String[] prefs, String pref) {
String[] bigger = Arrays.copyOf(prefs, prefs.length+1);
bigger[prefs.length] = pref;
return bigger;
}
}
33 changes: 0 additions & 33 deletions app/src/main/java/app/revanced/integrations/twitter/Utils.kt

This file was deleted.

0 comments on commit 1c38d00

Please sign in to comment.