Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

Commit

Permalink
About
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr-TSNG committed Mar 18, 2022
1 parent f2bed80 commit 1cca6b9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fun mainActivityHook() {
name == "onResume"
}.hookAfter { param ->
Log.d("MainActivity onResume")
if (modulePrefs.getBoolean("first_run", true)) {
if (BuildConfig.DEBUG || modulePrefs.getBoolean("first_run", true)) {
SettingsDialog(param.thisObject as Activity)
modulePrefs.edit().putBoolean("first_run", false).apply()
}
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/java/icu/nullptr/twifucker/ui/SettingsDialog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ package icu.nullptr.twifucker.ui
import android.app.Activity
import android.app.AlertDialog
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
import android.net.Uri
import android.os.Bundle
import android.preference.Preference
import android.preference.PreferenceFragment
Expand All @@ -28,6 +30,10 @@ class SettingsDialog(context: Context) : AlertDialog.Builder(context) {
preferenceManager.sharedPreferencesName = PREFS_NAME
addPreferencesFromResource(R.xml.settings_dialog)
prefs = preferenceManager.sharedPreferences
findPreference("about").setOnPreferenceClickListener {
activity.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/Dr-TSNG/TwiFucker")))
true
}
}

override fun onPreferenceChange(p0: Preference?, p1: Any?): Boolean {
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<string name="settings_main">Main</string>
<string name="settings_extra">Extra</string>

<string name="about_title">TwiFucker by Nullptr</string>
<string name="show_toast_title">Show Toast on Start</string>
<string name="disable_promoted_content_title">Disable Promoted Content</string>
<string name="disable_promoted_user_title">Disable Promoted User</string>
Expand All @@ -16,6 +17,7 @@
<string name="disable_who_to_follow_title">Disable Who to Follow</string>
<string name="disable_topics_to_follow_title">Disable Topics to Follow</string>

<string name="about_summary">Visit the GitHub page for more support</string>
<string name="show_toast_summary">You can find this page through settings/additional/version</string>
<string name="disable_promoted_content_summary">home/profile/search timeline</string>
<string name="disable_promoted_user_summary">home/profile/search timeline</string>
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/xml/settings_dialog.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="@string/settings_general">
<Preference
android:key="about"
android:summary="@string/about_summary"
android:title="@string/about_title" />
<SwitchPreference
android:defaultValue="true"
android:key="show_toast"
Expand Down

0 comments on commit 1cca6b9

Please sign in to comment.