com.wangjie.rapidfloatingactionbutton.constants.RFABSize Java Examples
The following examples show how to use
com.wangjie.rapidfloatingactionbutton.constants.RFABSize.
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: RapidFloatingActionButton.java From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License | 6 votes |
private void parserAttrs(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { final TypedArray a = context.obtainStyledAttributes( attrs, R.styleable.RapidFloatingActionButton, defStyleAttr, defStyleRes); try { identificationCode = a.getString(R.styleable.RapidFloatingActionButton_rfab_identification_code); if (null == identificationCode) { identificationCode = IDENTIFICATION_CODE_NONE; } buttonDrawable = a.getDrawable(R.styleable.RapidFloatingActionButton_rfab_drawable); normalColor = a.getColor(R.styleable.RapidFloatingActionButton_rfab_color_normal, getContext().getResources().getColor(R.color.rfab__color_background_normal)); pressedColor = a.getColor(R.styleable.RapidFloatingActionButton_rfab_color_pressed, getContext().getResources().getColor(R.color.rfab__color_background_pressed)); int sizeCode = a.getInt(R.styleable.RapidFloatingActionButton_rfab_size, RFABSize.NORMAL.getCode()); rfabProperties.setStandardSize(RFABSize.getRFABSizeByCode(sizeCode)); rfabProperties.setShadowColor(a.getInt(R.styleable.RapidFloatingActionButton_rfab_shadow_color, Color.TRANSPARENT)); rfabProperties.setShadowDx(a.getDimensionPixelSize(R.styleable.RapidFloatingActionButton_rfab_shadow_dx, 0)); rfabProperties.setShadowDy(a.getDimensionPixelSize(R.styleable.RapidFloatingActionButton_rfab_shadow_dy, 0)); rfabProperties.setShadowRadius(a.getDimensionPixelSize(R.styleable.RapidFloatingActionButton_rfab_shadow_radius, 0)); } finally { a.recycle(); } }
Example #2
Source File: RapidFloatingActionButton.java From RapidFloatingActionButton with Apache License 2.0 | 6 votes |
private void parserAttrs(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { final TypedArray a = context.obtainStyledAttributes( attrs, R.styleable.RapidFloatingActionButton, defStyleAttr, defStyleRes); try { identificationCode = a.getString(R.styleable.RapidFloatingActionButton_rfab_identification_code); if (null == identificationCode) { identificationCode = IDENTIFICATION_CODE_NONE; } buttonDrawable = a.getDrawable(R.styleable.RapidFloatingActionButton_rfab_drawable); normalColor = a.getColor(R.styleable.RapidFloatingActionButton_rfab_color_normal, getContext().getResources().getColor(R.color.rfab__color_background_normal)); pressedColor = a.getColor(R.styleable.RapidFloatingActionButton_rfab_color_pressed, getContext().getResources().getColor(R.color.rfab__color_background_pressed)); int sizeCode = a.getInt(R.styleable.RapidFloatingActionButton_rfab_size, RFABSize.NORMAL.getCode()); rfabProperties.setStandardSize(RFABSize.getRFABSizeByCode(sizeCode)); rfabProperties.setShadowColor(a.getInt(R.styleable.RapidFloatingActionButton_rfab_shadow_color, Color.TRANSPARENT)); rfabProperties.setShadowDx(a.getDimensionPixelSize(R.styleable.RapidFloatingActionButton_rfab_shadow_dx, 0)); rfabProperties.setShadowDy(a.getDimensionPixelSize(R.styleable.RapidFloatingActionButton_rfab_shadow_dy, 0)); rfabProperties.setShadowRadius(a.getDimensionPixelSize(R.styleable.RapidFloatingActionButton_rfab_shadow_radius, 0)); } finally { a.recycle(); } }
Example #3
Source File: CircleButtonProperties.java From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License | 4 votes |
public RFABSize getStandardSize() { return standardSize; }
Example #4
Source File: CircleButtonProperties.java From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License | 4 votes |
public CircleButtonProperties setStandardSize(RFABSize standardSize) { this.standardSize = standardSize; return this; }
Example #5
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 #6
Source File: CircleButtonProperties.java From RapidFloatingActionButton with Apache License 2.0 | 4 votes |
public RFABSize getStandardSize() { return standardSize; }
Example #7
Source File: CircleButtonProperties.java From RapidFloatingActionButton with Apache License 2.0 | 4 votes |
public CircleButtonProperties setStandardSize(RFABSize standardSize) { this.standardSize = standardSize; return this; }