diff options
author | Nancy Chen <nancychen@google.com> | 2014-08-08 14:39:01 -0700 |
---|---|---|
committer | Nancy Chen <nancychen@google.com> | 2014-08-13 16:27:37 -0700 |
commit | 043bfe40b226819a0497c928dc3f40444731be3c (patch) | |
tree | ff87125ec7e00679f9d20b8a0a8d9259e89bbb92 | |
parent | 3718dcb345e77e421ab18a760e48f0c3a760fcca (diff) |
Reveal InCallUI starting from the user's touch point
InCallUI expanding circle should start where the UI made the call.
Bug: 16396523
Change-Id: I1c7775fcbe684a51376f5a1b744bdd06f26e7bbf
-rw-r--r-- | InCallUI/src/com/android/incallui/CallCardFragment.java | 20 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/InCallActivity.java | 13 |
2 files changed, 26 insertions, 7 deletions
diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java index e17b9dff6..6127a1d99 100644 --- a/InCallUI/src/com/android/incallui/CallCardFragment.java +++ b/InCallUI/src/com/android/incallui/CallCardFragment.java @@ -32,6 +32,7 @@ import android.telephony.PhoneNumberUtils; import android.text.TextUtils; import android.view.Display; import android.view.LayoutInflater; +import android.view.MotionEvent; import android.view.View; import android.view.ViewAnimationUtils; import android.view.ViewGroup; @@ -55,7 +56,6 @@ import java.util.List; */ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPresenter.CallCardUi> implements CallCardPresenter.CallCardUi { - private int mRevealAnimationDuration; private int mShrinkAnimationDuration; private boolean mIsLandscape; @@ -814,8 +814,9 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr } } - public void animateForNewOutgoingCall() { + public void animateForNewOutgoingCall(Point touchPoint, Call call) { final ViewGroup parent = (ViewGroup) mPrimaryCallCardContainer.getParent(); + final Point startPoint = touchPoint; final ViewTreeObserver observer = getView().getViewTreeObserver(); observer.addOnGlobalLayoutListener(new OnGlobalLayoutListener() { @@ -827,11 +828,11 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr } observer.removeOnGlobalLayoutListener(this); - final int originalHeight = mPrimaryCallCardContainer.getHeight(); final LayoutIgnoringListener listener = new LayoutIgnoringListener(); mPrimaryCallCardContainer.addOnLayoutChangeListener(listener); // Prepare the state of views before the circular reveal animation + final int originalHeight = mPrimaryCallCardContainer.getHeight(); mPrimaryCallCardContainer.setBottom(parent.getHeight()); // Set up FAB. @@ -850,7 +851,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr mCallTypeLabel.setAlpha(0); mCallNumberAndLabel.setAlpha(0); - final Animator revealAnimator = getRevealAnimator(); + final Animator revealAnimator = getRevealAnimator(startPoint); final Animator shrinkAnimator = getShrinkAnimator(parent.getHeight(), originalHeight); @@ -903,15 +904,22 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr return shrinkAnimator; } - private Animator getRevealAnimator() { + private Animator getRevealAnimator(Point touchPoint) { final Activity activity = getActivity(); final View view = activity.getWindow().getDecorView(); final Display display = activity.getWindowManager().getDefaultDisplay(); final Point size = new Point(); display.getSize(size); + int startX = size.x / 2; + int startY = size.y / 2; + if (touchPoint != null) { + startX = touchPoint.x; + startY = touchPoint.y; + } + final Animator valueAnimator = ViewAnimationUtils.createCircularReveal(view, - size.x / 2, size.y / 2, 0, Math.max(size.x, size.y)); + startX, startY, 0, Math.max(size.x, size.y)); valueAnimator.setDuration(mRevealAnimationDuration); return valueAnimator; } diff --git a/InCallUI/src/com/android/incallui/InCallActivity.java b/InCallUI/src/com/android/incallui/InCallActivity.java index 1f7db588c..03ccf157f 100644 --- a/InCallUI/src/com/android/incallui/InCallActivity.java +++ b/InCallUI/src/com/android/incallui/InCallActivity.java @@ -25,6 +25,7 @@ import android.content.DialogInterface.OnClickListener; import android.content.DialogInterface.OnCancelListener; import android.content.Intent; import android.content.res.Configuration; +import android.graphics.Point; import android.os.Bundle; import android.telephony.DisconnectCause; import android.text.TextUtils; @@ -39,6 +40,7 @@ import android.view.accessibility.AccessibilityEvent; import com.android.phone.common.animation.AnimUtils; import com.android.phone.common.animation.AnimationListenerAdapter; +import com.android.contacts.common.interactions.TouchPointManager; import com.android.incallui.Call.State; import java.util.Locale; @@ -450,7 +452,16 @@ public class InCallActivity extends Activity { if (intent.getBooleanExtra(NEW_OUTGOING_CALL, false)) { intent.removeExtra(NEW_OUTGOING_CALL); - mCallCardFragment.animateForNewOutgoingCall(); + + Call call = CallList.getInstance().getOutgoingCall(); + if (call == null) { + call = CallList.getInstance().getPendingOutgoingCall(); + } + + Bundle extras = call.getTelecommCall().getDetails().getExtras(); + Point touchPoint = (Point) (extras == null? + null : extras.getParcelable(TouchPointManager.TOUCH_POINT)); + mCallCardFragment.animateForNewOutgoingCall(touchPoint, call); } if (CallList.getInstance().getWaitingForAccountCall() != null) { |