Ich versuche, Spiel und Pause Aktion in einer Taste hinzufügen das ist mein Code Ich füge gerade Spiel Aktion, können Sie mir bitte helfen?Wie kann ich mehrere Aktionen für eine Taste hinzufügen
fab_play_pause.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
timerHasStarted = true;
countDownTimer.start();
Resources res = getResources();
Drawable drawable = res.getDrawable(R.drawable.custom_progressbar_drawable);
final ProgressBar mProgress = (ProgressBar) rootView.findViewById(R.id.circularProgressbar);
mProgress.setProgress(0); // Main Progress
mProgress.setSecondaryProgress(100); // Secondary Progress
mProgress.setMax(100); // Maximum Progress
mProgress.setProgressDrawable(drawable);
mProgress.setRotation(0);
ObjectAnimator animation = ObjectAnimator.ofInt(mProgress, "progress", 0, 100);
animation.setDuration(startTime);
animation.setInterpolator(new DecelerateInterpolator());
animation.start();
}
});
behalten Sie einen Boolean überprüfen Sie Ihren Zustand und führen Sie die Aktion in Bezug auf den Zustand mit einem einfachen wenn sonst –