forked from upstream-mirrors/quik
Don't show changelogs for future versions
This commit is contained in:
@@ -4,6 +4,7 @@ import android.util.Log;
|
|||||||
import com.android.volley.toolbox.StringRequest;
|
import com.android.volley.toolbox.StringRequest;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import com.moez.QKSMS.BuildConfig;
|
||||||
import com.moez.QKSMS.R;
|
import com.moez.QKSMS.R;
|
||||||
import com.moez.QKSMS.data.Conversation;
|
import com.moez.QKSMS.data.Conversation;
|
||||||
import com.moez.QKSMS.transaction.SmsHelper;
|
import com.moez.QKSMS.transaction.SmsHelper;
|
||||||
@@ -99,22 +100,29 @@ public class DialogHelper {
|
|||||||
|
|
||||||
Arrays.sort(changes, (lhs, rhs) -> Long.valueOf(rhs.dateLong).compareTo(lhs.dateLong));
|
Arrays.sort(changes, (lhs, rhs) -> Long.valueOf(rhs.dateLong).compareTo(lhs.dateLong));
|
||||||
|
|
||||||
String[] versions = new String[changes.length];
|
boolean currentVersionReached = false;
|
||||||
String[] dates = new String[changes.length];
|
ArrayList<String> versions = new ArrayList<>();
|
||||||
String[] changelists = new String[changes.length];
|
ArrayList<String> dates = new ArrayList<>();
|
||||||
for (int i = 0; i < changes.length; i++) {
|
ArrayList<String> changelists = new ArrayList<>();
|
||||||
Change change = changes[i];
|
for (Change change : changes) {
|
||||||
versions[i] = change.version;
|
if (change.version.equals(BuildConfig.VERSION_NAME)) {
|
||||||
dates[i] = change.date;
|
currentVersionReached = true;
|
||||||
|
}
|
||||||
|
|
||||||
changelists[i] = "";
|
if (currentVersionReached) {
|
||||||
for (int j = 0; j < change.changes.size(); j++) {
|
versions.add(change.version);
|
||||||
String changeItem = change.changes.get(j);
|
dates.add(change.date);
|
||||||
changelists[i] += " • ";
|
|
||||||
changelists[i] += changeItem;
|
String changelist = "";
|
||||||
if (j < change.changes.size() - 1) {
|
for (int i = 0; i < change.changes.size(); i++) {
|
||||||
changelists[i] += "\n";
|
String changeItem = change.changes.get(i);
|
||||||
|
changelist += " • ";
|
||||||
|
changelist += changeItem;
|
||||||
|
if (i < change.changes.size() - 1) {
|
||||||
|
changelist += "\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
changelists.add(changelist);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,7 +131,10 @@ public class DialogHelper {
|
|||||||
new QKDialog()
|
new QKDialog()
|
||||||
.setContext(context)
|
.setContext(context)
|
||||||
.setTitle(R.string.title_changelog)
|
.setTitle(R.string.title_changelog)
|
||||||
.setTripleLineItems(versions, dates, changelists, null)
|
.setTripleLineItems(
|
||||||
|
versions.toArray(new String[versions.size()]),
|
||||||
|
dates.toArray(new String[versions.size()]),
|
||||||
|
changelists.toArray(new String[versions.size()]), null)
|
||||||
.show();
|
.show();
|
||||||
}, error -> {
|
}, error -> {
|
||||||
context.hideProgressDialog();
|
context.hideProgressDialog();
|
||||||
|
|||||||
Reference in New Issue
Block a user