@Override
  public void animateToVisibility(int visibility) {
    if (visibility == View.GONE) {
      ViewCompat.animate(mToolbar)
          .alpha(0)
          .setListener(
              new ViewPropertyAnimatorListenerAdapter() {
                private boolean mCanceled = false;

                @Override
                public void onAnimationEnd(View view) {
                  if (!mCanceled) {
                    mToolbar.setVisibility(View.GONE);
                  }
                }

                @Override
                public void onAnimationCancel(View view) {
                  mCanceled = true;
                }
              });
    } else if (visibility == View.VISIBLE) {
      ViewCompat.animate(mToolbar)
          .alpha(1)
          .setListener(
              new ViewPropertyAnimatorListenerAdapter() {
                @Override
                public void onAnimationStart(View view) {
                  mToolbar.setVisibility(View.VISIBLE);
                }
              });
    }
  }
 private void animateChangeImpl(DefaultItemAnimator.ChangeInfo paramChangeInfo)
 {
   View localView = null;
   Object localObject = oldHolder;
   if (localObject == null) {}
   for (localObject = null;; localObject = itemView)
   {
     RecyclerView.ViewHolder localViewHolder = newHolder;
     if (localViewHolder != null) {
       localView = itemView;
     }
     if (localObject != null)
     {
       localObject = ViewCompat.animate((View)localObject).setDuration(getChangeDuration());
       mChangeAnimations.add(oldHolder);
       ((ViewPropertyAnimatorCompat)localObject).translationX(toX - fromX);
       ((ViewPropertyAnimatorCompat)localObject).translationY(toY - fromY);
       ((ViewPropertyAnimatorCompat)localObject).alpha(0.0F).setListener(new DefaultItemAnimator.7(this, paramChangeInfo, (ViewPropertyAnimatorCompat)localObject)).start();
     }
     if (localView != null)
     {
       localObject = ViewCompat.animate(localView);
       mChangeAnimations.add(newHolder);
       ((ViewPropertyAnimatorCompat)localObject).translationX(0.0F).translationY(0.0F).setDuration(getChangeDuration()).alpha(1.0F).setListener(new DefaultItemAnimator.8(this, paramChangeInfo, (ViewPropertyAnimatorCompat)localObject, localView)).start();
     }
     return;
   }
 }
  public void setError(@Nullable CharSequence error) {
    if (!isErrorEnabled() && TextUtils.isEmpty(error)) {
      return;
    }

    if (!TextUtils.isEmpty(error)) {
      ViewCompat.setAlpha(this.error, 0f);
      setErrorEnabled(true);
      this.error.setText(error);

      ViewCompat.animate(this.error)
          .alpha(1f)
          .setDuration(200)
          .setInterpolator(ScopeStealing.INTERPOLATOR)
          .start();
    } else {
      if (isErrorEnabled()) {
        ViewCompat.animate(this.error)
            .alpha(1f)
            .setDuration(200)
            .setInterpolator(ScopeStealing.INTERPOLATOR)
            .setListener(
                new ViewPropertyAnimatorListenerAdapter() {
                  @Override
                  public void onAnimationEnd(View view) {
                    setErrorEnabled(false);
                  }
                })
            .start();
      }
    }
  }
 private void animateMoveImpl(RecyclerView.ViewHolder paramViewHolder, int paramInt1, int paramInt2, int paramInt3, int paramInt4)
 {
   Object localObject = itemView;
   paramInt1 = paramInt3 - paramInt1;
   paramInt2 = paramInt4 - paramInt2;
   if (paramInt1 != 0) {
     ViewCompat.animate((View)localObject).translationX(0.0F);
   }
   if (paramInt2 != 0) {
     ViewCompat.animate((View)localObject).translationY(0.0F);
   }
   localObject = ViewCompat.animate((View)localObject);
   mMoveAnimations.add(paramViewHolder);
   ((ViewPropertyAnimatorCompat)localObject).setDuration(getMoveDuration()).setListener(new DefaultItemAnimator.6(this, paramViewHolder, paramInt1, paramInt2, (ViewPropertyAnimatorCompat)localObject)).start();
 }
  @Override
  public void onDismissed(Snackbar snackbar, int event) {
    if (!mOnDismissedCalled) {
      // onDismissed is called multiple times
      mOnDismissedCalled = true;

      // !NOTE: here to secure bug with FABBehaviour where for some unknown reason fab wasn't
      // translated to original pos
      ViewCompat.animate(mMainActivity.getFabMenu()).translationY(0);

      if (!mUndoOnClickListener.undoTriggered()) {
        // undo not triggered ready to delete
        if (MyApplication.getWritableDatabase().deleteNote(mNote)) {
          // note deleted successfully
          BaseController baseController = BaseController.getInstance();
          if (baseController.getControllerId() != Constants.CONTROLLER_BIN) {
            // item is still current controller, remove it
            new RemoveItemFromMainTask(
                    MyApplication.getAppContext().getString(R.string.note_moved_to_bin))
                .execute(mNote);

          } else {
            // if in bin controller add newly deleted note
            // !NOTE: delete mode is already set in db#deleteNote()
            baseController.onNewNoteAdded(mNote.getMode());
          }
        } else {
          // failed to delete note, revert it back
          MyDebugger.log("Failed to send note to recycler bin!");
          mMainActivity.mMainAdapter.addItem(mPosition, mNote);
        }
      }
    }
  }
