diff options
author | Robert Greenwalt <rgreenwalt@google.com> | 2013-03-17 09:31:04 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-03-17 09:31:04 -0700 |
commit | 3c8a4c3b5939bb9134900266c12f67e33919675e (patch) | |
tree | c3caccf0906eaac71121b7c3c3a996ef892a08a7 | |
parent | 474958fc670e18347b2135d0ffd118f921ad7ccb (diff) | |
parent | cd1c38cf23e640d878767e189e10dbf26b6a0141 (diff) | |
download | packages_apps_Settings-3c8a4c3b5939bb9134900266c12f67e33919675e.zip packages_apps_Settings-3c8a4c3b5939bb9134900266c12f67e33919675e.tar.gz packages_apps_Settings-3c8a4c3b5939bb9134900266c12f67e33919675e.tar.bz2 |
am cd1c38cf: am ae9ebfd1: Merge "add MVNO field for APN Editor"
* commit 'cd1c38cf23e640d878767e189e10dbf26b6a0141':
add MVNO field for APN Editor
-rw-r--r-- | res/values/arrays.xml | 23 | ||||
-rw-r--r-- | res/values/strings.xml | 4 | ||||
-rw-r--r-- | res/xml/apn_editor.xml | 13 | ||||
-rw-r--r-- | src/com/android/settings/ApnEditor.java | 50 |
4 files changed, 89 insertions, 1 deletions
diff --git a/res/values/arrays.xml b/res/values/arrays.xml index 00b07ec..1a11ebb 100644 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -547,6 +547,29 @@ <item>0</item> </string-array> + <!-- MVNO Info used in APN editor --> + <string-array name="mvno_type_entries"> + <!-- Do not translate. --> + <item>None</item> + <!-- Do not translate. --> + <item>SPN</item> + <!-- Do not translate. --> + <item>IMSI</item> + <!-- Do not translate. --> + <item>GID</item> + </string-array> + + <string-array translatable="false" name="mvno_type_values"> + <!-- Do not translate. --> + <item></item> + <!-- Do not translate. --> + <item>spn</item> + <!-- Do not translate. --> + <item>imsi</item> + <!-- Do not translate. --> + <item>gid</item> + </string-array> + <!-- Apps on SD instalaltion location options in ApplicationSettings --> <string-array name="app_install_location_entries"> <item>Internal device storage</item> diff --git a/res/values/strings.xml b/res/values/strings.xml index 921b9e5..1e19d28 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -2121,6 +2121,10 @@ <string name="carrier_enabled_summaryOff">APN disabled</string> <!-- Edit Beaerer Info of APN --> <string name="bearer">Bearer</string> + <!-- Edit Mvno Type Info of APN --> + <string name="mvno_type">MVNO type</string> + <!-- Edit Mvno Match Data Info of APN --> + <string name="mvno_match_data">MVNO value</string> <!-- Edit access point screen menu option to delete this APN --> <string name="menu_delete">Delete APN</string> <!-- APNs screen menu option to create a brand spanking new APN --> diff --git a/res/xml/apn_editor.xml b/res/xml/apn_editor.xml index 604a349..745a83e 100644 --- a/res/xml/apn_editor.xml +++ b/res/xml/apn_editor.xml @@ -141,4 +141,17 @@ android:entries="@array/bearer_entries" android:entryValues="@array/bearer_values" /> + <ListPreference + android:title="@string/mvno_type" + android:key="mvno_type" + android:entries="@array/mvno_type_entries" + android:entryValues="@array/mvno_type_values" + /> + <EditTextPreference + android:title="@string/mvno_match_data" + android:dialogTitle="@string/mvno_match_data" + android:key="mvno_match_data" + android:singleLine="true" + android:inputType="text" + /> </PreferenceScreen> diff --git a/src/com/android/settings/ApnEditor.java b/src/com/android/settings/ApnEditor.java index 79b6d15..f34abfa 100644 --- a/src/com/android/settings/ApnEditor.java +++ b/src/com/android/settings/ApnEditor.java @@ -57,6 +57,7 @@ public class ApnEditor extends PreferenceActivity private final static String KEY_ROAMING_PROTOCOL = "apn_roaming_protocol"; private final static String KEY_CARRIER_ENABLED = "carrier_enabled"; private final static String KEY_BEARER = "bearer"; + private final static String KEY_MVNO_TYPE = "mvno_type"; private static final int MENU_DELETE = Menu.FIRST; private static final int MENU_SAVE = Menu.FIRST + 1; @@ -82,6 +83,8 @@ public class ApnEditor extends PreferenceActivity private ListPreference mRoamingProtocol; private CheckBoxPreference mCarrierEnabled; private ListPreference mBearer; + private ListPreference mMvnoType; + private EditTextPreference mMvnoMatchData; private String mCurMnc; private String mCurMcc; @@ -115,7 +118,9 @@ public class ApnEditor extends PreferenceActivity Telephony.Carriers.PROTOCOL, // 16 Telephony.Carriers.CARRIER_ENABLED, // 17 Telephony.Carriers.BEARER, // 18 - Telephony.Carriers.ROAMING_PROTOCOL // 19 + Telephony.Carriers.ROAMING_PROTOCOL, // 19 + Telephony.Carriers.MVNO_TYPE, // 20 + Telephony.Carriers.MVNO_MATCH_DATA // 21 }; private static final int ID_INDEX = 0; @@ -137,6 +142,8 @@ public class ApnEditor extends PreferenceActivity private static final int CARRIER_ENABLED_INDEX = 17; private static final int BEARER_INDEX = 18; private static final int ROAMING_PROTOCOL_INDEX = 19; + private static final int MVNO_TYPE_INDEX = 20; + private static final int MVNO_MATCH_DATA_INDEX = 21; @Override @@ -174,6 +181,10 @@ public class ApnEditor extends PreferenceActivity mBearer = (ListPreference) findPreference(KEY_BEARER); mBearer.setOnPreferenceChangeListener(this); + mMvnoType = (ListPreference) findPreference(KEY_MVNO_TYPE); + mMvnoType.setOnPreferenceChangeListener(this); + mMvnoMatchData = (EditTextPreference) findPreference("mvno_match_data"); + mRes = getResources(); final Intent intent = getIntent(); @@ -274,6 +285,9 @@ public class ApnEditor extends PreferenceActivity mRoamingProtocol.setValue(mCursor.getString(ROAMING_PROTOCOL_INDEX)); mCarrierEnabled.setChecked(mCursor.getInt(CARRIER_ENABLED_INDEX)==1); mBearer.setValue(mCursor.getString(BEARER_INDEX)); + mMvnoType.setValue(mCursor.getString(MVNO_TYPE_INDEX)); + mMvnoMatchData.setEnabled(false); + mMvnoMatchData.setText(mCursor.getString(MVNO_MATCH_DATA_INDEX)); } mName.setSummary(checkNull(mName.getText())); @@ -307,6 +321,9 @@ public class ApnEditor extends PreferenceActivity checkNull(protocolDescription(mRoamingProtocol.getValue(), mRoamingProtocol))); mBearer.setSummary( checkNull(bearerDescription(mBearer.getValue()))); + mMvnoType.setSummary( + checkNull(mvnoDescription(mMvnoType.getValue()))); + mMvnoMatchData.setSummary(checkNull(mMvnoMatchData.getText())); } /** @@ -342,6 +359,27 @@ public class ApnEditor extends PreferenceActivity } } + private String mvnoDescription(String raw) { + int mvnoIndex = mMvnoType.findIndexOfValue(raw); + if (mvnoIndex == -1) { + return null; + } else { + String[] values = mRes.getStringArray(R.array.mvno_type_entries); + if (values[mvnoIndex].equals("None")) { + mMvnoMatchData.setEnabled(false); + mMvnoMatchData.setText(""); + } else { + mMvnoMatchData.setEnabled(true); + } + + try { + return values[mvnoIndex]; + } catch (ArrayIndexOutOfBoundsException e) { + return null; + } + } + } + public boolean onPreferenceChange(Preference preference, Object newValue) { String key = preference.getKey(); if (KEY_AUTH_TYPE.equals(key)) { @@ -375,6 +413,13 @@ public class ApnEditor extends PreferenceActivity } mBearer.setValue((String) newValue); mBearer.setSummary(bearer); + } else if (KEY_MVNO_TYPE.equals(key)) { + String mvno = mvnoDescription((String) newValue); + if (mvno == null) { + return false; + } + mMvnoType.setValue((String) newValue); + mMvnoType.setSummary(mvno); } return true; @@ -508,6 +553,9 @@ public class ApnEditor extends PreferenceActivity values.put(Telephony.Carriers.BEARER, Integer.parseInt(bearerVal)); } + values.put(Telephony.Carriers.MVNO_TYPE, checkNotSet(mMvnoType.getValue())); + values.put(Telephony.Carriers.MVNO_MATCH_DATA, checkNotSet(mMvnoMatchData.getText())); + getContentResolver().update(mUri, values, null, null); return true; |