Skip to content

Commit b45e02f

Browse files
authored
Merge pull request #253 from powersync-ja/demo-tweaks
Demo tweaks
1 parent 14647c7 commit b45e02f

File tree

7 files changed

+41
-2
lines changed

7 files changed

+41
-2
lines changed

demos/android-supabase-todolist/src/main/java/com/powersync/androidexample/MainActivity.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.powersync.androidexample
33
import android.os.Bundle
44
import androidx.activity.ComponentActivity
55
import androidx.activity.compose.setContent
6+
import androidx.activity.enableEdgeToEdge
67
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
78
import com.powersync.androidexample.ui.CameraService
89
import com.powersync.demos.App
@@ -15,6 +16,9 @@ class MainActivity : ComponentActivity() {
1516

1617
super.onCreate(savedInstanceState)
1718

19+
// Needed to render system bar properly
20+
enableEdgeToEdge()
21+
1822
setContent {
1923
App(
2024
cameraService = cameraService,

demos/android-supabase-todolist/src/main/java/com/powersync/androidexample/screens/SignInScreen.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
package com.powersync.demos.screens
22

33
import androidx.compose.foundation.layout.*
4+
import androidx.compose.foundation.rememberScrollState
5+
import androidx.compose.foundation.text.KeyboardOptions
6+
import androidx.compose.foundation.verticalScroll
47
import androidx.compose.material3.*
58
import androidx.compose.runtime.*
69
import androidx.compose.ui.Alignment
710
import androidx.compose.ui.Modifier
11+
import androidx.compose.ui.text.input.KeyboardType
812
import androidx.compose.ui.text.input.PasswordVisualTransformation
913
import androidx.compose.ui.unit.dp
1014
import com.powersync.demos.AuthViewModel
@@ -24,10 +28,12 @@ internal fun SignInScreen(
2428
var isLoading by remember { mutableStateOf(false) }
2529

2630
val coroutineScope = rememberCoroutineScope()
31+
val scrollState = rememberScrollState()
2732

2833
Column(
2934
modifier = Modifier
3035
.fillMaxSize()
36+
.verticalScroll(scrollState)
3137
.padding(16.dp),
3238
verticalArrangement = Arrangement.Center,
3339
horizontalAlignment = Alignment.CenterHorizontally
@@ -52,6 +58,7 @@ internal fun SignInScreen(
5258
onValueChange = { password = it },
5359
label = { Text("Password") },
5460
visualTransformation = PasswordVisualTransformation(),
61+
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password),
5562
modifier = Modifier
5663
.fillMaxWidth()
5764
.padding(bottom = 16.dp)

demos/android-supabase-todolist/src/main/java/com/powersync/androidexample/screens/SignUpScreen.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
package com.powersync.demos.screens
22

33
import androidx.compose.foundation.layout.*
4+
import androidx.compose.foundation.rememberScrollState
5+
import androidx.compose.foundation.text.KeyboardOptions
6+
import androidx.compose.foundation.verticalScroll
47
import androidx.compose.material3.*
58
import androidx.compose.runtime.*
69
import androidx.compose.ui.Alignment
710
import androidx.compose.ui.Modifier
11+
import androidx.compose.ui.text.input.KeyboardType
812
import androidx.compose.ui.text.input.PasswordVisualTransformation
913
import androidx.compose.ui.unit.dp
1014
import com.powersync.demos.AuthViewModel
@@ -24,10 +28,12 @@ internal fun SignUpScreen(
2428
var isLoading by remember { mutableStateOf(false) }
2529

2630
val coroutineScope = rememberCoroutineScope()
31+
val scrollState = rememberScrollState()
2732

2833
Column(
2934
modifier = Modifier
3035
.fillMaxSize()
36+
.verticalScroll(scrollState)
3137
.padding(16.dp),
3238
verticalArrangement = Arrangement.Center,
3339
horizontalAlignment = Alignment.CenterHorizontally
@@ -48,6 +54,7 @@ internal fun SignUpScreen(
4854
onValueChange = { password = it },
4955
label = { Text("Password") },
5056
visualTransformation = PasswordVisualTransformation(),
57+
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password),
5158
modifier = Modifier
5259
.fillMaxWidth()
5360
.padding(bottom = 16.dp)
@@ -58,6 +65,7 @@ internal fun SignUpScreen(
5865
onValueChange = { confirmPassword = it },
5966
label = { Text("Confirm Password") },
6067
visualTransformation = PasswordVisualTransformation(),
68+
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password),
6169
modifier = Modifier
6270
.fillMaxWidth()
6371
.padding(bottom = 16.dp)

demos/supabase-todolist/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ all items have been received.
4141
1. Clone this repo: ```git clone https://github.com/powersync-ja/powersync-kotlin.git```
4242
2. Open the repo in Android Studio. This creates a `local.properties` file in root and should contain a `sdk.dir=/path/to/android/sdk` line.
4343
3. Sync the project with Gradle (this should happen automatically, or choose File > Sync project with Gradle Files).
44-
4. Insert your Supabase project URL, Supabase Anon Key, and PowerSync instance URL into the `demos/supabase-todlist/local.properties` file:
44+
4. Insert your Supabase project URL, Supabase Anon Key, and PowerSync instance URL into the `demos/supabase-todolist/local.properties` file:
4545

4646
```bash
4747
# local.properties

demos/supabase-todolist/androidApp/src/androidMain/kotlin/com/powersync/demos/MainActivity.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.powersync.demos
22

33
import android.os.Bundle
44
import androidx.activity.compose.setContent
5+
import androidx.activity.enableEdgeToEdge
56
import androidx.appcompat.app.AppCompatActivity
67
import androidx.compose.material.MaterialTheme
78
import androidx.compose.material.Surface
@@ -11,6 +12,9 @@ class MainActivity : AppCompatActivity() {
1112
override fun onCreate(savedInstanceState: Bundle?) {
1213
super.onCreate(savedInstanceState)
1314

15+
// Needed to render system bar properly
16+
enableEdgeToEdge()
17+
1418
setContent {
1519
MaterialTheme {
1620
Surface(color = MaterialTheme.colors.background) {

demos/supabase-todolist/shared/src/commonMain/kotlin/com/powersync/demos/screens/SignInScreen.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
package com.powersync.demos.screens
22

33
import androidx.compose.foundation.layout.*
4+
import androidx.compose.foundation.rememberScrollState
5+
import androidx.compose.foundation.text.KeyboardOptions
6+
import androidx.compose.foundation.verticalScroll
47
import androidx.compose.material.*
58
import androidx.compose.runtime.*
69
import androidx.compose.ui.Alignment
710
import androidx.compose.ui.Modifier
11+
import androidx.compose.ui.text.input.KeyboardType
812
import androidx.compose.ui.text.input.PasswordVisualTransformation
913
import androidx.compose.ui.unit.dp
1014
import com.powersync.demos.AuthViewModel
@@ -24,13 +28,16 @@ internal fun SignInScreen(
2428
var isLoading by remember { mutableStateOf(false) }
2529

2630
val coroutineScope = rememberCoroutineScope()
31+
val scrollState = rememberScrollState()
2732

2833
Column(
2934
modifier = Modifier
3035
.fillMaxSize()
36+
.verticalScroll(scrollState)
3137
.padding(16.dp),
3238
verticalArrangement = Arrangement.Center,
33-
horizontalAlignment = Alignment.CenterHorizontally
39+
horizontalAlignment = Alignment.CenterHorizontally,
40+
3441
) {
3542
Text(
3643
"Sign In",
@@ -52,6 +59,7 @@ internal fun SignInScreen(
5259
onValueChange = { password = it },
5360
label = { Text("Password") },
5461
visualTransformation = PasswordVisualTransformation(),
62+
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password),
5563
modifier = Modifier
5664
.fillMaxWidth()
5765
.padding(bottom = 16.dp)

demos/supabase-todolist/shared/src/commonMain/kotlin/com/powersync/demos/screens/SignUpScreen.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
package com.powersync.demos.screens
22

33
import androidx.compose.foundation.layout.*
4+
import androidx.compose.foundation.rememberScrollState
5+
import androidx.compose.foundation.text.KeyboardOptions
6+
import androidx.compose.foundation.verticalScroll
47
import androidx.compose.material.*
58
import androidx.compose.runtime.*
69
import androidx.compose.ui.Alignment
710
import androidx.compose.ui.Modifier
11+
import androidx.compose.ui.text.input.KeyboardType
812
import androidx.compose.ui.text.input.PasswordVisualTransformation
913
import androidx.compose.ui.unit.dp
1014
import com.powersync.demos.AuthViewModel
@@ -24,10 +28,12 @@ internal fun SignUpScreen(
2428
var isLoading by remember { mutableStateOf(false) }
2529

2630
val coroutineScope = rememberCoroutineScope()
31+
val scrollState = rememberScrollState()
2732

2833
Column(
2934
modifier = Modifier
3035
.fillMaxSize()
36+
.verticalScroll(scrollState)
3137
.padding(16.dp),
3238
verticalArrangement = Arrangement.Center,
3339
horizontalAlignment = Alignment.CenterHorizontally
@@ -48,6 +54,7 @@ internal fun SignUpScreen(
4854
onValueChange = { password = it },
4955
label = { Text("Password") },
5056
visualTransformation = PasswordVisualTransformation(),
57+
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password),
5158
modifier = Modifier
5259
.fillMaxWidth()
5360
.padding(bottom = 16.dp)
@@ -58,6 +65,7 @@ internal fun SignUpScreen(
5865
onValueChange = { confirmPassword = it },
5966
label = { Text("Confirm Password") },
6067
visualTransformation = PasswordVisualTransformation(),
68+
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password),
6169
modifier = Modifier
6270
.fillMaxWidth()
6371
.padding(bottom = 16.dp)

0 commit comments

Comments
 (0)