Settings/Setup style cleanup.
This is not an attempt to cleanup the code that much - minimal amount of
work was done to reduce the copy/pasting that is rampant in this part of
the codebase.
This basically just does visual fixes to:
- not make the buttons illegibly tiny
- not make the buttons overlap
- make the padding consistent on phones
Bug: 5039509
Bug: 5011325
Change-Id: Id31dee84a54a5dce9644b6f37fb41ac2c2ce89b9
diff --git a/res/layout-sw600dp/account_settings_buttons.xml b/res/layout-sw600dp/account_settings_buttons.xml
new file mode 100644
index 0000000..9f66bb3
--- /dev/null
+++ b/res/layout-sw600dp/account_settings_buttons.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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
+
+ 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 xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingTop="@dimen/settings_buttons_padding_top"
+ android:paddingBottom="@dimen/settings_buttons_padding_bottom"
+ >
+ <Button
+ android:id="@+id/cancel"
+ style="@style/accountSettingsButton"
+ android:layout_alignParentLeft="true"
+ android:layout_marginLeft="32dip"
+ android:text="@string/cancel_action" />
+ <Button
+ android:id="@+id/done"
+ style="@style/accountSettingsButton"
+ android:layout_alignParentRight="true"
+ android:layout_marginRight="32dip"
+ android:text="@string/done_action" />
+</RelativeLayout>
+
diff --git a/res/layout/account_settings_buttons.xml b/res/layout/account_settings_buttons.xml
new file mode 100644
index 0000000..66d39cf
--- /dev/null
+++ b/res/layout/account_settings_buttons.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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
+
+ 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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:paddingTop="@dimen/settings_buttons_padding_top"
+ android:paddingBottom="@dimen/settings_buttons_padding_bottom"
+ >
+ <Button
+ android:id="@+id/cancel"
+ style="@style/accountSettingsButton"
+ android:layout_width="0dip"
+ android:layout_weight="1"
+ android:text="@string/cancel_action" />
+ <Button
+ android:id="@+id/done"
+ style="@style/accountSettingsButton"
+ android:layout_width="0dip"
+ android:layout_weight="1"
+ android:text="@string/done_action" />
+</LinearLayout>
diff --git a/res/layout/account_settings_exchange_fragment.xml b/res/layout/account_settings_exchange_fragment.xml
index 142eaf1..b218cb3 100644
--- a/res/layout/account_settings_exchange_fragment.xml
+++ b/res/layout/account_settings_exchange_fragment.xml
@@ -47,24 +47,6 @@
android:layout_height="0dip"
android:layout_weight="1" />
- <!-- Cancel & Done buttons -->
- <RelativeLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:paddingTop="@dimen/settings_buttons_padding_top"
- android:paddingBottom="@dimen/settings_buttons_padding_bottom"
- >
- <Button
- android:id="@+id/cancel"
- android:layout_alignParentLeft="true"
- style="@style/accountSettingsButton"
- android:text="@string/cancel_action" />
- <Button
- android:id="@+id/done"
- android:layout_alignParentRight="true"
- style="@style/accountSettingsButton"
- android:text="@string/done_action" />
- </RelativeLayout>
+ <include layout="@layout/account_settings_buttons" />
</LinearLayout>
</ScrollView>
\ No newline at end of file
diff --git a/res/layout/account_settings_incoming_fragment.xml b/res/layout/account_settings_incoming_fragment.xml
index d19a0d2..0c91074 100644
--- a/res/layout/account_settings_incoming_fragment.xml
+++ b/res/layout/account_settings_incoming_fragment.xml
@@ -47,24 +47,6 @@
android:layout_height="0dip"
android:layout_weight="1" />
- <!-- Cancel & Done buttons -->
- <RelativeLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:paddingTop="@dimen/settings_buttons_padding_top"
- android:paddingBottom="@dimen/settings_buttons_padding_bottom"
- >
- <Button
- android:id="@+id/cancel"
- android:layout_alignParentLeft="true"
- style="@style/accountSettingsButton"
- android:text="@string/cancel_action" />
- <Button
- android:id="@+id/done"
- android:layout_alignParentRight="true"
- style="@style/accountSettingsButton"
- android:text="@string/done_action" />
- </RelativeLayout>
+ <include layout="@layout/account_settings_buttons" />
</LinearLayout>
</ScrollView>
\ No newline at end of file
diff --git a/res/layout/account_settings_outgoing_fragment.xml b/res/layout/account_settings_outgoing_fragment.xml
index 7cb1504..393f1a5 100644
--- a/res/layout/account_settings_outgoing_fragment.xml
+++ b/res/layout/account_settings_outgoing_fragment.xml
@@ -47,24 +47,6 @@
android:layout_height="0dip"
android:layout_weight="1" />
- <!-- Cancel & Done buttons -->
- <RelativeLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:paddingTop="@dimen/settings_buttons_padding_top"
- android:paddingBottom="@dimen/settings_buttons_padding_bottom"
- >
- <Button
- android:id="@+id/cancel"
- android:layout_alignParentLeft="true"
- style="@style/accountSettingsButton"
- android:text="@string/cancel_action" />
- <Button
- android:id="@+id/done"
- android:layout_alignParentRight="true"
- style="@style/accountSettingsButton"
- android:text="@string/done_action" />
- </RelativeLayout>
+ <include layout="@layout/account_settings_buttons" />
</LinearLayout>
</ScrollView>
\ No newline at end of file
diff --git a/res/layout/account_setup_account_type.xml b/res/layout/account_setup_account_type.xml
index 8305b45..3e6ff53 100644
--- a/res/layout/account_setup_account_type.xml
+++ b/res/layout/account_setup_account_type.xml
@@ -20,6 +20,9 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
+ android:paddingTop="@dimen/setup_fragment_padding_top"
+ android:paddingLeft="@dimen/setup_fragment_padding_left"
+ android:paddingRight="@dimen/setup_fragment_padding_right"
>
<TextView
android:text="@string/account_setup_account_type_instructions"
diff --git a/res/layout/account_setup_basics.xml b/res/layout/account_setup_basics.xml
index dc9eb80..8f78c65 100644
--- a/res/layout/account_setup_basics.xml
+++ b/res/layout/account_setup_basics.xml
@@ -23,6 +23,9 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:paddingTop="@dimen/setup_fragment_padding_top"
+ android:paddingLeft="@dimen/setup_fragment_padding_left"
+ android:paddingRight="@dimen/setup_fragment_padding_right"
>
<!-- Frame on the left containing the (common) setup info -->
@@ -42,20 +45,27 @@
</FrameLayout>
<!-- Buttons below -->
- <Button
- android:id="@+id/manual_setup"
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
android:layout_below="@+id/common"
- android:layout_alignParentLeft="true"
- android:layout_marginTop="16dip"
- style="@style/accountSetupButton"
- android:text="@string/account_setup_basics_manual_setup_action" />
- <Button
- android:id="@+id/next"
- android:layout_below="@+id/common"
- android:layout_alignParentRight="true"
- android:layout_marginTop="16dip"
- style="@style/accountSetupButton"
- android:text="@string/next_action" />
+ android:orientation="horizontal"
+ android:paddingTop="@dimen/settings_buttons_padding_top"
+ android:paddingBottom="@dimen/settings_buttons_padding_bottom"
+ >
+ <Button
+ android:id="@+id/manual_setup"
+ style="@style/accountSetupButton"
+ android:layout_width="0dip"
+ android:layout_weight="1"
+ android:text="@string/account_setup_basics_manual_setup_action" />
+ <Button
+ android:id="@+id/next"
+ style="@style/accountSetupButton"
+ android:layout_width="0dip"
+ android:layout_weight="1"
+ android:text="@string/next_action" />
+ </LinearLayout>
</RelativeLayout>
diff --git a/res/layout/account_setup_buttons.xml b/res/layout/account_setup_buttons.xml
new file mode 100644
index 0000000..242340b
--- /dev/null
+++ b/res/layout/account_setup_buttons.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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
+
+ 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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:paddingTop="@dimen/settings_buttons_padding_top"
+ android:paddingBottom="@dimen/settings_buttons_padding_bottom"
+ >
+ <Button
+ android:id="@+id/previous"
+ style="@style/accountSetupButton"
+ android:layout_width="0dip"
+ android:layout_weight="1"
+ android:text="@string/previous_action" />
+ <Button
+ android:id="@+id/next"
+ style="@style/accountSetupButton"
+ android:layout_width="0dip"
+ android:layout_weight="1"
+ android:text="@string/next_action" />
+</LinearLayout>
diff --git a/res/layout/account_setup_exchange.xml b/res/layout/account_setup_exchange.xml
index 33612bc..78549da 100644
--- a/res/layout/account_setup_exchange.xml
+++ b/res/layout/account_setup_exchange.xml
@@ -20,34 +20,24 @@
android:layout_height="match_parent"
android:fillViewport="true">
- <RelativeLayout
+ <LinearLayout
android:layout_width="match_parent"
- android:layout_height="wrap_content" >
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:paddingTop="@dimen/setup_fragment_padding_top"
+ android:paddingLeft="@dimen/setup_fragment_padding_left"
+ android:paddingRight="@dimen/setup_fragment_padding_right" >
<fragment
android:id="@+id/setup_fragment"
class="com.android.email.activity.setup.AccountSetupExchangeFragment"
android:layout_alignParentTop="true"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ android:layout_height="0dip"
android:layout_weight="1"
/>
- <!-- Buttons below -->
- <!-- TODO - quick placeholder - phone UX still TBD -->
- <Button
- android:id="@+id/previous"
- android:layout_below="@+id/setup_fragment"
- android:layout_alignParentLeft="true"
- android:layout_marginTop="16dip"
- style="@style/accountSetupButton"
- android:text="@string/previous_action" />
- <Button
- android:id="@+id/next"
- android:layout_below="@+id/setup_fragment"
- android:layout_alignParentRight="true"
- android:layout_marginTop="16dip"
- style="@style/accountSetupButton"
- android:text="@string/next_action" />
- </RelativeLayout>
+ <include layout="@layout/account_setup_buttons" />
+
+ </LinearLayout>
</ScrollView>
diff --git a/res/layout/account_setup_incoming.xml b/res/layout/account_setup_incoming.xml
index 1c4fb20..224145c 100644
--- a/res/layout/account_setup_incoming.xml
+++ b/res/layout/account_setup_incoming.xml
@@ -20,34 +20,24 @@
android:layout_height="match_parent"
android:fillViewport="true" >
- <RelativeLayout
+ <LinearLayout
android:layout_width="match_parent"
- android:layout_height="wrap_content" >
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:paddingTop="@dimen/setup_fragment_padding_top"
+ android:paddingLeft="@dimen/setup_fragment_padding_left"
+ android:paddingRight="@dimen/setup_fragment_padding_right" >
<fragment
android:id="@+id/setup_fragment"
class="com.android.email.activity.setup.AccountSetupIncomingFragment"
android:layout_alignParentTop="true"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ android:layout_height="0dip"
android:layout_weight="1"
/>
- <!-- Buttons below -->
- <!-- TODO - quick placeholder - phone UX still TBD -->
- <Button
- android:id="@+id/previous"
- android:layout_below="@+id/setup_fragment"
- android:layout_alignParentLeft="true"
- android:layout_marginTop="16dip"
- style="@style/accountSetupButton"
- android:text="@string/previous_action" />
- <Button
- android:id="@+id/next"
- android:layout_below="@+id/setup_fragment"
- android:layout_alignParentRight="true"
- android:layout_marginTop="16dip"
- style="@style/accountSetupButton"
- android:text="@string/next_action" />
- </RelativeLayout>
+ <include layout="@layout/account_setup_buttons" />
+
+ </LinearLayout>
</ScrollView>
diff --git a/res/layout/account_setup_names.xml b/res/layout/account_setup_names.xml
index d13ff84..309a0d4 100644
--- a/res/layout/account_setup_names.xml
+++ b/res/layout/account_setup_names.xml
@@ -23,7 +23,10 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
- android:orientation="vertical" >
+ android:orientation="vertical"
+ android:paddingTop="@dimen/setup_fragment_padding_top"
+ android:paddingLeft="@dimen/setup_fragment_padding_left"
+ android:paddingRight="@dimen/setup_fragment_padding_right" >
<TextView
android:layout_height="wrap_content"
android:layout_width="match_parent"
diff --git a/res/layout/account_setup_options.xml b/res/layout/account_setup_options.xml
index b023303..a17e3f8 100644
--- a/res/layout/account_setup_options.xml
+++ b/res/layout/account_setup_options.xml
@@ -24,7 +24,11 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
- android:orientation="vertical" >
+ android:orientation="vertical"
+ android:paddingTop="@dimen/setup_fragment_padding_top"
+ android:paddingLeft="@dimen/setup_fragment_padding_left"
+ android:paddingRight="@dimen/setup_fragment_padding_right" >
+
<TextView
android:text="@string/account_setup_options_mail_check_frequency_label"
android:layout_height="wrap_content"
@@ -83,21 +87,13 @@
android:layout_width="match_parent"
android:text="@string/account_setup_options_sync_email_label" />
- <!-- TODO - quick placeholder - phone UX still TBD -->
<CheckBox
android:id="@+id/account_background_attachments"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:text="@string/account_setup_options_background_attachments_label" />
- <Button
- android:id="@+id/previous"
- android:layout_marginTop="16dip"
- style="@style/accountSetupButton"
- android:text="@string/previous_action" />
- <Button
- android:id="@+id/next"
- android:layout_marginTop="16dip"
- style="@style/accountSetupButton"
- android:text="@string/next_action" />
+
+ <include layout="@layout/account_setup_buttons" />
+
</LinearLayout>
</ScrollView>
diff --git a/res/layout/account_setup_outgoing.xml b/res/layout/account_setup_outgoing.xml
index 20e9eea..d81a69d 100644
--- a/res/layout/account_setup_outgoing.xml
+++ b/res/layout/account_setup_outgoing.xml
@@ -20,34 +20,25 @@
android:layout_height="match_parent"
android:fillViewport="true" >
- <RelativeLayout
+ <LinearLayout
android:layout_width="match_parent"
- android:layout_height="wrap_content" >
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:paddingTop="@dimen/setup_fragment_padding_top"
+ android:paddingLeft="@dimen/setup_fragment_padding_left"
+ android:paddingRight="@dimen/setup_fragment_padding_right" >
<fragment
android:id="@+id/setup_fragment"
class="com.android.email.activity.setup.AccountSetupOutgoingFragment"
android:layout_alignParentTop="true"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ android:layout_height="0dip"
android:layout_weight="1"
/>
- <!-- Buttons below -->
- <!-- TODO - quick placeholder - phone UX still TBD -->
- <Button
- android:id="@+id/previous"
- android:layout_below="@+id/setup_fragment"
- android:layout_alignParentLeft="true"
- android:layout_marginTop="16dip"
- style="@style/accountSetupButton"
- android:text="@string/previous_action" />
- <Button
- android:id="@+id/next"
- android:layout_below="@+id/setup_fragment"
- android:layout_alignParentRight="true"
- android:layout_marginTop="16dip"
- style="@style/accountSetupButton"
- android:text="@string/next_action" />
- </RelativeLayout>
+ <include layout="@layout/account_setup_buttons"
+ android:layout_below="@+id/setup_fragment" />
+
+ </LinearLayout>
</ScrollView>
diff --git a/res/values-sw600dp/dimensions.xml b/res/values-sw600dp/dimensions.xml
index 3e03bdf..5e585ae 100644
--- a/res/values-sw600dp/dimensions.xml
+++ b/res/values-sw600dp/dimensions.xml
@@ -28,6 +28,17 @@
<!-- distance of any button above the bottom of the screen -->
<dimen name="setup_buttons_padding_bottom">48dip</dimen>
+ <!-- Account settings fragments -->
+ <dimen name="settings_fragment_padding_top">32dip</dimen>
+ <dimen name="settings_fragment_padding_left">32dip</dimen>
+ <dimen name="settings_fragment_padding_right">32dip</dimen>
+
+ <!-- On tablets, we don't need additional padding in setup mode since the
+ base settings fragments that are reused already have padding. -->
+ <dimen name="setup_fragment_padding_top">0dip</dimen>
+ <dimen name="setup_fragment_padding_left">0dip</dimen>
+ <dimen name="setup_fragment_padding_right">0dip</dimen>
+
<!-- In setup screens, the inset for all items below the headline+hairline -->
<dimen name="setup_item_inset_left">16dip</dimen>
<dimen name="setup_item_inset_right">64dip</dimen>
diff --git a/res/values/dimensions.xml b/res/values/dimensions.xml
index 29d147e..bd0ad5e 100644
--- a/res/values/dimensions.xml
+++ b/res/values/dimensions.xml
@@ -39,11 +39,15 @@
<dimen name="message_compose_header_button_area_width">120dip</dimen>
<!-- Account settings fragments -->
- <!-- In containers for settings fragments, the padding to use for all items
- (this matches PreferenceActivity hairline) -->
<dimen name="settings_fragment_padding_top">32dip</dimen>
- <dimen name="settings_fragment_padding_left">32dip</dimen>
- <dimen name="settings_fragment_padding_right">32dip</dimen>
+ <dimen name="settings_fragment_padding_left">0dip</dimen>
+ <dimen name="settings_fragment_padding_right">0dip</dimen>
+
+ <!-- On the phone, we need padding on the setup fragments but not in
+ settings mode. Ugh. -->
+ <dimen name="setup_fragment_padding_top">16dip</dimen>
+ <dimen name="setup_fragment_padding_left">16dip</dimen>
+ <dimen name="setup_fragment_padding_right">16dip</dimen>
<!-- inset distance for settings buttons -->
<dimen name="settings_buttons_padding_top">48dip</dimen>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index e55b22a..073fd4c 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -55,15 +55,16 @@
<style name="accountSetupButton">
<item name="android:layout_width">160sp</item>
<item name="android:layout_height">40sp</item>
- <item name="android:textAppearance">?android:attr/textColorPrimary</item>
+ <item name="android:textColor">?android:attr/textColorPrimary</item>
+ <item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
</style>
<!-- Cancel/Done buttons on the account settings (server settings) fragments -->
- <!-- TODO these are estimates for the phone UX - final sizes TBD -->
<style name="accountSettingsButton">
<item name="android:layout_width">160sp</item>
<item name="android:layout_height">40sp</item>
- <item name="android:textAppearance">?android:attr/textColorPrimary</item>
+ <item name="android:textColor">?android:attr/textColorPrimary</item>
+ <item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
</style>
<!-- EditText style without the "tray" -->