Java Code Examples for android.widget.ImageView#setLayerType()

The following examples show how to use android.widget.ImageView#setLayerType() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
@Override
public boolean onException(Exception e, T model, Target<PictureDrawable> target, boolean isFirstResource) {
    ImageView view = ((ImageViewTarget<?>) target).getView();
    if (Build.VERSION_CODES.HONEYCOMB <= Build.VERSION.SDK_INT) {
        view.setLayerType(ImageView.LAYER_TYPE_NONE, null);
    }
    return false;
}
 
Example 2
@Override
public boolean onResourceReady(PictureDrawable resource, T model, Target<PictureDrawable> target,
                               boolean isFromMemoryCache, boolean isFirstResource) {
    ImageView view = ((ImageViewTarget<?>) target).getView();
    if (Build.VERSION_CODES.HONEYCOMB <= Build.VERSION.SDK_INT) {
        view.setLayerType(ImageView.LAYER_TYPE_SOFTWARE, null);
    }
    return false;
}
 
Example 3
@Override
public boolean onLoadFailed(GlideException e, Object model, Target<PictureDrawable> target,
                            boolean isFirstResource) {
    ImageView view = ((ImageViewTarget<?>) target).getView();
    view.setLayerType(ImageView.LAYER_TYPE_NONE, null);

    if (customListener != null) {
        customListener.onLoadFailed();
    }
    return false;
}
 
Example 4
@Override
public boolean onResourceReady(PictureDrawable resource, Object model,
                               Target<PictureDrawable> target, DataSource dataSource, boolean isFirstResource) {
    ImageView view = ((ImageViewTarget<?>) target).getView();
    view.setLayerType(ImageView.LAYER_TYPE_SOFTWARE, null);

    if (customListener != null) {
        customListener.onResourceReady();
    }

    return false;
}
 
Example 5
@Override
public boolean onException(Exception e, T model, Target<PictureDrawable> target,
                           boolean isFirstResource) {
    ImageView view = ((ImageViewTarget<?>) target).getView();
    if (Build.VERSION_CODES.HONEYCOMB <= Build.VERSION.SDK_INT) {
        view.setLayerType(ImageView.LAYER_TYPE_NONE, null);
    }
    return false;
}
 
Example 6
@Override
public boolean onResourceReady(PictureDrawable resource, T model
        , Target<PictureDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
    ImageView view = ((ImageViewTarget<?>) target).getView();
    if (Build.VERSION_CODES.HONEYCOMB <= Build.VERSION.SDK_INT) {
        view.setLayerType(ImageView.LAYER_TYPE_SOFTWARE, null);
    }
    return false;
}
 
