本文整理匯總了Java中android.graphics.drawable.Drawable.setCallback方法的典型用法代碼示例。如果您正苦於以下問題:Java Drawable.setCallback方法的具體用法?Java Drawable.setCallback怎麽用?Java Drawable.setCallback使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.graphics.drawable.Drawable
的用法示例。
在下文中一共展示了Drawable.setCallback方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setStackedBackground
import android.graphics.drawable.Drawable; //導入方法依賴的package包/類
public void setStackedBackground(Drawable bg) {
boolean z = true;
if (this.mStackedBackground != null) {
this.mStackedBackground.setCallback(null);
unscheduleDrawable(this.mStackedBackground);
}
this.mStackedBackground = bg;
if (bg != null) {
bg.setCallback(this);
if (this.mIsStacked && this.mStackedBackground != null) {
this.mStackedBackground.setBounds(this.mTabContainer.getLeft(), this.mTabContainer.getTop(), this.mTabContainer.getRight(), this.mTabContainer.getBottom());
}
}
if (this.mIsSplit) {
if (this.mSplitBackground != null) {
z = false;
}
} else if (!(this.mBackground == null && this.mStackedBackground == null)) {
z = false;
}
setWillNotDraw(z);
invalidate();
}
示例2: setWrappedDrawable
import android.graphics.drawable.Drawable; //導入方法依賴的package包/類
public final void setWrappedDrawable(Drawable dr) {
if (this.mDrawable != null) {
this.mDrawable.setCallback(null);
}
this.mDrawable = dr;
if (dr != null) {
dr.setCallback(this);
dr.setVisible(isVisible(), true);
dr.setState(getState());
dr.setLevel(getLevel());
dr.setBounds(getBounds());
if (this.mState != null) {
this.mState.mDrawableState = dr.getConstantState();
}
}
invalidateSelf();
}
示例3: setHotspot
import android.graphics.drawable.Drawable; //導入方法依賴的package包/類
void setHotspot(Drawable hotspot) {
if (mHotspot != null) {
mHotspot.setCallback(null);
unscheduleDrawable(mHotspot);
}
if (hotspot != null) {
hotspot.setCallback(this);
if (hotspot.isStateful()) {
hotspot.setState(getDrawableState());
}
}
mHotspot = hotspot;
invalidate();
}
示例4: setPrimaryBackground
import android.graphics.drawable.Drawable; //導入方法依賴的package包/類
public void setPrimaryBackground(Drawable bg) {
boolean z = true;
if (this.mBackground != null) {
this.mBackground.setCallback(null);
unscheduleDrawable(this.mBackground);
}
this.mBackground = bg;
if (bg != null) {
bg.setCallback(this);
if (this.mActionBarView != null) {
this.mBackground.setBounds(this.mActionBarView.getLeft(), this.mActionBarView.getTop(), this.mActionBarView.getRight(), this.mActionBarView.getBottom());
}
}
if (this.mIsSplit) {
if (this.mSplitBackground != null) {
z = false;
}
} else if (!(this.mBackground == null && this.mStackedBackground == null)) {
z = false;
}
setWillNotDraw(z);
invalidate();
}
示例5: setThumbDrawable
import android.graphics.drawable.Drawable; //導入方法依賴的package包/類
public void setThumbDrawable(Drawable thumb) {
if (mThumbDrawable != null) {
mThumbDrawable.setCallback(null);
}
mThumbDrawable = thumb;
if (thumb != null) {
thumb.setCallback(this);
}
requestLayout();
}
示例6: setSelectionIndicator
import android.graphics.drawable.Drawable; //導入方法依賴的package包/類
/**
* Sets the drawable used to draw the number selection indicator.
*
* @param indicator The desired drawable for selection indicator. May be {@code null} to clear
* the current one.
* @see R.attr#uiSelectionIndicator ui:uiSelectionIndicator
* @see #setSelectionIndicatorTintList(ColorStateList)
* @see #setSelectionIndicatorTintMode(PorterDuff.Mode)
* @see #getSelectionIndicator()
*/
public void setSelectionIndicator(@Nullable Drawable indicator) {
if (mSelectionIndicator != indicator) {
final boolean needUpdate;
if (mSelectionIndicator != null) {
mSelectionIndicator.setCallback(null);
unscheduleDrawable(mSelectionIndicator);
needUpdate = true;
} else {
needUpdate = false;
}
if (indicator != null) {
indicator.setCallback(this);
indicator.setVisible(getVisibility() == VISIBLE, false);
if (indicator.getPadding(mRect)) {
TEXT_INFO.padding = Math.max(mRect.left, Math.max(mRect.top, Math.max(mRect.right, mRect.bottom)));
}
} else {
this.mSelectionIndicatorRes = 0;
}
this.mSelectionIndicator = indicator;
this.applySelectionIndicatorTint();
if (needUpdate) {
if (mSelectionIndicator.isStateful()) {
mSelectionIndicator.setState(getDrawableState());
}
this.invalidateNumbersArea();
}
}
}
示例7: addDrawable
import android.graphics.drawable.Drawable; //導入方法依賴的package包/類
/**
* 添加drawable, 如果id已經存在, drawable將會被替換
*
* @param id the drawable id.
* @param drawable the drawable.
* @return <code>true</code> - 如果添加成功, <code>false</code> - 其他
*/
public boolean addDrawable(int id, @NonNull Drawable drawable) {
DrawableInfo old = findAvatarDrawableById(id);
if (old != null) {
Drawable d = old.mDrawable;
old.mDrawable = drawable;
if (!hasSameDrawable(d)) {
cleanDrawable(d);
}
updateDrawableBounds(old);
} else {
if (getNumberOfDrawables() >= MAX_DRAWABLE_COUNT) {
return false;
}
mDrawables.add(crateAvatarDrawable(id, drawable));
layoutDrawables();
}
drawable.setCallback(this);
drawable.setVisible(getWindowVisibility() == VISIBLE && isShown(), true);
if (drawable.isStateful()) {
drawable.setState(getDrawableState());
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
drawable.setLayoutDirection(getLayoutDirection());
}
invalidate();
return true;
}
示例8: setRightDrawable
import android.graphics.drawable.Drawable; //導入方法依賴的package包/類
public void setRightDrawable(Drawable drawable) {
if (rightDrawable == drawable) {
return;
}
if (rightDrawable != null) {
rightDrawable.setCallback(null);
}
rightDrawable = drawable;
if (drawable != null) {
drawable.setCallback(this);
}
if (!recreateLayoutMaybe()) {
invalidate();
}
}
示例9: setTrackDrawable
import android.graphics.drawable.Drawable; //導入方法依賴的package包/類
public void setTrackDrawable(Drawable track) {
if (mTrackDrawable != null) {
mTrackDrawable.setCallback(null);
}
mTrackDrawable = track;
if (track != null) {
track.setCallback(this);
}
requestLayout();
}
示例10: setLeftDrawable
import android.graphics.drawable.Drawable; //導入方法依賴的package包/類
public void setLeftDrawable(Drawable drawable) {
if (leftDrawable == drawable) {
return;
}
if (leftDrawable != null) {
leftDrawable.setCallback(null);
}
leftDrawable = drawable;
if (drawable != null) {
drawable.setCallback(this);
}
if (!recreateLayoutMaybe()) {
invalidate();
}
}
示例11: setWrappedDrawable
import android.graphics.drawable.Drawable; //導入方法依賴的package包/類
public void setWrappedDrawable(Drawable drawable) {
if (this.mDrawable != null) {
this.mDrawable.setCallback(null);
}
this.mDrawable = drawable;
if (drawable != null) {
drawable.setCallback(this);
}
}
示例12: updateDrawable
import android.graphics.drawable.Drawable; //導入方法依賴的package包/類
private void updateDrawable(Drawable d) {
if (mDrawable != null) {
mDrawable.setCallback(null);
unscheduleDrawable(mDrawable);
if (isAttachedWindow) {
mDrawable.setVisible(false, false);
}
}
mDrawable = d;
if (d != null) {
d.setCallback(this);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
d.setLayoutDirection(getLayoutDirection());
}
if (d.isStateful()) {
d.setState(getDrawableState());
}
if (isAttachedWindow) {
d.setVisible(getWindowVisibility() == VISIBLE && isShown(), true);
}
d.setLevel(mLevel);
mDrawableWidth = d.getIntrinsicWidth();
mDrawableHeight = d.getIntrinsicHeight();
// applyImageTint();
// applyColorMod();
//
// configureBounds();
} else {
mDrawableWidth = mDrawableHeight = -1;
}
}
示例13: setOverlayDrawable
import android.graphics.drawable.Drawable; //導入方法依賴的package包/類
public void setOverlayDrawable(Drawable drawable) {
if (drawable != overlay.drawable) {
overlay.cleanupDrawable(this);
if (drawable != null) {
drawable.setCallback(this);
}
overlay = new Overlay(drawable);
overlay.setDrawableState(getDrawableState());
requestLayout();
}
}
示例14: setSelector
import android.graphics.drawable.Drawable; //導入方法依賴的package包/類
public void setSelector(Drawable sel) {
if (this.mSelector != null) {
this.mSelector.setCallback(null);
unscheduleDrawable(this.mSelector);
}
this.mSelector = sel;
Rect padding = new Rect();
sel.getPadding(padding);
this.mSelectionLeftPadding = padding.left;
this.mSelectionTopPadding = padding.top;
this.mSelectionRightPadding = padding.right;
this.mSelectionBottomPadding = padding.bottom;
sel.setCallback(this);
updateSelectorState();
}
示例15: verifyCallback
import android.graphics.drawable.Drawable; //導入方法依賴的package包/類
private void verifyCallback(Drawable parent, Drawable child) {
Drawable.Callback callback = mock(Drawable.Callback.class);
parent.setCallback(callback);
child.invalidateSelf();
verify(callback).invalidateDrawable(any(Drawable.class));
}