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


Java Drawable.isStateful方法代碼示例

本文整理匯總了Java中android.graphics.drawable.Drawable.isStateful方法的典型用法代碼示例。如果您正苦於以下問題:Java Drawable.isStateful方法的具體用法?Java Drawable.isStateful怎麽用?Java Drawable.isStateful使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.graphics.drawable.Drawable的用法示例。


在下文中一共展示了Drawable.isStateful方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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

示例2: drawableStateChanged

import android.graphics.drawable.Drawable; //導入方法依賴的package包/類
@Override
protected void drawableStateChanged() {
    super.drawableStateChanged();

    boolean invalidate = false;
    for (DrawableInfo drawable : mDrawables) {
        Drawable d = drawable.mDrawable;
        if (d.isStateful() && d.setState(getDrawableState())) {
            invalidate = true;
        }
    }

    if (invalidate) {
        invalidate();
    }
}
 
開發者ID:YiiGuxing,項目名稱:CompositionAvatar,代碼行數:17,代碼來源:CompositionAvatarView.java

示例3: drawableStateChanged

import android.graphics.drawable.Drawable; //導入方法依賴的package包/類
@SuppressWarnings("ConstantConditions")
@Override
protected void drawableStateChanged() {
    super.drawableStateChanged();

    final int[] state = getDrawableState();
    boolean changed = false;

    Drawable d = mStatusBarScrim;
    if (d != null && d.isStateful()) {
        changed |= d.setState(state);
    }
    d = mContentScrim;
    if (d != null && d.isStateful()) {
        changed |= d.setState(state);
    }
    if (mCollapsingTextHelper != null) {
        changed |= mCollapsingTextHelper.setState(state);
    }

    if (changed) {
        invalidate();
    }
}
 
開發者ID:QMUI,項目名稱:QMUI_Android,代碼行數:25,代碼來源:QMUICollapsingTopBarLayout.java

示例4: drawableStateChanged

