Loading src/com/android/settings/sim/MultiSimEnablerPreference.java +24 −3 Original line number Diff line number Diff line Loading @@ -41,9 +41,12 @@ import android.content.DialogInterface; import android.content.Intent; import android.content.IntentFilter; import android.content.res.Resources; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.os.Handler; import android.os.Message; import android.preference.Preference; import android.preference.PreferenceManager; import android.provider.Settings; import android.telephony.ServiceState; import android.telephony.SubscriptionManager; Loading @@ -53,6 +56,7 @@ import android.text.TextUtils; import android.util.AttributeSet; import android.util.Log; import android.view.View; import android.widget.AdapterView; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.EditText; Loading Loading @@ -88,6 +92,8 @@ public class MultiSimEnablerPreference extends Preference implements OnCheckedCh private static final int RESULT_ALERT_DLG_ID = 3; private static final int SIM_ID[] = {1, 2}; private static final String DISPLAY_NUMBERS_TYPE = "display_numbers_type"; private int mSlotId; private SubscriptionInfo mSir; private boolean mCurrentState; Loading Loading @@ -526,6 +532,23 @@ public class MultiSimEnablerPreference extends Preference implements OnCheckedCh TextView carrierView = (TextView)dialogLayout.findViewById(R.id.carrier); carrierView.setText(getNetOperatorName()); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext); final Editor editor = prefs.edit(); Spinner displayNumbers = (Spinner)dialogLayout.findViewById(R.id.display_numbers); displayNumbers.setSelection(prefs.getInt(DISPLAY_NUMBERS_TYPE, 0)); displayNumbers.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { editor.putInt(DISPLAY_NUMBERS_TYPE, position); } @Override public void onNothingSelected(AdapterView<?> arg0) { // do nothing } }); final Resources res = mContext.getResources(); builder.setTitle(res.getString(R.string.sim_editor_title, mSlotId + 1)); Loading @@ -533,14 +556,12 @@ public class MultiSimEnablerPreference extends Preference implements OnCheckedCh @Override public void onClick(DialogInterface dialog, int whichButton) { final EditText nameText = (EditText)dialogLayout.findViewById(R.id.sim_name); final Spinner displayNumbers = (Spinner)dialogLayout.findViewById(R.id.display_numbers); mSir.setDisplayName(nameText.getText()); SubscriptionManager.from(mContext).setDisplayName(mSir.getDisplayName().toString(), mSir.getSubscriptionId(), SubscriptionManager.NAME_SOURCE_USER_INPUT); update(); editor.commit(); } }); Loading src/com/android/settings/sim/SimSettings.java +22 −3 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ import android.content.ContentUris; import android.content.Intent; import android.content.IntentFilter; import android.content.res.Resources; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.content.DialogInterface; import android.database.Cursor; import android.net.Uri; Loading @@ -32,6 +34,7 @@ import android.os.Message; import android.os.SystemProperties; import android.preference.Preference; import android.preference.PreferenceCategory; import android.preference.PreferenceManager; import android.preference.PreferenceScreen; import android.provider.SearchIndexableResource; import android.provider.Settings.SettingNotFoundException; Loading Loading @@ -89,6 +92,7 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable private static final String KEY_ACTIVITIES = "activities"; private static final String KEY_PRIMARY_SUB_SELECT = "select_primary_sub"; private static final String SETTING_USER_PREF_DATA_SUB = "user_preferred_data_sub"; private static final String DISPLAY_NUMBERS_TYPE = "display_numbers_type"; private int mPreferredDataSubscription; Loading Loading @@ -665,6 +669,23 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable TextView carrierView = (TextView)dialogLayout.findViewById(R.id.carrier); carrierView.setText(mSubscriptionInfo.getDisplayName()); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); final Editor editor = prefs.edit(); Spinner displayNumbers = (Spinner)dialogLayout.findViewById(R.id.display_numbers); displayNumbers.setSelection(prefs.getInt(DISPLAY_NUMBERS_TYPE, 0)); displayNumbers.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { editor.putInt(DISPLAY_NUMBERS_TYPE, position); } @Override public void onNothingSelected(AdapterView<?> arg0) { // do nothing } }); final Resources res = getResources(); builder.setTitle(res.getString(R.string.sim_editor_title, mSlotId + 1)); Loading @@ -672,9 +693,6 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable @Override public void onClick(DialogInterface dialog, int whichButton) { final EditText nameText = (EditText)dialogLayout.findViewById(R.id.sim_name); final Spinner displayNumbers = (Spinner)dialogLayout.findViewById(R.id.display_numbers); mSubscriptionInfo.setDisplayName(nameText.getText()); SubscriptionManager.from(getActivity()).setDisplayName( mSubscriptionInfo.getDisplayName().toString(), Loading @@ -683,6 +701,7 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable updateAllOptions(); update(); editor.commit(); } }); Loading Loading
src/com/android/settings/sim/MultiSimEnablerPreference.java +24 −3 Original line number Diff line number Diff line Loading @@ -41,9 +41,12 @@ import android.content.DialogInterface; import android.content.Intent; import android.content.IntentFilter; import android.content.res.Resources; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.os.Handler; import android.os.Message; import android.preference.Preference; import android.preference.PreferenceManager; import android.provider.Settings; import android.telephony.ServiceState; import android.telephony.SubscriptionManager; Loading @@ -53,6 +56,7 @@ import android.text.TextUtils; import android.util.AttributeSet; import android.util.Log; import android.view.View; import android.widget.AdapterView; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.EditText; Loading Loading @@ -88,6 +92,8 @@ public class MultiSimEnablerPreference extends Preference implements OnCheckedCh private static final int RESULT_ALERT_DLG_ID = 3; private static final int SIM_ID[] = {1, 2}; private static final String DISPLAY_NUMBERS_TYPE = "display_numbers_type"; private int mSlotId; private SubscriptionInfo mSir; private boolean mCurrentState; Loading Loading @@ -526,6 +532,23 @@ public class MultiSimEnablerPreference extends Preference implements OnCheckedCh TextView carrierView = (TextView)dialogLayout.findViewById(R.id.carrier); carrierView.setText(getNetOperatorName()); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext); final Editor editor = prefs.edit(); Spinner displayNumbers = (Spinner)dialogLayout.findViewById(R.id.display_numbers); displayNumbers.setSelection(prefs.getInt(DISPLAY_NUMBERS_TYPE, 0)); displayNumbers.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { editor.putInt(DISPLAY_NUMBERS_TYPE, position); } @Override public void onNothingSelected(AdapterView<?> arg0) { // do nothing } }); final Resources res = mContext.getResources(); builder.setTitle(res.getString(R.string.sim_editor_title, mSlotId + 1)); Loading @@ -533,14 +556,12 @@ public class MultiSimEnablerPreference extends Preference implements OnCheckedCh @Override public void onClick(DialogInterface dialog, int whichButton) { final EditText nameText = (EditText)dialogLayout.findViewById(R.id.sim_name); final Spinner displayNumbers = (Spinner)dialogLayout.findViewById(R.id.display_numbers); mSir.setDisplayName(nameText.getText()); SubscriptionManager.from(mContext).setDisplayName(mSir.getDisplayName().toString(), mSir.getSubscriptionId(), SubscriptionManager.NAME_SOURCE_USER_INPUT); update(); editor.commit(); } }); Loading
src/com/android/settings/sim/SimSettings.java +22 −3 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ import android.content.ContentUris; import android.content.Intent; import android.content.IntentFilter; import android.content.res.Resources; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.content.DialogInterface; import android.database.Cursor; import android.net.Uri; Loading @@ -32,6 +34,7 @@ import android.os.Message; import android.os.SystemProperties; import android.preference.Preference; import android.preference.PreferenceCategory; import android.preference.PreferenceManager; import android.preference.PreferenceScreen; import android.provider.SearchIndexableResource; import android.provider.Settings.SettingNotFoundException; Loading Loading @@ -89,6 +92,7 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable private static final String KEY_ACTIVITIES = "activities"; private static final String KEY_PRIMARY_SUB_SELECT = "select_primary_sub"; private static final String SETTING_USER_PREF_DATA_SUB = "user_preferred_data_sub"; private static final String DISPLAY_NUMBERS_TYPE = "display_numbers_type"; private int mPreferredDataSubscription; Loading Loading @@ -665,6 +669,23 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable TextView carrierView = (TextView)dialogLayout.findViewById(R.id.carrier); carrierView.setText(mSubscriptionInfo.getDisplayName()); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); final Editor editor = prefs.edit(); Spinner displayNumbers = (Spinner)dialogLayout.findViewById(R.id.display_numbers); displayNumbers.setSelection(prefs.getInt(DISPLAY_NUMBERS_TYPE, 0)); displayNumbers.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { editor.putInt(DISPLAY_NUMBERS_TYPE, position); } @Override public void onNothingSelected(AdapterView<?> arg0) { // do nothing } }); final Resources res = getResources(); builder.setTitle(res.getString(R.string.sim_editor_title, mSlotId + 1)); Loading @@ -672,9 +693,6 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable @Override public void onClick(DialogInterface dialog, int whichButton) { final EditText nameText = (EditText)dialogLayout.findViewById(R.id.sim_name); final Spinner displayNumbers = (Spinner)dialogLayout.findViewById(R.id.display_numbers); mSubscriptionInfo.setDisplayName(nameText.getText()); SubscriptionManager.from(getActivity()).setDisplayName( mSubscriptionInfo.getDisplayName().toString(), Loading @@ -683,6 +701,7 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable updateAllOptions(); update(); editor.commit(); } }); Loading