Tap to pause/play the lottie animation in PrivateSpace education screen

This is to conform to a11y motion stopping requirements.

Change-Id: I73637af20688ee7f5fb5226f871dc57ed9b54e0d
Test: manually
Bug: 379258725
Flag: EXEMPT bugfix
This commit is contained in:
Kasia Krejszeff
2025-01-09 13:07:27 +00:00
parent 305a8e0ea7
commit 7b199e4d51

View File

@@ -44,6 +44,8 @@ import java.util.regex.Pattern;
public class PrivateSpaceEducation extends InstrumentedFragment {
private static final String TAG = "PrivateSpaceEducation";
private boolean mIsAnimationPlaying = true;
@Override
public View onCreateView(
LayoutInflater inflater,
@@ -73,6 +75,7 @@ public class PrivateSpaceEducation extends InstrumentedFragment {
.build());
LottieAnimationView lottieAnimationView = rootView.findViewById(R.id.lottie_animation);
LottieColorUtils.applyDynamicColors(getContext(), lottieAnimationView);
lottieAnimationView.setOnClickListener(v -> handleAnimationClick(lottieAnimationView));
TextView infoTextView = rootView.findViewById(R.id.learn_more);
Pattern pattern = Pattern.compile(infoTextView.getText().toString());
@@ -110,4 +113,13 @@ public class PrivateSpaceEducation extends InstrumentedFragment {
}
};
}
private void handleAnimationClick(LottieAnimationView lottieAnimationView) {
if (mIsAnimationPlaying) {
lottieAnimationView.pauseAnimation();
} else {
lottieAnimationView.playAnimation();
}
mIsAnimationPlaying = !mIsAnimationPlaying;
}
}