Skip to content

Instantly share code, notes, and snippets.

View emeowj's full-sized avatar
🗽
supermiao

Xiaoming emeowj

🗽
supermiao
View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<title>8-Bit Book Club</title>
<link>http://8bitbookclub.getenjoyment.net</link>
<description>The only book club that makes you dumber! Join Brian Murphy, Emily Axford, and Caldwell Tanner for a weekly chat about video game novels.</description>
<atom:link href="http://8bitbookclub.getenjoyment.net/8BBC.rss" rel="self" type="application/rss+xml"/>
<itunes:owner>
<itunes:name>Byron Murphy</itunes:name>
<itunes:email>[email protected]</itunes:email>
@emeowj
emeowj / DialControl.kt
Last active November 4, 2024 23:34
DialControl Final Code
import androidx.annotation.FloatRange
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.Spring
import androidx.compose.animation.core.VectorConverter
import androidx.compose.animation.core.spring
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.scaleIn
import androidx.compose.animation.scaleOut
@emeowj
emeowj / DialControl.kt
Last active December 5, 2024 06:36
DialControl Step 2
@Composable
fun <T> DialControlBox(
options: List<T>,
optionContent: @Composable (T, Boolean) -> Unit,
onSelected: (T) -> Unit,
modifier: Modifier = Modifier, config: DialConfig = DialConfig()
) {
val coroutineScope = rememberCoroutineScope()
var visible by remember { mutableStateOf(false) }
var offset by remember { mutableStateOf(Offset.Zero) }
@emeowj
emeowj / DialControl.kt
Last active October 11, 2024 19:41
DialControl Refactored
data class DialConfig(
val dialSize: Dp = 240.dp,
val indicatorSize: Dp = 32.dp,
@FloatRange(from = 0.0, to = 1.0) val cutOffFraction: Float = 0.4f,
)
@Composable
private fun <T> DialControl(
options: List<T>,
optionContent: @Composable (T) -> Unit,
@emeowj
emeowj / SpeedControl.kt
Last active June 30, 2024 09:01
Custom Slider compoent using anchoredDraggable: https://xiaoming.dev/post/anchored-draggable-for-speed-and-fun
import androidx.compose.animation.core.tween
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.gestures.AnchoredDraggableState
import androidx.compose.foundation.gestures.DraggableAnchors
import androidx.compose.foundation.gestures.Orientation
import androidx.compose.foundation.gestures.anchoredDraggable
import androidx.compose.foundation.gestures.animateTo
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column