From 62bc8c99c2bcdd64d2b34424d3a0d8e3ac3f2b7e Mon Sep 17 00:00:00 2001 From: Peter Serwylo Date: Fri, 3 May 2013 07:28:42 +1000 Subject: [PATCH] Fixed #240 - refresh view after resuming FDroid activity. The problem was that since the changes to implement tab swiping and fragments, the process for refreshing the lists was changed. The previous infrastructure for invalidating the result of FDroidApp.getApps() is still useful, so we presume that the list of apps is only going to take a few cycles to return, instead of several seconds. If it has been invalidated, so be it, we will put up with waiting the few seconds. --- src/org/fdroid/fdroid/AppListManager.java | 2 +- src/org/fdroid/fdroid/FDroid.java | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/org/fdroid/fdroid/AppListManager.java b/src/org/fdroid/fdroid/AppListManager.java index 99541eeb8..c0f506109 100644 --- a/src/org/fdroid/fdroid/AppListManager.java +++ b/src/org/fdroid/fdroid/AppListManager.java @@ -120,7 +120,7 @@ public class AppListManager { notifyLists(); notifyActivity(); - Log.d("FDroid", "Updated lists - " + allApps.size() + " allApps in total" + Log.d("FDroid", "Updated lists - " + allApps.size() + " in total" + " (update took " + (System.currentTimeMillis() - startTime) + " ms)"); } diff --git a/src/org/fdroid/fdroid/FDroid.java b/src/org/fdroid/fdroid/FDroid.java index 1d1a9af80..6d0899dca 100644 --- a/src/org/fdroid/fdroid/FDroid.java +++ b/src/org/fdroid/fdroid/FDroid.java @@ -19,6 +19,7 @@ package org.fdroid.fdroid; +import android.content.*; import android.content.res.Configuration; import android.support.v4.view.MenuItemCompat; import org.fdroid.fdroid.R; @@ -26,8 +27,6 @@ import org.fdroid.fdroid.R; import android.app.AlertDialog; import android.app.AlertDialog.Builder; import android.app.ProgressDialog; -import android.content.DialogInterface; -import android.content.Intent; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.net.Uri; @@ -80,10 +79,6 @@ public class FDroid extends FragmentActivity { createViews(); getTabManager().createTabs(); - // Must be done *after* createViews, because it will involve a - // callback to update the tab label for the "update" tab. This - // will fail unless the tabs have actually been created. - repopulateViews(); Intent i = getIntent(); if (i.hasExtra("uri")) { @@ -99,10 +94,16 @@ public class FDroid extends FragmentActivity { } @Override - protected void onStart() { - super.onStart(); + protected void onResume() { + super.onResume(); + repopulateViews(); } + /** + * Must be done *after* createViews, because it will involve a + * callback to update the tab label for the "update" tab. This + * will fail unless the tabs have actually been created. + */ protected void repopulateViews() { manager.repopulateLists(); }