List of usage examples for android.graphics.drawable Drawable setCallback
public final void setCallback(@Nullable Callback cb)
From source file:am.widget.basetabstrip.BaseTabStrip.java
private void clearItemBackground() { for (Drawable drawable : mTabItemBackgrounds) { drawable.setCallback(null); }//from w ww. j a va2s. c om mTabItemBackgrounds.clear(); }
From source file:nz.ac.otago.psyanlab.common.designer.program.stage.StageView.java
public void setSelector(int fingers, Drawable s) { Drawable d = mSelectors.get(fingers); if (d != null) { d.setCallback(null); unscheduleDrawable(d);//from ww w . j ava 2 s . c o m } mSelectors.put(fingers, s); s.setCallback(this); updateSelectorState(); }
From source file:am.widget.basetabstrip.BaseTabStrip.java
/** * ??/*from w ww .j av a 2 s. co m*/ */ protected void recreateItemBackgrounds() { clearItemBackground(); if (!hasItemBackgrounds()) return; int count = getItemCount(); for (int i = 0; i < count; i++) { Drawable tag = mTabItemBackground.getConstantState().newDrawable(); tag.setCallback(this); mTabItemBackgrounds.add(tag); } }
From source file:am.widget.basetabstrip.BaseTabStrip.java
/** * ?//from w w w. ja v a 2 s. c o m */ protected void createItemBackgrounds() { if (!hasItemBackgrounds()) return; int count = getItemCount(); if (count > 0) { for (int i = 0; i < count; i++) { if (i < mTabItemBackgrounds.size()) { mTabItemBackgrounds.get(i).setState(onCreateDrawableState(0)); } else { Drawable tag = mTabItemBackground.getConstantState().newDrawable(); tag.setCallback(this); mTabItemBackgrounds.add(tag); } } } else { for (Drawable drawable : mTabItemBackgrounds) { drawable.setState(onCreateDrawableState(0)); } } }
From source file:com.actionbarsherlock.internal.widget.IcsProgressBar.java
/** * <p>Define the drawable used to draw the progress bar in * indeterminate mode.</p>//from w w w. j a va 2 s.c o m * * @param d the new drawable * * @see #getIndeterminateDrawable() * @see #setIndeterminate(boolean) */ public void setIndeterminateDrawable(Drawable d) { if (d != null) { d.setCallback(this); } mIndeterminateDrawable = d; if (mIndeterminate) { mCurrentDrawable = d; postInvalidate(); } }
From source file:am.widget.basetabstrip.BaseTabStripGroup.java
/** * ??//from w w w . ja va2 s . c o m */ protected void recreateItemBackgrounds() { clearItemBackground(); if (!hasItemBackgrounds()) return; int count = getItemCount(); for (int i = 0; i < count; i++) { Drawable tag; if (mTabItemBackground.getConstantState() != null) { tag = mTabItemBackground.getConstantState().newDrawable().mutate(); } else { tag = mTabItemBackground.mutate(); } tag.setCallback(this); mTabItemBackgrounds.add(tag); } }
From source file:com.tr4android.support.extension.widget.FlexibleToolbarLayout.java
/** * Set the drawable to use for the status bar scrim from resources. * Providing null will disable the scrim functionality. * <p/>// www . j a va 2 s .com * <p>This scrim is only shown when we have been given a top system inset.</p> * * @param drawable the drawable to display * @attr ref R.styleable#FlexibleToolbarLayout_statusBarScrimColor * @see #getStatusBarScrim() */ public void setStatusBarScrim(@Nullable Drawable drawable) { if (mStatusBarScrim != drawable) { if (mStatusBarScrim != null) { mStatusBarScrim.setCallback(null); } mStatusBarScrim = drawable; drawable.setCallback(this); drawable.mutate().setAlpha(mScrimAlpha); ViewCompat.postInvalidateOnAnimation(this); } }
From source file:am.widget.basetabstrip.BaseTabStripGroup.java
/** * ?//w w w. j a va 2 s . co m */ protected void createItemBackgrounds() { if (!hasItemBackgrounds()) return; int count = getItemCount(); if (count > 0) { for (int i = 0; i < count; i++) { if (i < mTabItemBackgrounds.size()) { mTabItemBackgrounds.get(i).setState(onCreateDrawableState(0)); } else { Drawable tag; if (mTabItemBackground.getConstantState() != null) { tag = mTabItemBackground.getConstantState().newDrawable().mutate(); } else { tag = mTabItemBackground.mutate(); } tag.setCallback(this); mTabItemBackgrounds.add(tag); } } } else { for (Drawable drawable : mTabItemBackgrounds) { drawable.setState(onCreateDrawableState(0)); } } }
From source file:com.facebook.litho.ComponentHost.java
private void unmountDrawable(int index, MountItem mountItem) { final Drawable contentDrawable = (Drawable) mountItem.getContent(); final Drawable drawable = mountItem.getDisplayListDrawable() == null ? contentDrawable : mountItem.getDisplayListDrawable(); if (ComponentHostUtils.existsScrapItemAt(index, mScrapDrawableMountItems)) { mScrapDrawableMountItems.remove(index); } else {//from ww w . ja v a2 s .co m mDrawableMountItems.remove(index); } drawable.setCallback(null); if (contentDrawable instanceof Touchable) { if (ComponentHostUtils.existsScrapItemAt(index, mScrapTouchables)) { mScrapTouchables.remove(index); } else { mTouchables.remove(index); } } this.invalidate(drawable.getBounds()); releaseScrapDataStructuresIfNeeded(); }
From source file:com.tr4android.support.extension.widget.FlexibleToolbarLayout.java
/** * Set the drawable to use for the content scrim from resources. Providing null will disable * the scrim functionality.// w w w .j a v a 2 s . com * * @param drawable the drawable to display * @attr ref R.styleable#FlexibleToolbarLayout_contentScrimColor * @see #getContentScrim() */ public void setContentScrim(@Nullable Drawable drawable) { if (mContentScrim != drawable) { if (mContentScrim != null) { mContentScrim.setCallback(null); } if (drawable != null) { mContentScrim = drawable.mutate(); drawable.setBounds(0, 0, getWidth(), getHeight()); drawable.setCallback(this); drawable.setAlpha(mScrimAlpha); } else { mContentScrim = null; } ViewCompat.postInvalidateOnAnimation(this); } }