summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryueg <yueg@google.com>2018-01-19 11:39:03 -0800
committerCopybara-Service <copybara-piper@google.com>2018-01-19 13:16:20 -0800
commit7e421825670b090d2fe035575769af751e908015 (patch)
treefe7464bf4c4a40df2d56c4a163b3965e65e4e5c4
parent61f30b6c0e2f01c0a7f85346e9ac1f7735f01567 (diff)
Bubble v2 layout changes.
To display expanded view properly with display size and font size set to largest, we made the following changes: - increase expanded view width - use fixed expanded view button height - remove blue background behind avatar Test: manual PiperOrigin-RevId: 182565152 Change-Id: Ie4cea2c42b66320767e283144ddd5d7c5ff40e1c
-rw-r--r--java/com/android/newbubble/NewBubble.java19
-rw-r--r--java/com/android/newbubble/res/layout/new_bubble_base.xml46
-rw-r--r--java/com/android/newbubble/res/values/styles.xml7
-rw-r--r--java/com/android/newbubble/res/values/values.xml2
4 files changed, 27 insertions, 47 deletions
diff --git a/java/com/android/newbubble/NewBubble.java b/java/com/android/newbubble/NewBubble.java
index 09634b572..c0f93e29e 100644
--- a/java/com/android/newbubble/NewBubble.java
+++ b/java/com/android/newbubble/NewBubble.java
@@ -36,7 +36,6 @@ import android.support.annotation.IntDef;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.VisibleForTesting;
-import android.support.v4.graphics.ColorUtils;
import android.support.v4.os.BuildCompat;
import android.support.v4.view.animation.LinearOutSlowInInterpolator;
import android.text.TextUtils;
@@ -57,7 +56,6 @@ import android.view.animation.AnticipateInterpolator;
import android.view.animation.OvershootInterpolator;
import android.widget.ImageView;
import android.widget.Toast;
-import android.widget.ViewAnimator;
import com.android.dialer.common.LogUtil;
import com.android.dialer.logging.DialerImpression;
import com.android.dialer.logging.Logger;
@@ -665,16 +663,6 @@ public class NewBubble {
}
private void update() {
- // Whole primary button background
- Drawable backgroundCirle =
- context.getResources().getDrawable(R.drawable.bubble_shape_circle, context.getTheme());
- int primaryTint =
- ColorUtils.compositeColors(
- context.getColor(R.color.bubble_primary_background_darken),
- currentInfo.getPrimaryColor());
- backgroundCirle.mutate().setTint(primaryTint);
- viewHolder.getPrimaryButton().setBackground(backgroundCirle);
-
// Small icon
Drawable smallIconBackgroundCircle =
context
@@ -746,9 +734,6 @@ public class NewBubble {
// Create a new ViewHolder and copy needed info.
viewHolder = new ViewHolder(oldViewHolder.getRoot().getContext());
- viewHolder
- .getPrimaryButton()
- .setDisplayedChild(oldViewHolder.getPrimaryButton().getDisplayedChild());
viewHolder.getPrimaryIcon().setX(isDrawingFromRight() ? 0 : primaryIconMoveDistance);
viewHolder
.getPrimaryIcon()
@@ -887,7 +872,7 @@ public class NewBubble {
private NewMoveHandler moveHandler;
private final NewWindowRoot root;
- private final ViewAnimator primaryButton;
+ private final View primaryButton;
private final ImageView primaryIcon;
private final ImageView primaryAvatar;
private final View arrow;
@@ -971,7 +956,7 @@ public class NewBubble {
return root;
}
- public ViewAnimator getPrimaryButton() {
+ public View getPrimaryButton() {
return primaryButton;
}
diff --git a/java/com/android/newbubble/res/layout/new_bubble_base.xml b/java/com/android/newbubble/res/layout/new_bubble_base.xml
index 2b53b360e..c86d3bbcc 100644
--- a/java/com/android/newbubble/res/layout/new_bubble_base.xml
+++ b/java/com/android/newbubble/res/layout/new_bubble_base.xml
@@ -31,7 +31,7 @@
android:animateLayoutChanges="true"
android:clipChildren="false"
android:clipToPadding="false">
- <ViewAnimator
+ <FrameLayout
android:id="@+id/bubble_button_primary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -42,31 +42,25 @@
android:contentDescription="@string/a11y_bubble_description"
android:background="@drawable/bubble_shape_circle"
android:measureAllChildren="false"
- android:elevation="@dimen/bubble_elevation"
- tools:backgroundTint="#FF0000AA">
- <FrameLayout
- android:id="@+id/bubble_icon_container"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content">
- <ImageView
- android:id="@+id/bubble_icon_avatar"
- android:layout_width="@dimen/bubble_size"
- android:layout_height="@dimen/bubble_size"
- tools:src="@android:drawable/ic_btn_speak_now"/>
- <ImageView
- android:id="@+id/bubble_icon_primary"
- android:layout_width="@dimen/bubble_small_icon_size"
- android:layout_height="@dimen/bubble_small_icon_size"
- android:layout_gravity="bottom|right"
- android:padding="@dimen/bubble_small_icon_padding"
- android:tint="@android:color/white"
- android:tintMode="src_in"
- android:background="@drawable/bubble_shape_circle_small"
- android:measureAllChildren="false"
- tools:backgroundTint="#FF0000AA"
- tools:src="@android:drawable/ic_btn_speak_now"/>
- </FrameLayout>
- </ViewAnimator>
+ android:elevation="@dimen/bubble_elevation">
+ <ImageView
+ android:id="@+id/bubble_icon_avatar"
+ android:layout_width="@dimen/bubble_size"
+ android:layout_height="@dimen/bubble_size"
+ tools:src="@android:drawable/ic_btn_speak_now"/>
+ <ImageView
+ android:id="@+id/bubble_icon_primary"
+ android:layout_width="@dimen/bubble_small_icon_size"
+ android:layout_height="@dimen/bubble_small_icon_size"
+ android:layout_gravity="bottom|right"
+ android:padding="@dimen/bubble_small_icon_padding"
+ android:tint="@android:color/white"
+ android:tintMode="src_in"
+ android:background="@drawable/bubble_shape_circle_small"
+ android:measureAllChildren="false"
+ tools:backgroundTint="#FF0000AA"
+ tools:src="@android:drawable/ic_btn_speak_now"/>
+ </FrameLayout>
</RelativeLayout>
<!-- The RelativeLayout below serves as boundary for @id/bubble_expanded_layout during animation -->
<RelativeLayout
diff --git a/java/com/android/newbubble/res/values/styles.xml b/java/com/android/newbubble/res/values/styles.xml
index 6c138d645..5a900be6b 100644
--- a/java/com/android/newbubble/res/values/styles.xml
+++ b/java/com/android/newbubble/res/values/styles.xml
@@ -18,10 +18,11 @@
<resources>
<style name="CheckableButton">
<item name="android:layout_width">@dimen/bubble_expanded_width</item>
- <item name="android:layout_height">wrap_content</item>
+ <item name="android:layout_height">44dp</item>
- <item name="android:paddingTop">@dimen/bubble_button_padding_vertical</item>
- <item name="android:paddingBottom">@dimen/bubble_button_padding_vertical</item>
+ <item name="android:gravity">center_vertical</item>
+ <item name="android:maxLines">2</item>
+ <item name="android:ellipsize">end</item>
<item name="android:paddingStart">@dimen/bubble_button_padding_horizontal</item>
<item name="android:paddingEnd">@dimen/bubble_button_padding_horizontal</item>
<item name="android:drawablePadding">@dimen/bubble_icon_padding</item>
diff --git a/java/com/android/newbubble/res/values/values.xml b/java/com/android/newbubble/res/values/values.xml
index 540f6653e..2e72c5e5e 100644
--- a/java/com/android/newbubble/res/values/values.xml
+++ b/java/com/android/newbubble/res/values/values.xml
@@ -36,7 +36,7 @@
<dimen name="bubble_elevation">6dp</dimen>
<dimen name="bubble_expanded_elevation">8dp</dimen>
- <dimen name="bubble_expanded_width">160dp</dimen>
+ <dimen name="bubble_expanded_width">176dp</dimen>
<dimen name="bubble_radius">16dp</dimen>
<dimen name="bubble_expanded_separator_height">8dp</dimen>
<dimen name="bubble_small_icon_size">24dp</dimen>