コード例 #1
1
  public void hideMenu(View view) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      final int cx = (settingsMenuButton.getLeft() + settingsMenuButton.getRight()) / 2;
      final int cy =
          ((settingsMenuButton.getTop() + settingsMenuButton.getBottom()) / 2)
              - settingsMenu.getTop();

      Log.i("", "Circle center " + cx + ", " + cy + " width " + bottomView.getWidth());

      final Animator anim =
          ViewAnimationUtils.createCircularReveal(settingsMenu, cx, cy, bottomView.getWidth(), 0);

      anim.addListener(
          new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
              super.onAnimationEnd(animation);
              settingsMenu.setVisibility(View.INVISIBLE);
              settingsMenuButton.setVisibility(View.VISIBLE);
            }
          });

      anim.start();
    } else {
      settingsMenuButton.setVisibility(View.VISIBLE);
      settingsMenu.setVisibility(View.INVISIBLE);
    }
  }
コード例 #2
1
  private Animator createHideItemAnimator(final View item) {
    final float dx = centerItem.getX() - item.getX();
    final float dy = centerItem.getY() - item.getY();

    Animator anim =
        ObjectAnimator.ofPropertyValuesHolder(
            item,
            AnimatorUtils.scaleX(1f, 0f),
            AnimatorUtils.scaleY(1f, 0f),
            AnimatorUtils.translationX(0f, dx),
            AnimatorUtils.translationY(0f, dy));

    anim.setInterpolator(new DecelerateInterpolator());
    anim.addListener(
        new AnimatorListenerAdapter() {
          @Override
          public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            item.setTranslationX(0f);
            item.setTranslationY(0f);
          }
        });
    anim.setDuration(50);
    return anim;
  }
コード例 #3
0
  private void hideMenu(int cx, int cy, float startRadius, float endRadius) {
    List<Animator> animList = new ArrayList<>();

    for (int i = arcLayout.getChildCount() - 1; i >= 0; i--) {
      animList.add(createHideItemAnimator(arcLayout.getChildAt(i)));
    }

    animList.add(createHideItemAnimator(centerItem));

    Animator revealAnim = createCircularReveal(menuLayout, cx, cy, startRadius, endRadius);
    revealAnim.setInterpolator(new AccelerateDecelerateInterpolator());
    revealAnim.setDuration(200);
    revealAnim.addListener(
        new AnimatorListenerAdapter() {
          @Override
          public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            menuLayout.setVisibility(View.INVISIBLE);
          }
        });

    animList.add(revealAnim);

    AnimatorSet animSet = new AnimatorSet();
    animSet.playSequentially(animList);
    animSet.start();
  }
コード例 #4
0
ファイル: DisplayActivity.java プロジェクト: BoD/bikey
 @Override
 public void onActivated(Uri rideUri) {
   if (!rideUri.equals(mRideUri)) return;
   mChkRecord.setChecked(true, false);
   mChkRecordText.setText(R.string.display_chkRecord_active);
   if (!mChkRecordTextAnimator.isStarted()) mChkRecordTextAnimator.start();
 }
コード例 #5
0
 /**
  * make animation to start or end when target view was be Visible or Gone or Invisible. make
  * animation to cancel when target view be onDetachedFromWindow.
  *
  * @param animStatus
  */
 public void setAnimationStatus(AnimStatus animStatus) {
   if (mAnimators == null) {
     return;
   }
   int count = mAnimators.size();
   for (int i = 0; i < count; i++) {
     Animator animator = mAnimators.get(i);
     boolean isRunning = animator.isRunning();
     switch (animStatus) {
       case START:
         if (!isRunning) {
           animator.start();
         }
         break;
       case END:
         if (isRunning) {
           animator.end();
         }
         break;
       case CANCEL:
         if (isRunning) {
           animator.cancel();
         }
         break;
     }
   }
 }
コード例 #6
0
 @Override
 public void onAnimationEnd(Animator animation) {
   synchronized (this) {
     if (mAnimator != animation) {
       animation.removeAllListeners();
       animation.cancel();
       return;
     }
     if (mFadingIn) {
       if (mTodayAnimator != null) {
         mTodayAnimator.removeAllListeners();
         mTodayAnimator.cancel();
       }
       mTodayAnimator =
           ObjectAnimator.ofInt(MonthWeekEventsView.this, "animateTodayAlpha", 255, 0);
       mAnimator = mTodayAnimator;
       mFadingIn = false;
       mTodayAnimator.addListener(this);
       mTodayAnimator.setDuration(600);
       mTodayAnimator.start();
     } else {
       mAnimateToday = false;
       mAnimateTodayAlpha = 0;
       mAnimator.removeAllListeners();
       mAnimator = null;
       mTodayAnimator = null;
       invalidate();
     }
   }
 }