import android.graphics.drawable.Drawable; //導入方法依賴的package包/類
@Override
protected void drawableStateChanged() {
    super.drawableStateChanged();
    final Drawable d = mMarginDrawable;
    if (d != null && d.isStateful()) {
        d.setState(getDrawableState());
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:9,代碼來源:VerticalViewPager.java

示例5: isStateful

import android.graphics.drawable.Drawable; //導入方法依賴的package包/類
@Override
public boolean isStateful() {
  if (!mIsStatefulCalculated) {
    mIsStateful = false;
    for (int i = 0; i < mLayers.length; i++) {
      Drawable drawable = mLayers[i];
      mIsStateful |= drawable != null && drawable.isStateful();
    }
    mIsStatefulCalculated = true;
  }
  return mIsStateful;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:13,代碼來源:ArrayDrawable.java

示例6: setForeground

import android.graphics.drawable.Drawable; //導入方法依賴的package包/類
/**
 * Supply a Drawable that is to be rendered on top of all of the child
 * views in the frame layout.  Any padding in the Drawable will be taken
 * into account by ensuring that the children are inset to be placed
 * inside of the padding area.
 *
 * @param drawable The Drawable to be drawn on top of the children.
 */
public void setForeground(Drawable drawable) {
    if (mForeground != drawable) {
        if (mForeground != null) {
            mForeground.setCallback(null);
            unscheduleDrawable(mForeground);
        }

        mForeground = drawable;

        if (drawable != null) {
            setWillNotDraw(false);
            drawable.setCallback(this);
            if (drawable.isStateful()) {
                drawable.setState(getDrawableState());
            }
            if (mForegroundGravity == Gravity.FILL) {
                Rect padding = new Rect();
                drawable.getPadding(padding);
            }
        }  else {
            setWillNotDraw(true);
        }
        requestLayout();
        invalidate();
    }
}
 
開發者ID:dreaminglion,項目名稱:iosched-reader,代碼行數:35,代碼來源:ForegroundLinearLayout.java

示例7: getIndicator

import android.graphics.drawable.Drawable; //導入方法依賴的package包/類
/**
 * Gets the indicator for the item at the given position. If the indicator
 * is stateful, the state will be given to the indicator.
 *
 * @param pos The flat list position of the item whose indicator
 *            should be returned.
 * @return The indicator in the proper state.
 */
private Drawable getIndicator( ExpandableHListConnector.PositionMetadata pos ) {
	Drawable indicator;

	if( pos.position.type == ExpandableHListPosition.GROUP ) {
		indicator = mGroupIndicator;

		if( indicator != null && indicator.isStateful() ) {
			// Empty check based on availability of data.  If the groupMetadata isn't null,
			// we do a check on it. Otherwise, the group is collapsed so we consider it
			// empty for performance reasons.
			boolean isEmpty = ( pos.groupMetadata == null ) || ( pos.groupMetadata.lastChildFlPos == pos.groupMetadata.flPos );

			final int stateSetIndex = ( pos.isExpanded() ? 1 : 0 ) | // Expanded?
			                          ( isEmpty ? 2 : 0 ); // Empty?
			indicator.setState( GROUP_STATE_SETS[stateSetIndex] );
		}
	}
	else {
		indicator = mChildIndicator;

		if( indicator != null && indicator.isStateful() ) {
			// No need for a state sets array for the child since it only has two states
			final int stateSet[] = pos.position.flatListPos == pos.groupMetadata.lastChildFlPos ? CHILD_LAST_STATE_SET : EMPTY_STATE_SET;
			indicator.setState( stateSet );
		}
	}

	return indicator;
}
 
開發者ID:junchenChow,項目名稱:exciting-app,代碼行數:38,代碼來源:ExpandableHListView.java

示例8: updateDrawable

import android.graphics.drawable.Drawable; //導入方法依賴的package包/類
private void updateDrawable(Drawable d) {
        boolean sameDrawable = false;
        boolean sCompatDrawableVisibilityDispatch = false;

        if (mDrawable != null) {
            sameDrawable = mDrawable == d;
            mDrawable.setCallback(null);
            unscheduleDrawable(mDrawable);
            if (!sCompatDrawableVisibilityDispatch && !sameDrawable && 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 (!sameDrawable || sCompatDrawableVisibilityDispatch) {
                final boolean visible = sCompatDrawableVisibilityDispatch
                        ? getVisibility() == VISIBLE
                        : isAttachedWindow && getWindowVisibility() == VISIBLE && isShown();
                d.setVisible(visible, true);
            }
            d.setLevel(mLevel);
            mDrawableWidth = d.getIntrinsicWidth();
            mDrawableHeight = d.getIntrinsicHeight();
//            applyImageTint();
//            applyColorMod();
//
//            configureBounds();
        } else {
            mDrawableWidth = mDrawableHeight = -1;
        }
    }
 
開發者ID:jeasinlee,項目名稱:AndroidBasicLibs,代碼行數:41,代碼來源:UpdateImageView.java

示例9: drawableStateChanged

import android.graphics.drawable.Drawable; //導入方法依賴的package包/類
@Override
protected void drawableStateChanged() {
    super.drawableStateChanged();
    Drawable d = mDrawable;
    if (d != null && d.isStateful()) {
        d.setState(getDrawableState());
    }
}
 
開發者ID:jeasinlee,項目名稱:AndroidBasicLibs,代碼行數:9,代碼來源:UpdateImageView.java

示例10: drawableStateChanged

import android.graphics.drawable.Drawable; //導入方法依賴的package包/類
@CallSuper
@Override
protected void drawableStateChanged() {
    super.drawableStateChanged();
    final Drawable selectionDivider = mSelectionDivider;
    if (selectionDivider != null && selectionDivider.isStateful()
            && selectionDivider.setState(getDrawableState())) {
        invalidateDrawable(selectionDivider);
    }
}
 
開發者ID:h6ah4i,項目名稱:android-numberpickercompat,代碼行數:11,代碼來源:NumberPicker.java

示例11: drawableStateChanged

import android.graphics.drawable.Drawable; //導入方法依賴的package包/類
protected void drawableStateChanged() {
    super.drawableStateChanged();
    Drawable d = this.mMarginDrawable;
    if (d != null && d.isStateful()) {
        d.setState(getDrawableState());
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:8,代碼來源:ViewPager.java

示例12: drawLeadingMargin

import android.graphics.drawable.Drawable; //導入方法依賴的package包/類
@Override
public void drawLeadingMargin(Canvas c, Paint p, int x, int dir, int top, int baseline, int bottom, CharSequence text, int start, int end, boolean first, Layout layout) {

    if (!first
            || !LeadingMarginUtils.selfStart(start, text, this)) {
        return;
    }

    final Drawable drawable = theme.getTaskListDrawable();
    if (drawable == null) {
        return;
    }

    final int save = c.save();
    try {

        final int width = theme.getBlockMargin();
        final int height = bottom - top;

        final int w = (int) (width * .75F + .5F);
        final int h = (int) (height * .75F + .5F);

        drawable.setBounds(0, 0, w, h);

        if (drawable.isStateful()) {
            final int[] state;
            if (isDone) {
                state = STATE_CHECKED;
            } else {
                state = STATE_NONE;
            }
            drawable.setState(state);
        }

        final int l;
        if (dir > 0) {
            l = x + (width * (blockIndent - 1)) + ((width - w) / 2);
        } else {
            l = x - (width * blockIndent) + ((width - w) / 2);
        }

        final int t = top + ((height - h) / 2);

        c.translate(l, t);
        drawable.draw(c);

    } finally {
        c.restoreToCount(save);
    }
}
 
開發者ID:noties,項目名稱:Markwon,代碼行數:51,代碼來源:TaskListSpan.java


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