Skip to content

Commit

Permalink
LockscreenView: improved animation
Browse files Browse the repository at this point in the history
Signed-off-by: DHD2280 <[email protected]>
  • Loading branch information
DHD2280 committed Jan 24, 2025
1 parent 8a12cea commit 710b0c4
Showing 1 changed file with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class LockscreenView extends FrameLayout {
private CurrentWeatherView mWeatherView;
private LockscreenWidgetsView mWidgetsView;
private AnimatorSet currentAnimationSet;
private float mClockScale = 1f;

private boolean mLockscreenClockEnabled, mLockscreenWeatherEnabled, mLockscreenWidgetsEnabled;

Expand Down Expand Up @@ -120,6 +121,10 @@ public int getClockHeight() {
return mClockContainer.getHeight();
}

public void setClockScale(float scale) {
mClockScale = scale;
}

public void setAodStuff(int aodUiDeBurninY, int stockClockHeight) {
mAodUiDeBurninY = aodUiDeBurninY;
mStockClockHeight = stockClockHeight;
Expand Down Expand Up @@ -179,7 +184,13 @@ public void animateViewToAod() {
int measuredHeight = mClockContainer.getMeasuredHeight();

int originalHeight = mClockContainer.getHeight();
float scaledHeight = originalHeight * 0.8f;
float baseScaleY = 0.8f;
float dynamicScaleY = baseScaleY / mClockScale;
float scaled = originalHeight * mClockScale;
float heightDifference = originalHeight - scaled;
// if (scaled < originalHeight) {
// heightDifference = 0;
// }

float desiredBottomY = (mAodUiDeBurninY + mStockClockHeight);
float deltaY = desiredBottomY - (mStockClockHeight + originalHeight);
Expand All @@ -191,8 +202,8 @@ public void animateViewToAod() {
ObjectAnimator translationY = ObjectAnimator.ofFloat(this, "translationY", this.getTranslationY() + deltaY);

// Scale View
ObjectAnimator scaleX = ObjectAnimator.ofFloat(this, "scaleX", 0.8f);
ObjectAnimator scaleY = ObjectAnimator.ofFloat(this, "scaleY", 0.8f);
ObjectAnimator scaleX = ObjectAnimator.ofFloat(this, "scaleX", dynamicScaleY);
ObjectAnimator scaleY = ObjectAnimator.ofFloat(this, "scaleY", dynamicScaleY);

currentAnimationSet = new AnimatorSet();
List<Animator> animations = new ArrayList<>();
Expand Down

0 comments on commit 710b0c4

Please sign in to comment.