Fix data usage settings button visibility.

Also check that fragment is attached before launching intent.

Bug: 6385040
Change-Id: If857758acbf6fe17c8ffbd75226114346ffe6c62
This commit is contained in:
Jeff Sharkey
2012-04-24 11:35:43 -07:00
parent c1da7b105a
commit d92e0419b1

View File

@@ -781,6 +781,7 @@ public class DataUsageSummary extends Fragment {
final boolean matchFound = pm.resolveActivity(mAppSettingsIntent, 0) != null; final boolean matchFound = pm.resolveActivity(mAppSettingsIntent, 0) != null;
mAppSettings.setEnabled(matchFound); mAppSettings.setEnabled(matchFound);
mAppSettings.setVisibility(View.VISIBLE);
} else { } else {
mAppSettingsIntent = null; mAppSettingsIntent = null;
@@ -1047,6 +1048,8 @@ public class DataUsageSummary extends Fragment {
private OnClickListener mAppSettingsListener = new OnClickListener() { private OnClickListener mAppSettingsListener = new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (!isAdded()) return;
// TODO: target torwards entire UID instead of just first package // TODO: target torwards entire UID instead of just first package
startActivity(mAppSettingsIntent); startActivity(mAppSettingsIntent);
} }