Fix bug #15730311 Checkboxes on R side should update to Quantum/Material on/off switch

Per UX request, use a Switch for:

- Automatic date & time
- Automatic time zone
- Use 24-hour format

Change-Id: Ie35816febe2469705446fdd2c703b52ff8b0929a
diff --git a/res/xml/date_time_prefs.xml b/res/xml/date_time_prefs.xml
index 5bf3c9a..6c59ebe 100644
--- a/res/xml/date_time_prefs.xml
+++ b/res/xml/date_time_prefs.xml
@@ -19,13 +19,13 @@
         android:title="@string/date_and_time"
         settings:keywords="@string/keywords_date_and_time">
 
-    <CheckBoxPreference android:key="auto_time"
+    <SwitchPreference android:key="auto_time"
         android:title="@string/date_time_auto"
         android:summaryOn="@string/date_time_auto_summaryOn"
         android:summaryOff="@string/date_time_auto_summaryOff"
         />
 
-    <CheckBoxPreference android:key="auto_zone"
+    <SwitchPreference android:key="auto_zone"
         android:title="@string/zone_auto"
         android:summaryOn="@string/zone_auto_summaryOn"
         android:summaryOff="@string/zone_auto_summaryOff"
@@ -48,7 +48,7 @@
         android:summary="GMT-8:00"
         />
 
-    <CheckBoxPreference android:key="24 hour"
+    <SwitchPreference android:key="24 hour"
         android:title="@string/date_time_24hour"
         />
 
diff --git a/src/com/android/settings/DateTimeSettings.java b/src/com/android/settings/DateTimeSettings.java
index 8eb9c52..f34008d 100644
--- a/src/com/android/settings/DateTimeSettings.java
+++ b/src/com/android/settings/DateTimeSettings.java
@@ -29,10 +29,10 @@
 import android.content.SharedPreferences;
 import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
 import android.os.Bundle;
-import android.preference.CheckBoxPreference;
 import android.preference.ListPreference;
 import android.preference.Preference;
 import android.preference.PreferenceScreen;
+import android.preference.SwitchPreference;
 import android.provider.Settings;
 import android.provider.Settings.SettingNotFoundException;
 import android.text.BidiFormatter;
@@ -69,10 +69,10 @@
     // have we been launched from the setup wizard?
     protected static final String EXTRA_IS_FIRST_RUN = "firstRun";
 
-    private CheckBoxPreference mAutoTimePref;
+    private SwitchPreference mAutoTimePref;
     private Preference mTimePref;
     private Preference mTime24Pref;
-    private CheckBoxPreference mAutoTimeZonePref;
+    private SwitchPreference mAutoTimeZonePref;
     private Preference mTimeZone;
     private Preference mDatePref;
     private ListPreference mDateFormat;
@@ -90,7 +90,7 @@
         boolean autoTimeEnabled = getAutoState(Settings.Global.AUTO_TIME);
         boolean autoTimeZoneEnabled = getAutoState(Settings.Global.AUTO_TIME_ZONE);
 
-        mAutoTimePref = (CheckBoxPreference) findPreference(KEY_AUTO_TIME);
+        mAutoTimePref = (SwitchPreference) findPreference(KEY_AUTO_TIME);
 
         DevicePolicyManager dpm = (DevicePolicyManager) getSystemService(Context
                 .DEVICE_POLICY_SERVICE);
@@ -108,7 +108,7 @@
         mDummyDate = Calendar.getInstance();
 
         mAutoTimePref.setChecked(autoTimeEnabled);
-        mAutoTimeZonePref = (CheckBoxPreference) findPreference(KEY_AUTO_TIME_ZONE);
+        mAutoTimeZonePref = (SwitchPreference) findPreference(KEY_AUTO_TIME_ZONE);
         // Override auto-timezone if it's a wifi-only device or if we're still in setup wizard.
         // TODO: Remove the wifiOnly test when auto-timezone is implemented based on wifi-location.
         if (Utils.isWifiOnly(getActivity()) || isFirstRun) {
@@ -168,7 +168,7 @@
         getPreferenceScreen().getSharedPreferences()
                 .registerOnSharedPreferenceChangeListener(this);
 
-        ((CheckBoxPreference)mTime24Pref).setChecked(is24Hour());
+        ((SwitchPreference)mTime24Pref).setChecked(is24Hour());
 
         // Register for time ticks and other reasons for time change
         IntentFilter filter = new IntentFilter();
@@ -318,7 +318,7 @@
             removeDialog(DIALOG_TIMEPICKER);
             showDialog(DIALOG_TIMEPICKER);
         } else if (preference == mTime24Pref) {
-            final boolean is24Hour = ((CheckBoxPreference)mTime24Pref).isChecked();
+            final boolean is24Hour = ((SwitchPreference)mTime24Pref).isChecked();
             set24Hour(is24Hour);
             updateTimeAndDateDisplay(getActivity());
             timeUpdated(is24Hour);