Search in sources :

Example 21 with TranslateAnimation

use of android.view.animation.TranslateAnimation in project mobile-android by photo.

the class BottombarViewFlipper method createInAnimation.

/**
	 * Creates the in animation.
	 * 
	 * @param deltaType
	 *           the delta type
	 * @param height
	 *           the height
	 * @param durationMillis
	 *           the duration millis
	 * @param startOffset
	 *           the start offset
	 * @return the animation
	 */
private Animation createInAnimation(int deltaType, int height, int durationMillis, int startOffset) {
    if (mAnimationIn == null) {
        mAnimationIn = new TranslateAnimation(deltaType, 0, deltaType, 0, deltaType, height, deltaType, 0);
        mAnimationIn.setDuration(durationMillis);
        mAnimationIn.setStartOffset(startOffset);
        mAnimationIn.setInterpolator(new AccelerateInterpolator(0.5f));
    }
    return mAnimationIn;
// return animation;
}
Also used : AccelerateInterpolator(android.view.animation.AccelerateInterpolator) TranslateAnimation(android.view.animation.TranslateAnimation)

Example 22 with TranslateAnimation

use of android.view.animation.TranslateAnimation in project Android2048GameLesson by plter.

the class AnimLayer method createMoveAnim.

public void createMoveAnim(final Card from, final Card to, int fromX, int toX, int fromY, int toY) {
    final Card c = getCard(from.getNum());
    LayoutParams lp = new LayoutParams(Config.CARD_WIDTH, Config.CARD_WIDTH);
    lp.leftMargin = fromX * Config.CARD_WIDTH;
    lp.topMargin = fromY * Config.CARD_WIDTH;
    c.setLayoutParams(lp);
    if (to.getNum() <= 0) {
        to.getLabel().setVisibility(View.INVISIBLE);
    }
    TranslateAnimation ta = new TranslateAnimation(0, Config.CARD_WIDTH * (toX - fromX), 0, Config.CARD_WIDTH * (toY - fromY));
    ta.setDuration(100);
    ta.setAnimationListener(new Animation.AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            to.getLabel().setVisibility(View.VISIBLE);
            recycleCard(c);
        }
    });
    c.startAnimation(ta);
}
Also used : TranslateAnimation(android.view.animation.TranslateAnimation) ScaleAnimation(android.view.animation.ScaleAnimation) TranslateAnimation(android.view.animation.TranslateAnimation) Animation(android.view.animation.Animation)

Example 23 with TranslateAnimation

use of android.view.animation.TranslateAnimation in project JamsMusicPlayer by psaravan.

the class FilesFoldersFragment method slideUpListView.

/**
     * Slides in the ListView.
     */
private void slideUpListView() {
    getDir(rootDir, null);
    TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 2.0f, Animation.RELATIVE_TO_SELF, 0.0f);
    animation.setDuration(600);
    animation.setInterpolator(new AccelerateDecelerateInterpolator());
    animation.setAnimationListener(new AnimationListener() {

        @Override
        public void onAnimationEnd(Animation arg0) {
        }

        @Override
        public void onAnimationRepeat(Animation arg0) {
        // TODO Auto-generated method stub
        }

        @Override
        public void onAnimationStart(Animation arg0) {
            listView.setVisibility(View.VISIBLE);
        }
    });
    listView.startAnimation(animation);
}
Also used : TranslateAnimation(android.view.animation.TranslateAnimation) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) TranslateAnimation(android.view.animation.TranslateAnimation) Animation(android.view.animation.Animation) AnimationListener(android.view.animation.Animation.AnimationListener)

Example 24 with TranslateAnimation

use of android.view.animation.TranslateAnimation in project JamsMusicPlayer by psaravan.

