Skip to content

Instantly share code, notes, and snippets.

View benju69's full-sized avatar
🎯
Focusing

Benjamin Gonin benju69

🎯
Focusing
View GitHub Profile
import androidx.compose.animation.core.EaseInOut
import androidx.compose.animation.core.animateDpAsState
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.tween
import androidx.compose.desktop.ui.tooling.preview.Preview
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.hoverable
import androidx.compose.foundation.interaction.MutableInteractionSource
@LouisCAD
LouisCAD / ModalBottomSheet.kt
Last active November 20, 2023 09:16
Put this in its own Gradle module to have ModalBottomSheet in Material3 (or even without Material Design at all).
package com.louiscad.splitties.eap.bottomsheet
import android.app.Activity
import android.view.ViewGroup
import androidx.activity.compose.BackHandler
import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.material.ModalBottomSheetLayout
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.getValue
@alexjlockwood
alexjlockwood / CircleSquareView.kt
Created April 8, 2019 05:59
Inspired by @beesandbombs (twitter.com/beesandbombs)
import android.content.Context
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.util.AttributeSet
import android.view.View
import kotlin.math.cos
import kotlin.math.sin
import kotlin.math.sqrt
@riggaroo
riggaroo / PULL_REQUEST_TEMPLATE
Created February 3, 2019 14:34
Pull request template format. Add this file to your .github folder
<!--- Provide a general summary of your changes in the Title above -->
<!--- If there is no changelog entry, label this PR as trivial to bypass the Danger warning -->
## Description
<!--- Describe your changes in detail -->
## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
@nickbutcher
nickbutcher / LICENSE
Last active October 6, 2020 11:14
Fun with gradients and AnimatedVectorDrawables. Illustration by the wonderful https://twitter.com/VPoltrack
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
@soulduse
soulduse / ApiInterface.kt
Last active May 28, 2020 12:29
Example of usage kotlin-coroutines-retrofit
interface ApiInterface {
@GET("User")
fun getUser(
@Query("user_id") userId: String
): Deferred<User>
}
@maiconhellmann
maiconhellmann / DateExtension.kt
Last active August 17, 2023 07:36
Date extensions wrote in Kotlin
import java.text.SimpleDateFormat
import java.util.*
/**
* Pattern: yyyy-MM-dd HH:mm:ss
*/
fun Date.formatToServerDateTimeDefaults(): String{
val sdf= SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault())
return sdf.format(this)
}
<scheme name="Material Dark" version="142" parent_scheme="Darcula">
<!--
1. Install the Roboto Mono Regular font - https://fonts.google.com/specimen/Roboto+Mono?selection.family=Roboto+Mono
2. Copy `Material Dark.icls` to `~/Library/Preferences/AndroidStudio3.0/colors/`
3. Restart AS
4. Preferences > Editor > Color and Fonts > select Material Dark and press OK
-->
<option name="FONT_SCALE" value="1.0" />
@benju69
benju69 / RxJava.md
Created September 25, 2017 20:08 — forked from ZacSweers/RxJava.md
Party tricks with RxJava, RxAndroid & Retrolambda

View Click

Instead of the verbose setOnClickListener:

RxView.clicks(submitButton).subscribe(o -> log("submit button clicked!"));

Filter even numbers

Observable
    .just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
@rudchenkos
rudchenkos / CenterCropDrawable.java
Created July 14, 2017 12:47
Maintain aspect ratio of bitmap drawables set as windowBackground on Android
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.support.annotation.IntRange;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;