コード例 #7
0
  private void hide(final View myView) {
    // get the center for the clipping circle
    int cx = myView.getWidth() / 2;
    int cy = myView.getHeight() / 2;

    // get the initial radius for the clipping circle
    int initialRadius = myView.getWidth();

    // create the animation (the final radius is zero)
    Animator anim = null;
    if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP) {
      anim = ViewAnimationUtils.createCircularReveal(myView, cx, cy, initialRadius, 0);
    }

    // make the view invisible when the animation is done
    anim.addListener(
        new AnimatorListenerAdapter() {
          @Override
          public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            myView.setVisibility(View.INVISIBLE);
          }
        });

    // start the animation
    if (anim != null) {
      anim.start();
    }
  }
コード例 #8
0
  private Animator createCircularReveal(
      final ClipRevealFrame view, int x, int y, float startRadius, float endRadius) {
    final Animator reveal;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      reveal = ViewAnimationUtils.createCircularReveal(view, x, y, startRadius, endRadius);
    } else {
      view.setClipOutLines(true);
      view.setClipCenter(x, y);
      reveal = ObjectAnimator.ofFloat(view, "ClipRadius", startRadius, endRadius);
      reveal.addListener(
          new Animator.AnimatorListener() {
            @Override
            public void onAnimationStart(Animator animation) {}

            @Override
            public void onAnimationEnd(Animator animation) {
              view.setClipOutLines(false);
            }

            @Override
            public void onAnimationCancel(Animator animation) {}

            @Override
            public void onAnimationRepeat(Animator animation) {}
          });
    }
    return reveal;
  }
コード例 #9
0
 public AnimatedVectorDrawableState(AnimatedVectorDrawableState copy) {
   if (copy != null) {
     mChangingConfigurations = copy.mChangingConfigurations;
     if (copy.mVectorDrawable != null) {
       mVectorDrawable = (VectorDrawable) copy.mVectorDrawable.getConstantState().newDrawable();
       mVectorDrawable.mutate();
       mVectorDrawable.setAllowCaching(false);
       mVectorDrawable.setBounds(copy.mVectorDrawable.getBounds());
     }
     if (copy.mAnimators != null) {
       final int numAnimators = copy.mAnimators.size();
       mAnimators = new ArrayList<Animator>(numAnimators);
       mTargetNameMap = new ArrayMap<Animator, String>(numAnimators);
       for (int i = 0; i < numAnimators; ++i) {
         Animator anim = copy.mAnimators.get(i);
         Animator animClone = anim.clone();
         String targetName = copy.mTargetNameMap.get(anim);
         Object targetObject = mVectorDrawable.getTargetByName(targetName);
         animClone.setTarget(targetObject);
         mAnimators.add(animClone);
         mTargetNameMap.put(animClone, targetName);
       }
     }
   } else {
     mVectorDrawable = new VectorDrawable();
   }
 }
コード例 #10
0
  private void animateDismiss(final Runnable doAfter) {
    // the animation can only work (and is only worth doing) if this fragment is added
    // reasons it may not be added: fragment is being destroyed, or in the process of being
    // restored
    if (!mFragment.isAdded()) {
      mBackgroundView.setVisibility(View.GONE);
      return;
    }

    UtilsEx.enableHardwareLayer(mBackgroundView);
    final Animator animator =
        AnimatorInflater.loadAnimator(
            mFragment.getActivity().getApplicationContext(), R.anim.fade_out);
    animator.setTarget(mBackgroundView);
    animator.addListener(
        new AnimatorListenerAdapter() {
          @Override
          public void onAnimationEnd(Animator animation) {
            mBackgroundView.setVisibility(View.GONE);
            mBackgroundView.setLayerType(View.LAYER_TYPE_NONE, null);
            if (doAfter != null) {
              doAfter.run();
            }
          }
        });
    animator.start();
  }
