diff --git a/src/main/kotlin/app/util/ResourceUtils.kt b/src/main/kotlin/app/util/ResourceUtils.kt
index 56076078..66e50501 100644
--- a/src/main/kotlin/app/util/ResourceUtils.kt
+++ b/src/main/kotlin/app/util/ResourceUtils.kt
@@ -111,6 +111,29 @@ fun String.copyXmlNode(source: DomFileEditor, target: DomFileEditor): AutoClosea
}
}
+//Credits @inotia00
+/**
+ * Copy resources from the current class loader to the resource directory.
+ * @param resourceDirectory The directory of the resource.
+ * @param targetResource The target resource.
+ * @param elementTag The element to copy.
+ */
+fun ResourceContext.copyXmlNode(
+ resourceDirectory: String,
+ targetResource: String,
+ elementTag: String
+) {
+ val stringsResourceInputStream =
+ classLoader.getResourceAsStream("$resourceDirectory/$targetResource")!!
+
+ // Copy nodes from the resources node to the real resource node
+ elementTag.copyXmlNode(
+ this.xmlEditor[stringsResourceInputStream],
+ this.xmlEditor["res/$targetResource"]
+ ).close()
+}
+
+
// /**
// * Copies the specified node of the source [Document] to the target [Document].
// * @param source the source [Document].
diff --git a/src/main/kotlin/crimera/patches/twitter/misc/settings/SettingsResourcePatch.kt b/src/main/kotlin/crimera/patches/twitter/misc/settings/SettingsResourcePatch.kt
index 54b9a129..bd7017a4 100644
--- a/src/main/kotlin/crimera/patches/twitter/misc/settings/SettingsResourcePatch.kt
+++ b/src/main/kotlin/crimera/patches/twitter/misc/settings/SettingsResourcePatch.kt
@@ -5,7 +5,10 @@ import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
+import app.revanced.util.ResourceGroup
+import app.revanced.util.copyResources
import org.w3c.dom.Element
+import app.revanced.util.copyXmlNode
@Patch(
compatiblePackages = [CompatiblePackage("com.twitter.android")],
@@ -20,7 +23,7 @@ object SettingsResourcePatch: ResourcePatch() {
val prefMod = editor.file.createElement("Preference")
prefMod.setAttribute("android:icon", "@drawable/ic_vector_settings_stroke")
- prefMod.setAttribute("android:title", "Mod Settings")
+ prefMod.setAttribute("android:title", "@string/piko_settings_title")
prefMod.setAttribute("android:key", "pref_mod")
prefMod.setAttribute("android:order", "110")
@@ -31,12 +34,30 @@ object SettingsResourcePatch: ResourcePatch() {
val applicationNode = it.file.getElementsByTagName("application").item(0)
val modActivity = it.file.createElement("activity").apply {
- setAttribute("android:label", "Mod Settings")
+ setAttribute("android:label", "@strings/piko_settings_title")
setAttribute("android:name", "app.revanced.integrations.twitter.settings.SettingsActivity")
setAttribute("android:excludeFromRecents", "true")
}
applicationNode.appendChild(modActivity)
}
+
+ //credits @inotia00
+ context.copyXmlNode("twitter/settings", "values/strings.xml", "resources")
+
+ /**
+ * create directory for the untranslated language resources
+ */
+ context["res/values-v21"].mkdirs()
+ arrayOf(
+ ResourceGroup(
+ "values-v21",
+ "strings.xml"
+ )
+ ).forEach { resourceGroup ->
+ context.copyResources("twitter/settings", resourceGroup)
+ }
+
+
}
}
\ No newline at end of file
diff --git a/src/main/resources/twitter/settings/values-v21/strings.xml b/src/main/resources/twitter/settings/values-v21/strings.xml
new file mode 100644
index 00000000..687b210d
--- /dev/null
+++ b/src/main/resources/twitter/settings/values-v21/strings.xml
@@ -0,0 +1,5 @@
+
+
+
+ Piko Mod Settings
+
\ No newline at end of file
diff --git a/src/main/resources/twitter/settings/values/strings.xml b/src/main/resources/twitter/settings/values/strings.xml
new file mode 100644
index 00000000..407fb405
--- /dev/null
+++ b/src/main/resources/twitter/settings/values/strings.xml
@@ -0,0 +1,50 @@
+
+
+ Premium
+ Enable reader mode
+ Enables "reader mode" on long threads
+ Enable undo posts
+ Enables ability to undo posts before posting
+ Undo posts settings
+ App icon and navbar customisation settings
+
+ Download
+ Public folder
+ The public folder to use for video downloads
+ Download subfolder
+ The subfolder to download videos to ([PublicFolder]/[Subfolder])
+
+ Ads
+ Hide promoted posts
+ Hide google ads
+ Hide "Who to follow" section
+ Hide "Creators to subscribe" section
+ Hide "Community to join" section
+ Hide "Revist your bookmark" section
+ Hide "Pinned posts by followers" section
+ Hide detailed posts (in replies)
+ Hide promoted trends
+
+ Misc
+ Enable chirp font
+ Hide floating action button
+ Hide floating action button menu
+ Hide recommended users
+ Hide community notes
+ Hide view count
+ Custom sharing domain
+ The domain to use when sharing tweets
+
+ Timeline
+ Hide for you tab
+ Hide live threads
+ Hides live section in timeline
+ Hide banner
+ Hide new posts pill
+ Hide bookmark icon in timeline
+ Show poll results
+ View poll results without voting
+ Hide immersive player
+ Removes swipe up for more videos in video player
+
+
\ No newline at end of file