summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJin Cao <jinyan@google.com>2014-08-06 14:29:14 -0700
committerJin Cao <jinyan@google.com>2014-08-06 14:43:07 -0700
commitb58c9a621a250c6119be2d5a77164b940a8559b0 (patch)
tree12ab7ff79976308157060065e10a034a3973f3d6
parent46737050a95486de5f2a05851f22ec823ebd085a (diff)
downloadandroid_frameworks_opt_chips-b58c9a621a250c6119be2d5a77164b940a8559b0.tar.gz
android_frameworks_opt_chips-b58c9a621a250c6119be2d5a77164b940a8559b0.tar.bz2
android_frameworks_opt_chips-b58c9a621a250c6119be2d5a77164b940a8559b0.zip
[Quantum chips] add custom dividers for autocomplete
b/16818548 Change-Id: Idb3a112af7a16f05bfcf9e2f9ae14f3ef32aecef
-rw-r--r--res/layout/chips_autocomplete_recipient_dropdown_item.xml28
-rw-r--r--res/values-sw600dp/styles.xml2
-rw-r--r--res/values-v17/styles.xml7
-rw-r--r--res/values/colors.xml2
-rw-r--r--res/values/styles.xml9
-rw-r--r--src/com/android/ex/chips/DropdownChipLayouter.java7
6 files changed, 45 insertions, 10 deletions
diff --git a/res/layout/chips_autocomplete_recipient_dropdown_item.xml b/res/layout/chips_autocomplete_recipient_dropdown_item.xml
index 502a3ce..d15a97b 100644
--- a/res/layout/chips_autocomplete_recipient_dropdown_item.xml
+++ b/res/layout/chips_autocomplete_recipient_dropdown_item.xml
@@ -14,21 +14,37 @@
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="wrap_content"
android:minHeight="@dimen/chip_dropdown_height"
- android:background="@drawable/chips_dropdown_background"
- style="@style/ChipAutocompleteWrapperStyle">
+ android:orientation="vertical">
+
+ <View
+ android:id="@+id/chip_autocomplete_top_divider"
+ style="@style/ChipAutocompleteDividerStyle" />
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@drawable/chips_dropdown_background"
+ style="@style/ChipAutocompleteWrapperStyle">
+
+ <LinearLayout style="@style/ChipTextViewLayoutStyle">
+
+ <TextView style="@style/ChipTitleStyle" />
- <LinearLayout style="@style/ChipTextViewLayoutStyle">
+ <TextView style="@style/ChipSubtitleStyle" />
- <TextView style="@style/ChipTitleStyle" />
+ </LinearLayout>
- <TextView style="@style/ChipSubtitleStyle" />
+ <com.android.ex.chips.CircularImageView style="@style/ChipEndIconStyle" />
</LinearLayout>
- <com.android.ex.chips.CircularImageView style="@style/ChipEndIconStyle" />
+ <View
+ android:id="@+id/chip_autocomplete_bottom_divider"
+ style="@style/ChipAutocompleteDividerStyle" />
</LinearLayout> \ No newline at end of file
diff --git a/res/values-sw600dp/styles.xml b/res/values-sw600dp/styles.xml
index 00988a9..06e7608 100644
--- a/res/values-sw600dp/styles.xml
+++ b/res/values-sw600dp/styles.xml
@@ -24,8 +24,6 @@
<item name="android:background">@null</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">match_parent</item>
- <item name="android:dropDownVerticalOffset">0dip</item>
- <item name="android:dropDownHorizontalOffset">-4dip</item>
<item name="android:textAlignment" tools:ignore="NewApi">viewStart</item>
<item name="android:textDirection" tools:ignore="NewApi">locale</item>
</style>
diff --git a/res/values-v17/styles.xml b/res/values-v17/styles.xml
index f7b2477..53b5634 100644
--- a/res/values-v17/styles.xml
+++ b/res/values-v17/styles.xml
@@ -21,6 +21,13 @@
<item name="android:paddingBottom">@dimen/chip_wrapper_bottom_padding</item>
</style>
+ <style name="ChipAutocompleteDividerStyle">
+ <item name="android:layout_width">match_parent</item>
+ <item name="android:layout_height">1px</item>
+ <item name="android:background">@color/autocomplete_divider_color</item>
+ <item name="android:layout_marginStart">@dimen/chip_wrapper_start_padding</item>
+ </style>
+
<style name="ChipStartIconStyle" parent="@style/ChipIconBaseStyle">
<item name="android:layout_marginEnd">@dimen/chip_icon_margin_end</item>
</style>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 8b6347c..b222dfb 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -20,4 +20,6 @@
<color name="chips_dropdown_background_activated">#4285f4</color>
<color name="chips_dropdown_background_pressed">#ededed</color>
+ <color name="autocomplete_divider_color">#cccccc</color>
+
</resources> \ No newline at end of file
diff --git a/res/values/styles.xml b/res/values/styles.xml
index e5c7294..7a7d817 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -19,8 +19,6 @@
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:background">@null</item>
- <item name="android:dropDownHorizontalOffset">-16dip</item>
- <item name="android:dropDownVerticalOffset">-6dip</item>
<item name="android:dropDownWidth">match_parent</item>
<item name="android:imeOptions">actionNext|flagNoFullscreen</item>
<item name="android:inputType">textEmailAddress|textMultiLine</item>
@@ -39,6 +37,13 @@
<item name="android:paddingBottom">@dimen/chip_wrapper_bottom_padding</item>
</style>
+ <style name="ChipAutocompleteDividerStyle">
+ <item name="android:layout_width">match_parent</item>
+ <item name="android:layout_height">1px</item>
+ <item name="android:background">@color/autocomplete_divider_color</item>
+ <item name="android:layout_marginLeft">@dimen/chip_wrapper_start_padding</item>
+ </style>
+
<style name="ChipTextViewLayoutStyle">
<item name="android:layout_width">0dp</item>
<item name="android:layout_height">wrap_content</item>
diff --git a/src/com/android/ex/chips/DropdownChipLayouter.java b/src/com/android/ex/chips/DropdownChipLayouter.java
index 3327833..6c9a694 100644
--- a/src/com/android/ex/chips/DropdownChipLayouter.java
+++ b/src/com/android/ex/chips/DropdownChipLayouter.java
@@ -112,6 +112,11 @@ public class DropdownChipLayouter {
displayName = null;
showImage = false;
}
+
+ // For BASE_RECIPIENT set all top dividers except for the first one to be GONE.
+ if (viewHolder.topDivider != null) {
+ viewHolder.topDivider.setVisibility(position == 0 ? View.VISIBLE : View.GONE);
+ }
break;
case RECIPIENT_ALTERNATES:
if (position != 0) {
@@ -334,6 +339,7 @@ public class DropdownChipLayouter {
public final TextView destinationTypeView;
public final ImageView imageView;
public final ImageView deleteView;
+ public final View topDivider;
public ViewHolder(View view) {
displayNameView = (TextView) view.findViewById(getDisplayNameResId());
@@ -341,6 +347,7 @@ public class DropdownChipLayouter {
destinationTypeView = (TextView) view.findViewById(getDestinationTypeResId());
imageView = (ImageView) view.findViewById(getPhotoResId());
deleteView = (ImageView) view.findViewById(getDeleteResId());
+ topDivider = view.findViewById(R.id.chip_autocomplete_top_divider);
}
}
}