diff --git a/src/org/fdroid/fdroid/AppDetails.java b/src/org/fdroid/fdroid/AppDetails.java index 709b27b3a..551e02320 100644 --- a/src/org/fdroid/fdroid/AppDetails.java +++ b/src/org/fdroid/fdroid/AppDetails.java @@ -162,6 +162,7 @@ public class AppDetails extends ListActivity { } private boolean pref_cacheDownloaded; + private boolean viewResetRequired; @Override protected void onStart() { @@ -173,24 +174,33 @@ public class AppDetails extends ListActivity { SharedPreferences prefs = PreferenceManager .getDefaultSharedPreferences(getBaseContext()); pref_cacheDownloaded = prefs.getBoolean("cacheDownloaded", true); + viewResetRequired = true; - reset(false); + } + + @Override + protected void onResume() { + if (viewResetRequired) { + reset(); + viewResetRequired = false; + } + super.onResume(); } @Override protected void onStop() { db.close(); + db = null; ((FDroidApp) getApplication()).inActivity--; super.onStop(); } // Reset the display and list contents. Used when entering the activity, and - // also when something has been installed/uninstalled. In the latter case, - // 'update' is true to make the installed status get refreshed. - private void reset(boolean update) { + // also when something has been installed/uninstalled. + private void reset() { Log.d("FDroid", "Getting application details for " + appid); - app = db.getApps(appid, null, update).get(0); + app = db.getApps(appid, null, true).get(0); DB.Apk curver = app.getCurrentVersion(); app_currentvercode = curver == null ? 0 : curver.vercode; @@ -540,6 +550,7 @@ public class AppDetails extends ListActivity { @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { + if (requestCode == REQUEST_INSTALL) { // If we're not meant to be caching, delete the apk file we just // installed (or maybe the user cancelled the install - doesn't @@ -551,9 +562,10 @@ public class AppDetails extends ListActivity { File file = new File(apk_file); file.delete(); } + + viewResetRequired = true; } - reset(true); } } diff --git a/src/org/fdroid/fdroid/DB.java b/src/org/fdroid/fdroid/DB.java index e4a721e99..c3cf9b00e 100644 --- a/src/org/fdroid/fdroid/DB.java +++ b/src/org/fdroid/fdroid/DB.java @@ -347,9 +347,9 @@ public class DB { // version is older than the current one. for (App app : result) { Apk curver = app.getCurrentVersion(); - if (curver!= null && app.installedVersion != null + if (curver != null && app.installedVersion != null && !app.installedVersion.equals(curver.version)) { - if(app.installedVerCode < curver.vercode) + if (app.installedVerCode < curver.vercode) app.hasUpdates = true; } } @@ -363,7 +363,6 @@ public class DB { Map systemApks = new HashMap(); Log.d("FDroid", "Reading installed packages"); for (PackageInfo appInfo : installedPackages) { - Log.d("FDroid", "... " + appInfo.packageName); systemApks.put(appInfo.packageName, appInfo); }