0x3d.Site
is designed for aggregating information.
check repository here
heart-switch
A heart-shaped toggle switch component built using Jetpack Compose. Inspired by Tore Bernhoft's I heart toggle Dribbble shot and Anatoliy Gatt's React component.
Getting Started
Add the following code to your project's root build.gradle
file:
repositories {
maven { url "https://jitpack.io" }
}
Next, add the dependency below to your module's build.gradle
file:
dependencies {
implementation "com.github.popovanton0:heart-switch:LATEST_VERSION"
}
Usage
Examples are in the source code.
Basic
@Composable
fun BasicUsage() {
var state by remember { mutableStateOf(true) }
HeartSwitch(
checked = state,
onCheckedChange = { state = it },
)
}
Advanced
@Composable
fun AdvancedUsage() {
var state by remember { mutableStateOf(true) }
HeartSwitch(
checked = state,
onCheckedChange = { state = it },
modifier = Modifier,
colors = HeartSwitchColors(
checkedTrackColor = Color(0xFFE91E63),
checkedTrackBorderColor = Color(0xFFC2185B),
uncheckedTrackBorderColor = Color(0xFFBDBDBD)
),
width = 34.dp,
borderWidth = 2.1.dp,
movementAnimSpec = spring(stiffness = Spring.StiffnessMediumLow),
colorsAnimSpec = spring(stiffness = Spring.StiffnessMediumLow),
thumb = { modifier, color ->
Box(
modifier = modifier
.shadow(12.dp, CircleShape)
.background(color.value, CircleShape)
)
},
enabled = true,
interactionSource = remember { MutableInteractionSource() },
)
}
You can customize colors using HeartSwitchColors
class:
data class HeartSwitchColors(
val checkedThumbColor: Color = Color.White,
val checkedTrackColor: Color = Color(0xffff708f),
val checkedTrackBorderColor: Color = Color(0xffff4e74),
val uncheckedThumbColor: Color = Color.White,
val uncheckedTrackColor: Color = Color.White,
val uncheckedTrackBorderColor: Color = Color(0xffd1d1d1),
)
And, you even can fully customize thumb's appearance using thumb
composable param. Default
implementation is:
@Composable
fun Thumb(modifier: Modifier, color: State<Color>) = Box(
modifier = modifier
.shadow(6.dp, CircleShape)
.background(color.value, CircleShape)
)
Kotlin
Kotlin is a modern programming language interoperable with Java, designed for Android development. It offers a concise syntax and powerful features like null safety and coroutines, streamlining app development.
Kotlin | The Kotlin Blog
Build software better, together
Build software better, together
GitHub - z-huang/InnerTune: A Material 3 YouTube Music client for Android
Build software better, together
quasar/quasar-kotlin at master · puniverse/quasar
Kotlin Programming Language
GitHub - KotatsuApp/Kotatsu: Manga reader for Android
GitHub - iamr0s/Dhizuku: A Android Application for share DeviceOwner
Kotlin: An Illustrated Guide
GitHub - cansik/kotlin-latex-listing: A syntax highlighting template for the Kotlin language in LaTeX listings.
GitHub - qwertukg/xml-builder: Simplest XML builder for Kotlin
GitHub - cesarferreira/kotlin-pluralizer: :sunny: Kotlin extension to pluralize and singularize strings
Kotlin Cheat Sheet
GitHub - vert-x3/vertx-lang-kotlin: Vert.x for Kotlin
GitHub - hotchemi/khronos: An intuitive Date extensions in Kotlin.
GitHub - icela/FriceEngine: :video_game: JVM game engine based on Swing/JavaFX.
GitHub - holgerbrandl/jsonbuilder: A small artefact to build json with kotlin
Kotlin Standard Functions cheat-sheet
GitHub - MarkusAmshove/Kluent: Fluent Assertion-Library for Kotlin
GitHub - jershell/kbson: Mongo BSON support for kotlinx.serialization.
GitHub - sepatel/tekniq: A framework designed around Kotlin providing Restful HTTP Client, JDBC DSL, Loading Cache, Configurations, Validations, and more
GitHub - Ahoo-Wang/Simba: Distributed lock service | 分布式锁服务
GitHub - JetBrains/intellij-community: IntelliJ IDEA Community Edition & IntelliJ Platform
GitHub - seniorjoinu/reliable-udp: Multiplexed, coroutine-powered reliable UDP for Kotlin using fountain codes
GitHub - hypercube1024/firefly: Firefly is an asynchronous web framework for rapid development of high-performance web application.
GitHub - davidepianca98/KMQTT: Kotlin Multiplatform MQTT client & embeddable and standalone broker
GitHub - L-Briand/KTM: Mustache template engine in kotlin multiplatform
GitHub - sergeshustoff/dikt: Simple and powerful DI for kotlin multiplatform
GitHub - ParserKt/ParserKt: Naive one-pass recursive descent, scannerless parser framework for Kotlin
More on Kotlin
Programming Tips & Tricks
Code smarter, not harder—insider tips and tricks for developers.
Using Lua's Garbage Collector for Fine-Tuned Memory Management in Large Applications
#1
Leveraging Lua's Environment for Dynamic Code Execution and Security
#2
Mastering Lua's Table Manipulation: Advanced Techniques for Handling Large Data Sets
#3
Enhancing Code Readability and Debugging with Lua's Debug Library
#4
Leveraging Lua's Coroutines for Efficient Concurrency and Asynchronous Programming
#5
Leveraging Lua's Tail Call Optimization for Efficient Recursion and Avoiding Stack Overflow in Deep Recursive Functions
#6
Creating Custom Iterators in Lua for Traversing Complex Data Structures Like Graphs or Trees
#7
How to Maximize the Speed of Data Lookup in Lua Using Hash Tables and Optimized Table Management
#8
Advanced Techniques for Asynchronous Programming in Lua Using Coroutines for High-Performance Systems
#9
Mastering Efficient Memory Management in Lua with Weak Tables for Optimal Resource Utilization
#10
Error Solutions
Turn frustration into progress—fix errors faster than ever.
Visual Studio Crashes When Opening a File or Debugging a Project
#1
Visual Studio Cannot Connect to GitHub or Other Version Control System
#2
Visual Studio Freezes During Build or Debug Process
#3
Visual Studio Fails to Build Project with "Unable to Start Program" Error
#4
Visual Studio Shows "Cannot Open the Solution" Error Message When Opening a Project
#5
Visual Studio Crashes on Startup with "The application has encountered an error" Message
#6
Visual Studio Fails to Detect Changes in Files When Using Git Integration
#7
Visual Studio Crashes with "Unknown Exception" When Trying to Build Solution
#8
Visual Studio Hangs During Debugging with "Unable to Start Program" Error
#9
Visual Studio Fails to Load Solution with "The system cannot find the file specified" Error
#10
Shortcuts
The art of speed—shortcuts to supercharge your workflow.
Maximize Your Code Navigation with Cmd + Option + Left Arrow!
#1
Feel Like a Pro with Cmd + Control + D: Quickly View Definitions Like Never Before!
#2
Unlock Speed and Precision with Cmd + Shift + M: Maximize Your Productivity!
#3
Don’t Panic, Use Cmd + Option + I to Open the Developer Tools Now!
#4
Stop Wasting Time and Jump to Your File in an Instant with Cmd + Shift + O!
#5
Quickly Fix Your Code with ‘Cmd + Option + L’ for Instant Code Formatting!
#6
Transform Your Workflow with ‘Cmd + Shift + N’ to Open a New Window in No Time!
#7
Say Goodbye to Mouse: Master ‘Cmd + Shift + F’ to Search Your Entire Codebase!
#8
Struggling to Find Files? Hit ‘Cmd + P’ and Jump Right to Your File!
#9
Never Lose Your Progress Again: Use ‘Cmd + Z’ to Undo Mistakes Instantly!
#10
Made with ❤️
to provide resources in various ares.