Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.

Commit

Permalink
Better/fixed main list refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
M66B committed Aug 30, 2014
1 parent 9de1990 commit 58c9831
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
23 changes: 13 additions & 10 deletions src/biz/bokhorst/xprivacy/ActivityMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ public class ActivityMain extends ActivityBase implements OnItemSelectedListener
private static final int ERROR_INVALID_PACKAGE_NAME = 0x102;
private static final int ERROR_NON_MATCHING_UID = 0x103;

public static final String cRefreshUI = "RefreshUI";
public static final String cAction = "Action";
public static final int cActionRefresh = 1;

public static final Uri cProUri = Uri.parse("http://www.xprivacy.eu/");

Expand Down Expand Up @@ -327,17 +328,19 @@ protected void onResume() {

@Override
protected void onNewIntent(Intent intent) {
// Refresh application list
if (mAppAdapter != null)
mAppAdapter.notifyDataSetChanged();

// Import pro license
if (Intent.ACTION_VIEW.equals(intent.getAction()))
Util.importProLicense(new File(intent.getData().getPath()));

// Handle clear XPrivacy data (needs UI refresh)
if (intent.hasExtra(cRefreshUI))
Bundle extras = intent.getExtras();
if (extras != null && extras.containsKey(cAction) && extras.getInt(cAction) == cActionRefresh)
recreate();
else {
// Refresh application list
if (mAppAdapter != null)
mAppAdapter.notifyDataSetChanged();

// Import pro license
if (Intent.ACTION_VIEW.equals(intent.getAction()))
Util.importProLicense(new File(intent.getData().getPath()));
}
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/biz/bokhorst/xprivacy/ActivitySettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,7 @@ public void onClick(DialogInterface dialog, int which) {

// Refresh main UI
Intent intent = new Intent(ActivitySettings.this, ActivityMain.class);
intent.putExtra(ActivityMain.cAction, ActivityMain.cActionRefresh);
startActivity(intent);
}
});
Expand Down Expand Up @@ -723,7 +724,6 @@ private void optionSave() {
// Refresh view
if (uid == userId) {
Intent intent = new Intent(ActivitySettings.this, ActivityMain.class);
intent.putExtra(ActivityMain.cRefreshUI, true);
startActivity(intent);
} else {
Intent intent = new Intent(ActivitySettings.this, ActivityApp.class);
Expand Down

0 comments on commit 58c9831

Please sign in to comment.