Merge branch 'refresh_header_161' into 'master'

Refresh AppDetails header on package state change (fix #161)

Update the application details to display the correct state on
application install/uninstall.

Should fix issue #161
https://gitlab.com/fdroid/fdroidclient/issues/161

See merge request !56
This commit is contained in:
Peter Serwylo 2015-03-13 14:03:25 +00:00
commit 09029dd193
2 changed files with 13 additions and 1 deletions

View File

@ -22,7 +22,7 @@
<fragment
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/landscape_header"
android:id="@+id/header"
android:name="org.fdroid.fdroid.AppDetails$AppDetailsHeaderFragment"
tools:layout="@layout/app_details_header"/>

View File

@ -491,6 +491,7 @@ public class AppDetails extends ActionBarActivity implements ProgressListener, A
protected void onResumeFragments() {
super.onResumeFragments();
refreshApkList();
refreshHeader();
supportInvalidateOptionsMenu();
}
@ -544,6 +545,7 @@ public class AppDetails extends ActionBarActivity implements ProgressListener, A
}
refreshApkList();
refreshHeader();
supportInvalidateOptionsMenu();
}
@ -643,6 +645,12 @@ public class AppDetails extends ActionBarActivity implements ProgressListener, A
adapter.notifyDataSetChanged();
}
private void refreshHeader() {
AppDetailsHeaderFragment headerFragment = (AppDetailsHeaderFragment)
getSupportFragmentManager().findFragmentById(R.id.header);
headerFragment.refresh();
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
@ -1347,6 +1355,10 @@ public class AppDetails extends ActionBarActivity implements ProgressListener, A
@Override
public void onResume() {
super.onResume();
refresh();
}
public void refresh() {
updateViews(getView());
}