use of com.nineoldandroids.animation.ObjectAnimator in project ListViewAnimations by nhaarman.
the class SwipeTouchListener method flingView.
/**
* Flings given {@link android.view.View} out of sight.
*
* @param view the parent {@link android.view.View}.
* @param position the position of the item in the {@link android.widget.ListAdapter} corresponding to the {@code View}.
* @param flingToRight {@code true} if the {@code View} should be flinged to the right, {@code false} if it should be flinged to the left.
*/
private void flingView(@NonNull final View view, final int position, final boolean flingToRight) {
if (mViewWidth < 2) {
mViewWidth = mListViewWrapper.getListView().getWidth();
}
View swipeView = getSwipeView(view);
ObjectAnimator xAnimator = ObjectAnimator.ofFloat(swipeView, TRANSLATION_X, flingToRight ? mViewWidth : -mViewWidth);
ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(swipeView, ALPHA, 0);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(xAnimator, alphaAnimator);
animatorSet.setDuration(mAnimationTime);
animatorSet.addListener(new FlingAnimatorListener(view, position));
animatorSet.start();
}
use of com.nineoldandroids.animation.ObjectAnimator in project ListViewAnimations by nhaarman.
the class SwipeUndoTouchListener method undo.
/**
* Performs the undo animation and restores the original state for given {@link android.view.View}.
*
* @param view the parent {@code View} which contains both primary and undo {@code View}s.
*/
public void undo(@NonNull final View view) {
int position = AdapterViewUtil.getPositionForView(getListViewWrapper(), view);
mUndoPositions.remove(position);
View primaryView = mCallback.getPrimaryView(view);
View undoView = mCallback.getUndoView(view);
primaryView.setVisibility(View.VISIBLE);
ObjectAnimator undoAlphaAnimator = ObjectAnimator.ofFloat(undoView, ALPHA, 1f, 0f);
ObjectAnimator primaryAlphaAnimator = ObjectAnimator.ofFloat(primaryView, ALPHA, 0f, 1f);
ObjectAnimator primaryXAnimator = ObjectAnimator.ofFloat(primaryView, TRANSLATION_X, primaryView.getWidth(), 0f);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(undoAlphaAnimator, primaryAlphaAnimator, primaryXAnimator);
animatorSet.addListener(new UndoAnimatorListener(undoView));
animatorSet.start();
mCallback.onUndo(view, position);
}
use of com.nineoldandroids.animation.ObjectAnimator in project ListViewAnimations by nhaarman.
the class ScaleInAnimationAdapter method getAnimators.
@NonNull
@Override
public Animator[] getAnimators(@NonNull final ViewGroup parent, @NonNull final View view) {
ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, SCALE_X, mScaleFrom, 1f);
ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, SCALE_Y, mScaleFrom, 1f);
return new ObjectAnimator[] { scaleX, scaleY };
}
use of com.nineoldandroids.animation.ObjectAnimator in project MinimalForm by sd6352051.
the class MinimalFormLayout method resetLayout.
private void resetLayout(String title) {
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(mLabelTitle, "translationY", 0, -mLabelTitle.getHeight()).setDuration(ANIMATION_DURATION / 2);
objectAnimator.addListener(this);
objectAnimator.start();
mEditText.setText(contents[currentStep]);
if (inputTypes != null) {
mEditText.setInputType(inputTypes.get(currentStep));
}
mTextPage.setText((currentStep + 1) + "/" + datasize);
mEditText.setSelection(contents[currentStep] == null ? 0 : contents[currentStep].length());
}
use of com.nineoldandroids.animation.ObjectAnimator in project BeautifulRefreshLayout by android-cjj.
the class BeautifulRefreshLayout method shakeAnim.
public void shakeAnim(View view) {
ObjectAnimator animator = ObjectAnimator.ofFloat(view, "rotation", 0, 2, 0, -2, 0);
animator.setDuration(100);
animator.setRepeatCount(-1);
animator.setRepeatMode(ValueAnimator.RESTART);
animator.start();
}
Aggregations