當前位置: 首頁>>代碼示例>>Java>>正文


Java Drawable.setCallback方法代碼示例

本文整理匯總了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();
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:24,代碼來源:ActionBarContainer.java

示例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();
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:18,代碼來源:DrawableWrapperDonut.java

示例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();
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:17,代碼來源:FlatViewGroup.java

示例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();
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:24,代碼來源:ActionBarContainer.java

示例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();
}
 
開發者ID:pooyafaroka,項目名稱:PlusGram,代碼行數:11,代碼來源:Switch.java

示例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();
		}
	}
}
 
開發者ID:universum-studios,項目名稱:android_ui,代碼行數:41,代碼來源:CircularNumberPicker.java

示例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;
}
 
開發者ID:YiiGuxing,項目名稱:CompositionAvatar,代碼行數:38,代碼來源:CompositionAvatarView.java

示例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();
    }
}
 
開發者ID:chengzichen,項目名稱:KrGallery,代碼行數:16,代碼來源:SimpleTextView.java

示例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();
}
 
開發者ID:pooyafaroka,項目名稱:PlusGram,代碼行數:11,代碼來源:Switch.java

示例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();
    }
}
 
開發者ID:chengzichen,項目名稱:KrGallery,代碼行數:16,代碼來源:SimpleTextView.java

示例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);
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:10,代碼來源:DrawableWrapper.java

示例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;
        }
    }
 
開發者ID:jeasinlee,項目名稱:AndroidBasicLibs,代碼行數:33,代碼來源:LargeImageView.java

示例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();
    }
}
 
開發者ID:ihsanbal,項目名稱:Wiv,代碼行數:13,代碼來源:OverlayImageView.java

示例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();
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:16,代碼來源:AbsHListView.java

示例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));
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:7,代碼來源:GenericDraweeHierarchyTest.java


注:本文中的android.graphics.drawable.Drawable.setCallback方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。