1 /*
2  * Copyright (C) 2018 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.phone;
18 
19 import android.content.Context;
20 import android.os.Bundle;
21 import android.util.AttributeSet;
22 import android.view.View;
23 import android.widget.EditText;
24 
25 import com.android.phone.settings.fdn.EditPinPreference;
26 
27 /**
28  * This preference represents the status of disable all barring option.
29  */
30 public class CallBarringDeselectAllPreference extends EditPinPreference {
31     private static final String LOG_TAG = "CallBarringDeselectAllPreference";
32     private static final boolean DBG = (PhoneGlobals.DBG_LEVEL >= 2);
33 
34     /**
35      * CallBarringDeselectAllPreference constructor.
36      *
37      * @param context The context of view.
38      * @param attrs The attributes of the XML tag that is inflating EditTextPreference.
39      */
CallBarringDeselectAllPreference(Context context, AttributeSet attrs)40     public CallBarringDeselectAllPreference(Context context, AttributeSet attrs) {
41         super(context, attrs);
42     }
43 
44     @Override
showDialog(Bundle state)45     protected void showDialog(Bundle state) {
46         setDialogMessage(getContext().getString(R.string.messageCallBarring));
47         super.showDialog(state);
48     }
49 
50     @Override
onBindDialogView(View view)51     protected void onBindDialogView(View view) {
52         super.onBindDialogView(view);
53 
54         final EditText editText = (EditText) view.findViewById(android.R.id.edit);
55         if (editText != null) {
56             // Hide the input-text-line if the password is not shown.
57             editText.setVisibility(View.VISIBLE);
58         }
59     }
60 }
61