Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add kotlin examples in README.md #28 #30

Merged
merged 2 commits into from
Dec 29, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<FadingTextView>(R.id.fadingTextView)
fadingTextView.setTexts(texts) //You can use an array resource or a string array as the parameter
rosenpin marked this conversation as resolved.
Show resolved Hide resolved
//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
Expand Down