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.android.camera.v2.uimanager.SettingManager.java

private void startFadeInAnimation(View view) {
    if (mFadeIn == null) {
        mFadeIn = AnimationUtils.loadAnimation(mActivity, R.anim.setting_popup_grow_fade_in);
    }/* w  w  w  .j  a va 2  s.c o  m*/
    if (view != null && mFadeIn != null) {
        view.startAnimation(mFadeIn);
    }
}

From source file:com.rowland.movies.ui.fragments.DetailFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    // Check which instance we are dealing with
    if (getActivity() instanceof DetailActivity) {
        // Set the ToolBar
        ((DetailActivity) getActivity()).setToolbar(mToolbar, true, false, R.drawable.ic_logo_48px);
    }// w ww .j a va 2  s .  c  o m
    // Check for minimum api as Lollipop
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        // Set up  the systemUi flags
        getActivity().getWindow().getDecorView().setSystemUiVisibility(
                View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
        // Set the status bar tobe transparent
        getActivity().getWindow().setStatusBarColor(Color.TRANSPARENT);
    }
    /*// Check for minimum api as Kitkat
    if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
    // Set translucent to be true
    getActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    }*/
    // Check for null
    if (mMovie != null) {
        // Initialize the Loader
        getLoaderManager().initLoader(0, null, mReviewLoaderCallBack);
        getLoaderManager().initLoader(1, null, mTrailerLoaderCallBack);
        // Create an Animation
        Animation simpleGrowAnimation = AnimationUtils.loadAnimation(mFavoriteFab.getContext(),
                R.anim.grow_bigger);
        // Animate the Floating action button
        mFavoriteFab.startAnimation(simpleGrowAnimation);
    }
}

From source file:com.raja.knowme.FragmentProfile.java

private void previousDetail() {
    count--;//from  w  w w  . j a  v a 2s  .  com
    mHeaderSwitcher.setInAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.push_right_in));
    mHeaderSwitcher.setOutAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.push_right_out));
    mBodySwitcher.setInAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.push_right_in));
    mBodySwitcher.setOutAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.push_right_out));
    setUIData(count);
    mScrollview.scrollTo(0, 0);
}

From source file:com.github.developerpaul123.filepickerlibrary.FilePickerActivity.java

/**
 * Initializes the animations used in this activity.
 *//*from   w  ww . ja v  a2  s . c o  m*/
private void setUpAnimations() {
    slideUp = AnimationUtils.loadAnimation(this, R.anim.slide_up);
    slideDown = AnimationUtils.loadAnimation(this, R.anim.slide_down);
}

From source file:com.android.camera.v2.uimanager.SettingManager.java

private void startFadeOutAnimation(View view) {
    if (mFadeOut == null) {
        mFadeOut = AnimationUtils.loadAnimation(mActivity, R.anim.setting_popup_shrink_fade_out);
    }//from   w  w  w.  j  a va 2 s .c  o m
    if (view != null && mFadeOut != null) {
        view.startAnimation(mFadeOut);
    }
}

From source file:ca.rmen.android.networkmonitor.app.log.LogActivity.java

private void startRefreshIconAnimation() {
    Log.v(TAG, "startRefreshIconAnimation");
    if (mMenu == null)
        return; // This is null when we first enter the activity and the page loads.
    MenuItem menuItemRefresh = mMenu.findItem(R.id.action_refresh);
    if (menuItemRefresh == null)
        return;/*from www. j a  va  2 s.  c  o m*/
    View refreshIcon = View.inflate(this, R.layout.refresh_icon, null);
    Animation rotation = AnimationUtils.loadAnimation(this, R.anim.rotate);
    rotation.setRepeatCount(Animation.INFINITE);
    refreshIcon.startAnimation(rotation);
    MenuItemCompat.setActionView(menuItemRefresh, refreshIcon);
}

From source file:com.svpino.longhorn.fragments.StockListFragment.java

public void hideStockOverview(final AnimationEndCallback animationEndCallback) {
    if (this.stockOverviewState != null && this.stockOverviewState != StockOverviewState.HIDDEN) {
        setStockOverviewState(StockOverviewState.HIDDEN);

        Animation animation = AnimationUtils.loadAnimation(getActivity().getApplicationContext(),
                R.anim.slide_out_to_bottom);
        animation.setAnimationListener(new StockOverviewAnimationListener(new AnimationEndCallback() {

            @Override//from   w ww.  ja v  a  2s . c o m
            public void execute() {
                StockListFragment.this.viewFlipper.setVisibility(View.GONE);
                StockListFragment.this.viewFlipper.setInAnimation(null);
                StockListFragment.this.viewFlipper.setOutAnimation(null);

                setCurrentTile(null);

                if (animationEndCallback != null) {
                    animationEndCallback.execute();
                }
            }
        }));

        this.viewFlipper.startAnimation(animation);

        invalidateOptionsMenu();
    } else if (animationEndCallback != null) {
        animationEndCallback.execute();
    }
}

From source file:org.ttrssreader.utils.Utils.java

/**
 * Alert the user by a short vibration or a flash of the whole screen.
 *///from  w w w . ja  va  2 s  .  c o m
