From 7b7bc79a609aef1042cb449ecca9037b2a07e30b Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Wed, 9 Feb 2022 13:12:48 +0530 Subject: [PATCH] all: run reformat and code cleanup tasks --- .../msfjarvis/claw/android/ui/lists/NetworkPosts.kt | 2 -- .../claw/android/viewmodel/ClawViewModel.kt | 1 - .../kotlin/com/google/accompanist/flowlayout/Flow.kt | 12 ++++++------ desktop/src/jvmMain/kotlin/LazyPagingItems.kt | 11 +++++------ 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/android/src/main/kotlin/dev/msfjarvis/claw/android/ui/lists/NetworkPosts.kt b/android/src/main/kotlin/dev/msfjarvis/claw/android/ui/lists/NetworkPosts.kt index 08817572..bbddf245 100644 --- a/android/src/main/kotlin/dev/msfjarvis/claw/android/ui/lists/NetworkPosts.kt +++ b/android/src/main/kotlin/dev/msfjarvis/claw/android/ui/lists/NetworkPosts.kt @@ -3,8 +3,6 @@ package dev.msfjarvis.claw.android.ui.lists import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyListState import androidx.compose.runtime.Composable -import androidx.compose.runtime.getValue -import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.paging.compose.LazyPagingItems import androidx.paging.compose.items diff --git a/android/src/main/kotlin/dev/msfjarvis/claw/android/viewmodel/ClawViewModel.kt b/android/src/main/kotlin/dev/msfjarvis/claw/android/viewmodel/ClawViewModel.kt index d29230c3..c6c884c1 100644 --- a/android/src/main/kotlin/dev/msfjarvis/claw/android/viewmodel/ClawViewModel.kt +++ b/android/src/main/kotlin/dev/msfjarvis/claw/android/viewmodel/ClawViewModel.kt @@ -12,7 +12,6 @@ import javax.inject.Inject import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.first -import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.mapLatest import kotlinx.coroutines.launch import kotlinx.coroutines.withContext diff --git a/common/src/commonMain/kotlin/com/google/accompanist/flowlayout/Flow.kt b/common/src/commonMain/kotlin/com/google/accompanist/flowlayout/Flow.kt index 8c2e842e..6cb47535 100644 --- a/common/src/commonMain/kotlin/com/google/accompanist/flowlayout/Flow.kt +++ b/common/src/commonMain/kotlin/com/google/accompanist/flowlayout/Flow.kt @@ -44,7 +44,7 @@ import kotlin.math.max * @param lastLineMainAxisAlignment Overrides the main axis alignment of the last row. */ @Composable -public fun FlowRow( +fun FlowRow( modifier: Modifier = Modifier, mainAxisSize: SizeMode = SizeMode.Wrap, mainAxisAlignment: FlowMainAxisAlignment = FlowMainAxisAlignment.Start, @@ -82,7 +82,7 @@ public fun FlowRow( * @param lastLineMainAxisAlignment Overrides the main axis alignment of the last column. */ @Composable -public fun FlowColumn( +fun FlowColumn( modifier: Modifier = Modifier, mainAxisSize: SizeMode = SizeMode.Wrap, mainAxisAlignment: FlowMainAxisAlignment = FlowMainAxisAlignment.Start, @@ -106,7 +106,7 @@ public fun FlowColumn( } /** Used to specify the alignment of a layout's children, in cross axis direction. */ -public enum class FlowCrossAxisAlignment { +enum class FlowCrossAxisAlignment { /** Place children such that their center is in the middle of the cross axis. */ Center, /** Place children such that their start edge is aligned to the start edge of the cross axis. */ @@ -115,7 +115,7 @@ public enum class FlowCrossAxisAlignment { End, } -public typealias FlowMainAxisAlignment = MainAxisAlignment +typealias FlowMainAxisAlignment = MainAxisAlignment /** Layout model that arranges its children in a horizontal or vertical flow. */ @Composable @@ -259,7 +259,7 @@ private fun Flow( /** Used to specify how a layout chooses its own size when multiple behaviors are possible. */ // TODO(popam): remove this when Flow is reworked -public enum class SizeMode { +enum class SizeMode { /** * Minimize the amount of free space by wrapping the children, subject to the incoming layout * constraints. @@ -273,7 +273,7 @@ public enum class SizeMode { } /** Used to specify the alignment of a layout's children, in main axis direction. */ -public enum class MainAxisAlignment(internal val arrangement: Arrangement.Vertical) { +enum class MainAxisAlignment(internal val arrangement: Arrangement.Vertical) { // TODO(soboleva) support RTl in Flow // workaround for now - use Arrangement that equals to previous Arrangement /** Place children such that they are as close as possible to the middle of the main axis. */ diff --git a/desktop/src/jvmMain/kotlin/LazyPagingItems.kt b/desktop/src/jvmMain/kotlin/LazyPagingItems.kt index ca7d35fc..cea39447 100644 --- a/desktop/src/jvmMain/kotlin/LazyPagingItems.kt +++ b/desktop/src/jvmMain/kotlin/LazyPagingItems.kt @@ -32,7 +32,6 @@ import androidx.paging.PagingData import androidx.paging.PagingDataDiffer import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.collectLatest /** @@ -43,7 +42,7 @@ import kotlinx.coroutines.flow.collectLatest * * @param T the type of value used by [PagingData]. */ -public class LazyPagingItems +class LazyPagingItems internal constructor( /** the [Flow] object which contains a stream of [PagingData] elements. */ private val flow: Flow> @@ -157,7 +156,7 @@ internal constructor( } /** A [CombinedLoadStates] object which represents the current loading state. */ - public var loadState: CombinedLoadStates by + var loadState: CombinedLoadStates by mutableStateOf( CombinedLoadStates( refresh = InitialLoadStates.refresh, @@ -189,7 +188,7 @@ private val InitialLoadStates = * @sample androidx.paging.compose.samples.PagingBackendSample */ @Composable -public fun Flow>.collectAsLazyPagingItems(): LazyPagingItems { +fun Flow>.collectAsLazyPagingItems(): LazyPagingItems { val lazyPagingItems = remember(this) { LazyPagingItems(this) } LaunchedEffect(lazyPagingItems) { lazyPagingItems.collectPagingData() } @@ -216,7 +215,7 @@ public fun Flow>.collectAsLazyPagingItems(): LazyPagingI * [itemContent] method should handle the logic of displaying a placeholder instead of the main * content displayed by an item which is not `null`. */ -public fun LazyListScope.items( +fun LazyListScope.items( items: LazyPagingItems, key: ((item: T) -> Any)? = null, itemContent: @Composable LazyItemScope.(value: T?) -> Unit @@ -256,7 +255,7 @@ public fun LazyListScope.items( * [itemContent] method should handle the logic of displaying a placeholder instead of the main * content displayed by an item which is not `null`. */ -public fun LazyListScope.itemsIndexed( +fun LazyListScope.itemsIndexed( items: LazyPagingItems, key: ((index: Int, item: T) -> Any)? = null, itemContent: @Composable LazyItemScope.(index: Int, value: T?) -> Unit