List of usage examples for android.view.animation TranslateAnimation setFillAfter
public void setFillAfter(boolean fillAfter)
From source file:freed.cam.ui.themesample.cameraui.HelpFragment.java
private void showCloseManualMenu() { TranslateAnimation animation = new TranslateAnimation(0.0f, 0.0f, 0.0f, 400.0f); animation.setDuration(1000);/*w ww . j a va 2 s.com*/ animation.setRepeatCount(Animation.INFINITE); animation.setRepeatMode(Animation.INFINITE); animation.setFillAfter(true); finger.startAnimation(animation); description.setText( "Swipe from top to bottom to close Manuals\r\n\r\nif you can't the heat use Google camera :)"); nextButton.setText("Close"); dontshowagain.setVisibility(View.VISIBLE); }
From source file:quickbeer.android.next.views.ProgressIndicatorBar.java
private void animateScroller() { Log.v(TAG, "animateScroller()"); int animEnd = getWidth() - progressBarWidth; TranslateAnimation animation = new TranslateAnimation(0, animEnd, 0, 0); animation.setDuration(ANIMATION_SCROLL_DURATION); animation.setFillAfter(true); animation.setRepeatMode(Animation.REVERSE); animation.setRepeatCount(Animation.INFINITE); animation.setAnimationListener(new Animation.AnimationListener() { private int repeatCounter = 0; @Override/*from w w w.j a v a 2 s . c o m*/ public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { if (++repeatCounter % 2 == 0 && nextStatus != Status.INDEFINITE) { applyNextStatus(); } } }); progressBar.setVisibility(VISIBLE); progressBar.clearAnimation(); progressBar.startAnimation(animation); }
From source file:com.umeng.simplify.ui.fragments.CommentTabFragment.java
private void moveTabCurosr(int position) { float endPosition; float startPosition; if (mCurrentTab == position) { return;//w w w . j av a 2 s. co m } if (mCurrentTab == 0) { startPosition = 0; } else { startPosition = mTabDistance; } if (position == 0) { endPosition = 0; } else { endPosition = mTabDistance; } mCurrentTab = position; TranslateAnimation animation = new TranslateAnimation(startPosition, endPosition, 0, 0); animation.setDuration(180);//? animation.setFillAfter(true); mTabCursor.startAnimation(animation); }
From source file:quickbeer.android.views.ProgressIndicatorBar.java
private void animateScroller() { Timber.v("animateScroller()"); checkNotNull(progressBar);/*from w w w. ja v a2 s. c om*/ int animEnd = getWidth() - progressBarWidth; TranslateAnimation animation = new TranslateAnimation(0, animEnd, 0, 0); animation.setDuration(ANIMATION_SCROLL_DURATION); animation.setFillAfter(true); animation.setRepeatMode(Animation.REVERSE); animation.setRepeatCount(Animation.INFINITE); animation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { if (nextProgress.getStatus() != INDEFINITE) { applyNextStatus(); } } }); progressBar.setVisibility(VISIBLE); progressBar.clearAnimation(); progressBar.startAnimation(animation); }
From source file:me.xiaopan.android.examples.activity.custom.SlideTabHostActivity.java
@Override public void onInitListener(Bundle savedInstanceState) { for (final Tab tab : tabList) { tab.getTitle().setOnClickListener(new OnClickListener() { @Override/*w w w .j a va 2 s. c o m*/ public void onClick(View v) { viewPager.setCurrentItem(Integer.valueOf(String.valueOf(tab.getIndex()))); } }); } viewPager.setOnPageChangeListener(new OnPageChangeListener() { @Override public void onPageSelected(int arg0) { //?tab?tab Tab lastTab = tabList.get(lastTabIndex); Tab currentTab = tabList.get(arg0); //??tab?tab lastTab.getTitle().setSelected(false); currentTab.getTitle().setSelected(true); //? TranslateAnimation translateAnimation = new TranslateAnimation(lastTab.getSlideBlock().getLeft(), currentTab.getSlideBlock().getLeft(), 0, 0); translateAnimation.setDuration(200); translateAnimation.setFillAfter(true); slideBlock.startAnimation(translateAnimation); //tab lastTabIndex = arg0; } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } @Override public void onPageScrollStateChanged(int arg0) { } }); }
From source file:us.shandian.blacklight.ui.statuses.TimeLineFragment.java
@Override public boolean onTouch(View v, MotionEvent ev) { switch (ev.getAction() & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: mLastY = ev.getY();/* w w w. ja va 2s . c o m*/ break; case MotionEvent.ACTION_MOVE: if (mLastY == -1.0f) break; float y = ev.getY(); if (!mNewHidden && y < mLastY) { mNew.clearAnimation(); TranslateAnimation anim = new TranslateAnimation(0, 0, 0, mList.getHeight() - mNew.getTop()); anim.setFillAfter(true); anim.setDuration(400); mNew.setAnimation(anim); anim.startNow(); mNewHidden = true; } else if (mNewHidden && y > mLastY) { mNew.clearAnimation(); TranslateAnimation anim = new TranslateAnimation(0, 0, mList.getHeight() - mNew.getTop(), 0); anim.setFillAfter(true); anim.setDuration(400); mNew.setAnimation(anim); anim.startNow(); mNewHidden = false; } mLastY = y; break; case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: mLastY = -1.0f; break; } return false; }
From source file:ezy.ui.view.NoticeView.java
private Animation anim(float from, float to) { final TranslateAnimation anim = new TranslateAnimation(0, 0f, 0, 0f, Animation.RELATIVE_TO_PARENT, from, Animation.RELATIVE_TO_PARENT, to); anim.setDuration(mDuration);/* ww w. j a v a 2 s. c o m*/ anim.setFillAfter(false); anim.setInterpolator(new LinearInterpolator()); return anim; }
From source file:com.givon.baseproject.xinlu.fragment.FraHome.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = getActivity().getLayoutInflater().inflate(R.layout.layout_frahome, null); mRefreshableView = (RefreshableView) view.findViewById(R.id.refreshable_view); mRefreshableView.setRefreshListener(this); mTopBarLayout = (LinearLayout) view.findViewById(R.id.ly_top_bar); mTv_SearchView = (TextView) view.findViewById(R.id.tv_search); mTv_SearchView.setOnClickListener(this); mTopBarLayout_Jiadi = (LinearLayout) view.findViewById(R.id.ly_top_bar_jiadi); mDotPager = (TopDotPager) view.findViewById(R.id.topDotPager); mDotPager.setmBitmapUtils(new BitmapUtils(getActivity())); mMyScrollView = (MyScrollView) view.findViewById(R.id.sv_ScrollView); InitWidth(view);//from w ww . j a v a 2 s . co m InitTextView(view); InitViewPager(view); resources = getResources(); TranslateAnimation animation = new TranslateAnimation(position_one, offset, 0, 0); tvTabHot.setTextColor(resources.getColor(R.color.font_white)); animation.setFillAfter(true); animation.setDuration(300); ivBottomLine.startAnimation(animation); return view; }
From source file:org.bcsphere.activity.BCPage.java
@Override public void onClick(View v) { switch (v.getId()) { case R.id.btnManager: mActivity.managerPopupWindow.showAsDropDown(view, 0, 0); TranslateAnimation animation = new TranslateAnimation(0, 0, 0, (float) (getScreenHeight(mActivity) * (430.0 / 1920.0))); animation.setDuration(200);/* w ww .j a v a 2 s. c o m*/ animation.setFillAfter(true); parentView.startAnimation(animation); break; case R.id.btnMenu: if (menuPopupWindow == null) { menuPopupWindow = new MenuPopupWindow(mActivity); } if (menuPopupWindow.isShowing()) { menuPopupWindow.dismiss(); return; } menuPopupWindow.showAsDropDown(btnMenu, 0, 20); break; case R.id.btnBack: mWebView.goBack(); break; case R.id.btnClose: Intent intent = new Intent(); intent.setAction("removeApp"); intent.putExtra("removeAppURL", PageManager.getCurrentPager().url); mActivity.sendBroadcast(intent); PageManager.setDeleteUrl(PageManager.getCurrentPager().url); break; case R.id.hintOpenBluetooth: startActivity(new Intent(Settings.ACTION_BLUETOOTH_SETTINGS)); break; case R.id.hintOpenNetwork: startActivity(new Intent(Settings.ACTION_SETTINGS)); break; } }
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);/* ww 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; }