From 94c309a84b6f5d9148881f3aeed2cd62c608a7ce Mon Sep 17 00:00:00 2001 From: Duarte Pinto Date: Mon, 3 May 2021 15:42:13 +0100 Subject: [PATCH 1/3] Update README and Sample project to use Map and Array literals in Kotlin. --- README.md | 15 +++--- .../com/velocidi/sampleapp/MainActivity.kt | 53 ++++++++----------- 2 files changed, 31 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index 4f1debe..0800fd0 100644 --- a/README.md +++ b/README.md @@ -64,13 +64,14 @@ val eventJsonString = Velocidi.getInstance().track(UserId("", "gaid"), eventJsonString) // Using a JSONObject -val eventJsonObj = JSONObject() -eventJsonObj.put("clientId", "velocidi") -eventJsonObj.put("siteId", "velocidi.com") -eventJsonObj.put("type", "appView") -eventJsonObj.put("title", "Welcome Screen") - -Velocidi.getInstance().track(UserId("", "gaid"), eventJsonObj) +val eventJsonObj = mapOf( + "clientId" to "velocidi", + "siteId" to "velocidi.com", + "type" to "appView", + "title" to "Welcome Screen" +) + +Velocidi.getInstance().track(UserId("", "gaid"), JSONObject(eventJsonObj)) ``` ### Match diff --git a/velocidi-sample/src/main/java/com/velocidi/sampleapp/MainActivity.kt b/velocidi-sample/src/main/java/com/velocidi/sampleapp/MainActivity.kt index 1115c3b..268d994 100644 --- a/velocidi-sample/src/main/java/com/velocidi/sampleapp/MainActivity.kt +++ b/velocidi-sample/src/main/java/com/velocidi/sampleapp/MainActivity.kt @@ -18,40 +18,33 @@ class MainActivity : AppCompatActivity() { val matchButton = findViewById