summaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authorJin Cao <jinyan@google.com>2014-07-28 19:03:56 -0700
committerJin Cao <jinyan@google.com>2014-07-29 09:42:04 -0700
commit4ddcdaed9ef5ea83910a0513e87538130270e2e4 (patch)
tree36c74c7fee9f8d049a27f397be2d14bef6945cca /res
parente096b4534f8f7bd30513aed0e8fb9dc045842baf (diff)
downloadandroid_frameworks_opt_chips-4ddcdaed9ef5ea83910a0513e87538130270e2e4.tar.gz
android_frameworks_opt_chips-4ddcdaed9ef5ea83910a0513e87538130270e2e4.tar.bz2
android_frameworks_opt_chips-4ddcdaed9ef5ea83910a0513e87538130270e2e4.zip
[Quantum] chips autocomplete to quantum style
Separate layout for chips that have icons on the lefthand side and icons on the righthand side. b/15934812 Change-Id: I7b58197e46ad48bb838ee5e0c34bb06b0b74dfba
Diffstat (limited to 'res')
-rw-r--r--res/layout/chips_autocomplete_recipient_dropdown_item.xml29
-rw-r--r--res/layout/chips_recipient_dropdown_item.xml35
-rw-r--r--res/values-v17/styles.xml26
-rw-r--r--res/values/dimen.xml4
-rw-r--r--res/values/styles.xml57
5 files changed, 114 insertions, 37 deletions
diff --git a/res/layout/chips_autocomplete_recipient_dropdown_item.xml b/res/layout/chips_autocomplete_recipient_dropdown_item.xml
new file mode 100644
index 0000000..59c4155
--- /dev/null
+++ b/res/layout/chips_autocomplete_recipient_dropdown_item.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@drawable/chips_dropdown_background"
+ style="@style/ChipWrapperStyle">
+
+ <com.android.ex.chips.CircularImageView style="@style/ChipEndIconStyle" />
+
+ <TextView style="@style/ChipTitleEndIconStyle" />
+
+ <TextView style="@style/ChipSubtitleEndIconStyle" />
+
+</RelativeLayout> \ No newline at end of file
diff --git a/res/layout/chips_recipient_dropdown_item.xml b/res/layout/chips_recipient_dropdown_item.xml
index f84f301..697d71f 100644
--- a/res/layout/chips_recipient_dropdown_item.xml
+++ b/res/layout/chips_recipient_dropdown_item.xml
@@ -18,39 +18,12 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/chips_dropdown_background"
- android:padding="16dp" >
+ style="@style/ChipWrapperStyle">
- <com.android.ex.chips.CircularImageView
- android:id="@android:id/icon"
- style="@style/ChipIconStyle"
- android:layout_width="40dp"
- android:layout_height="40dp"
- android:contentDescription="@null" />
+ <com.android.ex.chips.CircularImageView style="@style/ChipStartIconStyle" />
- <TextView
- android:id="@android:id/title"
- style="@style/ChipTitleStyle"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="5dp"
- android:ellipsize="middle"
- android:singleLine="true"
- android:textColor="@color/chips_dropdown_text"
- android:textSize="14sp"
- android:textStyle="bold" />
+ <TextView style="@style/ChipTitleStartIconStyle" />
- <!-- Use bottom padding instead of margin to workaround RelativeLayout bug. -->
-
- <TextView
- android:id="@android:id/text1"
- style="@style/ChipSubtitleStyle"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentBottom="true"
- android:ellipsize="middle"
- android:paddingBottom="5dp"
- android:singleLine="true"
- android:textColor="@color/chips_dropdown_text"
- android:textSize="14sp" />
+ <TextView style="@style/ChipSubtitleStartIconStyle" />
</RelativeLayout> \ No newline at end of file
diff --git a/res/values-v17/styles.xml b/res/values-v17/styles.xml
index 03f6ae3..0842ba7 100644
--- a/res/values-v17/styles.xml
+++ b/res/values-v17/styles.xml
@@ -14,16 +14,36 @@
limitations under the License.
-->
<resources>
- <style name="ChipTitleStyle">
+ <style name="ChipWrapperStyle">
+ <item name="android:paddingStart">@dimen/chip_wrapper_start_padding</item>
+ <item name="android:paddingTop">@dimen/chip_wrapper_top_padding</item>
+ <item name="android:paddingEnd">@dimen/chip_wrapper_end_padding</item>
+ <item name="android:paddingBottom">@dimen/chip_wrapper_bottom_padding</item>
+ </style>
+
+ <style name="ChipTitleStartIconStyle" parent="@style/ChipTitleBaseStyle">
<item name="android:layout_toEndOf">@android:id/icon</item>
</style>
- <style name="ChipSubtitleStyle">
+ <style name="ChipTitleEndIconStyle" parent="@style/ChipTitleBaseStyle">
+ <item name="android:layout_toStartOf">@android:id/icon</item>
+ </style>
+
+ <style name="ChipSubtitleStartIconStyle" parent="@style/ChipSubtitleBaseStyle">
<item name="android:layout_toEndOf">@android:id/icon</item>
</style>
- <style name="ChipIconStyle">
+ <style name="ChipSubtitleEndIconStyle" parent="@style/ChipSubtitleBaseStyle">
+ <item name="android:layout_toStartOf">@android:id/icon</item>
+ </style>
+
+ <style name="ChipStartIconStyle" parent="@style/ChipIconBaseStyle">
<item name="android:layout_marginEnd">@dimen/chip_icon_margin_end</item>
<item name="android:layout_alignParentStart">true</item>
</style>
+
+ <style name="ChipEndIconStyle" parent="@style/ChipIconBaseStyle">
+ <item name="android:layout_marginStart">@dimen/chip_icon_margin_end</item>
+ <item name="android:layout_alignParentEnd">true</item>
+ </style>
</resources>
diff --git a/res/values/dimen.xml b/res/values/dimen.xml
index 60049df..645b3fc 100644
--- a/res/values/dimen.xml
+++ b/res/values/dimen.xml
@@ -21,4 +21,8 @@
<dimen name="line_spacing_extra">4dip</dimen>
<integer name="chips_max_lines">-1</integer>
<dimen name="chip_icon_margin_end">16dp</dimen>
+ <dimen name="chip_wrapper_start_padding">16dp</dimen>
+ <dimen name="chip_wrapper_top_padding">16dp</dimen>
+ <dimen name="chip_wrapper_end_padding">16dp</dimen>
+ <dimen name="chip_wrapper_bottom_padding">16dp</dimen>
</resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 21ca7ed..9e7b0d2 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -32,16 +32,67 @@
<item name="android:popupBackground">@drawable/chips_popup_background</item>
</style>
- <style name="ChipTitleStyle">
+ <style name="ChipWrapperStyle">
+ <item name="android:paddingLeft">@dimen/chip_wrapper_start_padding</item>
+ <item name="android:paddingTop">@dimen/chip_wrapper_top_padding</item>
+ <item name="android:paddingRight">@dimen/chip_wrapper_end_padding</item>
+ <item name="android:paddingBottom">@dimen/chip_wrapper_bottom_padding</item>
+ </style>
+
+ <style name="ChipTitleBaseStyle">
+ <item name="android:id">@android:id/title</item>
+ <item name="android:layout_width">match_parent</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:ellipsize">middle</item>
+ <item name="android:paddingTop">1dp</item>
+ <item name="android:singleLine">true</item>
+ <item name="android:textColor">@color/chips_dropdown_text</item>
+ <item name="android:textSize">14sp</item>
+ <item name="android:textStyle">bold</item>
+ </style>
+
+ <style name="ChipTitleStartIconStyle" parent="@style/ChipTitleBaseStyle">
<item name="android:layout_toRightOf">@android:id/icon</item>
</style>
- <style name="ChipSubtitleStyle">
+ <style name="ChipTitleEndIconStyle" parent="@style/ChipTitleBaseStyle">
+ <item name="android:layout_toLeftOf">@android:id/icon</item>
+ </style>
+
+ <style name="ChipSubtitleBaseStyle">
+ <item name="android:id">@android:id/text1</item>
+ <item name="android:layout_width">match_parent</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:layout_alignParentBottom">true</item>
+ <item name="android:ellipsize">middle</item>
+ <item name="android:paddingBottom">1dp</item>
+ <item name="android:singleLine">true</item>
+ <item name="android:textColor">@color/chips_dropdown_text</item>
+ <item name="android:textSize">14sp</item>
+ </style>
+
+ <style name="ChipSubtitleStartIconStyle" parent="@style/ChipSubtitleBaseStyle">
<item name="android:layout_toRightOf">@android:id/icon</item>
</style>
- <style name="ChipIconStyle">
+ <style name="ChipSubtitleEndIconStyle" parent="@style/ChipSubtitleBaseStyle">
+ <item name="android:layout_toLeftOf">@android:id/icon</item>
+ </style>
+
+ <style name="ChipIconBaseStyle">
+ <item name="android:id">@android:id/icon</item>
+ <item name="android:layout_width">40dp</item>
+ <item name="android:layout_height">40dp</item>
+ <item name="android:contentDescription">@null</item>
+ </style>
+
+ <style name="ChipStartIconStyle" parent="@style/ChipIconBaseStyle">
<item name="android:layout_marginRight">@dimen/chip_icon_margin_end</item>
<item name="android:layout_alignParentLeft">true</item>
</style>
+
+ <style name="ChipEndIconStyle" parent="@style/ChipIconBaseStyle">
+ <item name="android:layout_marginLeft">@dimen/chip_icon_margin_end</item>
+ <item name="android:layout_alignParentRight">true</item>
+ </style>
</resources>