Updater: 20 and up are integers!
Not 20.0 but 20! Change-Id: Iccbcd765ce2be60cef413a73461563569bc7cdc6
This commit is contained in:
@@ -31,6 +31,7 @@ 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;
|
||||||
|
|
||||||
@@ -61,7 +62,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,
|
||||||
BuildInfoUtils.getBuildVersion(), buildDate);
|
Utils.getDisplayVersion(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,
|
||||||
|
@@ -151,7 +151,7 @@ public class UpdatesActivity extends UpdatesListActivity {
|
|||||||
|
|
||||||
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,
|
||||||
BuildInfoUtils.getBuildVersion()));
|
Utils.getDisplayVersion(BuildInfoUtils.getBuildVersion())));
|
||||||
|
|
||||||
updateLastCheckedString();
|
updateLastCheckedString();
|
||||||
|
|
||||||
|
@@ -276,7 +276,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,
|
||||||
update.getVersion());
|
Utils.getDisplayVersion(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);
|
||||||
|
@@ -413,4 +413,10 @@ 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user