use of android.view.ViewTreeObserver.OnPreDrawListener in project UltimateAndroid by cymcsg.
the class FilckerAnimationListView method doAnimation.
private void doAnimation() {
setEnabled(false);
animating = true;
final float durationUnit = (float) MAX_ANIM_DURATION / getHeight();
animatePreLayout(durationUnit, new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(final Animator animation) {
adapter.notifyDataSetChanged();
getViewTreeObserver().addOnPreDrawListener(new OnPreDrawListener() {
@Override
public boolean onPreDraw() {
getViewTreeObserver().removeOnPreDrawListener(this);
animatePostLayout(durationUnit);
return true;
}
});
}
});
}
use of android.view.ViewTreeObserver.OnPreDrawListener in project UltimateAndroid by cymcsg.
the class HomeArc method init.
public void init(int score) {
this.score = score;
Resources res = getResources();
tb = res.getDimension(R.dimen.historyscore_tb);
paint_black = new Paint();
paint_black.setAntiAlias(true);
paint_black.setColor(blackColor);
paint_black.setStrokeWidth(tb * 0.2f);
paint_black.setStyle(Style.STROKE);
paint_white = new Paint();
paint_white.setAntiAlias(true);
paint_white.setColor(whiteColor);
paint_white.setTextSize(tb * 6.0f);
paint_white.setStrokeWidth(tb * 0.2f);
paint_white.setTextAlign(Align.CENTER);
paint_white.setStyle(Style.STROKE);
rectf = new RectF();
rectf.set(tb * 0.5f, tb * 0.5f, tb * 18.5f, tb * 18.5f);
setLayoutParams(new LayoutParams((int) (tb * 19.5f), (int) (tb * 19.5f)));
this.getViewTreeObserver().addOnPreDrawListener(new OnPreDrawListener() {
public boolean onPreDraw() {
new thread();
getViewTreeObserver().removeOnPreDrawListener(this);
return false;
}
});
}
Aggregations