Skip to content

Instantly share code, notes, and snippets.

View dmitriev-alexey's full-sized avatar

Alexey Dmitriev dmitriev-alexey

View GitHub Profile
@dmitriev-alexey
dmitriev-alexey / GooglePlayServices.kt
Created December 22, 2020 14:31 — forked from LouisCAD/GooglePlayServices.kt
Allows using Google Play Services Task API in Kotlin Coroutines, plus Play Services availability check made easier.
import com.google.android.gms.common.GoogleApiAvailability
import com.google.android.gms.tasks.Task
import splitties.init.appCtx
import kotlin.coroutines.experimental.suspendCoroutine
val googleApiAvailability = GoogleApiAvailability.getInstance()!!
inline val playServicesAvailability get() = googleApiAvailability.isGooglePlayServicesAvailable(appCtx)
@JvmName("awaitVoid")
suspend fun Task<Void>.await() = suspendCoroutine<Unit> { continuation ->
import android.content.SharedPreferences
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty
class Preference<T>(
private val preferences: SharedPreferences,
private val name: String,
private val default: T
) : ReadWriteProperty<Any?, T> {
@dmitriev-alexey
dmitriev-alexey / AndroidJavaCodeReview.md
Created December 26, 2017 10:28 — forked from srivastavarobin/AndroidJavaCodeReview.md
Code Review Checklist for Android (Java Only)

My Android Java Code Review Checklist

  1. Is the functionality correct?
  2. Are the classes named suitably?
  3. Are the functions named suitably?
  4. How's the datastructure being used? Is it the correct DS or it needs improvement?
  5. Can the classes be further borken into small classes?
  6. Do we need an interface?
  7. If it contain functions that can be reused later then are there Utils created for them?
  8. Can it use already available Util functions?
  9. Does the large set of input for a function deserve a new bean to be created?
@dmitriev-alexey
dmitriev-alexey / VIPER Android Example.kt
Created October 24, 2017 05:34 — forked from marciogranzotto/VIPER Android Example.kt
This is an example of Android development with VIPER in Kotlin
interface LoginContracts {
interface View {
fun showError(message: String)
}
interface Presenter {
fun onDestroy()
fun onLoginButtonPressed(username: String, password: String)
}
@dmitriev-alexey
dmitriev-alexey / designer.html
Last active August 29, 2015 14:12
designer
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../paper-tabs/paper-tabs.html">
<link rel="import" href="../paper-tabs/paper-tab.html">
<link rel="import" href="../core-animated-pages/core-animated-pages.html">