Wi-Fi Calling settings UI update

Bug: 28404126
Change-Id: Id9c44c0b97d2ef81502a65e9238e47656068db50
This commit is contained in:
Meng Wang
2016-06-02 17:06:22 -07:00
parent e8fce6d433
commit 0dc4311333
3 changed files with 13 additions and 2 deletions

View File

@@ -1984,6 +1984,7 @@
<!-- Wi-Fi Calling settings. Text displayed when Wi-Fi Calling is off --> <!-- Wi-Fi Calling settings. Text displayed when Wi-Fi Calling is off -->
<string name="wifi_calling_off_explanation">When Wi-Fi calling is on, your phone can route calls via Wi-Fi networks or your carrier\u2019s network, depending on your preference and which signal is stronger. Before turning on this feature, check with your carrier regarding fees and other details.</string> <string name="wifi_calling_off_explanation">When Wi-Fi calling is on, your phone can route calls via Wi-Fi networks or your carrier\u2019s network, depending on your preference and which signal is stronger. Before turning on this feature, check with your carrier regarding fees and other details.</string>
<string name="emergency_address_title">Update Emergency Address</string> <string name="emergency_address_title">Update Emergency Address</string>
<string name="emergency_address_summary">Address used by emergency services as your location if you make a 911 call using WiFi</string>
<!-- Sound and alerts settings --> <!-- Sound and alerts settings -->

View File

@@ -29,7 +29,7 @@
<Preference <Preference
android:key="emergency_address_key" android:key="emergency_address_key"
android:title="@string/emergency_address_title" android:title="@string/emergency_address_title"
android:summary="@string/emergency_address_title"> android:summary="@string/emergency_address_summary">
</Preference> </Preference>
</PreferenceScreen> </PreferenceScreen>

View File

@@ -60,10 +60,16 @@ public class WifiCallingSettings extends SettingsPreferenceFragment
private static final int REQUEST_CHECK_WFC_EMERGENCY_ADDRESS = 1; private static final int REQUEST_CHECK_WFC_EMERGENCY_ADDRESS = 1;
public static final String EXTRA_LAUNCH_CARRIER_APP = "EXTRA_LAUNCH_CARRIER_APP";
public static final int LAUCH_APP_ACTIVATE = 0;
public static final int LAUCH_APP_UPDATE = 1;
//UI objects //UI objects
private SwitchBar mSwitchBar; private SwitchBar mSwitchBar;
private Switch mSwitch; private Switch mSwitch;
private ListPreference mButtonWfcMode; private ListPreference mButtonWfcMode;
private Preference mUpdateAddress;
private TextView mEmptyView; private TextView mEmptyView;
private boolean mValidListener = false; private boolean mValidListener = false;
@@ -106,6 +112,7 @@ public class WifiCallingSettings extends SettingsPreferenceFragment
final Context context = getActivity(); final Context context = getActivity();
Intent carrierAppIntent = getCarrierActivityIntent(context); Intent carrierAppIntent = getCarrierActivityIntent(context);
if (carrierAppIntent != null) { if (carrierAppIntent != null) {
carrierAppIntent.putExtra(EXTRA_LAUNCH_CARRIER_APP, LAUCH_APP_UPDATE);
startActivity(carrierAppIntent); startActivity(carrierAppIntent);
} }
return true; return true;
@@ -185,7 +192,7 @@ public class WifiCallingSettings extends SettingsPreferenceFragment
mButtonWfcMode = (ListPreference) findPreference(BUTTON_WFC_MODE); mButtonWfcMode = (ListPreference) findPreference(BUTTON_WFC_MODE);
mButtonWfcMode.setOnPreferenceChangeListener(this); mButtonWfcMode.setOnPreferenceChangeListener(this);
Preference mUpdateAddress = (Preference) findPreference(PREFERENCE_EMERGENCY_ADDRESS); mUpdateAddress = (Preference) findPreference(PREFERENCE_EMERGENCY_ADDRESS);
mUpdateAddress.setOnPreferenceClickListener(mUpdateAddressListener); mUpdateAddress.setOnPreferenceClickListener(mUpdateAddressListener);
mIntentFilter = new IntentFilter(); mIntentFilter = new IntentFilter();
@@ -274,6 +281,7 @@ public class WifiCallingSettings extends SettingsPreferenceFragment
// Call address management activity before turning on WFC // Call address management activity before turning on WFC
Intent carrierAppIntent = getCarrierActivityIntent(context); Intent carrierAppIntent = getCarrierActivityIntent(context);
if (carrierAppIntent != null) { if (carrierAppIntent != null) {
carrierAppIntent.putExtra(EXTRA_LAUNCH_CARRIER_APP, LAUCH_APP_ACTIVATE);
startActivityForResult(carrierAppIntent, REQUEST_CHECK_WFC_EMERGENCY_ADDRESS); startActivityForResult(carrierAppIntent, REQUEST_CHECK_WFC_EMERGENCY_ADDRESS);
} else { } else {
updateWfcMode(context, true); updateWfcMode(context, true);
@@ -343,8 +351,10 @@ public class WifiCallingSettings extends SettingsPreferenceFragment
final PreferenceScreen preferenceScreen = getPreferenceScreen(); final PreferenceScreen preferenceScreen = getPreferenceScreen();
if (wfcEnabled) { if (wfcEnabled) {
preferenceScreen.addPreference(mButtonWfcMode); preferenceScreen.addPreference(mButtonWfcMode);
preferenceScreen.addPreference(mUpdateAddress);
} else { } else {
preferenceScreen.removePreference(mButtonWfcMode); preferenceScreen.removePreference(mButtonWfcMode);
preferenceScreen.removePreference(mUpdateAddress);
} }
preferenceScreen.setEnabled(mEditableWfcMode); preferenceScreen.setEnabled(mEditableWfcMode);
} }