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
binding.choiceChipGroup.checkedChanges() | |
.dropInitialValue() | |
.map { checkedIds -> state.change(checkedIds) } | |
.shareIn(scope = scope, started = SharingStarted.Eagerly, replay = 1) |
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
minVisibleItemsSlider.valueChanges() | |
.onEach { count -> expandableCell.minVisibleItems = count.roundToInt() } | |
.launchIn(scope) |
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
context | |
.receivesBroadcast(IntentFilter(nfcAction)) | |
.map { it.getNfcState() } | |
.distinctUntilChanged() | |
.onEach { _nfcState.value = it } | |
.launchIn(scope) |
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
viewLifecycleOwner.lifecycleScope.launch { | |
repeatOnLifecycle(Lifecycle.State.STARTED) { | |
productsViewPager.pageSelections() | |
.onEach(::onPageSelected) | |
.launchIn(this) | |
} | |
} |
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
viewLifecycleOwner.lifecycleScope.launch { | |
repeatOnLifecycle(Lifecycle.State.STARTED) { | |
detailsViewPager.pageScrollEvents() | |
.filter { it.positionOffset == 0f } | |
.map { it.position } | |
.distinctUntilChanged() | |
.onEach(::onPositionChanged) | |
.launchIn(this) | |
} | |
} |
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
viewLifecycleOwner.lifecycleScope.launch { | |
repeatOnLifecycle(Lifecycle.State.STARTED) { | |
parentFragmentManager.resultEvents( | |
requestKey = RESULT_DATA_KEY, | |
lifecycleOwner = this@ResultFragment | |
) | |
.mapNotNull { it.bundle.toResultData() } | |
.onEach(::renderResultData) | |
.launchIn(this) | |
} |
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
onBackPressedDispatcher.backPresses(lifecycleOwner = this) | |
.onEach { currentFlowFragment?.onBackPressed() } | |
.launchIn(lifecycleScope) |
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
@Composable | |
private fun FiberglassColumnContent() { | |
val items: List<FiberglassItem> = remember { | |
buildList { | |
val count = 4 | |
repeat(count) { | |
val number = it + 1 | |
add(TitleItem("Block №$number")) | |
add(LoremIpsumItem(20 * number)) | |
if (number < count) add(SpacerItem(16)) |
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
fun spacerItemSlot(): FiberglassLazyItemSlot = { _, item -> | |
Spacer(modifier = Modifier.height((item as SpacerItem).height.dp)) | |
} | |
fun titleItemSlot(): FiberglassLazyItemSlot = { _, item -> | |
Text( | |
text = (item as TitleItem).title, | |
modifier = Modifier.padding(horizontal = AppTheme.dimensions.horizontalGuideline), | |
color = AppTheme.colors.onBackground, | |
style = AppTheme.typography.headlineMedium |
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
data class SpacerItem(val height: Int) : FiberglassItem { | |
override val id: String = UUID.randomUUID().toString() | |
} | |
data class TitleItem(val title: String) : FiberglassItem { | |
override val id: String = title | |
} | |
data class LoremIpsumItem(private val words: Int) : FiberglassItem { | |
val text = LOREM_IPSUM_SOURCE.take(words).joinToString(separator = " ") |
NewerOlder