|
|
@ -21,6 +21,7 @@ import android.net.Uri
|
|
|
|
import androidx.annotation.ColorInt
|
|
|
|
import androidx.annotation.ColorInt
|
|
|
|
import androidx.browser.customtabs.CustomTabColorSchemeParams
|
|
|
|
import androidx.browser.customtabs.CustomTabColorSchemeParams
|
|
|
|
import androidx.browser.customtabs.CustomTabsIntent
|
|
|
|
import androidx.browser.customtabs.CustomTabsIntent
|
|
|
|
|
|
|
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
|
|
|
import androidx.compose.foundation.layout.padding
|
|
|
|
import androidx.compose.foundation.layout.padding
|
|
|
|
import androidx.compose.foundation.lazy.LazyListScope
|
|
|
|
import androidx.compose.foundation.lazy.LazyListScope
|
|
|
|
import androidx.compose.foundation.lazy.staggeredgrid.LazyStaggeredGridScope
|
|
|
|
import androidx.compose.foundation.lazy.staggeredgrid.LazyStaggeredGridScope
|
|
|
@ -47,6 +48,7 @@ import com.google.samples.apps.nowinandroid.core.model.data.UserNewsResource
|
|
|
|
* An extension on [LazyListScope] defining a feed with news resources.
|
|
|
|
* An extension on [LazyListScope] defining a feed with news resources.
|
|
|
|
* Depending on the [feedState], this might emit no items.
|
|
|
|
* Depending on the [feedState], this might emit no items.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
@OptIn(ExperimentalFoundationApi::class)
|
|
|
|
fun LazyStaggeredGridScope.newsFeed(
|
|
|
|
fun LazyStaggeredGridScope.newsFeed(
|
|
|
|
feedState: NewsFeedUiState,
|
|
|
|
feedState: NewsFeedUiState,
|
|
|
|
onNewsResourcesCheckedChanged: (String, Boolean) -> Unit,
|
|
|
|
onNewsResourcesCheckedChanged: (String, Boolean) -> Unit,
|
|
|
@ -88,7 +90,9 @@ fun LazyStaggeredGridScope.newsFeed(
|
|
|
|
)
|
|
|
|
)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
onTopicClick = onTopicClick,
|
|
|
|
onTopicClick = onTopicClick,
|
|
|
|
modifier = Modifier.padding(horizontal = 8.dp),
|
|
|
|
modifier = Modifier
|
|
|
|
|
|
|
|
.padding(horizontal = 8.dp)
|
|
|
|
|
|
|
|
.animateItemPlacement(),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|