From 6124ec66f3405ff9c0a2c72f59e36258f334e973 Mon Sep 17 00:00:00 2001 From: eddyizm Date: Tue, 11 Nov 2025 18:06:01 -0800 Subject: [PATCH] feat: added setting to disable github check and completely disable/hide when using the degoogled version --- .../tempo/ui/activity/MainActivity.java | 2 +- .../tempo/ui/dialog/GithubTempoUpdateDialog.java | 2 +- .../tempo/ui/fragment/SettingsFragment.java | 8 ++++++++ .../com/cappielloantonio/tempo/util/Preferences.kt | 11 +++++++++-- app/src/main/res/values/strings.xml | 3 +++ app/src/main/res/xml/global_preferences.xml | 12 ++++++++++++ 6 files changed, 34 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/cappielloantonio/tempo/ui/activity/MainActivity.java b/app/src/main/java/com/cappielloantonio/tempo/ui/activity/MainActivity.java index b311a627..156805a2 100644 --- a/app/src/main/java/com/cappielloantonio/tempo/ui/activity/MainActivity.java +++ b/app/src/main/java/com/cappielloantonio/tempo/ui/activity/MainActivity.java @@ -438,7 +438,7 @@ public class MainActivity extends BaseActivity { } private void checkTempoUpdate() { - if (BuildConfig.FLAVOR.equals("tempus") && Preferences.showTempoUpdateDialog()) { + if (BuildConfig.FLAVOR.equals("tempus") && Preferences.isGithubUpdateEnabled() && Preferences.showTempusUpdateDialog()) { mainViewModel.checkTempoUpdate().observe(this, latestRelease -> { if (latestRelease != null && UpdateUtil.showUpdateDialog(latestRelease)) { GithubTempoUpdateDialog dialog = new GithubTempoUpdateDialog(latestRelease); diff --git a/app/src/main/java/com/cappielloantonio/tempo/ui/dialog/GithubTempoUpdateDialog.java b/app/src/main/java/com/cappielloantonio/tempo/ui/dialog/GithubTempoUpdateDialog.java index 6ee951a0..55e07012 100644 --- a/app/src/main/java/com/cappielloantonio/tempo/ui/dialog/GithubTempoUpdateDialog.java +++ b/app/src/main/java/com/cappielloantonio/tempo/ui/dialog/GithubTempoUpdateDialog.java @@ -55,7 +55,7 @@ public class GithubTempoUpdateDialog extends DialogFragment { }); alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE).setOnClickListener(v -> { - Preferences.setTempoUpdateReminder(); + Preferences.setTempusUpdateReminder(); Objects.requireNonNull(getDialog()).dismiss(); }); diff --git a/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/SettingsFragment.java b/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/SettingsFragment.java index 2dd556df..bbbdecc2 100644 --- a/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/SettingsFragment.java +++ b/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/SettingsFragment.java @@ -29,6 +29,7 @@ import androidx.navigation.NavOptions; import androidx.navigation.fragment.NavHostFragment; import androidx.preference.ListPreference; import androidx.preference.Preference; +import androidx.preference.PreferenceCategory; import androidx.preference.PreferenceFragmentCompat; import androidx.preference.SwitchPreference; @@ -77,6 +78,13 @@ public class SettingsFragment extends PreferenceFragmentCompat { result -> {} ); + if (!BuildConfig.FLAVOR.equals("tempus")) { + PreferenceCategory githubUpdateCategory = findPreference("settings_github_update_category_key"); + if (githubUpdateCategory != null) { + getPreferenceScreen().removePreference(githubUpdateCategory); + } + } + directoryPickerLauncher = registerForActivityResult( new ActivityResultContracts.StartActivityForResult(), result -> { diff --git a/app/src/main/java/com/cappielloantonio/tempo/util/Preferences.kt b/app/src/main/java/com/cappielloantonio/tempo/util/Preferences.kt index 42ffa524..e404c29c 100644 --- a/app/src/main/java/com/cappielloantonio/tempo/util/Preferences.kt +++ b/app/src/main/java/com/cappielloantonio/tempo/util/Preferences.kt @@ -70,6 +70,7 @@ object Preferences { private const val SONG_RATING_PER_ITEM = "song_rating_per_item" private const val RATING_PER_ITEM = "rating_per_item" private const val NEXT_UPDATE_CHECK = "next_update_check" + private const val GITHUB_UPDATE_CHECK = "github_update_check" private const val CONTINUOUS_PLAY = "continuous_play" private const val LAST_INSTANT_MIX = "last_instant_mix" private const val ALLOW_PLAYLIST_DUPLICATES = "allow_playlist_duplicates" @@ -574,15 +575,21 @@ object Preferences { return App.getInstance().preferences.getBoolean(RATING_PER_ITEM, false) } + @JvmStatic - fun showTempoUpdateDialog(): Boolean { + fun isGithubUpdateEnabled(): Boolean { + return App.getInstance().preferences.getBoolean(GITHUB_UPDATE_CHECK, true) + } + + @JvmStatic + fun showTempusUpdateDialog(): Boolean { return App.getInstance().preferences.getLong( NEXT_UPDATE_CHECK, 0 ) + 86400000 < System.currentTimeMillis() } @JvmStatic - fun setTempoUpdateReminder() { + fun setTempusUpdateReminder() { App.getInstance().preferences.edit().putLong(NEXT_UPDATE_CHECK, System.currentTimeMillis()).apply() } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 80af298c..25dcec94 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -331,6 +331,9 @@ Follow the development Github https://github.com/eddyizm/tempus/discussions + Updates + Check github for release updates + If using the github version, by default app will check for new apk release. Toggle to disable automatic github checks Join community discussions and support User support Scanning: counting %1$d tracks diff --git a/app/src/main/res/xml/global_preferences.xml b/app/src/main/res/xml/global_preferences.xml index a8caeb8b..fcd65268 100644 --- a/app/src/main/res/xml/global_preferences.xml +++ b/app/src/main/res/xml/global_preferences.xml @@ -400,6 +400,18 @@ app:useSimpleSummaryProvider="true" /> + + + + +