Ejemplo n.º 6
0
  private void animateAddImpl(final ViewHolder holder) {
    final View view = holder.itemView;
    mAddAnimations.add(holder);
    final ViewPropertyAnimatorCompat animation = ViewCompat.animate(view);
    animation
        .alpha(1)
        .setDuration(getAddDuration())
        .setListener(
            new VpaListenerAdapter() {
              @Override
              public void onAnimationStart(View view) {
                dispatchAddStarting(holder);
              }

              @Override
              public void onAnimationCancel(View view) {
                ViewCompat.setAlpha(view, 1);
              }

              @Override
              public void onAnimationEnd(View view) {
                animation.setListener(null);
                dispatchAddFinished(holder);
                mAddAnimations.remove(holder);
                dispatchFinishedWhenDone();
              }
            })
        .start();
  }
 private void animFab(final float deltaY) {
   ViewCompat.animate(floatingActionButton)
       .translationYBy(deltaY)
       .setInterpolator(AnimUtils.FAST_OUT_SLOW_IN_INTERPOLATOR)
       .withLayer()
       .start();
 }
  private void animateOut(final BottomNavigationView bottomNavigationView) {
    ViewCompat.animate(bottomNavigationView)
        .translationY(bottomNavigationView.getHeight())
        .setInterpolator(INTERPOLATOR)
        .withLayer()
        .setUpdateListener(
            new ViewPropertyAnimatorUpdateListener() {
              @Override
              public void onAnimationUpdate(final View view) {
                updateSnackBarMargin(view);
              }
            })
        .setListener(
            new ViewPropertyAnimatorListener() {
              public void onAnimationStart(View view) {
                BottomNavigationBehavior.this.mIsAnimatingOut = true;
              }

              public void onAnimationCancel(View view) {
                BottomNavigationBehavior.this.mIsAnimatingOut = false;
              }

              public void onAnimationEnd(View view) {
                BottomNavigationBehavior.this.mIsAnimatingOut = false;
              }
            })
        .start();
  }
