Merge "fix breakage caused by recent automerge"
diff --git a/res/layout-sw600dp/date_time_settings_setupwizard.xml b/res/layout-sw600dp/date_time_settings_setupwizard.xml
index dae03ac..e37a4a6 100644
--- a/res/layout-sw600dp/date_time_settings_setupwizard.xml
+++ b/res/layout-sw600dp/date_time_settings_setupwizard.xml
@@ -1,196 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 The Android Open Source Project
+<!-- Copyright (C) 2011 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
+ http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
- -->
-<RelativeLayout
- android:id="@+id/layout_root"
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:paddingTop="@dimen/datetime_margin_top"
- android:paddingLeft="@dimen/screen_margin_sides"
- android:paddingRight="@dimen/screen_margin_sides"
- android:paddingBottom="@dimen/datetime_margin_bottom">
+-->
- <!-- Title: Set date & time-->
- <TextView
- android:id="@+id/title"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:minHeight="48dip"
- android:layout_alignParentLeft="true"
- android:layout_marginLeft="16dip"
- android:layout_alignParentTop="true"
- android:textSize="32dip"
- android:textColor="#FF99cc00"
- android:text="@string/date_and_time_settings_title_setup_wizard"
- android:gravity="bottom" />
-
- <!-- Divider -->
- <View
- android:id="@+id/top_divider"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/layout_root"
+ android:layout_height="match_parent"
android:layout_width="match_parent"
- android:layout_height="3dip"
- android:layout_below="@id/title"
- android:layout_marginTop="6dip"
- android:layout_marginBottom="17dip"
- android:background="@color/divider_color" />
+ android:paddingTop="96dip"
+ android:paddingLeft="40dip"
+ android:paddingRight="40dip"
+ android:paddingBottom="96dip"
+ android:orientation="vertical">
- <RelativeLayout
- android:id="@+id/timezone_auto_time"
- android:layout_width="716dip"
- android:layout_height="wrap_content"
- android:layout_centerHorizontal="true"
- android:layout_below="@id/top_divider">
- <!-- timezone -->
- <Button
- android:id="@+id/time_zone_button"
- style="?android:attr/dropDownSpinnerStyle"
- android:layout_width="304dip"
- android:layout_height="48dip"
- android:layout_alignParentLeft="true"
- android:layout_alignBottom="@+id/date_time_auto"
- android:gravity="left|center_vertical"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textSize="20dip" />
+ <FrameLayout android:id="@+id/timezone_dropdown_anchor"
+ android:layout_height="0px"
+ android:layout_width="match_parent"
+ android:layout_marginLeft="40dip"
+ android:layout_marginRight="40dip"/>
- <LinearLayout
- android:id="@+id/date_time_auto"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:layout_toRightOf="@id/time_zone_button"
- android:layout_marginLeft="32dip"
- android:layout_alignParentRight="true">
+ <LinearLayout android:layout_height="0px"
+ android:layout_weight="1"
+ android:layout_width="match_parent"
+ android:orientation="vertical">
- <RelativeLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_toRightOf="@id/time_zone_button"
- android:layout_alignParentRight="true">
+ <fragment android:id="@+id/date_time_settings_fragment"
+ class="com.android.settings.DateTimeSettings"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
- <TextView
- android:id="@+id/date_time_auto_text"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:minHeight="?android:attr/listPreferredItemHeight"
- android:layout_marginLeft="16dip"
- android:text="@string/date_time_auto"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textSize="20dip"
- android:layout_alignParentLeft="true"
- android:layout_toLeftOf="@+id/date_time_auto_button"
- android:gravity="left|center_vertical" />
-
- <CheckBox
- android:id="@+id/date_time_auto_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerVertical="true"
- android:layout_alignParentRight="true" />
- </RelativeLayout>
-
- <!--
- <Switch
- android:id="@+id/date_time_auto_button"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:minHeight="?android:attr/listPreferredItemHeight"
- android:layout_marginLeft="16dip"
- android:text="@string/date_time_auto"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textSize="20dip" /> -->
-
- <!-- Divider -->
- <View
- android:layout_width="match_parent"
- android:layout_height="1px"
- android:background="@color/divider_color" />
- </LinearLayout>
- </RelativeLayout>
-
- <LinearLayout
- android:layout_width="624dip"
- android:layout_height="wrap_content"
- android:layout_centerHorizontal="true"
- android:layout_below="@+id/timezone_auto_time"
- android:layout_marginTop="48dip"
- android:orientation="horizontal">
-
- <LinearLayout
- android:layout_width="312dip"
- android:layout_height="wrap_content"
- android:orientation="vertical">
- <TextView
- android:id="@+id/date_picker_title"
- android:layout_width="match_parent"
- android:layout_height="48dip"
- android:text="@string/date_picker_title"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textSize="20dip"
- android:clickable="false"
- android:longClickable="false"
- android:gravity="center" />
- <DatePicker
- android:id="@+id/date_picker"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_below="@id/date_picker_title" />
- </LinearLayout>
-
- <!-- divider -->
- <View
- android:id="@+id/center_divider"
- android:layout_width="1dip"
- android:layout_height="match_parent"
- android:background="@color/divider_color" />
-
- <LinearLayout
- android:layout_width="312dip"
- android:layout_height="wrap_content"
- android:orientation="vertical">
- <TextView
- android:id="@+id/time_picker_title"
- android:layout_width="match_parent"
- android:layout_height="48dip"
- android:text="@string/time_picker_title"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textSize="20dip"
- android:gravity="center" />
-
- <TimePicker
- android:id="@+id/time_picker"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_below="@id/time_picker_title" />
- </LinearLayout>
</LinearLayout>
- <View
- android:id="@+id/bottom_divider"
- android:layout_width="match_parent"
- android:layout_height="3dip"
- android:layout_alignLeft="@id/timezone_auto_time"
- android:layout_above="@+id/next_button"
- android:layout_marginBottom="16dip"
- android:background="@color/divider_color" />
+ <RelativeLayout android:layout_height="wrap_content"
+ android:layout_weight="0"
+ android:layout_width="match_parent">
- <Button
- android:id="@+id/next_button"
- style="@style/setup_wizard_button"
- android:layout_alignParentBottom="true"
- android:layout_alignParentRight="true"
- android:text="@string/next_label" />
-</RelativeLayout>
+ <View
+ android:id="@+id/bottom_divider"
+ android:layout_height="3dip"
+ android:layout_width="match_parent"
+ android:layout_marginTop="0dip"
+ android:layout_marginBottom="16dip"
+ android:background="@color/divider_color"
+ android:layout_above="@+id/next_button"/>
+
+ <Button android:id="@+id/next_button"
+ android:layout_width="wrap_content"
+ android:minWidth="208dip"
+ android:layout_height="48dip"
+ android:layout_marginTop="10dip"
+ android:layout_alignParentRight="true"
+ android:text="@string/next_label"/>
+
+ </RelativeLayout>
+
+</LinearLayout>
diff --git a/res/layout-sw600dp-land/date_time_settings_setupwizard.xml b/res/layout-sw720dp/date_time_settings_setupwizard.xml
similarity index 98%
rename from res/layout-sw600dp-land/date_time_settings_setupwizard.xml
rename to res/layout-sw720dp/date_time_settings_setupwizard.xml
index b31462d..1fc25da 100644
--- a/res/layout-sw600dp-land/date_time_settings_setupwizard.xml
+++ b/res/layout-sw720dp/date_time_settings_setupwizard.xml
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 The Android Open Source Project
+<!-- Copyright (C) 2011 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
+ http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
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 @@
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 @@
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 @@
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 @@
.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();