Skip to content

Commit

Permalink
Merge pull request #9 from vaccum121/master
Browse files Browse the repository at this point in the history
Added possibility to change corner radius
  • Loading branch information
igalata committed May 18, 2017
2 parents eddc519 + eafbaba commit 5e7f141
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ public FilterItem createView(int position, Tag item) {

filterItem.setStrokeColor(mColors[0]);
filterItem.setTextColor(mColors[0]);
filterItem.setCornerRadius(14);
filterItem.setCheckedTextColor(ContextCompat.getColor(ExampleActivity.this, android.R.color.white));
filterItem.setColor(ContextCompat.getColor(ExampleActivity.this, android.R.color.white));
filterItem.setCheckedColor(mColors[position]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ class FilterItem : FrameLayout, Serializable {
var collapsedSize: Int = 0
get() = viewLeft.width

var cornerRadius: Float = 100f
set(value) {
field = value
updateBackground()
}
internal var fullSize: Int = 0
internal var listener: FilterItemListener? = null

Expand Down Expand Up @@ -190,7 +195,7 @@ class FilterItem : FrameLayout, Serializable {
val strokeColor = if (isFilterSelected) color else removeAlpha(strokeColor)

val drawable: GradientDrawable = GradientDrawable()
drawable.cornerRadius = 100.toFloat()
drawable.cornerRadius = cornerRadius

if (color != null) {
drawable.setColor(color)
Expand Down

0 comments on commit 5e7f141

Please sign in to comment.