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
/* | |
* Copyright (C) 2016 Jeff Gilfelt. | |
* | |
* 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 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 android.os.Bundle | |
import android.support.annotation.LayoutRes | |
import android.support.v4.app.Fragment | |
import android.view.LayoutInflater | |
import android.view.View | |
import android.view.ViewGroup | |
import com.arellomobile.mvp.MvpDelegate | |
import com.google.android.gms.maps.GoogleMap | |
import com.google.android.gms.maps.MapView | |
import com.google.android.gms.maps.OnMapReadyCallback |
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
fun Resources.color(colorRes: Int) = | |
if (Build.VERSION.SDK_INT >= 23) { | |
this.getColor(colorRes, null) | |
} else { | |
this.getColor(colorRes) | |
} | |
fun ViewGroup.inflate(@LayoutRes layoutRes: Int, attachToRoot: Boolean = false): View { | |
return LayoutInflater.from(context).inflate(layoutRes, this, attachToRoot) | |
} |
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
/** | |
* Created by Konstantin Tskhovrebov (aka @terrakok) on 25.08.17. | |
*/ | |
class SimpleDividerDecorator( | |
private val dividerSizePx: Int, | |
dividerColor: Int | |
) : RecyclerView.ItemDecoration() { | |
private val paint = Paint().apply { color = dividerColor } | |
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 android.text.Editable | |
import android.text.TextWatcher | |
import android.view.View | |
import android.widget.EditText | |
/** | |
* Created by Konstantin Tskhovrebov (aka @terrakok) on 18.09.17. | |
*/ | |
class SmartField<T: Any>( | |
private val editText: EditText, |
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 io.ktor.utils.io.core.String | |
private const val BASE64_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" | |
private val BASE64_INVERSE_ALPHABET = IntArray(256) { BASE64_ALPHABET.indexOf(it.toChar()) } | |
fun String.encodeBase64(): String = String(encodeBase64ToByteArray()) | |
fun String.encodeBase64ToByteArray(): ByteArray = encodeToByteArray().encodeBase64() | |
fun ByteArray.encodeBase64ToString(): String = String(encodeBase64()) | |
fun String.decodeBase64(): String = String(decodeBase64ToByteArray()) |
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 android.os.Bundle | |
import androidx.annotation.LayoutRes | |
import androidx.fragment.app.Fragment | |
open class BaseFragment(@LayoutRes contentLayoutId: Int) : Fragment(contentLayoutId) { | |
protected lateinit var runId: String | |
private set | |
private var instanceStateSaved: Boolean = false | |
override fun onCreate(savedInstanceState: Bundle?) { |
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.CoroutineScope | |
import kotlinx.coroutines.Dispatchers | |
import kotlinx.coroutines.cancel | |
import timber.log.Timber | |
interface State | |
interface Action | |
interface Effect | |
interface Screen<T : State> { |