Skip to content

Instantly share code, notes, and snippets.

@bloooi
bloooi / CustomTheme.kt
Last active June 5, 2023 03:01
Compose Concurrency Dialog State System
@Composable
fun CustomTheme(
dialogState: DialogState? = null,
statusBarColor: Color = if (isSystemInDarkTheme()) Color.White else Color.White,
darkStatusIcon: Boolean = true,
navigationColor: Color = if (isSystemInDarkTheme()) Color.White else Color.White,
navigationDarkIcon: Boolean = true,
content: @Composable () -> Unit
) {
@bloooi
bloooi / Compose word break with FlowRow.kt
Last active November 26, 2023 14:10
한글이 단어개행이 안먹히는 문제점을 FlowRow 로 우회 적용
Column {
label.split("\n").forEach {
FlowRow {
it.split(" ").forEach {
Text(
text = "$it ",
)
}
}
}
@bloooi
bloooi / FontableText
Created February 22, 2022 08:08
Compose Required Baseline Top, Bottom Padding Text Component (컴포즈 Baseline 기준 Top, Bottom padding을 강제로 넣는 Text)
@Composable
fun FontableText(
text: String,
topBaseLinePadding: TextUnit,
bottomBaseLinePadding: TextUnit,
modifier: Modifier = Modifier,
color: Color = Color.Unspecified,
fontSize: TextUnit = TextUnit.Unspecified,
fontStyle: FontStyle? = null,
fontWeight: FontWeight? = null,
@bloooi
bloooi / RoundedLinearProgressbar
Last active March 4, 2022 04:04
Kotlin Compose Rounded corner Linear Progress bar
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.background
import androidx.compose.foundation.focusable
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.progressSemantics
import androidx.compose.material.*
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Color
@bloooi
bloooi / SegmentedControl.kt
Created December 4, 2021 12:28
iOS-style segmented control in Compose with Color Custom
package com.example.util.composable
import android.annotation.SuppressLint
import androidx.compose.animation.core.animateDpAsState
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.background
import androidx.compose.foundation.gestures.awaitFirstDown
import androidx.compose.foundation.gestures.forEachGesture
import androidx.compose.foundation.gestures.horizontalDrag
@bloooi
bloooi / ios_segue_prepare
Created May 28, 2018 12:07
if you use segue, prepare() is last pass before load destination viewController
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "example_segue" {
...
}
}
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>