Updater: 20 and up are integers!
Not 20.0 but 20!
Change-Id: Iccbcd765ce2be60cef413a73461563569bc7cdc6
diff --git a/src/org/lineageos/updater/UpdaterReceiver.java b/src/org/lineageos/updater/UpdaterReceiver.java
index 1fb2c5a..4b7cb7e 100644
--- a/src/org/lineageos/updater/UpdaterReceiver.java
+++ b/src/org/lineageos/updater/UpdaterReceiver.java
@@ -31,6 +31,7 @@
import org.lineageos.updater.misc.BuildInfoUtils;
import org.lineageos.updater.misc.Constants;
import org.lineageos.updater.misc.StringGenerator;
+import org.lineageos.updater.misc.Utils;
import java.text.DateFormat;
@@ -61,7 +62,7 @@
String buildDate = StringGenerator.getDateLocalizedUTC(context,
DateFormat.MEDIUM, preferences.getLong(Constants.PREF_INSTALL_NEW_TIMESTAMP, 0));
String buildInfo = context.getString(R.string.list_build_version_date,
- BuildInfoUtils.getBuildVersion(), buildDate);
+ Utils.getDisplayVersion(BuildInfoUtils.getBuildVersion()), buildDate);
Intent notificationIntent = new Intent(context, UpdatesActivity.class);
PendingIntent intent = PendingIntent.getActivity(context, 0, notificationIntent,
diff --git a/src/org/lineageos/updater/UpdatesActivity.java b/src/org/lineageos/updater/UpdatesActivity.java
index b1365cc..12254c7 100644
--- a/src/org/lineageos/updater/UpdatesActivity.java
+++ b/src/org/lineageos/updater/UpdatesActivity.java
@@ -151,7 +151,7 @@
TextView headerTitle = findViewById(R.id.header_title);
headerTitle.setText(getString(R.string.header_title_text,
- BuildInfoUtils.getBuildVersion()));
+ Utils.getDisplayVersion(BuildInfoUtils.getBuildVersion())));
updateLastCheckedString();
diff --git a/src/org/lineageos/updater/UpdatesListAdapter.java b/src/org/lineageos/updater/UpdatesListAdapter.java
index a107470..e01825d 100644
--- a/src/org/lineageos/updater/UpdatesListAdapter.java
+++ b/src/org/lineageos/updater/UpdatesListAdapter.java
@@ -276,7 +276,7 @@
String buildDate = StringGenerator.getDateLocalizedUTC(mActivity,
DateFormat.LONG, update.getTimestamp());
String buildVersion = mActivity.getString(R.string.list_build_version,
- update.getVersion());
+ Utils.getDisplayVersion(update.getVersion()));
viewHolder.mBuildDate.setText(buildDate);
viewHolder.mBuildVersion.setText(buildVersion);
viewHolder.mBuildVersion.setCompoundDrawables(null, null, null, null);
diff --git a/src/org/lineageos/updater/misc/Utils.java b/src/org/lineageos/updater/misc/Utils.java
index d768f62..f0e390a 100644
--- a/src/org/lineageos/updater/misc/Utils.java
+++ b/src/org/lineageos/updater/misc/Utils.java
@@ -413,4 +413,10 @@
public static boolean isRecoveryUpdateExecPresent() {
return new File(Constants.UPDATE_RECOVERY_EXEC).exists();
}
+
+ public static String getDisplayVersion(String version) {
+ float floatVersion = Float.parseFloat(version);
+ // Lineage 20 and up should only be integer values (we don't have minor versions anymore)
+ return (floatVersion >= 20) ? String.valueOf((int)floatVersion) : version;
+ }
}