Don't suggest downgrades. No need to check version

This commit is contained in:
Daniel Martí 2013-06-01 12:03:34 +02:00
parent 020cac971f
commit 3f0d8b2577
2 changed files with 7 additions and 10 deletions

View File

@ -502,8 +502,7 @@ public class AppDetails extends ListActivity {
return true; return true;
DB.Apk curver = app.getCurrentVersion(); DB.Apk curver = app.getCurrentVersion();
List<MenuItem> toShow = new ArrayList<MenuItem>(2); List<MenuItem> toShow = new ArrayList<MenuItem>(2);
if (app.installedVersion != null && curver != null if (app.hasUpdates == true) {
&& !app.installedVersion.equals(curver.version)) {
toShow.add(menu.add(Menu.NONE, INSTALL, 0, R.string.menu_update).setIcon( toShow.add(menu.add(Menu.NONE, INSTALL, 0, R.string.menu_update).setIcon(
R.drawable.ic_menu_refresh)); R.drawable.ic_menu_refresh));
} }

View File

@ -736,19 +736,17 @@ public class DB {
if (getinstalledinfo) { if (getinstalledinfo) {
// We'll say an application has updates if it's installed AND the // We'll say an application has updates if it's installed AND the
// installed version is not the 'current' one AND the installed // version is older than the current one
// version is older than the current one.
for (App app : result) { for (App app : result) {
Apk curver = app.getCurrentVersion(); Apk curver = app.getCurrentVersion();
if (curver != null && app.installedVersion != null if (curver != null
&& !app.installedVersion.equals(curver.version)) { && app.installedVersion != null
if (app.installedVerCode < curver.vercode) { && app.installedVerCode < curver.vercode) {
app.hasUpdates = true; app.hasUpdates = true;
app.updateVersion = curver.version; app.updateVersion = curver.version;
} }
} }
} }
}
return result; return result;
} }