[SIM Dialog Migration] Add SIM dialogs to support screen rotation
Adding dialog fragments to handle SIM enable, disable, rename, and erase and make dialogs persistent over screen rotation. Bug: 160819390 Test: Manually tested eSIM profile disabling. Design: https://docs.google.com/document/d/1wb5_hoBkZVbkXGNWHbx4Jf61swjfxsJzkytiTzJosYo/edit?usp=sharing Change-Id: I6b8c9a1c88eacdcbd3a5f0e466b1308ef639c225
This commit is contained in:
@@ -16,25 +16,24 @@
|
||||
|
||||
package com.android.settings.network.telephony;
|
||||
|
||||
import android.R;
|
||||
import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import android.telephony.SubscriptionManager;
|
||||
|
||||
/** The base class for subscription action dialogs */
|
||||
public class SubscriptionActionDialogActivity extends Activity {
|
||||
|
||||
private static final String TAG = "SubscriptionActionDialogActivity";
|
||||
// Arguments
|
||||
protected static final String ARG_SUB_ID = "sub_id";
|
||||
|
||||
private ProgressDialog mProgressDialog;
|
||||
private AlertDialog mErrorDialog;
|
||||
protected SubscriptionManager mSubscriptionManager;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
mSubscriptionManager = getSystemService(SubscriptionManager.class);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -43,20 +42,12 @@ public class SubscriptionActionDialogActivity extends Activity {
|
||||
* @param message The string content should be displayed in the progress dialog.
|
||||
*/
|
||||
protected void showProgressDialog(String message) {
|
||||
if (mProgressDialog == null) {
|
||||
mProgressDialog = ProgressDialog.show(this, null, message);
|
||||
mProgressDialog.setCanceledOnTouchOutside(false);
|
||||
mProgressDialog.setCancelable(false);
|
||||
}
|
||||
mProgressDialog.setMessage(message);
|
||||
mProgressDialog.show();
|
||||
ProgressDialogFragment.show(getFragmentManager(), message, null);
|
||||
}
|
||||
|
||||
/** Dismisses the loading dialog. */
|
||||
protected void dismissProgressDialog() {
|
||||
if (mProgressDialog != null) {
|
||||
mProgressDialog.dismiss();
|
||||
}
|
||||
ProgressDialogFragment.dismiss(getFragmentManager());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,31 +55,8 @@ public class SubscriptionActionDialogActivity extends Activity {
|
||||
*
|
||||
* @param title The title of the error dialog.
|
||||
* @param message The body text of the error dialog.
|
||||
* @param positiveOnClickListener The callback function after users confirm with the error.
|
||||
*/
|
||||
protected void showErrorDialog(
|
||||
String title, String message, DialogInterface.OnClickListener positiveOnClickListener) {
|
||||
if (mErrorDialog == null) {
|
||||
mErrorDialog =
|
||||
new AlertDialog.Builder(this)
|
||||
.setTitle(title)
|
||||
.setMessage(message)
|
||||
.setPositiveButton(
|
||||
R.string.ok,
|
||||
(dialog, which) -> {
|
||||
positiveOnClickListener.onClick(dialog, which);
|
||||
dismissErrorDialog();
|
||||
})
|
||||
.create();
|
||||
}
|
||||
mErrorDialog.setMessage(message);
|
||||
mErrorDialog.show();
|
||||
}
|
||||
|
||||
/** Dismisses the error dialog. */
|
||||
protected void dismissErrorDialog() {
|
||||
if (mErrorDialog != null) {
|
||||
mErrorDialog.dismiss();
|
||||
}
|
||||
protected void showErrorDialog(String title, String message) {
|
||||
AlertDialogFragment.show(this, title, message);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user