generated from ReVanced/revanced-patches-template
-
-
Notifications
You must be signed in to change notification settings - Fork 301
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(TikTok): Add ReVanced settings about screen (#4009)
- Loading branch information
1 parent
c65f642
commit 12ea26b
Showing
4 changed files
with
130 additions
and
34 deletions.
There are no files selected for viewing
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
56 changes: 56 additions & 0 deletions
56
...java/app/revanced/extension/tiktok/settings/preference/ReVancedTikTokAboutPreference.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,56 @@ | ||
package app.revanced.extension.tiktok.settings.preference; | ||
|
||
import android.content.Context; | ||
import android.util.AttributeSet; | ||
|
||
import java.util.Map; | ||
|
||
import app.revanced.extension.shared.Logger; | ||
import app.revanced.extension.shared.settings.preference.ReVancedAboutPreference; | ||
|
||
@SuppressWarnings("unused") | ||
public class ReVancedTikTokAboutPreference extends ReVancedAboutPreference { | ||
|
||
/** | ||
* Because resources cannot be added to TikTok, | ||
* these strings are copied from the shared strings.xml file. | ||
* | ||
* Changes here must also be made in strings.xml | ||
*/ | ||
private final Map<String, String> aboutStrings = Map.of( | ||
"revanced_settings_about_links_body", "You are using ReVanced Patches version <i>%s</i>", | ||
"revanced_settings_about_links_dev_header", "Note", | ||
"revanced_settings_about_links_dev_body", "This version is a pre-release and you may experience unexpected issues", | ||
"revanced_settings_about_links_header", "Official links" | ||
); | ||
|
||
{ | ||
//noinspection deprecation | ||
setTitle("About"); | ||
} | ||
|
||
public ReVancedTikTokAboutPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { | ||
super(context, attrs, defStyleAttr, defStyleRes); | ||
} | ||
public ReVancedTikTokAboutPreference(Context context, AttributeSet attrs, int defStyleAttr) { | ||
super(context, attrs, defStyleAttr); | ||
} | ||
public ReVancedTikTokAboutPreference(Context context, AttributeSet attrs) { | ||
super(context, attrs); | ||
} | ||
public ReVancedTikTokAboutPreference(Context context) { | ||
super(context); | ||
} | ||
|
||
@Override | ||
protected String getString(String key, Object ... args) { | ||
String format = aboutStrings.get(key); | ||
|
||
if (format == null) { | ||
Logger.printException(() -> "Unknown key: " + key); | ||
return ""; | ||
} | ||
|
||
return String.format(format, args); | ||
} | ||
} |
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
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