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;
}
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);
}
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);
}
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;
}
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);
}
Aggregations