When resuming the activity check for uninstall/install in the mean time.
Fixes #854. There is a bunch of UI code which runs in `onResumeFragments()`. However it all depends on the `app` variable in `AppDetails` being up to date. There is a number of things which could've changed since last refresh, the most notable of which is that the app may have been installed/uninstalled. Thus, this particular change checks only for a difference in installed state. However it could equally do a deeper comparison between the old and new `App` objects if it becomes aparant that other state becomes stale between pause and resume in the future. It is true that this requires a database query to be run each time the activity is resumed, but it doesn't seem there is much else we can do to prevent bugs relating to stale state.
This commit is contained in:
parent
ff6a60ae26
commit
94403d1d7e
@ -432,6 +432,15 @@ public class AppDetails extends AppCompatActivity {
|
|||||||
myAppObserver);
|
myAppObserver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
App newApp = AppProvider.Helper.findHighestPriorityMetadata(getContentResolver(), app.packageName);
|
||||||
|
if (newApp.isInstalled() != app.isInstalled()) {
|
||||||
|
setApp(newApp);
|
||||||
|
}
|
||||||
|
super.onResume();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResumeFragments() {
|
protected void onResumeFragments() {
|
||||||
// Must be called before super.onResumeFragments(), as the fragments depend on the active
|
// Must be called before super.onResumeFragments(), as the fragments depend on the active
|
||||||
|
Loading…
x
Reference in New Issue
Block a user