Android Open Source - AndroidViewAnimations My Activity






From Project

Back to project page AndroidViewAnimations.

License

The source code is released under:

MIT License

If you think the Android project AndroidViewAnimations listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.daimajia.androidanimations;
/*  w  ww .ja  v  a2 s .  c  o  m*/
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.Toast;

import com.daimajia.androidanimations.library.Techniques;
import com.daimajia.androidanimations.library.YoYo;
import com.nineoldandroids.animation.Animator;

public class MyActivity extends Activity {

    private ListView mListView;
    private EffectAdapter mAdapter;
    private View mTarget;

    @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);
        rope = YoYo.with(Techniques.FadeIn).duration(1000).playOn(mTarget);// after start,just click mTarget view, rope is not init 
        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(MyActivity.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);   
                }
            }
        });
    }
    private YoYo.YoYoString rope;


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.my, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            startActivity(new Intent(this,ExampleActivity.class));
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
}




Java Source Code List

com.daimajia.androidanimations.EffectAdapter.java
com.daimajia.androidanimations.ExampleActivity.java
com.daimajia.androidanimations.MyActivity.java
com.daimajia.androidanimations.library.BaseViewAnimator.java
com.daimajia.androidanimations.library.Techniques.java
com.daimajia.androidanimations.library.YoYo.java
com.daimajia.androidanimations.library.attention.BounceAnimator.java
com.daimajia.androidanimations.library.attention.FlashAnimator.java
com.daimajia.androidanimations.library.attention.PulseAnimator.java
com.daimajia.androidanimations.library.attention.RubberBandAnimator.java
com.daimajia.androidanimations.library.attention.ShakeAnimator.java
com.daimajia.androidanimations.library.attention.StandUpAnimator.java
com.daimajia.androidanimations.library.attention.SwingAnimator.java
com.daimajia.androidanimations.library.attention.TadaAnimator.java
com.daimajia.androidanimations.library.attention.WaveAnimator.java
com.daimajia.androidanimations.library.attention.WobbleAnimator.java
com.daimajia.androidanimations.library.bouncing_entrances.BounceInAnimator.java
com.daimajia.androidanimations.library.bouncing_entrances.BounceInDownAnimator.java
com.daimajia.androidanimations.library.bouncing_entrances.BounceInLeftAnimator.java
com.daimajia.androidanimations.library.bouncing_entrances.BounceInRightAnimator.java
com.daimajia.androidanimations.library.bouncing_entrances.BounceInUpAnimator.java
com.daimajia.androidanimations.library.fading_entrances.FadeInAnimator.java
com.daimajia.androidanimations.library.fading_entrances.FadeInDownAnimator.java
com.daimajia.androidanimations.library.fading_entrances.FadeInLeftAnimator.java
com.daimajia.androidanimations.library.fading_entrances.FadeInRightAnimator.java
com.daimajia.androidanimations.library.fading_entrances.FadeInUpAnimator.java
com.daimajia.androidanimations.library.fading_exits.FadeOutAnimator.java
com.daimajia.androidanimations.library.fading_exits.FadeOutDownAnimator.java
com.daimajia.androidanimations.library.fading_exits.FadeOutLeftAnimator.java
com.daimajia.androidanimations.library.fading_exits.FadeOutRightAnimator.java
com.daimajia.androidanimations.library.fading_exits.FadeOutUpAnimator.java
com.daimajia.androidanimations.library.flippers.FlipInXAnimator.java
com.daimajia.androidanimations.library.flippers.FlipOutXAnimator.java
com.daimajia.androidanimations.library.flippers.FlipOutYAnimator.java
com.daimajia.androidanimations.library.flippers.FlipYAnimator.java
com.daimajia.androidanimations.library.rotating_entrances.RotateInAnimator.java
com.daimajia.androidanimations.library.rotating_entrances.RotateInDownLeftAnimator.java
com.daimajia.androidanimations.library.rotating_entrances.RotateInDownRightAnimator.java
com.daimajia.androidanimations.library.rotating_entrances.RotateInUpLeftAnimator.java
com.daimajia.androidanimations.library.rotating_entrances.RotateInUpRightAnimator.java
com.daimajia.androidanimations.library.rotating_exits.RotateOutAnimator.java
com.daimajia.androidanimations.library.rotating_exits.RotateOutDownLeftAnimator.java
com.daimajia.androidanimations.library.rotating_exits.RotateOutDownRightAnimator.java
com.daimajia.androidanimations.library.rotating_exits.RotateOutUpLeftAnimator.java
com.daimajia.androidanimations.library.rotating_exits.RotateOutUpRightAnimator.java
com.daimajia.androidanimations.library.sliders.SlideInDownAnimator.java
com.daimajia.androidanimations.library.sliders.SlideInLeftAnimator.java
com.daimajia.androidanimations.library.sliders.SlideInRightAnimator.java
com.daimajia.androidanimations.library.sliders.SlideInUpAnimator.java
com.daimajia.androidanimations.library.sliders.SlideOutDownAnimator.java
com.daimajia.androidanimations.library.sliders.SlideOutLeftAnimator.java
com.daimajia.androidanimations.library.sliders.SlideOutRightAnimator.java
com.daimajia.androidanimations.library.sliders.SlideOutUpAnimator.java
com.daimajia.androidanimations.library.specials.HingeAnimator.java
com.daimajia.androidanimations.library.specials.RollInAnimator.java
com.daimajia.androidanimations.library.specials.RollOutAnimator.java
com.daimajia.androidanimations.library.specials.in.DropOutAnimator.java
com.daimajia.androidanimations.library.specials.in.LandingAnimator.java
com.daimajia.androidanimations.library.specials.out.TakingOffAnimator.java
com.daimajia.androidanimations.library.zooming_entrances.ZoomInAnimator.java
com.daimajia.androidanimations.library.zooming_entrances.ZoomInDownAnimator.java
com.daimajia.androidanimations.library.zooming_entrances.ZoomInLeftAnimator.java
com.daimajia.androidanimations.library.zooming_entrances.ZoomInRightAnimator.java
com.daimajia.androidanimations.library.zooming_entrances.ZoomInUpAnimator.java
com.daimajia.androidanimations.library.zooming_exits.ZoomOutAnimator.java
com.daimajia.androidanimations.library.zooming_exits.ZoomOutDownAnimator.java
com.daimajia.androidanimations.library.zooming_exits.ZoomOutLeftAnimator.java
com.daimajia.androidanimations.library.zooming_exits.ZoomOutRightAnimator.java
com.daimajia.androidanimations.library.zooming_exits.ZoomOutUpAnimator.java