use of carbon.widget.ProgressView in project Carbon by ZieIony.
the class CircularProgressActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initToolbar();
final ProgressView progress1 = findViewById(R.id.progress1);
final Handler handler = new Handler();
Runnable runnable = new Runnable() {
@Override
public void run() {
progress1.setProgress((float) (progress1.getProgress() + Math.random() / 100));
if (progress1.getProgress() < 1) {
handler.postDelayed(this, 10);
} else {
progress1.animateVisibility(View.INVISIBLE);
}
}
};
findViewById(R.id.button1).setOnClickListener(view -> progress1.animateVisibility(progress1.getVisibility() == View.VISIBLE ? View.INVISIBLE : View.VISIBLE));
final ProgressView progress2 = findViewById(R.id.progress2);
findViewById(R.id.button2).setOnClickListener(view -> progress2.animateVisibility(progress2.getVisibility() == View.VISIBLE ? View.INVISIBLE : View.VISIBLE));
final ProgressView progress3 = findViewById(R.id.progress3);
findViewById(R.id.button3).setOnClickListener(view -> progress3.animateVisibility(progress3.getVisibility() == View.VISIBLE ? View.INVISIBLE : View.VISIBLE));
final ProgressView progress4 = findViewById(R.id.progress4);
findViewById(R.id.button4).setOnClickListener(view -> progress4.animateVisibility(progress4.getVisibility() == View.VISIBLE ? View.INVISIBLE : View.VISIBLE));
handler.postDelayed(runnable, 10);
}
use of carbon.widget.ProgressView in project Carbon by ZieIony.
the class ProgressBarsActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initToolbar();
final ProgressView progress1 = findViewById(R.id.progress5);
findViewById(R.id.button1).setOnClickListener(view -> progress1.animateVisibility(progress1.getVisibility() == View.VISIBLE ? View.INVISIBLE : View.VISIBLE));
final ProgressView progress2 = findViewById(R.id.progress6);
final Handler handler = new Handler();
Runnable runnable = new Runnable() {
@Override
public void run() {
progress2.setProgress((float) (progress2.getProgress() + Math.random() / 100));
if (progress2.getProgress() < 1) {
handler.postDelayed(this, 10);
} else {
progress2.animateVisibility(View.INVISIBLE);
}
}
};
findViewById(R.id.button2).setOnClickListener(view -> progress2.animateVisibility(progress2.getVisibility() == View.VISIBLE ? View.INVISIBLE : View.VISIBLE));
final ProgressView progress3 = findViewById(R.id.progress7);
findViewById(R.id.button3).setOnClickListener(view -> progress3.animateVisibility(progress3.getVisibility() == View.VISIBLE ? View.INVISIBLE : View.VISIBLE));
handler.postDelayed(runnable, 10);
}
use of carbon.widget.ProgressView in project Carbon by ZieIony.
the class AnimUtils method getProgressWidthOutAnimator.
public static Animator getProgressWidthOutAnimator() {
ViewAnimator animator = new ViewAnimator();
animator.setInterpolator(new FastOutLinearInInterpolator());
animator.setOnSetupValuesListener(() -> {
ProgressView circularProgress = (ProgressView) animator.getTarget();
float start = circularProgress.getBarWidth();
animator.setFloatValues(start, 0);
animator.setDuration((long) (100 * start));
});
animator.addUpdateListener(valueAnimator -> {
ProgressView circularProgress = (ProgressView) animator.getTarget();
final float arcWidth = circularProgress.getBarPadding() + circularProgress.getBarWidth();
float value = (Float) valueAnimator.getAnimatedValue();
circularProgress.setBarWidth(value);
circularProgress.setBarPadding(arcWidth - value);
});
return animator;
}
use of carbon.widget.ProgressView in project Carbon by ZieIony.
the class AnimUtils method getProgressWidthInAnimator.
public static ValueAnimator getProgressWidthInAnimator() {
ViewAnimator animator = new ViewAnimator();
animator.setInterpolator(new LinearOutSlowInInterpolator());
animator.setOnSetupValuesListener(() -> {
ProgressView circularProgress = (ProgressView) animator.getTarget();
final float arcWidth = circularProgress.getBarPadding() + circularProgress.getBarWidth();
float start = circularProgress.getBarWidth();
animator.setFloatValues(circularProgress.getBarWidth(), arcWidth);
animator.setDuration((long) (100 * (arcWidth - start)));
});
animator.addUpdateListener(valueAnimator -> {
ProgressView circularProgress = (ProgressView) animator.getTarget();
final float arcWidth = circularProgress.getBarPadding() + circularProgress.getBarWidth();
float value = (Float) valueAnimator.getAnimatedValue();
circularProgress.setBarWidth(value);
circularProgress.setBarPadding(arcWidth - value);
});
return animator;
}
Aggregations