Track LauncherState, RecentsAnimation, resumed state for task bar in one place

TODO:
- Consider delaying animating task bar to stashed towards all apps state until user releasing their finger (tho in this change heuristic is applied for stashing and unstashing respectively)
- Further consolidate some animation logic

Bug: 204220602
Test: manual

Change-Id: I58b4d035fcf65a9f5c68e69c129eae95b89b1c4a
This commit is contained in:
Tracy Zhou
2021-11-08 00:48:53 -08:00
parent f37d7a21f2
commit e89a83b65d
3 changed files with 417 additions and 242 deletions

View File

@@ -24,6 +24,7 @@ import android.view.View;
import com.android.launcher3.anim.AlphaUpdateListener;
import java.util.Arrays;
import java.util.function.Consumer;
/**
* Utility class to handle separating a single value as a factor of multiple values
@@ -85,6 +86,8 @@ public class MultiValueAlpha {
// Factor of all other alpha channels, only valid if mMyMask is present in mValidMask.
private float mOthers = 1;
private Consumer<Float> mConsumer;
AlphaProperty(int myMask) {
mMyMask = myMask;
}
@@ -109,16 +112,24 @@ public class MultiValueAlpha {
mValidMask = mMyMask;
mValue = value;
mView.setAlpha(mOthers * mValue);
final float alpha = mOthers * mValue;
mView.setAlpha(alpha);
if (mUpdateVisibility) {
AlphaUpdateListener.updateVisibility(mView);
}
if (mConsumer != null) {
mConsumer.accept(mValue);
}
}
public float getValue() {
return mValue;
}
public void setConsumer(Consumer<Float> consumer) {
mConsumer = consumer;
}
@Override
public String toString() {
return Float.toString(mValue);