forked from ReVanced/revanced-integrations
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
40 additions
and
33 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
app/src/main/java/app/revanced/integrations/twitter/Utils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
33
app/src/main/java/app/revanced/integrations/twitter/Utils.kt
This file was deleted.
Oops, something went wrong.