• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2020 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.settings.network.telephony;
18 
19 import android.app.Activity;
20 import android.os.Bundle;
21 import android.telephony.SubscriptionManager;
22 
23 /** The base class for subscription action dialogs */
24 public class SubscriptionActionDialogActivity extends Activity {
25 
26     private static final String TAG = "SubscriptionActionDialogActivity";
27     // Arguments
28     protected static final String ARG_SUB_ID = "sub_id";
29 
30     protected SubscriptionManager mSubscriptionManager;
31 
32     @Override
onCreate(Bundle savedInstanceState)33     protected void onCreate(Bundle savedInstanceState) {
34         super.onCreate(savedInstanceState);
35 
36         mSubscriptionManager = getSystemService(SubscriptionManager.class);
37     }
38 
39     /**
40      * Displays a loading dialog.
41      *
42      * @param message The string content should be displayed in the progress dialog.
43      */
showProgressDialog(String message)44     protected void showProgressDialog(String message) {
45         ProgressDialogFragment.show(getFragmentManager(), message, null);
46     }
47 
48     /** Dismisses the loading dialog. */
dismissProgressDialog()49     protected void dismissProgressDialog() {
50         ProgressDialogFragment.dismiss(getFragmentManager());
51     }
52 
53     /**
54      * Displays an error dialog to indicate the subscription action failure.
55      *
56      * @param title The title of the error dialog.
57      * @param message The body text of the error dialog.
58      */
showErrorDialog(String title, String message)59     protected void showErrorDialog(String title, String message) {
60         AlertDialogFragment.show(this, title, message);
61     }
62 }
63