@@ -27,11 +27,24 @@ class MainActivity : ComponentActivity() {
2727 setContentView(R .layout.activity_main)
2828
2929 val basic = findViewById<TextView >(R .id.basic_text)
30+ val name = findViewById<TextView >(R .id.app_name_text)
3031 val parameter = findViewById<TextView >(R .id.parameterized_text)
31- val button = findViewById<Button >(R .id.button)
3232 val plural = findViewById<TextView >(R .id.plural_text)
3333 val array = findViewById<TextView >(R .id.array_text)
34+ val buttonEn = findViewById<Button >(R .id.button_en)
35+ val buttonFr = findViewById<Button >(R .id.button_fr)
36+ val buttonCs = findViewById<Button >(R .id.button_cs)
3437
38+ lifecycleScope.launch {
39+ tolgee.tFlow(
40+ context = this @MainActivity,
41+ id = R .string.app_name,
42+ ).collect { value ->
43+ withContext(Dispatchers .Main ) {
44+ name.text = value
45+ }
46+ }
47+ }
3548 lifecycleScope.launch {
3649 tolgee.tFlow(
3750 context = this @MainActivity,
@@ -74,8 +87,15 @@ class MainActivity : ComponentActivity() {
7487 }
7588 }
7689 }
77- button.setOnClickListener {
90+
91+ buttonEn.setOnClickListener {
7892 tolgee.setLocale(Locale .ENGLISH )
7993 }
94+ buttonFr.setOnClickListener {
95+ tolgee.setLocale(Locale .FRENCH )
96+ }
97+ buttonCs.setOnClickListener {
98+ tolgee.setLocale(Locale (" cs" ))
99+ }
80100 }
81101}
0 commit comments