Move the setup nav buttons to the bottom on tablets

b/14187851
Now the bars on the sides for tablet landscape setup are actually
in the activity, not the fragment. The setup fragment template
is identical between tablet and phone, with any differences between
them contained in different styles or dimensions.

Change-Id: Id7005f73aa29ed6010e629873155eb5fdc8e818f
This commit is contained in:
Martin Hibdon 2014-04-22 14:23:22 -07:00
parent 91eec1a519
commit 92581f7820
7 changed files with 93 additions and 187 deletions

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2010 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.
-->
<!-- Account Names - XL - portrait - see layout/ for small-screen version -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:background="@color/account_setup_xlarge_background_color" >
<!-- Spacer view -->
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"/>
<FrameLayout
android:layout_width="@dimen/setup_template_content_width"
android:layout_height="match_parent"
android:fillViewport="true"
android:id="@+id/setup_fragment_container">
</FrameLayout>
<!-- Spacer view -->
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"/>
</LinearLayout>

View File

@ -1,102 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2010 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.
-->
<!-- Account Names - XL - portrait - see layout/ for small-screen version -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:background="@color/account_setup_xlarge_background_color" >
<!-- Spacer view -->
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"/>
<ImageButton
style="@style/account_setup_nav_button"
android:contentDescription="@string/previous_action"
android:id="@+id/previous"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/setup_nav_button_padding_side"
android:paddingRight="@dimen/setup_nav_button_padding_side"
android:src="@drawable/ic_nav_arrow_previous_button"
android:text="@string/previous_action"
android:layout_gravity="center_vertical" />
<ScrollView
style="@style/account_setup_content"
android:layout_width="@dimen/setup_template_content_width"
android:layout_height="match_parent"
android:fillViewport="true" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<!-- Headline and hairline divider -->
<!-- Set headline for first fragment, change in code as we progress through screens -->
<TextView
android:id="@+id/headline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/account_setup_options_headline"
style="@style/account_setup_headline" />
<!-- Primary Content -->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/setup_fragment_content"
style="@style/account_setup_fragment_container"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="@dimen/setup_fragment_padding_side"
android:paddingRight="@dimen/setup_fragment_padding_side" >
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<Button
android:id="@+id/manual_setup"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/account_setup_basics_manual_setup_action"
android:visibility="gone"
style="@style/account_setup_manual_button" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<ImageButton
style="@style/account_setup_nav_button"
android:contentDescription="@string/next_action"
android:id="@+id/next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/setup_nav_button_padding_side"
android:paddingRight="@dimen/setup_nav_button_padding_side"
android:src="@drawable/ic_nav_arrow_next_button"
android:text="@string/next_action"
android:layout_gravity="center_vertical"/>
<!-- Spacer view -->
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"/>
</LinearLayout>

View File

@ -20,70 +20,69 @@
android:layout_height="match_parent"
style="@style/account_setup_content"
android:fillViewport="true" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<!-- Headline -->
<!-- Set headline for first fragment, change in code as we progress through screens -->
<TextView
android:id="@+id/headline"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/account_setup_options_headline"
style="@style/account_setup_headline" />
android:id="@+id/headline"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/account_setup_options_headline"
style="@style/account_setup_headline" />
<!-- Primary Content -->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/setup_fragment_content"
style="@style/account_setup_fragment_container"
/>
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/setup_fragment_content"
style="@style/account_setup_fragment_container"
/>
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<!-- Buttons below that -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/setup_nav_button_padding_top"
android:paddingLeft="@dimen/setup_nav_button_padding_side"
android:paddingRight="@dimen/setup_nav_button_padding_side"
android:paddingBottom="@dimen/setup_nav_button_padding_bottom"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/setup_nav_button_padding_top"
android:paddingLeft="@dimen/setup_nav_button_padding_side"
android:paddingRight="@dimen/setup_nav_button_padding_side"
android:paddingBottom="@dimen/setup_nav_button_padding_bottom"
android:orientation="horizontal">
<ImageButton
style="@style/account_setup_nav_button"
android:contentDescription="@string/previous_action"
android:id="@+id/previous"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:src="@drawable/ic_nav_arrow_previous_button"
android:text="@string/next_action" />
style="@style/account_setup_nav_button"
android:contentDescription="@string/previous_action"
android:id="@+id/previous"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:src="@drawable/ic_nav_arrow_previous_button"
android:text="@string/next_action" />
<Button
android:id="@+id/manual_setup"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/account_setup_basics_manual_setup_action"
android:visibility="gone"
android:layout_gravity="center_vertical"
style="@style/account_setup_manual_button" />
android:id="@+id/manual_setup"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/account_setup_basics_manual_setup_action"
android:visibility="gone"
android:layout_gravity="center_vertical"
style="@style/account_setup_manual_button" />
<View
android:layout_height="match_parent"
android:layout_width="0dp"
android:layout_weight="1" />
android:layout_height="match_parent"
android:layout_width="0dp"
android:layout_weight="1" />
<ImageButton
style="@style/account_setup_nav_button"
android:contentDescription="@string/next_action"
android:id="@+id/next"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:src="@drawable/ic_nav_arrow_next_button"
android:text="@string/next_action" />
style="@style/account_setup_nav_button"
android:contentDescription="@string/next_action"
android:id="@+id/next"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:src="@drawable/ic_nav_arrow_next_button"
android:text="@string/next_action" />
</LinearLayout>
</LinearLayout>
</ScrollView>

View File

@ -21,6 +21,9 @@
<dimen name="settings_fragment_padding_side">32dp</dimen>
<dimen name="settings_fragment_padding_bottom">24dp</dimen>
<!-- Account setup nav buttons -->
<dimen name="setup_nav_button_padding_side">64dp</dimen>
<!-- Account setup fragments -->
<dimen name="setup_fragment_padding_top">16dp</dimen>
<dimen name="setup_fragment_padding_side">64dp</dimen>

View File

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2014 Google Inc.
Licensed to 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.
-->
<resources>
<!-- Int value for whether we want the 'previous' button on the Basics setup screen to be
invisible or gone -->
<bool name="setup_basics_prev_button_gone">false</bool>
</resources>

View File

@ -19,10 +19,6 @@
<!-- Boolean value indicating whether the feedback is supported. -->
<bool name="feedback_supported">false</bool>
<!-- Int value for whether we want the 'previous' button on the Basics setup screen to be
invisible or gone. See also w800dp -->
<bool name="setup_basics_prev_button_gone">true</bool>
<!-- Alpha value for 'manual setup' button when disabled -->
<fraction name="manual_setup_disabled_alpha">40%</fraction>
<!-- Alpha value for 'manual setup' button when enabled -->

View File

@ -68,15 +68,7 @@ public class AccountSetupBasicsFragment extends AccountSetupFragment {
mEmailView.addTextChangedListener(textWatcher);
// On some layouts we want the button to only be invisible but still take up space, but on
// others we need it to be completely gone. So we divert based on resources.
final boolean prevButtonGone =
getResources().getBoolean(R.bool.setup_basics_prev_button_gone);
if (prevButtonGone) {
setPreviousButtonVisibility(View.GONE);
} else {
setPreviousButtonVisibility(View.INVISIBLE);
}
setPreviousButtonVisibility(View.GONE);
setManualSetupButtonVisibility(View.VISIBLE);