the class MusicFoldersFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mContext = getActivity().getApplicationContext();
    mApp = (Common) mContext;
    View rootView = (View) getActivity().getLayoutInflater().inflate(R.layout.fragment_welcome_screen_2, null);
    mFoldersLayout = (RelativeLayout) rootView.findViewById(R.id.folders_fragment_holder);
    if (mApp.getSharedPreferences().getInt("MUSIC_FOLDERS_SELECTION", 0) == 0) {
        mFoldersLayout.setVisibility(View.INVISIBLE);
        mFoldersLayout.setEnabled(false);
    } else {
        mFoldersLayout.setVisibility(View.VISIBLE);
        mFoldersLayout.setEnabled(true);
    }
    mSlideInAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 2.0f, Animation.RELATIVE_TO_SELF, 0.0f);
    mSlideInAnimation.setDuration(600);
    mSlideInAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
    mSlideInAnimation.setAnimationListener(slideInListener);
    mSlideOutAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 2.0f);
    mSlideOutAnimation.setDuration(600);
    mSlideOutAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
    mSlideOutAnimation.setAnimationListener(slideOutListener);
    mChildFragmentManager = this.getChildFragmentManager();
    mChildFragmentManager.beginTransaction().add(R.id.folders_fragment_holder, getMusicFoldersSelectionFragment()).commit();
    mWelcomeHeader = (TextView) rootView.findViewById(R.id.welcome_header);
    mWelcomeHeader.setTypeface(TypefaceHelper.getTypeface(mContext, "Roboto-Light"));
    mMusicFoldersOptions = (RadioGroup) rootView.findViewById(R.id.music_library_welcome_radio_group);
    RadioButton getAllSongsRadioButton = (RadioButton) mMusicFoldersOptions.findViewById(R.id.get_all_songs_radio);
    RadioButton letMePickFoldersRadioButton = (RadioButton) mMusicFoldersOptions.findViewById(R.id.pick_folders_radio);
    getAllSongsRadioButton.setTypeface(TypefaceHelper.getTypeface(mContext, "Roboto-Regular"));
    letMePickFoldersRadioButton.setTypeface(TypefaceHelper.getTypeface(mContext, "Roboto-Regular"));
    mMusicFoldersOptions.setOnCheckedChangeListener(onCheckedChangeListener);
    return rootView;
}
Also used : TranslateAnimation(android.view.animation.TranslateAnimation) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) RadioButton(android.widget.RadioButton) TextView(android.widget.TextView) View(android.view.View)

Example 25 with TranslateAnimation

use of android.view.animation.TranslateAnimation in project weiciyuan by qii.

the class UserInfoFragment method displayCoverPicture.

private void displayCoverPicture() {
    if (cover.getDrawable() != null) {
        return;
    }
    //        final int height = viewPager.getHeight();
    final int height = Utility.dip2px(200);
    final int width = Utility.getMaxLeftWidthOrHeightImageViewCanRead(height);
    final String picPath = userBean.getCover_image();
    blur.setAlpha(0f);
    blur.setOriImageUrl(picPath);
    ArrayList<ImageView> imageViewArrayList = new ArrayList<ImageView>();
    imageViewArrayList.add(cover);
    imageViewArrayList.add(blur);
    TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, -100f, Animation.RELATIVE_TO_SELF, 0f);
    animation.setDuration(3000);
    animation.setInterpolator(new DecelerateInterpolator());
    ArrayList<Animation> animationArray = new ArrayList<Animation>();
    animationArray.add(animation);
    TimeLineBitmapDownloader.getInstance().display(imageViewArrayList, width, height, picPath, FileLocationMethod.cover, animationArray);
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) ArrayList(java.util.ArrayList) TranslateAnimation(android.view.animation.TranslateAnimation) TranslateAnimation(android.view.animation.TranslateAnimation) Animation(android.view.animation.Animation) ImageView(android.widget.ImageView) BlurImageView(org.qii.weiciyuan.support.lib.BlurImageView) TimeLineAvatarImageView(org.qii.weiciyuan.support.lib.TimeLineAvatarImageView) TextPaint(android.text.TextPaint)

Aggregations

TranslateAnimation (android.view.animation.TranslateAnimation)156 Animation (android.view.animation.Animation)69 AlphaAnimation (android.view.animation.AlphaAnimation)65 AnimationSet (android.view.animation.AnimationSet)48 ScaleAnimation (android.view.animation.ScaleAnimation)27 View (android.view.View)17 AnimationListener (android.view.animation.Animation.AnimationListener)16 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)14 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)14 ClipRectAnimation (android.view.animation.ClipRectAnimation)12 LinearInterpolator (android.view.animation.LinearInterpolator)12 CurvedTranslateAnimation (com.android.server.wm.animation.CurvedTranslateAnimation)12 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)11 ListView (android.widget.ListView)11 TextView (android.widget.TextView)11 ImageView (android.widget.ImageView)9 WindowAnimation_activityCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_activityCloseEnterAnimation)8 WindowAnimation_activityCloseExitAnimation (com.android.internal.R.styleable.WindowAnimation_activityCloseExitAnimation)8 WindowAnimation_activityOpenEnterAnimation (com.android.internal.R.styleable.WindowAnimation_activityOpenEnterAnimation)8 WindowAnimation_activityOpenExitAnimation (com.android.internal.R.styleable.WindowAnimation_activityOpenExitAnimation)8