diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2021-02-10 18:19:49 +0000 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2021-02-11 17:51:24 +0000 |
| commit | bbd5bca10ad09eae3789b505ab25aa168be80e55 (patch) | |
| tree | 340dd8b84f1c77bed5f13bb41f56d0fcb4c0b94a | |
| parent | 22f628d568b51d8680c46bb903305772fddab600 (diff) | |
| download | mullvadvpn-bbd5bca10ad09eae3789b505ab25aa168be80e55.tar.xz mullvadvpn-bbd5bca10ad09eae3789b505ab25aa168be80e55.zip | |
Use `JvmOverloads` annotation in `Cell`
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/Cell.kt | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/Cell.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/Cell.kt index d65875696d..54f35fd519 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/Cell.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/Cell.kt @@ -61,38 +61,19 @@ open class Cell : LinearLayout { var onClickListener: (() -> Unit)? = null - constructor(context: Context, footer: TextView? = null) : super(context) { - this.footer = footer - } - - constructor(context: Context, attributes: AttributeSet, footer: TextView? = null) : - super(context, attributes) { - this.footer = footer - loadAttributes(attributes) - } - - constructor( - context: Context, - attributes: AttributeSet, - defaultStyleAttribute: Int, - footer: TextView? = null - ) : super(context, attributes, defaultStyleAttribute) { - this.footer = footer - loadAttributes(attributes) - } - + @JvmOverloads constructor( context: Context, - attributes: AttributeSet, - defaultStyleAttribute: Int, - defaultStyleResource: Int, + attributes: AttributeSet? = null, + defaultStyleAttribute: Int = 0, + defaultStyleResource: Int = 0, footer: TextView? = null ) : super(context, attributes, defaultStyleAttribute, defaultStyleResource) { this.footer = footer loadAttributes(attributes) } - private fun loadAttributes(attributes: AttributeSet) { + private fun loadAttributes(attributes: AttributeSet?) { context.theme.obtainStyledAttributes(attributes, R.styleable.TextAttribute, 0, 0).apply { try { label.text = getString(R.styleable.TextAttribute_text) ?: "" |
