Commit 8b0c8168 authored by Mygod's avatar Mygod

Use JvmOverloads for BoundedGridLayout

parent 020a2a5d
...@@ -28,12 +28,13 @@ import com.github.shadowsocks.R ...@@ -28,12 +28,13 @@ import com.github.shadowsocks.R
/** /**
* Based on: http://stackoverflow.com/a/6212120/2245107 * Based on: http://stackoverflow.com/a/6212120/2245107
*/ */
class BoundedGridLayout(context: Context, attrs: AttributeSet) : GridLayout(context, attrs) { class BoundedGridLayout @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0,
defStyleRes: Int = 0) : GridLayout(context, attrs, defStyleAttr) {
private val boundedWidth: Int private val boundedWidth: Int
private val boundedHeight: Int private val boundedHeight: Int
init { init {
val arr = context.obtainStyledAttributes(attrs, R.styleable.BoundedGridLayout) val arr = context.obtainStyledAttributes(attrs, R.styleable.BoundedGridLayout, defStyleAttr, defStyleRes)
boundedWidth = arr.getDimensionPixelSize(R.styleable.BoundedGridLayout_bounded_width, 0) boundedWidth = arr.getDimensionPixelSize(R.styleable.BoundedGridLayout_bounded_width, 0)
boundedHeight = arr.getDimensionPixelSize(R.styleable.BoundedGridLayout_bounded_height, 0) boundedHeight = arr.getDimensionPixelSize(R.styleable.BoundedGridLayout_bounded_height, 0)
arr.recycle() arr.recycle()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment