Skip to content

Instantly share code, notes, and snippets.

View kasem-sm's full-sized avatar
🎯
Focusing

Kasem SM kasem-sm

🎯
Focusing
  • Mumbai, India
  • 18:26 (UTC +05:30)
View GitHub Profile
@kasem-sm
kasem-sm / BottomBar.kt
Created February 8, 2022 07:40
Navigation Overview
@Composable
internal fun SlimeBottomBar(
navController: NavController,
items: List<BottomNavigationItems>,
) {
Column {
val currentRoute = navController.currentRouteAsState()
NavigationBar {
@kasem-sm
kasem-sm / CoilWithPlaceholder.kt
Created February 6, 2022 15:49
Small workaround to show thumbnail before loading actual image with Coil.
var isOriginalImageLoaded = false
// Thumbnail Request
val thumbRequest = ImageRequest.Builder(ctx)
.data(thumbUrl)
.target(
onSuccess = { result ->
// If highRes image is not loaded yet,
// show the thumbnail
if (!isOriginalImageLoaded) {
result.data?.let { list ->
val totalCount = list.count()
// example there are 2 uploadedPosts
list.forEach { review ->
if (review.status.contains("Live")) {
/** if totalCount (posts) are 2 and both of them are live,
* minus 1 for each live post, so totalCount would be 0
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">