質問編集履歴
3
変更点のコードを変更箇所に書き換えました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -392,9 +392,37 @@
|
|
392
392
|
|
393
393
|
```ここに言語を入力
|
394
394
|
|
395
|
-
|
395
|
+
変更箇所
|
396
|
+
|
396
|
-
|
397
|
+
private void showWorkout(Workout workout) {
|
398
|
+
|
399
|
+
countTextView.setText(""+workout.getCount());
|
400
|
+
|
401
|
+
setTextView.setText(""+workout.getSet());
|
402
|
+
|
403
|
+
// progressBar.setProgress(workout.getTick());
|
404
|
+
|
405
|
+
ObjectAnimator animation = ObjectAnimator.ofInt(progressBar,"progress",workout.getTick());
|
406
|
+
|
407
|
+
animation.setDuration(500); // 0.5 secondかけて実行する
|
408
|
+
|
409
|
+
animation.start();
|
410
|
+
|
411
|
+
int left = workout.getLeftSecond();
|
412
|
+
|
413
|
+
int minute = left / 60;
|
414
|
+
|
415
|
+
int second = left % 60;
|
416
|
+
|
417
|
+
lefttimeTextView.setText(String.format((minute>0?"%1$02d:":"")+"%2$02d", minute, second));
|
418
|
+
|
419
|
+
}
|
420
|
+
|
421
|
+
|
422
|
+
|
423
|
+
|
424
|
+
|
397
|
-
int getTick() { return currentTick; }
|
425
|
+
int getTick() { return currentTick; }//書き換え
|
398
426
|
|
399
427
|
|
400
428
|
|
@@ -418,7 +446,9 @@
|
|
418
446
|
|
419
447
|
tick = tickMax -1;//切り替わったときに一秒増えないように調整
|
420
448
|
|
421
|
-
currentTick = 1;
|
449
|
+
currentTick = 1;//tuiki
|
450
|
+
|
451
|
+
|
422
452
|
|
423
453
|
if(--count <= 0) {
|
424
454
|
|
@@ -440,7 +470,7 @@
|
|
440
470
|
|
441
471
|
public void onFinish() {
|
442
472
|
|
443
|
-
currentTick = 0;
|
473
|
+
currentTick = 0;//追記
|
444
474
|
|
445
475
|
tick = 0;
|
446
476
|
|
2
質問箇所の追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -392,39 +392,73 @@
|
|
392
392
|
|
393
393
|
```ここに言語を入力
|
394
394
|
|
395
|
-
|
395
|
+
質問箇所
|
396
|
+
|
396
|
-
|
397
|
+
int getTick() { return currentTick; }
|
398
|
+
|
399
|
+
|
400
|
+
|
401
|
+
void start(Listener listener) {
|
402
|
+
|
403
|
+
this.listener = listener;
|
404
|
+
|
405
|
+
long millisInFuture = (tick+tickMax*(count*set-1))*1000L/PARTICLE_SIZE;
|
406
|
+
|
397
|
-
|
407
|
+
countDownTimer = new CountDownTimer(millisInFuture, 1000L/PARTICLE_SIZE) { //[ms]
|
398
|
-
|
408
|
+
|
399
|
-
|
409
|
+
@Override
|
400
|
-
|
410
|
+
|
401
|
-
|
411
|
+
public void onTick(long millisUntilFinished) {
|
402
|
-
|
412
|
+
|
403
|
-
|
413
|
+
tick --;
|
404
|
-
|
414
|
+
|
405
|
-
|
415
|
+
currentTick++;
|
416
|
+
|
406
|
-
|
417
|
+
if(tick < 0) {
|
418
|
+
|
419
|
+
tick = tickMax -1;//切り替わったときに一秒増えないように調整
|
420
|
+
|
407
|
-
|
421
|
+
currentTick = 1;
|
408
|
-
|
422
|
+
|
409
|
-
|
423
|
+
if(--count <= 0) {
|
424
|
+
|
425
|
+
set --;
|
426
|
+
|
427
|
+
count = countMax;
|
410
428
|
|
411
429
|
}
|
412
430
|
|
413
|
-
|
431
|
+
}
|
432
|
+
|
414
|
-
|
433
|
+
Workout.this.listener.progress(Workout.this);
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
}
|
438
|
+
|
415
|
-
|
439
|
+
@Override
|
416
|
-
|
440
|
+
|
417
|
-
|
441
|
+
public void onFinish() {
|
418
|
-
|
442
|
+
|
419
|
-
|
443
|
+
currentTick = 0;
|
444
|
+
|
420
|
-
|
445
|
+
tick = 0;
|
446
|
+
|
447
|
+
count = 0;
|
448
|
+
|
449
|
+
set = 0;
|
450
|
+
|
421
|
-
|
451
|
+
Workout.this.listener.finish(Workout.this);
|
422
|
-
|
452
|
+
|
423
|
-
|
453
|
+
Workout.this.listener = null;
|
424
|
-
|
454
|
+
|
425
|
-
|
455
|
+
}
|
426
|
-
|
456
|
+
|
427
|
-
|
457
|
+
}.start();
|
458
|
+
|
459
|
+
listener.start(Workout.this);
|
460
|
+
|
461
|
+
}
|
428
462
|
|
429
463
|
```
|
430
464
|
|
1
一部修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
※気になるところ(下のソースコード)
|
16
16
|
|
17
|
-
ここに記述した処理が終わ
|
17
|
+
ここに記述した処理を繰り返し前のtimer処理が終わった段階で呼びたい
|
18
18
|
|
19
19
|
|
20
20
|
|