Update Wi-Fi Calling settings

- Update strings
- Move WFC mode summary strings to framework/base
- Update screens to reflect latest UX requirements

Change-Id: Ibcb1a0b6eec2342dfbaa30f90fe728976ad80a0d
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1dafbeb..09ba335 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1887,7 +1887,7 @@
     <!-- Wireless networks, item title to go into the WFC settings [CHAR LIMIT=30] -->
     <string name="wifi_calling_settings_title">Wi-Fi calling</string>
     <!-- WFC mode [CHAR LIMIT=30] -->
-    <string name="wifi_calling_mode_title">Wi-Fi calling mode</string>
+    <string name="wifi_calling_mode_title">Calling preference</string>
     <!-- WFC mode dialog [CHAR LIMIT=30] -->
     <string name="wifi_calling_mode_dialog_title">Wi-Fi calling mode</string>
     <string-array name="wifi_calling_mode_choices">
@@ -1900,14 +1900,8 @@
         <item>"1"</item>
         <item>"0"</item>
     </string-array>
-    <!-- WFC, summary for Disabled [CHAR LIMIT=100] -->
-    <string name="wifi_calling_off_summary">Off</string>
-    <!-- WFC, summary for Wi-Fi Preferred [CHAR LIMIT=100] -->
-    <string name="wfc_mode_wifi_preferred_summary">Wi-Fi preferred (Uses cell network only if Wi-Fi isn\'t available)</string>
-    <!-- WFC, summary for Cellular Preferred [CHAR LIMIT=100] -->
-    <string name="wfc_mode_cellular_preferred_summary">Cellular preferred (Uses Wi-Fi only if cell network isn\'t available)</string>
-    <!-- WFC, summary for Wi-Fi Only [CHAR LIMIT=100] -->
-    <string name="wfc_mode_wifi_only_summary">Wi-Fi only (Never uses cell network. Can\'t make or receive calls if Wi-Fi isn\'t available)</string>
+    <!-- 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\'s 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>
 
     <!-- Sound and alerts settings -->
     <skip/>
diff --git a/res/xml/wireless_settings.xml b/res/xml/wireless_settings.xml
index 7a4ed9a..b615c9e 100644
--- a/res/xml/wireless_settings.xml
+++ b/res/xml/wireless_settings.xml
@@ -38,6 +38,12 @@
         android:persistent="false" />
 
     <PreferenceScreen
+        android:key="wifi_calling_settings"
+        android:title="@string/wifi_calling_settings_title"
+        settings:keywords="@string/keywords_wifi_calling"
+        android:fragment="com.android.settings.WifiCallingSettings" />
+
+    <PreferenceScreen
         android:fragment="com.android.settings.nfc.AndroidBeam"
         android:key="android_beam_settings"
         android:title="@string/android_beam_settings_title" />
@@ -63,12 +69,6 @@
             android:targetClass="com.android.phone.MobileNetworkSettings" />
     </PreferenceScreen>
 
-    <PreferenceScreen
-        android:key="wifi_calling_settings"
-        android:title="@string/wifi_calling_settings_title"
-        settings:keywords="@string/keywords_wifi_calling"
-        android:fragment="com.android.settings.WifiCallingSettings" />
-
     <Preference
         android:key="manage_mobile_plan"
         android:title="@string/manage_mobile_plan_title"
diff --git a/src/com/android/settings/WifiCallingSettings.java b/src/com/android/settings/WifiCallingSettings.java
index 8e2c7ed..5167ab0 100644
--- a/src/com/android/settings/WifiCallingSettings.java
+++ b/src/com/android/settings/WifiCallingSettings.java
@@ -25,10 +25,12 @@
 import android.os.Bundle;
 import android.preference.ListPreference;
 import android.preference.Preference;
+import android.preference.PreferenceScreen;
 import android.telephony.PhoneStateListener;
 import android.telephony.TelephonyManager;
 import android.util.Log;
 import android.widget.Switch;
+import android.widget.TextView;
 
 import com.android.ims.ImsConfig;
 import com.android.ims.ImsManager;
@@ -52,6 +54,7 @@
     private SwitchBar mSwitchBar;
     private Switch mSwitch;
     private ListPreference mButtonWfcMode;
+    private TextView mEmptyView;
 
     private final PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
         /*
@@ -89,6 +92,10 @@
         mSwitchBar = activity.getSwitchBar();
         mSwitch = mSwitchBar.getSwitch();
         mSwitchBar.show();
+
+        mEmptyView = (TextView) getView().findViewById(android.R.id.empty);
+        getListView().setEmptyView(mEmptyView);
+        mEmptyView.setText(R.string.wifi_calling_off_explanation);
     }
 
     @Override
@@ -106,7 +113,7 @@
         AlertDialog.Builder builder = new AlertDialog.Builder(context);
         builder.setMessage(message)
                 .setTitle(title)
-                .setIcon(android.R.drawable.stat_sys_warning)
+                .setIcon(android.R.drawable.ic_dialog_alert)
                 .setPositiveButton(android.R.string.ok, null);
         AlertDialog dialog = builder.create();
         dialog.show();
@@ -206,6 +213,13 @@
         int wfcMode = ImsManager.getWfcMode(context);
         mButtonWfcMode.setSummary(getWfcModeSummary(context, wfcMode));
         mButtonWfcMode.setEnabled(isChecked);
+
+        final PreferenceScreen preferenceScreen = getPreferenceScreen();
+        if (isChecked) {
+            preferenceScreen.addPreference(mButtonWfcMode);
+        } else {
+            preferenceScreen.removePreference(mButtonWfcMode);
+        }
     }
 
     @Override
@@ -224,17 +238,17 @@
     }
 
     static int getWfcModeSummary(Context context, int wfcMode) {
-        int resId = R.string.wifi_calling_off_summary;
+        int resId = com.android.internal.R.string.wifi_calling_off_summary;
         if (ImsManager.isWfcEnabledByUser(context)) {
             switch (wfcMode) {
                 case ImsConfig.WfcModeFeatureValueConstants.WIFI_ONLY:
-                    resId = R.string.wfc_mode_wifi_only_summary;
+                    resId = com.android.internal.R.string.wfc_mode_wifi_only_summary;
                     break;
                 case ImsConfig.WfcModeFeatureValueConstants.CELLULAR_PREFERRED:
-                    resId = R.string.wfc_mode_cellular_preferred_summary;
+                    resId = com.android.internal.R.string.wfc_mode_cellular_preferred_summary;
                     break;
                 case ImsConfig.WfcModeFeatureValueConstants.WIFI_PREFERRED:
-                    resId = R.string.wfc_mode_wifi_preferred_summary;
+                    resId = com.android.internal.R.string.wfc_mode_wifi_preferred_summary;
                     break;
                 default:
                     Log.e(TAG, "Unexpected WFC mode value: " + wfcMode);