public static void alert(Activity activity, boolean error) {
    Vibrator vib = ((Vibrator) activity.getSystemService(Context.VIBRATOR_SERVICE));
    if (vib.hasVibrator()) {
        vib.vibrate(Utils.SHORT_VIBRATE);
    } else if (error) {
        // Only flash when user tried to move forward, flashing when reaching the last article looks just wrong.
        Animation flash = AnimationUtils.loadAnimation(activity, R.anim.flash);
        View main = activity.findViewById(R.id.frame_all);
        main.startAnimation(flash);
    }
}

From source file:com.rowland.moviesquire.ui.fragments.DetailFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    // Check which instance we are dealing with
    if (getActivity() instanceof DetailActivity) {
        // Set the Toolbar
        ((BaseToolBarActivity) getActivity()).setToolbar(mToolbar, true, false, R.drawable.ic_logo_48px);
        // Set Toolbar status bar transparency
        ((BaseToolBarActivity) getActivity()).setToolbarTransparent(true);
    }/*from   w ww.java2  s .co  m*/

    // Check for null
    if (mMovie != null) {
        // Initialize the Loader
        getActivity().getSupportLoaderManager().initLoader(REVIEWS_LOADER_ID, null, mReviewLoaderCallBack);
        getActivity().getSupportLoaderManager().initLoader(TRAILERS_LOADER_ID, null, mTrailerLoaderCallBack);
        // Create an Animation
        Animation simpleGrowAnimation = AnimationUtils.loadAnimation(mFavoriteFab.getContext(),
                R.anim.grow_bigger);
        // Animate the Floating action button
        mFavoriteFab.startAnimation(simpleGrowAnimation);
    }
}

From source file:com.google.android.apps.santatracker.games.matching.MemoryMatchFragment.java

/**
 * Load and initialise all animations required for the game.
 *//*from  w  w  w .  ja  v  a2 s.  c  o  m*/
private void loadAnimations() {
    mAnimationTimerAlpha = new AlphaAnimation(0.0f, 1.0f);
    mAnimationTimerAlpha.setDuration(1000);
    mAnimationTimerAlpha.setRepeatMode(Animation.REVERSE);
    mAnimationTimerAlpha.setRepeatCount(Animation.INFINITE);

    mAnimationPlayAgainBackground = AnimationUtils.loadAnimation(getActivity(), R.anim.play_again_bkgrd_anim);
    mAnimationPlayAgainBackground.setFillAfter(true);
    mAnimationPlayAgainBackground.setAnimationListener(this);
    mAnimationCardCover = AnimationUtils.loadAnimation(getActivity(), R.anim.card_answer_flash);
    mAnimationCardCover.setFillAfter(true);
    mAnimationPlayAgainMain = AnimationUtils.loadAnimation(getActivity(), R.anim.play_again_main_anim);
    mAnimationPlayAgainMain.setFillAfter(true);
    mAnimationPlayAgainMain.setAnimationListener(this);
    // Special bonus animation to play if the player is particularly awesome.
    mAnimationSetSnowman = new AnimationSet(true);
    mAnimationSnowman = new TranslateAnimation(150, 0, 150, 0);
    mAnimationSnowman.setDuration(1000);
    mAnimationSetSnowman.addAnimation(mAnimationSnowman);
    mAnimationSnowmanBack = new TranslateAnimation(0, 150, 0, 150);
    mAnimationSnowmanBack.setDuration(1000);
    mAnimationSnowmanBack.setStartOffset(1500);
    mAnimationSnowmanBack.setAnimationListener(this);
    mAnimationSetSnowman.addAnimation(mAnimationSnowmanBack);
    mAnimationSetSnowman.setAnimationListener(this);

    mAnimationRightPaneSlideOut = AnimationUtils.loadAnimation(getActivity(), android.R.anim.slide_out_right);
    mAnimationRightPaneSlideOut.setFillAfter(true);
    mAnimationLeftPaneSlideOut = AnimationUtils.loadAnimation(getActivity(), R.anim.left_pane_slide_out);
    mAnimationLeftPaneSlideOut.setFillAfter(true);
    mAnimationLeftPaneSlideIn = AnimationUtils.loadAnimation(getActivity(), android.R.anim.slide_in_left);
    mAnimationLeftPaneSlideIn.setFillAfter(true);
    mAnimationRightPaneSlideIn = AnimationUtils.loadAnimation(getActivity(), R.anim.right_pane_slide_in);
    mAnimationRightPaneSlideIn.setFillAfter(true);
    mAnimationScaleLevelDown = AnimationUtils.loadAnimation(getActivity(), R.anim.scale_level_anim_down);
    mAnimationScaleLevelDown.setAnimationListener(this);
    mAnimationLevelFadeOut = AnimationUtils.loadAnimation(getActivity(), R.anim.level_fade_out_anim);
    mAnimationLevelFadeOut.setAnimationListener(this);
    mAnimationLevelScaleUp = AnimationUtils.loadAnimation(getActivity(), R.anim.scale_up_level_anim);
    mAnimationLevelScaleUp.setAnimationListener(this);
    mAnimationRightPaneSlideOut.setAnimationListener(this);
    mAnimationLeftPaneSlideOut.setAnimationListener(this);
}