Ejemplo n.º 9
0
  // if sdk < 14, just ignore because of min sdk is 14
  private void animateOut(final FloatingActionButton button) {
    if (Build.VERSION.SDK_INT >= 14) {
      int translationY = button.getHeight() + getMarginBottom(button);
      ViewCompat.animate(button)
          .scaleX(0.0F)
          .scaleY(0.0F)
          .alpha(0.0F)
          .translationY(translationY)
          .setInterpolator(INTERPOLATOR)
          .withLayer()
          .setListener(
              new ViewPropertyAnimatorListener() {
                public void onAnimationStart(View view) {
                  BetterFabBehavior.this.mIsAnimatingOut = true;
                }

                public void onAnimationCancel(View view) {
                  BetterFabBehavior.this.mIsAnimatingOut = false;
                }

                public void onAnimationEnd(View view) {
                  BetterFabBehavior.this.mIsAnimatingOut = false;
                  view.setVisibility(View.GONE);
                }
              })
          .start();
    }
  }
 @Override
 protected ViewPropertyAnimatorCompat animateAddImpl(ViewHolder holder) {
   return ViewCompat.animate(holder.itemView)
       .rotationY(0)
       .translationX(0)
       .setInterpolator(new BounceInterpolator());
 }
Ejemplo n.º 11
0
  protected void animateAddImpl(final RecyclerView.ViewHolder holder) {
    View view = holder.itemView;
    final ViewPropertyAnimatorCompat animation = ViewCompat.animate(view);
    this.mAddAnimations.add(holder);
    animation
        .alpha(1.0F)
        .setDuration(this.getAddDuration())
        .setListener(
            new VpaListenerAdapter() {
              public void onAnimationStart(View view) {
                dispatchAddStarting(holder);
              }

              public void onAnimationCancel(View view) {
                ViewCompat.setAlpha(view, 1.0F);
              }

              public void onAnimationEnd(View view) {
                animation.setListener((ViewPropertyAnimatorListener) null);
                dispatchAddFinished(holder);
                mAddAnimations.remove(holder);
                dispatchFinishedWhenDone();
              }
            })
        .start();
  }
Ejemplo n.º 12
0
 @Override
 protected void animateAddImpl(final RecyclerView.ViewHolder holder) {
   ViewCompat.animate(holder.itemView)
       .alpha(1)
       .setDuration(getAddDuration())
       .setListener(new DefaultAddVpaListener(holder))
       .start();
 }
Ejemplo n.º 13
0
  private void animateMoveImpl(final ViewHolder holder, int fromX, int fromY, int toX, int toY) {
    final View view = holder.itemView;
    final int deltaX = toX - fromX;
    final int deltaY = toY - fromY;
    if (deltaX != 0) {
      ViewCompat.animate(view).translationX(0);
    }
    if (deltaY != 0) {
      ViewCompat.animate(view).translationY(0);
    }
    // TODO: make EndActions end listeners instead, since end actions aren't
    // called when
    // vpas are canceled (and can't end them. why?)
    // need listener functionality in VPACompat for this. Ick.
    mMoveAnimations.add(holder);
    final ViewPropertyAnimatorCompat animation = ViewCompat.animate(view);
    animation
        .setDuration(getMoveDuration())
        .setListener(
            new VpaListenerAdapter() {
              @Override
              public void onAnimationStart(View view) {
                dispatchMoveStarting(holder);
              }

              @Override
              public void onAnimationCancel(View view) {
                if (deltaX != 0) {
                  ViewCompat.setTranslationX(view, 0);
                }
                if (deltaY != 0) {
                  ViewCompat.setTranslationY(view, 0);
                }
              }

              @Override
              public void onAnimationEnd(View view) {
                animation.setListener(null);
                dispatchMoveFinished(holder);
                mMoveAnimations.remove(holder);
                dispatchFinishedWhenDone();
              }
            })
        .start();
  }
 @Override
 protected void animateRemoveImpl(final RecyclerView.ViewHolder holder) {
   ViewCompat.animate(holder.itemView)
       .translationY(-holder.itemView.getHeight())
       .alpha(0)
       .setDuration(getRemoveDuration())
       .setListener(new DefaultRemoveVpaListener(holder))
       .start();
 }
 void cancelAll(List<RecyclerView.ViewHolder> paramList)
 {
   int i = paramList.size() - 1;
   while (i >= 0)
   {
     ViewCompat.animate(getitemView).cancel();
     i -= 1;
   }
 }
 @Override
 protected ViewPropertyAnimatorCompat animateRemoveImpl(ViewHolder holder) {
   return ViewCompat.animate(holder.itemView)
       .rotationY(90)
       .translationX(-(holder.itemView.getMeasuredWidth() / 4))
       .scaleX(0.5F)
       .scaleY(0.5F)
       .setInterpolator(new AccelerateInterpolator());
 }
 @Override
 public void animateAddImpl(ViewPropertyAnimatorListener listener) {
   ViewCompat.animate(itemView)
       .translationY(0)
       .alpha(1)
       .setDuration(500)
       .setListener(listener)
       .start();
 }
