Landscape support 3/3
Updated previews layouts to support landscape UI.
Changed theme_preview_card layout to ConstraintLayout to
allow better support of positioning the different elements
both for cover and for other preview cards.
Bug: 125903559
Change-Id: Id38ecf097d23c09b8431e56bf5127ba353723ef0
diff --git a/res/layout/preview_card_color_content.xml b/res/layout/preview_card_color_content.xml
index 156a74d..8587652 100644
--- a/res/layout/preview_card_color_content.xml
+++ b/res/layout/preview_card_color_content.xml
@@ -16,13 +16,11 @@
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="200dp"
- android:layout_height="200dp"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
android:layout_gravity="center"
- android:gravity="center_horizontal|bottom"
- android:orientation="vertical"
- tools:showIn="@layout/theme_preview_card">
+ android:gravity="center_horizontal"
+ android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -31,56 +29,72 @@
android:orientation="horizontal">
<FrameLayout
android:layout_width="@dimen/preview_theme_icon_size"
- android:layout_height="@dimen/preview_theme_icon_size">
+ android:layout_height="@dimen/preview_theme_icon_size"
+ android:layout_weight="1">
<ImageView
android:layout_width="@dimen/preview_theme_icon_size"
android:layout_height="@dimen/preview_theme_icon_size"
+ android:layout_gravity="center"
android:id="@+id/preview_color_qs_0_bg"/>
<ImageView
android:layout_width="@dimen/preview_theme_tile_size"
android:layout_height="@dimen/preview_theme_tile_size"
+ android:layout_gravity="center"
android:id="@+id/preview_color_qs_0_icon"
- android:tint="@color/tile_enabled_icon_color"
- android:layout_gravity="center"/>
+ android:tint="@color/tile_enabled_icon_color"/>
</FrameLayout>
+ <Space
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="0" />
<FrameLayout
android:layout_width="@dimen/preview_theme_icon_size"
android:layout_height="@dimen/preview_theme_icon_size"
- android:layout_marginHorizontal="28dp">
+ android:layout_weight="1">
<ImageView
android:layout_width="@dimen/preview_theme_icon_size"
android:layout_height="@dimen/preview_theme_icon_size"
+ android:layout_gravity="center"
android:id="@+id/preview_color_qs_1_bg"/>
<ImageView
android:layout_width="@dimen/preview_theme_tile_size"
android:layout_height="@dimen/preview_theme_tile_size"
+ android:layout_gravity="center"
android:id="@+id/preview_color_qs_1_icon"
- android:tint="@color/tile_enabled_icon_color"
- android:layout_gravity="center"/>
+ android:tint="@color/tile_enabled_icon_color"/>
</FrameLayout>
+ <Space
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="0" />
<FrameLayout
android:layout_width="@dimen/preview_theme_icon_size"
- android:layout_height="@dimen/preview_theme_icon_size">
+ android:layout_height="@dimen/preview_theme_icon_size"
+ android:layout_weight="1">
<ImageView
android:layout_width="@dimen/preview_theme_icon_size"
android:layout_height="@dimen/preview_theme_icon_size"
+ android:layout_gravity="center"
android:id="@+id/preview_color_qs_2_bg"
android:tint="@color/tile_disabled_background_color"/>
<ImageView
android:layout_width="@dimen/preview_theme_tile_size"
android:layout_height="@dimen/preview_theme_tile_size"
+ android:layout_gravity="center"
android:id="@+id/preview_color_qs_2_icon"
- android:color="@color/tile_disabled_icon_color"
- android:layout_gravity="center"/>
+ android:color="@color/tile_disabled_icon_color"/>
</FrameLayout>
</LinearLayout>
+ <Space
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:orientation="horizontal"
- android:layout_marginTop="30dp"
- android:gravity="center|bottom">
+ android:gravity="center">
<SeekBar
android:id="@+id/preview_seekbar"
android:layout_height="wrap_content"
@@ -91,63 +105,63 @@
android:clickable="true"
android:max="3"/>
</LinearLayout>
+ <Space
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
- android:layout_marginTop="15dp"
android:gravity="center"
android:orientation="horizontal">
- <CheckBox
- android:id="@+id/preview_check_selected"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:checked="true"
- android:layout_gravity="center"
- android:enabled="false"/>
- <RadioButton
- android:id="@+id/preview_radio_selected"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="30dp"
- android:layout_marginRight="22dp"
- android:checked="true"
- android:layout_gravity="center"
- android:enabled="false"/>
- <Switch
- android:id="@+id/preview_toggle_selected"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:checked="true"
- android:layout_gravity="center"
- android:enabled="false"/>
+ <FrameLayout
+ android:layout_width="@dimen/preview_theme_icon_size"
+ android:layout_height="@dimen/preview_theme_icon_size"
+ android:layout_weight="1">
+ <CheckBox
+ android:id="@+id/preview_check_selected"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:checked="true"
+ android:enabled="false"/>
+ </FrameLayout>
+ <Space
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="0" />
+ <FrameLayout
+ android:layout_width="@dimen/preview_theme_icon_size"
+ android:layout_height="@dimen/preview_theme_icon_size"
+ android:layout_weight="1">
+ <RadioButton
+ android:id="@+id/preview_radio_selected"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:checked="true"
+ android:enabled="false"/>
+ </FrameLayout>
+ <Space
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="0" />
+ <FrameLayout
+ android:layout_width="@dimen/preview_theme_icon_size"
+ android:layout_height="@dimen/preview_theme_icon_size"
+ android:layout_weight="1">
+ <Switch
+ android:id="@+id/preview_toggle_selected"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:checked="true"
+ android:enabled="false"/>
+ </FrameLayout>
</LinearLayout>
- <LinearLayout
+ <Space
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="0"
- android:layout_marginTop="20dp"
- android:gravity="center"
- android:orientation="horizontal">
- <CheckBox
- android:id="@+id/preview_check_unselected"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:enabled="false"/>
- <RadioButton
- android:id="@+id/preview_radio_unselected"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="30dp"
- android:layout_marginRight="22dp"
- android:layout_gravity="center"
- android:enabled="false"/>
- <Switch
- android:id="@+id/preview_toggle_unselected"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:enabled="false"/>
- </LinearLayout>
+ android:layout_height="0dp"
+ android:layout_weight="1" />
</LinearLayout>
diff --git a/res/layout/preview_card_cover_content.xml b/res/layout/preview_card_cover_content.xml
index aa20204..d052642 100644
--- a/res/layout/preview_card_cover_content.xml
+++ b/res/layout/preview_card_cover_content.xml
@@ -14,94 +14,104 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<LinearLayout
+<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="wrap_content"
+ android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
+ android:layout_marginHorizontal="@dimen/preview_theme_cover_content_extra_margin"
android:gravity="center_horizontal"
- android:orientation="vertical"
tools:showIn="@layout/theme_preview_card">
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="0"
- android:layout_marginBottom="24dp"
- android:gravity="center|bottom"
- android:orientation="horizontal">
- <FrameLayout
- android:layout_width="@dimen/preview_theme_icon_size"
- android:layout_height="@dimen/preview_theme_icon_size"
- android:layout_marginLeft="6dp">
- <ImageView
- android:layout_width="@dimen/preview_theme_icon_size"
- android:layout_height="@dimen/preview_theme_icon_size"
- android:id="@+id/preview_color_qs_0_bg"/>
- <ImageView
- android:layout_width="@dimen/preview_theme_tile_size"
- android:layout_height="@dimen/preview_theme_tile_size"
- android:id="@+id/preview_color_qs_0_icon"
- android:tint="@color/tile_enabled_icon_color"
- android:layout_gravity="center"/>
- </FrameLayout>
- <FrameLayout
- android:layout_width="@dimen/preview_theme_icon_size"
- android:layout_height="@dimen/preview_theme_icon_size"
- android:layout_marginHorizontal="50dp">
- <ImageView
- android:layout_width="@dimen/preview_theme_icon_size"
- android:layout_height="@dimen/preview_theme_icon_size"
- android:id="@+id/preview_color_qs_1_bg"/>
- <ImageView
- android:layout_width="@dimen/preview_theme_tile_size"
- android:layout_height="@dimen/preview_theme_tile_size"
- android:id="@+id/preview_color_qs_1_icon"
- android:tint="@color/tile_enabled_icon_color"
- android:layout_gravity="center"/>
- </FrameLayout>
- <FrameLayout
- android:layout_width="@dimen/preview_theme_icon_size"
- android:layout_height="@dimen/preview_theme_icon_size"
- android:layout_marginRight="6dp">
- <ImageView
- android:layout_width="@dimen/preview_theme_icon_size"
- android:layout_height="@dimen/preview_theme_icon_size"
- android:id="@+id/preview_color_qs_2_bg"
- android:tint="@color/tile_disabled_background_color"/>
- <ImageView
- android:layout_width="@dimen/preview_theme_tile_size"
- android:layout_height="@dimen/preview_theme_tile_size"
- android:id="@+id/preview_color_qs_2_icon"
- android:color="@color/tile_disabled_icon_color"
- android:layout_gravity="center"/>
- </FrameLayout>
- </LinearLayout>
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:orientation="horizontal">
+ <FrameLayout
+ android:layout_width="@dimen/preview_theme_icon_size"
+ android:layout_height="@dimen/preview_theme_icon_size"
+ android:layout_marginLeft="6dp"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentTop="true">
<ImageView
- android:id="@+id/shape_preview_icon_0"
- android:layout_width="@dimen/preview_theme_shape_size"
- android:layout_height="@dimen/preview_theme_shape_size"
- android:layout_marginVertical="4dp"
- android:elevation="4dp"/>
+ android:layout_width="@dimen/preview_theme_icon_size"
+ android:layout_height="@dimen/preview_theme_icon_size"
+ android:id="@+id/preview_color_qs_0_bg"/>
+ <ImageView
+ android:layout_width="@dimen/preview_theme_tile_size"
+ android:layout_height="@dimen/preview_theme_tile_size"
+ android:id="@+id/preview_color_qs_0_icon"
+ android:tint="@color/tile_enabled_icon_color"
+ android:layout_gravity="center"/>
+ </FrameLayout>
+ <FrameLayout
+ android:layout_width="@dimen/preview_theme_icon_size"
+ android:layout_height="@dimen/preview_theme_icon_size"
+ android:layout_alignParentTop="true"
+ android:layout_centerHorizontal="true"
+ android:layout_gravity="center_horizontal">
+ <ImageView
+ android:layout_width="@dimen/preview_theme_icon_size"
+ android:layout_height="@dimen/preview_theme_icon_size"
+ android:layout_gravity="center"
+ android:id="@+id/preview_color_qs_1_bg"/>
+ <ImageView
+ android:layout_width="@dimen/preview_theme_tile_size"
+ android:layout_height="@dimen/preview_theme_tile_size"
+ android:id="@+id/preview_color_qs_1_icon"
+ android:tint="@color/tile_enabled_icon_color"
+ android:layout_gravity="center"/>
+ </FrameLayout>
+ <FrameLayout
+ android:layout_width="@dimen/preview_theme_icon_size"
+ android:layout_height="@dimen/preview_theme_icon_size"
+ android:layout_marginRight="6dp"
+ android:layout_alignParentRight="true"
+ android:layout_alignParentTop="true">
+ <ImageView
+ android:layout_width="@dimen/preview_theme_icon_size"
+ android:layout_height="@dimen/preview_theme_icon_size"
+ android:id="@+id/preview_color_qs_2_bg"
+ android:tint="@color/tile_disabled_background_color"/>
+ <ImageView
+ android:layout_width="@dimen/preview_theme_tile_size"
+ android:layout_height="@dimen/preview_theme_tile_size"
+ android:id="@+id/preview_color_qs_2_icon"
+ android:color="@color/tile_disabled_icon_color"
+ android:layout_gravity="center"/>
+ </FrameLayout>
+
+ <ImageView
+ android:id="@+id/shape_preview_icon_0"
+ android:layout_width="@dimen/preview_theme_shape_size"
+ android:layout_height="@dimen/preview_theme_shape_size"
+ android:layout_marginVertical="4dp"
+ android:layout_alignParentLeft="true"
+ android:layout_centerVertical="true"
+ android:elevation="4dp"/>
+ <FrameLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerVertical="true"
+ android:layout_centerHorizontal="true">
<ImageView
android:id="@+id/shape_preview_icon_1"
android:layout_width="@dimen/preview_theme_shape_size"
android:layout_height="@dimen/preview_theme_shape_size"
- android:layout_marginHorizontal="38dp"
+ android:layout_gravity="center_horizontal"
android:layout_marginVertical="4dp"
android:elevation="4dp"/>
- <ImageView
- android:id="@+id/shape_preview_icon_2"
- android:layout_width="@dimen/preview_theme_shape_size"
- android:layout_height="@dimen/preview_theme_shape_size"
- android:layout_marginVertical="4dp"
- android:layout_marginRight="2dp"
- android:elevation="4dp"/>
- </LinearLayout>
- <include layout="@layout/theme_cover_qsb"/>
-</LinearLayout>
\ No newline at end of file
+ </FrameLayout>
+ <ImageView
+ android:id="@+id/shape_preview_icon_2"
+ android:layout_width="@dimen/preview_theme_shape_size"
+ android:layout_height="@dimen/preview_theme_shape_size"
+ android:layout_marginVertical="4dp"
+ android:layout_marginRight="2dp"
+ android:layout_alignParentRight="true"
+ android:layout_centerVertical="true"
+ android:elevation="4dp"/>
+
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true">
+ <include layout="@layout/theme_cover_qsb"/>
+ </FrameLayout>
+</RelativeLayout>
\ No newline at end of file
diff --git a/res/layout/preview_card_font_content.xml b/res/layout/preview_card_font_content.xml
index d52474e..2a27b01 100644
--- a/res/layout/preview_card_font_content.xml
+++ b/res/layout/preview_card_font_content.xml
@@ -17,7 +17,7 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="wrap_content"
+ android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center_horizontal"
@@ -28,14 +28,13 @@
android:id="@+id/font_card_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginBottom="16dp"
android:gravity="center_horizontal"
android:text="@string/font_card_title"/>
<View
android:id="@+id/font_card_divider"
android:layout_width="15dp"
android:layout_height="2dp"
- android:layout_marginVertical="30dp"
+ android:layout_marginVertical="@dimen/font_preview_divider_gap"
android:background="?android:colorAccent"/>
<TextView
style="@style/FontCardBodyTextStyle"
diff --git a/res/layout/preview_card_icon_content.xml b/res/layout/preview_card_icon_content.xml
index 260d212..ce40c48 100644
--- a/res/layout/preview_card_icon_content.xml
+++ b/res/layout/preview_card_icon_content.xml
@@ -16,56 +16,81 @@
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="200dp"
- android:layout_height="136dp"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center_horizontal"
- android:orientation="vertical"
- tools:showIn="@layout/theme_preview_card">
+ android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
android:orientation="horizontal">
<ImageView
android:id="@+id/preview_icon_0"
android:layout_width="@dimen/preview_theme_icon_size"
android:layout_height="@dimen/preview_theme_icon_size"
+ android:layout_weight="1"
android:tint="@color/theme_preview_icon_color"/>
+ <Space
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="0" />
<ImageView
android:id="@+id/preview_icon_1"
android:layout_width="@dimen/preview_theme_icon_size"
android:layout_height="@dimen/preview_theme_icon_size"
- android:layout_marginHorizontal="40dp"
+ android:layout_weight="1"
android:tint="@color/theme_preview_icon_color"/>
+ <Space
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="0" />
<ImageView
android:id="@+id/preview_icon_2"
android:layout_width="@dimen/preview_theme_icon_size"
android:layout_height="@dimen/preview_theme_icon_size"
+ android:layout_weight="1"
android:tint="@color/theme_preview_icon_color"/>
</LinearLayout>
+ <Space
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1" />
<LinearLayout
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:gravity="bottom"
+ android:layout_height="wrap_content"
+ android:gravity="bottom|center_horizontal"
android:orientation="horizontal">
<ImageView
android:id="@+id/preview_icon_3"
android:layout_width="@dimen/preview_theme_icon_size"
android:layout_height="@dimen/preview_theme_icon_size"
+ android:layout_weight="1"
android:tint="@color/theme_preview_icon_color"/>
+ <Space
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="0" />
<ImageView
android:id="@+id/preview_icon_4"
android:layout_width="@dimen/preview_theme_icon_size"
android:layout_height="@dimen/preview_theme_icon_size"
- android:layout_marginHorizontal="40dp"
+ android:layout_weight="1"
android:tint="@color/theme_preview_icon_color"/>
+ <Space
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="0" />
<ImageView
android:id="@+id/preview_icon_5"
android:layout_width="@dimen/preview_theme_icon_size"
android:layout_height="@dimen/preview_theme_icon_size"
+ android:layout_weight="1"
android:tint="@color/theme_preview_icon_color"/>
</LinearLayout>
+ <Space
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1" />
</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/preview_card_shape_content.xml b/res/layout/preview_card_shape_content.xml
index 8013214..67d3526 100644
--- a/res/layout/preview_card_shape_content.xml
+++ b/res/layout/preview_card_shape_content.xml
@@ -16,63 +16,117 @@
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="wrap_content"
- android:layout_height="152dp"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center_horizontal"
- android:orientation="vertical"
- tools:showIn="@layout/theme_preview_card">
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:orientation="horizontal">
- <ImageView
- android:id="@+id/shape_preview_icon_0"
- android:layout_width="@dimen/preview_theme_shape_size"
- android:layout_height="@dimen/preview_theme_shape_size"
- android:layout_margin="4dp"
- android:elevation="4dp"/>
- <ImageView
- android:id="@+id/shape_preview_icon_1"
- android:layout_width="@dimen/preview_theme_shape_size"
- android:layout_height="@dimen/preview_theme_shape_size"
- android:layout_marginHorizontal="22dp"
- android:layout_marginVertical="4dp"
- android:elevation="4dp"/>
- <ImageView
- android:id="@+id/shape_preview_icon_2"
- android:layout_width="@dimen/preview_theme_shape_size"
- android:layout_height="@dimen/preview_theme_shape_size"
- android:layout_margin="4dp"
- android:elevation="4dp"/>
- </LinearLayout>
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_marginBottom="5dp"
- android:layout_weight="1"
- android:gravity="bottom"
- android:orientation="horizontal">
- <ImageView
- android:id="@+id/shape_preview_icon_3"
- android:layout_width="@dimen/preview_theme_shape_size"
- android:layout_height="@dimen/preview_theme_shape_size"
- android:layout_margin="4dp"
- android:elevation="4dp"/>
- <ImageView
- android:id="@+id/shape_preview_icon_4"
- android:layout_width="@dimen/preview_theme_shape_size"
- android:layout_height="@dimen/preview_theme_shape_size"
- android:layout_marginHorizontal="22dp"
- android:layout_marginVertical="4dp"
- android:elevation="4dp"/>
- <ImageView
- android:id="@+id/shape_preview_icon_5"
- android:layout_width="@dimen/preview_theme_shape_size"
- android:layout_height="@dimen/preview_theme_shape_size"
- android:layout_margin="4dp"
- android:elevation="4dp"/>
- </LinearLayout>
+ android:orientation="vertical">
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:orientation="horizontal">
+ <FrameLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1">
+ <ImageView
+ android:id="@+id/shape_preview_icon_0"
+ android:layout_width="@dimen/preview_theme_shape_size"
+ android:layout_height="@dimen/preview_theme_shape_size"
+ android:layout_gravity="center_horizontal"
+ android:layout_margin="4dp"
+ android:elevation="4dp"/>
+ </FrameLayout>
+ <Space
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="0" />
+ <FrameLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1">
+ <ImageView
+ android:id="@+id/shape_preview_icon_1"
+ android:layout_width="@dimen/preview_theme_shape_size"
+ android:layout_height="@dimen/preview_theme_shape_size"
+ android:layout_gravity="center_horizontal"
+ android:layout_margin="4dp"
+ android:elevation="4dp"/>
+ </FrameLayout>
+ <Space
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="0" />
+ <FrameLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1">
+ <ImageView
+ android:id="@+id/shape_preview_icon_2"
+ android:layout_width="@dimen/preview_theme_shape_size"
+ android:layout_height="@dimen/preview_theme_shape_size"
+ android:layout_gravity="center_horizontal"
+ android:layout_margin="4dp"
+ android:elevation="4dp"/>
+ </FrameLayout>
+ </LinearLayout>
+ <Space
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1" />
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="bottom|center_horizontal"
+ android:orientation="horizontal">
+ <FrameLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1">
+ <ImageView
+ android:id="@+id/shape_preview_icon_3"
+ android:layout_width="@dimen/preview_theme_shape_size"
+ android:layout_height="@dimen/preview_theme_shape_size"
+ android:layout_gravity="center_horizontal"
+ android:layout_margin="4dp"
+ android:elevation="4dp"/>
+ </FrameLayout>
+ <Space
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="0" />
+ <FrameLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1">
+ <ImageView
+ android:id="@+id/shape_preview_icon_4"
+ android:layout_width="@dimen/preview_theme_shape_size"
+ android:layout_height="@dimen/preview_theme_shape_size"
+ android:layout_gravity="center_horizontal"
+ android:layout_margin="4dp"
+ android:elevation="4dp"/>
+ </FrameLayout>
+ <Space
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="0" />
+ <FrameLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1">
+ <ImageView
+ android:id="@+id/shape_preview_icon_5"
+ android:layout_width="@dimen/preview_theme_shape_size"
+ android:layout_height="@dimen/preview_theme_shape_size"
+ android:layout_margin="4dp"
+ android:layout_gravity="center_horizontal"
+ android:elevation="4dp"/>
+ </FrameLayout>
+ </LinearLayout>
+ <Space
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1" />
</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/theme_preview_card.xml b/res/layout/theme_preview_card.xml
index d8cb8a9..451ee7c 100644
--- a/res/layout/theme_preview_card.xml
+++ b/res/layout/theme_preview_card.xml
@@ -29,51 +29,89 @@
android:layout_height="match_parent"
android:focusable="true">
- <LinearLayout
+ <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:paddingTop="@dimen/preview_card_padding"
android:paddingHorizontal="@dimen/preview_card_padding"
- android:orientation="vertical">
+ android:paddingTop="@dimen/preview_card_padding"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="0.5"
+ app:layout_constraintStart_toStartOf="parent">
<ViewStub
android:id="@+id/theme_preview_top_bar"
- android:layout="@layout/theme_preview_topbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginBottom="20dp"/>
+ android:layout="@layout/theme_preview_topbar"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="0.5"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"/>
- <TextView
+ <TextView
android:id="@+id/theme_preview_card_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
- android:drawablePadding="10dp"
- android:textAppearance="@style/CardTitleTextAppearance"/>
+ android:layout_marginVertical="@dimen/card_header_top_margin"
+ android:drawablePadding="12dp"
+ android:textAppearance="@style/CardTitleTextAppearance"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="0.5"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/theme_preview_top_bar"
+ app:layout_goneMarginTop="@dimen/card_header_top_margin"/>
<Space
- android:layout_width="match_parent"
+ android:id="@+id/theme_preview_content_spacer"
+ android:layout_width="0dp"
android:layout_height="0dp"
- android:layout_weight="1" />
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHeight_max="48dp"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/theme_preview_card_header"/>
<FrameLayout
android:id="@+id/theme_preview_card_body_container"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ android:layout_height="0dp"
android:layout_marginHorizontal="8dp"
- android:layout_weight="1"/>
+ android:layout_marginTop="@dimen/preview_theme_content_margin"
+ app:layout_constraintBottom_toTopOf="@+id/guideline"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHeight_max="@dimen/preview_theme_content_max_height"
+ app:layout_constraintHeight_min="@dimen/preview_theme_content_min_height"
+ app:layout_constraintHorizontal_bias="0.5"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/theme_preview_content_spacer">
+
+ </FrameLayout>
+
+ <androidx.constraintlayout.widget.Guideline
+ android:id="@+id/guideline"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ app:layout_constraintGuide_end="40dp"
+ />
<TextView
android:id="@+id/edit_label"
+ style="@style/EditLabelStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal"
android:drawableStart="@drawable/ic_tune"
android:drawablePadding="8dp"
android:gravity="center"
android:text="@string/edit_custom_theme_lbl"
- style="@style/EditLabelStyle"
- android:visibility="invisible"/>
- </LinearLayout>
+ android:visibility="invisible"
+ 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/theme_preview_card_body_container"
+ app:layout_constraintVertical_bias="0.5"/>
+
+ </androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>
</androidx.cardview.widget.CardView>
\ No newline at end of file
diff --git a/res/layout/theme_preview_topbar.xml b/res/layout/theme_preview_topbar.xml
index 1977e47..2422064 100644
--- a/res/layout/theme_preview_topbar.xml
+++ b/res/layout/theme_preview_topbar.xml
@@ -17,6 +17,7 @@
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/theme_preview_top_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:visibility="visible" tools:showIn="@layout/theme_preview_card">
diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml
index ecb78be..4b16b5e 100644
--- a/res/values-land/dimens.xml
+++ b/res/values-land/dimens.xml
@@ -16,10 +16,23 @@
limitations under the License.
-->
<resources>
+ <dimen name="card_title_text_size">12sp</dimen>
+ <dimen name="card_cover_title_text_size">16sp</dimen>
+ <dimen name="card_header_top_margin">8dp</dimen>
+ <dimen name="preview_card_padding">8dp</dimen>
<dimen name="preview_page_gap">93dp</dimen>
<dimen name="preview_page_horizontal_margin">92dp</dimen>
+ <dimen name="preview_theme_content_margin">18dp</dimen>
+ <dimen name="preview_theme_content_max_height">140dp</dimen>
+ <dimen name="preview_theme_content_min_height">100dp</dimen>
+ <dimen name="preview_theme_cover_topbar_icon_size">14dp</dimen>
+ <dimen name="preview_theme_icon_size">28dp</dimen>
+ <dimen name="preview_theme_tile_size">14dp</dimen>
+ <dimen name="preview_theme_shape_size">32dp</dimen>
+ <dimen name="preview_theme_cover_content_extra_margin">0dp</dimen>
+
+ <dimen name="font_preview_divider_gap">12dp</dimen>
<dimen name="options_container_width">400dp</dimen>
-
<dimen name="option_bottom_margin">8dp</dimen>
</resources>
\ No newline at end of file
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 121a23f..6ccf9bf 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -27,7 +27,6 @@
<dimen name="preview_indicator_width">16dp</dimen>
<dimen name="preview_indicator_height">8dp</dimen>
<dimen name="indicator_container_height">48dp</dimen>
- <dimen name="indicator_container_divider_height">1dp</dimen>
<dimen name="indicator_arrow_size">24dp</dimen>
<dimen name="indicator_arrow_touch_area_size">48dp</dimen>
@@ -50,7 +49,6 @@
<dimen name="theme_option_font_sample_width">52dp</dimen>
<dimen name="theme_option_sample_padding">5dp</dimen>
<!-- Note, using dp instead of sp as this is just the "+" symbol, not text -->
- <dimen name="theme_option_add_size">32dp</dimen>
<dimen name="option_tile_padding_vertical">12dp</dimen>
<dimen name="option_tile_padding_horizontal">10dp</dimen>
@@ -62,21 +60,22 @@
<dimen name="option_tile_margin_horizontal">2dp</dimen>
<dimen name="theme_option_label_margin">4dp</dimen>
- <dimen name="preview_card_corner_radius">8dp</dimen>
- <dimen name="preview_card_padding">16dp</dimen>
+ <dimen name="preview_card_padding">20dp</dimen>
<dimen name="card_title_text_size">16sp</dimen>
<dimen name="card_cover_title_text_size">24sp</dimen>
+ <dimen name="card_header_top_margin">16dp</dimen>
+ <dimen name="preview_theme_content_margin">40dp</dimen>
+ <dimen name="preview_theme_content_max_height">192dp</dimen>
+ <dimen name="preview_theme_content_min_height">152dp</dimen>
<dimen name="preview_theme_icon_size">40dp</dimen>
<dimen name="preview_theme_tile_size">20dp</dimen>
<dimen name="preview_theme_shape_size">52dp</dimen>
<dimen name="preview_theme_cover_topbar_icon_size">20dp</dimen>
+ <dimen name="preview_theme_cover_content_extra_margin">8dp</dimen>
- <dimen name="color_preview_image_width">182dp</dimen>
- <dimen name="color_preview_image_height">194dp</dimen>
-
- <dimen name="shape_preview_image_width">236dp</dimen>
- <dimen name="shape_preview_image_height">153dp</dimen>
+ <dimen name="font_preview_body_width">200dp</dimen>
+ <dimen name="font_preview_divider_gap">30dp</dimen>
<dimen name="custom_theme_nav_height">56dp</dimen>
diff --git a/res/values/override.xml b/res/values/override.xml
index 9b7ea96..818f357 100644
--- a/res/values/override.xml
+++ b/res/values/override.xml
@@ -17,7 +17,6 @@
-->
<resources>
<string name="themes_stub_package" translatable="false"/>
- <string name="clocks_stub_package" translatable="false"/>
<!-- Authority of a provider in System UI that will provide preview info for available clockfaces. -->
<string name="clocks_provider_authority" translatable="false">com.android.keyguard.clock</string>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 2b3427b..cae42ce 100755
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -67,7 +67,6 @@
<string name="theme_description">Font: <xliff:g name="font_name">%1$s</xliff:g>, icons: <xliff:g name="icon_name">%2$s</xliff:g>, shape: <xliff:g name="shape_name">%3$s</xliff:g>, color: <xliff:g name="color_name">%4$s</xliff:g> </string>
<!-- Plus sign used to indicate that the user can add a custom theme -->
- <string name="add_custom_theme" translatable="false">+</string>
<!-- Name for the Android Theme that comes preset with the device [CHAR LIMIT=10]-->
<string name="default_theme_title">Default</string>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index a907769..5009155 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -96,14 +96,13 @@
</style>
<style name="FontCardBodyTextStyle">
- <item name="android:layout_width">200dp</item>
+ <item name="android:layout_width">wrap_content</item>
+ <item name="android:maxWidth">@dimen/font_preview_body_width</item>
<item name="android:textAlignment">center</item>
<item name="android:textAppearance">@android:style/TextAppearance.DeviceDefault</item>
</style>
- <style name="ComponentCounterTextAppearance" parent="@android:style/TextAppearance.DeviceDefault"/>
-
- <style name="EditLabelStyle" parent="@style/ActionSecondaryButton">
+ <style name="EditLabelStyle">
<item name="android:textAppearance">@android:style/TextAppearance.DeviceDefault</item>
</style>
</resources>
diff --git a/src/com/android/customization/model/theme/custom/ThemeComponentOption.java b/src/com/android/customization/model/theme/custom/ThemeComponentOption.java
index 9427208..d148746 100644
--- a/src/com/android/customization/model/theme/custom/ThemeComponentOption.java
+++ b/src/com/android/customization/model/theme/custom/ThemeComponentOption.java
@@ -230,8 +230,7 @@
*/
private static int[] COLOR_BUTTON_IDS = {
R.id.preview_check_selected, R.id.preview_radio_selected,
- R.id.preview_toggle_selected, R.id.preview_check_unselected,
- R.id.preview_radio_unselected, R.id.preview_toggle_unselected
+ R.id.preview_toggle_selected
};
@ColorInt private int mColorAccentLight;
@@ -318,14 +317,6 @@
enabledSwitch.setThumbTintList(tintList);
enabledSwitch.setTrackTintList(tintList);
- Switch disabledSwitch = container.findViewById(R.id.preview_toggle_unselected);
- disabledSwitch.setThumbTintList(
- ColorStateList.valueOf(res.getColor(R.color.switch_thumb_tint)));
- disabledSwitch.setTrackTintList(
- ColorStateList.valueOf(res.getColor(R.color.switch_track_tint)));
- // Change overlay method so our color doesn't get too light/dark
- disabledSwitch.setTrackTintMode(PorterDuff.Mode.OVERLAY);
-
ColorStateList seekbarTintList = ColorStateList.valueOf(accentColor);
SeekBar seekbar = container.findViewById(R.id.preview_seekbar);
seekbar.setThumbTintList(seekbarTintList);
diff --git a/src/com/android/customization/picker/theme/ThemeFragment.java b/src/com/android/customization/picker/theme/ThemeFragment.java
index 7f6754f..3c0c6d1 100644
--- a/src/com/android/customization/picker/theme/ThemeFragment.java
+++ b/src/com/android/customization/picker/theme/ThemeFragment.java
@@ -32,6 +32,7 @@
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
+import android.view.View.MeasureSpec;
import android.view.View.OnClickListener;
import android.view.View.OnLayoutChangeListener;
import android.view.ViewGroup;
@@ -326,6 +327,7 @@
header.setCompoundDrawablesWithIntrinsicBounds(0, iconSrc, 0, 0);
header.setCompoundDrawableTintList(ColorStateList.valueOf(accentColor));
card.findViewById(R.id.theme_preview_top_bar).setVisibility(View.GONE);
+ card.findViewById(R.id.edit_label).setVisibility(View.GONE);
ViewGroup body = card.findViewById(R.id.theme_preview_card_body_container);
inflater.inflate(contentLayoutRes, body, true);
@@ -389,10 +391,14 @@
}
ViewGroup body = card.findViewById(R.id.theme_preview_card_body_container);
+
inflater.inflate(contentLayoutRes, body, true);
+
bindBody(false);
+
TextView editLabel = card.findViewById(R.id.edit_label);
editLabel.setOnClickListener(mEditClickListener);
+ card.setOnClickListener(mEditClickListener);
editLabel.setVisibility(mEditClickListener != null
? View.VISIBLE : View.INVISIBLE);
ColorStateList themeAccentColor = ColorStateList.valueOf(accentColor);
@@ -445,9 +451,7 @@
R.id.preview_icon_4, R.id.preview_icon_5
};
private int[] mColorButtonIds = {
- R.id.preview_check_selected, R.id.preview_radio_selected, R.id.preview_toggle_selected,
- R.id.preview_check_unselected, R.id.preview_radio_unselected,
- R.id.preview_toggle_unselected
+ R.id.preview_check_selected, R.id.preview_radio_selected, R.id.preview_toggle_selected
};
private int[] mColorTileIds = {
R.id.preview_color_qs_0_bg, R.id.preview_color_qs_1_bg, R.id.preview_color_qs_2_bg
@@ -585,14 +589,6 @@
enabledSwitch.setThumbTintList(tintList);
enabledSwitch.setTrackTintList(tintList);
- Switch disabledSwitch = card.findViewById(R.id.preview_toggle_unselected);
- disabledSwitch.setThumbTintList(
- ColorStateList.valueOf(res.getColor(R.color.switch_thumb_tint)));
- disabledSwitch.setTrackTintList(
- ColorStateList.valueOf(res.getColor(R.color.switch_track_tint)));
- // Change overlay method so our color doesn't get too light/dark
- disabledSwitch.setTrackTintMode(PorterDuff.Mode.OVERLAY);
-
ColorStateList seekbarTintList = ColorStateList.valueOf(accentColor);
SeekBar seekbar = card.findViewById(R.id.preview_seekbar);
seekbar.setThumbTintList(seekbarTintList);
diff --git a/src/com/android/customization/widget/PreviewPager.java b/src/com/android/customization/widget/PreviewPager.java
index eea4c65..9bf7651 100644
--- a/src/com/android/customization/widget/PreviewPager.java
+++ b/src/com/android/customization/widget/PreviewPager.java
@@ -81,10 +81,13 @@
mViewPager.setPageMargin(res.getDimensionPixelOffset(R.dimen.preview_page_gap));
mViewPager.setClipToPadding(false);
if (mPageStyle == STYLE_PEEKING) {
+ int screenWidth = mViewPager.getResources().getDisplayMetrics().widthPixels;
+ int hMargin = res.getDimensionPixelOffset(R.dimen.preview_page_horizontal_margin);
+ hMargin = Math.max(hMargin, screenWidth/8);
mViewPager.setPadding(
- res.getDimensionPixelOffset(R.dimen.preview_page_horizontal_margin),
+ hMargin,
res.getDimensionPixelOffset(R.dimen.preview_page_top_margin),
- res.getDimensionPixelOffset(R.dimen.preview_page_horizontal_margin),
+ hMargin,
res.getDimensionPixelOffset(R.dimen.preview_page_bottom_margin));
} else if (mPageStyle == STYLE_ASPECT_RATIO) {
DisplayMetrics dm = res.getDisplayMetrics();