com.wangjie.androidbucket.utils.imageprocess.ABShape Java Examples
The following examples show how to use
com.wangjie.androidbucket.utils.imageprocess.ABShape.
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: FeedAdapter.java From RxAndroidEventsSample with Apache License 2.0 | 6 votes |
@Override public ABRecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = View.inflate(context, R.layout.feed_rv_item, null); ABRecyclerViewHolder holder = new ABRecyclerViewHolder(view); View rootView = holder.obtainView(R.id.feed_rv_item_root_view); ABViewUtil.setBackgroundDrawable(rootView, ABShape.selectorClickColorCornerSimple(0xffffffff, 0xffefefef, 0)); ViewGroup.LayoutParams lp = view.getLayoutParams(); if(null == lp){ lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); } lp.width = ViewGroup.LayoutParams.MATCH_PARENT; lp.height = ViewGroup.LayoutParams.WRAP_CONTENT; view.setLayoutParams(lp); rootView.setOnClickListener(view1 -> { if (null != onFeedAdapterListener) { int position = holder.getAdapterPosition(); onFeedAdapterListener.onFeedItemClick(position, list.get(position)); } }); return holder; }
Example #2
Source File: MainActivity.java From WaveCompat with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); WaveTouchHelper.bindWaveTouchHelper(aTv, this); WaveTouchHelper.bindWaveTouchHelper(bTv, this); WaveTouchHelper.bindWaveTouchHelper(cTv, this); WaveTouchHelper.bindWaveTouchHelper(dTv, this); WaveTouchHelper.bindWaveTouchHelper(eTv, this); ABViewUtil.setBackgroundDrawable(eTv, ABShape.selectorClickColorCornerSimple(0xff218868, 0x88218868, 0)); }
Example #3
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); } } }