Home | History | Annotate | Download | only in videoeditor
      1 /*
      2  * Copyright (C) 2010 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.android.videoeditor;
     18 
     19 import android.content.Context;
     20 
     21 /**
     22  * A movie transition type
     23  */
     24 public class TransitionType {
     25     // Transition types
     26     public static final int TRANSITION_TYPE_ALPHA_CONTOUR = 0;
     27     public static final int TRANSITION_TYPE_ALPHA_DIAGONAL= 1;
     28     public static final int TRANSITION_TYPE_CROSSFADE = 2;
     29     public static final int TRANSITION_TYPE_FADE_BLACK = 3;
     30     public static final int TRANSITION_TYPE_SLIDING_RIGHT_OUT_LEFT_IN = 4;
     31     public static final int TRANSITION_TYPE_SLIDING_LEFT_OUT_RIGHT_IN = 5;
     32     public static final int TRANSITION_TYPE_SLIDING_TOP_OUT_BOTTOM_IN = 6;
     33     public static final int TRANSITION_TYPE_SLIDING_BOTTOM_OUT_TOP_IN = 7;
     34 
     35     // Transition preview resources
     36     public final static int TRANSITION_RESOURCE_IDS[] = {
     37         R.drawable.transition_alpha_contour,
     38         R.drawable.transition_alpha_diagonal,
     39         R.drawable.transition_crossfade,
     40         R.drawable.transition_fade_black,
     41         R.drawable.transition_sliding_right_out_left_in,
     42         R.drawable.transition_sliding_left_out_right_in,
     43         R.drawable.transition_sliding_top_out_bottom_in,
     44         R.drawable.transition_sliding_bottom_out_top_in
     45     };
     46 
     47     /**
     48      * Get transitions for the specified category
     49      *
     50      * @param context The context
     51      *
     52      * @return The array of transitions of the specified category
     53      */
     54     public static TransitionType[] getTransitions(Context context) {
     55         final TransitionType[] transitions = new TransitionType[8];
     56         transitions[0] = new TransitionType(
     57                 context.getString(R.string.transitions_alpha_countour),
     58                 TRANSITION_TYPE_ALPHA_CONTOUR);
     59         transitions[1] = new TransitionType(
     60                 context.getString(R.string.transitions_alpha_diagonal),
     61                 TRANSITION_TYPE_ALPHA_DIAGONAL);
     62         transitions[2] = new TransitionType(
     63                 context.getString(R.string.transitions_crossfade),
     64                 TRANSITION_TYPE_CROSSFADE);
     65         transitions[3] = new TransitionType(
     66                 context.getString(R.string.transitions_fade_black),
     67                 TRANSITION_TYPE_FADE_BLACK);
     68         transitions[4] = new TransitionType(
     69                 context.getString(R.string.transitions_sliding_right_out_left_in),
     70                 TRANSITION_TYPE_SLIDING_RIGHT_OUT_LEFT_IN);
     71         transitions[5] = new TransitionType(
     72                 context.getString(R.string.transitions_sliding_left_out_right_in),
     73                 TRANSITION_TYPE_SLIDING_LEFT_OUT_RIGHT_IN);
     74         transitions[6] = new TransitionType(
     75                 context.getString(R.string.transitions_sliding_top_out_bottom_in),
     76                 TRANSITION_TYPE_SLIDING_TOP_OUT_BOTTOM_IN);
     77         transitions[7] = new TransitionType(
     78                 context.getString(R.string.transitions_sliding_bottom_out_top_in),
     79                 TRANSITION_TYPE_SLIDING_BOTTOM_OUT_TOP_IN);
     80 
     81         return transitions;
     82     }
     83 
     84     // Instance variables
     85     private final String mName;
     86     private final int mType;
     87 
     88     /**
     89      * Constructor
     90      */
     91     public TransitionType(String name, int type) {
     92         mName = name;
     93         mType = type;
     94     }
     95 
     96     /**
     97      * @return The theme name
     98      */
     99     public String getName() {
    100         return mName;
    101     }
    102 
    103     /**
    104      * @return The type
    105      */
    106     public int getType() {
    107         return mType;
    108     }
    109 }
    110