This file contains 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.animation.core.animateDpAsState | |
import androidx.compose.animation.fadeIn | |
import androidx.compose.animation.fadeOut | |
import androidx.compose.foundation.layout.Box | |
import androidx.compose.foundation.layout.WindowInsets | |
import androidx.compose.foundation.layout.consumeWindowInsets | |
import androidx.compose.foundation.layout.fillMaxSize | |
import androidx.compose.foundation.layout.navigationBars | |
import androidx.compose.foundation.layout.padding | |
import androidx.compose.foundation.layout.windowInsetsPadding |
This file contains 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
// этот файл поместить в корень проекта | |
cmake_minimum_required(VERSION 3.4.1) | |
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") | |
// адаптировать под структуру вашего проекта | |
set(SOURCES src/main/cpp/NativeRootChecker.cpp) | |
add_library(root_checker_jni SHARED ${SOURCES}) |
This file contains 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 kotlinx.coroutines.flow.FlowCollector | |
import kotlinx.coroutines.flow.StateFlow | |
import kotlinx.coroutines.flow.combine | |
/** | |
* Replacement for [combine][kotlinx.coroutines.flow.combine] operation for [StateFlow]s. | |
* Keeps the result as a [StateFlow], provides realtime results ([StateFlow] result). | |
* Also reduces number of allocations. | |
* | |
* @see kotlinx.coroutines.flow.combine |
This file contains 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
// This prints the dependencies of each task in the current execution graph | |
gradle.taskGraph.whenReady( | |
closureOf<TaskExecutionGraph> { | |
println("About to run ${allTasks.size} tasks: (use `-i` to see why tasks are skipped, use `--rerun-tasks` to prevent UP-TO-DATE checks)") | |
allTasks.forEachIndexed { i, task -> | |
val dependenciesString = | |
if (task.dependsOn.isEmpty()) { | |
"" | |
} else { | |
task.dependsOn.joinToString(", ", " (depends on ", ")") { dependency -> |
This file contains 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
// https://github.com/Kotlin/kotlinx.coroutines/issues/3626#issuecomment-1451115356 | |
// https://github.com/Kotlin/kotlinx.coroutines/issues/3626#issuecomment-1452820863 | |
suspend fun <ReturnT> Mutex.checkedWithLock( | |
block: suspend () -> ReturnT | |
): ReturnT { | |
val element = LockedMutexesElement(this).key | |
check (currentCoroutineContext()[element] == null) { | |
"Reentered Mutex" | |
} |
This file contains 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 ParallaxScreen(modifier: Modifier = Modifier) { | |
val context = LocalContext.current | |
val scope = rememberCoroutineScope() | |
var data by remember { mutableStateOf<SensorData?>(null) } | |
DisposableEffect(Unit) { | |
val dataManager = SensorDataManager(context) | |
dataManager.init() |
This file contains 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
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") | |
// Tooltip implementation for AndroidX Jetpack Compose | |
// See usage example in the next file | |
// Tested with Compose version **1.1.0-alpha06** | |
// Based on material DropdownMenu implementation. | |
import androidx.compose.animation.core.MutableTransitionState | |
import androidx.compose.animation.core.animateFloat |
This file contains 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 java.io.File | |
import java.nio.file.* | |
import java.nio.file.attribute.BasicFileAttributes | |
// Simple helper for AndroidX migration, written as Kotlin script | |
// Can be better then Android Studio migration | |
// But use at your own risk ;) | |
NewerOlder