From 217f9ba2d98bc8102d3ffd4860ecc64fb1511478 Mon Sep 17 00:00:00 2001 From: Emre BAYRAKTAR Date: Fri, 29 Dec 2023 01:43:12 +0300 Subject: [PATCH] Add kotlin examples in README.md #28 --- README.md | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e7a4aab..3d012f6 100644 --- a/README.md +++ b/README.md @@ -66,8 +66,39 @@ app:timeout="500" app:timeout="500" app:texts="@array/examples" /> ``` +### Updating the view dynamically - Kotlin +To set the text dynamically, you can use + +```kotlin +val texts = arrayOf("text1", "text2", "text3") +val fadingTextView = findViewById(R.id.fadingTextView) +fadingTextView.setTexts(texts) //You can use an array resource or a string array as the parameter +//fadingTextView.setTexts(R.array.examples) +``` + +To set the timeout between text changes you can use: + +```kotlin +//For text change once every hour +fadingTextView.setTimeout(60.minutes) + +//For text change once every half a minute +fadingTextView.setTimeout(0.5.minutes) + +//For text change every 10 seconds +fadingTextView.setTimeout(10.seconds) + +//For text change every 500 milliseconds (0.5 seconds) +fadingTextView.setTimeout(500.milliseconds) +``` + +Or you can shuffle texts that you set + +```kotlin +fadingTextView.shuffle() +``` -### Updating the view dynamically +### Updating the view dynamically - JAVA To set the text dynamically, you can use ```java