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 9b5de20..a24f69d 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 @@ -23,13 +23,41 @@ setContentView(R.layout.activity_animation); animationCanvas = this.findViewById(R.id.animationMyCanvas); - Button button = findViewById(R.id.button_playback); - button.setOnClickListener(new View.OnClickListener(){ + //アニメーションの再生停止 + Button buttonPlayback = findViewById(R.id.button_playback); + buttonPlayback.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { animationCanvas.onClickPlayback(); } }); + + //最初に戻す + Button buttonReset = findViewById(R.id.button_reset); + buttonReset.setOnClickListener(new View.OnClickListener(){ + @Override + public void onClick(View v) { + animationCanvas.resetAnimationPage(); + } + }); + + //閉じる + Button buttonClose = findViewById(R.id.button_close); + buttonClose.setOnClickListener(new View.OnClickListener(){ + @Override + public void onClick(View v) { + finish(); + } + }); + + Button buttonDetail = findViewById(R.id.button_detail); + buttonDetail.setOnClickListener(new View.OnClickListener(){ + @Override + public void onClick(View v) { + + } + }); + } } \ No newline at end of file diff --git a/app/src/main/java/org/ntlab/acanthus_client/views/animation/AnimationCanvas.java b/app/src/main/java/org/ntlab/acanthus_client/views/animation/AnimationCanvas.java index 8106117..73aa4c4 100644 --- a/app/src/main/java/org/ntlab/acanthus_client/views/animation/AnimationCanvas.java +++ b/app/src/main/java/org/ntlab/acanthus_client/views/animation/AnimationCanvas.java @@ -22,10 +22,12 @@ private Timer timer; private CountUpTimerTask timerTask; private Handler handler = new Handler(Looper.getMainLooper()); + private int msec = 100; //ページ指定用の変数 private int pageNo = 0; + public AnimationCanvas(Context context, AttributeSet attrs) { super(context, attrs); } @@ -42,6 +44,7 @@ } + //アニメーションの再生停止 public void onClickPlayback(){ if(timer != null){ //timerの終了 @@ -52,7 +55,7 @@ //timerの生成 this.timer = new Timer(); this.timerTask = new CountUpTimerTask(); - this.timer.schedule(timerTask,0,100);//スケジュールを100ms毎に設定する。 + this.timer.schedule(timerTask,0, msec);//スケジュールを100ms毎に設定する。 } } @@ -69,6 +72,11 @@ } } + //アニメーションを最初のページに戻す。 + public void resetAnimationPage(){ + pageNo = 0; + postInvalidate(); + } diff --git a/app/src/main/res/layout/activity_animation.xml b/app/src/main/res/layout/activity_animation.xml index 7d9c320..69e0a2e 100644 --- a/app/src/main/res/layout/activity_animation.xml +++ b/app/src/main/res/layout/activity_animation.xml @@ -25,4 +25,41 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_bias="1.0" /> + +