get System Animations - Android Animation

Android examples for Animation:Animation Creation

Description

get System Animations

Demo Code

/*/*from  w w  w  . j a  va  2 s .  co  m*/
 * Copyright (C) 2013 AOKP by Steve Spear - Stevespear426
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import android.content.Context;
import android.content.res.Resources;
import java.util.ArrayList;

public class Main{
    public final static int ANIMATION_FADE = 1;
    public final static int ANIMATION_SLIDE_RIGHT = 2;
    public final static int ANIMATION_SLIDE_LEFT = 3;
    public final static int ANIMATION_SLIDE_RIGHT_NO_FADE = 4;
    public final static int ANIMATION_SLIDE_LEFT_NO_FADE = 5;
    public final static int ANIMATION_SLIDE_UP = 6;
    public final static int ANIMATION_SLIDE_DOWN = 7;
    public final static int ANIMATION_TRANSLUCENT = 8;
    public final static int ANIMATION_GROW_SHRINK = 9;
    public final static int ANIMATION_GROW_SHRINK_CENTER = 10;
    public final static int ANIMATION_GROW_SHRINK_BOTTOM = 11;
    public final static int ANIMATION_GROW_SHRINK_LEFT = 12;
    public final static int ANIMATION_GROW_SHRINK_RIGHT = 13;
    public static int[] getSystemAnimations(int mAnim, boolean enterOnly,
            boolean reverseExit) {
        int[] anim = new int[2];
        switch (mAnim) {
        case ANIMATION_FADE:
            anim[0] = reverseExit ? com.android.internal.R.anim.no_animation
                    : com.android.internal.R.anim.slow_fade_out;
            anim[1] = com.android.internal.R.anim.slow_fade_in;
            break;
        case ANIMATION_SLIDE_RIGHT:
            anim[0] = reverseExit ? com.android.internal.R.anim.slide_out_left_ribbon
                    : com.android.internal.R.anim.slide_out_right_ribbon;
            anim[1] = com.android.internal.R.anim.slide_in_right_ribbon;
            break;
        case ANIMATION_SLIDE_LEFT:
            anim[0] = reverseExit ? com.android.internal.R.anim.slide_out_right_ribbon
                    : com.android.internal.R.anim.slide_out_left_ribbon;
            anim[1] = com.android.internal.R.anim.slide_in_left_ribbon;
            break;
        case ANIMATION_SLIDE_UP:
            anim[0] = reverseExit ? com.android.internal.R.anim.slide_out_up
                    : com.android.internal.R.anim.slide_out_down_ribbon;
            anim[1] = com.android.internal.R.anim.slide_in_up_ribbon;
            break;
        case ANIMATION_SLIDE_DOWN:
            anim[0] = reverseExit ? com.android.internal.R.anim.slide_out_down_ribbon
                    : com.android.internal.R.anim.slide_out_up;
            anim[1] = com.android.internal.R.anim.slide_in_down;
            break;
        case ANIMATION_SLIDE_RIGHT_NO_FADE:
            anim[0] = reverseExit ? com.android.internal.R.anim.slide_out_left_no_fade
                    : com.android.internal.R.anim.slide_out_right_no_fade;
            anim[1] = com.android.internal.R.anim.slide_in_right_no_fade;
            break;
        case ANIMATION_SLIDE_LEFT_NO_FADE:
            anim[0] = reverseExit ? com.android.internal.R.anim.slide_out_right_no_fade
                    : com.android.internal.R.anim.slide_out_left_no_fade;
            anim[1] = com.android.internal.R.anim.slide_in_left_no_fade;
            break;
        case ANIMATION_TRANSLUCENT:
            anim[0] = reverseExit ? com.android.internal.R.anim.translucent_exit_left
                    : com.android.internal.R.anim.translucent_exit_ribbon;
            anim[1] = com.android.internal.R.anim.translucent_enter_ribbon;
            break;
        case ANIMATION_GROW_SHRINK:
            anim[0] = reverseExit ? com.android.internal.R.anim.shrink_fade_out_from_bottom_ribbon
                    : com.android.internal.R.anim.shrink_fade_out_ribbon;
            anim[1] = com.android.internal.R.anim.grow_fade_in_ribbon;
            break;
        case ANIMATION_GROW_SHRINK_CENTER:
            anim[0] = reverseExit ? com.android.internal.R.anim.no_animation
                    : com.android.internal.R.anim.shrink_fade_out_center_ribbon;
            anim[1] = com.android.internal.R.anim.grow_fade_in_center_ribbon;
            break;
        case ANIMATION_GROW_SHRINK_LEFT:
            anim[0] = reverseExit ? com.android.internal.R.anim.shrink_fade_out_right_ribbon
                    : com.android.internal.R.anim.shrink_fade_out_left_ribbon;
            anim[1] = com.android.internal.R.anim.grow_fade_in_left_ribbon;
            break;
        case ANIMATION_GROW_SHRINK_RIGHT:
            anim[0] = reverseExit ? com.android.internal.R.anim.shrink_fade_out_left_ribbon
                    : com.android.internal.R.anim.shrink_fade_out_right_ribbon;
            anim[1] = com.android.internal.R.anim.grow_fade_in_right_ribbon;
            break;
        case ANIMATION_GROW_SHRINK_BOTTOM:
            anim[0] = reverseExit ? com.android.internal.R.anim.shrink_fade_out_ribbon
                    : com.android.internal.R.anim.shrink_fade_out_from_bottom_ribbon;
            anim[1] = com.android.internal.R.anim.grow_fade_in_from_bottom_ribbon;
            break;
        }
        if (enterOnly)
            anim[0] = com.android.internal.R.anim.no_animation;
        return anim;
    }
}

Related Tutorials