summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/DateTimeSettings.java
diff options
context:
space:
mode:
authorFreeman Ng <tenorslowworm@google.com>2011-06-02 15:44:51 -0700
committerFreeman Ng <tenorslowworm@google.com>2011-06-06 12:40:28 -0700
commit7f6f6e18c9f078323b15c8185a7e707194e7d155 (patch)
tree0b61aedc2909094c366cc7c4ba17f956d2cbf156 /src/com/android/settings/DateTimeSettings.java
parent1f7014a25aad4cd3fe5e6f34eb30d936f4da2fd4 (diff)
downloadpackages_apps_Settings-7f6f6e18c9f078323b15c8185a7e707194e7d155.zip
packages_apps_Settings-7f6f6e18c9f078323b15c8185a7e707194e7d155.tar.gz
packages_apps_Settings-7f6f6e18c9f078323b15c8185a7e707194e7d155.tar.bz2
use prefs-style layout for setup wizard date/time settings on non-xlarge screens
Adjusted the screen size test to fall back to phone version of DateTimeSettingsSetupWizard on large screens. I made the following changes from how the phone version works: 1. Some layout changes. (Tablet look, bigger margins.) 2. Use zone picker to select time zone. 3. Added isFirstRun boolean extra to hide the pref fields we don't need to see from setup wizard Furthermore, I made the following fixes to the existing phone flow (which had probably never yet been tried on a phone): 1. Added conditionals around access to some variables that only exist in the xlarge layout. 2. Implemented PreferenceFragment.OnPreferenceStartFragmentCallback in DateTimeSettingsSetupWizard in order to catch the user tapping on the timezone preference and show the time zone picker popup. (Note: for phones in ICS, we might want to launch the zone picker preferences style, like it would have been had this been a PreferenceActivity. Or maybe we should just create a separate DateTimeSettingsSetupWizardPhone activity that subclasses PreferencesActivity and doesn't need to play this trick.) Change-Id: Ib5774a005c9f44d730d86c13746d91eb712141cc
Diffstat (limited to 'src/com/android/settings/DateTimeSettings.java')
-rw-r--r--src/com/android/settings/DateTimeSettings.java18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/com/android/settings/DateTimeSettings.java b/src/com/android/settings/DateTimeSettings.java
index 64f42a0..d2c5973 100644
--- a/src/com/android/settings/DateTimeSettings.java
+++ b/src/com/android/settings/DateTimeSettings.java
@@ -60,6 +60,9 @@ public class DateTimeSettings extends SettingsPreferenceFragment
private static final int DIALOG_DATEPICKER = 0;
private static final int DIALOG_TIMEPICKER = 1;
+ // have we been launched from the setup wizard?
+ protected static final String EXTRA_IS_FIRST_RUN = "firstRun";
+
private CheckBoxPreference mAutoTimePref;
private Preference mTimePref;
private Preference mTime24Pref;
@@ -81,15 +84,18 @@ public class DateTimeSettings extends SettingsPreferenceFragment
boolean autoTimeEnabled = getAutoState(Settings.System.AUTO_TIME);
boolean autoTimeZoneEnabled = getAutoState(Settings.System.AUTO_TIME_ZONE);
+ Intent intent = getActivity().getIntent();
+ boolean isFirstRun = intent.getBooleanExtra(EXTRA_IS_FIRST_RUN, false);
+
mDummyDate = Calendar.getInstance();
mDummyDate.set(mDummyDate.get(Calendar.YEAR), 11, 31, 13, 0, 0);
mAutoTimePref = (CheckBoxPreference) findPreference(KEY_AUTO_TIME);
mAutoTimePref.setChecked(autoTimeEnabled);
mAutoTimeZonePref = (CheckBoxPreference) findPreference(KEY_AUTO_TIME_ZONE);
- // Override auto-timezone if it's a wifi-only device.
- // TODO: Remove this when auto-timezone is implemented based on wifi-location.
- if (Utils.isWifiOnly()) {
+ // 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() || isFirstRun) {
getPreferenceScreen().removePreference(mAutoTimeZonePref);
autoTimeZoneEnabled = false;
}
@@ -100,6 +106,10 @@ public class DateTimeSettings extends SettingsPreferenceFragment
mTimeZone = findPreference("timezone");
mDatePref = findPreference("date");
mDateFormat = (ListPreference) findPreference(KEY_DATE_FORMAT);
+ if (isFirstRun) {
+ getPreferenceScreen().removePreference(mTime24Pref);
+ getPreferenceScreen().removePreference(mDateFormat);
+ }
String [] dateFormats = getResources().getStringArray(R.array.date_format_values);
String [] formattedDates = new String[dateFormats.length];
@@ -158,7 +168,7 @@ public class DateTimeSettings extends SettingsPreferenceFragment
.unregisterOnSharedPreferenceChangeListener(this);
}
- private void updateTimeAndDateDisplay(Context context) {
+ public void updateTimeAndDateDisplay(Context context) {
java.text.DateFormat shortDateFormat = DateFormat.getDateFormat(context);
final Calendar now = Calendar.getInstance();
Date dummyDate = mDummyDate.getTime();