Implement the custom style flow part 1
- Make the options horizontal scrolls, note that the picker side UI
will be vertical scroll(like Style and Grid tab)
- Adjust custom style flow pages layout, will have next cl to fine-tune
the recyclerview and options
Doc: https://docs.google.com/presentation/d/15JadcGi5k1_0znUN_XdFpU7UxeXwxjK3Y7LxvhW5ETM/edit#slide=id.g85fff7c452_6_15
Video: https://drive.google.com/file/d/1x2oc6p2TOUpO3JUSr3tkrF3fZ61PBZ-v/view?usp=sharing
Bug: 151285666
Test: manually
Change-Id: If0cbb5afa1d5e005805a8459467cda89609fd97a
diff --git a/res/layout/fragment_custom_theme_component.xml b/res/layout/fragment_custom_theme_component.xml
index cf80192..7b3549e 100644
--- a/res/layout/fragment_custom_theme_component.xml
+++ b/res/layout/fragment_custom_theme_component.xml
@@ -33,13 +33,13 @@
android:layout_height="0dp"
android:background="?android:colorPrimary"
app:layout_constrainedHeight="true"
- app:layout_constraintBottom_toTopOf="@+id/guideline"
+ app:layout_constraintBottom_toTopOf="@+id/divider"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHeight_max="@dimen/preview_pager_max_height"
- app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintVertical_bias="0.0">
+ app:layout_constraintVertical_bias="0.0"
+ app:layout_constraintHeight_percent="@dimen/preview_pager_maximum_height_ratio">
<include
android:id="@+id/component_preview_content"
@@ -58,43 +58,31 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/component_preview_container"/>
-
- <androidx.constraintlayout.widget.Guideline
- android:id="@+id/guideline"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- app:layout_constraintGuide_percent=".7"/>
-
-
+
<TextView
android:id="@+id/component_options_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="10dp"
- android:layout_marginStart="10dp"
- android:layout_marginEnd="10dp"
- android:layout_marginBottom="10dp"
+ android:layout_marginVertical="18dp"
+ android:layout_marginHorizontal="16dp"
android:textAlignment="center"
android:textAppearance="@style/TitleTextAppearance"
android:textSize="@dimen/component_options_title_size"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/component_preview_container"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintVertical_bias=".15"/>
+ app:layout_constraintBottom_toTopOf="@+id/options_container"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/options_container"
android:layout_width="match_parent"
- android:layout_height="@dimen/options_container_height"
+ android:layout_height="0dp"
android:layout_gravity="center_horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/component_options_title"
- app:layout_constraintVertical_bias=".25"/>
+ app:layout_constraintVertical_bias="1"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
diff --git a/res/layout/theme_color_option.xml b/res/layout/theme_color_option.xml
index 33e4668..7f03c21 100644
--- a/res/layout/theme_color_option.xml
+++ b/res/layout/theme_color_option.xml
@@ -15,7 +15,7 @@
limitations under the License.
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="8dp">
diff --git a/res/values-land/bools.xml b/res/values-land/bools.xml
deleted file mode 100644
index 409538d..0000000
--- a/res/values-land/bools.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-
- Copyright (C) 2019 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>
- <bool name="use_grid_for_options">true</bool>
-</resources>
\ No newline at end of file
diff --git a/res/values/bools.xml b/res/values/bools.xml
deleted file mode 100644
index 409538d..0000000
--- a/res/values/bools.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-
- Copyright (C) 2019 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>
- <bool name="use_grid_for_options">true</bool>
-</resources>
\ No newline at end of file
diff --git a/src/com/android/customization/picker/theme/CustomThemeActivity.java b/src/com/android/customization/picker/theme/CustomThemeActivity.java
index a5ce222..f9cca14 100644
--- a/src/com/android/customization/picker/theme/CustomThemeActivity.java
+++ b/src/com/android/customization/picker/theme/CustomThemeActivity.java
@@ -355,8 +355,7 @@
return CustomThemeComponentFragment.newInstance(
title,
position,
- titleResId,
- true);
+ titleResId);
}
}
diff --git a/src/com/android/customization/widget/OptionSelectorController.java b/src/com/android/customization/widget/OptionSelectorController.java
index 19dc34e..5b76b36 100644
--- a/src/com/android/customization/widget/OptionSelectorController.java
+++ b/src/com/android/customization/widget/OptionSelectorController.java
@@ -72,14 +72,14 @@
private CustomizationOption mAppliedOption;
public OptionSelectorController(RecyclerView container, List<T> options) {
- this(container, options, false, true);
+ this(container, options, true, true);
}
public OptionSelectorController(RecyclerView container, List<T> options,
boolean useGrid, boolean showCheckmark) {
mContainer = container;
mOptions = options;
- mUseGrid = container.getResources().getBoolean(R.bool.use_grid_for_options) || useGrid;
+ mUseGrid = useGrid;
mShowCheckmark = showCheckmark;
}