Example usage for android.view.animation AnimationUtils loadAnimation

List of usage examples for android.view.animation AnimationUtils loadAnimation

Introduction

In this page you can find the example usage for android.view.animation AnimationUtils loadAnimation.

Prototype

public static Animation loadAnimation(Context context, @AnimRes int id) throws NotFoundException 

Source Link

Document

Loads an Animation object from a resource

Usage

From source file:com.example.android.tryanimationt.TryAnimationFragment.java

void slideView(View view, boolean up) {
    int animResourceId = up ? R.anim.slide_up : R.anim.slide_down;
    Animation slide = AnimationUtils.loadAnimation(getActivity(), animResourceId);
    slide.setFillAfter(true);/* w ww  . j av  a2  s .co m*/
    view.startAnimation(slide);
}

From source file:com.flipzu.flipzu.Player.java

private void updateButton() {
    Button but = (Button) findViewById(R.id.play_toggle_btn);
    switch (mState) {
    case PLAYING:
        but.clearAnimation();/*from  ww  w . j  ava2  s  .co m*/
        but.setBackgroundResource(R.drawable.pause_button);
        break;
    case FINISHED:
        setFinishedBanner(true);
        break;
    case STOPPED:
    case PAUSED:
        but.clearAnimation();
        but.setBackgroundResource(R.drawable.play_button);
        break;
    case LOADING:
        if (bcast != null && !bcast.isLive()) {
            setFinishedBanner(false);
        }
        but.setBackgroundResource(R.drawable.loading_button);
        but.startAnimation(AnimationUtils.loadAnimation(Player.this, R.anim.rotate));
        break;
    case ERROR:
        but.clearAnimation();
        but.setBackgroundResource(R.drawable.play_button);
        break;
    }
}

From source file:android.support.design.widget.BaseTransientBottomBar.java

private void animateViewOut(final int event) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        ViewCompat.animate(mView).translationY(mView.getHeight()).setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR)
                .setDuration(ANIMATION_DURATION).setListener(new ViewPropertyAnimatorListenerAdapter() {
                    @Override//from  ww w  .  j a  v a 2  s .c  o m
                    public void onAnimationStart(View view) {
                        mContentViewCallback.animateContentOut(0, ANIMATION_FADE_DURATION);
                    }

                    @Override
                    public void onAnimationEnd(View view) {
                        onViewHidden(event);
                    }
                }).start();
    } else {
        Animation anim = AnimationUtils.loadAnimation(mView.getContext(), R.anim.design_snackbar_out);
        anim.setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR);
        anim.setDuration(ANIMATION_DURATION);
        anim.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationEnd(Animation animation) {
                onViewHidden(event);
            }

            @Override
            public void onAnimationStart(Animation animation) {
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            }
        });
        mView.startAnimation(anim);
    }
}

From source file:com.jet.sweettips.snackbar.SweetSnackbar.java

void animateViewIn() {
    Animation anim = null;//from   www. ja v a  2 s  . co  m
    if (animateIn != -1) {
        anim = AnimationUtils.loadAnimation(mView.getContext(), animateIn);
    } else {
        anim = AnimationUtils.loadAnimation(mView.getContext(), R.anim.design_snackbar_in);
    }
    anim.setInterpolator(com.jet.sweettips.util.AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR);
    anim.setDuration(ANIMATION_DURATION);
    anim.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationEnd(Animation animation) {
            onViewShown();
        }

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }
    });
    mView.startAnimation(anim);
}

From source file:com.sunho.nating.fragments.DetailPlaceFragment.java

@Override
public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) {
    Animation animation = AnimationUtils.loadAnimation(getActivity(),
            enter ? android.R.anim.fade_in : android.R.anim.fade_out);
    // We bind a listener for the fragment transaction. We only bind it when
    // this fragment is entering.
    if (animation != null && enter) {
        animation.setAnimationListener(this);
    }//from  w  w w.  j  av  a 2 s.  c o  m
    return animation;
}

From source file:com.heinrichreimersoftware.materialdrawer.DrawerView.java

