-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Scroll progress on wear OS app (#705)
**Background** Now we not display progress indicator **Changes** Use progress indicator **Test plan** Go to Key Screen and some another Column --------- Co-authored-by: Nikita Kulikov <[email protected]>
- Loading branch information
1 parent
58bccb1
commit cbc2895
Showing
8 changed files
with
87 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 9 additions & 38 deletions
47
...rc/main/java/com/flipperdevices/wearable/sync/wear/impl/composable/ComposableFindPhone.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,36 @@ | ||
package com.flipperdevices.wearable.sync.wear.impl.composable | ||
|
||
import androidx.compose.foundation.focusable | ||
import androidx.compose.foundation.gestures.scrollBy | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.PaddingValues | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.rememberScrollState | ||
import androidx.compose.foundation.verticalScroll | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.LaunchedEffect | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.runtime.rememberCoroutineScope | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.focus.FocusRequester | ||
import androidx.compose.ui.focus.focusRequester | ||
import androidx.compose.ui.input.rotary.onRotaryScrollEvent | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.unit.dp | ||
import androidx.wear.compose.material.Text | ||
import com.flipperdevices.core.ui.theme.LocalTypography | ||
import com.flipperdevices.wearable.core.ui.components.ComposableFlipperButton | ||
import com.flipperdevices.wearable.core.ui.components.ComposableWearOsScrollableColumn | ||
import com.flipperdevices.wearable.sync.wear.impl.R | ||
import com.google.android.horologist.compose.layout.fillMaxRectangle | ||
import kotlinx.coroutines.launch | ||
|
||
@Composable | ||
fun ComposableFindPhone( | ||
onInstall: () -> Unit, | ||
modifier: Modifier = Modifier, | ||
) { | ||
val columnScrollState = rememberScrollState() | ||
val coroutineScope = rememberCoroutineScope() | ||
val focusRequester = remember { FocusRequester() } | ||
|
||
Column( | ||
modifier = modifier | ||
.verticalScroll(columnScrollState) | ||
.fillMaxRectangle() | ||
.onRotaryScrollEvent { | ||
coroutineScope.launch { | ||
columnScrollState.scrollBy(it.verticalScrollPixels) | ||
} | ||
true | ||
} | ||
.focusRequester(focusRequester) | ||
.focusable(), | ||
verticalArrangement = Arrangement.Center, | ||
horizontalAlignment = Alignment.CenterHorizontally | ||
) { | ||
ComposableWearOsScrollableColumn(modifier) { | ||
Text( | ||
text = stringResource(id = R.string.phone_missing), | ||
style = LocalTypography.current.bodyM14 | ||
) | ||
ComposableFlipperButton( | ||
modifier = Modifier.padding(top = 16.dp), | ||
modifier = Modifier.fillMaxWidth().padding(top = 4.dp), | ||
textPadding = PaddingValues( | ||
vertical = 12.dp, | ||
horizontal = 20.dp | ||
), | ||
text = stringResource(R.string.install_app), | ||
onClick = onInstall | ||
) | ||
} | ||
LaunchedEffect(Unit) { | ||
focusRequester.requestFocus() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters