Clean up CellDataPreference dialog problems

Bug: 26830672
Change-Id: I189f8b2120143ca9829feebd24cf2ee93a33f05b
This commit is contained in:
Jason Monk
2016-01-28 12:35:31 -05:00
parent 3ba50d858a
commit d0682d0363
3 changed files with 8 additions and 5 deletions

View File

@@ -29,7 +29,8 @@ public class CustomDialogPreference extends DialogPreference {
private CustomPreferenceDialogFragment mFragment; private CustomPreferenceDialogFragment mFragment;
public CustomDialogPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { public CustomDialogPreference(Context context, AttributeSet attrs, int defStyleAttr,
int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes); super(context, attrs, defStyleAttr, defStyleRes);
} }

View File

@@ -48,7 +48,7 @@ public class CellDataPreference extends CustomDialogPreference implements Templa
private static final String TAG = "CellDataPreference"; private static final String TAG = "CellDataPreference";
public int mSubId; public int mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
public boolean mChecked; public boolean mChecked;
public boolean mMultiSimDialog; public boolean mMultiSimDialog;
private TelephonyManager mTelephonyManager; private TelephonyManager mTelephonyManager;
@@ -65,8 +65,10 @@ public class CellDataPreference extends CustomDialogPreference implements Templa
mTelephonyManager = TelephonyManager.from(getContext()); mTelephonyManager = TelephonyManager.from(getContext());
mChecked = state.mChecked; mChecked = state.mChecked;
mMultiSimDialog = state.mMultiSimDialog; mMultiSimDialog = state.mMultiSimDialog;
mSubId = state.mSubId; if (mSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
setKey(getKey() + mSubId); mSubId = state.mSubId;
setKey(getKey() + mSubId);
}
notifyChanged(); notifyChanged();
} }
@@ -110,7 +112,6 @@ public class CellDataPreference extends CustomDialogPreference implements Templa
@Override @Override
protected void performClick(View view) { protected void performClick(View view) {
super.performClick(view);
MetricsLogger.action(getContext(), MetricsEvent.ACTION_CELL_DATA_TOGGLE, !mChecked); MetricsLogger.action(getContext(), MetricsEvent.ACTION_CELL_DATA_TOGGLE, !mChecked);
if (mChecked) { if (mChecked) {
// disabling data; show confirmation dialog which eventually // disabling data; show confirmation dialog which eventually

View File

@@ -138,6 +138,7 @@ public class DataUsageSummary extends DataUsageBase implements Indexable {
TemplatePreferenceCategory category = (TemplatePreferenceCategory) TemplatePreferenceCategory category = (TemplatePreferenceCategory)
inflatePreferences(R.xml.data_usage_cellular); inflatePreferences(R.xml.data_usage_cellular);
category.setTemplate(getNetworkTemplate(subId), subId, services); category.setTemplate(getNetworkTemplate(subId), subId, services);
category.pushTemplates(services);
} }
private void addWifiSection() { private void addWifiSection() {