private void updateListVisibility() {
    Log.d(TAG, "updateListVisibility()");

    if (profileListOpen && mProfileAdapter.getCount() > 0) {
        if (getWidth() > 0 && linearListViewProfileList.getVisibility() != View.VISIBLE) {
            Log.d(TAG, "updateListVisibility() - show Profile List animated");
            linearListViewProfileList//from  www  . j ava 2 s  .c om
                    .startAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.abc_fade_in));
        }
        linearListViewProfileList.setVisibility(VISIBLE);

    } else {
        linearListViewProfileList.setVisibility(GONE);
    }

    if (!profileListOpen && mAdapter.getCount() > 0) {
        if (getWidth() > 0 && linearListView.getVisibility() != View.VISIBLE) {
            Log.d(TAG, "updateListVisibility() - show Items List animated");
            linearListView.startAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.abc_fade_in));
        }
        linearListView.setVisibility(VISIBLE);

    } else {
        linearListView.setVisibility(GONE);
    }

    if (mAdapterFixed.getCount() > 0) {
        if (getWidth() > 0 && fixedListContainer.getVisibility() != View.VISIBLE) {
            Log.d(TAG, "updateListVisibility() - show fixed Items List animated");
            fixedListContainer
                    .startAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.abc_slide_in_bottom));
        }
        fixedListContainer.setVisibility(VISIBLE);

        if ((profileListOpen && mProfileAdapter.getCount() > 0)
                || (!profileListOpen && mAdapter.getCount() > 0)) {

            if (getWidth() > 0 && fixedDivider.getVisibility() != View.VISIBLE) {
                fixedDivider.startAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.abc_fade_in));
            }
            fixedDivider.setVisibility(VISIBLE);

            if (getWidth() > 0 && fixedShadow.getVisibility() != View.VISIBLE) {
                fixedShadow.startAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.abc_fade_in));
            }
            fixedShadow.setVisibility(VISIBLE);
        } else {
            fixedDivider.setVisibility(GONE);
            fixedShadow.setVisibility(GONE);
        }
    } else {
        fixedListContainer.setVisibility(GONE);
    }
}

From source file:com.shollmann.igcparser.ui.activity.FlightPreviewActivity.java

@Override
public void onClick(View view) {
    switch (view.getId()) {
    case R.id.main_cardview_close:
        cardviewInformation.startAnimation(AnimationUtils.loadAnimation(this, R.anim.anim_dae_out));
        cardviewInformation.setVisibility(View.GONE);
        btnShowInformation.setVisibility(View.VISIBLE);
        btnShowInformation/* w w w  .  ja va 2s .c o m*/
                .startAnimation(AnimationUtils.loadAnimation(this, R.anim.anim_information_btn_enter));
        TrackerHelper.trackCloseInformation();
        break;
    case R.id.main_information_btn:
        btnShowInformation
                .startAnimation(AnimationUtils.loadAnimation(this, R.anim.anim_information_btn_leave));
        btnShowInformation.setVisibility(View.GONE);
        cardviewInformation.setVisibility(View.VISIBLE);
        cardviewInformation.startAnimation(AnimationUtils.loadAnimation(this, R.anim.anim_fade_in));
        TrackerHelper.trackOpenInformation();
        break;
    case R.id.main_btn_play:
        startFlightReplay();
        break;
    case R.id.main_btn_speed_up:
        speedUpReplay();
        break;
    case R.id.main_btn_speed_down:
        speedDownReplay();
        break;
    case R.id.main_information_btn_viewmore:
        TrackerHelper.trackOpenMoreInformation();
        IGCViewerApplication.setCurrentIGCFile(igcFile);
        Intent intent = new Intent(this, FlightInformationActivity.class);
        startActivity(intent);
        break;
    }
}

From source file:com.devpaul.filepickerlibrary.FilePickerActivity.java

/**
 * Initializes the animations used in this activity.
 *//* w w  w . j  a  v  a2  s.  c om*/
private void setUpAnimations() {
    slideUp = AnimationUtils.loadAnimation(FilePickerActivity.this,
            com.devpaul.filepickerlibrary.R.anim.slide_up);
    slideDown = AnimationUtils.loadAnimation(FilePickerActivity.this,
            com.devpaul.filepickerlibrary.R.anim.slide_down);
}

From source file:com.google.android.exoplayer2.demo.MediaPlayerFragment.java

private void hideCenterInfo() {
    centerInfo.startAnimation(AnimationUtils.loadAnimation(getContext(), android.R.anim.fade_out));
    centerInfo.setVisibility(View.GONE);

}

From source file:com.example.android.tryanimationt.TryAnimationFragment.java

public void onActivityResult(int requestCode, int resultCode, Intent data) {

    Log.e("+++&&& onActivityResult()", "requestCode:" + requestCode);

    if (requestCode == mRequestCode) {
        animButtons(fab1st, true, 3000, 0);
        animButtons(fab2nd, true, 1000, 250);
        animButtons(fab3rd, true, 2000, 500);

        // footer slide up
        Animation slideUp = AnimationUtils.loadAnimation(getActivity(), R.anim.slide_up);
        footer.startAnimation(slideUp);//  w w  w.j a v  a 2  s. c  om
    }
}