android.view.ViewPropertyAnimator.withLayer()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(202)

本文整理了Java中android.view.ViewPropertyAnimator.withLayer()方法的一些代码示例,展示了ViewPropertyAnimator.withLayer()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ViewPropertyAnimator.withLayer()方法的具体详情如下:
包路径:android.view.ViewPropertyAnimator
类名称:ViewPropertyAnimator
方法名:withLayer

ViewPropertyAnimator.withLayer介绍

暂无

代码示例

代码示例来源:origin: pili-engineering/PLDroidShortVideo

public void focus() {
  if (mState == STATE_IDLE) {
    setBackgroundResource(R.drawable.ic_focus_focusing);
    animate().withLayer().setDuration(SCALING_UP_TIME)
        .scaleX(1.5f).scaleY(1.5f);
    mState = STATE_FOCUSING;
  }
}

代码示例来源:origin: pili-engineering/PLDroidShortVideo

public void focusFail() {
  if (mState == STATE_FOCUSING) {
    setBackgroundResource(R.drawable.ic_focus_failed);
    animate().withLayer().setDuration(SCALING_DOWN_TIME).scaleX(1f)
        .scaleY(1f).withEndAction(mEndAction);
    mState = STATE_FINISHING;
  }
}

代码示例来源:origin: pili-engineering/PLDroidShortVideo

public void focusSuccess() {
  if (mState == STATE_FOCUSING) {
    setBackgroundResource(R.drawable.ic_focus_focused);
    animate().withLayer().setDuration(SCALING_DOWN_TIME).scaleX(1f)
        .scaleY(1f).withEndAction(mEndAction);
    mState = STATE_FINISHING;
  }
}

代码示例来源:origin: kingargyle/adt-leanback-support

public static void withLayer(View view) {
  view.animate().withLayer();
}

代码示例来源:origin: SachinVin/citra_android

public static ViewPropertyAnimator fadeViewOut(View view)
 {
  return view.animate()
      .withLayer()
      .setDuration(300)
      .alpha(0.0f);
 }
}

代码示例来源:origin: ywwynm/EverythingDone

public void showActionbarShadow(float alpha) {
  mActionbarShadow.animate().alpha(alpha).withLayer();
}

代码示例来源:origin: SachinVin/citra_android

public static ViewPropertyAnimator fadeViewIn(View view)
{
 view.setVisibility(View.VISIBLE);
 return view.animate()
     .withLayer()
     .setDuration(100)
     .alpha(1.0f);
}

代码示例来源:origin: ywwynm/EverythingDone

public void hideActionbarShadow() {
  actionbarShadowAlpha = mActionbarShadow.getAlpha();
  mActionbarShadow.animate().alpha(0).withLayer().setDuration(160);
}

代码示例来源:origin: Doist/RecyclerViewExtensions

private void animateRemoveImpl(final ViewHolder holder) {
  final View view = holder.itemView;
  final ViewPropertyAnimator animation = view.animate().withLayer();
  mRemoveAnimations.add(holder);
  animation.setDuration(getRemoveDuration()).alpha(0).setListener(new AnimatorListenerAdapter() {
    @Override
    public void onAnimationStart(Animator anim) {
      dispatchRemoveStarting(holder);
    }
    @Override
    public void onAnimationEnd(Animator anim) {
      animation.setListener(null);
      view.setAlpha(1);
      dispatchRemoveFinished(holder);
      mRemoveAnimations.remove(holder);
      dispatchFinishedWhenDone();
    }
  }).start();
}

代码示例来源:origin: Doist/RecyclerViewExtensions

private void animateAddImpl(final ViewHolder holder) {
  final View view = holder.itemView;
  final ViewPropertyAnimator animation = view.animate().withLayer();
  mAddAnimations.add(holder);
  animation.alpha(1).setDuration(getAddDuration()).
      setListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationStart(Animator anim) {
          dispatchAddStarting(holder);
        }
        @Override
        public void onAnimationCancel(Animator anim) {
          view.setAlpha(1);
        }
        @Override
        public void onAnimationEnd(Animator anim) {
          animation.setListener(null);
          dispatchAddFinished(holder);
          mAddAnimations.remove(holder);
          dispatchFinishedWhenDone();
        }
      }).start();
}

代码示例来源:origin: vickychijwani/udacity-p1-p2-popular-movies

private void startEnterAnimation(int startDelay) {
  Interpolator interpolator = new DecelerateInterpolator();
  if (mAnimBackdropAnimateAlpha) {
    View[] mFadeInViews = new View[] { mBackdrop, mPoster };
    for (View v : mFadeInViews) {
      v.setAlpha(0f);
      v.animate()
          .withLayer()
          .alpha(1f)
          .setInterpolator(interpolator)
          .setDuration(mAnimShortDuration)
          .setListener(null)
          .start();
    }
  }
  for (int i = 0; i < mEnterAnimationViews.size(); ++i) {
    final View v = mEnterAnimationViews.get(i);
    v.setAlpha(0f);
    v.setTranslationY(75);
    v.animate()
        .withLayer()
        .alpha(1.0f)
        .translationY(0)
        .setInterpolator(interpolator)
        .setStartDelay(startDelay + mAnimStaggerDelay * i)
        .setDuration(mAnimShortDuration)
        .setListener(null)      // http://stackoverflow.com/a/22934588/504611
        .start();
  }
}

代码示例来源:origin: wasdennnoch/AndroidN-ify

