当前位置: 首页>>代码示例>>Java>>正文


Java AppCompatDrawableManager类代码示例

本文整理汇总了Java中android.support.v7.widget.AppCompatDrawableManager的典型用法代码示例。如果您正苦于以下问题:Java AppCompatDrawableManager类的具体用法?Java AppCompatDrawableManager怎么用?Java AppCompatDrawableManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AppCompatDrawableManager类属于android.support.v7.widget包,在下文中一共展示了AppCompatDrawableManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: FloatingActionButton

import android.support.v7.widget.AppCompatDrawableManager; //导入依赖的package包/类
public FloatingActionButton(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    this.mShadowPadding = new Rect();
    ThemeUtils.checkAppCompatTheme(context);
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.FloatingActionButton, defStyleAttr, R.style.Widget_Design_FloatingActionButton);
    this.mBackgroundTint = a.getColorStateList(R.styleable.FloatingActionButton_backgroundTint);
    this.mBackgroundTintMode = parseTintMode(a.getInt(R.styleable.FloatingActionButton_backgroundTintMode, -1), null);
    this.mRippleColor = a.getColor(R.styleable.FloatingActionButton_rippleColor, 0);
    this.mSize = a.getInt(R.styleable.FloatingActionButton_fabSize, 0);
    this.mBorderWidth = a.getDimensionPixelSize(R.styleable.FloatingActionButton_borderWidth, 0);
    float elevation = a.getDimension(R.styleable.FloatingActionButton_elevation, 0.0f);
    float pressedTranslationZ = a.getDimension(R.styleable.FloatingActionButton_pressedTranslationZ, 0.0f);
    this.mCompatPadding = a.getBoolean(R.styleable.FloatingActionButton_useCompatPadding, false);
    a.recycle();
    this.mImageHelper = new AppCompatImageHelper(this, AppCompatDrawableManager.get());
    this.mImageHelper.loadFromAttributes(attrs, defStyleAttr);
    this.mImagePadding = (getSizeDimension() - ((int) getResources().getDimension(R.dimen.design_fab_image_size))) / 2;
    getImpl().setBackgroundDrawable(this.mBackgroundTint, this.mBackgroundTintMode, this.mRippleColor, this.mBorderWidth);
    getImpl().setElevation(elevation);
    getImpl().setPressedTranslationZ(pressedTranslationZ);
    getImpl().updatePadding();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:23,代码来源:FloatingActionButton.java

示例2: setPicasso

import android.support.v7.widget.AppCompatDrawableManager; //导入依赖的package包/类
public static void setPicasso(Context context, Uri url, ImageView imageView, @DrawableRes int placeHolder) {

        Picasso picasso = Picasso.with(context);

        if (BuildConfig.DEBUG)
            picasso.setLoggingEnabled(true);

        RequestCreator requestCreator = picasso.load(url);

        if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            requestCreator.placeholder(placeHolder);
            requestCreator.error(placeHolder);
        } else {
            Drawable drawable = AppCompatDrawableManager.get().getDrawable(context, placeHolder);
            requestCreator.placeholder(drawable);
            requestCreator.error(drawable);
        }

        requestCreator.into(imageView);
    }
 
开发者ID:pvarry,项目名称:intra42,代码行数:21,代码来源:mImage.java

示例3: init

import android.support.v7.widget.AppCompatDrawableManager; //导入依赖的package包/类
private void init(final AttributeSet attrs, final int defStyleAttr) {
    final TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), attrs,
            R.styleable.IcButtonStyle, defStyleAttr, 0);
    try {
        final AppCompatDrawableManager drawableManager = AppCompatDrawableManager.get();
        Drawable rightIcon = a.getDrawableIfKnown(R.styleable.IcButtonStyle_rightIcon);

        int id = a.getResourceId(R.styleable.IcButtonStyle_rightIcon, -1);
        if (id != -1) {
            rightIcon = drawableManager.getDrawable(getContext(), id);
        }
        Drawable topIcon = a.getDrawableIfKnown(R.styleable.IcButtonStyle_topIcon);
        id = a.getResourceId(R.styleable.IcButtonStyle_topIcon, -1);
        if (id != -1) {
            topIcon = drawableManager.getDrawable(getContext(), id);
        }

        setCompoundDrawablesWithIntrinsicBounds(null, topIcon, rightIcon, null);
    } finally {
        a.recycle();
    }
}
 
