List of usage examples for android.view.animation AccelerateDecelerateInterpolator AccelerateDecelerateInterpolator
public AccelerateDecelerateInterpolator()
From source file:info.awesomedevelopment.tvgrid.library.TVGridView.java
@SuppressWarnings("deprecation") private void init(AttributeSet attrs) { ActivityManager am = (ActivityManager) getContext().getSystemService(Context.ACTIVITY_SERVICE); mCache = new LruCache<>(am.getMemoryClass() * 1024); mYSize = new ValueAnimator(); mXSize = new ValueAnimator(); mYLocation = new ValueAnimator(); mXLocation = new ValueAnimator(); mXSize.addUpdateListener(xSizeListener); mYSize.addUpdateListener(ySizeListener); mYLocation.addUpdateListener(yLocationListener); mXLocation.addUpdateListener(xLocationListener); mSelectorAnimationSet.playTogether(mXLocation, mYLocation, mXSize, mYSize); mSelectorAnimationSet.setInterpolator(new AccelerateDecelerateInterpolator()); mSelectorAnimationSet.setDuration(ANIMATION_DURATION); TypedValue fillAlpha = new TypedValue(); getResources().getValue(R.dimen.tvg_defFillAlpha, fillAlpha, true); TypedValue fillAlphaSelected = new TypedValue(); getResources().getValue(R.dimen.tvg_defFillAlphaSelected, fillAlphaSelected, true); if (attrs != null) { TypedArray a = getContext().getTheme().obtainStyledAttributes(attrs, R.styleable.TVGridView, 0, 0); try {/*w w w . j av a 2 s. co m*/ //noinspection ResourceType mStrokePosition = a.getInteger(R.styleable.TVGridView_tvg_strokePosition, OUTSIDE); //noinspection ResourceType mSelectorPosition = a.getInteger(R.styleable.TVGridView_tvg_selectorPosition, OVER); //noinspection ResourceType mSelectorShape = a.getInteger(R.styleable.TVGridView_tvg_selectorShape, RECTANGLE); mAnimateSelectorChanges = a.getBoolean(R.styleable.TVGridView_tvg_animateSelectorChanges, getResources().getInteger(R.integer.tvg_defAnimateSelectorChanges) == 1); mIsFilled = a.getBoolean(R.styleable.TVGridView_tvg_filled, getResources().getInteger(R.integer.tvg_defIsFilled) == 1); mFillAlpha = a.getFloat(R.styleable.TVGridView_tvg_fillAlpha, fillAlpha.getFloat()); mFillAlphaSelected = a.getFloat(R.styleable.TVGridView_tvg_fillAlphaSelected, fillAlphaSelected.getFloat()); mFillColor = a.getColor(R.styleable.TVGridView_tvg_fillColor, getResources().getColor(R.color.tvg_defFillColor)); mFillColorSelected = a.getColor(R.styleable.TVGridView_tvg_fillColorSelected, getResources().getColor(R.color.tvg_defFillColorSelected)); mCornerRadiusX = a.getDimension(R.styleable.TVGridView_tvg_cornerRadius, getResources().getDimension(R.dimen.tvg_defCornerRadius)); mCornerRadiusY = a.getDimension(R.styleable.TVGridView_tvg_cornerRadius, getResources().getDimension(R.dimen.tvg_defCornerRadius)); mStrokeWidth = a.getDimension(R.styleable.TVGridView_tvg_strokeWidth, getResources().getDimension(R.dimen.tvg_defStrokeWidth)); mStrokeColor = a.getColor(R.styleable.TVGridView_tvg_strokeColor, getResources().getColor(R.color.tvg_defStrokeColor)); mStrokeColorSelected = a.getColor(R.styleable.TVGridView_tvg_strokeColorSelected, getResources().getColor(R.color.tvg_defStrokeColorSelected)); mStrokeMarginLeft = a.getDimension(R.styleable.TVGridView_tvg_marginLeft, getResources().getDimension(R.dimen.tvg_defStrokeMarginLeft)); mStrokeMarginTop = a.getDimension(R.styleable.TVGridView_tvg_marginTop, getResources().getDimension(R.dimen.tvg_defStrokeMarginTop)); mStrokeMarginRight = a.getDimension(R.styleable.TVGridView_tvg_marginRight, getResources().getDimension(R.dimen.tvg_defStrokeMarginRight)); mStrokeMarginBottom = a.getDimension(R.styleable.TVGridView_tvg_marginBottom, getResources().getDimension(R.dimen.tvg_defStrokeMarginBottom)); mStrokeSpacingLeft = a.getDimension(R.styleable.TVGridView_tvg_spacingLeft, getResources().getDimension(R.dimen.tvg_defStrokeSpacingLeft)); mStrokeSpacingTop = a.getDimension(R.styleable.TVGridView_tvg_spacingTop, getResources().getDimension(R.dimen.tvg_defStrokeSpacingTop)); mStrokeSpacingRight = a.getDimension(R.styleable.TVGridView_tvg_spacingRight, getResources().getDimension(R.dimen.tvg_defStrokeSpacingRight)); mStrokeSpacingBottom = a.getDimension(R.styleable.TVGridView_tvg_spacingBottom, getResources().getDimension(R.dimen.tvg_defStrokeSpacingBottom)); } finally { a.recycle(); } } else { mStrokePosition = OUTSIDE; mSelectorPosition = OVER; mSelectorShape = RECTANGLE; mAnimateSelectorChanges = getResources().getInteger(R.integer.tvg_defAnimateSelectorChanges) == 1; mIsFilled = getResources().getInteger(R.integer.tvg_defIsFilled) == 1; mFillAlpha = fillAlpha.getFloat(); mFillAlphaSelected = fillAlphaSelected.getFloat(); mFillColor = getResources().getColor(R.color.tvg_defFillColor); mFillColorSelected = getResources().getColor(R.color.tvg_defFillColorSelected); mCornerRadiusX = getResources().getDimension(R.dimen.tvg_defCornerRadius); mCornerRadiusY = getResources().getDimension(R.dimen.tvg_defCornerRadius); mStrokeWidth = getResources().getDimension(R.dimen.tvg_defStrokeWidth); mStrokeColor = getResources().getColor(R.color.tvg_defStrokeColor); mStrokeColorSelected = getResources().getColor(R.color.tvg_defStrokeColorSelected); mStrokeMarginLeft = getResources().getDimension(R.dimen.tvg_defStrokeMarginLeft); mStrokeMarginTop = getResources().getDimension(R.dimen.tvg_defStrokeMarginTop); mStrokeMarginRight = getResources().getDimension(R.dimen.tvg_defStrokeMarginRight); mStrokeMarginBottom = getResources().getDimension(R.dimen.tvg_defStrokeMarginBottom); mStrokeSpacingLeft = getResources().getDimension(R.dimen.tvg_defStrokeSpacingLeft); mStrokeSpacingTop = getResources().getDimension(R.dimen.tvg_defStrokeSpacingTop); mStrokeSpacingRight = getResources().getDimension(R.dimen.tvg_defStrokeSpacingRight); mStrokeSpacingBottom = getResources().getDimension(R.dimen.tvg_defStrokeSpacingBottom); } addOnScrollListener(new OnScrollListener() { @Override public void onScrollStateChanged(RecyclerView recyclerView, int newState) { super.onScrollStateChanged(recyclerView, newState); if (newState == SCROLL_STATE_IDLE) { mEdgeChange = false; mHardScrollChange = false; } } @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); mScrollY = mScrollY + dy; if (mStrokeCellCurrentBounds == null || mStrokeCell == null) return; if (useAnimations()) { mSelectorAnimationSet.cancel(); mStrokeCellCurrentBounds.offsetTo(mStrokeCellCurrentBounds.left - dx, mStrokeCellCurrentBounds.top - dy); performSelectorAnimation(); } else if (mHardScrollChange || mEdgeChange) { mStrokeCellCurrentBounds.offsetTo(mStrokeCellCurrentBounds.left - dx, mStrokeCellCurrentBounds.top - dy); setPrevBounds(); mStrokeCell.setBounds(mStrokeCellPrevBounds); invalidate(); } } }); setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { clearHighlightedView(); return false; } }); }
From source file:com.aniruddhc.acemusic.player.FoldersFragment.FilesFoldersFragment.java
/** * Slides in the ListView.//from w ww .ja va2 s . co m */ 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); }
From source file:arun.com.chromer.shared.views.TabView.java
private void selectedAnimation() { clearAnimations();//w w w . j av a 2 s . c o m final AnimatorSet transformAnimator = new AnimatorSet(); transformAnimator.playTogether(ObjectAnimator.ofFloat(tabIcon, "translationX", getIconCentreInLayout()), ObjectAnimator.ofFloat(tabIcon, "scaleX", 1f), ObjectAnimator.ofFloat(tabIcon, "scaleY", 1f), ObjectAnimator.ofFloat(text, "scaleX", 0f), ObjectAnimator.ofFloat(text, "scaleY", 0f), ObjectAnimator.ofFloat(text, "alpha", 0f)); transformAnimator.setDuration(275); transformAnimator.setInterpolator(new AccelerateDecelerateInterpolator()); final AnimatorSet togetherAnimator = new AnimatorSet(); togetherAnimator.playSequentially(transformAnimator, getIconSelectionAnimator()); togetherAnimator.start(); }
From source file:com.abslyon.abetterselection.CoverFlow.CoverFlowView.java
private void init() { setWillNotDraw(false);// w ww . j a v a 2s . c o m setClickable(true); mChildTransfromer = new Matrix(); mReflectionTransfromer = new Matrix(); mTouchRect = new RectF(); mImageRecorder = new SparseArray<int[]>(); mDrawChildPaint = new Paint(); mDrawChildPaint.setAntiAlias(true); mDrawChildPaint.setFlags(Paint.ANTI_ALIAS_FLAG); mCoverFlowPadding = new Rect(); mDrawFilter = new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG); mScroller = new Scroller(getContext(), new AccelerateDecelerateInterpolator()); mRemoveReflectionPendingArray = new ArrayList<Integer>(); }
From source file:com.aniruddhc.acemusic.player.ListViewFragment.ListViewFragment.java
/** * Displays the search field.//from w w w. j a v a 2 s. com */ private void showSearch() { mSearchLayout.setVisibility(View.VISIBLE); final TranslateAnimation searchAnim = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, -2f, Animation.RELATIVE_TO_SELF, 0f); searchAnim.setDuration(500l); searchAnim.setInterpolator(new AccelerateDecelerateInterpolator()); final TranslateAnimation gridListAnim = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 2f); gridListAnim.setDuration(500l); gridListAnim.setInterpolator(new LinearInterpolator()); gridListAnim.setAnimationListener(new AnimationListener() { @Override public void onAnimationEnd(Animation animation) { mListView.setAdapter(null); } @Override public void onAnimationRepeat(Animation animation) { // TODO Auto-generated method stub } @Override public void onAnimationStart(Animation animation) { mSearchLayout.startAnimation(searchAnim); mSearchLayout.setVisibility(View.VISIBLE); } }); searchAnim.setAnimationListener(new AnimationListener() { @Override public void onAnimationEnd(Animation animation) { if (mSearchEditText.requestFocus()) { mFragment.getActivity().getWindow() .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); } } @Override public void onAnimationRepeat(Animation animation) { // TODO Auto-generated method stub } @Override public void onAnimationStart(Animation animation) { // TODO Auto-generated method stub } }); mListView.startAnimation(gridListAnim); }
From source file:com.wytiger.common.widget.SlideSwitch.java
private void moveToDest(final boolean toRight) { ValueAnimator toDestAnim = ValueAnimator.ofInt(frontRect_left, toRight ? max_left : min_left); toDestAnim.setDuration(500);/*from w w w .j ava 2 s. com*/ toDestAnim.setInterpolator(new AccelerateDecelerateInterpolator()); toDestAnim.start(); toDestAnim.addUpdateListener(new AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { frontRect_left = (Integer) animation.getAnimatedValue(); alpha = (int) (255 * (float) frontRect_left / (float) max_left); invalidateView(); } }); toDestAnim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (toRight) { isOpen = true; if (listener != null) listener.open(); frontRect_left_begin = max_left; } else { isOpen = false; if (listener != null) listener.close(); frontRect_left_begin = min_left; } } }); }
From source file:com.viewpagerindicator.TabMovablePageIndicator.java
private void animateScrollWithIndicator(TabView tabView) { int scrollPos = tabView.getLeft() - (getWidth() - tabView.getWidth()) / 2; AnimatorSet as = new AnimatorSet(); as.setDuration(300);/*from w w w.jav a2 s . c o m*/ ArrayList<Animator> animations = new ArrayList<Animator>(); // scroll ObjectAnimator animScrollX = ObjectAnimator.ofInt(TabMovablePageIndicator.this, "scrollX", scrollPos); animScrollX.setInterpolator(new AccelerateDecelerateInterpolator()); animations.add(animScrollX); // indicator position int left = tabView.getLeft(); // int width = tabView.getWidth(); int textWidth = tabView.wordWidth; // int x = left + (width - textWidth) / 2 - mExtendWidth * 2; // x = x < 0 ? 0 : x; ObjectAnimator translateXAnim = ObjectAnimator.ofFloat(mIndicator, "translationX", left); translateXAnim.setInterpolator(new OvershootInterpolator(0.8f)); animations.add(translateXAnim); // indicator width ValueAnimator animWidth = ValueAnimator.ofInt(mIndicator.getLayoutParams().width, textWidth + mExtendWidth * 2); animWidth.addUpdateListener(new AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mIndicator.getLayoutParams(); lp.width = (Integer) animation.getAnimatedValue(); mIndicator.setLayoutParams(lp); requestLayout(); } }); animations.add(animWidth); as.playTogether(animations); as.start(); }
From source file:com.dolphinwang.imagecoverflow.CoverFlowView.java
private void init() { setWillNotDraw(false);/* ww w . java 2 s . c o m*/ setClickable(true); mChildTransfromer = new Matrix(); mReflectionTransfromer = new Matrix(); mTouchRect = new RectF(); mTouchRect2 = new ArrayList<RectF>(); for (int i = 0; i < 5; i++) { RectF a = new RectF(); mTouchRect2.add(a); } mImageRecorder = new SparseArray<int[]>(); mDrawChildPaint = new Paint(); mDrawChildPaint.setAntiAlias(true); mDrawChildPaint.setFlags(Paint.ANTI_ALIAS_FLAG); mCoverFlowPadding = new Rect(); mDrawFilter = new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG); mScroller = new Scroller(getContext(), new AccelerateDecelerateInterpolator()); mRemoveReflectionPendingArray = new ArrayList<Integer>(); }
From source file:de.wikilab.android.friendica01.activity.HomeActivity.java
protected void setMenuBarVisible(boolean v) { View leftBar = findViewById(R.id.left_bar); if (v) {//from w w w . j av a 2s .c om Animation anim1 = AnimationUtils.loadAnimation(HomeActivity.this, android.R.anim.slide_in_left); anim1.setInterpolator((new AccelerateDecelerateInterpolator())); //anim1.setFillAfter(true); leftBar.setAnimation(anim1); leftBar.setVisibility(View.VISIBLE); } else { Animation anim1 = AnimationUtils.loadAnimation(HomeActivity.this, R.anim.slide_out_left); anim1.setInterpolator((new AccelerateDecelerateInterpolator())); anim1.setFillAfter(true); leftBar.setAnimation(anim1); leftBar.setVisibility(View.GONE); } }
From source file:com.fruit.widget.SlideSwitch.java
public void moveToDest(final boolean toRight) { ValueAnimator toDestAnim = ValueAnimator.ofInt(frontRect_left, toRight ? max_left : min_left); toDestAnim.setDuration(duration);//ww w . j a v a 2 s . com toDestAnim.setInterpolator(new AccelerateDecelerateInterpolator()); toDestAnim.start(); toDestAnim.addUpdateListener(new AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { frontRect_left = (Integer) animation.getAnimatedValue(); alpha = (int) (255 * (float) frontRect_left / (float) max_left); invalidateView(); } }); toDestAnim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (toRight) { isOpen = true; if (listener != null) listener.open(); frontRect_left_begin = max_left; } else { isOpen = false; if (listener != null) listener.close(); frontRect_left_begin = min_left; } } }); }