diff options
Diffstat (limited to 'java/com/android')
-rw-r--r-- | java/com/android/newbubble/NewBubble.java | 26 | ||||
-rw-r--r-- | java/com/android/newbubble/res/layout/new_bubble_base.xml | 10 | ||||
-rw-r--r-- | java/com/android/newbubble/res/values/values.xml | 1 |
3 files changed, 15 insertions, 22 deletions
diff --git a/java/com/android/newbubble/NewBubble.java b/java/com/android/newbubble/NewBubble.java index 2e98ad17b..54e56ba61 100644 --- a/java/com/android/newbubble/NewBubble.java +++ b/java/com/android/newbubble/NewBubble.java @@ -25,7 +25,6 @@ import android.annotation.SuppressLint; import android.app.PendingIntent.CanceledException; import android.content.Context; import android.content.Intent; -import android.graphics.Outline; import android.graphics.PixelFormat; import android.graphics.Rect; import android.graphics.drawable.Animatable; @@ -47,7 +46,6 @@ import android.view.MotionEvent; import android.view.View; import android.view.View.AccessibilityDelegate; import android.view.ViewGroup; -import android.view.ViewOutlineProvider; import android.view.ViewTreeObserver.OnPreDrawListener; import android.view.WindowManager; import android.view.WindowManager.LayoutParams; @@ -525,7 +523,7 @@ public class NewBubble { public void updateAvatar(@NonNull Drawable avatar) { if (!avatar.equals(currentInfo.getAvatar())) { currentInfo = NewBubbleInfo.from(currentInfo).setAvatar(avatar).build(); - viewHolder.getPrimaryAvatar().setImageDrawable(currentInfo.getAvatar()); + viewHolder.getPrimaryAvatar().setBackground(currentInfo.getAvatar()); } } @@ -560,7 +558,7 @@ public class NewBubble { savedYPosition = -1; viewHolder - .getPrimaryButton() + .getPrimaryAvatar() .animate() .translationZ( context @@ -569,7 +567,7 @@ public class NewBubble { } void onMoveFinish() { - viewHolder.getPrimaryButton().animate().translationZ(0); + viewHolder.getPrimaryAvatar().animate().translationZ(0); } void primaryButtonClick() { @@ -669,17 +667,9 @@ public class NewBubble { primaryIconMoveDistance = context.getResources().getDimensionPixelSize(R.dimen.bubble_size) - context.getResources().getDimensionPixelSize(R.dimen.bubble_small_icon_size); - // Set boundary for primary button to show elevation (background is transparent) - viewHolder - .getPrimaryButton() - .setOutlineProvider( - new ViewOutlineProvider() { - @Override - public void getOutline(View view, Outline outline) { - ViewOutlineProvider.BACKGROUND.getOutline(view, outline); - outline.setAlpha(1); - } - }); + + // Avatar + viewHolder.getPrimaryAvatar().setBackground(currentInfo.getAvatar()); // Small icon Drawable smallIconBackgroundCircle = @@ -689,7 +679,6 @@ public class NewBubble { smallIconBackgroundCircle.setTint(context.getColor(R.color.bubble_button_color_blue)); viewHolder.getPrimaryIcon().setBackground(smallIconBackgroundCircle); viewHolder.getPrimaryIcon().setImageIcon(currentInfo.getPrimaryIcon()); - viewHolder.getPrimaryAvatar().setImageDrawable(currentInfo.getAvatar()); updatePrimaryIconAnimation(); updateButtonStates(); @@ -873,6 +862,9 @@ public class NewBubble { xValueAnimator.setInterpolator(new LinearOutSlowInInterpolator()); xValueAnimator.addUpdateListener( (valueAnimator) -> { + if (windowParams == null) { + return; + } // Update windowParams and the root layout. // We can't do ViewPropertyAnimation since it clips children. float newX = (float) valueAnimator.getAnimatedValue(); 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 c86d3bbcc..9b8250d6b 100644 --- a/java/com/android/newbubble/res/layout/new_bubble_base.xml +++ b/java/com/android/newbubble/res/layout/new_bubble_base.xml @@ -40,14 +40,13 @@ android:layout_marginTop="@dimen/bubble_shadow_padding_size_vertical" android:layout_marginBottom="@dimen/bubble_shadow_padding_size_vertical" android:contentDescription="@string/a11y_bubble_description" - android:background="@drawable/bubble_shape_circle" - android:measureAllChildren="false" - android:elevation="@dimen/bubble_elevation"> + android:measureAllChildren="false"> <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"/> + android:background="@android:drawable/ic_btn_speak_now" + android:elevation="@dimen/bubble_elevation"/> <ImageView android:id="@+id/bubble_icon_primary" android:layout_width="@dimen/bubble_small_icon_size" @@ -59,7 +58,8 @@ android:background="@drawable/bubble_shape_circle_small" android:measureAllChildren="false" tools:backgroundTint="#FF0000AA" - tools:src="@android:drawable/ic_btn_speak_now"/> + tools:src="@android:drawable/ic_btn_speak_now" + android:elevation="@dimen/bubble_dragging_elevation"/> </FrameLayout> </RelativeLayout> <!-- The RelativeLayout below serves as boundary for @id/bubble_expanded_layout during animation --> diff --git a/java/com/android/newbubble/res/values/values.xml b/java/com/android/newbubble/res/values/values.xml index 2e72c5e5e..f449c9bed 100644 --- a/java/com/android/newbubble/res/values/values.xml +++ b/java/com/android/newbubble/res/values/values.xml @@ -19,6 +19,7 @@ <dimen name="bubble_size">56dp</dimen> <dimen name="bubble_icon_padding">16dp</dimen> <dimen name="bubble_dragging_elevation_change">6dp</dimen> + <dimen name="bubble_dragging_elevation">12dp</dimen> <dimen name="bubble_button_height">36dp</dimen> <dimen name="bubble_button_icon_padding">16dp</dimen> |