This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun Float.dpToPx(): Float = with(LocalDensity.current) { this@dpToPx.dp.toPx() } | |
@Composable | |
fun Int.dpToPx(): Float = with(LocalDensity.current) { this@dpToPx.dp.toPx() } | |
val circleRadius = 12.dp.dpToPx() | |
fun <T> SnapshotStateList<T>.toggle(item: T) { | |
if (contains(item)) remove(item) else add(item) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun String.toAnnotatedTextWithArabicDiacritics( | |
diacriticsStyle: SpanStyle = SpanStyle(color = Color.Red) | |
): AnnotatedString { | |
val builder = AnnotatedString.Builder() | |
// اعراب عربی که باید قرمز شوند | |
val arabicDiacritics = setOf( | |
'\u064B', // فتحتان (ً) | |
'\u064C', // ضمتان (ٌ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Qualifier | |
@Retention(AnnotationRetention.BINARY) | |
annotation class SharedPreferencesFileNameKey | |
@Qualifier | |
@Retention(AnnotationRetention.BINARY) | |
annotation class LanguageCodeKey | |
@Module | |
@InstallIn(SingletonComponent::class) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun interface OnAction { | |
fun execute(context: Context) | |
companion object { | |
fun withLogging(tag: String = "MyAction", | |
message: String = "Button clicked", | |
action: (Context) -> Unit | |
): OnAction { | |
return OnAction { context -> | |
Log.d(tag, message) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import androidx.compose.runtime.Composable | |
import androidx.compose.ui.Modifier | |
import androidx.lifecycle.ViewModel | |
import androidx.lifecycle.viewModelScope | |
import kotlinx.coroutines.flow.MutableStateFlow | |
import kotlinx.coroutines.flow.SharingStarted | |
import kotlinx.coroutines.flow.asStateFlow | |
import kotlinx.coroutines.flow.combine | |
import kotlinx.coroutines.flow.distinctUntilChangedBy | |
import kotlinx.coroutines.flow.launchIn |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (C) 2017 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (C) 2017 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (C) 2017 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import androidx.compose.foundation.layout.PaddingValues | |
import androidx.compose.runtime.* | |
import androidx.compose.ui.Modifier | |
import androidx.compose.ui.layout.SubcomposeLayout | |
import androidx.compose.ui.layout.SubcomposeLayoutState | |
import androidx.compose.ui.layout.SubcomposeSlotReusePolicy | |
import androidx.compose.ui.unit.* | |
import java.time.LocalDate | |
/** |
NewerOlder