Skip to content

Instantly share code, notes, and snippets.

View galex's full-sized avatar

Alexander Gherschon galex

View GitHub Profile
@cbeyls
cbeyls / SuspendIntentService.kt
Created August 6, 2017 11:30
An Intent Service processing work in order from a Kotlin coroutine running on the main thread.
package be.digitalia.common.services
import android.app.Service
import android.content.Intent
import android.os.Message
import kotlinx.coroutines.experimental.android.UI
import kotlinx.coroutines.experimental.channels.Channel
import kotlinx.coroutines.experimental.channels.LinkedListChannel
import kotlinx.coroutines.experimental.launch
@yshrsmz
yshrsmz / 1_common.kt
Last active April 13, 2019 05:43
Multiplatform ViewModel
expect abstract class ViewModel() {
open fun onCleared()
}
@objcode
objcode / Permissions.kt
Last active February 21, 2023 23:01
Quick demo of compose permissions using activity result API. Uses Flow instead of State to make it reusable outside of Compose.
/*
* Copyright 2020 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