本文整理了Java中android.graphics.drawable.Drawable.setVisible()
方法的一些代码示例,展示了Drawable.setVisible()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Drawable.setVisible()
方法的具体详情如下:
包路径:android.graphics.drawable.Drawable
类名称:Drawable
方法名:setVisible
暂无
代码示例来源:origin: bumptech/glide
@Override
public boolean setVisible(boolean visible, boolean restart) {
return wrapped.setVisible(visible, restart);
}
代码示例来源:origin: koral--/android-gif-drawable
private static void setDrawablesVisible(final Drawable[] drawables, final boolean visible) {
for (final Drawable drawable : drawables) {
if (drawable != null) {
drawable.setVisible(visible, false);
}
}
}
代码示例来源:origin: rey5137/material
@Override
public boolean setVisible(boolean visible, boolean restart) {
return super.setVisible(visible, restart) || (mDrawable != null && mDrawable.setVisible(visible, restart));
}
代码示例来源:origin: facebook/litho
@Override
public boolean setVisible(boolean visible, boolean restart) {
return super.setVisible(visible, restart) || mDrawable.setVisible(visible, restart);
}
代码示例来源:origin: DreaminginCodeZH/MaterialProgressBar
@Override
public boolean setVisible(boolean visible, boolean restart) {
boolean changed = super.setVisible(visible, restart);
if (mLastDrawable != null) {
mLastDrawable.setVisible(visible, restart);
}
if (mCurrDrawable != null) {
mCurrDrawable.setVisible(visible, restart);
}
return changed;
}
代码示例来源:origin: seven332/EhViewer
public boolean setVisible(boolean visible, boolean restart) {
return super.setVisible(visible, restart) || this.mDrawable.setVisible(visible, restart);
}
代码示例来源:origin: facebook/litho
private void setDrawableVisibilitySafe(boolean visible, boolean restart) {
if (mDrawable != null && mDrawable.isVisible() != visible) {
try {
mDrawable.setVisible(visible, restart);
} catch (NullPointerException e) {
// Swallow. LayerDrawable on KitKat sometimes causes this, if some of its children are null.
// This should not cause any rendering bugs, since visibility is anyway a "hint".
}
}
}
代码示例来源:origin: facebook/litho
@Override
public boolean setVisible(boolean visible, boolean restart) {
final boolean changed = super.setVisible(visible, restart);
setDrawableVisibilitySafe(visible, restart);
return changed;
}
代码示例来源:origin: facebook/litho
@Override
public boolean setVisible(boolean visible, boolean restart) {
return super.setVisible(visible, restart) || mDrawable.setVisible(visible, restart);
}
代码示例来源:origin: LuckyJayce/LargeImage
@Override
public void setVisibility(int visibility) {
super.setVisibility(visibility);
if (mDrawable != null) {
mDrawable.setVisible(visibility == VISIBLE, false);
}
}
代码示例来源:origin: LuckyJayce/LargeImage
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
isAttachedWindow = true;
imageBlockImageLoader.stopLoad();
if (mDrawable != null) {
mDrawable.setVisible(false, false);
}
}
代码示例来源:origin: ZieIony/Carbon
@Override
public boolean setVisible(boolean visible, boolean restart) {
final boolean changed = super.setVisible(visible, restart);
final ChildDrawable[] array = mLayerState.mChildren;
final int N = mLayerState.mNum;
for (int i = 0; i < N; i++) {
final Drawable dr = array[i].mDrawable;
if (dr != null) {
dr.setVisible(visible, restart);
}
}
return changed;
}
代码示例来源:origin: facebook/litho
/**
* Mounts a drawable into a view.
* @param view view into which the drawable should be mounted
* @param drawable drawable to be mounted
* @param bounds bounds of the drawable being mounted
* @param flags flags that determine whether the drawable obtains state from the view
* @param nodeInfo nodeInfo associated to the drawable node
*/
static void mountDrawable(
View view,
Drawable drawable,
Rect bounds,
int flags,
NodeInfo nodeInfo) {
drawable.setVisible(view.getVisibility() == View.VISIBLE, false);
drawable.setCallback(view);
maybeSetDrawableState(view, drawable, flags, nodeInfo);
view.invalidate(bounds);
}
代码示例来源:origin: bumptech/glide
@Override
public boolean setVisible(boolean visible, boolean restart) {
Preconditions.checkArgument(!isRecycled, "Cannot change the visibility of a recycled resource."
+ " Ensure that you unset the Drawable from your View before changing the View's"
+ " visibility.");
isVisible = visible;
if (!visible) {
stopRunning();
} else if (isStarted) {
startRunning();
}
return super.setVisible(visible, restart);
}
代码示例来源:origin: LuckyJayce/LargeImage
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
isAttachedWindow = true;
if (mDrawable != null) {
mDrawable.setVisible(getVisibility() == VISIBLE, false);
}
}
代码示例来源:origin: LuckyJayce/LargeImage
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
isAttachedWindow = false;
imageBlockLoader.stopLoad();
if (mDrawable != null) {
mDrawable.setVisible(false, false);
}
}
代码示例来源:origin: LuckyJayce/LargeImage
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
isAttachedWindow = false;
if (mDrawable != null) {
mDrawable.setVisible(getVisibility() == VISIBLE, false);
}
}
代码示例来源:origin: rey5137/material
protected void positionSelectorLikeFocusCompat(int position, View sel) {
// If we're changing position, update the visibility since the selector
// is technically being detached from the previous selection.
final Drawable selector = getSelector();
final boolean manageState = selector != null && position != INVALID_POSITION;
if (manageState) {
selector.setVisible(false, false);
}
positionSelectorCompat(position, sel);
if (manageState) {
final Rect bounds = mSelectorRect;
final float x = bounds.exactCenterX();
final float y = bounds.exactCenterY();
selector.setVisible(getVisibility() == VISIBLE, false);
DrawableCompat.setHotspot(selector, x, y);
}
}
protected void positionSelectorCompat(int position, View sel) {
代码示例来源:origin: facebook/litho
@Override
public void setVisibility(int visibility) {
super.setVisibility(visibility);
for (int i = 0, size = (mDrawableMountItems == null) ? 0 : mDrawableMountItems.size();
i < size;
i++) {
final Drawable drawable = (Drawable) mDrawableMountItems.valueAt(i).getMountableContent();
drawable.setVisible(visibility == View.VISIBLE, false);
}
}
代码示例来源:origin: facebook/litho
@Test
public void testSetVisibility() {
Drawable d1 = mock(ColorDrawable.class);
when(d1.getBounds()).thenReturn(new Rect());
mount(0, d1);
Drawable d2 = mock(ColorDrawable.class);
when(d2.getBounds()).thenReturn(new Rect());
mount(1, d2);
View v1 = mock(View.class);
mount(2, v1);
mHost.setVisibility(GONE);
mHost.setVisibility(INVISIBLE);
mHost.setVisibility(VISIBLE);
verify(d1, times(2)).setVisible(eq(true), eq(false));
verify(d1, times(2)).setVisible(eq(false), eq(false));
verify(d2, times(2)).setVisible(eq(true), eq(false));
verify(d2, times(2)).setVisible(eq(false), eq(false));
verify(v1, never()).setVisibility(anyInt());
}
内容来源于网络,如有侵权,请联系作者删除!