Merge "Tap to pause/play the lottie animation in PrivateSpace education screen" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
f909314daf
@@ -44,6 +44,8 @@ import java.util.regex.Pattern;
|
|||||||
public class PrivateSpaceEducation extends InstrumentedFragment {
|
public class PrivateSpaceEducation extends InstrumentedFragment {
|
||||||
private static final String TAG = "PrivateSpaceEducation";
|
private static final String TAG = "PrivateSpaceEducation";
|
||||||
|
|
||||||
|
private boolean mIsAnimationPlaying = true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(
|
public View onCreateView(
|
||||||
LayoutInflater inflater,
|
LayoutInflater inflater,
|
||||||
@@ -73,6 +75,7 @@ public class PrivateSpaceEducation extends InstrumentedFragment {
|
|||||||
.build());
|
.build());
|
||||||
LottieAnimationView lottieAnimationView = rootView.findViewById(R.id.lottie_animation);
|
LottieAnimationView lottieAnimationView = rootView.findViewById(R.id.lottie_animation);
|
||||||
LottieColorUtils.applyDynamicColors(getContext(), lottieAnimationView);
|
LottieColorUtils.applyDynamicColors(getContext(), lottieAnimationView);
|
||||||
|
lottieAnimationView.setOnClickListener(v -> handleAnimationClick(lottieAnimationView));
|
||||||
|
|
||||||
TextView infoTextView = rootView.findViewById(R.id.learn_more);
|
TextView infoTextView = rootView.findViewById(R.id.learn_more);
|
||||||
Pattern pattern = Pattern.compile(infoTextView.getText().toString());
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user