use of android.view.animation.BounceInterpolator in project WilliamChart by diogobernardino.
the class LineCardOne method show.
@Override
public void show(Runnable action) {
super.show(action);
// Tooltip
mTip = new Tooltip(mContext, R.layout.linechart_three_tooltip, R.id.value);
((TextView) mTip.findViewById(R.id.value)).setTypeface(Typeface.createFromAsset(mContext.getAssets(), "OpenSans-Semibold.ttf"));
mTip.setVerticalAlignment(Tooltip.Alignment.BOTTOM_TOP);
mTip.setDimensions((int) Tools.fromDpToPx(58), (int) Tools.fromDpToPx(25));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
mTip.setEnterAnimation(PropertyValuesHolder.ofFloat(View.ALPHA, 1), PropertyValuesHolder.ofFloat(View.SCALE_Y, 1f), PropertyValuesHolder.ofFloat(View.SCALE_X, 1f)).setDuration(200);
mTip.setExitAnimation(PropertyValuesHolder.ofFloat(View.ALPHA, 0), PropertyValuesHolder.ofFloat(View.SCALE_Y, 0f), PropertyValuesHolder.ofFloat(View.SCALE_X, 0f)).setDuration(200);
mTip.setPivotX(Tools.fromDpToPx(65) / 2);
mTip.setPivotY(Tools.fromDpToPx(25));
}
// Data
LineSet dataset = new LineSet(mLabels, mValues[0]);
dataset.setColor(Color.parseColor("#758cbb")).setFill(Color.parseColor("#2d374c")).setDotsColor(Color.parseColor("#758cbb")).setThickness(4).setDashed(new float[] { 10f, 10f }).beginAt(5);
mChart.addData(dataset);
dataset = new LineSet(mLabels, mValues[0]);
dataset.setColor(Color.parseColor("#b3b5bb")).setFill(Color.parseColor("#2d374c")).setDotsColor(Color.parseColor("#ffc755")).setThickness(4).endAt(6);
mChart.addData(dataset);
mBaseAction = action;
Runnable chartAction = new Runnable() {
@Override
public void run() {
mBaseAction.run();
mTip.prepare(mChart.getEntriesArea(0).get(3), mValues[0][3]);
mChart.showTooltip(mTip, true);
}
};
mChart.setAxisBorderValues(0, 20).setYLabels(AxisRenderer.LabelPosition.NONE).setTooltips(mTip).show(new Animation().setInterpolator(new BounceInterpolator()).fromAlpha(0).withEndAction(chartAction));
}
use of android.view.animation.BounceInterpolator in project ViewAnimator by florent37.
the class ViewAnimatorMainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.view_animator_activity_main);
image = (ImageView) findViewById(R.id.image);
mountain = (ImageView) findViewById(R.id.mountain);
text = (TextView) findViewById(R.id.text);
percent = (TextView) findViewById(R.id.percent);
findViewById(R.id.parallel).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
animateParallel();
}
});
findViewById(R.id.mountain).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
simpleAnimation();
}
});
findViewById(R.id.sequentially).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
animateSequentially();
}
});
findViewById(R.id.enhanced).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int random = new Random().nextInt(10);
final ViewGroup viewGroup = (ViewGroup) v.getParent();
final ImageView imageView = new ImageView(v.getContext());
imageView.setImageResource(R.mipmap.ic_launcher);
viewGroup.addView(imageView);
AnimationBuilder builder;
switch(random) {
case 0:
builder = ViewAnimator.animate(imageView).shake().interpolator(new LinearInterpolator());
break;
case 1:
builder = ViewAnimator.animate(imageView).bounceIn().interpolator(new BounceInterpolator());
break;
case 2:
builder = ViewAnimator.animate(imageView).flash().repeatCount(4);
break;
case 3:
builder = ViewAnimator.animate(imageView).flipHorizontal();
break;
case 4:
builder = ViewAnimator.animate(imageView).wave().duration(5000);
break;
case 5:
builder = ViewAnimator.animate(imageView).tada();
break;
case 6:
builder = ViewAnimator.animate(imageView).pulse();
break;
case 7:
builder = ViewAnimator.animate(imageView).standUp();
break;
case 8:
builder = ViewAnimator.animate(imageView).swing();
break;
default:
builder = ViewAnimator.animate(imageView).wobble();
break;
}
builder.onStop(new AnimationListener.Stop() {
@Override
public void onStop() {
viewGroup.removeView(imageView);
}
}).start();
}
});
findViewById(R.id.path).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Path path = new Path();
path.moveTo(START_POINT[0], START_POINT[1]);
path.quadTo(RIGHT_CONTROL_POINT[0], RIGHT_CONTROL_POINT[1], BOTTOM_POINT[0], BOTTOM_POINT[1]);
path.quadTo(LEFT_CONTROL_POINT[0], LEFT_CONTROL_POINT[1], START_POINT[0], START_POINT[1]);
path.close();
ViewAnimator.animate(v).path(path).repeatCount(2).start();
}
});
findViewById(R.id.svgPath).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ViewAnimator.animate(v).svgPath(SVG_PATH).duration(10000).repeatCount(3).start();
final View btnWave = findViewById(R.id.wave);
btnWave.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ViewAnimator.animate(btnWave).wave().duration(3000).start();
}
});
final View btnShake = findViewById(R.id.shake);
btnShake.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ViewAnimator.animate(btnShake).shake().duration(3000).start();
}
});
}
});
}
Aggregations