Merge "Handle touch on bubble bar while animating" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
3fcdc0a39f
@@ -132,6 +132,17 @@ public class BubbleBarViewController {
|
||||
});
|
||||
|
||||
mBubbleBarViewAnimator = new BubbleBarViewAnimator(mBarView, mBubbleStashController);
|
||||
mBarView.setController(new BubbleBarView.Controller() {
|
||||
@Override
|
||||
public float getBubbleBarTranslationY() {
|
||||
return mBubbleStashController.getBubbleBarTranslationY();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBubbleBarTouchedWhileAnimating() {
|
||||
BubbleBarViewController.this.onBubbleBarTouchedWhileAnimating();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void onBubbleClicked(View v) {
|
||||
@@ -140,14 +151,6 @@ public class BubbleBarViewController {
|
||||
Log.e(TAG, "bubble click listener, bubble was null");
|
||||
}
|
||||
|
||||
if (mBarView.isAnimatingNewBubble()) {
|
||||
mBubbleBarViewAnimator.onBubbleClickedWhileAnimating();
|
||||
mBubbleStashController.showBubbleBarImmediate();
|
||||
setExpanded(true);
|
||||
mBubbleBarController.showAndSelectBubble(bubble);
|
||||
return;
|
||||
}
|
||||
|
||||
final String currentlySelected = mBubbleBarController.getSelectedBubbleKey();
|
||||
if (mBarView.isExpanded() && Objects.equals(bubble.getKey(), currentlySelected)) {
|
||||
// Tapping the currently selected bubble while expanded collapses the view.
|
||||
@@ -158,6 +161,11 @@ public class BubbleBarViewController {
|
||||
}
|
||||
}
|
||||
|
||||
private void onBubbleBarTouchedWhileAnimating() {
|
||||
mBubbleBarViewAnimator.onBubbleBarTouchedWhileAnimating();
|
||||
mBubbleStashController.onNewBubbleAnimationInterrupted(false, mBarView.getTranslationY());
|
||||
}
|
||||
|
||||
private void onBubbleBarClicked() {
|
||||
if (mShouldShowEducation) {
|
||||
mShouldShowEducation = false;
|
||||
@@ -169,6 +177,10 @@ public class BubbleBarViewController {
|
||||
// Show user education relative to the reference point
|
||||
mSystemUiProxy.showUserEducation(position);
|
||||
} else {
|
||||
// ensure that the bubble bar has the correct translation. we may have just interrupted
|
||||
// the animation by touching the bubble bar.
|
||||
mBubbleBarTranslationY.animateToValue(mBubbleStashController.getBubbleBarTranslationY())
|
||||
.start();
|
||||
setExpanded(true);
|
||||
}
|
||||
}
|
||||
@@ -505,10 +517,17 @@ public class BubbleBarViewController {
|
||||
/**
|
||||
* Notifies {@link BubbleBarView} that drag and all animations are finished.
|
||||
*/
|
||||
public void onDragEnd() {
|
||||
public void onDragBubbleEnded() {
|
||||
mBarView.setDraggedBubble(null);
|
||||
}
|
||||
|
||||
/** Notifies that dragging the bubble bar ended. */
|
||||
public void onDragBubbleBarEnded() {
|
||||
// we may have changed the bubble bar translation Y value from the value it had at the
|
||||
// beginning of the drag, so update the translation Y animator state
|
||||
mBubbleBarTranslationY.updateValue(mBarView.getTranslationY());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get translation for bubble bar when drag is released.
|
||||
*
|
||||
@@ -516,9 +535,6 @@ public class BubbleBarViewController {
|
||||
*/
|
||||
public PointF getBubbleBarDragReleaseTranslation(PointF initialTranslation,
|
||||
BubbleBarLocation location) {
|
||||
if (location == mBarView.getBubbleBarLocation()) {
|
||||
return initialTranslation;
|
||||
}
|
||||
return mBarView.getBubbleBarDragReleaseTranslation(initialTranslation, location);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user