Example #1
0
 static void fixSliding(int position) {
   try {
     Reddit.lastposition.add(position, 0);
   } catch (IndexOutOfBoundsException e) {
     fixSliding(position - 1);
   }
 }
Example #2
0
 static void fixSliding(int position) {
   try {
     System.out.println("Fixing..");
     Reddit.lastposition.add(position, 0);
   } catch (IndexOutOfBoundsException e) {
     fixSliding(position - 1);
   }
 }
Example #3
0
  @TargetApi(Build.VERSION_CODES.LOLLIPOP)
  public static void setAnimation(View viewToAnimate, int position) {
    try {
      if (position >= Reddit.lastposition.get(Reddit.currentPosition) - 1 && Reddit.animation) {
        int cx = viewToAnimate.getWidth() / 2;
        int cy = viewToAnimate.getHeight() / 2;
        int finalRadius = Math.max(viewToAnimate.getWidth(), viewToAnimate.getHeight());

        final Animator anim =
            ViewAnimationUtils.createCircularReveal(viewToAnimate, cx, cy, 0, finalRadius);
        anim.setDuration(Reddit.enter_animation_time);
        anim.setInterpolator(new FastOutSlowInInterpolator());
        viewToAnimate.setVisibility(View.VISIBLE);
        anim.start();
        Reddit.lastposition.set(
            Reddit.currentPosition, Reddit.lastposition.get(Reddit.currentPosition) + 1);
      }
    } catch (IndexOutOfBoundsException e) {
      fixSliding(Reddit.currentPosition);
    }
  }