Commit ed9b55bf authored by Alexandre Roux's avatar Alexandre Roux
Browse files

Merge branch 'v1-q-186-display-preversion-when-available' into 'v1-q'

display preversion when available

See merge request !63
parents 7c632baf f3a79b80
......@@ -28,7 +28,7 @@ to be updated. This will be fixed later
android:requestLegacyExternalStorage="true"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="false">
android:usesCleartextTraffic="true">
<activity
android:name=".UpdatesActivity"
......
......@@ -269,7 +269,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter.
String buildDate = StringGenerator.getDateLocalizedUTC(mActivity,
DateFormat.LONG, update.getTimestamp());
String buildVersion = mActivity.getString(R.string.list_build_version,
update.getVersion());
update.getVersion() + (!update.getPreversion().isEmpty() ? "-"+update.getPreversion() : ""));
if (!update.getAndroidVersion().equals(Build.VERSION.RELEASE)){
viewHolder.mUpgradeType.setVisibility(TextView.VISIBLE);
......@@ -472,7 +472,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter.
String buildDate = StringGenerator.getDateLocalizedUTC(mActivity,
DateFormat.MEDIUM, update.getTimestamp());
String buildInfoText = mActivity.getString(R.string.list_build_version_date,
update.getVersion(), buildDate);
update.getVersion() + (!update.getPreversion().isEmpty() ? "-"+update.getPreversion() : ""), buildDate);
if(update.getAndroidVersion().equals(Build.VERSION.RELEASE)){
title = R.string.apply_update_dialog_title;
......
......@@ -97,6 +97,11 @@ public class Utils {
update.setFileSize(object.getLong("size"));
update.setDownloadUrl(object.getString("url"));
update.setVersion(object.getString("version"));
if (object.has("pre_version")) {
update.setPreversion(object.getString("pre_version"));
} else {
update.setPreversion("");
}
update.setDisplayVersion(object.getString("display_version"));
update.setAndroidVersion(object.getString("android_version"));
return update;
......
......@@ -23,6 +23,7 @@ public class UpdateBase implements UpdateBaseInfo {
private long mTimestamp;
private String mType;
private String mVersion;
private String mPreversion;
private String mAndroidVersion;
private String mDisplayVersion;
private long mFileSize;
......@@ -37,6 +38,7 @@ public class UpdateBase implements UpdateBaseInfo {
mTimestamp = update.getTimestamp();
mType = update.getType();
mVersion = update.getVersion();
mPreversion = update.getPreversion();
mDisplayVersion = update.getDisplayVersion();
mAndroidVersion = update.getAndroidVersion();
mFileSize = update.getFileSize();
......@@ -87,6 +89,15 @@ public class UpdateBase implements UpdateBaseInfo {
mVersion = version;
}
@Override
public String getPreversion() {
return mPreversion;
}
public void setPreversion(String preversion) {
mPreversion = preversion;
}
@Override
public String getDisplayVersion() {
return mDisplayVersion;
......
......@@ -26,6 +26,8 @@ public interface UpdateBaseInfo {
String getVersion();
String getPreversion();
String getDisplayVersion();
String getAndroidVersion();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment