Merge "Store whether the Dialog was previously dismissed" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
0c28e9dca7
@@ -23,6 +23,7 @@ import android.content.DialogInterface;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.telephony.SubscriptionInfo;
|
import android.telephony.SubscriptionInfo;
|
||||||
import android.telephony.SubscriptionManager;
|
import android.telephony.SubscriptionManager;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
@@ -81,7 +82,12 @@ public class PreferredSimDialogFragment extends SimDialogFragment implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateDialog(AlertDialog dialog) {
|
private void updateDialog(AlertDialog dialog) {
|
||||||
|
Log.d(TAG, "Dialog updated, dismiss status: " + mWasDismissed);
|
||||||
|
|
||||||
final SubscriptionInfo info = getPreferredSubscription();
|
final SubscriptionInfo info = getPreferredSubscription();
|
||||||
|
if (mWasDismissed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
dismiss();
|
dismiss();
|
||||||
return;
|
return;
|
||||||
|
@@ -19,6 +19,7 @@ package com.android.settings.sim;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
@@ -34,6 +35,7 @@ public abstract class SimDialogFragment extends InstrumentedDialogFragment imple
|
|||||||
private static final String KEY_DIALOG_TYPE = "dialog_type";
|
private static final String KEY_DIALOG_TYPE = "dialog_type";
|
||||||
|
|
||||||
private SubscriptionsChangeListener mChangeListener;
|
private SubscriptionsChangeListener mChangeListener;
|
||||||
|
protected boolean mWasDismissed = false;
|
||||||
|
|
||||||
protected static Bundle initArguments(int dialogType, int titleResId) {
|
protected static Bundle initArguments(int dialogType, int titleResId) {
|
||||||
final Bundle args = new Bundle();
|
final Bundle args = new Bundle();
|
||||||
@@ -53,6 +55,8 @@ public abstract class SimDialogFragment extends InstrumentedDialogFragment imple
|
|||||||
@Override
|
@Override
|
||||||
public void onAttach(Context context) {
|
public void onAttach(Context context) {
|
||||||
super.onAttach(context);
|
super.onAttach(context);
|
||||||
|
Log.d(TAG, "Dialog Attached.");
|
||||||
|
mWasDismissed = false;
|
||||||
mChangeListener = new SubscriptionsChangeListener(context, this);
|
mChangeListener = new SubscriptionsChangeListener(context, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,6 +74,8 @@ public abstract class SimDialogFragment extends InstrumentedDialogFragment imple
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||||
|
Log.d(TAG, "Dialog Dismissed.");
|
||||||
|
mWasDismissed = true;
|
||||||
super.onDismiss(dialog);
|
super.onDismiss(dialog);
|
||||||
final SimDialogActivity activity = (SimDialogActivity) getActivity();
|
final SimDialogActivity activity = (SimDialogActivity) getActivity();
|
||||||
if (activity != null && !activity.isFinishing()) {
|
if (activity != null && !activity.isFinishing()) {
|
||||||
|
@@ -24,6 +24,7 @@ import android.os.Bundle;
|
|||||||
import android.telephony.SubscriptionInfo;
|
import android.telephony.SubscriptionInfo;
|
||||||
import android.telephony.SubscriptionManager;
|
import android.telephony.SubscriptionManager;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@@ -49,6 +50,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class SimListDialogFragment extends SimDialogFragment implements
|
public class SimListDialogFragment extends SimDialogFragment implements
|
||||||
DialogInterface.OnClickListener {
|
DialogInterface.OnClickListener {
|
||||||
|
private static final String TAG = "SimListDialogFragment";
|
||||||
protected static final String KEY_INCLUDE_ASK_EVERY_TIME = "include_ask_every_time";
|
protected static final String KEY_INCLUDE_ASK_EVERY_TIME = "include_ask_every_time";
|
||||||
|
|
||||||
protected SelectSubscriptionAdapter mAdapter;
|
protected SelectSubscriptionAdapter mAdapter;
|
||||||
@@ -101,9 +103,13 @@ public class SimListDialogFragment extends SimDialogFragment implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateDialog() {
|
public void updateDialog() {
|
||||||
|
Log.d(TAG, "Dialog updated, dismiss status: " + mWasDismissed);
|
||||||
|
|
||||||
List<SubscriptionInfo> currentSubscriptions = getCurrentSubscriptions();
|
List<SubscriptionInfo> currentSubscriptions = getCurrentSubscriptions();
|
||||||
if (currentSubscriptions == null) {
|
if (currentSubscriptions == null) {
|
||||||
dismiss();
|
if (!mWasDismissed) {
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (getArguments().getBoolean(KEY_INCLUDE_ASK_EVERY_TIME)) {
|
if (getArguments().getBoolean(KEY_INCLUDE_ASK_EVERY_TIME)) {
|
||||||
|
Reference in New Issue
Block a user