use of com.daimajia.androidanimations.library.Techniques in project AndroidViewAnimations by daimajia.
the class MyActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my);
mListView = (ListView) findViewById(R.id.list_items);
mTarget = findViewById(R.id.hello_world);
mAdapter = new EffectAdapter(this);
mListView.setAdapter(mAdapter);
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (rope != null) {
rope.stop(true);
}
Techniques technique = (Techniques) view.getTag();
rope = YoYo.with(technique).duration(1200).repeat(YoYo.INFINITE).pivot(YoYo.CENTER_PIVOT, YoYo.CENTER_PIVOT).interpolate(new AccelerateDecelerateInterpolator()).withListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
}
@Override
public void onAnimationCancel(Animator animation) {
Toast.makeText(MyActivity.this, "canceled previous animation", Toast.LENGTH_SHORT).show();
}
@Override
public void onAnimationRepeat(Animator animation) {
}
}).playOn(mTarget);
}
});
findViewById(R.id.hello_world).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (rope != null) {
rope.stop(true);
}
}
});
}
Aggregations