1 /* 2 * Copyright (C) 2006 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.os.Bundle; 20 import android.preference.CheckBoxPreference; 21 import android.preference.Preference; 22 import android.preference.PreferenceActivity; 23 import android.preference.PreferenceScreen; 24 import android.view.MenuItem; 25 26 import com.android.internal.telephony.Phone; 27 import com.android.internal.telephony.PhoneConstants; 28 29 public class GsmUmtsCallOptions extends PreferenceActivity { 30 private static final String LOG_TAG = "GsmUmtsCallOptions"; 31 private final boolean DBG = (PhoneGlobals.DBG_LEVEL >= 2); 32 33 private static final String CALL_FORWARDING_KEY = "call_forwarding_key"; 34 private static final String ADDITIONAL_GSM_SETTINGS_KEY = "additional_gsm_call_settings_key"; 35 36 @Override 37 protected void onCreate(Bundle icicle) { 38 super.onCreate(icicle); 39 40 addPreferencesFromResource(R.xml.gsm_umts_call_options); 41 42 SubscriptionInfoHelper subInfoHelper = new SubscriptionInfoHelper(this, getIntent()); 43 subInfoHelper.setActionBarTitle( 44 getActionBar(), getResources(), R.string.labelGsmMore_with_label); 45 init(getPreferenceScreen(), subInfoHelper); 46 47 if (subInfoHelper.getPhone().getPhoneType() != PhoneConstants.PHONE_TYPE_GSM) { 48 //disable the entire screen 49 getPreferenceScreen().setEnabled(false); 50 } 51 } 52 53 @Override 54 public boolean onOptionsItemSelected(MenuItem item) { 55 final int itemId = item.getItemId(); 56 if (itemId == android.R.id.home) { 57 onBackPressed(); 58 return true; 59 } 60 return super.onOptionsItemSelected(item); 61 } 62 63 public static void init(PreferenceScreen prefScreen, SubscriptionInfoHelper subInfoHelper) { 64 Preference callForwardingPref = prefScreen.findPreference(CALL_FORWARDING_KEY); 65 callForwardingPref.setIntent(subInfoHelper.getIntent(GsmUmtsCallForwardOptions.class)); 66 67 Preference additionalGsmSettingsPref = 68 prefScreen.findPreference(ADDITIONAL_GSM_SETTINGS_KEY); 69 additionalGsmSettingsPref.setIntent( 70 subInfoHelper.getIntent(GsmUmtsAdditionalCallOptions.class)); 71 } 72 } 73