Search in sources :

Example 1 with Techniques

use of com.marshalchen.common.uimodule.androidanimations.Techniques in project UltimateAndroid by cymcsg.

the class AndroidAnimationsDemoActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.android_animations_activity);
    mListView = (ListView) findViewById(R.id.list_items);
    mTarget = findViewById(R.id.hello_world);
    mAdapter = new EffectAdapter(this);
    mListView.setAdapter(mAdapter);
    // after start,just click mTarget view, rope is not init
    rope = YoYo.with(Techniques.FadeIn).duration(1000).playOn(mTarget);
    mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Techniques technique = (Techniques) view.getTag();
            rope = YoYo.with(technique).duration(1200).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(AndroidAnimationsDemoActivity.this, "canceled", 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);
            }
        }
    });
}
Also used : Techniques(com.marshalchen.common.uimodule.androidanimations.Techniques) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) Animator(com.marshalchen.common.uimodule.nineoldandroids.animation.Animator) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) AdapterView(android.widget.AdapterView)

Aggregations

View (android.view.View)1 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)1 AdapterView (android.widget.AdapterView)1 ListView (android.widget.ListView)1 Techniques (com.marshalchen.common.uimodule.androidanimations.Techniques)1 Animator (com.marshalchen.common.uimodule.nineoldandroids.animation.Animator)1