Search in sources :

Example 56 with Animation

use of android.view.animation.Animation in project UltimateAndroid by cymcsg.

the class RayMenu method getItemClickListener.

private OnClickListener getItemClickListener(final OnClickListener listener) {
    return new OnClickListener() {

        @Override
        public void onClick(final View viewClicked) {
            Animation animation = bindItemAnimation(viewClicked, true, 400);
            animation.setAnimationListener(new AnimationListener() {

                @Override
                public void onAnimationStart(Animation animation) {
                }

                @Override
                public void onAnimationRepeat(Animation animation) {
                }

                @Override
                public void onAnimationEnd(Animation animation) {
                    postDelayed(new Runnable() {

                        @Override
                        public void run() {
                            itemDidDisappear();
                        }
                    }, 0);
                }
            });
            final int itemCount = mRayLayout.getChildCount();
            for (int i = 0; i < itemCount; i++) {
                View item = mRayLayout.getChildAt(i);
                if (viewClicked != item) {
                    bindItemAnimation(item, false, 300);
                }
            }
            mRayLayout.invalidate();
            mHintView.startAnimation(createHintSwitchAnimation(true));
            if (listener != null) {
                listener.onClick(viewClicked);
            }
        }
    };
}
Also used : ScaleAnimation(android.view.animation.ScaleAnimation) RotateAnimation(android.view.animation.RotateAnimation) AlphaAnimation(android.view.animation.AlphaAnimation) Animation(android.view.animation.Animation) AnimationListener(android.view.animation.Animation.AnimationListener) ImageView(android.widget.ImageView) View(android.view.View)

Example 57 with Animation

use of android.view.animation.Animation in project AntennaPod by AntennaPod.

the class VideoplayerActivity method hideVideoControls.

@SuppressLint("NewApi")
private void hideVideoControls() {
    final Animation animation = AnimationUtils.loadAnimation(this, R.anim.fade_out);
    if (animation != null) {
        videoOverlay.startAnimation(animation);
        controls.startAnimation(animation);
    }
    if (Build.VERSION.SDK_INT >= 14) {
        int videoviewFlag = (Build.VERSION.SDK_INT >= 16) ? View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION : 0;
        getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | videoviewFlag);
        videoOverlay.setFitsSystemWindows(true);
    }
    videoOverlay.setVisibility(View.GONE);
    controls.setVisibility(View.GONE);
}
Also used : Animation(android.view.animation.Animation) SuppressLint(android.annotation.SuppressLint) SuppressLint(android.annotation.SuppressLint)

Example 58 with Animation

use of android.view.animation.Animation in project android_frameworks_base by DirtyUnicorns.

the class ViewGroup method bindLayoutAnimation.

private void bindLayoutAnimation(View child) {
    Animation a = mLayoutAnimationController.getAnimationForView(child);
    child.setAnimation(a);
}
Also used : Animation(android.view.animation.Animation)

Example 59 with Animation

use of android.view.animation.Animation in project android_frameworks_base by DirtyUnicorns.

the class WindowStateAnimator method applyAnimationLocked.

/**
     * Choose the correct animation and set it to the passed WindowState.
     * @param transit If AppTransition.TRANSIT_PREVIEW_DONE and the app window has been drawn
     *      then the animation will be app_starting_exit. Any other value loads the animation from
     *      the switch statement below.
     * @param isEntrance The animation type the last time this was called. Used to keep from
     *      loading the same animation twice.
     * @return true if an animation has been loaded.
     */