Ejemplo n.º 18
0
 @Override
 protected void animateRemoveImpl(final RecyclerView.ViewHolder holder) {
   ViewCompat.animate(holder.itemView)
       .rotationY(90)
       .setDuration(getRemoveDuration())
       .setInterpolator(mInterpolator)
       .setListener(new DefaultRemoveVpaListener(holder))
       .start();
 }
Ejemplo n.º 19
0
 @Override
 protected void animateRemoveImpl(final RecyclerView.ViewHolder holder) {
   ViewCompat.animate(holder.itemView)
       .scaleX(0)
       .scaleY(0)
       .setDuration(getRemoveDuration())
       .setListener(new DefaultRemoveVpaListener(holder))
       .start();
 }
 protected void animateRemoveImpl(final RecyclerView.ViewHolder holder) {
   final View view = holder.itemView;
   ViewCompat.animate(view).cancel();
   ViewCompat.animate(view)
       .setDuration(getRemoveDuration())
       .translationX(-mRecyclerView.getWidth())
       .setListener(
           new VpaListenerAdapter() {
             @Override
             public void onAnimationEnd(View view) {
               ViewCompat.setTranslationX(view, -mRecyclerView.getWidth());
               dispatchRemoveFinished(holder);
               mRemoveAnimations.remove(holder);
               dispatchFinishedWhenDone();
             }
           })
       .start();
   mRemoveAnimations.add(holder);
 }
 private void _showTapCount(int size) {
   _tapEventCountShow.setText(String.valueOf(size));
   _tapEventCountShow.setVisibility(View.VISIBLE);
   _tapEventCountShow.setScaleX(1f);
   _tapEventCountShow.setScaleY(1f);
   ViewCompat.animate(_tapEventCountShow)
       .scaleXBy(-1f)
       .scaleYBy(-1f)
       .setDuration(800)
       .setStartDelay(100);
 }
Ejemplo n.º 22
0
 protected void completeloading() {
   ViewCompat.animate(betterCircleBar)
       .alpha(0f)
       .withEndAction(
           new Runnable() {
             @Override
             public void run() {
               betterCircleBar.setVisibility(View.GONE);
             }
           });
 }
Ejemplo n.º 23
0
 @Override
 protected void animateAddImpl(final RecyclerView.ViewHolder holder) {
   ViewCompat.animate(holder.itemView)
       .scaleX(1)
       .scaleY(1)
       .setDuration(getAddDuration())
       .setInterpolator(mInterpolator)
       .setListener(new DefaultAddVpaListener(holder))
       .setStartDelay(getAddDelay(holder))
       .start();
 }
 private void hiddenTitlebar() {
   ViewCompat.animate(mTitleRl)
       .translationY(-mTitleRl.getHeight())
       .setInterpolator(new DecelerateInterpolator(2))
       .setListener(
           new ViewPropertyAnimatorListenerAdapter() {
             @Override
             public void onAnimationEnd(View view) {
               mIsHidden = true;
             }
           })
       .start();
 }
