Skip to content

Instantly share code, notes, and snippets.

Avatar

Vitali Olshevski olshevski

View GitHub Profile
@olshevski
olshevski / reimagined_demo_2.kt
Created Feb 4, 2022
For "Compose Navigation Reimagined" blogpost on Medium
View reimagined_demo_2.kt
@Composable
fun NavHostScreen() {
val navController = rememberNavController<Screen>(
startDestination = Screen.First,
)
NavBackHandler(navController)
NavHost(controller = navController) { screen ->
when (screen) {
@olshevski
olshevski / reimagined_demo_1.kt
Last active Feb 4, 2022
For "Compose Navigation Reimagined" blogpost on Medium
View reimagined_demo_1.kt
sealed class Screen : Parcelable {
@Parcelize
object First : Screen()
@Parcelize
data class Second(val id: Int) : Screen()
@Parcelize
data class Third(val text: String) : Screen()
@olshevski
olshevski / settings.gradle.kts
Created Nov 5, 2021
Example of resolutionStrategy in pluginManagement block
View settings.gradle.kts
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
resolutionStrategy {
eachPlugin {
when {
requested.id.namespace == "com.android" -> {
@olshevski
olshevski / CMakeLists.txt
Created Dec 21, 2020
add OpenCV to a project using CMake
View CMakeLists.txt
cmake_minimum_required(VERSION 3.6)
# opencv
set(OpenCV_DIR ${CMAKE_CURRENT_SOURCE_DIR}/opencv-4.5.0/sdk/native/jni)
find_package(OpenCV REQUIRED core imgproc) # specify desired OpenCV modules here
# mylibname
add_library(mylibname SHARED nativeutils.cpp)
target_include_directories(mylibname PRIVATE
${OpenCV_INCLUDE_DIRS})
View twine.gradle
final String TWINE_INPUT_FILE = "${projectDir}/translations/twine.txt"
final String TWINE_OUTPUT_DIR = "${projectDir}/build/generated/twine"
android.applicationVariants.all { variant ->
variant.registerGeneratedResFolders(files(TWINE_OUTPUT_DIR))
}
task generateLocalizations {
description "Generates localizations from twine.txt file."
inputs.file(TWINE_INPUT_FILE)
View version.gradle
/*
* Initializes versionName and versionCode from version.properties file.
*
* Just create version.properties file in the project's or root project's folder with the next
* properties:
*
* major=1
* minor=2
* patch=3
*
View release-signing.gradle
/**
* Signs release build with the specified signature parameters. When parameters are omitted the
* release APK file will be left unsigned.
*
* By default, keystore.properties file in the project's or root project's folder will be used as a
* source of required signing data:
*
* storeFile=/Users/me/keyvault/release.keystore
* storePassword=pass123
* keyAlias=sampleAlias