diff --git a/app/build.gradle b/app/build.gradle
index d883de1b..0bd1e8a1 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -11,7 +11,7 @@ android {
targetSdk 35
versionCode 5
- versionName '4.2.0'
+ versionName '4.2.1'
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
javaCompileOptions {
diff --git a/app/src/main/java/com/cappielloantonio/tempo/github/utils/UpdateUtil.java b/app/src/main/java/com/cappielloantonio/tempo/github/utils/UpdateUtil.java
index a6baea99..a4e61fb3 100644
--- a/app/src/main/java/com/cappielloantonio/tempo/github/utils/UpdateUtil.java
+++ b/app/src/main/java/com/cappielloantonio/tempo/github/utils/UpdateUtil.java
@@ -7,10 +7,11 @@ public class UpdateUtil {
public static boolean showUpdateDialog(LatestRelease release) {
if (release.getTagName() == null) return false;
+ String remoteTag = release.getTagName().replaceAll("^\\D+", "");
try {
String[] local = BuildConfig.VERSION_NAME.split("\\.");
- String[] remote = release.getTagName().split("\\.");
+ String[] remote = remoteTag.split("\\.");
for (int i = 0; i < local.length; i++) {
int localPart = Integer.parseInt(local[i]);
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" />
+
+
+
+
+