コード例 #11
0
  public void swapPanels() {
    final View toShow, toHide;
    if (mSettingsView == null) {
      addSettingsView();
      toShow = mSettingsView;
      toHide = mNotificationScroller;
    } else {
      toShow = mNotificationScroller;
      toHide = mSettingsView;
    }
    Animator a = ObjectAnimator.ofFloat(toHide, "alpha", 1f, 0f).setDuration(PANEL_FADE_DURATION);
    a.addListener(
        new AnimatorListenerAdapter() {
          @Override
          public void onAnimationEnd(Animator _a) {
            toHide.setVisibility(View.GONE);
            if (toShow != null) {
              toShow.setVisibility(View.VISIBLE);
              if (toShow == mSettingsView || mNotificationCount > 0) {
                ObjectAnimator.ofFloat(toShow, "alpha", 0f, 1f)
                    .setDuration(PANEL_FADE_DURATION)
                    .start();
              }

              if (toHide == mSettingsView) {
                removeSettingsView();
              }
            }
            updateClearButton();
            updatePanelModeButtons();
          }
        });
    a.start();
  }
コード例 #12
0
  public void propertyValuesHolder(View view) {
    Log.i("tag", "动画已经被执行");
    PropertyValuesHolder pvhX = PropertyValuesHolder.ofFloat("alpha", 1f, 1f);
    PropertyValuesHolder pvhY = PropertyValuesHolder.ofFloat("scaleX", 1f, 1f);
    PropertyValuesHolder pvhZ = PropertyValuesHolder.ofFloat("scaleY", 1f, 1f);
    Animator objectAnimator =
        ObjectAnimator.ofPropertyValuesHolder(view, pvhX, pvhY, pvhZ).setDuration(2000);
    objectAnimator.start();
    objectAnimator.addListener(
        new Animator.AnimatorListener() {
          @Override
          public void onAnimationStart(Animator animation) {}

          @Override
          public void onAnimationEnd(Animator animation) {
            if (mFirst) {
              turn2Activity(New_login.this, WelcomeActivity.class);
            } else {
              turn2Activity(New_login.this, NewMain.class);
              overridePendingTransition(R.anim.push_center_in, R.anim.push_center_out);
            }
            finish();
          }

          @Override
          public void onAnimationCancel(Animator animation) {}

          @Override
          public void onAnimationRepeat(Animator animation) {}
        });
  }
コード例 #13
0
ファイル: MainActivity.java プロジェクト: tolga-k/FlipIt
  // Layout showing effect(using CircularReveal)
  private void showLayout(int viewId, int viewId2) {
    final View myView = findViewById(viewId);
    View myView2 = findViewById(viewId2);

    if (android.os.Build.VERSION.SDK_INT > 20) {

      int finalRadius = Math.max(myView.getWidth(), myView.getHeight());

      int cx = (myView2.getLeft() + myView2.getRight()) / 2;
      int cy = (myView2.getTop() + myView2.getBottom()) / 2;

      Animator anim = ViewAnimationUtils.createCircularReveal(myView, cx, cy, 0, finalRadius);
      anim.setDuration(500);

      anim.addListener(
          new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
              super.onAnimationEnd(animation);
              if (gameStatus == GAME_GOGAME) {
                gameStatus = GAME_WAITING;
              }
            }
          });

      myView.setVisibility(View.VISIBLE);
      myView.setAlpha(1);
      anim.start();
    } else {
      myView.setVisibility(View.VISIBLE);
      if (gameStatus == GAME_GOGAME) {
        gameStatus = GAME_WAITING;
      }
    }
  }
コード例 #14
0
  @Override
  public Animator onCreateAnimator(int transit, boolean enter, int nextAnim) {
    final MainActivity mainActivity = (MainActivity) getActivity();
    Animator anim = null;
    if (showTransitionAnim) {
      if (nextAnim != 0) anim = AnimatorInflater.loadAnimator(getActivity(), nextAnim);
      showTransitionAnim = false;
      if (anim != null)
        anim.addListener(
            new Animator.AnimatorListener() {
              @Override
              public void onAnimationEnd(Animator animator) {
                if (mainActivity.drawer instanceof DrawerLayout)
                  ((DrawerLayout) mainActivity.drawer).closeDrawer(mainActivity.drawerView);
                mainActivity.setDrawerListener(true);
              }

              @Override
              public void onAnimationCancel(Animator animator) {}

              @Override
              public void onAnimationStart(Animator animator) {
                mainActivity.setDrawerListener(false);
              }

              @Override
              public void onAnimationRepeat(Animator animator) {}
            });
    } else anim = AnimatorInflater.loadAnimator(getActivity(), R.animator.none);
    return anim;
  }
