For example, you want to set 40% alpha transparence to #000000
(black color), you need to add 66
like this #66000000
.
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
data class RGBA(var red: Long = 0, var green: Long = 0, var blue: Long = 0, var alpha: Double = 0.0) | |
fun main() { | |
// rgba-order | |
val base = RGBA(124, 77, 255, 0.06) | |
val added = RGBA(255, 255, 255, 0.06) | |
val mix = RGBA() | |
// alpha | |
mix.alpha = 1 - (1 - added.alpha) * (1 - base.alpha) |
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.Build | |
import android.security.KeyPairGeneratorSpec | |
import android.security.keystore.KeyGenParameterSpec | |
import android.security.keystore.KeyProperties | |
import android.util.Base64 | |
import timber.log.Timber | |
import java.math.BigInteger | |
import java.security.GeneralSecurityException | |
import java.security.KeyPairGenerator | |
import java.security.KeyStore |
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
package com.andevapps.ontv.extension | |
import android.os.Parcel | |
import android.os.Parcelable | |
import androidx.work.Data | |
import java.io.* | |
fun Data.Builder.putParcelable(key: String, parcelable: Parcelable): Data.Builder { | |
val parcel = Parcel.obtain() | |
try { |
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.graphics.Canvas | |
import android.graphics.drawable.Drawable | |
import androidx.recyclerview.widget.RecyclerView | |
class ItemDecorationWithoutLastItem(private val divider: Drawable) : RecyclerView.ItemDecoration() { | |
override fun onDrawOver(c: Canvas, parent: RecyclerView, state: RecyclerView.State) { | |
super.onDrawOver(c, parent, state) | |
val left = parent.paddingLeft | |
val right = parent.width - parent.paddingRight |
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 <T> ComponentActivity.collectLatestLifecycleFlow(flow: Flow<T>, collect: suspend (T) -> Unit) { | |
lifecycleScope.launch { | |
repeatOnLifecycle(Lifecycle.State.STARTED) { | |
flow.collectLatest(collect) | |
} | |
} | |
} |
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
class OnThrottleClickListener( | |
private val dispatcher: CoroutineDispatcher, | |
private val onClickListener: View.OnClickListener, | |
private val interval: Long, | |
) : View.OnClickListener { | |
private var isClickable = true | |
override fun onClick(view: View) { | |
if (isClickable) { |
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.content.SharedPreferences | |
import kotlinx.coroutines.Dispatchers | |
import kotlinx.coroutines.GlobalScope | |
import kotlinx.coroutines.InternalCoroutinesApi | |
import kotlinx.coroutines.channels.Channel | |
import kotlinx.coroutines.flow.Flow | |
import kotlinx.coroutines.flow.FlowCollector | |
import kotlinx.coroutines.launch | |
import kotlinx.coroutines.withContext | |
import kotlin.properties.ReadWriteProperty |
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
# <type>: <subject> | |
##### Subject 50 characters ################# -> | | |
# Body Message | |
######## Body 72 characters ####################################### -> | | |
# Issue Tracker Number or URL | |
# --- COMMIT END --- |
NewerOlder