Skip to content

Instantly share code, notes, and snippets.

View shakil807g's full-sized avatar
👋

Shakil Karim shakil807g

👋
View GitHub Profile
@shakil807g
shakil807g / SwipeToDismiss.kt
Created January 12, 2023 10:49
SwipeToDismissDemo
val list = mutableStateListOf("a","b","c")
LazyColumn(Modifier.fillMaxSize()) {
items(list,{ it }) { item ->
val scope = rememberCoroutineScope()
val undoScope = rememberCoroutineScope()
val dismissState = rememberDismissState(
confirmStateChange = {
if(it == DismissValue.DismissedToStart) {
scope.launch {
delay(4000)
FACRModalBottomSheet(facrViewModel.isClubSheetVisible, onSheetHidden = {
facrViewModel.isClubSheetVisible = false
}) { state ->
AddClubsBottomSheet(facrViewModel = facrViewModel)
}
package com.facr.fotbal.common
import androidx.compose.animation.animateContentSize
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.MaterialTheme
import androidx.compose.runtime.Composable
@ExperimentalLayout
@ExperimentalFoundationApi
@Composable
fun CompetitionDetailsScreenNew() {
val navigator = LocalNavigator.current
val isLandScape = LocalIsLandScape.current
val dashboardViewModel: DashboardViewModel = viewModel()
val viewModel: CompetitionDetailsViewModel = viewModel()
val scrollState = rememberLazyListState()
val competionMatchesList = dashboardViewModel.competionMatchesList.collectAsLazyPagingItems()
val clubsList = onboardingViewModel.clubs.collectAsLazyPagingItems()
GridPagingList(modifier = Modifier.fillMaxWidth().weight(1f),clubsList) {
TeamItem(it, savedClubs.value) { club ->
onboardingViewModel.updateClubs(savedClubs.value, club)
}
}
@shakil807g
shakil807g / build.gradle
Created May 28, 2020 19:26 — forked from ultraon/build.gradle
Good example of the merged Jacoco code covarage Gradle configuration
apply plugin: 'com.android.application'
apply from: "$rootDir/coverage.gradle"
//...
android {
//...
buildTypes {
//...
debug {
@shakil807g
shakil807g / TimestampUtils.java
Created March 17, 2020 20:11 — forked from kristopherjohnson/TimestampUtils.java
Methods for generating ISO 8601 timestamps in Java/Android
package net.kristopherjohnson.util;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
/**
* Methods for dealing with timestamps
@shakil807g
shakil807g / ConnectivityAndInternetAccess.kt
Created March 16, 2020 10:56
Class to check the Connectivity and Internet Access of an Android device.
/*
* Copyright (c) 2017 Emil Davtyan
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
@shakil807g
shakil807g / MediaDecoder.java
Created March 13, 2020 09:57 — forked from a-m-s/MediaDecoder.java
Android code to extract raw audio from arbitrary media files.
/* MediaDecoder
Author: Andrew Stubbs (based on some examples from the docs)
This class opens a file, reads the first audio channel it finds, and returns raw audio data.
Usage:
MediaDecoder decoder = new MediaDecoder("myfile.m4a");
short[] data;
while ((data = decoder.readShortData()) != null) {
fun <T> unsafeLazy(initializer: () -> T) = lazy(LazyThreadSafetyMode.NONE, initializer)
@JvmOverloads @Dimension(unit = Dimension.PX) fun Number.dpToPx(
metrics: DisplayMetrics = Resources.getSystem().displayMetrics
): Float {
return toFloat() * metrics.density
}
@JvmOverloads @Dimension(unit = Dimension.DP) fun Number.pxToDp(
metrics: DisplayMetrics = Resources.getSystem().displayMetrics