summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorSetup Wizard Team <android-setup-team-eng@google.com>2021-01-12 20:05:34 +0800
committerpastychang <pastychang@google.com>2021-01-12 20:43:08 +0800
commitaea92c40b741ad5936fff31158c19c79e8c7d270 (patch)
treec1f9d515c03b3cfb67e962eadeca3db2eff560ac /main
parent2a24a72817b9286934f04ddf62709929fae46217 (diff)
downloadsetupdesign-aea92c40b741ad5936fff31158c19c79e8c7d270.tar.gz
Import updated Android Setupdesign Library 351341431
Copied from google3/third_party/java_src/android_libs/setupdesign Test: mm Included changes: - 351341431 [SetupDesign] Add new landscape layout for GlifPreference... - 351303342 [SetupCompat] Extract the default value from setupcompat - 351273540 [GlifLoadingLayout] Implement empty layout - 350731251 [SetupDesign] Add new landscape layout for GlifListLayout - 350721878 [BC][Stencil] Add partner resource for the content paddin... - 350709115 [SetupDesign] Add new landscape layout for GlifRecyclerLa... - 350704461 Automated g4 rollback of changelist 348989675. - 350512138 [SetupDesign] Suport new landscape layout for GlifLayout - 350487129 [BC][Tranisition] Add debug info and parameter check on t... - 350324972 Migrate Network activity to DescriptionMixin - 350055775 Refactor the public APIs for BC layout - 350054492 [GlifLoadingLayout] Create build target for GlifLoadingLa... PiperOrigin-RevId: 351341431 Change-Id: I4b1d6d0f5d053f235a4d6392bbc3d305491dec85
Diffstat (limited to 'main')
-rw-r--r--main/res/layout-land-v30/sud_glif_list_template_content_s.xml82
-rw-r--r--main/res/layout-land-v30/sud_glif_preference_recycler_view_s.xml26
-rw-r--r--main/res/layout-land-v30/sud_glif_preference_template_content_s.xml76
-rw-r--r--main/res/layout-land-v30/sud_glif_recycler_template_content_s.xml83
-rw-r--r--main/res/layout-land-v30/sud_glif_template_content_s.xml102
-rw-r--r--main/res/layout-v30/sud_glif_list_template_compact_s.xml26
-rw-r--r--main/res/layout-v30/sud_glif_list_template_content_s.xml26
-rw-r--r--main/res/layout-v30/sud_glif_preference_recycler_view_s.xml27
-rw-r--r--main/res/layout-v30/sud_glif_preference_template_compact_s.xml27
-rw-r--r--main/res/layout-v30/sud_glif_preference_template_content_s.xml26
-rw-r--r--main/res/layout-v30/sud_glif_recycler_template_compact_s.xml26
-rw-r--r--main/res/layout-v30/sud_glif_recycler_template_content_s.xml26
-rw-r--r--main/res/layout-v30/sud_glif_template_compact_s.xml26
-rw-r--r--main/res/layout-v30/sud_glif_template_content_s.xml9
-rw-r--r--main/res/layout/sud_glif_header.xml2
-rw-r--r--main/res/values-v30/layouts.xml44
-rw-r--r--main/res/values/dimens.xml3
-rw-r--r--main/res/values/layouts.xml1
-rw-r--r--main/res/values/styles.xml6
-rw-r--r--main/src/com/google/android/setupdesign/GlifLayout.java44
-rw-r--r--main/src/com/google/android/setupdesign/GlifListLayout.java8
-rw-r--r--main/src/com/google/android/setupdesign/GlifPreferenceLayout.java22
-rw-r--r--main/src/com/google/android/setupdesign/GlifRecyclerLayout.java8
-rw-r--r--main/src/com/google/android/setupdesign/items/DescriptionItem.java3
-rw-r--r--main/src/com/google/android/setupdesign/items/ExpandableSwitchItem.java5
-rw-r--r--main/src/com/google/android/setupdesign/items/Item.java19
-rw-r--r--main/src/com/google/android/setupdesign/template/DescriptionMixin.java29
-rw-r--r--main/src/com/google/android/setupdesign/transition/TransitionHelper.java14
-rw-r--r--main/src/com/google/android/setupdesign/util/ContentStyler.java9
-rw-r--r--main/src/com/google/android/setupdesign/util/HeaderAreaStyler.java99
-rw-r--r--main/src/com/google/android/setupdesign/util/LayoutStyler.java10
-rw-r--r--main/src/com/google/android/setupdesign/util/MessageWarning.java2
32 files changed, 834 insertions, 82 deletions
diff --git a/main/res/layout-land-v30/sud_glif_list_template_content_s.xml b/main/res/layout-land-v30/sud_glif_list_template_content_s.xml
new file mode 100644
index 0000000..99b0cce
--- /dev/null
+++ b/main/res/layout-land-v30/sud_glif_list_template_content_s.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2021 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:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:orientation="horizontal">
+
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:orientation="vertical">
+
+ <ViewStub
+ android:id="@+id/sud_layout_sticky_header"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+ <com.google.android.setupdesign.view.BottomScrollView
+ android:id="@+id/sud_header_scroll_view"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:fillViewport="true"
+ android:scrollbarThumbVertical="@null"
+ android:scrollbarThumbHorizontal="@null">
+
+ <include layout="@layout/sud_glif_header" />
+
+ </com.google.android.setupdesign.view.BottomScrollView>
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:orientation="vertical">
+
+ <!-- Ignore UnusedAttribute: scrollIndicators is new in M. Default to no indicators in
+ older versions. -->
+ <com.google.android.setupdesign.view.StickyHeaderListView
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:id="@android:id/list"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:scrollIndicators="?attr/sudScrollIndicators"
+ tools:ignore="UnusedAttribute" />
+
+ </LinearLayout>
+
+ </LinearLayout>
+
+ <ViewStub
+ android:id="@+id/suc_layout_footer"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+</LinearLayout>
diff --git a/main/res/layout-land-v30/sud_glif_preference_recycler_view_s.xml b/main/res/layout-land-v30/sud_glif_preference_recycler_view_s.xml
new file mode 100644
index 0000000..241f6e5
--- /dev/null
+++ b/main/res/layout-land-v30/sud_glif_preference_recycler_view_s.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2021 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.
+-->
+
+<!-- TODO : move to "layout-land-v31" and change name to "sud_glif_preference_recycler_view_s.xml" -->
+<com.google.android.setupdesign.view.HeaderRecyclerView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:id="@+id/sud_recycler_view"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:clipChildren="false"
+ android:scrollbars="vertical" />
diff --git a/main/res/layout-land-v30/sud_glif_preference_template_content_s.xml b/main/res/layout-land-v30/sud_glif_preference_template_content_s.xml
new file mode 100644
index 0000000..1335afd
--- /dev/null
+++ b/main/res/layout-land-v30/sud_glif_preference_template_content_s.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2021 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">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:orientation="horizontal">
+
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:orientation="vertical">
+
+ <ViewStub
+ android:id="@+id/sud_layout_sticky_header"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+ <com.google.android.setupdesign.view.BottomScrollView
+ android:id="@+id/sud_header_scroll_view"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:fillViewport="true"
+ android:scrollbarThumbVertical="@null"
+ android:scrollbarThumbHorizontal="@null">
+
+ <include layout="@layout/sud_glif_header" />
+
+ </com.google.android.setupdesign.view.BottomScrollView>
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:orientation="vertical">
+
+ <FrameLayout
+ android:id="@+id/sud_layout_content"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1" />
+
+ </LinearLayout>
+
+ </LinearLayout>
+
+ <ViewStub
+ android:id="@+id/suc_layout_footer"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+</LinearLayout>
diff --git a/main/res/layout-land-v30/sud_glif_recycler_template_content_s.xml b/main/res/layout-land-v30/sud_glif_recycler_template_content_s.xml
new file mode 100644
index 0000000..60ca5ef
--- /dev/null
+++ b/main/res/layout-land-v30/sud_glif_recycler_template_content_s.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2021 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:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:orientation="horizontal">
+
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:orientation="vertical">
+
+ <ViewStub
+ android:id="@+id/sud_layout_sticky_header"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+ <com.google.android.setupdesign.view.BottomScrollView
+ android:id="@+id/sud_header_scroll_view"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:fillViewport="true"
+ android:scrollbarThumbVertical="@null"
+ android:scrollbarThumbHorizontal="@null">
+
+ <include layout="@layout/sud_glif_header" />
+
+ </com.google.android.setupdesign.view.BottomScrollView>
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:orientation="vertical">
+
+ <!-- Ignore UnusedAttribute: scrollIndicators is new in M. Default to no indicators in
+ older versions. -->
+ <com.google.android.setupdesign.view.HeaderRecyclerView
+ android:id="@+id/sud_recycler_view"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:scrollbars="vertical"
+ android:scrollIndicators="?attr/sudScrollIndicators"
+ tools:ignore="UnusedAttribute" />
+
+ </LinearLayout>
+
+ </LinearLayout>
+
+ <ViewStub
+ android:id="@+id/suc_layout_footer"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+</LinearLayout>
diff --git a/main/res/layout-land-v30/sud_glif_template_content_s.xml b/main/res/layout-land-v30/sud_glif_template_content_s.xml
new file mode 100644
index 0000000..0399e68
--- /dev/null
+++ b/main/res/layout-land-v30/sud_glif_template_content_s.xml
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2021 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:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:orientation="horizontal">
+
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:orientation="vertical">
+
+ <ViewStub
+ android:id="@+id/sud_layout_sticky_header"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+ <com.google.android.setupdesign.view.BottomScrollView
+ android:id="@+id/sud_header_scroll_view"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:fillViewport="true"
+ android:scrollbarThumbVertical="@null"
+ android:scrollbarThumbHorizontal="@null">
+
+ <include layout="@layout/sud_glif_header" />
+
+ </com.google.android.setupdesign.view.BottomScrollView>
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:orientation="vertical">
+
+ <!-- Ignore UnusedAttribute: scrollIndicators is new in M.
+ Default to no indicators in older versions. -->
+ <com.google.android.setupdesign.view.BottomScrollView
+ android:id="@+id/sud_scroll_view"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:fillViewport="true"
+ android:scrollIndicators="?attr/sudScrollIndicators"
+ tools:ignore="UnusedAttribute">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <FrameLayout
+ android:id="@+id/sud_layout_content"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1" />
+
+ <ViewStub
+ android:id="@+id/sud_layout_illustration_progress_stub"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:inflatedId="@+id/sud_layout_progress_illustration"
+ android:layout="@layout/sud_progress_illustration_layout" />
+ </LinearLayout>
+
+ </com.google.android.setupdesign.view.BottomScrollView>
+
+ </LinearLayout>
+
+ </LinearLayout>
+
+ <ViewStub
+ android:id="@+id/suc_layout_footer"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+</LinearLayout>
diff --git a/main/res/layout-v30/sud_glif_list_template_compact_s.xml b/main/res/layout-v30/sud_glif_list_template_compact_s.xml
new file mode 100644
index 0000000..da5c143
--- /dev/null
+++ b/main/res/layout-v30/sud_glif_list_template_compact_s.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2021 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.google.android.setupcompat.view.StatusBarBackgroundLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/suc_layout_status"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <include layout="@layout/sud_glif_list_template_content_s" />
+
+</com.google.android.setupcompat.view.StatusBarBackgroundLayout>
diff --git a/main/res/layout-v30/sud_glif_list_template_content_s.xml b/main/res/layout-v30/sud_glif_list_template_content_s.xml
new file mode 100644
index 0000000..d88233b
--- /dev/null
+++ b/main/res/layout-v30/sud_glif_list_template_content_s.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2021 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">
+
+ <include layout="@layout/sud_glif_list_template_content" />
+
+</LinearLayout>
diff --git a/main/res/layout-v30/sud_glif_preference_recycler_view_s.xml b/main/res/layout-v30/sud_glif_preference_recycler_view_s.xml
new file mode 100644
index 0000000..c8c85da
--- /dev/null
+++ b/main/res/layout-v30/sud_glif_preference_recycler_view_s.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2021 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.
+-->
+
+<!-- TODO : remove this file to use "sud_glif_preference_recycler_view.xml" directly. -->
+<com.google.android.setupdesign.view.HeaderRecyclerView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:id="@+id/sud_recycler_view"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:clipChildren="false"
+ android:scrollbars="vertical"
+ app:sudHeader="@layout/sud_glif_header" />
diff --git a/main/res/layout-v30/sud_glif_preference_template_compact_s.xml b/main/res/layout-v30/sud_glif_preference_template_compact_s.xml
new file mode 100644
index 0000000..4d6ccd9
--- /dev/null
+++ b/main/res/layout-v30/sud_glif_preference_template_compact_s.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2021 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.google.android.setupcompat.view.StatusBarBackgroundLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/suc_layout_status"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <!-- TODO : change to "@layout/sud_glif_preference_template_content" -->
+ <include layout="@layout/sud_glif_preference_template_content_s" />
+
+</com.google.android.setupcompat.view.StatusBarBackgroundLayout>
diff --git a/main/res/layout-v30/sud_glif_preference_template_content_s.xml b/main/res/layout-v30/sud_glif_preference_template_content_s.xml
new file mode 100644
index 0000000..870b2ba
--- /dev/null
+++ b/main/res/layout-v30/sud_glif_preference_template_content_s.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2021 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">
+
+ <include layout="@layout/sud_glif_blank_template_content" />
+
+</LinearLayout>
diff --git a/main/res/layout-v30/sud_glif_recycler_template_compact_s.xml b/main/res/layout-v30/sud_glif_recycler_template_compact_s.xml
new file mode 100644
index 0000000..5e4e390
--- /dev/null
+++ b/main/res/layout-v30/sud_glif_recycler_template_compact_s.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2021 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.google.android.setupcompat.view.StatusBarBackgroundLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/suc_layout_status"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <include layout="@layout/sud_glif_recycler_template_content_s" />
+
+</com.google.android.setupcompat.view.StatusBarBackgroundLayout>
diff --git a/main/res/layout-v30/sud_glif_recycler_template_content_s.xml b/main/res/layout-v30/sud_glif_recycler_template_content_s.xml
new file mode 100644
index 0000000..2572197
--- /dev/null
+++ b/main/res/layout-v30/sud_glif_recycler_template_content_s.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2021 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">
+
+ <include layout="@layout/sud_glif_recycler_template_content" />
+
+</LinearLayout>
diff --git a/main/res/layout-v30/sud_glif_template_compact_s.xml b/main/res/layout-v30/sud_glif_template_compact_s.xml
new file mode 100644
index 0000000..0e1e6a4
--- /dev/null
+++ b/main/res/layout-v30/sud_glif_template_compact_s.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2021 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.google.android.setupcompat.view.StatusBarBackgroundLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/suc_layout_status"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <include layout="@layout/sud_glif_template_content_s" />
+
+</com.google.android.setupcompat.view.StatusBarBackgroundLayout>
diff --git a/main/res/layout-v30/sud_glif_template_content_s.xml b/main/res/layout-v30/sud_glif_template_content_s.xml
new file mode 100644
index 0000000..faab147
--- /dev/null
+++ b/main/res/layout-v30/sud_glif_template_content_s.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <include layout="@layout/sud_glif_template_content" />
+
+</LinearLayout> \ No newline at end of file
diff --git a/main/res/layout/sud_glif_header.xml b/main/res/layout/sud_glif_header.xml
index ea20993..0390f84 100644
--- a/main/res/layout/sud_glif_header.xml
+++ b/main/res/layout/sud_glif_header.xml
@@ -47,7 +47,7 @@
android:inflatedId="@+id/sud_layout_progress"
android:layout="@layout/sud_progress_bar" />
- <TextView
+ <com.google.android.setupdesign.view.RichTextView
android:id="@+id/sud_layout_subtitle"
style="@style/SudGlifDescription"
android:layout_width="match_parent"
diff --git a/main/res/values-v30/layouts.xml b/main/res/values-v30/layouts.xml
new file mode 100644
index 0000000..c966fd3
--- /dev/null
+++ b/main/res/values-v30/layouts.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2021 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 xmlns:tools="http://schemas.android.com/tools">
+
+ <!-- template for SDK S+, it provides for new template layout for landscape mode and keeps unchanged for the portrait layout. -->
+ <!-- TODO : Use "values-land-v31" folder directly when SDK & S device ready.
+ - delete "sud_glif_template_s" & "sud_glif_template_compact_s"
+ - move "sud_glif_template_content_s" into "values-land-v31" -->
+ <item name="sud_glif_template_s" type="layout">@layout/sud_glif_template_compact_s</item>
+
+ <!-- TODO : Use "values-land-v31" folder directly when SDK & S device ready.
+ - delete the item "sud_glif_recycler_template_s" & the file "sud_glif_recycler_template_compact_s.xml"
+ - move "sud_glif_recycler_template_content_s.xml" into "values-land-v31" and rename to "sud_glif_recycler_template_content.xml" -->
+ <item name="sud_glif_recycler_template_s" type="layout">@layout/sud_glif_recycler_template_compact_s</item>
+
+ <!-- TODO : Use "values-land-v31" folder directly when SDK & S device ready.
+ - delete the item "sud_glif_list_template_s" & the file "sud_glif_list_template_compact_s.xml"
+ - move "sud_glif_list_template_content_s.xml" into "layout-land-v31" and rename to "sud_glif_list_template_content.xml" -->
+ <item name="sud_glif_list_template_s" type="layout">@layout/sud_glif_list_template_compact_s</item>
+
+ <!-- TODO : Use "values-land-v31" folder directly when SDK & S device ready.
+ - move the item "sud_glif_preference_template_s" & the content "sud_glif_preference_template_compact_s" into the file "values-v31/layouts.xml",
+ change itme name to "sud_glif_preference_template" & the content name to "sud_glif_preference_template_compact"
+ - move "/layout-land-v30/sud_glif_preference_template_content_s.xml" into "layout-land-v31" and rename to "sud_glif_preference_template_content.xml"
+ - move "/layout-v30/sud_glif_preference_template_compact_s.xml" into "layout-land-v31" and rename to "sud_glif_preference_template_compact.xml" -->
+ <item name="sud_glif_preference_template_s" type="layout">@layout/sud_glif_preference_template_compact_s</item>
+
+</resources>
+
diff --git a/main/res/values/dimens.xml b/main/res/values/dimens.xml
index 670743a..f3b45b1 100644
--- a/main/res/values/dimens.xml
+++ b/main/res/values/dimens.xml
@@ -57,6 +57,9 @@
<dimen name="sud_description_margin_bottom_lists">24dp</dimen>
<dimen name="sud_description_line_spacing_extra">4sp</dimen>
<dimen name="sud_description_text_size">16sp</dimen>
+ <!-- This value is the margin bottom difference between DescriptionItem and DescriptionMixin. -->
+ <dimen name="sud_description_margin_top_extra">1dp</dimen>
+ <dimen name="sud_description_margin_bottom_extra">12dp</dimen>
<!-- TODO: Remove sud_description_glif_margin_xxx once all apps migrate to sud_glif_description_margin_xxx -->
<dimen name="sud_description_glif_margin_top">3dp</dimen>
diff --git a/main/res/values/layouts.xml b/main/res/values/layouts.xml
index cf37c37..910965f 100644
--- a/main/res/values/layouts.xml
+++ b/main/res/values/layouts.xml
@@ -53,4 +53,3 @@
<item name="sud_glif_preference_template" type="layout">@layout/sud_glif_blank_template_compact</item>
<item name="sud_glif_recycler_template" type="layout">@layout/sud_glif_recycler_template_compact</item>
</resources>
-
diff --git a/main/res/values/styles.xml b/main/res/values/styles.xml
index f348651..5e26ce9 100644
--- a/main/res/values/styles.xml
+++ b/main/res/values/styles.xml
@@ -161,6 +161,9 @@
<item name="sucFooterBarPaddingVertical">@dimen/sud_glif_footer_padding_vertical</item>
<item name="sucFooterBarPaddingStart">@dimen/sud_glif_footer_padding_start</item>
<item name="sucFooterBarPaddingEnd">@dimen/sud_glif_footer_padding_end</item>
+ <item name="sucFooterBarMinHeight">@dimen/sud_glif_footer_min_height</item>
+ <item name="sucFooterButtonPaddingStart">@dimen/sud_glif_button_padding</item>
+ <item name="sucFooterButtonPaddingEnd">@dimen/sud_glif_button_padding</item>
</style>
<style name="SudThemeGlif" parent="SudBaseThemeGlif"/>
@@ -226,6 +229,9 @@
<item name="sucFooterBarPaddingVertical">@dimen/sud_glif_footer_padding_vertical</item>
<item name="sucFooterBarPaddingStart">@dimen/sud_glif_footer_padding_start</item>
<item name="sucFooterBarPaddingEnd">@dimen/sud_glif_footer_padding_end</item>
+ <item name="sucFooterBarMinHeight">@dimen/sud_glif_footer_min_height</item>
+ <item name="sucFooterButtonPaddingStart">@dimen/sud_glif_button_padding</item>
+ <item name="sucFooterButtonPaddingEnd">@dimen/sud_glif_button_padding</item>
</style>
<style name="SudThemeGlif.Light" parent="SudBaseThemeGlif.Light"/>
diff --git a/main/src/com/google/android/setupdesign/GlifLayout.java b/main/src/com/google/android/setupdesign/GlifLayout.java
index 19eb50a..a5aeea8 100644
--- a/main/src/com/google/android/setupdesign/GlifLayout.java
+++ b/main/src/com/google/android/setupdesign/GlifLayout.java
@@ -48,6 +48,8 @@ import com.google.android.setupdesign.template.RequireScrollMixin;
import com.google.android.setupdesign.template.ScrollViewScrollHandlingDelegate;
import com.google.android.setupdesign.util.DescriptionStyler;
import com.google.android.setupdesign.util.LayoutStyler;
+import com.google.android.setupdesign.util.MessageWarning;
+import com.google.android.setupdesign.util.PartnerStyleHelper;
/**
* Layout for the GLIF theme used in Setup Wizard for N.
@@ -138,13 +140,14 @@ public class GlifLayout extends PartnerCustomizationLayout {
View view = findManagedViewById(R.id.sud_layout_content);
if (view != null) {
// The margin of content is defined by @style/SudContentFrame. The Setupdesign library
- // cannot
- // obtain the content resource ID of the client, so the value of the content margin cannot
- // be adjusted through GlifLayout. If the margin sides are changed through the partner
- // config, it can only be based on the increased or decreased value to adjust the value of
- // pading. In this way, the value of content margin plus padding will be equal to the value
- // of partner config.
+ // cannot obtain the content resource ID of the client, so the value of the content margin
+ // cannot be adjusted through GlifLayout. If the margin sides are changed through the
+ // partner config, it can only be based on the increased or decreased value to adjust the
+ // value of pading. In this way, the value of content margin plus padding will be equal to
+ // the value of partner config.
LayoutStyler.applyPartnerCustomizationExtraPaddingStyle(view);
+
+ applyPartnerCustomizationContentPaddingStyle(view);
}
}
@@ -188,7 +191,12 @@ public class GlifLayout extends PartnerCustomizationLayout {
@Override
protected View onInflateTemplate(LayoutInflater inflater, @LayoutRes int template) {
if (template == 0) {
- template = R.layout.sud_glif_template;
+ // TODO : use "values-land-v31" folder for sud_glif_template_s directly.
+ if (MessageWarning.isAtLeastS()) {
+ template = R.layout.sud_glif_template_s;
+ } else {
+ template = R.layout.sud_glif_template;
+ }
}
return inflateTemplate(inflater, R.style.SudThemeGlif_Light, template);
}
@@ -365,4 +373,26 @@ public class GlifLayout extends PartnerCustomizationLayout {
.getColor(getContext(), PartnerConfig.CONFIG_LAYOUT_BACKGROUND_COLOR);
this.getRootView().setBackgroundColor(color);
}
+
+ @TargetApi(VERSION_CODES.JELLY_BEAN_MR1)
+ private static void applyPartnerCustomizationContentPaddingStyle(View view) {
+ Context context = view.getContext();
+ boolean partnerPaddingTopAvailable =
+ PartnerConfigHelper.get(context)
+ .isPartnerConfigAvailable(PartnerConfig.CONFIG_CONTENT_PADDING_TOP);
+
+ if (PartnerStyleHelper.shouldApplyPartnerHeavyThemeResource(view)
+ && PartnerConfigHelper.shouldApplyExtendedPartnerConfig(context)
+ && partnerPaddingTopAvailable) {
+ int paddingTop =
+ (int)
+ PartnerConfigHelper.get(context)
+ .getDimension(context, PartnerConfig.CONFIG_CONTENT_PADDING_TOP);
+
+ if (paddingTop != view.getPaddingTop()) {
+ view.setPadding(
+ view.getPaddingStart(), paddingTop, view.getPaddingEnd(), view.getPaddingBottom());
+ }
+ }
+ }
}
diff --git a/main/src/com/google/android/setupdesign/GlifListLayout.java b/main/src/com/google/android/setupdesign/GlifListLayout.java
index 31335cc..15aa14b 100644
--- a/main/src/com/google/android/setupdesign/GlifListLayout.java
+++ b/main/src/com/google/android/setupdesign/GlifListLayout.java
@@ -29,6 +29,7 @@ import android.widget.ListView;
import com.google.android.setupdesign.template.ListMixin;
import com.google.android.setupdesign.template.ListViewScrollHandlingDelegate;
import com.google.android.setupdesign.template.RequireScrollMixin;
+import com.google.android.setupdesign.util.MessageWarning;
/**
* A GLIF themed layout with a ListView. {@code android:entries} can also be used to specify an
@@ -80,7 +81,12 @@ public class GlifListLayout extends GlifLayout {
@Override
protected View onInflateTemplate(LayoutInflater inflater, int template) {
if (template == 0) {
- template = R.layout.sud_glif_list_template;
+ // TODO : use "values-land-v31" folder for sud_glif_list_template_s directly.
+ if (MessageWarning.isAtLeastS()) {
+ template = R.layout.sud_glif_list_template_s;
+ } else {
+ template = R.layout.sud_glif_list_template;
+ }
}
return super.onInflateTemplate(inflater, template);
}
diff --git a/main/src/com/google/android/setupdesign/GlifPreferenceLayout.java b/main/src/com/google/android/setupdesign/GlifPreferenceLayout.java
index f235442..166254c 100644
--- a/main/src/com/google/android/setupdesign/GlifPreferenceLayout.java
+++ b/main/src/com/google/android/setupdesign/GlifPreferenceLayout.java
@@ -24,6 +24,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.google.android.setupdesign.template.RecyclerMixin;
+import com.google.android.setupdesign.util.MessageWarning;
/**
* A layout to be used with {@code PreferenceFragment} in v14 support library. This can be specified
@@ -98,7 +99,13 @@ public class GlifPreferenceLayout extends GlifRecyclerLayout {
@Override
protected View onInflateTemplate(LayoutInflater inflater, int template) {
if (template == 0) {
- template = R.layout.sud_glif_preference_template;
+ // TODO : use "values-land-v31" folder for sud_glif_preference_template_s
+ // directly.
+ if (MessageWarning.isAtLeastS()) {
+ template = R.layout.sud_glif_preference_template_s;
+ } else {
+ template = R.layout.sud_glif_preference_template;
+ }
}
return super.onInflateTemplate(inflater, template);
}
@@ -108,8 +115,17 @@ public class GlifPreferenceLayout extends GlifRecyclerLayout {
// Inflate the recycler view here, so attributes on the decoration views can be applied
// immediately.
final LayoutInflater inflater = LayoutInflater.from(getContext());
- RecyclerView recyclerView =
- (RecyclerView) inflater.inflate(R.layout.sud_glif_preference_recycler_view, this, false);
+ RecyclerView recyclerView;
+ // TODO : use "layout-land-v31" folder for sud_glif_preference_recycler_view
+ // directly.
+ if (MessageWarning.isAtLeastS()) {
+ recyclerView =
+ (RecyclerView)
+ inflater.inflate(R.layout.sud_glif_preference_recycler_view_s, this, false);
+ } else {
+ recyclerView =
+ (RecyclerView) inflater.inflate(R.layout.sud_glif_preference_recycler_view, this, false);
+ }
recyclerMixin = new RecyclerMixin(this, recyclerView);
}
}
diff --git a/main/src/com/google/android/setupdesign/GlifRecyclerLayout.java b/main/src/com/google/android/setupdesign/GlifRecyclerLayout.java
index c74cff0..06c34bb 100644
--- a/main/src/com/google/android/setupdesign/GlifRecyclerLayout.java
+++ b/main/src/com/google/android/setupdesign/GlifRecyclerLayout.java
@@ -30,6 +30,7 @@ import android.view.ViewGroup;
import com.google.android.setupdesign.template.RecyclerMixin;
import com.google.android.setupdesign.template.RecyclerViewScrollHandlingDelegate;
import com.google.android.setupdesign.template.RequireScrollMixin;
+import com.google.android.setupdesign.util.MessageWarning;
/**
* A GLIF themed layout with a RecyclerView. {@code android:entries} can also be used to specify an
@@ -81,7 +82,12 @@ public class GlifRecyclerLayout extends GlifLayout {
@Override
protected View onInflateTemplate(LayoutInflater inflater, int template) {
if (template == 0) {
- template = R.layout.sud_glif_recycler_template;
+ // TODO : use "values-land-v31" folder for sud_glif_recycler_template_s directly.
+ if (MessageWarning.isAtLeastS()) {
+ template = R.layout.sud_glif_recycler_template_s;
+ } else {
+ template = R.layout.sud_glif_recycler_template;
+ }
}
return super.onInflateTemplate(inflater, template);
}
diff --git a/main/src/com/google/android/setupdesign/items/DescriptionItem.java b/main/src/com/google/android/setupdesign/items/DescriptionItem.java
index 509ddcb..36ccfb9 100644
--- a/main/src/com/google/android/setupdesign/items/DescriptionItem.java
+++ b/main/src/com/google/android/setupdesign/items/DescriptionItem.java
@@ -29,7 +29,10 @@ import com.google.android.setupdesign.util.DescriptionStyler;
/**
* Definition of an item in an {@link ItemHierarchy}. An item is usually defined in XML and inflated
* using {@link ItemInflater}.
+ *
+ * @deprecated Use {@link com.google.android.setupdesign.template.DescriptionMixin} instead.
*/
+@Deprecated
public class DescriptionItem extends Item {
private boolean partnerDescriptionHeavyStyle = false;
diff --git a/main/src/com/google/android/setupdesign/items/ExpandableSwitchItem.java b/main/src/com/google/android/setupdesign/items/ExpandableSwitchItem.java
index 78cf0a9..29eaf23 100644
--- a/main/src/com/google/android/setupdesign/items/ExpandableSwitchItem.java
+++ b/main/src/com/google/android/setupdesign/items/ExpandableSwitchItem.java
@@ -36,7 +36,6 @@ import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.TextView;
import com.google.android.setupdesign.R;
import com.google.android.setupdesign.util.LayoutStyler;
-import com.google.android.setupdesign.util.PartnerStyleHelper;
import com.google.android.setupdesign.view.CheckableLinearLayout;
/**
@@ -182,9 +181,7 @@ public class ExpandableSwitchItem extends SwitchItem
// switch on the right, but not the item itself.
view.setFocusable(false);
- if (PartnerStyleHelper.shouldApplyPartnerHeavyThemeResource(view)) {
- LayoutStyler.applyPartnerCustomizationLayoutPaddingStyle(content);
- }
+ LayoutStyler.applyPartnerCustomizationLayoutPaddingStyle(content);
}
@Override
diff --git a/main/src/com/google/android/setupdesign/items/Item.java b/main/src/com/google/android/setupdesign/items/Item.java
index d3e6a8c..fd3f2eb 100644
--- a/main/src/com/google/android/setupdesign/items/Item.java
+++ b/main/src/com/google/android/setupdesign/items/Item.java
@@ -32,7 +32,6 @@ import androidx.annotation.Nullable;
import com.google.android.setupdesign.R;
import com.google.android.setupdesign.util.ItemStyler;
import com.google.android.setupdesign.util.LayoutStyler;
-import com.google.android.setupdesign.util.PartnerStyleHelper;
/**
* Definition of an item in an {@link ItemHierarchy}. An item is usually defined in XML and inflated
@@ -204,17 +203,15 @@ public class Item extends AbstractItem {
view.setId(getViewId());
- if (PartnerStyleHelper.shouldApplyPartnerHeavyThemeResource(view)) {
- // ExpandableSwitchItem uses its child view to apply the style SudItemContainer. It is not
- // possible to directly adjust the padding start/end of the item's layout here. It needs to
- // get its child view to adjust it first, so skip the Layout padding adjustment.
- // If the item view is a header layout, it doesn't need to adjust the layout padding start/end
- // here. It will be adjusted by HeaderMixin.
- if (!(this instanceof ExpandableSwitchItem) && view.getId() != R.id.sud_layout_header) {
- LayoutStyler.applyPartnerCustomizationLayoutPaddingStyle(view);
- }
- ItemStyler.applyPartnerCustomizationItemStyle(view);
+ // ExpandableSwitchItem uses its child view to apply the style SudItemContainer. It is not
+ // possible to directly adjust the padding start/end of the item's layout here. It needs to
+ // get its child view to adjust it first, so skip the Layout padding adjustment.
+ // If the item view is a header layout, it doesn't need to adjust the layout padding start/end
+ // here. It will be adjusted by HeaderMixin.
+ if (!(this instanceof ExpandableSwitchItem) && view.getId() != R.id.sud_layout_header) {
+ LayoutStyler.applyPartnerCustomizationLayoutPaddingStyle(view);
}
+ ItemStyler.applyPartnerCustomizationItemStyle(view);
}
/**
diff --git a/main/src/com/google/android/setupdesign/template/DescriptionMixin.java b/main/src/com/google/android/setupdesign/template/DescriptionMixin.java
index b78ee1f..983274f 100644
--- a/main/src/com/google/android/setupdesign/template/DescriptionMixin.java
+++ b/main/src/com/google/android/setupdesign/template/DescriptionMixin.java
@@ -16,10 +16,12 @@
package com.google.android.setupdesign.template;
+import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.View;
+import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.AttrRes;
import androidx.annotation.NonNull;
@@ -157,4 +159,31 @@ public class DescriptionMixin implements Mixin {
final TextView titleView = getTextView();
return titleView != null ? titleView.getTextColors() : null;
}
+
+ /**
+ * Call this method ONLY when a layout migrates from {@link
+ * com.google.android.setupdesign.items.DescriptionItem} to {@link DescriptionMixin}.
+ *
+ * <p>If a screen is migrated from {@link com.google.android.setupdesign.items.DescriptionItem} it
+ * will looks slightly different from the original UI. This method helps keeping the UI consistent
+ * with the original UI.
+ */
+ public void adjustLegacyDescriptionItem() {
+ final TextView titleView = getTextView();
+ final Context context = titleView.getContext();
+
+ final ViewGroup.LayoutParams lp = titleView.getLayoutParams();
+ if (lp instanceof ViewGroup.MarginLayoutParams) {
+ final ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) lp;
+ int extraBottomMargin =
+ (int) context.getResources().getDimension(R.dimen.sud_description_margin_bottom_extra);
+ int extraTopMargin =
+ (int) context.getResources().getDimension(R.dimen.sud_description_margin_top_extra);
+ mlp.setMargins(
+ mlp.leftMargin,
+ mlp.topMargin + extraTopMargin,
+ mlp.rightMargin,
+ mlp.bottomMargin + extraBottomMargin);
+ }
+ }
}
diff --git a/main/src/com/google/android/setupdesign/transition/TransitionHelper.java b/main/src/com/google/android/setupdesign/transition/TransitionHelper.java
index 1836a11..8ce4306 100644
--- a/main/src/com/google/android/setupdesign/transition/TransitionHelper.java
+++ b/main/src/com/google/android/setupdesign/transition/TransitionHelper.java
@@ -352,6 +352,13 @@ public class TransitionHelper {
throw new IllegalArgumentException("Invalid intent=" + intent);
}
+ if ((intent.getFlags() & Intent.FLAG_ACTIVITY_NEW_TASK) == Intent.FLAG_ACTIVITY_NEW_TASK) {
+ Log.e(
+ TAG,
+ "The transition won't take effect since the WindowManager does not allow override new"
+ + " task transitions");
+ }
+
int configTransitionType =
PartnerConfigHelper.get(activity)
.getInteger(activity, PartnerConfig.CONFIG_TRANSITION_TYPE, TRANSITION_SLIDE);
@@ -389,6 +396,13 @@ public class TransitionHelper {
throw new IllegalArgumentException("Invalid intent=" + intent);
}
+ if ((intent.getFlags() & Intent.FLAG_ACTIVITY_NEW_TASK) == Intent.FLAG_ACTIVITY_NEW_TASK) {
+ Log.e(
+ TAG,
+ "The transition won't take effect since the WindowManager does not allow override new"
+ + " task transitions");
+ }
+
int configTransitionType =
PartnerConfigHelper.get(activity)
.getInteger(activity, PartnerConfig.CONFIG_TRANSITION_TYPE, TRANSITION_SLIDE);
diff --git a/main/src/com/google/android/setupdesign/util/ContentStyler.java b/main/src/com/google/android/setupdesign/util/ContentStyler.java
index 3b64fd6..185b53b 100644
--- a/main/src/com/google/android/setupdesign/util/ContentStyler.java
+++ b/main/src/com/google/android/setupdesign/util/ContentStyler.java
@@ -25,11 +25,16 @@ import com.google.android.setupdesign.util.TextViewPartnerStyler.TextPartnerConf
import java.util.Locale;
/**
- * Applies the partner style of content to the given TextView {@code contentText}. The user needs to
- * check if the {@code contentText} should apply partner heavy theme before calling this method.
+ * Applies the partner style of content to the given TextView {@code contentText}. The theme should
+ * set partner heavy theme first, and then the partner style of content would be applied. The user
+ * can also check if the {@code contentText} should apply partner heavy theme before calling this
+ * method.
*/
public final class ContentStyler {
public static void applyPartnerCustomizationStyle(TextView contentText) {
+ if (!PartnerStyleHelper.shouldApplyPartnerHeavyThemeResource(contentText)) {
+ return;
+ }
TextViewPartnerStyler.applyPartnerCustomizationStyle(
contentText,
diff --git a/main/src/com/google/android/setupdesign/util/HeaderAreaStyler.java b/main/src/com/google/android/setupdesign/util/HeaderAreaStyler.java
index efeff97..6407b5c 100644
--- a/main/src/com/google/android/setupdesign/util/HeaderAreaStyler.java
+++ b/main/src/com/google/android/setupdesign/util/HeaderAreaStyler.java
@@ -137,38 +137,45 @@ public final class HeaderAreaStyler {
}
/**
- * Applies the partner style of header area to the given layout {@code headerArea}.
+ * Applies the partner style of header area to the given layout {@code headerArea}. The theme
+ * should set partner heavy theme first, and then the partner style of header would be applied. As
+ * for the margin bottom of header, it would aslo be appied when extended parter config is
+ * enabled.
*
* @param headerArea A ViewGroup would apply the partner style of header area
*/
public static void applyPartnerCustomizationHeaderAreaStyle(ViewGroup headerArea) {
-
if (headerArea == null) {
return;
}
- Context context = headerArea.getContext();
- int color =
- PartnerConfigHelper.get(context)
- .getColor(context, PartnerConfig.CONFIG_HEADER_AREA_BACKGROUND_COLOR);
- headerArea.setBackgroundColor(color);
-
- if (PartnerConfigHelper.shouldApplyExtendedPartnerConfig(context)) {
- final ViewGroup.LayoutParams lp = headerArea.getLayoutParams();
- if (lp instanceof ViewGroup.MarginLayoutParams) {
- final ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) lp;
-
- int bottomMargin =
- (int)
- PartnerConfigHelper.get(context)
- .getDimension(context, PartnerConfig.CONFIG_HEADER_CONTAINER_MARGIN_BOTTOM);
- mlp.setMargins(mlp.leftMargin, mlp.topMargin, mlp.rightMargin, bottomMargin);
- headerArea.setLayoutParams(lp);
+ if (PartnerStyleHelper.shouldApplyPartnerHeavyThemeResource(headerArea)) {
+ Context context = headerArea.getContext();
+
+ int color =
+ PartnerConfigHelper.get(context)
+ .getColor(context, PartnerConfig.CONFIG_HEADER_AREA_BACKGROUND_COLOR);
+ headerArea.setBackgroundColor(color);
+
+ if (PartnerConfigHelper.shouldApplyExtendedPartnerConfig(context)) {
+ final ViewGroup.LayoutParams lp = headerArea.getLayoutParams();
+ if (lp instanceof ViewGroup.MarginLayoutParams) {
+ final ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) lp;
+
+ int bottomMargin =
+ (int)
+ PartnerConfigHelper.get(context)
+ .getDimension(context, PartnerConfig.CONFIG_HEADER_CONTAINER_MARGIN_BOTTOM);
+ mlp.setMargins(mlp.leftMargin, mlp.topMargin, mlp.rightMargin, bottomMargin);
+ headerArea.setLayoutParams(lp);
+ }
}
}
}
/**
- * Applies the partner style of header icon to the given {@code iconImage}.
+ * Applies the partner style of header icon to the given {@code iconImage}. The theme should set
+ * partner heavy theme and enable extended parter config first, and then the partner icon size
+ * would be applied.
*
* @param iconImage A ImageView would apply the partner style of header icon
* @param templateLayout The template containing this mixin
@@ -179,42 +186,40 @@ public final class HeaderAreaStyler {
return;
}
- if (PartnerStyleHelper.isPartnerLightThemeLayout(templateLayout)) {
+ if (PartnerStyleHelper.shouldApplyPartnerResource(templateLayout)) {
Context context = iconImage.getContext();
int gravity = PartnerStyleHelper.getLayoutGravity(context);
if (gravity != 0) {
setGravity(iconImage, gravity);
}
- if (!PartnerStyleHelper.isPartnerHeavyThemeLayout(templateLayout)
- || !PartnerConfigHelper.shouldApplyExtendedPartnerConfig(context)) {
- return;
- }
-
- final ViewGroup.LayoutParams lp = iconImage.getLayoutParams();
- boolean partnerConfigAvailable =
- PartnerConfigHelper.get(context)
- .isPartnerConfigAvailable(PartnerConfig.CONFIG_ICON_MARGIN_TOP);
- if (partnerConfigAvailable && lp instanceof ViewGroup.MarginLayoutParams) {
- final ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) lp;
- int topMargin =
- (int)
- PartnerConfigHelper.get(context)
- .getDimension(context, PartnerConfig.CONFIG_ICON_MARGIN_TOP);
- mlp.setMargins(mlp.leftMargin, topMargin, mlp.rightMargin, mlp.bottomMargin);
- }
+ if (PartnerStyleHelper.shouldApplyPartnerHeavyThemeResource(iconImage)
+ && PartnerConfigHelper.shouldApplyExtendedPartnerConfig(context)) {
+ final ViewGroup.LayoutParams lp = iconImage.getLayoutParams();
+ boolean partnerConfigAvailable =
+ PartnerConfigHelper.get(context)
+ .isPartnerConfigAvailable(PartnerConfig.CONFIG_ICON_MARGIN_TOP);
+ if (partnerConfigAvailable && lp instanceof ViewGroup.MarginLayoutParams) {
+ final ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) lp;
+ int topMargin =
+ (int)
+ PartnerConfigHelper.get(context)
+ .getDimension(context, PartnerConfig.CONFIG_ICON_MARGIN_TOP);
+ mlp.setMargins(mlp.leftMargin, topMargin, mlp.rightMargin, mlp.bottomMargin);
+ }
- if (PartnerConfigHelper.get(context)
- .isPartnerConfigAvailable(PartnerConfig.CONFIG_ICON_SIZE)) {
+ if (PartnerConfigHelper.get(context)
+ .isPartnerConfigAvailable(PartnerConfig.CONFIG_ICON_SIZE)) {
- checkImageType(iconImage);
+ checkImageType(iconImage);
- lp.height =
- (int)
- PartnerConfigHelper.get(context)
- .getDimension(context, PartnerConfig.CONFIG_ICON_SIZE);
- lp.width = LayoutParams.WRAP_CONTENT;
- iconImage.setScaleType(ScaleType.FIT_CENTER);
+ lp.height =
+ (int)
+ PartnerConfigHelper.get(context)
+ .getDimension(context, PartnerConfig.CONFIG_ICON_SIZE);
+ lp.width = LayoutParams.WRAP_CONTENT;
+ iconImage.setScaleType(ScaleType.FIT_CENTER);
+ }
}
}
}
diff --git a/main/src/com/google/android/setupdesign/util/LayoutStyler.java b/main/src/com/google/android/setupdesign/util/LayoutStyler.java
index 97596e1..c18e0d1 100644
--- a/main/src/com/google/android/setupdesign/util/LayoutStyler.java
+++ b/main/src/com/google/android/setupdesign/util/LayoutStyler.java
@@ -33,7 +33,9 @@ import com.google.android.setupdesign.R;
public final class LayoutStyler {
/**
- * Applies the partner layout padding style to the given view {@code view}.
+ * Applies the partner layout padding style to the given view {@code view}. The theme should set
+ * partner heavy theme and enable extended parter config first, and then the partner layout style
+ * would be applied.
*
* @param view A view would be applied partner layout padding style
*/
@@ -51,7 +53,8 @@ public final class LayoutStyler {
PartnerConfigHelper.get(context)
.isPartnerConfigAvailable(PartnerConfig.CONFIG_LAYOUT_MARGIN_END);
- if (PartnerConfigHelper.shouldApplyExtendedPartnerConfig(context)
+ if (PartnerStyleHelper.shouldApplyPartnerHeavyThemeResource(view)
+ && PartnerConfigHelper.shouldApplyExtendedPartnerConfig(context)
&& (partnerMarginStartAvailable || partnerMarginEndAvailable)) {
int paddingStart;
int paddingEnd;
@@ -100,7 +103,8 @@ public final class LayoutStyler {
PartnerConfigHelper.get(context)
.isPartnerConfigAvailable(PartnerConfig.CONFIG_LAYOUT_MARGIN_END);
- if (PartnerConfigHelper.shouldApplyExtendedPartnerConfig(context)
+ if (PartnerStyleHelper.shouldApplyPartnerHeavyThemeResource(view)
+ && PartnerConfigHelper.shouldApplyExtendedPartnerConfig(context)
&& (partnerMarginStartAvailable || partnerMarginEndAvailable)) {
int extraPaddingStart;
int extraPaddingEnd;
diff --git a/main/src/com/google/android/setupdesign/util/MessageWarning.java b/main/src/com/google/android/setupdesign/util/MessageWarning.java
index e98eb52..ca9a93b 100644
--- a/main/src/com/google/android/setupdesign/util/MessageWarning.java
+++ b/main/src/com/google/android/setupdesign/util/MessageWarning.java
@@ -35,7 +35,7 @@ public final class MessageWarning {
}
}
- private static boolean isAtLeastS() {
+ public static boolean isAtLeastS() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
return false;
}