Skip to content

Commit cc51b80

Browse files
committed
chore: update demo applications
1 parent f34d3ce commit cc51b80

5 files changed

Lines changed: 39 additions & 7 deletions

File tree

demo/android-view/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<uses-permission android:name="android.permission.INTERNET" />
55

66
<application
7+
android:name=".MyApplication"
78
android:allowBackup="true"
89
android:icon="@mipmap/ic_launcher"
910
android:label="@string/app_name"

demo/android-view/src/main/kotlin/io/tolgee/demo/view/MainActivity.kt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ import java.util.*
1515

1616
class MainActivity : ComponentActivity() {
1717

18-
val tolgee = Tolgee.instanceOrInit {
19-
20-
}
18+
val tolgee = Tolgee.instance
2119

2220
override fun attachBaseContext(newBase: Context?) {
2321
super.attachBaseContext(TolgeeContextWrapper.wrap(newBase))
@@ -35,7 +33,7 @@ class MainActivity : ComponentActivity() {
3533
val array = findViewById<TextView>(R.id.array_text)
3634

3735
lifecycleScope.launch {
38-
tolgee.translation(
36+
tolgee.tFlow(
3937
context = this@MainActivity,
4038
id = R.string.description
4139
).collect { value ->
@@ -45,7 +43,7 @@ class MainActivity : ComponentActivity() {
4543
}
4644
}
4745
lifecycleScope.launch {
48-
tolgee.translation(
46+
tolgee.tFlow(
4947
context = this@MainActivity,
5048
id = R.string.percentage_placeholder,
5149
87
@@ -56,7 +54,7 @@ class MainActivity : ComponentActivity() {
5654
}
5755
}
5856
lifecycleScope.launch {
59-
tolgee.pluralTranslation(
57+
tolgee.tPluralFlow(
6058
resources = this@MainActivity.resources,
6159
id = R.plurals.plr_test_placeholder_2,
6260
3, 2, 3, "Plurals"
@@ -67,7 +65,7 @@ class MainActivity : ComponentActivity() {
6765
}
6866
}
6967
lifecycleScope.launch {
70-
tolgee.stringArrayTranslation(
68+
tolgee.tArrayFlow(
7169
resources = this@MainActivity.resources,
7270
id = R.array.array_test
7371
).collect { value ->
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package io.tolgee.demo.view
2+
3+
import android.app.Application
4+
import io.tolgee.Tolgee
5+
6+
class MyApplication : Application() {
7+
8+
override fun onCreate() {
9+
super.onCreate()
10+
11+
Tolgee.init {
12+
contentDelivery {
13+
// url =
14+
}
15+
}
16+
}
17+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package io.tolgee.demo.compose
2+
3+
import io.tolgee.Tolgee
4+
5+
object Setup {
6+
7+
fun init() {
8+
Tolgee.init {
9+
contentDelivery {
10+
// url =
11+
}
12+
}
13+
}
14+
}

demo/multiplatform-compose/src/jvmMain/kotlin/io/tolgee/demo/compose/Main.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package io.tolgee.demo.compose
33
import androidx.compose.ui.window.singleWindowApplication
44

55
fun main() {
6+
Setup.init()
7+
68
singleWindowApplication(
79
title = "Tolgee Compose Multiplatform Demo"
810
) {

0 commit comments

Comments
 (0)