android.support.v7.widget.AppCompatImageHelper的实例源码

项目:boohee_v5.6    文件:FloatingActionButton.java   
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();
}
项目:Carbon    文件:ImageView.java   
private void initImageView(AttributeSet attrs,int defStyleAttr) {
    TypedArray a = getContext().obtainStyledAttributes(attrs,R.styleable.ImageView,R.style.carbon_ImageView);

    for (int i = 0; i < a.getIndexCount(); i++) {
        int attr = a.getIndex(i);
        if (attr == R.styleable.ImageView_android_src) {
            int resId = a.getResourceId(attr,0);
            if (resId != 0 && getContext().getResources().getResourceTypeName(resId).equals("raw")) {
                if (!isInEditMode()) {
                    setImageDrawable(new VectorDrawable(getResources(),resId));
                } else {
                    setImageResource(R.drawable.carbon_iconplaceholder);
                }
            }
        } else if (attr == R.styleable.ImageView_android_enabled) {
            setEnabled(a.getBoolean(attr,true));
        } else if (attr == R.styleable.ImageView_carbon_cornerRadius) {
            setCornerRadius(a.getDimension(attr,0));
        }
    }

    new AppCompatImageHelper(this).loadFromAttributes(attrs,defStyleAttr);

    Carbon.initDefaultBackground(this,a,R.styleable.ImageView_android_background);

    Carbon.initElevation(this,elevationIds);
    Carbon.initRippleDrawable(this,rippleIds);
    Carbon.initAnimations(this,animationIds);
    Carbon.initTouchMargin(this,touchMarginIds);
    Carbon.initTint(this,tintIds);
    Carbon.initStroke(this,strokeIds);

    a.recycle();
}
项目:iosched    文件:FloatingActionButton.java   
public FloatingActionButton(Context context,int defStyleAttr) {
  super(context,defStyleAttr);

  ThemeUtils.checkAppCompatTheme(context);

  TypedArray a =
      context.obtainStyledAttributes(
          attrs,R.style.Widget_Design_FloatingActionButton);
  mBackgroundTint = a.getColorStateList(R.styleable.FloatingActionButton_backgroundTint);
  mBackgroundTintMode =
      ViewUtils.parseTintMode(
          a.getInt(R.styleable.FloatingActionButton_backgroundTintMode,null);
  mRippleColor = a.getColor(R.styleable.FloatingActionButton_rippleColor,0);
  mSize = a.getInt(R.styleable.FloatingActionButton_fabSize,SIZE_AUTO);
  mBorderWidth = a.getDimensionPixelSize(R.styleable.FloatingActionButton_borderWidth,0);
  final float elevation = a.getDimension(R.styleable.FloatingActionButton_elevation,0f);
  final float pressedTranslationZ =
      a.getDimension(R.styleable.FloatingActionButton_pressedTranslationZ,0f);
  mCompatPadding = a.getBoolean(R.styleable.FloatingActionButton_useCompatPadding,false);
  a.recycle();

  mImageHelper = new AppCompatImageHelper(this);
  mImageHelper.loadFromAttributes(attrs,defStyleAttr);

  mMaxImageSize = (int) getResources().getDimension(R.dimen.design_fab_image_size);

  getImpl()
      .setBackgroundDrawable(mBackgroundTint,mBackgroundTintMode,mRippleColor,mBorderWidth);
  getImpl().setElevation(elevation);
  getImpl().setPressedTranslationZ(pressedTranslationZ);
}
项目:material-components-android    文件:FloatingActionButton.java   
public FloatingActionButton(Context context,defStyleAttr);

  ThemeEnforcement.checkAppCompatTheme(context);

  TypedArray a =
      context.obtainStyledAttributes(
          attrs,R.style.Widget_Design_FloatingActionButton);
  backgroundTint =
      MaterialResources.getColorStateList(
          context,R.styleable.FloatingActionButton_backgroundTint);
  backgroundTintMode =
      ViewUtils.parseTintMode(
          a.getInt(R.styleable.FloatingActionButton_backgroundTintMode,null);
  rippleColor =
      MaterialResources.getColorStateList(
          context,R.styleable.FloatingActionButton_rippleColor);
  size = a.getInt(R.styleable.FloatingActionButton_fabSize,SIZE_AUTO);
  customSize =
      a.getDimensionPixelSize(R.styleable.FloatingActionButton_fabCustomSize,NO_CUSTOM_SIZE);
  borderWidth = a.getDimensionPixelSize(R.styleable.FloatingActionButton_borderWidth,0f);
  final float hoveredFocusedTranslationZ =
      a.getDimension(R.styleable.FloatingActionButton_hoveredFocusedTranslationZ,0f);
  compatPadding = a.getBoolean(R.styleable.FloatingActionButton_useCompatPadding,false);
  maxImageSize = a.getDimensionPixelSize(R.styleable.FloatingActionButton_maxImageSize,0);

  MotionSpec showMotionSpec =
      MotionSpec.createFromAttribute(
          context,R.styleable.FloatingActionButton_showMotionSpec);
  MotionSpec hideMotionSpec =
      MotionSpec.createFromAttribute(
          context,R.styleable.FloatingActionButton_hideMotionSpec);

  a.recycle();

  imageHelper = new AppCompatImageHelper(this);
  imageHelper.loadFromAttributes(attrs,defStyleAttr);

  expandableWidgetHelper = new ExpandableWidgetHelper(this);

  getImpl().setBackgroundDrawable(backgroundTint,backgroundTintMode,rippleColor,borderWidth);
  getImpl().setElevation(elevation);
  getImpl().setHoveredFocusedTranslationZ(hoveredFocusedTranslationZ);
  getImpl().setPressedTranslationZ(pressedTranslationZ);
  getImpl().setMaxImageSize(maxImageSize);
  getImpl().setShowMotionSpec(showMotionSpec);
  getImpl().setHideMotionSpec(hideMotionSpec);

  setScaleType(ScaleType.MATRIX);
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


com.google.gson.internal.bind.ArrayTypeAdapter的实例源码
com.google.gson.JsonSyntaxException的实例源码
com.google.gson.JsonDeserializer的实例源码
com.google.gson.internal.ConstructorConstructor的实例源码
com.google.gson.JsonPrimitive的实例源码
com.google.gson.LongSerializationPolicy的实例源码
com.google.gson.internal.GsonInternalAccess的实例源码
com.google.gson.JsonIOException的实例源码
com.google.gson.internal.StringMap的实例源码
com.google.gson.JsonObject的实例源码
com.google.gson.internal.bind.TimeTypeAdapter的实例源码
com.google.gson.FieldAttributes的实例源码
com.google.gson.internal.bind.TreeTypeAdapter的实例源码
com.google.gson.internal.LinkedHashTreeMap的实例源码
com.google.gson.TypeAdapterFactory的实例源码
com.google.gson.JsonSerializer的实例源码
com.google.gson.FieldNamingPolicy的实例源码
com.google.gson.JsonElement的实例源码
com.google.gson.internal.JsonReaderInternalAccess的实例源码
com.google.gson.TypeAdapter的实例源码