diff options
author | yueg <yueg@google.com> | 2018-01-02 16:23:14 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-01-02 16:47:06 -0800 |
commit | f473e1d0988bb13874a0774db9cbcd66777f9150 (patch) | |
tree | 0bdad6c3221ca608439b5b518d746ccce89cb120 /java/com/android/newbubble/NewBubble.java | |
parent | 31586c7946fdc1a238d64bba07fbab9b0c4ea872 (diff) |
Bubble v2 dismiss.
Drag and drop bubble to bottom to hide or end call. Flinging to bottom does not trigger the actions. Color/text is not final. Navigation bar is not hiden and the change will be in a following CL.
Bug: 67605985
Test: NewBubbleTest
PiperOrigin-RevId: 180608133
Change-Id: Iff4cb32226d8fbf0f8e5319f6876a1d74c336b4a
Diffstat (limited to 'java/com/android/newbubble/NewBubble.java')
-rw-r--r-- | java/com/android/newbubble/NewBubble.java | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/java/com/android/newbubble/NewBubble.java b/java/com/android/newbubble/NewBubble.java index 469c15d71..f5a036f93 100644 --- a/java/com/android/newbubble/NewBubble.java +++ b/java/com/android/newbubble/NewBubble.java @@ -60,6 +60,7 @@ import android.view.animation.AnticipateInterpolator; import android.view.animation.OvershootInterpolator; import android.widget.ImageView; import android.widget.TextView; +import android.widget.Toast; import android.widget.ViewAnimator; import com.android.dialer.common.LogUtil; import com.android.dialer.logging.DialerImpression; @@ -830,6 +831,12 @@ public class NewBubble { */ void replaceViewHolder() { LogUtil.enterBlock("NewBubble.replaceViewHolder"); + // Don't do it. If windowParams is null, either we haven't initialized it or we set it to null. + // There is no need to recreate bubble. + if (windowParams == null) { + return; + } + ViewHolder oldViewHolder = viewHolder; // Create a new ViewHolder and copy needed info. @@ -873,6 +880,27 @@ public class NewBubble { return viewHolder.getExpandedView().getVisibility(); } + void bottomActionDismiss() { + logBasicOrCallImpression(DialerImpression.Type.BUBBLE_V2_BOTTOM_ACTION_DISMISS); + // Create bubble at default location at next time + hideAndReset(); + windowParams = null; + } + + void bottomActionEndCall() { + logBasicOrCallImpression(DialerImpression.Type.BUBBLE_V2_BOTTOM_ACTION_END_CALL); + // Hide without animation + hideHelper( + () -> { + defaultAfterHidingAnimation(); + DialerCall call = getCall(); + if (call != null) { + call.disconnect(); + Toast.makeText(context, R.string.incall_call_ended, Toast.LENGTH_SHORT).show(); + } + }); + } + private boolean isDrawingFromRight() { return (windowParams.gravity & Gravity.RIGHT) == Gravity.RIGHT; } @@ -896,11 +924,7 @@ public class NewBubble { } private void logBasicOrCallImpression(DialerImpression.Type impressionType) { - // Bubble is shown for outgoing, active or background call - DialerCall call = CallList.getInstance().getOutgoingCall(); - if (call == null) { - call = CallList.getInstance().getActiveOrBackgroundCall(); - } + DialerCall call = getCall(); if (call != null) { Logger.get(context) .logCallImpression(impressionType, call.getUniqueCallId(), call.getTimeAddedMs()); @@ -909,6 +933,15 @@ public class NewBubble { } } + private DialerCall getCall() { + // Bubble is shown for outgoing, active or background call + DialerCall call = CallList.getInstance().getOutgoingCall(); + if (call == null) { + call = CallList.getInstance().getActiveOrBackgroundCall(); + } + return call; + } + private void setPrimaryButtonAccessibilityAction(String description) { viewHolder .getPrimaryButton() |