all: run reformat and code cleanup tasks

This commit is contained in:
Harsh Shandilya 2022-02-09 13:12:48 +05:30
parent 80dc5a59f8
commit 7b7bc79a60
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80
4 changed files with 11 additions and 15 deletions

View file

@ -3,8 +3,6 @@ package dev.msfjarvis.claw.android.ui.lists
import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyListState import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.paging.compose.LazyPagingItems import androidx.paging.compose.LazyPagingItems
import androidx.paging.compose.items import androidx.paging.compose.items

View file

@ -12,7 +12,6 @@ import javax.inject.Inject
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.mapLatest import kotlinx.coroutines.flow.mapLatest
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext

View file

@ -44,7 +44,7 @@ import kotlin.math.max
* @param lastLineMainAxisAlignment Overrides the main axis alignment of the last row. * @param lastLineMainAxisAlignment Overrides the main axis alignment of the last row.
*/ */
@Composable @Composable
public fun FlowRow( fun FlowRow(
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
mainAxisSize: SizeMode = SizeMode.Wrap, mainAxisSize: SizeMode = SizeMode.Wrap,
mainAxisAlignment: FlowMainAxisAlignment = FlowMainAxisAlignment.Start, mainAxisAlignment: FlowMainAxisAlignment = FlowMainAxisAlignment.Start,
@ -82,7 +82,7 @@ public fun FlowRow(
* @param lastLineMainAxisAlignment Overrides the main axis alignment of the last column. * @param lastLineMainAxisAlignment Overrides the main axis alignment of the last column.
*/ */
@Composable @Composable
public fun FlowColumn( fun FlowColumn(
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
mainAxisSize: SizeMode = SizeMode.Wrap, mainAxisSize: SizeMode = SizeMode.Wrap,
mainAxisAlignment: FlowMainAxisAlignment = FlowMainAxisAlignment.Start, 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. */ /** 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. */ /** Place children such that their center is in the middle of the cross axis. */
Center, Center,
/** Place children such that their start edge is aligned to the start edge of the cross axis. */ /** 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, End,
} }
public typealias FlowMainAxisAlignment = MainAxisAlignment typealias FlowMainAxisAlignment = MainAxisAlignment
/** Layout model that arranges its children in a horizontal or vertical flow. */ /** Layout model that arranges its children in a horizontal or vertical flow. */
@Composable @Composable
@ -259,7 +259,7 @@ private fun Flow(
/** Used to specify how a layout chooses its own size when multiple behaviors are possible. */ /** Used to specify how a layout chooses its own size when multiple behaviors are possible. */
// TODO(popam): remove this when Flow is reworked // 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 * Minimize the amount of free space by wrapping the children, subject to the incoming layout
* constraints. * constraints.
@ -273,7 +273,7 @@ public enum class SizeMode {
} }
/** Used to specify the alignment of a layout's children, in main axis direction. */ /** 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 // TODO(soboleva) support RTl in Flow
// workaround for now - use Arrangement that equals to previous Arrangement // 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. */ /** Place children such that they are as close as possible to the middle of the main axis. */

View file

@ -32,7 +32,6 @@ import androidx.paging.PagingData
import androidx.paging.PagingDataDiffer import androidx.paging.PagingDataDiffer
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.collectLatest
/** /**
@ -43,7 +42,7 @@ import kotlinx.coroutines.flow.collectLatest
* *
* @param T the type of value used by [PagingData]. * @param T the type of value used by [PagingData].
*/ */
public class LazyPagingItems<T : Any> class LazyPagingItems<T : Any>
internal constructor( internal constructor(
/** the [Flow] object which contains a stream of [PagingData] elements. */ /** the [Flow] object which contains a stream of [PagingData] elements. */
private val flow: Flow<PagingData<T>> private val flow: Flow<PagingData<T>>
@ -157,7 +156,7 @@ internal constructor(
} }
/** A [CombinedLoadStates] object which represents the current loading state. */ /** A [CombinedLoadStates] object which represents the current loading state. */
public var loadState: CombinedLoadStates by var loadState: CombinedLoadStates by
mutableStateOf( mutableStateOf(
CombinedLoadStates( CombinedLoadStates(
refresh = InitialLoadStates.refresh, refresh = InitialLoadStates.refresh,
@ -189,7 +188,7 @@ private val InitialLoadStates =
* @sample androidx.paging.compose.samples.PagingBackendSample * @sample androidx.paging.compose.samples.PagingBackendSample
*/ */
@Composable @Composable
public fun <T : Any> Flow<PagingData<T>>.collectAsLazyPagingItems(): LazyPagingItems<T> { fun <T : Any> Flow<PagingData<T>>.collectAsLazyPagingItems(): LazyPagingItems<T> {
val lazyPagingItems = remember(this) { LazyPagingItems(this) } val lazyPagingItems = remember(this) { LazyPagingItems(this) }
LaunchedEffect(lazyPagingItems) { lazyPagingItems.collectPagingData() } LaunchedEffect(lazyPagingItems) { lazyPagingItems.collectPagingData() }
@ -216,7 +215,7 @@ public fun <T : Any> Flow<PagingData<T>>.collectAsLazyPagingItems(): LazyPagingI
* [itemContent] method should handle the logic of displaying a placeholder instead of the main * [itemContent] method should handle the logic of displaying a placeholder instead of the main
* content displayed by an item which is not `null`. * content displayed by an item which is not `null`.
*/ */
public fun <T : Any> LazyListScope.items( fun <T : Any> LazyListScope.items(
items: LazyPagingItems<T>, items: LazyPagingItems<T>,
key: ((item: T) -> Any)? = null, key: ((item: T) -> Any)? = null,
itemContent: @Composable LazyItemScope.(value: T?) -> Unit itemContent: @Composable LazyItemScope.(value: T?) -> Unit
@ -256,7 +255,7 @@ public fun <T : Any> LazyListScope.items(
* [itemContent] method should handle the logic of displaying a placeholder instead of the main * [itemContent] method should handle the logic of displaying a placeholder instead of the main
* content displayed by an item which is not `null`. * content displayed by an item which is not `null`.
*/ */
public fun <T : Any> LazyListScope.itemsIndexed( fun <T : Any> LazyListScope.itemsIndexed(
items: LazyPagingItems<T>, items: LazyPagingItems<T>,
key: ((index: Int, item: T) -> Any)? = null, key: ((index: Int, item: T) -> Any)? = null,
itemContent: @Composable LazyItemScope.(index: Int, value: T?) -> Unit itemContent: @Composable LazyItemScope.(index: Int, value: T?) -> Unit