private static void transition(final View v, final boolean in) {
    if (v.getVisibility() == (in ? VISIBLE : INVISIBLE)) return;
    if (in) {
      v.bringToFront();
      v.setVisibility(View.VISIBLE);
    }
    if (v.hasOverlappingRendering()) {
      v.animate().withLayer();
    }
    v.animate()
        .alpha(in ? 1 : 0)
        .withEndAction(new SafeRunnable() {
          @Override
          public void runSafe() {
            if (!in) {
              v.setVisibility(View.INVISIBLE);
            }
          }
        })
        .start();
  }
}

代码示例来源:origin: jahirfiquitiva/IconShowcase

@Override
  public void onShown(FloatingActionButton fab) {
    super.onShown(fab);
    fab.animate().rotation(0.0f).withLayer().setDuration(300).setInterpolator(new
        OvershootInterpolator(10.0F)).start();
  }
});

代码示例来源:origin: geniusgithub/AndroidDialer

private static void scaleInternal(final View view, int startScaleValue, int endScaleValue,
    int durationMs, int startDelay, AnimatorListenerAdapter listener,
    Interpolator interpolator) {
  view.setScaleX(startScaleValue);
  view.setScaleY(startScaleValue);
  final ViewPropertyAnimator animator = view.animate();
  animator.cancel();
  animator.setInterpolator(interpolator)
    .scaleX(endScaleValue)
    .scaleY(endScaleValue)
    .setListener(listener)
    .withLayer();
  if (durationMs != DEFAULT_DURATION) {
    animator.setDuration(durationMs);
  }
  animator.setStartDelay(startDelay);
  animator.start();
}

代码示例来源:origin: wasdennnoch/AndroidN-ify

public static void transition(final View v, final boolean in) {
  if (in) {
    v.bringToFront();
    v.setVisibility(View.VISIBLE);
  }
  if (v.hasOverlappingRendering()) {
    v.animate().withLayer();
  }
  v.animate()
      .alpha(in ? 1 : 0)
      .withEndAction(new SafeRunnable() {
        @Override
        public void runSafe() {
          if (!in) {
            v.setVisibility(View.INVISIBLE);
          }
          if (!ConfigUtils.M)
            XposedHelpers.setBooleanField(mStatusBarHeaderView, "mDetailTransitioning", false);
        }
      })
      .start();
}

代码示例来源:origin: jahirfiquitiva/IconShowcase

private void openMenu() {
  fab.animate().rotation(45.0f).withLayer().setDuration(300).setInterpolator(new
      OvershootInterpolator(10.0F)).start();
  showFab(applyFab);
  showFab(saveFab);
  showFab(infoFab);
}

代码示例来源:origin: vickychijwani/udacity-p1-p2-popular-movies

@Override
  public boolean onPreDraw() {
    mFavoriteBtn.getViewTreeObserver().removeOnPreDrawListener(this);
    mFavoriteBtn.animate()
        .withLayer()
        .scaleX(1f)
        .scaleY(1f)
        .setInterpolator(new DecelerateInterpolator())
        .setStartDelay(animStartDelay)
        .setDuration(mAnimShortDuration)
        .start();
    return true;
  }
});

代码示例来源:origin: jahirfiquitiva/IconShowcase

private void closeMenu() {
  hideFab(infoFab);
  hideFab(saveFab);
  hideFab(applyFab);
  fab.animate().rotation(0.0f).withLayer().setDuration(300).setInterpolator(new
      OvershootInterpolator(10.0F)).start();
}

代码示例来源:origin: ywwynm/EverythingDone

private void updateHeader(int scrollY, boolean anim) {
    float scale = titleShrinkFactor * scrollY + 1;
    mTitle.setPivotX(1);
    mTitle.setPivotY(1);

    if (anim) {
      mRelativeLayout.animate().translationY(-headerTranslationYFactor * scrollY);

      /**
       * Changing scaleX and scaleY of title is better than changing its textSize.
       * pivotX and pivotY should be remained as 1 so that title's location won't
       * be changed incorrectly.
       */

      mTitle.animate().scaleX(scale).setDuration(160);
      mTitle.animate().scaleY(scale).setDuration(160);
      mSubtitle.animate().alpha(-1.0f / mScreenDensity / 90 * scrollY + 1).withLayer().setDuration(160);
    } else {
      mRelativeLayout.setTranslationY((int) (-headerTranslationYFactor * scrollY));
      mTitle.setScaleX(scale);
      mTitle.setScaleY(scale);
      mSubtitle.setAlpha(-1.0f / mScreenDensity / 90 * scrollY + 1);
    }
  }
}

代码示例来源:origin: wasdennnoch/AndroidN-ify

@Override
  protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
    View mScrimBehind = (View) XposedHelpers.getObjectField(param.thisObject, "mScrimBehind");
    Object mPanelHolder = XposedHelpers.getObjectField(param.thisObject, "mPanelHolder");
    final View mBrightnessMirror = (View) XposedHelpers.getObjectField(param.thisObject, "mBrightnessMirror");
    XposedHelpers.callMethod(mScrimBehind, "animateViewAlpha", 1.0f, 200, Interpolators.ALPHA_IN);
    inAnimation((ViewPropertyAnimator) XposedHelpers.callMethod(mPanelHolder, "animate"))
        .withLayer()
        .withEndAction(new Runnable() {
          @Override
          public void run() {
            mBrightnessMirror.setVisibility(View.INVISIBLE);
            setFadingOut(false);
          }
        });
    return null;
  }
});

相关文章