Tap to pause/play the lottie animation in remaining PrivateSpace setup screens

This is to conform to a11y motion stopping requirements.

Test: manually
Bug: 379258725
Flag: EXEMPT bugfix

Change-Id: Ic06cb03f5490def37894b8f448e9e435ad5baf35
This commit is contained in:
Kasia Krejszeff
2025-03-07 20:33:46 +00:00
parent f909314daf
commit 14bdf5e927
2 changed files with 24 additions and 0 deletions

View File

@@ -51,6 +51,8 @@ public class PrivateSpaceSetLockFragment extends InstrumentedFragment {
private static final String TAG = "PrivateSpaceSetLockFrag";
private static final int HEADER_TEXT_MAX_LINES = 4;
private boolean mIsAnimationPlaying = true;
@Override
public View onCreateView(
LayoutInflater inflater,
@@ -91,6 +93,7 @@ public class PrivateSpaceSetLockFragment extends InstrumentedFragment {
requireActivity().getOnBackPressedDispatcher().addCallback(this, callback);
LottieAnimationView lottieAnimationView = rootView.findViewById(R.id.lottie_animation);
LottieColorUtils.applyDynamicColors(getContext(), lottieAnimationView);
lottieAnimationView.setOnClickListener(v -> handleAnimationClick(lottieAnimationView));
return rootView;
}
@@ -130,4 +133,13 @@ public class PrivateSpaceSetLockFragment extends InstrumentedFragment {
Log.w(TAG, "Private profile user handle is null");
}
}
private void handleAnimationClick(LottieAnimationView lottieAnimationView) {
if (mIsAnimationPlaying) {
lottieAnimationView.pauseAnimation();
} else {
lottieAnimationView.playAnimation();
}
mIsAnimationPlaying = !mIsAnimationPlaying;
}
}

View File

@@ -49,6 +49,8 @@ import java.util.List;
public class SetupSuccessFragment extends InstrumentedFragment {
private static final String TAG = "SetupSuccessFragment";
private boolean mIsAnimationPlaying = true;
@Override
public View onCreateView(
LayoutInflater inflater,
@@ -80,6 +82,7 @@ public class SetupSuccessFragment extends InstrumentedFragment {
requireActivity().getOnBackPressedDispatcher().addCallback(this, callback);
LottieAnimationView lottieAnimationView = rootView.findViewById(R.id.lottie_animation);
LottieColorUtils.applyDynamicColors(getContext(), lottieAnimationView);
lottieAnimationView.setOnClickListener(v -> handleAnimationClick(lottieAnimationView));
return rootView;
}
@@ -141,4 +144,13 @@ public class SetupSuccessFragment extends InstrumentedFragment {
task.finishAndRemoveTask();
}
}
private void handleAnimationClick(LottieAnimationView lottieAnimationView) {
if (mIsAnimationPlaying) {
lottieAnimationView.pauseAnimation();
} else {
lottieAnimationView.playAnimation();
}
mIsAnimationPlaying = !mIsAnimationPlaying;
}
}