From e56c6ad189efb4e09519b2201f6d8c470dbeb5e8 Mon Sep 17 00:00:00 2001 From: Quentin Marciset Date: Wed, 15 Dec 2021 09:51:22 +0100 Subject: [PATCH 1/3] Implement Android version and move iOS sources --- android/Formatters/UrlAction.kt | 16 ++++++++++++++++ .../Sources}/Formatters/UILabel+url.swift | 0 2 files changed, 16 insertions(+) create mode 100644 android/Formatters/UrlAction.kt rename {Sources => ios/Sources}/Formatters/UILabel+url.swift (100%) diff --git a/android/Formatters/UrlAction.kt b/android/Formatters/UrlAction.kt new file mode 100644 index 0000000..fa66a67 --- /dev/null +++ b/android/Formatters/UrlAction.kt @@ -0,0 +1,16 @@ +package ___PACKAGE___ + +import android.content.Intent +import android.net.Uri +import android.widget.TextView +import androidx.databinding.BindingAdapter + +@BindingAdapter("urlAction") +fun urlAction(view: TextView, urlAction: String?) { + if (urlAction.isNullOrEmpty()) return + + view.setOnClickListener { + val urlIntent = Intent(Intent.ACTION_VIEW, Uri.parse(urlAction)) + view.context.startActivity(Intent.createChooser(urlIntent, "Url")) + } +} diff --git a/Sources/Formatters/UILabel+url.swift b/ios/Sources/Formatters/UILabel+url.swift similarity index 100% rename from Sources/Formatters/UILabel+url.swift rename to ios/Sources/Formatters/UILabel+url.swift From 03857a6ea12c1573291c6b938a34d9b81480ed90 Mon Sep 17 00:00:00 2001 From: Quentin Marciset Date: Fri, 28 Jan 2022 14:50:43 +0100 Subject: [PATCH 2/3] Fix issue with layout value display --- android/Formatters/UrlAction.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/Formatters/UrlAction.kt b/android/Formatters/UrlAction.kt index fa66a67..e85d2a8 100644 --- a/android/Formatters/UrlAction.kt +++ b/android/Formatters/UrlAction.kt @@ -8,7 +8,7 @@ import androidx.databinding.BindingAdapter @BindingAdapter("urlAction") fun urlAction(view: TextView, urlAction: String?) { if (urlAction.isNullOrEmpty()) return - + view.text = urlAction view.setOnClickListener { val urlIntent = Intent(Intent.ACTION_VIEW, Uri.parse(urlAction)) view.context.startActivity(Intent.createChooser(urlIntent, "Url")) From 4eca46a6b1809258e86eab2d33ca1eeb81842b88 Mon Sep 17 00:00:00 2001 From: Quentin Marciset Date: Tue, 1 Feb 2022 08:31:04 +0100 Subject: [PATCH 3/3] add targets in manifest --- manifest.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 9facc65..140199a 100644 --- a/manifest.json +++ b/manifest.json @@ -1,5 +1,6 @@ { "name": "url", "binding": "urlAction", - "type" : "text" + "type" : "text", + "target" : ["ios", "android"] } \ No newline at end of file