Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2009 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 com.android.internal.telephony.Phone; |
| 20 | import com.android.internal.telephony.PhoneConstants; |
| 21 | |
| 22 | import android.content.DialogInterface; |
| 23 | import android.os.AsyncResult; |
| 24 | import android.os.Bundle; |
| 25 | import android.os.Handler; |
| 26 | import android.os.Message; |
| 27 | import android.preference.CheckBoxPreference; |
| 28 | import android.preference.Preference; |
| 29 | import android.preference.PreferenceActivity; |
| 30 | import android.preference.PreferenceScreen; |
| 31 | import android.util.Log; |
Sanket Padawe | e09a6f6 | 2015-03-05 11:59:39 -0800 | [diff] [blame^] | 32 | import android.view.MenuItem; |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 33 | |
| 34 | public class CdmaCallOptions extends PreferenceActivity { |
| 35 | private static final String LOG_TAG = "CdmaCallOptions"; |
| 36 | private final boolean DBG = (PhoneGlobals.DBG_LEVEL >= 2); |
| 37 | |
| 38 | private static final String BUTTON_VP_KEY = "button_voice_privacy_key"; |
| 39 | private CheckBoxPreference mButtonVoicePrivacy; |
| 40 | |
| 41 | @Override |
| 42 | protected void onCreate(Bundle icicle) { |
| 43 | super.onCreate(icicle); |
| 44 | |
| 45 | addPreferencesFromResource(R.xml.cdma_call_privacy); |
| 46 | |
Sanket Padawe | e09a6f6 | 2015-03-05 11:59:39 -0800 | [diff] [blame^] | 47 | SubscriptionInfoHelper subInfoHelper = new SubscriptionInfoHelper(this, getIntent()); |
| 48 | subInfoHelper.setActionBarTitle( |
| 49 | getActionBar(), getResources(), R.string.labelCdmaMore_with_label); |
| 50 | |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 51 | mButtonVoicePrivacy = (CheckBoxPreference) findPreference(BUTTON_VP_KEY); |
Sanket Padawe | e09a6f6 | 2015-03-05 11:59:39 -0800 | [diff] [blame^] | 52 | if (subInfoHelper.getPhone().getPhoneType() != PhoneConstants.PHONE_TYPE_CDMA |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 53 | || getResources().getBoolean(R.bool.config_voice_privacy_disable)) { |
| 54 | //disable the entire screen |
| 55 | getPreferenceScreen().setEnabled(false); |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | @Override |
Sanket Padawe | e09a6f6 | 2015-03-05 11:59:39 -0800 | [diff] [blame^] | 60 | public boolean onOptionsItemSelected(MenuItem item) { |
| 61 | final int itemId = item.getItemId(); |
| 62 | if (itemId == android.R.id.home) { |
| 63 | onBackPressed(); |
| 64 | return true; |
| 65 | } |
| 66 | return super.onOptionsItemSelected(item); |
| 67 | } |
| 68 | |
| 69 | @Override |
Santos Cordon | 7d4ddf6 | 2013-07-10 11:58:08 -0700 | [diff] [blame] | 70 | public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { |
| 71 | if (preference.getKey().equals(BUTTON_VP_KEY)) { |
| 72 | return true; |
| 73 | } |
| 74 | return false; |
| 75 | } |
| 76 | |
| 77 | } |