Skip to content

Instantly share code, notes, and snippets.

@Barros9
Barros9 / Theme.kt
Created July 24, 2022 09:41
Animation Theme
@Composable
fun ComposeFunctionsTheme(
darkTheme: Boolean = isSystemInDarkTheme(),
content: @Composable () -> Unit
) {
val palette = if (darkTheme) { DarkColorPalette } else { LightColorPalette }
MaterialTheme(
colors = palette.switch(),
typography = Typography,
@Barros9
Barros9 / SwipeButton.kt
Created July 10, 2022 08:28
SwipeButton
fun SwipeButton(
modifier: Modifier = Modifier,
shape: Shape = RoundedCornerShape(16.dp),
backgroundColor: Color = Color.White,
borderStroke: BorderStroke = BorderStroke(2.dp, Color.Black),
elevation: Dp = 8.dp,
icon: @Composable () -> Unit,
text: String,
textStyle: TextStyle = TextStyle(Color.Black, 20.sp),
onSwipe: () -> Unit
@Barros9
Barros9 / build.gradle
Created April 30, 2022 13:15
Gradle task pre commit ktlintCheck
task installGitHook(type: Copy) {
from new File(rootProject.rootDir, 'githook/pre-commit')
into { new File(rootProject.rootDir, '../.git/hooks') }
fileMode 0777
}
tasks.getByPath(':app:preBuild').dependsOn installGitHook
@Barros9
Barros9 / pre-commit
Created April 30, 2022 13:11
Git hook pre commit ktlintCheck
#!/bin/bash
echo "Git hook pre commit ktlintCheck"
cd mobile-and || return
./gradlew app:ktlintCheck --daemon
STATUS=$?
# return 1 exit code if running checks fails
@Barros9
Barros9 / detekt.gradle
Last active November 6, 2020 08:59
Configure Detekt
plugins {
id("io.gitlab.arturbosch.detekt").version("1.14.2")
}
detekt {
toolVersion = "1.14.2"
input = files("$projectDir")
config = files("$project.projectDir/config/detekt.yml")
reports {
xml {
@Barros9
Barros9 / gitHookKtLintTask.gradle
Last active November 4, 2020 17:51
GitHookKtLintTask
task installGitHook(type: Copy) {
def lintingConfigScript = new File(rootProject.rootDir, '.git/hooks/pre-commit')
if (!lintingConfigScript.exists()) {
from new File(rootProject.rootDir, '.githooks/pre-commit')
into { new File(rootProject.rootDir, '.git/hooks') }
fileMode 0777
}
}
tasks.getByPath('app:preBuild').dependsOn installGitHook
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
clean:
import com.jakewharton.retrofit2.adapter.kotlin.coroutines.CoroutineCallAdapterFactory
import com.squareup.moshi.Moshi
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
import kotlinx.coroutines.Deferred
import retrofit2.Retrofit
import retrofit2.converter.moshi.MoshiConverterFactory
import retrofit2.http.GET
private const val BASE_URL = "PUT_HERE_URL"
import retrofit2.Call
import retrofit2.Retrofit
import retrofit2.converter.scalars.ScalarsConverterFactory
import retrofit2.http.GET
private const val BASE_URL = "PUT_HERE_URL"
private val retrofit = Retrofit.Builder()
.addConverterFactory(ScalarsConverterFactory.create())
.baseUrl(BASE_URL)