android.graphics.drawable.Drawable.invalidateSelf()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(307)

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

Drawable.invalidateSelf介绍

暂无

代码示例

代码示例来源:origin: bumptech/glide

@Override
public void invalidateSelf() {
 super.invalidateSelf();
 wrapped.invalidateSelf();
}

代码示例来源:origin: scwang90/SmartRefreshLayout

public void setStartEndTrim(float startAngle, float endAngle) {
  mRing.mStartTrim = (startAngle);
  mRing.mEndTrim = (endAngle);
  final Drawable thisDrawable = this;
  thisDrawable.invalidateSelf();
}

代码示例来源:origin: scwang90/SmartRefreshLayout

void setRotation(float rotation) {
  mRotation = rotation;
  final Drawable thisDrawable = this;
  thisDrawable.invalidateSelf();
}

代码示例来源:origin: scwang90/SmartRefreshLayout

public void showArrow(boolean show) {
  if (mRing.mShowArrow != show) {
    mRing.mShowArrow = show;
    final Drawable thisDrawable = this;
    thisDrawable.invalidateSelf();
  }
}

代码示例来源:origin: scwang90/SmartRefreshLayout

public void setArrowScale(float scale) {
  if (mRing.mArrowScale != scale) {
    mRing.mArrowScale = scale;
    final Drawable thisDrawable = this;
    thisDrawable.invalidateSelf();
  }
}

代码示例来源:origin: scwang90/SmartRefreshLayout

public void setProgressRotation(float rotation) {
  mRing.mRotation = (rotation);
  final Drawable thisDrawable = this;
  thisDrawable.invalidateSelf();
}

代码示例来源:origin: scwang90/SmartRefreshLayout

@Override
public void setColorFilter(ColorFilter colorFilter) {
  mRing.mPaint.setColorFilter(colorFilter);
  final Drawable thisDrawable = this;
  thisDrawable.invalidateSelf();
}

代码示例来源:origin: scwang90/SmartRefreshLayout

@Override
public void onAnimationUpdate(ValueAnimator animation) {
  int value = (int) animation.getAnimatedValue();
  mProgressDegree = 30 * (value / 30);
  final Drawable drawable = ProgressDrawable.this;
  drawable.invalidateSelf();
}

代码示例来源:origin: koral--/android-gif-drawable

@Override
public void invalidateSelf() {
  super.invalidateSelf();
  scheduleNextRender();
}

代码示例来源:origin: scwang90/SmartRefreshLayout

private void setSizeParameters(int progressCircleWidth, int progressCircleHeight,
                float centerRadius, float strokeWidth, float arrowWidth, float arrowHeight) {
  final DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics();
  final float screenDensity = metrics.density;
  mWidth = progressCircleWidth * screenDensity;
  mHeight = progressCircleHeight * screenDensity;
  mRing.setColorIndex(0);
  mRing.mPaint.setStrokeWidth(strokeWidth * screenDensity);
  mRing.mStrokeWidth = strokeWidth * screenDensity;
  mRing.mRingCenterRadius = (centerRadius * screenDensity);
  mRing.mArrowWidth = (int) (arrowWidth * screenDensity);
  mRing.mArrowHeight = (int) (arrowHeight * screenDensity);
  mRing.setInsets((int) mWidth, (int) mHeight);
  final Drawable thisDrawable = this;
  thisDrawable.invalidateSelf();
}

代码示例来源:origin: aurelhubert/ahbottomnavigation

/**
 * Return a tint drawable
 *
 * @param drawable
 * @param color
 * @param forceTint
 * @return
 */
public static Drawable getTintDrawable(Drawable drawable, @ColorInt int color, boolean forceTint) {
  if (forceTint) {
    drawable.clearColorFilter();
    drawable.mutate().setColorFilter(color, PorterDuff.Mode.SRC_IN);
    drawable.invalidateSelf();
    return drawable;
  }
  Drawable wrapDrawable = DrawableCompat.wrap(drawable).mutate();
  DrawableCompat.setTint(wrapDrawable, color);
  return wrapDrawable;
}

