Yingding Wang
06/16/2022, 9:41 PMWearNavScaffold
of horologist. I used a scalingLazyColumnComposable
to show a menu and default time text. Wenn I swipe back to the menu screen, the time text is gone. Is it desired behaviour?
My navi graph codeJohn Nichol
06/17/2022, 5:15 AMyschimke
06/17/2022, 5:25 AMyschimke
06/17/2022, 5:28 AMYingding Wang
06/17/2022, 7:16 AMyschimke
06/17/2022, 8:23 AMyschimke
06/17/2022, 8:28 AMYingding Wang
06/17/2022, 8:30 AMyschimke
06/17/2022, 8:30 AMyschimke
06/17/2022, 8:31 AMYingding Wang
06/17/2022, 8:42 AMcompose_compiler_version = '1.2.0-rc01'
wear_compose_version = '1.0.0-beta03'
or
compose_compiler_version = '1.2.0-beta03'
wear_compose_version = '1.0.0-rc01'
With beta03
compose_compiler_version = '1.2.0-beta03'
wear_compose_version = '1.0.0-beta03'
the default time text doesnโt shown on the scalingLazyColumnComposable
,
I will probably need to customize the time text slot.yschimke
06/17/2022, 8:57 AMYingding Wang
06/17/2022, 9:02 AMstates need to remember
, there are the swipeDismissState and the navState, and also the ScalingLazyListState for the scalingLazyColumnComposable
. The learning curve for states are quite high at the beginning. Maybe we need some more doc
and probably a codelab to explain die effect of states and how to customise the states with WearNavScaffold API.
I will also welcome some more docs to know what the snackbar slot
does ๐ I havenโt figure it out yet. And I would also like to know what the focusRequest is generally used for. I am very new to compose in general.
I really like compose and wear compose, for my limited knowledge and working with horologist, I am able to refactor one view activity and reduce the code from 1000+ lines to 180 lines.yschimke
06/17/2022, 9:04 AMyschimke
06/17/2022, 9:05 AMyschimke
06/17/2022, 9:05 AMyschimke
06/17/2022, 9:06 AMyschimke
06/17/2022, 9:07 AMyschimke
06/17/2022, 9:08 AMyschimke
06/17/2022, 9:08 AMYingding Wang
06/17/2022, 9:14 AMyschimke
06/17/2022, 9:15 AMyschimke
06/17/2022, 9:15 AMYingding Wang
06/17/2022, 9:16 AMyschimke
06/17/2022, 9:17 AMyschimke
06/17/2022, 9:18 AMyschimke
06/17/2022, 9:45 AMyschimke
06/17/2022, 9:46 AMyschimke
06/17/2022, 9:55 AMyschimke
06/17/2022, 9:55 AM@ExperimentalHorologistComposeLayoutApi
public fun Modifier.fadeAwayScalingLazyList(
initialIndex: Int = 1,
initialOffset: Int = 0,
scrollStateFn: () -> ScalingLazyListState,
): Modifier =
composed {
val scrollState = remember { scrollStateFn() }
val isInitial by derivedStateOf { scrollState.centerItemIndex == initialIndex }
val centerItemScrollOffset by derivedStateOf { scrollState.centerItemScrollOffset }
if (isInitial && centerItemScrollOffset > initialOffset) {
val y = centerItemScrollOffset / LocalDensity.current.density
Yingding Wang
06/17/2022, 10:16 AM@ExperimentalHorologistComposeLayoutApi
fun Modifier.fadeAwayScalingLazyList(
initialIndex: Int = 1,
initialOffset: Int = 0,
scrollStateFn: () -> ScalingLazyListState,
): Modifier =
composed {
val scrollState = remember { scrollStateFn() }
val isInitial by derivedStateOf { scrollState.centerItemIndex == initialIndex }
val centerItemScrollOffset by derivedStateOf { scrollState.centerItemScrollOffset }
if (isInitial && centerItemScrollOffset > initialOffset) {
val y = centerItemScrollOffset / LocalDensity.current.density
fadeEffect(y, fade = true)
} else if (scrollState.centerItemIndex > initialIndex) {
alpha(0.0f)
} else {
this
}
}
I canโt compile since fadeEffect: it is private in file
yschimke
06/17/2022, 10:33 AMYingding Wang
06/17/2022, 10:40 AMyschimke
06/17/2022, 10:40 AMyschimke
06/17/2022, 10:40 AMYingding Wang
06/17/2022, 10:41 AMYingding Wang
06/17/2022, 10:42 AMyschimke
06/17/2022, 10:42 AMYingding Wang
06/17/2022, 11:10 AMyschimke
06/17/2022, 11:11 AMyschimke
06/17/2022, 11:12 AMwearcompose = "1.0.0-rc01"
Yingding Wang
06/17/2022, 11:14 AM1.0.0-beta03
on my end ๐Yingding Wang
06/17/2022, 11:23 AMYingding Wang
06/17/2022, 11:24 AM@ExperimentalHorologistComposeLayoutApi
fun Modifier.fadeAwayScalingLazyList(
initialIndex: Int = 1,
initialOffset: Int = 0,
scrollStateFn: () -> ScalingLazyListState,
): Modifier =
composed {
val scrollState = remember { scrollStateFn() }
val isInitial by derivedStateOf { scrollState.centerItemIndex == initialIndex }
val centerItemScrollOffset by derivedStateOf { scrollState.centerItemScrollOffset }
if (isInitial && centerItemScrollOffset > initialOffset) {
val y = centerItemScrollOffset / LocalDensity.current.density
fadeEffect(y, fade = true)
} else if (scrollState.centerItemIndex > initialIndex) {
alpha(0.0f)
} else {
this
}
}
yschimke
06/17/2022, 11:55 AMYingding Wang
06/17/2022, 12:47 PMlayout/fadeAway.kt
and added my example to the sample/simplenav
folder, you can start my app with a config using specific activity of SimpleNavActivityYingding Wang
06/17/2022, 12:49 PMyschimke
06/17/2022, 1:01 PMyschimke
06/17/2022, 1:03 PMyschimke
06/17/2022, 1:03 PMscrollStateBuilder = { ScalingLazyListState(initialCenterItemIndex = 0) }
yschimke
06/17/2022, 1:03 PMyschimke
06/17/2022, 1:04 PMautoCentering = AutoCenteringParams(itemIndex = 1, itemOffset = 30),
yschimke
06/17/2022, 1:05 PMAutoCenteringParams(itemIndex = 0)
It shows upyschimke
06/17/2022, 1:05 PMYingding Wang
06/17/2022, 1:09 PMyschimke
06/17/2022, 1:10 PMyschimke
06/17/2022, 1:10 PM