diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2020-07-21 22:57:23 +0000 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2020-07-23 12:59:41 +0000 |
| commit | 494cad0d0f0b0ca2d3fb036d6c39df9d0f7b304f (patch) | |
| tree | 69e7a1d2542df7c0c9ff4906e9f7489b0b1f5e3f /android/src | |
| parent | 8cd1cd7ea4b610b3f0e1be4f4a8fee7b0fbf66aa (diff) | |
| download | mullvadvpn-494cad0d0f0b0ca2d3fb036d6c39df9d0f7b304f.tar.xz mullvadvpn-494cad0d0f0b0ca2d3fb036d6c39df9d0f7b304f.zip | |
Separate `text` styleable attribute
Diffstat (limited to 'android/src')
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/Button.kt | 9 | ||||
| -rw-r--r-- | android/src/main/res/values/attrs.xml | 6 |
2 files changed, 12 insertions, 3 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/Button.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/Button.kt index 9c2573664f..791b8caaa5 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/Button.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/Button.kt @@ -142,7 +142,6 @@ open class Button : FrameLayout { context.theme.obtainStyledAttributes(attributes, styleableId, 0, 0).apply { try { - button.text = getString(R.styleable.Button_text) ?: "" buttonColor = ButtonColor.fromCode(getInteger(R.styleable.Button_buttonColor, 0)) detailImage = getDrawable(R.styleable.Button_detailImage) showSpinner = getBoolean(R.styleable.Button_showSpinner, false) @@ -150,5 +149,13 @@ open class Button : FrameLayout { recycle() } } + + context.theme.obtainStyledAttributes(attributes, R.styleable.TextAttribute, 0, 0).apply { + try { + button.text = getString(R.styleable.TextAttribute_text) ?: "" + } finally { + recycle() + } + } } } diff --git a/android/src/main/res/values/attrs.xml b/android/src/main/res/values/attrs.xml index 449db0efd7..1ddae37ee7 100644 --- a/android/src/main/res/values/attrs.xml +++ b/android/src/main/res/values/attrs.xml @@ -13,8 +13,6 @@ format="reference" /> <attr name="showSpinner" format="boolean" /> - <attr name="text" - format="reference|string" /> </declare-styleable> <declare-styleable name="CopyableInformationView"> <attr name="clipboardLabel" @@ -41,6 +39,10 @@ value="2" /> </attr> </declare-styleable> + <declare-styleable name="TextAttribute"> + <attr name="text" + format="reference|string" /> + </declare-styleable> <declare-styleable name="UrlButton"> <attr name="url" format="reference|string" /> |