开发者ID:deniotokiari,项目名称:training-epam-2016,代码行数:23,代码来源:IcButton.java

示例4: renderMessageFromOthers

import android.support.v7.widget.AppCompatDrawableManager; //导入依赖的package包/类
private void renderMessageFromOthers(Message message) {
  User user = message.getUser();
  rootView.setGravity(Gravity.BOTTOM | Gravity.START);
  displayNameTextView.setVisibility(View.VISIBLE);
  avatarImageView.setVisibility(View.VISIBLE);

  imageLoader.builder()
      .load(user.getImageUrl())
      .placeHolder(AppCompatDrawableManager.get().getDrawable(avatarImageView.getContext(),
          R.drawable.ned_head_light))
      .into(avatarImageView)
      .circle()
      .show();

  displayNameTextView.setText(user.getName());
  displayPayLoad(message.getPayload());
  messageContainer.setBackgroundResource(R.drawable.background_message_from_others);
}
 
开发者ID:tonilopezmr,项目名称:Game-of-Thrones,代码行数:19,代码来源:MessageRenderer.java

示例5: displayPayLoad

import android.support.v7.widget.AppCompatDrawableManager; //导入依赖的package包/类
private void displayPayLoad(Payload payload) {
  if (payload instanceof ImagePayload) {
    ImagePayload imagePayload = (ImagePayload) payload;
    imageLoader.builder()
        .load(imagePayload.getImageMessage())
        .placeHolder(AppCompatDrawableManager.get().getDrawable(avatarImageView.getContext(),
            R.drawable.ned_head_light))
        .into(messageImageView)
        .show();
  } else {
    messageImageView.setVisibility(View.GONE);
  }

  TextPayLoad textPayload = (TextPayLoad) payload;
  Spannable textMessage = textPayload.getTextMessage();
  messageTextView.setText(textMessage);
}
 
开发者ID:tonilopezmr,项目名称:Game-of-Thrones,代码行数:18,代码来源:MessageRenderer.java

示例6: render

import android.support.v7.widget.AppCompatDrawableManager; //导入依赖的package包/类
@Override
public void render() {
  Message message = getContent();

  Uri sticker = ((StickerPayLoad) message.getPayload()).getSticker();
  stickerImageView.setImageURI(sticker);

  if (message.isFromMe()) {
    avatarImageView.setVisibility(View.GONE);
    rootView.setGravity(Gravity.BOTTOM | Gravity.END);
  } else {
    avatarImageView.setVisibility(View.VISIBLE);
    rootView.setGravity(Gravity.BOTTOM | Gravity.START);

    imageLoader.builder()
        .load(message.getUser().getImageUrl())
        .placeHolder(AppCompatDrawableManager.get().getDrawable(avatarImageView.getContext(),
            R.drawable.ned_head_light))
        .into(avatarImageView)
        .circle()
        .show();
  }
}
 
开发者ID:tonilopezmr,项目名称:Game-of-Thrones,代码行数:24,代码来源:StickerRenderer.java

示例7: onApplySupportImageTint

import android.support.v7.widget.AppCompatDrawableManager; //导入依赖的package包/类
private void onApplySupportImageTint() {
  Drawable drawable = getDrawable();
  if (drawable == null) {
    return;
  }

  if (imageTint == null) {
    DrawableCompat.clearColorFilter(drawable);
    return;
  }

  int color = imageTint.getColorForState(getDrawableState(), Color.TRANSPARENT);
  Mode mode = imageMode;
  if (mode == null) {
    mode = Mode.SRC_IN;
  }

  drawable
      .mutate()
      .setColorFilter(AppCompatDrawableManager.getPorterDuffColorFilter(color, mode));
}
 