コード例 #15
0
ファイル: BottomBar.java プロジェクト: zst123/p201-packages
 void hide() {
   Xlog.i(TAG, "bottom bar hide(), showing: " + mShowing);
   if (mUseQuickControls || mUseFullScreen) {
     cancelBottomBarAnimation();
     int visibleHeight = getVisibleBottomHeight();
     float startPos = getTranslationY();
     this.setLayerType(View.LAYER_TYPE_HARDWARE, null);
     mBottomBarAnimator =
         ObjectAnimator.ofFloat(this, "translationY", startPos, startPos + visibleHeight);
     mBottomBarAnimator.addListener(mHideBottomBarAnimatorListener);
     setupBottomBarAnimator(mBottomBarAnimator);
     mBottomBarAnimator.start();
     this.setVisibility(View.GONE);
     mShowing = false;
     return;
   } else {
     this.setVisibility(View.VISIBLE);
     cancelBottomBarAnimation();
     int visibleHeight = getVisibleBottomHeight();
     float startPos = getTranslationY();
     Xlog.i(TAG, "hide(): visibleHeight: " + visibleHeight);
     Xlog.i(TAG, "hide(): startPos: " + startPos);
     this.setLayerType(View.LAYER_TYPE_HARDWARE, null);
     mBottomBarAnimator =
         ObjectAnimator.ofFloat(this, "translationY", startPos, startPos + visibleHeight);
     mBottomBarAnimator.addListener(mHideBottomBarAnimatorListener);
     setupBottomBarAnimator(mBottomBarAnimator);
     mBottomBarAnimator.start();
   }
   mShowing = false;
 }
コード例 #16
0
  @Override
  public void call(final Subscriber<? super Void> subscriber) {
    checkUiThread();
    AnimatorListenerAdapter adapter =
        new AnimatorListenerAdapter() {
          @Override
          public void onAnimationStart(Animator animation) {
            super.onAnimationStart(animation);
            subscriber.onNext(null);
            Logger.d("onAnimationStart");
          }

          @Override
          public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            subscriber.onCompleted();
            Logger.d("onAnimationEnd");
          }
        };

    animator.addListener(adapter);
    animator.start(); // 先绑定监听器再开始
    //        subscriber.add(new MainThreadSubscription() {
    //            @Override protected void onUnsubscribe() {
    //               animator.removeAllListeners();
    //            }
    //        });
  }
コード例 #17
0
  /**
   * Utility function, called by animateProperty() and animatePropertyBy(), which handles the
   * details of adding a pending animation and posting the request to start the animation.
   *
   * @param constantName The specifier for the property being animated
   * @param startValue The starting value of the property
   * @param byValue The amount by which the property will change
   */
  private void animatePropertyBy(int constantName, float startValue, float byValue) {
    // First, cancel any existing animations on this property
    if (mAnimatorMap.size() > 0) {
      Animator animatorToCancel = null;
      Set<Animator> animatorSet = mAnimatorMap.keySet();
      for (Animator runningAnim : animatorSet) {
        PropertyBundle bundle = mAnimatorMap.get(runningAnim);
        if (bundle.cancel(constantName)) {
          // property was canceled - cancel the animation if it's now empty
          // Note that it's safe to break out here because every new animation
          // on a property will cancel a previous animation on that property, so
          // there can only ever be one such animation running.
          if (bundle.mPropertyMask == NONE) {
            // the animation is no longer changing anything - cancel it
            animatorToCancel = runningAnim;
            break;
          }
        }
      }
      if (animatorToCancel != null) {
        animatorToCancel.cancel();
      }
    }

    NameValuesHolder nameValuePair = new NameValuesHolder(constantName, startValue, byValue);
    mPendingAnimations.add(nameValuePair);
    mView.removeCallbacks(mAnimationStarter);
    mView.postOnAnimation(mAnimationStarter);
  }
コード例 #18
0
ファイル: DisplayActivity.java プロジェクト: BoD/bikey
 @Override
 public void onPaused(Uri rideUri) {
   if (!rideUri.equals(mRideUri)) return;
   mChkRecord.setChecked(false, false);
   mChkRecordText.setText(R.string.display_chkRecord_paused);
   if (mChkRecordTextAnimator.isStarted()) mChkRecordTextAnimator.cancel();
   mChkRecordText.setAlpha(1f);
 }
