Merge "Update bubble bar stash and unstash animation" into main
This commit is contained in:
@@ -80,12 +80,14 @@ public class BubbleBarViewController {
|
||||
|
||||
// These are exposed to {@link BubbleStashController} to animate for stashing/un-stashing
|
||||
private final MultiValueAlpha mBubbleBarAlpha;
|
||||
private final AnimatedFloat mBubbleBarScale = new AnimatedFloat(this::updateScale);
|
||||
private final AnimatedFloat mBubbleBarScaleY = new AnimatedFloat(this::updateScaleY);
|
||||
private final AnimatedFloat mBubbleBarTranslationY = new AnimatedFloat(
|
||||
this::updateTranslationY);
|
||||
|
||||
// Modified when swipe up is happening on the bubble bar or task bar.
|
||||
private float mBubbleBarSwipeUpTranslationY;
|
||||
// Modified when bubble bar is springing back into the stash handle.
|
||||
private float mBubbleBarStashTranslationY;
|
||||
|
||||
// Whether the bar is hidden for a sysui state.
|
||||
private boolean mHiddenForSysui;
|
||||
@@ -125,7 +127,7 @@ public class BubbleBarViewController {
|
||||
onBubbleBarConfigurationChanged(/* animate= */ false);
|
||||
mActivity.addOnDeviceProfileChangeListener(
|
||||
dp -> onBubbleBarConfigurationChanged(/* animate= */ true));
|
||||
mBubbleBarScale.updateValue(1f);
|
||||
mBubbleBarScaleY.updateValue(1f);
|
||||
mBubbleClickListener = v -> onBubbleClicked((BubbleView) v);
|
||||
mBubbleBarClickListener = v -> expandBubbleBar();
|
||||
mBubbleDragController.setupBubbleBarView(mBarView);
|
||||
@@ -255,8 +257,8 @@ public class BubbleBarViewController {
|
||||
return mBubbleBarAlpha;
|
||||
}
|
||||
|
||||
public AnimatedFloat getBubbleBarScale() {
|
||||
return mBubbleBarScale;
|
||||
public AnimatedFloat getBubbleBarScaleY() {
|
||||
return mBubbleBarScaleY;
|
||||
}
|
||||
|
||||
public AnimatedFloat getBubbleBarTranslationY() {
|
||||
@@ -267,6 +269,27 @@ public class BubbleBarViewController {
|
||||
return mBarView.getBubbleBarCollapsedHeight();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see BubbleBarView#getRelativePivotX()
|
||||
*/
|
||||
public float getBubbleBarRelativePivotX() {
|
||||
return mBarView.getRelativePivotX();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see BubbleBarView#getRelativePivotY()
|
||||
*/
|
||||
public float getBubbleBarRelativePivotY() {
|
||||
return mBarView.getRelativePivotY();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see BubbleBarView#setRelativePivot(float, float)
|
||||
*/
|
||||
public void setBubbleBarRelativePivot(float x, float y) {
|
||||
mBarView.setRelativePivot(x, y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the bubble bar is visible or not.
|
||||
*/
|
||||
@@ -474,17 +497,20 @@ public class BubbleBarViewController {
|
||||
updateTranslationY();
|
||||
}
|
||||
|
||||
private void updateTranslationY() {
|
||||
mBarView.setTranslationY(mBubbleBarTranslationY.value
|
||||
+ mBubbleBarSwipeUpTranslationY);
|
||||
/**
|
||||
* Sets the translation of the bubble bar during the stash animation.
|
||||
*/
|
||||
public void setTranslationYForStash(float transY) {
|
||||
mBubbleBarStashTranslationY = transY;
|
||||
updateTranslationY();
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies scale properties for the entire bubble bar.
|
||||
*/
|
||||
private void updateScale() {
|
||||
float scale = mBubbleBarScale.value;
|
||||
mBarView.setScaleX(scale);
|
||||
private void updateTranslationY() {
|
||||
mBarView.setTranslationY(mBubbleBarTranslationY.value + mBubbleBarSwipeUpTranslationY
|
||||
+ mBubbleBarStashTranslationY);
|
||||
}
|
||||
|
||||
private void updateScaleY(float scale) {
|
||||
mBarView.setScaleY(scale);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user