diff --git a/app/src/main/java/org/ntlab/acanthus_client/views/animation/AnimationActivity.java b/app/src/main/java/org/ntlab/acanthus_client/views/animation/AnimationActivity.java index 25d437a..441ed09 100644 --- a/app/src/main/java/org/ntlab/acanthus_client/views/animation/AnimationActivity.java +++ b/app/src/main/java/org/ntlab/acanthus_client/views/animation/AnimationActivity.java @@ -43,6 +43,7 @@ //ボタン系 private boolean buttonView = true; + private boolean player = true; private Button buttonPlayback; private Button buttonReset; private Button buttonClose; @@ -82,7 +83,8 @@ buttonPlayback = findViewById(R.id.button_playback); buttonPlayback.setOnClickListener(new View.OnClickListener(){ public void onClick(View v) { - if(onClickPlayback()){ + onClickPlayback(); + if(player){ buttonPlayback.setBackgroundDrawable(getResources().getDrawable(R.drawable.ic_baseline_play_arrow)); } else { @@ -128,6 +130,10 @@ buttonDetail = findViewById(R.id.button_detail); buttonDetail.setOnClickListener(new View.OnClickListener(){ public void onClick(View v) { + if(player){ + onClickPlayback(); + buttonPlayback.setBackgroundDrawable(getResources().getDrawable(R.drawable.ic_baseline_play_arrow)); + } Intent intent = new Intent(AnimationActivity.this, AnimationDetailActivity.class); intent.putExtra("AnimationJsonData", animationJson); startActivity(intent); @@ -220,19 +226,19 @@ } //アニメーションの再生停止 - public boolean onClickPlayback(){ + public void onClickPlayback(){ if(timer != null){ //timerの終了 timer.cancel(); timer = null; - return true; + player = true; } else{ //timerの生成 this.timer = new Timer(); this.timerTask = new CountUpTimerTask(); this.timer.schedule(timerTask,0, this.msec);//スケジュールを100ms毎に設定する。 - return false; + player = false; } }