Ejemplo n.º 25
0
 // if sdk < 14, just ignore because of min sdk is 14
 private void animateIn(FloatingActionButton button) {
   button.setVisibility(View.VISIBLE);
   if (Build.VERSION.SDK_INT >= 14) {
     ViewCompat.animate(button)
         .scaleX(1.0F)
         .scaleY(1.0F)
         .alpha(1.0F)
         .translationY(0)
         .setInterpolator(INTERPOLATOR)
         .withLayer()
         .setListener(null)
         .start();
   }
 }
Ejemplo n.º 26
0
  private void animateAddImpl(final ViewHolder holder) {
    final View view = holder.itemView;
    final ViewPropertyAnimatorCompat animation = ViewCompat.animate(view);
    mAddAnimations.add(holder);
    float startX, startY;

    int position = (int) view.getTag();

    if (position % 2 == 0) {
      startY = -100;
      startX = -width;
    } else {
      startY = 100;
      startX = width;
    }
    Log.d("test", String.valueOf(holder.getLayoutPosition()));
    ViewCompat.setTranslationX(view, startX);
    // 应该是相对偏移
    ViewCompat.setTranslationY(view, startY);
    ViewCompat.setAlpha(view, 0);
    animation.setInterpolator(new OvershootInterpolator());
    animation
        .alpha(1)
        .translationX(0)
        .translationY(0)
        .setDuration(getAddDuration())
        .setListener(
            new VpaListenerAdapter() {
              @Override
              public void onAnimationStart(View view) {
                dispatchAddStarting(holder);
              }

              @Override
              public void onAnimationCancel(View view) {
                ViewCompat.setAlpha(view, 1);
              }

              @Override
              public void onAnimationEnd(View view) {
                animation.setListener(null);
                dispatchAddFinished(holder);
                mAddAnimations.remove(holder);
                dispatchFinishedWhenDone();
                // 使用这个来复原
                ViewCompat.setTranslationY(view, 0);
              }
            })
        .start();
  }
  private static void slideInternal(
      final RecyclerView.ViewHolder holder,
      boolean horizontal,
      int translationX,
      int translationY) {
    if (!(holder instanceof SwipeableItemViewHolder)) {
      return;
    }

    final View containerView = ((SwipeableItemViewHolder) holder).getSwipeableContainerView();
    ViewCompat.animate(containerView).cancel();
    ViewCompat.setTranslationX(containerView, translationX);
    ViewCompat.setTranslationY(containerView, translationY);
  }
 private void animateIn(BottomNavigationView bottomNavigationView) {
   ViewCompat.animate(bottomNavigationView)
       .translationY(0)
       .setInterpolator(INTERPOLATOR)
       .withLayer()
       .setUpdateListener(
           new ViewPropertyAnimatorUpdateListener() {
             @Override
             public void onAnimationUpdate(final View view) {
               updateSnackBarMargin(view);
             }
           })
       .setListener(null)
       .start();
 }
  protected void animateAddImpl(final RecyclerView.ViewHolder holder) {
    final View view = holder.itemView;

    ViewCompat.animate(view).cancel();
    ViewCompat.animate(view)
        .translationX(0)
        .setDuration(getAddDuration())
        .setListener(
            new VpaListenerAdapter() {
              @Override
              public void onAnimationCancel(View view) {
                ViewCompat.setTranslationX(view, 0);
              }

              @Override
              public void onAnimationEnd(View view) {
                dispatchAddFinished(holder);
                mAddAnimations.remove(holder);
                dispatchFinishedWhenDone();
              }
            })
        .start();
    mAddAnimations.add(holder);
  }
Ejemplo n.º 30
0
 @Override
 public void exit() {
   ViewCompat.animate(rootView)
       .translationY(DensityUtil.getScreenHeight(SearchActivity.this))
       .setDuration(Constants.MILLISECONDS_400)
       .setInterpolator(new LinearInterpolator())
       .withLayer()
       .setListener(
           new ViewPropertyAnimatorListenerAdapter() {
             @Override
             public void onAnimationEnd(View view) {
               SearchActivity.this.finish();
             }
           });
 }