diff options
author | Maurice Lam <yukl@google.com> | 2015-04-18 20:11:59 -0700 |
---|---|---|
committer | Maurice Lam <yukl@google.com> | 2015-04-21 10:19:35 -0700 |
commit | 83301b5256e3fd930d620e8e9ad5f43cd388ba09 (patch) | |
tree | 71e2c358fabf8aee6166177d0dcb34efc5215609 | |
parent | c3385dc11bacdcc4d8e7d614fd7133bb9e609cdb (diff) | |
download | packages_apps_Settings-83301b5256e3fd930d620e8e9ad5f43cd388ba09.zip packages_apps_Settings-83301b5256e3fd930d620e8e9ad5f43cd388ba09.tar.gz packages_apps_Settings-83301b5256e3fd930d620e8e9ad5f43cd388ba09.tar.bz2 |
[Setup] Use SetupWizardLayout
Use SetupWizardLayout for the screens that show in Settings to get
better visual consistency and new features like showing a progress
bar in list view.
Bug: 19594252
Change-Id: I53ab17a4c2d922a362e3762f1cdccb512f7d8f6e
31 files changed, 352 insertions, 1081 deletions
diff --git a/res/drawable/setup_illustration.xml b/res/drawable/setup_illustration.xml deleted file mode 100644 index f8d96d5..0000000 --- a/res/drawable/setup_illustration.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2014 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. ---> - -<layer-list xmlns:android="http://schemas.android.com/apk/res/android" - android:autoMirrored="true"> - - <item android:id="@+id/illustration_image"> - <bitmap android:src="@drawable/setup_illustration_wifi" - android:gravity="fill" /> - </item> - -</layer-list> diff --git a/res/drawable/setup_illustration_bg.xml b/res/drawable/setup_illustration_bg.xml deleted file mode 100644 index 0a229c7..0000000 --- a/res/drawable/setup_illustration_bg.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2014 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. ---> - -<bitmap xmlns:android="http://schemas.android.com/apk/res/android" - android:src="@drawable/setup_illustration_tile" - android:tileMode="repeat" /> diff --git a/res/drawable/setup_wizard_card_bg.xml b/res/drawable/setup_wizard_card_bg.xml deleted file mode 100644 index 8621437..0000000 --- a/res/drawable/setup_wizard_card_bg.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> - -<shape xmlns:android="http://schemas.android.com/apk/res/android" - android:shape="rectangle"> - - <corners - android:topLeftRadius="@dimen/setup_wizard_card_corner_radius" - android:topRightRadius="@dimen/setup_wizard_card_corner_radius" /> - - <solid android:color="?android:attr/colorBackground" /> - -</shape> - diff --git a/res/layout-land/setup_preference.xml b/res/layout-land/setup_preference.xml deleted file mode 100644 index bee46ed..0000000 --- a/res/layout-land/setup_preference.xml +++ /dev/null @@ -1,56 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (c) 2014 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:id="@+id/fragment" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> - - <FrameLayout - android:id="@+id/title_area" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="@drawable/setup_illustration_bg" - android:elevation="@dimen/setup_wizard_title_area_elevation"> - - <TextView - android:id="@+id/title" - style="@style/SetupTitle" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:text="@string/wifi_setup_wizard_title" /> - - </FrameLayout> - - <ListView - android:id="@android:id/list" - android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_weight="1" - android:cacheColorHint="@android:color/transparent" - android:clipToPadding="false" - android:drawSelectorOnTop="false" - android:headerDividersEnabled="false" - android:scrollbarAlwaysDrawVerticalTrack="true" /> - - <fragment android:name="com.android.setupwizard.navigationbar.SetupWizardNavBar" - android:id="@+id/navigation_bar" - style="@style/setup_wizard_navbar_style" /> - -</LinearLayout> - diff --git a/res/layout-land/setup_template.xml b/res/layout-land/setup_template.xml deleted file mode 100644 index cc3402f..0000000 --- a/res/layout-land/setup_template.xml +++ /dev/null @@ -1,68 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2014 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="match_parent" - android:orientation="vertical"> - - <RelativeLayout - android:layout_weight="1" - android:layout_width="match_parent" - android:layout_height="0dp"> - - <FrameLayout - android:id="@+id/title_area" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_alignParentTop="true" - android:background="@drawable/setup_illustration_bg" - android:elevation="@dimen/setup_wizard_title_area_elevation"> - - <TextView - android:id="@+id/title" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:text="@string/wifi_setup_title" - style="@style/SetupTitle"/> - </FrameLayout> - - <ScrollView - android:id="@+id/bottom_scroll_view" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_below="@id/title_area" - android:layout_alignParentBottom="true" - android:fillViewport="true"> - - <FrameLayout android:id="@+id/setup_content" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:clipChildren="false"/> - - </ScrollView> - - </RelativeLayout> - - <fragment android:name="com.android.setupwizard.navigationbar.SetupWizardNavBar" - android:id="@+id/navigation_bar" - android:layout_width="match_parent" - android:layout_height="56dip" - style="@style/setup_wizard_navbar_style"/> -</LinearLayout> - diff --git a/res/layout-sw600dp-land/setup_preference.xml b/res/layout-sw600dp-land/setup_preference.xml deleted file mode 100644 index 883d1de..0000000 --- a/res/layout-sw600dp-land/setup_preference.xml +++ /dev/null @@ -1,78 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (c) 2014 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:id="@+id/fragment" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> - - <com.android.settings.widget.SetupWizardIllustration - android:id="@+id/setup_illustration" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_weight="1" - android:foreground="@drawable/setup_illustration" - android:background="@drawable/setup_illustration_bg"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:gravity="start|top" - android:weightSum="16"> - - <TextView - android:id="@+id/title" - style="@style/SetupCardTitle" - android:layout_width="1dp" - android:layout_height="wrap_content" - android:layout_marginTop="@dimen/setup_wizard_tablet_illustration_height" - android:layout_weight="6" - android:text="@string/wifi_setup_wizard_title"/> - - <LinearLayout - android:layout_width="1dp" - android:layout_height="match_parent" - android:layout_marginTop="@dimen/setup_wizard_card_land_margin_top" - android:layout_weight="8" - android:background="@drawable/setup_wizard_card_bg" - android:elevation="@dimen/setup_wizard_card_elevation" - android:orientation="vertical"> - - <ListView - android:id="@android:id/list" - android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_weight="1" - android:cacheColorHint="@android:color/transparent" - android:clipToPadding="false" - android:drawSelectorOnTop="false" - android:headerDividersEnabled="false" - android:scrollbarAlwaysDrawVerticalTrack="true" /> - - </LinearLayout> - - </LinearLayout> - - </com.android.settings.widget.SetupWizardIllustration> - - <fragment android:name="com.android.setupwizard.navigationbar.SetupWizardNavBar" - android:id="@+id/navigation_bar" - style="@style/setup_wizard_navbar_style" /> - -</LinearLayout> - diff --git a/res/layout-sw600dp-land/setup_template.xml b/res/layout-sw600dp-land/setup_template.xml deleted file mode 100644 index a58dd3d..0000000 --- a/res/layout-sw600dp-land/setup_template.xml +++ /dev/null @@ -1,74 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2014 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="match_parent" - android:orientation="vertical"> - - <com.android.settings.widget.SetupWizardIllustration - android:id="@+id/setup_illustration" - android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_weight="1" - android:background="@drawable/setup_illustration_bg" - android:foreground="@drawable/setup_illustration"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:gravity="start|top" - android:weightSum="16"> - - <TextView - android:id="@+id/title" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_marginTop="@dimen/setup_wizard_tablet_illustration_height" - android:layout_weight="6" - android:text="@string/wifi_setup_title" - style="@style/SetupCardTitle"/> - - <ScrollView - android:id="@+id/bottom_scroll_view" - android:layout_width="0dp" - android:layout_height="match_parent" - android:layout_marginTop="@dimen/setup_wizard_card_land_margin_top" - android:layout_weight="8" - android:background="@drawable/setup_wizard_card_bg" - android:elevation="@dimen/setup_wizard_card_elevation" - android:fillViewport="true"> - - <FrameLayout android:id="@+id/setup_content" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:clipChildren="false"/> - - </ScrollView> - - </LinearLayout> - - </com.android.settings.widget.SetupWizardIllustration> - - <fragment android:name="com.android.setupwizard.navigationbar.SetupWizardNavBar" - android:id="@+id/navigation_bar" - android:layout_width="match_parent" - android:layout_height="56dip" - style="@style/setup_wizard_navbar_style"/> - -</LinearLayout> - diff --git a/res/layout-sw600dp/setup_preference.xml b/res/layout-sw600dp/setup_preference.xml deleted file mode 100644 index cc12003..0000000 --- a/res/layout-sw600dp/setup_preference.xml +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2014 Google Inc. - - 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="match_parent" - android:orientation="vertical"> - - <com.android.settings.widget.SetupWizardIllustration - android:id="@+id/setup_illustration" - android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_weight="1" - android:background="@drawable/setup_illustration_bg" - android:foreground="@drawable/setup_illustration"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_marginTop="@dimen/setup_wizard_tablet_illustration_height" - android:orientation="vertical" - android:paddingLeft="@dimen/setup_wizard_card_port_margin_sides" - android:paddingRight="@dimen/setup_wizard_card_port_margin_sides"> - - <TextView - android:id="@+id/title" - style="@style/SetupCardTitle" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:text="@string/wifi_setup_wizard_title" /> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_weight="1" - android:background="@drawable/setup_wizard_card_bg" - android:elevation="@dimen/setup_wizard_card_elevation" - android:orientation="vertical"> - - <ListView - android:id="@android:id/list" - android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_weight="1" - android:cacheColorHint="@android:color/transparent" - android:clipToPadding="false" - android:drawSelectorOnTop="false" - android:headerDividersEnabled="false" - android:scrollbarAlwaysDrawVerticalTrack="true" /> - - </LinearLayout> - - </LinearLayout> - - </com.android.settings.widget.SetupWizardIllustration> - - <fragment - android:id="@+id/navigation_bar" - android:name="com.android.setupwizard.navigationbar.SetupWizardNavBar" - style="@style/setup_wizard_navbar_style" /> - -</LinearLayout> - diff --git a/res/layout-sw600dp/setup_template.xml b/res/layout-sw600dp/setup_template.xml deleted file mode 100644 index 297e9fb..0000000 --- a/res/layout-sw600dp/setup_template.xml +++ /dev/null @@ -1,74 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2014 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="match_parent" - android:orientation="vertical"> - - <com.android.settings.widget.SetupWizardIllustration - android:id="@+id/setup_illustration" - android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_weight="1" - android:background="@drawable/setup_illustration_bg" - android:foreground="@drawable/setup_illustration"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_marginTop="@dimen/setup_wizard_tablet_illustration_height" - android:orientation="vertical" - android:paddingStart="@dimen/setup_wizard_card_port_margin_sides" - android:paddingEnd="@dimen/setup_wizard_card_port_margin_sides"> - - <TextView - android:id="@+id/title" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:text="@string/wifi_setup_title" - style="@style/SetupCardTitle"/> - - <ScrollView - android:id="@+id/bottom_scroll_view" - android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_weight="1" - android:background="@drawable/setup_wizard_card_bg" - android:elevation="@dimen/setup_wizard_card_elevation" - android:fillViewport="true"> - - <FrameLayout - android:id="@+id/setup_content" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:clipChildren="false"/> - - </ScrollView> - - </LinearLayout> - - </com.android.settings.widget.SetupWizardIllustration> - - <fragment android:name="com.android.setupwizard.navigationbar.SetupWizardNavBar" - android:id="@+id/navigation_bar" - android:layout_width="match_parent" - android:layout_height="56dip" - style="@style/setup_wizard_navbar_style"/> - -</LinearLayout> - diff --git a/res/layout/setup_choose_lock_generic.xml b/res/layout/setup_choose_lock_generic.xml new file mode 100644 index 0000000..3b3b5e7 --- /dev/null +++ b/res/layout/setup_choose_lock_generic.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright 2015, 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. +--> + +<com.android.setupwizardlib.SetupWizardListLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:settings="http://schemas.android.com/apk/res-auto" + android:layout_width="match_parent" + android:layout_height="match_parent" + settings:suwBackgroundTile="@drawable/setup_illustration_tile" + settings:suwHeaderText="@string/wifi_setup_wizard_title" + settings:suwIllustrationHorizontalTile="@drawable/setup_illustration_horizontal_tile" + settings:suwIllustrationImage="@drawable/setup_illustration_lock_screen" /> diff --git a/res/layout/setup_choose_lock_password.xml b/res/layout/setup_choose_lock_password.xml index 59fa523..3ec5241 100644 --- a/res/layout/setup_choose_lock_password.xml +++ b/res/layout/setup_choose_lock_password.xml @@ -15,70 +15,82 @@ limitations under the License. --> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" +<com.android.setupwizardlib.SetupWizardLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:settings="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" - android:gravity="center_horizontal" - android:orientation="vertical"> + settings:suwBackgroundTile="@drawable/setup_illustration_tile" + settings:suwHeaderText="@string/wifi_setup_wizard_title" + settings:suwIllustrationHorizontalTile="@drawable/setup_illustration_horizontal_tile" + settings:suwIllustrationImage="@drawable/setup_illustration_lock_screen"> - <!-- header text ('Enter Pin') --> - <TextView android:id="@+id/headerText" + <LinearLayout android:layout_width="match_parent" - android:layout_height="wrap_content" - android:gravity="center" - android:lines="2" - android:textAppearance="?android:attr/textAppearanceMedium"/> + android:layout_height="match_parent" + android:gravity="center_horizontal" + android:orientation="vertical"> - <!-- Password entry field --> - <EditText android:id="@+id/password_entry" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:layout_marginStart="30dip" - android:layout_marginEnd="30dip" - android:gravity="center" - android:inputType="textPassword" - android:imeOptions="actionNext|flagNoExtractUi" - android:textSize="24sp" - style="@style/TextAppearance.PasswordEntry"/> + <!-- header text ('Enter Pin') --> + <TextView android:id="@+id/headerText" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center" + android:lines="2" + android:textAppearance="?android:attr/textAppearanceMedium"/> - <!-- Spacer between password entry and keyboard --> - <View - android:layout_width="match_parent" - android:layout_height="0dip" - android:layout_weight="1"/> + <!-- Password entry field --> + <EditText android:id="@+id/password_entry" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:layout_marginStart="30dip" + android:layout_marginEnd="30dip" + android:gravity="center" + android:inputType="textPassword" + android:imeOptions="actionNext|flagNoExtractUi" + android:textSize="24sp" + style="@style/TextAppearance.PasswordEntry"/> - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal" - android:visibility="gone" - style="@style/SecurityPreferenceButtonContainer"> + <!-- Spacer between password entry and keyboard --> + <View + android:layout_width="match_parent" + android:layout_height="0dip" + android:layout_weight="1"/> - <!-- left : cancel --> - <Button android:id="@+id/cancel_button" - android:layout_width="0dip" + <LinearLayout + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_weight="1" - android:text="@string/lockpassword_cancel_label" - style="@style/SecurityPreferenceButton"/> + android:orientation="horizontal" + android:visibility="gone" + style="@style/SecurityPreferenceButtonContainer"> + + <!-- left : cancel --> + <Button android:id="@+id/cancel_button" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/lockpassword_cancel_label" + style="@style/SecurityPreferenceButton"/> + + <!-- right : continue --> + <Button android:id="@+id/next_button" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/lockpassword_continue_label" + style="@style/SecurityPreferenceButton"/> - <!-- right : continue --> - <Button android:id="@+id/next_button" - android:layout_width="0dip" + </LinearLayout> + + <!-- Alphanumeric keyboard --> + <com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboard" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_weight="1" - android:text="@string/lockpassword_continue_label" - style="@style/SecurityPreferenceButton"/> + android:background="#00000000" + android:keyBackground="@*android:drawable/btn_keyboard_key_fulltrans" + android:visibility="gone"/> </LinearLayout> - <!-- Alphanumeric keyboard --> - <com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboard" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="#00000000" - android:keyBackground="@*android:drawable/btn_keyboard_key_fulltrans" - android:visibility="gone"/> - -</LinearLayout> +</com.android.setupwizardlib.SetupWizardLayout> diff --git a/res/layout/setup_choose_lock_pattern.xml b/res/layout/setup_choose_lock_pattern.xml index a906826..00c7018 100644 --- a/res/layout/setup_choose_lock_pattern.xml +++ b/res/layout/setup_choose_lock_pattern.xml @@ -15,80 +15,91 @@ limitations under the License. --> -<com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient +<com.android.setupwizardlib.SetupWizardLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/topLayout" + xmlns:settings="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" - android:orientation="vertical"> + settings:suwBackgroundTile="@drawable/setup_illustration_tile" + settings:suwHeaderText="@string/wifi_setup_wizard_title" + settings:suwIllustrationHorizontalTile="@drawable/setup_illustration_horizontal_tile" + settings:suwIllustrationImage="@drawable/setup_illustration_lock_screen"> - <!-- takes up all space above button bar at bottom --> - <LinearLayout + <com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient + android:id="@+id/topLayout" android:layout_width="match_parent" - android:layout_height="0dip" - android:layout_weight="1" - android:gravity="center" + android:layout_height="match_parent" android:orientation="vertical"> - <TextView android:id="@+id/headerText" + <!-- takes up all space above button bar at bottom --> + <LinearLayout android:layout_width="match_parent" android:layout_height="0dip" android:layout_weight="1" android:gravity="center" - android:minHeight="50dp" - android:textSize="18sp"/> + android:orientation="vertical"> - <com.android.internal.widget.LockPatternView android:id="@+id/lockPattern" - android:layout_width="match_parent" - android:layout_height="0dip" - android:layout_weight="4" - android:background="@color/lock_pattern_background"/> + <TextView android:id="@+id/headerText" + android:layout_width="match_parent" + android:layout_height="0dip" + android:layout_weight="1" + android:gravity="center" + android:minHeight="50dip" + android:textSize="18sp"/> - </LinearLayout> + <com.android.internal.widget.LockPatternView android:id="@+id/lockPattern" + android:layout_width="match_parent" + android:layout_height="0dip" + android:layout_weight="4" + android:background="@color/lock_pattern_background"/> - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:gravity="center_horizontal" - android:orientation="horizontal"> + </LinearLayout> - <Button android:id="@+id/retryButton" - android:layout_width="wrap_content" + <LinearLayout + android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="@string/lockpattern_retry_button_text"/> + android:gravity="center_horizontal" + android:orientation="horizontal"> - <TextView android:id="@+id/footerText" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:minHeight="50dp" - android:textSize="14sp"/> + <Button android:id="@+id/retryButton" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/lockpattern_retry_button_text"/> - </LinearLayout> + <TextView android:id="@+id/footerText" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:minHeight="50dip" + android:textSize="14sp"/> - <!-- Buttons are hidden during setup, and use the buttons in setup navigation bar instead --> - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal" - android:visibility="gone" - style="@style/SecurityPreferenceButtonContainer"> - - <!-- left : cancel, or re-try --> - <Button android:id="@+id/footerLeftButton" - android:layout_width="0dip" - android:layout_height="wrap_content" - android:layout_weight="1" - android:text="@string/lockpattern_tutorial_cancel_label" - style="@style/SecurityPreferenceButton"/> + </LinearLayout> - <!-- right : confirm or ok --> - <Button android:id="@+id/footerRightButton" - android:layout_width="0dip" + <!-- Buttons are hidden during setup, and use the buttons in setup navigation bar instead --> + <LinearLayout + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_weight="1" - android:text="@string/lockpattern_tutorial_continue_label" - style="@style/SecurityPreferenceButton"/> - - </LinearLayout> - -</com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient> + android:orientation="horizontal" + android:visibility="gone" + style="@style/SecurityPreferenceButtonContainer"> + + <!-- left : cancel, or re-try --> + <Button android:id="@+id/footerLeftButton" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/lockpattern_tutorial_cancel_label" + style="@style/SecurityPreferenceButton"/> + + <!-- right : confirm or ok --> + <Button android:id="@+id/footerRightButton" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/lockpattern_tutorial_continue_label" + style="@style/SecurityPreferenceButton"/> + + </LinearLayout> + + </com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient> + +</com.android.setupwizardlib.SetupWizardLayout> diff --git a/res/layout/setup_preference.xml b/res/layout/setup_preference.xml deleted file mode 100644 index d07d4a3..0000000 --- a/res/layout/setup_preference.xml +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 2012, 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:id="@+id/fragment" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> - - <com.android.settings.widget.StickyHeaderListView - android:id="@android:id/list" - android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_weight="1" - android:cacheColorHint="@android:color/transparent" - android:clipToPadding="false" - android:drawSelectorOnTop="false" - android:headerDividersEnabled="false" - android:scrollbarAlwaysDrawVerticalTrack="true" /> - - <fragment android:name="com.android.setupwizard.navigationbar.SetupWizardNavBar" - android:id="@+id/navigation_bar" - style="@style/setup_wizard_navbar_style" /> - -</LinearLayout> diff --git a/res/layout/setup_screen_lock_fingerprint_details.xml b/res/layout/setup_screen_lock_fingerprint_details.xml index 988468f..06ca778 100644 --- a/res/layout/setup_screen_lock_fingerprint_details.xml +++ b/res/layout/setup_screen_lock_fingerprint_details.xml @@ -20,6 +20,6 @@ android:layout_height="wrap_content" android:paddingTop="6dip" android:paddingBottom="6dip" - android:paddingStart="@dimen/setup_wizard_margin_sides" - android:paddingEnd="@dimen/setup_wizard_margin_sides" + android:paddingStart="@dimen/suw_layout_margin_sides" + android:paddingEnd="@dimen/suw_layout_margin_sides" android:text="@string/unlock_setup_wizard_fingerprint_details" /> diff --git a/res/layout/setup_template.xml b/res/layout/setup_template.xml deleted file mode 100644 index 0623e25..0000000 --- a/res/layout/setup_template.xml +++ /dev/null @@ -1,75 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2014 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" - xmlns:settings="http://schemas.android.com/apk/res/com.android.settings" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> - - <ScrollView - android:id="@+id/bottom_scroll_view" - android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_weight="1" - android:fillViewport="true"> - - <RelativeLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:clipChildren="false"> - - <com.android.settings.widget.SetupWizardIllustration - android:id="@+id/setup_illustration" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:elevation="@dimen/setup_wizard_title_area_elevation" - android:background="@drawable/setup_illustration_bg" - android:foreground="@drawable/setup_illustration" - android:tag="stickyContainer" - settings:aspectRatio="2.22"> - - <TextView - android:id="@+id/title" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:tag="sticky" - android:text="@string/wifi_setup_title" - style="@style/SetupTitle"/> - - </com.android.settings.widget.SetupWizardIllustration> - - <FrameLayout - android:id="@+id/setup_content" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_below="@id/setup_illustration" - android:clipChildren="false"/> - - </RelativeLayout> - - </ScrollView> - - <fragment android:name="com.android.setupwizard.navigationbar.SetupWizardNavBar" - android:id="@+id/navigation_bar" - android:layout_width="match_parent" - android:layout_height="56dip" - style="@style/setup_wizard_navbar_style"/> - -</LinearLayout> - diff --git a/res/layout/setup_wifi_empty.xml b/res/layout/setup_wifi_empty.xml index 52864f9..b1659d7 100644 --- a/res/layout/setup_wifi_empty.xml +++ b/res/layout/setup_wifi_empty.xml @@ -19,6 +19,6 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="@dimen/setup_wizard_margin_top" - android:paddingStart="@dimen/setup_wizard_margin_sides" - android:paddingEnd="@dimen/setup_wizard_margin_sides" + android:paddingStart="@dimen/suw_layout_margin_sides" + android:paddingEnd="@dimen/suw_layout_margin_sides" android:textAppearance="@style/TextAppearance.SetupWizardDescription" /> diff --git a/res/drawable-sw600dp/setup_illustration.xml b/res/layout/setup_wifi_layout.xml index c0e54e2..62bb6a1 100644 --- a/res/drawable-sw600dp/setup_illustration.xml +++ b/res/layout/setup_wifi_layout.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- - Copyright (C) 2014 The Android Open Source Project + Copyright 2015, 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. @@ -15,19 +15,12 @@ limitations under the License. --> -<layer-list xmlns:android="http://schemas.android.com/apk/res/android" - android:autoMirrored="true"> - - <item> - <bitmap android:src="@drawable/setup_illustration_horizontal_tile" - android:gravity="top" - android:tileModeX="repeat" - android:tileModeY="disabled" /> - </item> - - <item android:id="@+id/illustration_image"> - <bitmap android:src="@drawable/setup_illustration_wifi" - android:gravity="top|start" /> - </item> - -</layer-list> +<com.android.setupwizardlib.SetupWizardListLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:settings="http://schemas.android.com/apk/res-auto" + android:layout_width="match_parent" + android:layout_height="match_parent" + settings:suwBackgroundTile="@drawable/setup_illustration_tile" + settings:suwHeaderText="@string/wifi_setup_wizard_title" + settings:suwIllustrationHorizontalTile="@drawable/setup_illustration_horizontal_tile" + settings:suwIllustrationImage="@drawable/setup_illustration_wifi" /> diff --git a/res/layout/setup_wizard_header.xml b/res/layout/setup_wizard_header.xml deleted file mode 100644 index b030ad1..0000000 --- a/res/layout/setup_wizard_header.xml +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2014 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. ---> - -<com.android.settings.widget.SetupWizardIllustration - xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:settings="http://schemas.android.com/apk/res/com.android.settings" - android:id="@+id/setup_illustration" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="@drawable/setup_illustration_bg" - android:elevation="@dimen/setup_wizard_title_area_elevation" - android:foreground="@drawable/setup_illustration" - android:tag="stickyContainer" - settings:aspectRatio="2.22"> - - <TextView - android:id="@+id/title" - style="@style/SetupTitle" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:tag="sticky" - android:text="@string/wifi_setup_wizard_title"/> - -</com.android.settings.widget.SetupWizardIllustration> diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml index 5f524af..79529e2 100755 --- a/res/values-land/dimens.xml +++ b/res/values-land/dimens.xml @@ -45,9 +45,4 @@ <!-- Dashboard tile image margin start / end --> <dimen name="dashboard_tile_image_margin_start">12dp</dimen> - <dimen name="setup_wizard_card_title_padding_end">32dp</dimen> - <dimen name="setup_wizard_card_title_padding_start">56dp</dimen> - <dimen name="setup_wizard_card_title_padding_top">24dp</dimen> - <dimen name="setup_wizard_card_title_padding_bottom">0dp</dimen> - </resources> diff --git a/res/values-sw600dp/dimens.xml b/res/values-sw600dp/dimens.xml index d9521db..03809c4 100755 --- a/res/values-sw600dp/dimens.xml +++ b/res/values-sw600dp/dimens.xml @@ -24,7 +24,6 @@ <dimen name="content_margin_left">16dip</dimen> <dimen name="description_margin_top">26dip</dimen> <dimen name="crypt_clock_size">120sp</dimen> - <dimen name="setup_title_size">24sp</dimen> <dimen name="appwidget_min_width">325dip</dimen> <dimen name="appwidget_min_height">50dip</dimen> diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 8a58c5c..cd11c2c 100755 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -38,28 +38,10 @@ <dimen name="crypt_clock_size">100sp</dimen> - <dimen name="setup_margin_bottom">0dip</dimen> - <dimen name="setup_title_size">24sp</dimen> - <dimen name="setup_title_margin_bottom">16dp</dimen> - <!-- This is the extra spacing required to make the leading exactly 32sp --> - <dimen name="setup_title_line_spacing_extra">3.67sp</dimen> - <dimen name="setup_title_padding_bottom">2dp</dimen> - <dimen name="setup_title_padding_top">16dp</dimen> <!-- Size of padding to give in the wifi list when there is no icon --> <dimen name="setup_list_no_icon_padding">56dp</dimen> <dimen name="setup_add_network_item_height">56dp</dimen> - <dimen name="setup_wizard_card_corner_radius">2dp</dimen> - <dimen name="setup_wizard_card_elevation">5dp</dimen> - <dimen name="setup_wizard_tablet_illustration_height">256dp</dimen> - <dimen name="setup_wizard_card_title_padding_end">0dp</dimen> - <dimen name="setup_wizard_card_title_padding_start">0dp</dimen> - <dimen name="setup_wizard_card_title_padding_top">16dp</dimen> - <dimen name="setup_wizard_card_title_padding_bottom">28dp</dimen> - <dimen name="setup_wizard_card_port_margin_sides">56dp</dimen> - <dimen name="setup_wizard_card_land_margin_top">128dp</dimen> - <dimen name="setup_wizard_margin_sides">40dp</dimen> <dimen name="setup_wizard_margin_top">24dp</dimen> - <dimen name="setup_wizard_title_area_elevation">3dp</dimen> <dimen name="divider_height">3dip</dimen> <dimen name="divider_margin_top">6dip</dimen> diff --git a/res/values/styles.xml b/res/values/styles.xml index 22061e6..f9f4561 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -146,45 +146,6 @@ <item name="android:clickable">false</item> </style> - <!-- We'd like to have this as 16dip hight including paddingTop/paddingBottom to - be consistent with ProgressBar --> - <style name="TopDivider"> - <item name="android:layout_width">match_parent</item> - <item name="android:layout_height">@dimen/divider_height</item> - <item name="android:background">?attr/setup_divider_color</item> - <item name="android:focusable">false</item> - <item name="android:clickable">false</item> - <item name="android:layout_marginTop">@dimen/divider_margin_top</item> - <item name="android:layout_marginBottom">@dimen/divider_margin_bottom</item> - </style> - - <style name="SetupTitle"> - <item name="android:layout_marginBottom">@dimen/setup_title_margin_bottom</item> - <item name="android:layout_marginEnd">@dimen/setup_wizard_margin_sides</item> - <item name="android:layout_marginStart">@dimen/setup_wizard_margin_sides</item> - <item name="android:clickable">false</item> - <item name="android:fontFamily">sans-serif</item> - <item name="android:lineSpacingExtra">@dimen/setup_title_line_spacing_extra</item> - <item name="android:longClickable">false</item> - <item name="android:textColor">@android:color/white</item> - <item name="android:textSize">@dimen/setup_title_size</item> - <item name="android:paddingBottom">@dimen/setup_title_padding_bottom</item> - <item name="android:paddingTop">@dimen/setup_title_padding_top</item> - </style> - - <!-- Alternate title style used for some tablet layouts --> - <style name="SetupCardTitle"> - <item name="android:paddingBottom">@dimen/setup_wizard_card_title_padding_bottom</item> - <item name="android:paddingEnd">@dimen/setup_wizard_card_title_padding_end</item> - <item name="android:paddingStart">@dimen/setup_wizard_card_title_padding_start</item> - <item name="android:paddingTop">@dimen/setup_wizard_card_title_padding_top</item> - <item name="android:textAppearance">@style/TextAppearance.SetupWizardCardTitle</item> - </style> - - <style name="TextAppearance.SetupWizardCardTitle" parent="@android:style/TextAppearance.Material.Display1"> - <item name="android:textColor">@android:color/white</item> - </style> - <style name="TextAppearance.SetupWizardDescription" parent="@android:style/TextAppearance.Material.Subhead"> </style> diff --git a/res/values/themes.xml b/res/values/themes.xml index 0d28126..2d6945b 100644 --- a/res/values/themes.xml +++ b/res/values/themes.xml @@ -31,8 +31,8 @@ <style name="SetupWizardTheme" parent="SuwThemeMaterial"> <item name="android:alertDialogTheme">@style/Theme.WifiDialog</item> - <item name="android:listPreferredItemPaddingEnd">@dimen/setup_wizard_margin_sides</item> - <item name="android:listPreferredItemPaddingStart">@dimen/setup_wizard_margin_sides</item> + <item name="android:listPreferredItemPaddingEnd">@dimen/suw_layout_margin_sides</item> + <item name="android:listPreferredItemPaddingStart">@dimen/suw_layout_margin_sides</item> <item name="android:windowBackground">?android:attr/colorBackground</item> <item name="@*android:preferencePanelStyle">@*android:style/PreferencePanel.Dialog</item> <item name="ic_menu_add">@drawable/ic_menu_add_dark</item> @@ -52,8 +52,8 @@ <style name="SetupWizardTheme.Light" parent="SuwThemeMaterial.Light"> <item name="android:alertDialogTheme">@style/Theme.Light.WifiDialog</item> - <item name="android:listPreferredItemPaddingEnd">@dimen/setup_wizard_margin_sides</item> - <item name="android:listPreferredItemPaddingStart">@dimen/setup_wizard_margin_sides</item> + <item name="android:listPreferredItemPaddingEnd">@dimen/suw_layout_margin_sides</item> + <item name="android:listPreferredItemPaddingStart">@dimen/suw_layout_margin_sides</item> <item name="android:windowBackground">?android:attr/colorBackground</item> <item name="@*android:preferencePanelStyle">@*android:style/PreferencePanel.Dialog</item> <item name="ic_menu_add">@drawable/ic_menu_add_light</item> diff --git a/src/com/android/settings/SetupChooseLockGeneric.java b/src/com/android/settings/SetupChooseLockGeneric.java index f2da8cc..82157c0 100644 --- a/src/com/android/settings/SetupChooseLockGeneric.java +++ b/src/com/android/settings/SetupChooseLockGeneric.java @@ -16,8 +16,10 @@ package com.android.settings; -import com.android.setupwizard.navigationbar.SetupWizardNavBar; +import com.android.setupwizardlib.SetupWizardListLayout; +import com.android.setupwizardlib.view.NavigationBar; +import android.app.Activity; import android.app.admin.DevicePolicyManager; import android.content.Context; import android.content.Intent; @@ -37,8 +39,7 @@ import android.widget.ListView; * Other changes should be done to ChooseLockGeneric class instead and let this class inherit * those changes. */ -public class SetupChooseLockGeneric extends ChooseLockGeneric - implements SetupWizardNavBar.NavigationBarListener { +public class SetupChooseLockGeneric extends ChooseLockGeneric { @Override protected boolean isValidFragment(String fragmentName) { @@ -56,33 +57,16 @@ public class SetupChooseLockGeneric extends ChooseLockGeneric super.onApplyThemeResource(theme, resid, first); } - @Override - public void onNavigationBarCreated(SetupWizardNavBar bar) { - SetupWizardUtils.setImmersiveMode(this); - bar.getNextButton().setEnabled(false); - } - - @Override - public void onNavigateBack() { - onBackPressed(); - } - - @Override - public void onNavigateNext() { - } - - public static class SetupChooseLockGenericFragment extends ChooseLockGenericFragment { + public static class SetupChooseLockGenericFragment extends ChooseLockGenericFragment + implements NavigationBar.NavigationBarListener { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - final View view = inflater.inflate(R.layout.setup_preference, container, false); - ListView list = (ListView) view.findViewById(android.R.id.list); - View title = view.findViewById(R.id.title); - if (title == null) { - final View header = inflater.inflate(R.layout.setup_wizard_header, list, false); - list.addHeaderView(header, null, false); - } + final SetupWizardListLayout layout = (SetupWizardListLayout) inflater.inflate( + R.layout.setup_choose_lock_generic, container, false); + layout.setHeaderText(getActivity().getTitle()); + ListView list = layout.getListView(); final FingerprintManager fpm = (FingerprintManager) getActivity().getSystemService(Context.FINGERPRINT_SERVICE); if (fpm != null && fpm.isHardwareDetected()) { @@ -90,15 +74,18 @@ public class SetupChooseLockGeneric extends ChooseLockGeneric R.layout.setup_screen_lock_fingerprint_details, list, false); list.addFooterView(footer, null, false); } - return view; + + final NavigationBar navigationBar = layout.getNavigationBar(); + navigationBar.getNextButton().setEnabled(false); + navigationBar.setNavigationBarListener(this); + + return layout; } @Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); - SetupWizardUtils.setIllustration(getActivity(), - R.drawable.setup_illustration_lock_screen); - SetupWizardUtils.setHeaderText(getActivity(), getActivity().getTitle()); + SetupWizardUtils.setImmersiveMode(getActivity()); } @Override @@ -192,5 +179,17 @@ public class SetupChooseLockGeneric extends ChooseLockGeneric SetupWizardUtils.copySetupExtras(getActivity().getIntent(), intent); return intent; } + + @Override + public void onNavigateBack() { + Activity activity = getActivity(); + if (activity != null) { + activity.onBackPressed(); + } + } + + @Override + public void onNavigateNext() { + } } } diff --git a/src/com/android/settings/SetupChooseLockPassword.java b/src/com/android/settings/SetupChooseLockPassword.java index 461b67c..6f384a4 100644 --- a/src/com/android/settings/SetupChooseLockPassword.java +++ b/src/com/android/settings/SetupChooseLockPassword.java @@ -16,9 +16,11 @@ package com.android.settings; -import com.android.setupwizard.navigationbar.SetupWizardNavBar; +import com.android.setupwizardlib.SetupWizardLayout; import com.android.setupwizardlib.util.SystemBarHelper; +import com.android.setupwizardlib.view.NavigationBar; +import android.app.Activity; import android.app.Fragment; import android.content.Context; import android.content.Intent; @@ -35,8 +37,7 @@ import android.view.ViewGroup; * Other changes should be done to ChooseLockPassword class instead and let this class inherit * those changes. */ -public class SetupChooseLockPassword extends ChooseLockPassword - implements SetupWizardNavBar.NavigationBarListener { +public class SetupChooseLockPassword extends ChooseLockPassword { public static Intent createIntent(Context context, int quality, int minLength, final int maxLength, boolean requirePasswordToDecrypt, @@ -66,9 +67,6 @@ public class SetupChooseLockPassword extends ChooseLockPassword return intent; } - private SetupWizardNavBar mNavigationBar; - private SetupChooseLockPasswordFragment mFragment; - @Override protected boolean isValidFragment(String fragmentName) { return SetupChooseLockPasswordFragment.class.getName().equals(fragmentName); @@ -85,51 +83,22 @@ public class SetupChooseLockPassword extends ChooseLockPassword super.onApplyThemeResource(theme, resid, first); } - @Override - public void onNavigationBarCreated(SetupWizardNavBar bar) { - mNavigationBar = bar; - SetupWizardUtils.setImmersiveMode(this); - } - - @Override - public void onNavigateBack() { - onBackPressed(); - } + public static class SetupChooseLockPasswordFragment extends ChooseLockPasswordFragment + implements NavigationBar.NavigationBarListener { - @Override - public void onNavigateNext() { - if (mFragment != null) { - mFragment.handleNext(); - } - } - - @Override - public void onAttachFragment(Fragment fragment) { - super.onAttachFragment(fragment); - if (fragment instanceof SetupChooseLockPasswordFragment) { - mFragment = (SetupChooseLockPasswordFragment) fragment; - } - } - - public static class SetupChooseLockPasswordFragment extends ChooseLockPasswordFragment { + private NavigationBar mNavigationBar; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - final View view = inflater.inflate(R.layout.setup_template, container, false); - View scrollView = view.findViewById(R.id.bottom_scroll_view); - SystemBarHelper.setImeInsetView(scrollView); - ViewGroup setupContent = (ViewGroup) view.findViewById(R.id.setup_content); - inflater.inflate(R.layout.setup_choose_lock_password, setupContent, true); - return view; - } - - @Override - public void onViewCreated(View view, Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); - SetupWizardUtils.setIllustration(getActivity(), - R.drawable.setup_illustration_lock_screen); - SetupWizardUtils.setHeaderText(getActivity(), getActivity().getTitle()); + final SetupWizardLayout layout = (SetupWizardLayout) inflater.inflate( + R.layout.setup_choose_lock_password, container, false); + SystemBarHelper.setImeInsetView(layout.findViewById(R.id.suw_bottom_scroll_view)); + mNavigationBar = layout.getNavigationBar(); + mNavigationBar.setNavigationBarListener(this); + layout.setHeaderText(getActivity().getTitle()); + SetupWizardUtils.setImmersiveMode(getActivity()); + return layout; } @Override @@ -141,14 +110,25 @@ public class SetupChooseLockPassword extends ChooseLockPassword @Override protected void setNextEnabled(boolean enabled) { - SetupChooseLockPassword activity = (SetupChooseLockPassword) getActivity(); - activity.mNavigationBar.getNextButton().setEnabled(enabled); + mNavigationBar.getNextButton().setEnabled(enabled); } @Override protected void setNextText(int text) { - SetupChooseLockPassword activity = (SetupChooseLockPassword) getActivity(); - activity.mNavigationBar.getNextButton().setText(text); + mNavigationBar.getNextButton().setText(text); + } + + @Override + public void onNavigateBack() { + final Activity activity = getActivity(); + if (activity != null) { + activity.onBackPressed(); + } + } + + @Override + public void onNavigateNext() { + handleNext(); } } } diff --git a/src/com/android/settings/SetupChooseLockPattern.java b/src/com/android/settings/SetupChooseLockPattern.java index ca79744..2ea8d4a 100644 --- a/src/com/android/settings/SetupChooseLockPattern.java +++ b/src/com/android/settings/SetupChooseLockPattern.java @@ -16,8 +16,10 @@ package com.android.settings; -import com.android.setupwizard.navigationbar.SetupWizardNavBar; +import com.android.setupwizardlib.SetupWizardLayout; +import com.android.setupwizardlib.view.NavigationBar; +import android.app.Activity; import android.app.Fragment; import android.content.Context; import android.content.Intent; @@ -35,8 +37,7 @@ import android.widget.Button; * Other changes should be done to ChooseLockPattern class instead and let this class inherit * those changes. */ -public class SetupChooseLockPattern extends ChooseLockPattern - implements SetupWizardNavBar.NavigationBarListener { +public class SetupChooseLockPattern extends ChooseLockPattern { public static Intent createIntent(Context context, boolean requirePassword, boolean confirmCredentials) { @@ -58,9 +59,6 @@ public class SetupChooseLockPattern extends ChooseLockPattern return intent; } - private SetupWizardNavBar mNavigationBar; - private SetupChooseLockPatternFragment mFragment; - @Override protected boolean isValidFragment(String fragmentName) { return SetupChooseLockPatternFragment.class.getName().equals(fragmentName); @@ -77,43 +75,21 @@ public class SetupChooseLockPattern extends ChooseLockPattern super.onApplyThemeResource(theme, resid, first); } - @Override - public void onNavigationBarCreated(SetupWizardNavBar bar) { - mNavigationBar = bar; - SetupWizardUtils.setImmersiveMode(this); - } - - @Override - public void onNavigateBack() { - onBackPressed(); - } - - @Override - public void onNavigateNext() { - if (mFragment != null) { - mFragment.handleRightButton(); - } - } - - @Override - public void onAttachFragment(Fragment fragment) { - super.onAttachFragment(fragment); - if (fragment instanceof ChooseLockPatternFragment) { - mFragment = (SetupChooseLockPatternFragment) fragment; - } - } - - public static class SetupChooseLockPatternFragment extends ChooseLockPatternFragment { + public static class SetupChooseLockPatternFragment extends ChooseLockPatternFragment + implements NavigationBar.NavigationBarListener { + private NavigationBar mNavigationBar; private Button mRetryButton; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - final View view = inflater.inflate(R.layout.setup_template, container, false); - ViewGroup setupContent = (ViewGroup) view.findViewById(R.id.setup_content); - inflater.inflate(R.layout.setup_choose_lock_pattern, setupContent, true); - return view; + final SetupWizardLayout layout = (SetupWizardLayout) inflater.inflate( + R.layout.setup_choose_lock_pattern, container, false); + mNavigationBar = layout.getNavigationBar(); + mNavigationBar.setNavigationBarListener(this); + layout.setHeaderText(getActivity().getTitle()); + return layout; } @Override @@ -121,9 +97,7 @@ public class SetupChooseLockPattern extends ChooseLockPattern mRetryButton = (Button) view.findViewById(R.id.retryButton); mRetryButton.setOnClickListener(this); super.onViewCreated(view, savedInstanceState); - SetupWizardUtils.setIllustration(getActivity(), - R.drawable.setup_illustration_lock_screen); - SetupWizardUtils.setHeaderText(getActivity(), getActivity().getTitle()); + SetupWizardUtils.setImmersiveMode(getActivity()); } @Override @@ -144,14 +118,12 @@ public class SetupChooseLockPattern extends ChooseLockPattern @Override protected void setRightButtonEnabled(boolean enabled) { - SetupChooseLockPattern activity = (SetupChooseLockPattern) getActivity(); - activity.mNavigationBar.getNextButton().setEnabled(enabled); + mNavigationBar.getNextButton().setEnabled(enabled); } @Override protected void setRightButtonText(int text) { - SetupChooseLockPattern activity = (SetupChooseLockPattern) getActivity(); - activity.mNavigationBar.getNextButton().setText(text); + mNavigationBar.getNextButton().setText(text); } @Override @@ -160,5 +132,18 @@ public class SetupChooseLockPattern extends ChooseLockPattern // Only enable the button for retry mRetryButton.setEnabled(stage == Stage.FirstChoiceValid); } + + @Override + public void onNavigateBack() { + final Activity activity = getActivity(); + if (activity != null) { + activity.onBackPressed(); + } + } + + @Override + public void onNavigateNext() { + handleRightButton(); + } } } diff --git a/src/com/android/settings/SetupEncryptionInterstitial.java b/src/com/android/settings/SetupEncryptionInterstitial.java index 8d5f613..61ff81c 100644 --- a/src/com/android/settings/SetupEncryptionInterstitial.java +++ b/src/com/android/settings/SetupEncryptionInterstitial.java @@ -16,8 +16,10 @@ package com.android.settings; -import com.android.setupwizard.navigationbar.SetupWizardNavBar; +import com.android.setupwizardlib.SetupWizardLayout; +import com.android.setupwizardlib.view.NavigationBar; +import android.app.Activity; import android.app.admin.DevicePolicyManager; import android.content.Context; import android.content.Intent; @@ -34,8 +36,7 @@ import android.view.ViewGroup; * Setup Wizard. Other changes should be done to EncryptionInterstitial class instead and let this * class inherit those changes. */ -public class SetupEncryptionInterstitial extends EncryptionInterstitial - implements SetupWizardNavBar.NavigationBarListener{ +public class SetupEncryptionInterstitial extends EncryptionInterstitial { public static Intent createStartIntent(Context ctx, int quality, boolean requirePasswordDefault) { @@ -66,32 +67,29 @@ public class SetupEncryptionInterstitial extends EncryptionInterstitial super.onApplyThemeResource(theme, resid, first); } - @Override - public void onNavigationBarCreated(SetupWizardNavBar bar) { - SetupWizardUtils.setImmersiveMode(this); - } - - @Override - public void onNavigateBack() { - onBackPressed(); - } - - @Override - public void onNavigateNext() { - setResult(RESULT_OK, getResultIntentData()); - finish(); - } - - public static class SetupEncryptionInterstitialFragment extends EncryptionInterstitialFragment { + public static class SetupEncryptionInterstitialFragment extends EncryptionInterstitialFragment + implements NavigationBar.NavigationBarListener { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.setup_template, container, false); - ViewGroup setupContent = (ViewGroup) view.findViewById(R.id.setup_content); - View content = super.onCreateView(inflater, setupContent, savedInstanceState); - setupContent.addView(content); - return view; + final SetupWizardLayout layout = new SetupWizardLayout(inflater.getContext()); + layout.setIllustration(R.drawable.setup_illustration_lock_screen, + R.drawable.setup_illustration_horizontal_tile); + layout.setBackgroundTile(R.drawable.setup_illustration_tile); + final int headerTextResource = getHeaderTextResource(); + layout.setHeaderText(headerTextResource); + + View content = super.onCreateView(inflater, layout, savedInstanceState); + layout.addView(content); + layout.getNavigationBar().setNavigationBarListener(this); + + Activity activity = getActivity(); + if (activity != null) { + activity.setTitle(headerTextResource); + SetupWizardUtils.setImmersiveMode(activity); + } + return layout; } private int getHeaderTextResource() { @@ -108,13 +106,21 @@ public class SetupEncryptionInterstitial extends EncryptionInterstitial } @Override - public void onViewCreated(View view, Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); - SetupWizardUtils.setIllustration(getActivity(), - R.drawable.setup_illustration_lock_screen); - final int title = getHeaderTextResource(); - getActivity().setTitle(title); - SetupWizardUtils.setHeaderText(getActivity(), title); + public void onNavigateBack() { + final Activity activity = getActivity(); + if (activity != null) { + activity.onBackPressed(); + } + } + + @Override + public void onNavigateNext() { + final SetupEncryptionInterstitial activity = + (SetupEncryptionInterstitial) getActivity(); + if (activity != null) { + activity.setResult(RESULT_OK, activity.getResultIntentData()); + finish(); + } } } } diff --git a/src/com/android/settings/SetupRedactionInterstitial.java b/src/com/android/settings/SetupRedactionInterstitial.java index 266a049..c6437e0 100644 --- a/src/com/android/settings/SetupRedactionInterstitial.java +++ b/src/com/android/settings/SetupRedactionInterstitial.java @@ -17,8 +17,10 @@ package com.android.settings; import com.android.settings.notification.RedactionInterstitial; -import com.android.setupwizard.navigationbar.SetupWizardNavBar; +import com.android.setupwizardlib.SetupWizardLayout; +import com.android.setupwizardlib.view.NavigationBar; +import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.res.Resources; @@ -34,8 +36,7 @@ import android.view.ViewGroup; * Wizard. Other changes should be done to RedactionInterstitial class instead and let this class * inherit those changes. */ -public class SetupRedactionInterstitial extends RedactionInterstitial - implements SetupWizardNavBar.NavigationBarListener{ +public class SetupRedactionInterstitial extends RedactionInterstitial { public static Intent createStartIntent(Context ctx) { Intent startIntent = RedactionInterstitial.createStartIntent(ctx); @@ -64,41 +65,43 @@ public class SetupRedactionInterstitial extends RedactionInterstitial super.onApplyThemeResource(theme, resid, first); } - @Override - public void onNavigationBarCreated(SetupWizardNavBar bar) { - SetupWizardUtils.setImmersiveMode(this); - bar.getBackButton().setEnabled(false); - } + public static class SetupEncryptionInterstitialFragment extends RedactionInterstitialFragment + implements NavigationBar.NavigationBarListener { - @Override - public void onNavigateBack() { - onBackPressed(); - } + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + final SetupWizardLayout layout = new SetupWizardLayout(inflater.getContext()); + layout.setIllustration(R.drawable.setup_illustration_lock_screen, + R.drawable.setup_illustration_horizontal_tile); + layout.setBackgroundTile(R.drawable.setup_illustration_tile); + layout.setHeaderText(R.string.notification_section_header); - @Override - public void onNavigateNext() { - setResult(RESULT_OK, getResultIntentData()); - finish(); - } + View content = super.onCreateView(inflater, layout, savedInstanceState); + layout.addView(content); - public static class SetupEncryptionInterstitialFragment extends RedactionInterstitialFragment { + final NavigationBar navigationBar = layout.getNavigationBar(); + navigationBar.setNavigationBarListener(this); + navigationBar.getBackButton().setEnabled(false); + SetupWizardUtils.setImmersiveMode(getActivity()); + return layout; + } @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.setup_template, container, false); - ViewGroup setupContent = (ViewGroup) view.findViewById(R.id.setup_content); - View content = super.onCreateView(inflater, setupContent, savedInstanceState); - setupContent.addView(content); - return view; + public void onNavigateBack() { + final Activity activity = getActivity(); + if (activity != null) { + activity.onBackPressed(); + } } @Override - public void onViewCreated(View view, Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); - SetupWizardUtils.setIllustration(getActivity(), - R.drawable.setup_illustration_lock_screen); - SetupWizardUtils.setHeaderText(getActivity(), R.string.notification_section_header); + public void onNavigateNext() { + final SetupRedactionInterstitial activity = (SetupRedactionInterstitial) getActivity(); + if (activity != null) { + activity.setResult(RESULT_OK, activity.getResultIntentData()); + finish(); + } } } } diff --git a/src/com/android/settings/SetupWizardUtils.java b/src/com/android/settings/SetupWizardUtils.java index d91ba13..7c4267c 100644 --- a/src/com/android/settings/SetupWizardUtils.java +++ b/src/com/android/settings/SetupWizardUtils.java @@ -16,17 +16,12 @@ package com.android.settings; -import com.android.settings.widget.SetupWizardIllustration; import com.android.setupwizardlib.util.SystemBarHelper; import com.android.setupwizardlib.util.WizardManagerHelper; import android.app.Activity; import android.app.Dialog; import android.content.Intent; -import android.graphics.drawable.BitmapDrawable; -import android.graphics.drawable.Drawable; -import android.graphics.drawable.LayerDrawable; -import android.widget.TextView; public class SetupWizardUtils { private static final String TAG = "SetupWizardUtils"; @@ -75,42 +70,10 @@ public class SetupWizardUtils { SystemBarHelper.hideSystemBars(dialog); } - public static TextView getHeader(Activity activity) { - return (TextView) activity.findViewById(R.id.title); - } - - public static void setHeaderText(Activity activity, int text) { - getHeader(activity).setText(text); - } - - public static void setHeaderText(Activity activity, CharSequence text) { - getHeader(activity).setText(text); - } - public static void copySetupExtras(Intent fromIntent, Intent toIntent) { toIntent.putExtra(WizardManagerHelper.EXTRA_THEME, fromIntent.getStringExtra(WizardManagerHelper.EXTRA_THEME)); toIntent.putExtra(WizardManagerHelper.EXTRA_USE_IMMERSIVE_MODE, fromIntent.getBooleanExtra(WizardManagerHelper.EXTRA_USE_IMMERSIVE_MODE, false)); } - - public static void setIllustration(Activity activity, int asset) { - SetupWizardIllustration illustration = - (SetupWizardIllustration) activity.findViewById(R.id.setup_illustration); - if (illustration != null) { - Drawable drawable = activity.getDrawable(R.drawable.setup_illustration); - Drawable newIllustration = activity.getDrawable(asset); - if (drawable instanceof LayerDrawable) { - LayerDrawable layers = (LayerDrawable) drawable; - Drawable oldIllustration = layers.findDrawableByLayerId(R.id.illustration_image); - if (newIllustration instanceof BitmapDrawable - && oldIllustration instanceof BitmapDrawable) { - final int gravity = ((BitmapDrawable) oldIllustration).getGravity(); - ((BitmapDrawable) newIllustration).setGravity(gravity); - } - layers.setDrawableByLayerId(R.id.illustration_image, newIllustration); - illustration.setForeground(layers); - } - } - } } diff --git a/src/com/android/settings/wifi/WifiSettingsForSetupWizard.java b/src/com/android/settings/wifi/WifiSettingsForSetupWizard.java index 4dfea08..ba78794 100644 --- a/src/com/android/settings/wifi/WifiSettingsForSetupWizard.java +++ b/src/com/android/settings/wifi/WifiSettingsForSetupWizard.java @@ -30,6 +30,8 @@ import android.widget.TextView; import com.android.settings.R; import com.android.settings.SetupWizardUtils; +import com.android.setupwizardlib.SetupWizardListLayout; +import com.android.setupwizardlib.view.NavigationBar; /** * This customized version of WifiSettings is shown to the user only during Setup Wizard. Menu @@ -48,15 +50,9 @@ public class WifiSettingsForSetupWizard extends WifiSettings { @Override public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - - final View view = inflater.inflate(R.layout.setup_preference, container, false); - - final ListView list = (ListView) view.findViewById(android.R.id.list); - final View title = view.findViewById(R.id.title); - if (title == null) { - final View header = inflater.inflate(R.layout.setup_wizard_header, list, false); - list.addHeaderView(header, null, false); - } + final SetupWizardListLayout layout = (SetupWizardListLayout) inflater.inflate( + R.layout.setup_wifi_layout, container, false); + final ListView list = layout.getListView(); mAddOtherNetworkItem = inflater.inflate(R.layout.setup_wifi_add_network, list, false); list.addFooterView(mAddOtherNetworkItem, null, true); @@ -69,19 +65,19 @@ public class WifiSettingsForSetupWizard extends WifiSettings { } }); - return view; + final NavigationBar navigationBar = layout.getNavigationBar(); + if (navigationBar != null) { + WifiSetupActivity activity = (WifiSetupActivity) getActivity(); + activity.onNavigationBarCreated(navigationBar); + } + + return layout; } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); - getView().setSystemUiVisibility( - View.STATUS_BAR_DISABLE_HOME | - View.STATUS_BAR_DISABLE_RECENT | - View.STATUS_BAR_DISABLE_NOTIFICATION_ALERTS | - View.STATUS_BAR_DISABLE_CLOCK); - if (hasNextButton()) { getNextButton().setVisibility(View.GONE); } diff --git a/src/com/android/settings/wifi/WifiSetupActivity.java b/src/com/android/settings/wifi/WifiSetupActivity.java index 7d7fe3b..4f5d5f6 100644 --- a/src/com/android/settings/wifi/WifiSetupActivity.java +++ b/src/com/android/settings/wifi/WifiSetupActivity.java @@ -35,11 +35,10 @@ import android.util.Log; import com.android.settings.ButtonBarHandler; import com.android.settings.R; import com.android.settings.SetupWizardUtils; -import com.android.setupwizard.navigationbar.SetupWizardNavBar; -import com.android.setupwizard.navigationbar.SetupWizardNavBar.NavigationBarListener; +import com.android.setupwizardlib.view.NavigationBar; public class WifiSetupActivity extends WifiPickerActivity - implements ButtonBarHandler, NavigationBarListener { + implements ButtonBarHandler, NavigationBar.NavigationBarListener { private static final String TAG = "WifiSetupActivity"; // this boolean extra specifies whether to auto finish when connection is established @@ -72,7 +71,7 @@ public class WifiSetupActivity extends WifiPickerActivity // Whether the device is connected to WiFi private boolean mWifiConnected; - private SetupWizardNavBar mNavigationBar; + private NavigationBar mNavigationBar; private IntentFilter mFilter = new IntentFilter(); private final BroadcastReceiver mReceiver = new BroadcastReceiver() { @@ -209,9 +208,9 @@ public class WifiSetupActivity extends WifiPickerActivity } } - @Override - public void onNavigationBarCreated(final SetupWizardNavBar bar) { + public void onNavigationBarCreated(final NavigationBar bar) { mNavigationBar = bar; + bar.setNavigationBarListener(this); SetupWizardUtils.setImmersiveMode(this); } |