boolean applyAnimationLocked(int transit, boolean isEntrance) {
    if ((mLocalAnimating && mAnimationIsEntrance == isEntrance) || mKeyguardGoingAwayAnimation) {
        // keyguard exit animation such that it also fades out.
        if (mAnimation != null && mKeyguardGoingAwayAnimation && transit == WindowManagerPolicy.TRANSIT_PREVIEW_DONE) {
            applyFadeoutDuringKeyguardExitAnimation();
        }
        return true;
    }
    // Only apply an animation if the display isn't frozen.  If it is
    // frozen, there is no reason to animate and it can cause strange
    // artifacts when we unfreeze the display if some different animation
    // is running.
    Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "WSA#applyAnimationLocked");
    if (mService.okToDisplay()) {
        int anim = mPolicy.selectAnimationLw(mWin, transit);
        int attr = -1;
        Animation a = null;
        if (anim != 0) {
            a = anim != -1 ? AnimationUtils.loadAnimation(mContext, anim) : null;
        } else {
            switch(transit) {
                case WindowManagerPolicy.TRANSIT_ENTER:
                    attr = com.android.internal.R.styleable.WindowAnimation_windowEnterAnimation;
                    break;
                case WindowManagerPolicy.TRANSIT_EXIT:
                    attr = com.android.internal.R.styleable.WindowAnimation_windowExitAnimation;
                    break;
                case WindowManagerPolicy.TRANSIT_SHOW:
                    attr = com.android.internal.R.styleable.WindowAnimation_windowShowAnimation;
                    break;
                case WindowManagerPolicy.TRANSIT_HIDE:
                    attr = com.android.internal.R.styleable.WindowAnimation_windowHideAnimation;
                    break;
            }
            if (attr >= 0) {
                a = mService.mAppTransition.loadAnimationAttr(mWin.mAttrs, attr);
            }
        }
        if (DEBUG_ANIM)
            Slog.v(TAG, "applyAnimation: win=" + this + " anim=" + anim + " attr=0x" + Integer.toHexString(attr) + " a=" + a + " transit=" + transit + " isEntrance=" + isEntrance + " Callers " + Debug.getCallers(3));
        if (a != null) {
            if (DEBUG_ANIM)
                logWithStack(TAG, "Loaded animation " + a + " for " + this);
            setAnimation(a);
            mAnimationIsEntrance = isEntrance;
        }
    } else {
        clearAnimation();
    }
    Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER);
    if (mWin.mAttrs.type == TYPE_INPUT_METHOD) {
        mService.adjustForImeIfNeeded(mWin.mDisplayContent);
        if (isEntrance) {
            mWin.setDisplayLayoutNeeded();
            mService.mWindowPlacerLocked.requestTraversal();
        }
    }
    return mAnimation != null;
}
Also used : AppWindowAnimator.sDummyAnimation(com.android.server.wm.AppWindowAnimator.sDummyAnimation) Animation(android.view.animation.Animation) Point(android.graphics.Point)

Example 60 with Animation

use of android.view.animation.Animation in project android_frameworks_base by DirtyUnicorns.

the class WindowStateAnimator method setMoveAnimation.

void setMoveAnimation(int left, int top) {
    final Animation a = AnimationUtils.loadAnimation(mContext, com.android.internal.R.anim.window_move_from_decor);
    setAnimation(a);
    mAnimDx = mWin.mLastFrame.left - left;
    mAnimDy = mWin.mLastFrame.top - top;
    mAnimateMove = true;
}
Also used : AppWindowAnimator.sDummyAnimation(com.android.server.wm.AppWindowAnimator.sDummyAnimation) Animation(android.view.animation.Animation)

Aggregations

Animation (android.view.animation.Animation)943 AlphaAnimation (android.view.animation.AlphaAnimation)241 TranslateAnimation (android.view.animation.TranslateAnimation)190 ScaleAnimation (android.view.animation.ScaleAnimation)146 Transformation (android.view.animation.Transformation)114 View (android.view.View)104 AnimationListener (android.view.animation.Animation.AnimationListener)98 AnimationSet (android.view.animation.AnimationSet)94 RotateAnimation (android.view.animation.RotateAnimation)63 ImageView (android.widget.ImageView)48 TextView (android.widget.TextView)47 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)43 Point (android.graphics.Point)40 WindowAnimation_activityCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_activityCloseEnterAnimation)35 WindowAnimation_activityCloseExitAnimation (com.android.internal.R.styleable.WindowAnimation_activityCloseExitAnimation)35 WindowAnimation_activityOpenEnterAnimation (com.android.internal.R.styleable.WindowAnimation_activityOpenEnterAnimation)35 WindowAnimation_activityOpenExitAnimation (com.android.internal.R.styleable.WindowAnimation_activityOpenExitAnimation)35 WindowAnimation_taskCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskCloseEnterAnimation)35 WindowAnimation_taskCloseExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskCloseExitAnimation)35 WindowAnimation_taskOpenEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskOpenEnterAnimation)35