コード例 #19
0
ファイル: RideAdapter.java プロジェクト: BoD/bikey
  @Override
  public void bindView(View view, Context context, Cursor cursor) {
    RideCursor c = (RideCursor) cursor;

    // Title (name / date)
    TextView txtTitle = ViewHolder.get(view, R.id.txtTitle);
    String name = c.getName();
    long createdDateLong = c.getCreatedDate().getTime();
    String createdDateTimeStr =
        DateUtils.formatDateTime(
            context, createdDateLong, DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_TIME);
    if (name == null) {
      txtTitle.setText(createdDateTimeStr);
    } else {
      txtTitle.setText(name + "\n" + createdDateTimeStr);
    }

    // Summary
    TextView txtSummary = ViewHolder.get(view, R.id.txtSummary);
    CharSequence details = null;
    Animator animator = (Animator) view.getTag(R.id.animator);
    // Cancel the animation / reset the alpha in any case
    if (animator != null) animator.cancel();
    txtSummary.setAlpha(1);
    RideState rideState = c.getState();
    switch (rideState) {
      case CREATED:
        details = context.getString(R.string.ride_list_notStarted);
        txtSummary.setTextColor(mColorDefault);
        txtSummary.setEnabled(false);
        break;

      case ACTIVE:
        details = context.getString(R.string.ride_list_active);
        if (animator == null) {
          animator = AnimatorInflater.loadAnimator(context, R.animator.blink);
          animator.setTarget(txtSummary);
          view.setTag(R.id.animator, animator);
        }
        animator.start();
        txtSummary.setTextColor(mColorActive);
        txtSummary.setEnabled(true);
        break;

      case PAUSED:
        // Distance
        float distance = c.getDistance();
        details = TextUtils.concat(UnitUtil.formatDistance(distance, true, .85f, false), "  -  ");

        // Duration
        long duration = c.getDuration();
        details = TextUtils.concat(details, DateTimeUtil.formatDuration(context, duration));
        txtSummary.setTextColor(mColorDefault);
        txtSummary.setEnabled(true);
        break;
    }
    txtSummary.setText(details);
  }
コード例 #20
0
 @Override
 public void stop() {
   final ArrayList<Animator> animators = mAnimatedVectorState.mAnimators;
   final int size = animators.size();
   for (int i = 0; i < size; i++) {
     final Animator animator = animators.get(i);
     animator.end();
   }
 }
コード例 #21
0
 public static void onDestroyActivity() {
   HashSet<Animator> animators = new HashSet<Animator>(sAnimators.keySet());
   for (Animator a : animators) {
     if (a.isRunning()) {
       a.cancel();
     }
     sAnimators.remove(a);
   }
 }
コード例 #22
0
 private void showMessage(int duration) {
   if (duration > 0) {
     Animator anim = ObjectAnimator.ofFloat(this, "alpha", 1f);
     anim.setDuration(duration);
     anim.start();
   } else {
     setAlpha(1f);
   }
 }
コード例 #23
0
 @Override
 public Animator onCreateAnimator(int transit, boolean enter, int nextAnim) {
   if (FragmentUtils.disableAnimations) {
     Animator a = AnimatorInflater.loadAnimator(fa, nextAnim);
     a.setDuration(0);
     return a;
   } else {
     return super.onCreateAnimator(transit, enter, nextAnim);
   }
 }
コード例 #24
0
 public void animateCircularClip(int x, int y, boolean in, AnimatorListener listener) {
   if (mAnimator != null) {
     mAnimator.cancel();
   }
   final int w = mDetail.getWidth() - x;
   final int h = mDetail.getHeight() - y;
   int innerR = 0;
   if (x < 0 || w < 0 || y < 0 || h < 0) {
     innerR = Math.abs(x);
     innerR = Math.min(innerR, Math.abs(y));
     innerR = Math.min(innerR, Math.abs(w));
     innerR = Math.min(innerR, Math.abs(h));
   }
   int r = (int) Math.ceil(Math.sqrt(x * x + y * y));
   r = (int) Math.max(r, Math.ceil(Math.sqrt(w * w + y * y)));
   r = (int) Math.max(r, Math.ceil(Math.sqrt(w * w + h * h)));
   r = (int) Math.max(r, Math.ceil(Math.sqrt(x * x + h * h)));
   if (in) {
     mAnimator = ViewAnimationUtils.createCircularReveal(mDetail, x, y, innerR, r);
   } else {
     mAnimator = ViewAnimationUtils.createCircularReveal(mDetail, x, y, r, innerR);
   }
   mAnimator.setDuration((long) (mAnimator.getDuration() * 1.5));
   if (listener != null) {
     mAnimator.addListener(listener);
   }
   if (in) {
     mBackground.startTransition((int) (mAnimator.getDuration() * 0.6));
     mAnimator.addListener(mVisibleOnStart);
   } else {
     mDetail.postDelayed(mReverseBackground, (long) (mAnimator.getDuration() * 0.65));
     mAnimator.addListener(mGoneOnEnd);
   }
   mAnimator.start();
 }
