summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJin Cao <jinyan@google.com>2014-07-29 16:23:03 -0700
committerJin Cao <jinyan@google.com>2014-07-29 16:23:03 -0700
commit58d541de27090b4bd55746368b3b3b1486a7c094 (patch)
tree557141a6770ff78f34539fb65fff2e80fc5bc8e9
parent4ddcdaed9ef5ea83910a0513e87538130270e2e4 (diff)
downloadandroid_frameworks_opt_chips-58d541de27090b4bd55746368b3b3b1486a7c094.tar.gz
android_frameworks_opt_chips-58d541de27090b4bd55746368b3b3b1486a7c094.tar.bz2
android_frameworks_opt_chips-58d541de27090b4bd55746368b3b3b1486a7c094.zip
[Quantum chips] restyle recipient chips to quantum
Restyle recipient chips to quantum redlines, also remove padding style from non-autocomplete dropdowns. b/15934812 Change-Id: I28eef0f4b9d622f81782d12f279e78af10c14458
-rw-r--r--res/drawable-hdpi/chip_background.9.pngbin679 -> 679 bytes
-rw-r--r--res/drawable-hdpi/chip_background_selected.9.pngbin733 -> 729 bytes
-rw-r--r--res/drawable-mdpi/chip_background.9.pngbin415 -> 415 bytes
-rw-r--r--res/drawable-mdpi/chip_background_selected.9.pngbin473 -> 465 bytes
-rw-r--r--res/drawable-xhdpi/chip_background.9.pngbin887 -> 892 bytes
-rw-r--r--res/drawable-xhdpi/chip_background_selected.9.pngbin974 -> 966 bytes
-rw-r--r--res/drawable-xxhdpi/chip_background.9.pngbin1632 -> 1663 bytes
-rw-r--r--res/drawable-xxhdpi/chip_background_selected.9.pngbin1773 -> 1791 bytes
-rw-r--r--res/layout/chips_autocomplete_recipient_dropdown_item.xml2
-rw-r--r--res/layout/chips_recipient_dropdown_item.xml3
-rw-r--r--res/values-sw600dp-land/dimen.xml21
-rw-r--r--res/values-v17/styles.xml2
-rw-r--r--res/values/dimen.xml11
-rw-r--r--res/values/styles.xml2
-rw-r--r--src/com/android/ex/chips/RecipientEditTextView.java32
15 files changed, 36 insertions, 37 deletions
diff --git a/res/drawable-hdpi/chip_background.9.png b/res/drawable-hdpi/chip_background.9.png
index 3d6d27d..4125139 100644
--- a/res/drawable-hdpi/chip_background.9.png
+++ b/res/drawable-hdpi/chip_background.9.png
Binary files differ
diff --git a/res/drawable-hdpi/chip_background_selected.9.png b/res/drawable-hdpi/chip_background_selected.9.png
index 1d9b5ee..fe3856d 100644
--- a/res/drawable-hdpi/chip_background_selected.9.png
+++ b/res/drawable-hdpi/chip_background_selected.9.png
Binary files differ
diff --git a/res/drawable-mdpi/chip_background.9.png b/res/drawable-mdpi/chip_background.9.png
index 116f731..5ee5586 100644
--- a/res/drawable-mdpi/chip_background.9.png
+++ b/res/drawable-mdpi/chip_background.9.png
Binary files differ
diff --git a/res/drawable-mdpi/chip_background_selected.9.png b/res/drawable-mdpi/chip_background_selected.9.png
index ceda86e..f9d65b5 100644
--- a/res/drawable-mdpi/chip_background_selected.9.png
+++ b/res/drawable-mdpi/chip_background_selected.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/chip_background.9.png b/res/drawable-xhdpi/chip_background.9.png
index 4fe3fe4..f721c5f 100644
--- a/res/drawable-xhdpi/chip_background.9.png
+++ b/res/drawable-xhdpi/chip_background.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/chip_background_selected.9.png b/res/drawable-xhdpi/chip_background_selected.9.png
index 37400f3..df21950 100644
--- a/res/drawable-xhdpi/chip_background_selected.9.png
+++ b/res/drawable-xhdpi/chip_background_selected.9.png
Binary files differ
diff --git a/res/drawable-xxhdpi/chip_background.9.png b/res/drawable-xxhdpi/chip_background.9.png
index d8fff51..52ca406 100644
--- a/res/drawable-xxhdpi/chip_background.9.png
+++ b/res/drawable-xxhdpi/chip_background.9.png
Binary files differ
diff --git a/res/drawable-xxhdpi/chip_background_selected.9.png b/res/drawable-xxhdpi/chip_background_selected.9.png
index 4e0f00e..c38fd54 100644
--- a/res/drawable-xxhdpi/chip_background_selected.9.png
+++ b/res/drawable-xxhdpi/chip_background_selected.9.png
Binary files differ
diff --git a/res/layout/chips_autocomplete_recipient_dropdown_item.xml b/res/layout/chips_autocomplete_recipient_dropdown_item.xml
index 59c4155..3f35e86 100644
--- a/res/layout/chips_autocomplete_recipient_dropdown_item.xml
+++ b/res/layout/chips_autocomplete_recipient_dropdown_item.xml
@@ -18,7 +18,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/chips_dropdown_background"
- style="@style/ChipWrapperStyle">
+ style="@style/ChipAutocompleteWrapperStyle">
<com.android.ex.chips.CircularImageView style="@style/ChipEndIconStyle" />
diff --git a/res/layout/chips_recipient_dropdown_item.xml b/res/layout/chips_recipient_dropdown_item.xml
index 697d71f..343bf61 100644
--- a/res/layout/chips_recipient_dropdown_item.xml
+++ b/res/layout/chips_recipient_dropdown_item.xml
@@ -17,8 +17,7 @@
<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">
+ android:background="@drawable/chips_dropdown_background">
<com.android.ex.chips.CircularImageView style="@style/ChipStartIconStyle" />
diff --git a/res/values-sw600dp-land/dimen.xml b/res/values-sw600dp-land/dimen.xml
deleted file mode 100644
index dc3aadf..0000000
--- a/res/values-sw600dp-land/dimen.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 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>
- <dimen name="chip_padding">8dip</dimen>
- <dimen name="chip_height">32dip</dimen>
- <dimen name="chip_text_size">14sp</dimen>
-</resources> \ No newline at end of file
diff --git a/res/values-v17/styles.xml b/res/values-v17/styles.xml
index 0842ba7..7674bad 100644
--- a/res/values-v17/styles.xml
+++ b/res/values-v17/styles.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<resources>
- <style name="ChipWrapperStyle">
+ <style name="ChipAutocompleteWrapperStyle">
<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>
diff --git a/res/values/dimen.xml b/res/values/dimen.xml
index 645b3fc..636fd26 100644
--- a/res/values/dimen.xml
+++ b/res/values/dimen.xml
@@ -15,11 +15,18 @@
-->
<resources>
- <dimen name="chip_padding">3dip</dimen>
- <dimen name="chip_height">36dip</dimen>
+ <!-- override default padding values, -1dp if it's not set to override -->
+ <dimen name="chip_padding_start">-1dp</dimen>
+ <dimen name="chip_padding_end">12dp</dimen>
+
+ <!-- chip -->
+ <dimen name="chip_padding">8dp</dimen>
+ <dimen name="chip_height">32dp</dimen>
<dimen name="chip_text_size">14sp</dimen>
<dimen name="line_spacing_extra">4dip</dimen>
<integer name="chips_max_lines">-1</integer>
+
+ <!-- dropdown -->
<dimen name="chip_icon_margin_end">16dp</dimen>
<dimen name="chip_wrapper_start_padding">16dp</dimen>
<dimen name="chip_wrapper_top_padding">16dp</dimen>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 9e7b0d2..a2b8585 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -32,7 +32,7 @@
<item name="android:popupBackground">@drawable/chips_popup_background</item>
</style>
- <style name="ChipWrapperStyle">
+ <style name="ChipAutocompleteWrapperStyle">
<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>
diff --git a/src/com/android/ex/chips/RecipientEditTextView.java b/src/com/android/ex/chips/RecipientEditTextView.java
index 1f735e7..6dd8de4 100644
--- a/src/com/android/ex/chips/RecipientEditTextView.java
+++ b/src/com/android/ex/chips/RecipientEditTextView.java
@@ -144,7 +144,8 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements
private float mChipHeight;
private float mChipFontSize;
private float mLineSpacingExtra;
- private int mChipPadding;
+ private int mChipTextStartPadding;
+ private int mChipTextEndPadding;
private final int mTextHeight;
/**
@@ -698,8 +699,8 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements
// Make sure there is a minimum chip width so the user can ALWAYS
// tap a chip without difficulty.
- int width = Math.max(iconWidth * 2, textWidth + (mChipPadding * 2) + iconWidth
- + backgroundPadding.left + backgroundPadding.right);
+ int width = Math.max(iconWidth * 2, textWidth + mChipTextStartPadding + mChipTextEndPadding
+ + iconWidth + backgroundPadding.left + backgroundPadding.right);
// Create the background of the chip.
result.bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
@@ -710,8 +711,8 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements
background.draw(canvas);
// Draw the text vertically aligned
int textX = shouldPositionAvatarOnRight() ?
- mChipPadding + backgroundPadding.left :
- width - backgroundPadding.right - mChipPadding - textWidth;
+ mChipTextEndPadding + backgroundPadding.left :
+ width - backgroundPadding.right - mChipTextEndPadding - textWidth;
canvas.drawText(ellipsizedText, 0, ellipsizedText.length(),
textX, getTextYOffset(height), paint);
@@ -928,7 +929,8 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements
* that will be added to the chip.
*/
private float calculateAvailableWidth() {
- return getWidth() - getPaddingLeft() - getPaddingRight() - (mChipPadding * 2);
+ return getWidth() - getPaddingLeft() - getPaddingRight() - mChipTextStartPadding
+ - mChipTextEndPadding;
}
@@ -950,9 +952,21 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements
if (mChipDelete == null) {
mChipDelete = r.getDrawable(R.drawable.chip_delete);
}
- mChipPadding = a.getDimensionPixelSize(R.styleable.RecipientEditTextView_chipPadding, -1);
- if (mChipPadding == -1) {
- mChipPadding = (int) r.getDimension(R.dimen.chip_padding);
+ mChipTextStartPadding = mChipTextEndPadding
+ = a.getDimensionPixelSize(R.styleable.RecipientEditTextView_chipPadding, -1);
+ if (mChipTextStartPadding == -1) {
+ mChipTextStartPadding = mChipTextEndPadding =
+ (int) r.getDimension(R.dimen.chip_padding);
+ }
+ // xml-overrides for each individual padding
+ // TODO: add these to attr?
+ int overridePadding = (int) r.getDimension(R.dimen.chip_padding_start);
+ if (overridePadding >= 0) {
+ mChipTextStartPadding = overridePadding;
+ }
+ overridePadding = (int) r.getDimension(R.dimen.chip_padding_end);
+ if (overridePadding >= 0) {
+ mChipTextEndPadding = overridePadding;
}
mDefaultContactPhoto = BitmapFactory.decodeResource(r, R.drawable.ic_contact_picture);