Skip to content

Commit f34a2d7

Browse files
committed
test: adjust the ceil of the initial value
1 parent aba40b5 commit f34a2d7

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

demo/src/main/java/com/liulishuo/magicprogress/demo/activity/MainActivity.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,17 @@ protected void onCreate(Bundle savedInstanceState) {
3939
private final Random random = new Random();
4040

4141
private void anim() {
42-
final int progress = random.nextInt(51);
42+
final int ceil = 26;
43+
final int progress = random.nextInt(ceil);
4344

4445
AnimatorSet set = new AnimatorSet();
4546
set.playTogether(
4647
ObjectAnimator.ofFloat(demoMpc, "percent", 0, progress / 100f),
4748
ObjectAnimator.ofInt(demoTv, "progress", 0, progress),
48-
ObjectAnimator.ofFloat(demo1Mpb, "percent", 0, random.nextInt(51) / 100f),
49-
ObjectAnimator.ofFloat(demo2Mpb, "percent", 0, random.nextInt(51) / 100f),
50-
ObjectAnimator.ofFloat(demo3Mpb, "percent", 0, random.nextInt(51) / 100f),
51-
ObjectAnimator.ofFloat(demo4Mpb, "percent", 0, random.nextInt(51) / 100f)
49+
ObjectAnimator.ofFloat(demo1Mpb, "percent", 0, random.nextInt(ceil) / 100f),
50+
ObjectAnimator.ofFloat(demo2Mpb, "percent", 0, random.nextInt(ceil) / 100f),
51+
ObjectAnimator.ofFloat(demo3Mpb, "percent", 0, random.nextInt(ceil) / 100f),
52+
ObjectAnimator.ofFloat(demo4Mpb, "percent", 0, random.nextInt(ceil) / 100f)
5253
);
5354
set.setDuration(600);
5455
set.addListener(new Animator.AnimatorListener() {

0 commit comments

Comments
 (0)