コード例 #25
0
ファイル: ItemSlideHelper.java プロジェクト: yjwfn/SlideItem
  /**
   * 根据当前scrollX的位置判断是展开还是折叠
   *
   * @param velocityX 如果不等于0那么这是一次fling事件,否则是一次ACTION_UP或者ACTION_CANCEL
   */
  private boolean smoothHorizontalExpandOrCollapse(float velocityX) {

    int scrollX = mTargetView.getScrollX();
    int scrollRange = getHorizontalRange();

    if (mExpandAndCollapseAnim != null) return false;

    int to = 0;
    int duration = DEFAULT_DURATION;

    if (velocityX == 0) {
      // 如果已经展一半,平滑展开
      if (scrollX > scrollRange / 2) {
        to = scrollRange;
      }
    } else {

      if (velocityX > 0) to = 0;
      else to = scrollRange;

      duration = (int) ((1.f - Math.abs(velocityX) / mMaxVelocity) * DEFAULT_DURATION);
    }

    if (to == scrollX) return false;

    mExpandAndCollapseAnim = ObjectAnimator.ofInt(mTargetView, "scrollX", to);
    mExpandAndCollapseAnim.setDuration(duration);
    mExpandAndCollapseAnim.addListener(
        new Animator.AnimatorListener() {
          @Override
          public void onAnimationStart(Animator animation) {}

          @Override
          public void onAnimationEnd(Animator animation) {
            mExpandAndCollapseAnim = null;
            if (isCollapsed()) mTargetView = null;

            Log.d(TAG, "onAnimationEnd");
          }

          @Override
          public void onAnimationCancel(Animator animation) {
            // onAnimationEnd(animation);
            mExpandAndCollapseAnim = null;

            Log.d(TAG, "onAnimationCancel");
          }

          @Override
          public void onAnimationRepeat(Animator animation) {}
        });
    mExpandAndCollapseAnim.start();

    return true;
  }
コード例 #26
0
 protected void play(Animator animator) {
   mCurrentAnimator = animator;
   animator.addListener(
       new AnimationFinishedListener() {
         @Override
         public void onAnimationFinished() {
           mCurrentAnimator = null;
         }
       });
   animator.start();
 }
コード例 #27
0
  // testing animation class
  private void animateRevealShow(View viewRoot) {
    int cx = (viewRoot.getLeft() + viewRoot.getRight()) / 2;
    int cy = (viewRoot.getTop() + viewRoot.getBottom()) / 2;
    int finalRadius = Math.max(viewRoot.getWidth(), viewRoot.getHeight());

    Animator anim = ViewAnimationUtils.createCircularReveal(viewRoot, cx, cy, 0, finalRadius);
    viewRoot.setVisibility(View.VISIBLE);
    anim.setDuration(1000);
    anim.setInterpolator(new AccelerateInterpolator());
    anim.start();
  }
コード例 #28
0
 private boolean isStarted() {
   final ArrayList<Animator> animators = mAnimatedVectorState.mAnimators;
   final int size = animators.size();
   for (int i = 0; i < size; i++) {
     final Animator animator = animators.get(i);
     if (animator.isStarted()) {
       return true;
     }
   }
   return false;
 }
コード例 #29
0
  /** Redraws default text with circle animation. */
  private void reDrawDefaultLayout() {
    int cx = mDefaultText.getMeasuredWidth() / 2;
    int cy = mDefaultText.getMeasuredHeight() / 2;

    int finalRadius = Math.max(mDefaultText.getWidth(), mDefaultText.getHeight()) / 2;

    Animator anim = ViewAnimationUtils.createCircularReveal(mDefaultText, cx, cy, 0, finalRadius);

    mDefaultText.setVisibility(View.VISIBLE);
    anim.start();
  }
コード例 #30
0
 @Override
 public void start() {
   final ArrayList<Animator> animators = mAnimatedVectorState.mAnimators;
   final int size = animators.size();
   for (int i = 0; i < size; i++) {
     final Animator animator = animators.get(i);
     if (!animator.isStarted()) {
       animator.start();
     }
   }
   invalidateSelf();
 }