diff options
Diffstat (limited to 'android/src')
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/AppVersionCell.kt | 38 |
1 files changed, 9 insertions, 29 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/AppVersionCell.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/AppVersionCell.kt index f3508847d1..978a8b1505 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/AppVersionCell.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/AppVersionCell.kt @@ -1,7 +1,6 @@ package net.mullvad.mullvadvpn.ui.widget import android.content.Context -import android.content.Intent import android.graphics.Typeface import android.net.Uri import android.util.AttributeSet @@ -12,7 +11,7 @@ import android.widget.TextView import kotlin.properties.Delegates.observable import net.mullvad.mullvadvpn.R -class AppVersionCell : Cell { +class AppVersionCell : UrlCell { private val warningIcon = ImageView(context).apply { val iconSize = resources.getDimensionPixelSize(R.dimen.app_version_warning_icon_size) @@ -40,13 +39,6 @@ class AppVersionCell : Cell { text = "" } - private val externalLinkIcon = ImageView(context).apply { - layoutParams = LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 0.0f) - alpha = 0.6f - - setImageResource(R.drawable.icon_extlink) - } - var updateAvailable by observable(false) { _, _, updateAvailable -> if (updateAvailable) { warningIcon.visibility = VISIBLE @@ -61,32 +53,20 @@ class AppVersionCell : Cell { versionLabel.text = version } - constructor(context: Context) : super(context) {} - - constructor(context: Context, attributes: AttributeSet) : super(context, attributes) {} - - constructor(context: Context, attributes: AttributeSet, defaultStyleAttribute: Int) : - super(context, attributes, defaultStyleAttribute) {} - + @JvmOverloads constructor( context: Context, - attributes: AttributeSet, - defaultStyleAttribute: Int, - defaultStyleResource: Int + attributes: AttributeSet? = null, + defaultStyleAttribute: Int = 0, + defaultStyleResource: Int = 0 ) : super(context, attributes, defaultStyleAttribute, defaultStyleResource) {} init { cell.addView(warningIcon, 0) - cell.addView(versionLabel) - cell.addView(externalLinkIcon) - - onClickListener = { openLink() } - } + cell.addView(versionLabel, cell.getChildCount() - 1) - private fun openLink() { - val url = context.getString(R.string.download_url) - val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url)) - - context.startActivity(intent) + if (url == null) { + url = Uri.parse(context.getString(R.string.download_url)) + } } } |
