Revert "Updater: 20 and up are integers!"

This reverts commit 1ec0b8d1de.

Change-Id: I5b5c5bf825405d7a0b3720521cea343a0674fd40
This commit is contained in:
Michael Bestas
2024-12-26 02:30:04 +02:00
parent b31dd16806
commit a2e31f1f2d
4 changed files with 3 additions and 10 deletions

View File

@@ -31,7 +31,6 @@ import androidx.preference.PreferenceManager;
import org.lineageos.updater.misc.BuildInfoUtils; import org.lineageos.updater.misc.BuildInfoUtils;
import org.lineageos.updater.misc.Constants; import org.lineageos.updater.misc.Constants;
import org.lineageos.updater.misc.StringGenerator; import org.lineageos.updater.misc.StringGenerator;
import org.lineageos.updater.misc.Utils;
import java.text.DateFormat; import java.text.DateFormat;
@@ -62,7 +61,7 @@ public class UpdaterReceiver extends BroadcastReceiver {
String buildDate = StringGenerator.getDateLocalizedUTC(context, String buildDate = StringGenerator.getDateLocalizedUTC(context,
DateFormat.MEDIUM, preferences.getLong(Constants.PREF_INSTALL_NEW_TIMESTAMP, 0)); DateFormat.MEDIUM, preferences.getLong(Constants.PREF_INSTALL_NEW_TIMESTAMP, 0));
String buildInfo = context.getString(R.string.list_build_version_date, String buildInfo = context.getString(R.string.list_build_version_date,
Utils.getDisplayVersion(BuildInfoUtils.getBuildVersion()), buildDate); BuildInfoUtils.getBuildVersion(), buildDate);
Intent notificationIntent = new Intent(context, UpdatesActivity.class); Intent notificationIntent = new Intent(context, UpdatesActivity.class);
PendingIntent intent = PendingIntent.getActivity(context, 0, notificationIntent, PendingIntent intent = PendingIntent.getActivity(context, 0, notificationIntent,

View File

@@ -181,7 +181,7 @@ public class UpdatesActivity extends UpdatesListActivity implements UpdateImport
TextView headerTitle = findViewById(R.id.header_title); TextView headerTitle = findViewById(R.id.header_title);
headerTitle.setText(getString(R.string.header_title_text, headerTitle.setText(getString(R.string.header_title_text,
Utils.getDisplayVersion(BuildInfoUtils.getBuildVersion()))); BuildInfoUtils.getBuildVersion()));
updateLastCheckedString(); updateLastCheckedString();

View File

@@ -280,7 +280,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter.
String buildDate = StringGenerator.getDateLocalizedUTC(mActivity, String buildDate = StringGenerator.getDateLocalizedUTC(mActivity,
DateFormat.LONG, update.getTimestamp()); DateFormat.LONG, update.getTimestamp());
String buildVersion = mActivity.getString(R.string.list_build_version, String buildVersion = mActivity.getString(R.string.list_build_version,
Utils.getDisplayVersion(update.getVersion())); update.getVersion());
viewHolder.mBuildDate.setText(buildDate); viewHolder.mBuildDate.setText(buildDate);
viewHolder.mBuildVersion.setText(buildVersion); viewHolder.mBuildVersion.setText(buildVersion);
viewHolder.mBuildVersion.setCompoundDrawables(null, null, null, null); viewHolder.mBuildVersion.setCompoundDrawables(null, null, null, null);

View File

@@ -427,10 +427,4 @@ public class Utils {
public static boolean isRecoveryUpdateExecPresent() { public static boolean isRecoveryUpdateExecPresent() {
return new File(Constants.UPDATE_RECOVERY_EXEC).exists(); 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;
}
} }