Refactor the BorderAnimator for simplicity

The internal implementation of BorderAnimator does not need to be as exposed. refactored the class to be simpler to implement

Flag: ENABLE_KEYBOARD_QUICK_SWITCH, ENABLE_CURSOR_HOVER_STATES
Bug: 302334949
Test: check border animation in keyboard quick switch and recents view
Change-Id: I8a2e4fa0abc5af743352cd6409aee9f2912b41a2
This commit is contained in:
Schneider Victor-tulias
2023-09-27 13:19:33 -04:00
parent 7f1b5d0a70
commit 7335bcf7f5
6 changed files with 370 additions and 398 deletions

View File

@@ -40,6 +40,8 @@ import com.android.systemui.shared.recents.model.ThumbnailData;
import java.util.function.Consumer;
import kotlin.Unit;
/**
* A view that displays a recent task during a keyboard quick switch.
*/
@@ -96,17 +98,18 @@ public class KeyboardQuickSwitchTaskView extends ConstraintLayout {
Resources resources = mContext.getResources();
Preconditions.assertNotNull(mContent);
mBorderAnimator = new BorderAnimator(
mBorderAnimator = BorderAnimator.createScalingBorderAnimator(
/* borderRadiusPx= */ resources.getDimensionPixelSize(
R.dimen.keyboard_quick_switch_task_view_radius),
/* borderColor= */ mBorderColor,
/* borderAnimationParams= */ new BorderAnimator.ScalingParams(
/* borderWidthPx= */ resources.getDimensionPixelSize(
/* borderWidthPx= */ resources.getDimensionPixelSize(
R.dimen.keyboard_quick_switch_border_width),
/* boundsBuilder= */ bounds -> bounds.set(
0, 0, getWidth(), getHeight()),
/* targetView= */ this,
/* contentView= */ mContent));
/* boundsBuilder= */ bounds -> {
bounds.set(0, 0, getWidth(), getHeight());
return Unit.INSTANCE;
},
/* targetView= */ this,
/* contentView= */ mContent,
/* borderColor= */ mBorderColor);
}
@Nullable