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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user