Example 7
private void refreshItems() {
    if(ABTextUtil.isEmpty(this.items)) {
        throw new RuntimeException(this.getClass().getSimpleName() + "[items] can not be empty!");
    } else {
        this.contentView.removeAllViews();
        int i = 0;

        for(int size = this.items.size(); i < size; ++i) {
            RFACLabelItem item = (RFACLabelItem)this.items.get(i);
            View itemView = LayoutInflater.from(this.getContext()).inflate(com.wangjie.rapidfloatingactionbutton.R.layout.rfab__content_label_list_item, (ViewGroup)null);
            View rootView = (ABViewUtil.obtainView(itemView, com.wangjie.rapidfloatingactionbutton.R.id.rfab__content_label_list_root_view));
            TextView labelTv = (TextView)ABViewUtil.obtainView(itemView, com.wangjie.rapidfloatingactionbutton.R.id.rfab__content_label_list_label_tv);
            ImageView iconIv = (ImageView)ABViewUtil.obtainView(itemView, com.wangjie.rapidfloatingactionbutton.R.id.rfab__content_label_list_icon_iv);
            rootView.setOnClickListener(this);
            labelTv.setOnClickListener(this);
            iconIv.setOnClickListener(this);
            rootView.setTag(com.wangjie.rapidfloatingactionbutton.R.id.rfab__id_content_label_list_item_position, Integer.valueOf(i));
            labelTv.setTag(com.wangjie.rapidfloatingactionbutton.R.id.rfab__id_content_label_list_item_position, Integer.valueOf(i));
            iconIv.setTag(com.wangjie.rapidfloatingactionbutton.R.id.rfab__id_content_label_list_item_position, Integer.valueOf(i));
            CircleButtonProperties circleButtonProperties = (new CircleButtonProperties()).setStandardSize(RFABSize.MINI).setShadowColor(this.iconShadowColor).setShadowRadius(this.iconShadowRadius).setShadowDx(this.iconShadowDx).setShadowDy(this.iconShadowDy);
            int shadowOffsetHalf = circleButtonProperties.getShadowOffsetHalf();
            int minPadding = ABTextUtil.dip2px(this.getContext(), 8.0F);
            int realItemSize;
            if(shadowOffsetHalf < minPadding) {
                realItemSize = minPadding - shadowOffsetHalf;
                rootView.setPadding(0, realItemSize, 0, realItemSize);
            }

            realItemSize = circleButtonProperties.getRealSizePx(this.getContext());
            android.widget.LinearLayout.LayoutParams lp = (android.widget.LinearLayout.LayoutParams)iconIv.getLayoutParams();
            if(null == lp) {
                lp = new android.widget.LinearLayout.LayoutParams(-2, -2);
            }

            int rfabRealSize = this.onRapidFloatingActionListener.obtainRFAButton().getRfabProperties().getRealSizePx(this.getContext());
            lp.rightMargin = (rfabRealSize - realItemSize) / 2;
            lp.width = realItemSize;
            lp.height = realItemSize;
            iconIv.setLayoutParams(lp);
            Integer normalColor = item.getIconNormalColor();
            Integer pressedColor = item.getIconPressedColor();
            CircleButtonDrawable rfacNormalDrawable = new CircleButtonDrawable(this.getContext(), circleButtonProperties, null == normalColor?this.getResources().getColor(com.wangjie.rapidfloatingactionbutton.R.color.rfab__color_background_normal):normalColor.intValue());
            CircleButtonDrawable rfacPressedDrawable = new CircleButtonDrawable(this.getContext(), circleButtonProperties, null == pressedColor?this.getResources().getColor(com.wangjie.rapidfloatingactionbutton.R.color.rfab__color_background_pressed):pressedColor.intValue());
            if(Build.VERSION.SDK_INT > 11) {
                iconIv.setLayerType(1, rfacNormalDrawable.getPaint());
            }

            ABViewUtil.setBackgroundDrawable(iconIv, ABShape.selectorClickSimple(rfacNormalDrawable, rfacPressedDrawable));
            int padding = ABTextUtil.dip2px(this.getContext(), 8.0F) + shadowOffsetHalf;
            iconIv.setPadding(padding, padding, padding, padding);
            String label = item.getLabel();
            if(ABTextUtil.isEmpty(label)) {
                labelTv.setVisibility(GONE);
            } else {
                if(item.isLabelTextBold()) {
                    labelTv.getPaint().setFakeBoldText(true);
                }

                labelTv.setVisibility(VISIBLE);
                labelTv.setText(label);
                Drawable resId = item.getLabelBackgroundDrawable();
                if(null != resId) {
                    ABViewUtil.setBackgroundDrawable(labelTv, resId);
                }

                Integer drawable = item.getLabelColor();
                if(null != drawable) {
                    labelTv.setTextColor(drawable.intValue());
                }

                Integer labelSize = item.getLabelSizeSp();
                if(null != labelSize) {
                    labelTv.setTextSize(2, (float)labelSize.intValue());
                }
            }

            Drawable var23 = item.getDrawable();
            if(null != var23) {
                iconIv.setVisibility(VISIBLE);
                var23.setBounds(0, 0, this.rfacItemDrawableSizePx, this.rfacItemDrawableSizePx);
                iconIv.setImageDrawable(var23);
            } else {
                int var24;
                if((var24 = item.getResId()) > 0) {
                    iconIv.setVisibility(VISIBLE);
                    iconIv.setImageDrawable(ABImageProcess.getResourceDrawableBounded(this.getContext(), var24, this.rfacItemDrawableSizePx));
                } else {
                    iconIv.setVisibility(GONE);
                }
            }

            this.contentView.addView(itemView);
        }

    }
}
 
Example 8
public Holder(View view) {
    imageView = (ImageView) view.findViewById(R.id.image1);
    imageView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    textView = (TextView) view.findViewById(R.id.text1);
}