com.wangjie.rapidfloatingactionbutton.widget.CircleButtonProperties Java Examples
The following examples show how to use
com.wangjie.rapidfloatingactionbutton.widget.CircleButtonProperties.
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 check out the related API usage on the sidebar.
Example #1
Source File: MyRapidFloatingActionContentLabelList.java From nono-android with GNU General Public License v3.0 | 4 votes |
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 #2
Source File: RapidFloatingActionButton.java From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License | 2 votes |
/** * 返回图片属性对象,可以通过调用这个 * * @return */ public CircleButtonProperties getRfabProperties() { return rfabProperties; }
Example #3
Source File: RapidFloatingActionButton.java From RapidFloatingActionButton with Apache License 2.0 | 2 votes |
/** * 返回图片属性对象,可以通过调用这个 * * @return */ public CircleButtonProperties getRfabProperties() { return rfabProperties; }