android.view.animation.DecelerateInterpolator Java Examples
The following examples show how to use
android.view.animation.DecelerateInterpolator.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PhotoEditToolCell.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@Override public void run() { valueTextView.setTag(null); valueAnimation = new AnimatorSet(); valueAnimation.playTogether( ObjectAnimator.ofFloat(valueTextView, "alpha", 0.0f), ObjectAnimator.ofFloat(nameTextView, "alpha", 1.0f)); valueAnimation.setDuration(180); valueAnimation.setInterpolator(new DecelerateInterpolator()); valueAnimation.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (animation.equals(valueAnimation)) { valueAnimation = null; } } }); valueAnimation.start(); }
Example #2
Source File: CommentContentsLayout.java From star-zone-android with Apache License 2.0 | 6 votes |
private void animateExpand(int target) { if (animator != null) { animator.cancel(); animator = null; } animator = ValueAnimator.ofFloat(curExpandValue, target); animator.setInterpolator(new DecelerateInterpolator()); animator.setDuration(300); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { setExpandValue((float) valueAnimator.getAnimatedValue()); } }); animator.addListener(new ExpansionListener(target)); animator.start(); }
Example #3
Source File: BaseRecyclerAdapter.java From TwinklingRefreshLayout with Apache License 2.0 | 6 votes |
private void runEnterAnimation(View view, int position) { if (animationsLocked) return; if (position > lastAnimatedPosition) { lastAnimatedPosition = position; view.setTranslationY(DensityUtil.dip2px(view.getContext(), 100));//(position+1)*50f view.setAlpha(0.f); view.animate() .translationY(0).alpha(1.f) .setStartDelay(delayEnterAnimation ? 20 * (position) : 0) .setInterpolator(new DecelerateInterpolator(2.f)) .setDuration(500) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { animationsLocked = true; } }).start(); } }
Example #4
Source File: MainActivity.java From android-player with Apache License 2.0 | 6 votes |
private void animateSampleThree(View activityMainProfileName, View activityMainMobileNumberLayout, View activityMainPinkFab, View activityMainheaderLayout, View activityMainMessageIcon) { final PropertyAction propertyAction = PropertyAction.newPropertyAction(activityMainheaderLayout).translationX(-200).duration(1500).interpolator(new AccelerateDecelerateInterpolator()).alpha(0.4f).build(); final PropertyAction headerPropertyAction = PropertyAction.newPropertyAction(activityMainProfileName).interpolator(new DecelerateInterpolator()).translationY(-200).duration(3750).delay(1233).alpha(0.4f).build(); final PropertyAction viewSecondAction = PropertyAction.newPropertyAction(activityMainPinkFab).translationY(200).duration(750).alpha(0f).build(); final PropertyAction bottomPropertyAction = PropertyAction.newPropertyAction(activityMainMobileNumberLayout).rotation(-180).scaleX(0.1f).scaleY(0.1f).translationX(-200).duration(750).build(); Player.init(). setPlayerStartListener(playerStartListener). setPlayerEndListener(playerEndListener). animate(propertyAction). animate(headerPropertyAction). then(). animate(viewSecondAction). then(). animate(bottomPropertyAction). play(); }
Example #5
Source File: BottomRedPointView.java From letv with Apache License 2.0 | 6 votes |
private void init(Context context, View target) { this.context = context; this.target = target; fadeIn = new AlphaAnimation(0.0f, 1.0f); fadeIn.setInterpolator(new DecelerateInterpolator()); fadeIn.setDuration(200); fadeOut = new AlphaAnimation(1.0f, 0.0f); fadeOut.setInterpolator(new AccelerateInterpolator()); fadeOut.setDuration(200); this.isShown = false; if (this.target != null) { applyTo(this.target); } else { show(); } }
Example #6
Source File: MicrophoneRecorderView.java From mollyim-android with GNU General Public License v3.0 | 6 votes |
void hide() { recordButtonFab.setTranslationX(0); recordButtonFab.setTranslationY(0); if (recordButtonFab.getVisibility() != VISIBLE) return; AnimationSet animation = new AnimationSet(false); Animation scaleAnimation = new ScaleAnimation(1, 0.5f, 1, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); Animation translateAnimation = new TranslateAnimation(Animation.ABSOLUTE, lastOffsetX, Animation.ABSOLUTE, 0, Animation.ABSOLUTE, lastOffsetY, Animation.ABSOLUTE, 0); scaleAnimation.setInterpolator(new AnticipateOvershootInterpolator(1.5f)); translateAnimation.setInterpolator(new DecelerateInterpolator()); animation.addAnimation(scaleAnimation); animation.addAnimation(translateAnimation); animation.setDuration(ANIMATION_DURATION); animation.setInterpolator(new AnticipateOvershootInterpolator(1.5f)); recordButtonFab.setVisibility(View.GONE); recordButtonFab.clearAnimation(); recordButtonFab.startAnimation(animation); }
Example #7
Source File: InsightsAnimatorSetFactory.java From mollyim-android with GNU General Public License v3.0 | 6 votes |
static AnimatorSet create(int insecurePercent, @Nullable final UpdateListener progressUpdateListener, @Nullable final UpdateListener detailsUpdateListener, @Nullable final UpdateListener percentSecureListener, @Nullable final UpdateListener lottieListener) { final int securePercent = 100 - insecurePercent; final AnimatorSet animatorSet = new AnimatorSet(); final ValueAnimator[] animators = Stream.of(createProgressAnimator(securePercent, progressUpdateListener), createDetailsAnimator(detailsUpdateListener), createPercentSecureAnimator(percentSecureListener), createLottieAnimator(lottieListener)) .filter(a -> a != null) .toArray(ValueAnimator[]::new); animatorSet.setInterpolator(new DecelerateInterpolator()); animatorSet.playTogether(animators); return animatorSet; }
Example #8
Source File: ModernFireworksDrawer.java From FireworkyPullToRefresh with MIT License | 6 votes |
private void emitFirework(int width, int height) { float fireworkWidth = width / mMaxFireworksCount; float fireworkHeight = height / mMaxFireworksCount; float x = RND.nextInt((int) (width - fireworkWidth)) + fireworkWidth / 2f; float y = RND.nextInt((int) (height - fireworkHeight)) + fireworkHeight; for(int i=0; i< mMaxFireworksCount; i++) { ParticleSystem particleSystem = new ParticleSystem( (Activity) mParentView.getContext(), //activity 20, //max particles R.drawable.ptr_star_white, //icon 800L, //time to live mParentView); //parent view particleSystem.setScaleRange(0.7f, 1.3f); particleSystem.setSpeedRange(0.03f, 0.07f); particleSystem.setRotationSpeedRange(90, 180); particleSystem.setFadeOut(500, new DecelerateInterpolator()); particleSystem.setTintColor(getRandomBubbleColor()); mParticleSystems.add(particleSystem); particleSystem.emit((int) x, (int) y, 70, 500); } }
Example #9
Source File: PullToRefreshView.java From Taurus with Apache License 2.0 | 6 votes |
public PullToRefreshView(Context context, AttributeSet attrs) { super(context, attrs); mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR); mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); float density = context.getResources().getDisplayMetrics().density; mTotalDragDistance = Math.round((float) DRAG_MAX_DISTANCE * density); mRefreshImageView = new ImageView(context); mRefreshView = new RefreshView(getContext(), this); mRefreshImageView.setImageDrawable(mRefreshView); addView(mRefreshImageView); setWillNotDraw(false); ViewCompat.setChildrenDrawingOrderEnabled(this, true); }
Example #10
Source File: SlidePanelView.java From Tok-Android with GNU General Public License v3.0 | 6 votes |
public void onStart() { updateTimeRunnable = new UpdateTimeRunnable(); setVisibility(View.VISIBLE); setTranslationX(getMeasuredWidth()); AnimatorSet animSet = new AnimatorSet(); animSet.setInterpolator(new DecelerateInterpolator()); animSet.setDuration(200); animSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); if (blinkingDrawable != null) { blinkingDrawable.blinking(); } postDelayed(updateTimeRunnable, 200); } }); animSet.playTogether(ObjectAnimator.ofFloat(this, "translationX", 0f), ObjectAnimator.ofFloat(this, "alpha", 1f)); animSet.start(); }
Example #11
Source File: DrawerLayoutContainer.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
public void openDrawer(boolean fast) { if (!allowOpenDrawer) { return; } if (AndroidUtilities.isTablet() && parentActionBarLayout != null && parentActionBarLayout.parentActivity != null) { AndroidUtilities.hideKeyboard(parentActionBarLayout.parentActivity.getCurrentFocus()); } cancelCurrentAnimation(); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playTogether(ObjectAnimator.ofFloat(this, "drawerPosition", drawerLayout.getMeasuredWidth())); animatorSet.setInterpolator(new DecelerateInterpolator()); if (fast) { animatorSet.setDuration(Math.max((int) (200.0f / drawerLayout.getMeasuredWidth() * (drawerLayout.getMeasuredWidth() - drawerPosition)), 50)); } else { animatorSet.setDuration(250); } animatorSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animator) { onDrawerAnimationEnd(true); } }); animatorSet.start(); currentAnimation = animatorSet; }
Example #12
Source File: OverScrollListView.java From Easy-PullToRefresh-Android with MIT License | 6 votes |
private void init(Context context) { mScreenDensity = context.getResources().getDisplayMetrics().density; mLoadingMorePullDistanceThreshold = (int)(mScreenDensity * 50); mScroller = new Scroller(context, new DecelerateInterpolator(1.3f)); // on Android 2.3.3, disabling overscroll makes ListView behave weirdly if (Build.VERSION.SDK_INT > 10) { // disable the glow effect at the edges when overscrolling. setOverScrollMode(OVER_SCROLL_NEVER); } final ViewConfiguration configuration = ViewConfiguration.get(getContext()); mTouchSlop = configuration.getScaledTouchSlop(); mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); mVelocityTracker = VelocityTracker.obtain(); }
Example #13
Source File: Utils.java From protrip with MIT License | 6 votes |
private void staggerContent(View[] animatedViews) { Interpolator interpolator = new DecelerateInterpolator(); for (int i = 0; i < animatedViews.length; ++i) { View v = animatedViews[i]; /* v.setLayerType(View.LAYER_TYPE_HARDWARE, null);*/ v.setAlpha(0f); v.setTranslationY(75); v.animate() .setInterpolator(interpolator) .alpha(1.0f) .translationY(0) .setStartDelay(100 + 75 * i) .start(); } }
Example #14
Source File: BorderEffect.java From TvWidget with Apache License 2.0 | 6 votes |
@Override public void onFocusChanged(View oldFocus, View newFocus) { try { if (newFocus instanceof AbsListView) { return; } AnimatorSet animatorSet = new AnimatorSet(); animatorSet.setInterpolator(new DecelerateInterpolator(1)); animatorSet.setDuration(mDurationTraslate); animatorSet.playTogether(mAnimatorList); for (Animator.AnimatorListener listener : mAnimatorListener) { animatorSet.addListener(listener); } mAnimatorSet = animatorSet; if (oldFocus == null) { animatorSet.setDuration(0); mTarget.setVisibility(View.VISIBLE); } animatorSet.start(); }catch (Exception ex){ ex.printStackTrace(); } }
Example #15
Source File: Utils.java From android-open-project-demo with Apache License 2.0 | 6 votes |
public static Animation createScaleAnimation(View view, int parentWidth, int parentHeight, int toX, int toY) { // Difference in X and Y final int diffX = toX - view.getLeft(); final int diffY = toY - view.getTop(); // Calculate actual distance using pythagors float diffDistance = FloatMath.sqrt((toX * toX) + (toY * toY)); float parentDistance = FloatMath .sqrt((parentWidth * parentWidth) + (parentHeight * parentHeight)); ScaleAnimation scaleAnimation = new ScaleAnimation(1f, 0f, 1f, 0f, Animation.ABSOLUTE, diffX, Animation.ABSOLUTE, diffY); scaleAnimation.setFillAfter(true); scaleAnimation.setInterpolator(new DecelerateInterpolator()); scaleAnimation.setDuration(Math.round(diffDistance / parentDistance * Constants.SCALE_ANIMATION_DURATION_FULL_DISTANCE)); return scaleAnimation; }
Example #16
Source File: TVSlideTab.java From moviedb-android with Apache License 2.0 | 6 votes |
/** * Instant shows our toolbar. Used when click on movie details from movies list and toolbar is hidden. */ public void showInstantToolbar() { if (activity != null) { View toolbarView = activity.findViewById(R.id.toolbar); if (toolbarView != null) { toolbarView.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2)).setDuration(0).start(); mSlidingTabLayout.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2)).setDuration(0).start(); upDyKey = true; downDyKey = false; downDy = 9999999; } } }
Example #17
Source File: PuzzlePiece.java From imsdk-android with MIT License | 6 votes |
PuzzlePiece(Drawable drawable, Area area, Matrix matrix) { this.drawable = drawable; this.area = area; this.matrix = matrix; this.previousMatrix = new Matrix(); this.drawableBounds = new Rect(0, 0, getWidth(), getHeight()); this.drawablePoints = new float[] { 0f, 0f, getWidth(), 0f, getWidth(), getHeight(), 0f, getHeight() }; this.mappedDrawablePoints = new float[8]; this.mappedBounds = new RectF(); this.centerPoint = new PointF(area.centerX(), area.centerY()); this.mappedCenterPoint = new PointF(); this.animator = ValueAnimator.ofFloat(0f, 1f); this.animator.setInterpolator(new DecelerateInterpolator()); this.tempMatrix = new Matrix(); }
Example #18
Source File: AdpArtists.java From freemp with Apache License 2.0 | 6 votes |
public AdpArtists(Activity activity, ArrayList<ClsTrack> data) { this.data = data; this.activity = activity; listAq = new AQuery(activity); int iDisplayWidth = Math.max(320, PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext()).getInt("screenWidth", 800)); int numColumns = (int) (iDisplayWidth / 310); if (numColumns == 0) numColumns = 1; width = (iDisplayWidth / numColumns); layoutParams = new AbsListView.LayoutParams(width, width); fadeIn = new AlphaAnimation(0, 1); fadeIn.setDuration(300); fadeIn.setInterpolator(new DecelerateInterpolator()); }
Example #19
Source File: DrawerLayoutContainer.java From Telegram with GNU General Public License v2.0 | 6 votes |
public void closeDrawer(boolean fast) { cancelCurrentAnimation(); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playTogether( ObjectAnimator.ofFloat(this, "drawerPosition", 0) ); animatorSet.setInterpolator(new DecelerateInterpolator()); if (fast) { animatorSet.setDuration(Math.max((int) (200.0f / drawerLayout.getMeasuredWidth() * drawerPosition), 50)); } else { animatorSet.setDuration(250); } animatorSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animator) { onDrawerAnimationEnd(false); } }); animatorSet.start(); }
Example #20
Source File: MetroViewBorderHandler.java From LivePlayback with Apache License 2.0 | 6 votes |
@Override public void onFocusChanged(View oldFocus, View newFocus) { try { if (newFocus instanceof AbsListView) {//如果新的view是AbsListView的实例,直接return return; } AnimatorSet animatorSet = new AnimatorSet(); animatorSet.setInterpolator(new DecelerateInterpolator(1));//设置插值器 animatorSet.setDuration(mDurationTraslate);//设置动画时间 animatorSet.playTogether(mAnimatorList);//表示两个动画同进执行 for (Animator.AnimatorListener listener : mAnimatorListener) { animatorSet.addListener(listener); } mAnimatorSet = animatorSet; if (oldFocus == null) {//之前view为null,表示首次状态时 animatorSet.setDuration(0);//无动画时长 mTarget.setVisibility(View.VISIBLE); } animatorSet.start();//开启动画 } catch (Exception ex) { ex.printStackTrace(); } }
Example #21
Source File: AnimUtils.java From Android-utils with Apache License 2.0 | 6 votes |
/** * <p>对 View 做透明度变化的进场动画。</p> * <p>相关方法 {@link #fadeOut(View, int, Animation.AnimationListener, boolean)}</p> * * @param view 做动画的 View * @param duration 动画时长(毫秒) * @param listener 动画回调 * @param isNeedAnimation 是否需要动画 */ public static AlphaAnimation fadeIn(View view, int duration, Animation.AnimationListener listener, boolean isNeedAnimation) { if (view == null) { return null; } if (isNeedAnimation) { view.setVisibility(View.VISIBLE); AlphaAnimation alpha = new AlphaAnimation(0, 1); alpha.setInterpolator(new DecelerateInterpolator()); alpha.setDuration(duration); alpha.setFillAfter(true); if (listener != null) { alpha.setAnimationListener(listener); } view.startAnimation(alpha); return alpha; } else { view.setAlpha(1); view.setVisibility(View.VISIBLE); return null; } }
Example #22
Source File: CastDetails.java From moviedb-android with Apache License 2.0 | 6 votes |
/** * Instant shows our toolbar. Used when click on movie details from movies list and toolbar is hidden. */ public void showInstantToolbar() { if (activity != null) { View toolbarView = activity.findViewById(R.id.toolbar); if (toolbarView != null) { toolbarView.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2)).setDuration(0).start(); mSlidingTabLayout.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2)).setDuration(0).start(); upDyKey = true; downDyKey = false; downDy = 9999999; } } }
Example #23
Source File: DetailActivity.java From MaterialWpp with Apache License 2.0 | 6 votes |
private void hideOrShowToolbar() { appBarLayout.animate() .translationY(ishide ? 0 : -appBarLayout.getHeight()) .setInterpolator(new DecelerateInterpolator()) .start(); floatingActionButton.animate() .scaleX(ishide?1.0F:0.0F) .scaleY(ishide?1.0F:0.0F) .alpha(ishide?0.8F:0.0F) .setInterpolator(new AccelerateDecelerateInterpolator()) .setDuration(500) .start(); linearLayout.animate() .translationY(ishide?0:-(appBarLayout.getHeight()+linearLayout.getHeight())) .setInterpolator(new DecelerateInterpolator()) .setDuration(1000) .start(); ishide = !ishide; }
Example #24
Source File: SwipeRefresh.java From Android-Application-ZJB with Apache License 2.0 | 6 votes |
/** * Constructor that is called when inflating SwipeRefreshLayout from XML. * * @param context */ public SwipeRefresh(Context context, AttributeSet attrs) { super(context, attrs); mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); mMediumAnimationDuration = getResources().getInteger( android.R.integer.config_mediumAnimTime); setWillNotDraw(false); mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR); final TypedArray a = context.obtainStyledAttributes(attrs, LAYOUT_ATTRS); setEnabled(a.getBoolean(0, true)); a.recycle(); final DisplayMetrics metrics = getResources().getDisplayMetrics(); mCircleWidth = (int) (CIRCLE_DIAMETER * metrics.density); mCircleHeight = (int) (CIRCLE_DIAMETER * metrics.density); createProgressView(); ViewCompat.setChildrenDrawingOrderEnabled(this, true); // the absolute offset has to take into account that the circle starts at an offset mSpinnerFinalOffset = DEFAULT_CIRCLE_TARGET * metrics.density; mTotalDragDistance = mSpinnerFinalOffset; }
Example #25
Source File: ViewPagerAdapter.java From MediaGallery with Apache License 2.0 | 6 votes |
private void onTap() { mPhotoViewAttacher = new PhotoViewAttacher(imageView); mPhotoViewAttacher.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() { @Override public void onPhotoTap(View view, float x, float y) { if (isShowing) { isShowing = false; toolbar.animate().translationY(-toolbar.getBottom()).setInterpolator(new AccelerateInterpolator()).start(); imagesHorizontalList.animate().translationY(imagesHorizontalList.getBottom()).setInterpolator(new AccelerateInterpolator()).start(); } else { isShowing = true; toolbar.animate().translationY(0).setInterpolator(new DecelerateInterpolator()).start(); imagesHorizontalList.animate().translationY(0).setInterpolator(new DecelerateInterpolator()).start(); } } @Override public void onOutsidePhotoTap() { } }); }
Example #26
Source File: MessageBox.java From always-on-amoled with GNU General Public License v3.0 | 5 votes |
public void showNotification(NotificationListener.NotificationHolder notification) { if (notification != null) if (!notification.getTitle().equals("null")) { this.notification = notification; //Clear previous animation if (messageBox.getAnimation() != null) messageBox.clearAnimation(); //Fade in animation Animation fadeIn = new AlphaAnimation(0, 1); fadeIn.setInterpolator(new DecelerateInterpolator()); fadeIn.setDuration(1000); //Fade out animation Animation fadeOut = new AlphaAnimation(1, 0); fadeOut.setInterpolator(new AccelerateInterpolator()); fadeOut.setStartOffset(40000); fadeOut.setDuration(1000); //Set the notification text and icon ((TextView) messageBox.findViewById(R.id.message_box_title)).setText(notification.getTitle()); ((TextView) messageBox.findViewById(R.id.message_box_message)).setText(notification.getMessage()); ((ImageView) messageBox.findViewById(R.id.message_box_icon)).setImageDrawable(notification.getIcon(context)); ((TextView) messageBox.findViewById(R.id.message_app_name)).setText(notification.getAppName()); //Run animations AnimationSet animation = new AnimationSet(false); animation.addAnimation(fadeIn); animation.addAnimation(fadeOut); messageBox.setAnimation(animation); } }
Example #27
Source File: BadgeView.java From android-project-wo2b with Apache License 2.0 | 5 votes |
private void init(Context context, View target, int tabIndex) { this.context = context; this.target = target; this.targetTabIndex = tabIndex; // apply defaults badgePosition = DEFAULT_POSITION; badgeMarginH = dipToPixels(DEFAULT_MARGIN_DIP); badgeMarginV = badgeMarginH; badgeColor = DEFAULT_BADGE_COLOR; setTypeface(Typeface.DEFAULT_BOLD); int paddingPixels = dipToPixels(DEFAULT_LR_PADDING_DIP); setPadding(paddingPixels, 0, paddingPixels, 0); setTextColor(DEFAULT_TEXT_COLOR); fadeIn = new AlphaAnimation(0, 1); fadeIn.setInterpolator(new DecelerateInterpolator()); fadeIn.setDuration(200); fadeOut = new AlphaAnimation(1, 0); fadeOut.setInterpolator(new AccelerateInterpolator()); fadeOut.setDuration(200); isShown = false; if (this.target != null) { applyTo(this.target); } else { show(); } }
Example #28
Source File: SuperSwipeRefreshLayout.java From AutoRecycleView with Apache License 2.0 | 5 votes |
@SuppressWarnings("deprecation") public SuperSwipeRefreshLayout(Context context, AttributeSet attrs) { super(context, attrs); /** * getScaledTouchSlop是一个距离,表示滑动的时候,手的移动要大于这个距离才开始移动控件。如果小于这个距离就不触发移动控件 */ mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); mMediumAnimationDuration = getResources().getInteger( android.R.integer.config_mediumAnimTime); setWillNotDraw(false); mDecelerateInterpolator = new DecelerateInterpolator( DECELERATE_INTERPOLATION_FACTOR); final TypedArray a = context .obtainStyledAttributes(attrs, LAYOUT_ATTRS); setEnabled(a.getBoolean(0, true)); a.recycle(); WindowManager wm = (WindowManager) context .getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); final DisplayMetrics metrics = getResources().getDisplayMetrics(); mHeaderViewWidth = (int) display.getWidth(); mFooterViewWidth = (int) display.getWidth(); mHeaderViewHeight = (int) (HEADER_VIEW_HEIGHT * metrics.density); mFooterViewHeight = (int) (HEADER_VIEW_HEIGHT * metrics.density); defaultProgressView = new CircleProgressView(getContext()); createHeaderViewContainer(); createFooterViewContainer(); ViewCompat.setChildrenDrawingOrderEnabled(this, true); mSpinnerFinalOffset = DEFAULT_CIRCLE_TARGET * metrics.density; density = metrics.density; mTotalDragDistance = mSpinnerFinalOffset; }
Example #29
Source File: CollectionListAdapter.java From Jager with GNU General Public License v3.0 | 5 votes |
private void runEnterAnimation (View view, int position) { if (position >= ANIMATED_ITEMS_COUNT - 1) { return; } if (position > lastAnimatedPosition) { lastAnimatedPosition = position; view.setTranslationY (ViewUtils.getScreenHeight (mContext)); view.animate () .translationY (0) .setInterpolator (new DecelerateInterpolator (3.f)) .setDuration (ANIM_LIST_ENTER_DURATION) .start (); } }
Example #30
Source File: DragItem.java From fingerpoetry-android with Apache License 2.0 | 5 votes |
void startDrag(View startFromView, float touchX, float touchY) { show(); onBindDragView(startFromView, mDragView); onMeasureDragView(startFromView, mDragView); onStartDragAnimation(mDragView); float startX = startFromView.getX() - (mDragView.getMeasuredWidth() - startFromView.getMeasuredWidth()) / 2 + mDragView .getMeasuredWidth() / 2; float startY = startFromView.getY() - (mDragView.getMeasuredHeight() - startFromView.getMeasuredHeight()) / 2 + mDragView .getMeasuredHeight() / 2; if (mSnapToTouch) { mPosTouchDx = 0; mPosTouchDy = 0; setPosition(touchX, touchY); setAnimationDx(startX - touchX); setAnimationDY(startY - touchY); PropertyValuesHolder pvhX = PropertyValuesHolder.ofFloat("AnimationDx", mAnimationDx, 0); PropertyValuesHolder pvhY = PropertyValuesHolder.ofFloat("AnimationDY", mAnimationDy, 0); ObjectAnimator anim = ObjectAnimator.ofPropertyValuesHolder(this, pvhX, pvhY); anim.setInterpolator(new DecelerateInterpolator()); anim.setDuration(ANIMATION_DURATION); anim.start(); } else { mPosTouchDx = startX - touchX; mPosTouchDy = startY - touchY; setPosition(touchX, touchY); } }