开发者ID:material-components,项目名称:material-components-android,代码行数:22,代码来源:FloatingActionButton.java

示例8: getBitmapFromVectorDrawable

import android.support.v7.widget.AppCompatDrawableManager; //导入依赖的package包/类
public static Bitmap getBitmapFromVectorDrawable(Context context, int drawableId, float scale) {
  Drawable drawable = AppCompatDrawableManager.get().getDrawable(context, drawableId);
  int scaledWidth = (int)(drawable.getIntrinsicWidth() * scale);
  int scaledHeight = (int)(drawable.getIntrinsicHeight() * scale);

  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
    drawable = (DrawableCompat.wrap(drawable)).mutate();
  }

  Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
  Canvas canvas = new Canvas(bitmap);
  drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
  drawable.draw(canvas);

  Bitmap bitmapResized = Bitmap.createScaledBitmap(bitmap, scaledWidth, scaledHeight, false);
  bitmap.recycle();

  return bitmapResized;
}
 
开发者ID:eleith,项目名称:calchoochoo,代码行数:20,代码来源:DrawableUtils.java

示例9: setNavButtonDrawable

import android.support.v7.widget.AppCompatDrawableManager; //导入依赖的package包/类
public static void setNavButtonDrawable(Context context, ImageButton left, ImageButton right,
                                        int monthTextAppearanceResId) {
    // Retrieve the previous and next drawables
    AppCompatDrawableManager dm = AppCompatDrawableManager.get();
    Drawable prevDrawable = dm.getDrawable(context, R.drawable.ic_chevron_left_black_24dp);
    Drawable nextDrawable = dm.getDrawable(context, R.drawable.ic_chevron_right_black_24dp);

    // Proxy the month text color into the previous and next drawables.
    final TypedArray ta = context.obtainStyledAttributes(null,
            new int[]{android.R.attr.textColor}, 0, monthTextAppearanceResId);
    final ColorStateList monthColor = ta.getColorStateList(0);
    if (monthColor != null) {
        DrawableCompat.setTint(DrawableCompat.wrap(prevDrawable), monthColor.getDefaultColor());
        DrawableCompat.setTint(DrawableCompat.wrap(nextDrawable), monthColor.getDefaultColor());
    }
    ta.recycle();

    // Set the previous and next drawables
    left.setImageDrawable(prevDrawable);
    right.setImageDrawable(nextDrawable);
}
 
开发者ID:TR4Android,项目名称:AppCompat-Extension-Library,代码行数:22,代码来源:PickerThemeUtils.java

示例10: init

import android.support.v7.widget.AppCompatDrawableManager; //导入依赖的package包/类
private void init(Context context, AttributeSet attributeSet) {
    mButtonSpacing = getResources().getDimensionPixelSize(R.dimen.fam_spacing);
    mLabelsMargin = getResources().getDimensionPixelSize(R.dimen.fam_label_spacing);
    mLabelsVerticalOffset = 0;

    TypedArray attr = context.obtainStyledAttributes(attributeSet, R.styleable.FloatingActionMenu, 0, 0);
    mExpandDirection = attr.getInt(R.styleable.FloatingActionMenu_fabMenuExpandDirection, EXPAND_UP);
    mLabelsPosition = attr.getInt(R.styleable.FloatingActionMenu_fabMenuLabelPosition, LABELS_ON_LEFT_SIDE);
    mLabelsStyle = attr.getResourceId(R.styleable.FloatingActionMenu_fabMenuLabelStyle, 0);
    int mCloseDrawableResourceId = attr.getResourceId(R.styleable.FloatingActionMenu_fabMenuCloseIconSrc, 0);
    mCloseDrawable = mCloseDrawableResourceId == 0 ? null : AppCompatDrawableManager.get().getDrawable(getContext(), mCloseDrawableResourceId);
    mCloseAngle = attr.getFloat(R.styleable.FloatingActionMenu_fabMenuCloseIconAngle, 0);
    mButtonSpacing = attr.getDimensionPixelSize(R.styleable.FloatingActionMenu_fabMenuSpacing, mButtonSpacing);
    attr.recycle();

    if (mLabelsStyle != 0 && expandsHorizontally()) {
        throw new IllegalStateException("Action labels in horizontal expand orientation is not supported.");
    }

    // So we can catch the back button
    setFocusableInTouchMode(true);
}
 
