Update new UI for conditional collapsibility

- Add a footer view with collapsing button and this view will be
appended to the last position of condition cards when condition
cards are expanded.
- Add a header view with expanding button when condition cards
are in collapsed state.

Bug: 119593268, 113451905
Test: rebuild, visual
Change-Id: I82c20641d1542e45383da48106f8fedea06a68ed
This commit is contained in:
Mill Chen
2018-11-15 14:39:55 +08:00
committed by Fan Zhang
parent f611fe8689
commit 4b19fecd50
5 changed files with 129 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 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.
-->
<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/ContextualCardStyle">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/homepage_condition_footer_height"
android:contentDescription="@string/homepage_condition_footer_content_description"
android:gravity="end"
android:orientation="horizontal"
android:paddingTop="@dimen/homepage_condition_footer_padding_top"
android:paddingEnd="@dimen/homepage_condition_footer_padding_end">
<ImageView
android:id="@+id/collapse_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_expand_less" />
</LinearLayout>
</androidx.cardview.widget.CardView>

View File

@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 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.
-->
<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/ContextualCardStyle">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/homepage_condition_header_padding_top"
android:paddingBottom="@dimen/homepage_condition_header_padding_bottom"
android:orientation="horizontal"
android:gravity="center_vertical">
<LinearLayout
android:id="@+id/header_icons_container"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginStart="@dimen/homepage_condition_header_icons_margin_start"
android:orientation="horizontal"
android:gravity="center_vertical"/>
<ImageView
android:id="@+id/expand_indicator"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:paddingTop="@dimen/homepage_condition_header_indicator_padding_top"
android:paddingStart="@dimen/homepage_condition_header_indicator_padding_start"
android:paddingEnd="@dimen/homepage_condition_header_indicator_padding_end"
android:src="@drawable/ic_expand_more"/>
</LinearLayout>
</androidx.cardview.widget.CardView>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 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.
-->
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/icon"
android:layout_width="@dimen/homepage_condition_header_icon_width_height"
android:layout_height="@dimen/homepage_condition_header_icon_width_height"
android:layout_marginEnd="@dimen/homepage_condition_header_icon_margin_end"
android:tint="?android:attr/colorAccent"/>

View File

@@ -355,5 +355,16 @@
<dimen name="homepage_condition_full_card_padding_end">24dp</dimen>
<dimen name="homepage_condition_full_card_padding_top">12dp</dimen>
<dimen name="homepage_condition_full_card_padding_bottom">12dp</dimen>
<dimen name="homepage_condition_header_padding_top">10dp</dimen>
<dimen name="homepage_condition_header_padding_bottom">10dp</dimen>
<dimen name="homepage_condition_header_icons_margin_start">24dp</dimen>
<dimen name="homepage_condition_header_indicator_padding_top">4dp</dimen>
<dimen name="homepage_condition_header_indicator_padding_start">16dp</dimen>
<dimen name="homepage_condition_header_indicator_padding_end">16dp</dimen>
<dimen name="homepage_condition_footer_height">44dp</dimen>
<dimen name="homepage_condition_footer_padding_top">10dp</dimen>
<dimen name="homepage_condition_footer_padding_end">10dp</dimen>
<dimen name="homepage_condition_header_icon_width_height">24dp</dimen>
<dimen name="homepage_condition_header_icon_margin_end">24dp</dimen>
</resources>

View File

@@ -9105,6 +9105,9 @@
<!-- Summary for the condition section on the dashboard, representing number of conditions. [CHAR LIMIT=10] -->
<string name="condition_summary" translatable="false"><xliff:g name="count" example="3">%1$d</xliff:g></string>
<!-- Content description for condition footer button. In talkback mode, double tapping will cause condition list to collapse [CHAR LIMIT=NONE]-->
<string name="homepage_condition_footer_content_description">Collapse</string>
<!-- Title for the suggestions section on the dashboard [CHAR LIMIT=30] -->
<string name="suggestions_title_v2">Suggested for You</string>