Update tab refreshes correctly now.

Before it was listening for changes, but we weren't notifying
of changes correctly. Now we use ContentResolver.notifyChange().
This commit is contained in:
Peter Serwylo 2014-02-23 10:05:36 +11:00
parent bfdfb6d5ef
commit 9703350f41
2 changed files with 12 additions and 3 deletions

View File

@ -909,7 +909,7 @@ public class AppDetails extends ListActivity {
Uri uri = Uri.fromParts("package", pkginfo.packageName, null);
Intent intent = new Intent(Intent.ACTION_DELETE, uri);
startActivityForResult(intent, REQUEST_UNINSTALL);
((FDroidApp) getApplication()).invalidateApp(id);
notifyAppChanged(id);
}
@ -927,7 +927,15 @@ public class AppDetails extends ListActivity {
"application/vnd.android.package-archive");
extraNotUnknownSource(intent);
startActivityForResult(intent, REQUEST_INSTALL);
((FDroidApp) getApplication()).invalidateApp(id);
notifyAppChanged(id);
}
/**
* We could probably drop this, and let the PackageReceiver take care of notifications
* for us, but I don't think the package receiver notifications are very instantaneous.
*/
private void notifyAppChanged(String id) {
getContentResolver().notifyChange(AppProvider.getContentUri(id), null);
}
private void launchApk(String id) {

View File

@ -22,6 +22,7 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import org.fdroid.fdroid.data.AppProvider;
public class PackageReceiver extends BroadcastReceiver {
@ -29,7 +30,7 @@ public class PackageReceiver extends BroadcastReceiver {
public void onReceive(Context ctx, Intent intent) {
String appid = intent.getData().getSchemeSpecificPart();
Log.d("FDroid", "PackageReceiver received "+appid);
((FDroidApp) ctx.getApplicationContext()).invalidateApp(appid);
ctx.getContentResolver().notifyChange(AppProvider.getContentUri(appid), null);
Utils.clearInstalledApksCache();
}