开发者ID:TR4Android,项目名称:AppCompat-Extension-Library,代码行数:23,代码来源:FloatingActionMenu.java

示例11: init

import android.support.v7.widget.AppCompatDrawableManager; //导入依赖的package包/类
private void init(Context context, AttributeSet attrs) {
    final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.AnimatedPencil);
    if (typedArray != null) {
        color = typedArray.getColor(R.styleable.AnimatedPencil_pencil_color, color);
        typedArray.recycle();
    }
    imageView = new AppCompatImageView(getContext());
    addView(imageView, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    drawable = AppCompatDrawableManager.get().getDrawable(getContext(), R.drawable.awsb_ic_edit_animated_24);
    drawable = DrawableCompat.wrap(drawable).mutate();
    DrawableCompat.setTint(drawable, color);
    imageView.setImageDrawable(drawable);
}
 
开发者ID:florent37,项目名称:AnimatedPencil,代码行数:14,代码来源:AnimatedPencil.java

示例12: getVectorDrawable

import android.support.v7.widget.AppCompatDrawableManager; //导入依赖的package包/类
public static @Nullable Drawable getVectorDrawable(Context context, @DrawableRes int resVector) {
    try {
        return AppCompatDrawableManager.get().getDrawable(context, resVector);
    } catch (Exception e) {
        QMUILog.d(TAG, "Error in getVectorDrawable. resVector=" + resVector + ", resName=" + context.getResources().getResourceName(resVector) + e.getMessage());
        return null;
    }
}
 
开发者ID:coopese,项目名称:qmui,代码行数:9,代码来源:QMUIDrawableHelper.java

示例13: getBitmapFromVectorDrawable

import android.support.v7.widget.AppCompatDrawableManager; //导入依赖的package包/类
public Bitmap getBitmapFromVectorDrawable(Context context, int drawableId) {
    Drawable drawable = AppCompatDrawableManager.get().getDrawable(context, drawableId);
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        drawable = (DrawableCompat.wrap(drawable)).mutate();
    }

    Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(),
            drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
    drawable.draw(canvas);

    return bitmap;
}
 
开发者ID:cahergil,项目名称:Farmacias,代码行数:15,代码来源:ImageUtils.java

示例14: getDrawableInt

import android.support.v7.widget.AppCompatDrawableManager; //导入依赖的package包/类
@Nullable
public static int getDrawableInt(@NonNull Context context, @DrawableRes int res)
{
	Drawable drawable = AppCompatDrawableManager.get().getDrawable(context, res);
	drawable.mutate();
	
	return res;
}
 
开发者ID:MSay2,项目名称:Mire,代码行数:9,代码来源:DrawableHelpers.java

示例15: getTintedDrawableInt

import android.support.v7.widget.AppCompatDrawableManager; //导入依赖的package包/类
@Nullable
public static int getTintedDrawableInt(@NonNull Context context, @DrawableRes int res, @ColorInt int color)
{
	Drawable drawable = AppCompatDrawableManager.get().getDrawable(context, res);
	drawable.setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
	drawable.mutate();

	return res;
}
 
开发者ID:MSay2,项目名称:Mire,代码行数:10,代码来源:DrawableHelpers.java


注:本文中的android.support.v7.widget.AppCompatDrawableManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。