Java Code Examples for android.graphics.drawable.AnimationDrawable#setEnterFadeDuration()

The following examples show how to use android.graphics.drawable.AnimationDrawable#setEnterFadeDuration() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Eyebrows.java    From Eyebrows with MIT License 6 votes vote down vote up
/**
 * start the gradient anim
 */
public void startGradientAnimation(){
    if(mView!=null){
        mView.setBackgroundResource(mGradientAnimation);
        mAnimationDrawable = (AnimationDrawable) mView.getBackground();
        if(mAnimationDrawable!=null){
            mView.setBackground(mAnimationDrawable);
            mAnimationDrawable.setEnterFadeDuration(mDuration);
            mAnimationDrawable.setExitFadeDuration(mDuration);
            mView.post(new Runnable() {
                @Override
                public void run() {
                    mAnimationDrawable.start();
                }
            });
        }
    }
}
 
Example 2
Source File: SampleActivity.java    From DragPointView with Apache License 2.0 6 votes vote down vote up
private void initAnim() {

        animationDrawable = new AnimationDrawable();
        animationDrawable.addFrame(getResources().getDrawable(R.mipmap.explode1), 100);
        animationDrawable.addFrame(getResources().getDrawable(R.mipmap.explode2), 100);
        animationDrawable.addFrame(getResources().getDrawable(R.mipmap.explode3), 100);
        animationDrawable.addFrame(getResources().getDrawable(R.mipmap.explode4), 100);
        animationDrawable.addFrame(getResources().getDrawable(R.mipmap.explode5), 100);
        animationDrawable.setOneShot(true);
        animationDrawable.setExitFadeDuration(300);
        animationDrawable.setEnterFadeDuration(100);

        ObjectAnimator objectAnimator1 = ObjectAnimator.ofFloat(null, "scaleX", 1.f, 0.f);
        ObjectAnimator objectAnimator2 = ObjectAnimator.ofFloat(null, "scaleY", 1.f, 0.f);
        animatorSet = new AnimatorSet();
        animatorSet.setDuration(300l);
        animatorSet.playTogether(objectAnimator1, objectAnimator2);

        objectAnimator = ObjectAnimator.ofFloat(null, "alpha", 1.f, 0.f);
        objectAnimator.setDuration(2000l);
    }
 
Example 3
Source File: SignupFragment.java    From Android with MIT License 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.signup_layout, container, false);
    mContext = this.getActivity();
    full_name = view.findViewById(R.id.full_name);
    email = view.findViewById(R.id.email);
    password = view.findViewById(R.id.password);
    phone = view.findViewById(R.id.phone);

    animation_view_fullname = view.findViewById(R.id.animation_view_fullname);
    animation_view_email = view.findViewById(R.id.animation_view_email);
    animation_view_password = view.findViewById(R.id.animation_view_password);
    animation_view_phone = view.findViewById(R.id.animation_view_phone);
    animation_view_location = view.findViewById(R.id.animation_view_location);
    animation_view_birth_signup = view.findViewById(R.id.animation_view_birth_signup);


    buttonRegister = view.findViewById(R.id.buttonRegister);
    determine_location = view.findViewById(R.id.determine_location);
    Date_of_Birth = view.findViewById(R.id.Date_of_Birth);


    background_layout_signup = view.findViewById(R.id.background_layout_signup);

    anim = (AnimationDrawable) background_layout_signup.getBackground();
    anim.setEnterFadeDuration(4000);
    anim.setExitFadeDuration(4000);

    buttonRegister.setOnClickListener(this);
    determine_location.setOnClickListener(this);
    Date_of_Birth.setOnClickListener(this);


    getDetailsMANUFACTURER();
    validateFields2();
    return view;
}
 
Example 4
Source File: FollowUserInputActivity.java    From Android-3D-Layout with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_follow_user_input);

    LinearLayout container = (LinearLayout) findViewById(R.id.container);
    anim = (AnimationDrawable) container.getBackground();
    anim.setEnterFadeDuration(6000);
    anim.setExitFadeDuration(2000);
}
 
Example 5
Source File: ItemConversationAdapter.java    From DragPointView with Apache License 2.0 5 votes vote down vote up
public ItemConversationAdapter(Context context, List<ConversationEntity> objects) {
    this.context = context;
    this.layoutInflater = LayoutInflater.from(context);
    this.objects = objects;

    animationDrawable = new AnimationDrawable();
    animationDrawable.addFrame(context.getResources().getDrawable(R.mipmap.explode1), 100);
    animationDrawable.addFrame(context.getResources().getDrawable(R.mipmap.explode2), 100);
    animationDrawable.addFrame(context.getResources().getDrawable(R.mipmap.explode3), 100);
    animationDrawable.addFrame(context.getResources().getDrawable(R.mipmap.explode4), 100);
    animationDrawable.addFrame(context.getResources().getDrawable(R.mipmap.explode5), 100);
    animationDrawable.setOneShot(true);
    animationDrawable.setExitFadeDuration(300);
    animationDrawable.setEnterFadeDuration(100);
}
 
Example 6
Source File: FlowingGradient.java    From ahoy-onboarding with Apache License 2.0 5 votes vote down vote up
private void init() {
    setBackgroundResource(draw);
    final AnimationDrawable frameAnimation = (AnimationDrawable) getBackground();
    frameAnimation.setEnterFadeDuration(duration);
    frameAnimation.setExitFadeDuration(duration);
    post(new Runnable(){
        public void run(){
            frameAnimation.start();
        }
    });
}
 
Example 7
Source File: LoginFragment.java    From Android with MIT License 4 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.login_fragment, container, false);
    terms =  view.findViewById(R.id.terms);
    error_message =  view.findViewById(R.id.error_message);

    login_btn =  view.findViewById(R.id.login_btn);
    back_login_fragment =  view.findViewById(R.id.back_login_fragment);

    login_email =  view.findViewById(R.id.login_email);
    login_password =  view.findViewById(R.id.login_password);
    background_layout =  view.findViewById(R.id.background_layout);

    mContext = this.getActivity();

    login_password.setOnEditorActionListener(new EditText.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                login();
                return true;
            }
            return false;
        }
    });




    login_btn.setOnClickListener(this);
    back_login_fragment.setOnClickListener(this);


    anim = (AnimationDrawable) background_layout.getBackground();
    anim.setEnterFadeDuration(4000);
    anim.setExitFadeDuration(4000);


    check_edittext_fileds();
    return view;
}