代码示例来源:origin: aa112901/remusic

public static void tintViewDrawable(View view, Drawable drawable, TintInfo tint) {
  if (view == null || drawable == null) return;
  if (tint.mHasTintList || tint.mHasTintMode) {
    drawable.mutate();
    if (drawable instanceof ColorDrawable) {
      ((ColorDrawable) drawable).setColor(ThemeUtils.replaceColor(view.getContext(), tint.mTintList.getColorForState(view.getDrawableState(), tint.mTintList.getDefaultColor())));
    } else {
      drawable.setColorFilter(createTintFilter(view.getContext(),
          tint.mHasTintList ? tint.mTintList : null,
          tint.mHasTintMode ? tint.mTintMode : DEFAULT_MODE,
          view.getDrawableState()));
    }
  } else {
    drawable.clearColorFilter();
  }
  if (Build.VERSION.SDK_INT <= 23) {
    // On Gingerbread, GradientDrawable does not invalidate itself when it's ColorFilter
    // has changed, so we need to force an invalidation
    drawable.invalidateSelf();
  }
}

代码示例来源:origin: aa112901/remusic

public static void tintViewBackground(View view, TintInfo tint) {
  Drawable background;
  if (view == null || (background = view.getBackground()) == null) return;
  if (tint.mHasTintList || tint.mHasTintMode) {
    background.mutate();
    if (background instanceof ColorDrawable) {
      ((ColorDrawable) background).setColor(ThemeUtils.replaceColor(view.getContext(), tint.mTintList.getColorForState(view.getDrawableState(), tint.mTintList.getDefaultColor())));
    } else {
      background.setColorFilter(createTintFilter(view.getContext(),
          tint.mHasTintList ? tint.mTintList : null,
          tint.mHasTintMode ? tint.mTintMode : DEFAULT_MODE,
          view.getDrawableState()));
    }
  } else {
    background.clearColorFilter();
  }
  if (Build.VERSION.SDK_INT <= 23) {
    // On Gingerbread, GradientDrawable does not invalidate itself when it's ColorFilter
    // has changed, so we need to force an invalidation
    background.invalidateSelf();
  }
}

代码示例来源:origin: koral--/android-gif-drawable

@Test
public void testViewRemoval() {
  simpleMultiCallback.addView(view);
  drawable.setCallback(simpleMultiCallback);
  drawable.invalidateSelf();
  simpleMultiCallback.removeView(view);
  drawable.invalidateSelf();
  verify(view).invalidateDrawable(drawable);
}

代码示例来源:origin: koral--/android-gif-drawable

@Test
  public void testViewInvalidate() {
    final MultiCallback viewInvalidateMultiCallback = new MultiCallback(true);
    viewInvalidateMultiCallback.addView(view);
    drawable.setCallback(viewInvalidateMultiCallback);
    drawable.invalidateSelf();
    verify(view).invalidate();
  }
}

代码示例来源:origin: koral--/android-gif-drawable

@Test
public void testInvalidateDrawable() {
  simpleMultiCallback.addView(view);
  drawable.setCallback(simpleMultiCallback);
  drawable.invalidateSelf();
  verify(view).invalidateDrawable(drawable);
}

代码示例来源:origin: aa112901/remusic

tintDrawable.invalidateSelf();

代码示例来源:origin: robolectric/robolectric

@Test
public void testWasSelfInvalidated() throws Exception {
 Drawable drawable = ShadowDrawable.createFromResourceId(34758);
 ShadowDrawable shadowDrawable = shadowOf(drawable);
 assertThat(shadowDrawable.wasInvalidated()).isFalse();
 drawable.invalidateSelf();
 assertThat(shadowDrawable.wasInvalidated()).isTrue();
}

代码示例来源:origin: googlesamples/android-unsplash

@Override
public void invalidateSelf() {
  super.invalidateSelf();
  view.invalidate();
}

代码示例来源:origin: DroidsOnRoids/Workcation

@Override
public void invalidateSelf() {
  super.invalidateSelf();
  view.invalidate();
}

相关文章