Show the currently installed version (if installed) and current version (if hasUpdate)
This commit is contained in:
parent
ac890a051e
commit
5c87a5c425
@ -4,8 +4,6 @@ import java.io.File;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.fdroid.fdroid.R;
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@ -61,13 +59,21 @@ public class AppListAdapter extends BaseAdapter {
|
|||||||
name.setText(app.name);
|
name.setText(app.name);
|
||||||
|
|
||||||
String vs;
|
String vs;
|
||||||
int numav = app.apks.size();
|
if (app.hasUpdates)
|
||||||
if (numav == 1)
|
vs = app.installedVersion + " -> " + app.currentVersion;
|
||||||
vs = mContext.getString(R.string.n_version_available);
|
else if (app.installedVersion != null)
|
||||||
else
|
vs = app.installedVersion;
|
||||||
vs = mContext.getString(R.string.n_versions_available);
|
else {
|
||||||
|
int numav = app.apks.size();
|
||||||
|
if (numav == 1)
|
||||||
|
vs = mContext.getString(R.string.n_version_available);
|
||||||
|
else
|
||||||
|
vs = mContext.getString(R.string.n_versions_available);
|
||||||
|
vs = String.format(vs, numav);
|
||||||
|
}
|
||||||
|
|
||||||
TextView status = (TextView) v.findViewById(R.id.status);
|
TextView status = (TextView) v.findViewById(R.id.status);
|
||||||
status.setText(String.format(vs, numav));
|
status.setText(vs);
|
||||||
|
|
||||||
TextView license = (TextView) v.findViewById(R.id.license);
|
TextView license = (TextView) v.findViewById(R.id.license);
|
||||||
license.setText(app.license);
|
license.setText(app.license);
|
||||||
|
@ -37,8 +37,8 @@ import android.database.sqlite.SQLiteDatabase;
|
|||||||
import android.database.sqlite.SQLiteOpenHelper;
|
import android.database.sqlite.SQLiteOpenHelper;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.util.Log;
|
|
||||||
import android.text.TextUtils.SimpleStringSplitter;
|
import android.text.TextUtils.SimpleStringSplitter;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
public class DB {
|
public class DB {
|
||||||
|
|
||||||
@ -94,6 +94,7 @@ public class DB {
|
|||||||
public String sourceURL;
|
public String sourceURL;
|
||||||
public String donateURL; // Donate link, or null
|
public String donateURL; // Donate link, or null
|
||||||
public String installedVersion;
|
public String installedVersion;
|
||||||
|
public String currentVersion;
|
||||||
public int installedVerCode;
|
public int installedVerCode;
|
||||||
public String marketVersion;
|
public String marketVersion;
|
||||||
public int marketVercode;
|
public int marketVercode;
|
||||||
@ -632,8 +633,10 @@ public class DB {
|
|||||||
Apk curver = app.getCurrentVersion(compatChecker);
|
Apk curver = app.getCurrentVersion(compatChecker);
|
||||||
if (curver != null && app.installedVersion != null
|
if (curver != null && app.installedVersion != null
|
||||||
&& !app.installedVersion.equals(curver.version)) {
|
&& !app.installedVersion.equals(curver.version)) {
|
||||||
if (app.installedVerCode < curver.vercode)
|
if (app.installedVerCode < curver.vercode) {
|
||||||
app.hasUpdates = true;
|
app.hasUpdates = true;
|
||||||
|
app.currentVersion = curver.version;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user