Esempio n. 1
0
    private void swipeLeft() {
      if (currentPosition < accounts.size() - 1) {
        View currentView = getChildAt(currentPosition);
        Animation fadeInAnimation =
            AnimationUtils.loadAnimation(getContext(), R.anim.slide_left_out);
        currentView.startAnimation(fadeInAnimation);
        currentView.setVisibility(View.GONE);

        View nextView = getChildAt(++currentPosition);
        fadeInAnimation = AnimationUtils.loadAnimation(getContext(), R.anim.slide_left_in);
        nextView.startAnimation(fadeInAnimation);
        nextView.setVisibility(View.VISIBLE);
        fadeInAnimation.setAnimationListener(endAnimationLister);
      }
    }
Esempio n. 2
0
    private void swipeRight() {
      // Now Set your animation
      if (currentPosition > 0) {
        View currentView = getChildAt(currentPosition);
        Animation fadeInAnimation =
            AnimationUtils.loadAnimation(getContext(), R.anim.slide_right_out);
        currentView.startAnimation(fadeInAnimation);
        currentView.setVisibility(View.GONE);

        View nextView = getChildAt(--currentPosition);
        fadeInAnimation = AnimationUtils.loadAnimation(getContext(), R.anim.slide_right_in);
        nextView.startAnimation(fadeInAnimation);
        nextView.setVisibility(View.VISIBLE);
        fadeInAnimation.setAnimationListener(endAnimationLister);
      }
    }