List of usage examples for android.view.animation TranslateAnimation setDuration
public void setDuration(long durationMillis)
From source file:com.breadwallet.presenter.activities.IntroActivity.java
private void animateSlide(final Fragment from, final Fragment to, int direction) { if (to instanceof IntroRecoverWalletFragment) { if (Utils.isUsingCustomInputMethod(to.getActivity())) ((IntroRecoverWalletFragment) to).disableEditText(); }/*www . jav a 2 s .co m*/ int screenWidth = screenParametersPoint.x; int screenHeigth = screenParametersPoint.y; showHideFragments(from, to); TranslateAnimation transFrom = direction == RIGHT ? new TranslateAnimation(0, -screenWidth, 0, 0) : new TranslateAnimation(0, screenWidth, 0, 0); transFrom.setDuration(BRAnimator.horizontalSlideDuration); transFrom.setInterpolator(new DecelerateOvershootInterpolator(1f, 0.5f)); View fromView = from.getView(); if (fromView != null) fromView.startAnimation(transFrom); TranslateAnimation transTo = direction == RIGHT ? new TranslateAnimation(screenWidth, 0, 0, 0) : new TranslateAnimation(-screenWidth, 0, 0, 0); transTo.setDuration(BRAnimator.horizontalSlideDuration); transTo.setInterpolator(new DecelerateOvershootInterpolator(1f, 0.5f)); transTo.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { showHideFragments(to); } @Override public void onAnimationRepeat(Animation animation) { } }); View toView = to.getView(); if (toView != null) toView.startAnimation(transTo); }
From source file:com.changhong.mscreensynergy.mainui.fragment.ViewPageFragment.java
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { //mInflater = inflater; View mView = inflater.inflate(R.layout.view_pager, null); showLeft = (Button) mView.findViewById(R.id.showLeft); mPager = (ViewPager) mView.findViewById(R.id.pager); PageFragment1 page1 = new PageFragment1(); PageFragment2 page2 = new PageFragment2(); PageFragment3 page3 = new PageFragment3(); // PageFragment4 page4 = new PageFragment4(); // PageFragment5 page5 = new PageFragment5(); pagerItemList.add(page1);// w w w .ja va 2 s .co m pagerItemList.add(page2); pagerItemList.add(page3); // pagerItemList.add(page4); // pagerItemList.add(page5); mAdapter = new MyAdapter(getFragmentManager()); mPager.setAdapter(mAdapter); mPager.setOffscreenPageLimit(3); //3 mPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageSelected(int position) { if (myPageChangeListener != null) myPageChangeListener.onPageSelected(position); if (rg_nav_content != null && rg_nav_content.getChildCount() > position) { ((RadioButton) rg_nav_content.getChildAt(position)).performClick(); } } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } @Override public void onPageScrollStateChanged(int position) { } }); /* * ? */ rl_nav = (RelativeLayout) mView.findViewById(R.id.rl_nav); mHsv = (SyncHorizontalScrollView) mView.findViewById(R.id.mHsv); rg_nav_content = (RadioGroup) mView.findViewById(R.id.rg_nav_content); rg_nav_content.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { if (rg_nav_content.getChildAt(checkedId) != null) { TranslateAnimation animation = new TranslateAnimation(currentIndicatorLeft, ((RadioButton) rg_nav_content.getChildAt(checkedId)).getLeft(), 0f, 0f); animation.setInterpolator(new LinearInterpolator()); animation.setDuration(100); animation.setFillAfter(true); //? iv_nav_indicator.startAnimation(animation); mPager.setCurrentItem(checkedId); //ViewPager ? ? //? ? ? currentIndicatorLeft = ((RadioButton) rg_nav_content.getChildAt(checkedId)).getLeft(); mHsv.smoothScrollTo( (checkedId > 1 ? ((RadioButton) rg_nav_content.getChildAt(checkedId)).getLeft() : 0) - ((RadioButton) rg_nav_content.getChildAt(2)).getLeft(), 0); } } }); iv_nav_indicator = (ImageView) mView.findViewById(R.id.iv_nav_indicator); iv_nav_left = (ImageView) mView.findViewById(R.id.iv_nav_left); iv_nav_right = (ImageView) mView.findViewById(R.id.iv_nav_right); LayoutParams cursor_Params = iv_nav_indicator.getLayoutParams(); cursor_Params.width = indicatorWidth;// ? iv_nav_indicator.setLayoutParams(cursor_Params); mHsv.setSomeParam(rl_nav, iv_nav_left, iv_nav_right, SlidingActivity.scontext); mInflater = (LayoutInflater) SlidingActivity.scontext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); indicatorWidth = SlidingMenu.screenWidth / 4; initNavigationHSV(); return mView; }
From source file:com.kasungunathilaka.sarigama.ui.HomeActivity.java
private void showMiniPlayer(boolean show) { if (show) {/*from w ww .ja va 2s. c o m*/ TranslateAnimation animate = new TranslateAnimation(0, 0, flMiniPlayer.getHeight(), 0); animate.setDuration(getResources().getInteger(android.R.integer.config_mediumAnimTime)); flMiniPlayer.startAnimation(animate); flMiniPlayer.setVisibility(View.VISIBLE); } else { TranslateAnimation animate = new TranslateAnimation(0, 0, 0, flMiniPlayer.getHeight()); animate.setDuration(getResources().getInteger(android.R.integer.config_mediumAnimTime)); flMiniPlayer.startAnimation(animate); flMiniPlayer.setVisibility(View.GONE); } flMiniPlayer.setVisibility(show ? View.VISIBLE : View.GONE); }
From source file:com.xys.libzxing.zxing.activity.CaptureActivity.java
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) //?? != PackageManager.PERMISSION_GRANTED) { //??/*w ww . j a va 2 s . c o m*/ ActivityCompat.requestPermissions(CaptureActivity.this, new String[] { Manifest.permission.CAMERA }, 1); } Window window = getWindow(); requestWindowFeature(Window.FEATURE_NO_TITLE); window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.activity_capture); m_oCaptureActivity = this; scanPreview = (SurfaceView) findViewById(R.id.capture_preview); scanContainer = (RelativeLayout) findViewById(R.id.capture_container); scanCropView = (RelativeLayout) findViewById(R.id.capture_crop_view); scanLine = (ImageView) findViewById(R.id.capture_scan_line); trunoff_on = (ImageView) findViewById(R.id.trunoff_on); trunoff_on.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (isOpen) { // ? cameraManager.offLight(); isOpen = false; } else { //? cameraManager.openLight(); isOpen = true; } } }); inactivityTimer = new InactivityTimer(this); beepManager = new BeepManager(this); TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.9f); animation.setDuration(4500); animation.setRepeatCount(-1); animation.setRepeatMode(Animation.RESTART); scanLine.startAnimation(animation); }
From source file:com.melvin.share.zxing.activity.CaptureActivity.java
@Override protected void initView() { Window window = getWindow();/*from ww w.j a v a2s.co m*/ window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.activity_capture); initWindow(); toolbar = (Toolbar) findViewById(R.id.toolbar); initToolbar(toolbar); scanPreview = (SurfaceView) findViewById(R.id.capture_preview); scanContainer = (RelativeLayout) findViewById(R.id.capture_container); scanCropView = (RelativeLayout) findViewById(R.id.capture_crop_view); scanLine = (ImageView) findViewById(R.id.capture_scan_line); inactivityTimer = new InactivityTimer(this); beepManager = new BeepManager(this); TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.9f); animation.setDuration(4500); animation.setRepeatCount(-1); animation.setRepeatMode(Animation.RESTART); scanLine.startAnimation(animation); }
From source file:com.aosijia.dragonbutler.ui.widget.ActionSheet.java
private Animation createTranslationInAnimation() { int type = TranslateAnimation.RELATIVE_TO_SELF; TranslateAnimation an = new TranslateAnimation(type, 0, type, 0, type, 1, type, 0); an.setDuration(TRANSLATE_DURATION); return an;// w w w . j a v a 2 s .c o m }
From source file:com.aosijia.dragonbutler.ui.widget.ActionSheet.java
private Animation createTranslationOutAnimation() { int type = TranslateAnimation.RELATIVE_TO_SELF; TranslateAnimation an = new TranslateAnimation(type, 0, type, 0, type, 0, type, 1); an.setDuration(TRANSLATE_DURATION); an.setFillAfter(true);//from w w w .java 2 s. com return an; }
From source file:org.digitalcampus.oppia.activity.DownloadMediaActivity.java
private void showDownloadMediaMessage() { TranslateAnimation anim = new TranslateAnimation(0, 0, -200, 0); anim.setDuration(900); missingMediaContainer.startAnimation(anim); missingMediaContainer.measure(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); ValueAnimator animator = ValueAnimator.ofInt(0, missingMediaContainer.getMeasuredHeight()); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { //@Override public void onAnimationUpdate(ValueAnimator valueAnimator) { mediaList.setPadding(0, (Integer) valueAnimator.getAnimatedValue(), 0, 0); mediaList.setSelectionAfterHeaderView(); }//from w w w. j av a 2s . co m }); animator.setStartDelay(200); animator.setDuration(700); animator.start(); }
From source file:org.digitalcampus.oppia.activity.DownloadMediaActivity.java
private void hideDownloadMediaMessage() { TranslateAnimation anim = new TranslateAnimation(0, 0, 0, -200); anim.setDuration(900); missingMediaContainer.startAnimation(anim); missingMediaContainer.measure(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); ValueAnimator animator = ValueAnimator.ofInt(missingMediaContainer.getMeasuredHeight(), 0); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { //@Override public void onAnimationUpdate(ValueAnimator valueAnimator) { mediaList.setPadding(0, (Integer) valueAnimator.getAnimatedValue(), 0, 0); mediaList.setSelectionAfterHeaderView(); }//www.j a v a 2 s.c o m }); animator.setStartDelay(0); animator.setDuration(700); animator.start(); missingMediaContainer.setVisibility(View.GONE); }
From source file:cn.org.eshow.framwork.view.sliding.AbBottomTabView.java
/** * ??.//from w ww .j a v a2 s. co m * * @param v the v * @param startX the start x * @param toX the to x * @param startY the start y * @param toY the to y */ public void imageSlide(View v, int startX, int toX, int startY, int toY) { TranslateAnimation anim = new TranslateAnimation(startX, toX, startY, toY); anim.setDuration(100); anim.setFillAfter(true); v.startAnimation(anim); }