Skip to content

Instantly share code, notes, and snippets.

View MossoIsai's full-sized avatar
🏠
Working from home

AR2D2 MossoIsai

🏠
Working from home
  • Morelos, México
View GitHub Profile
@wangerekaharun
wangerekaharun / gradleErrror
Created August 12, 2020 12:27
Error when you don't include the android and kotlin plugins
Unable to load class 'com.android.build.gradle.BaseExtension'.
Possible causes for this unexpected error include:
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)
Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
@stevdza-san
stevdza-san / MainActivity.kt
Last active April 27, 2023 11:00
Proto DataStore | YouTube Tutorial - https://youtu.be/5_Jy8Alcp14
package com.example.protodatastoretest
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import androidx.lifecycle.ViewModelProvider
import kotlinx.android.synthetic.main.activity_main.*
class MainActivity : AppCompatActivity() {
@MossoIsai
MossoIsai / ObserveOnceExtension.kt
Created May 19, 2021 02:33 — forked from kobeumut/ObserveOnceExtension.kt
Android Livedata Observe Once Only (Kotlin)
fun <T> LiveData<T>.observeOnce(lifecycleOwner: LifecycleOwner, observer: Observer<T>) {
observe(lifecycleOwner, object : Observer<T> {
override fun onChanged(t: T?) {
observer.onChanged(t)
removeObserver(this)
}
})
}
//Using
liveData.observeOnce(this, Observer<Password> {
@MossoIsai
MossoIsai / MainActivity.kt
Created June 17, 2021 14:02 — forked from stevdza-san/MainActivity.kt
Proto DataStore | YouTube Tutorial - https://youtu.be/5_Jy8Alcp14
package com.example.protodatastoretest
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import androidx.lifecycle.ViewModelProvider
import kotlinx.android.synthetic.main.activity_main.*
class MainActivity : AppCompatActivity() {
@Klerith
Klerith / instalaciones.md
Created August 25, 2021 21:31
Instalaciones necesarias para el curso de Git y GitHub
@MossoIsai
MossoIsai / ExpiringLruCache.java
Created February 16, 2024 15:12 — forked from christopherperry/ExpiringLruCache.java
LruCache for Android with expiring keys. Instead of modifying LruCache directly I used delegation to get around final keyword usage and a dirty hack to override everything else.
import android.os.SystemClock;
import android.support.v4.util.LruCache;
import java.util.HashMap;
import java.util.Map;
/**
* An Lru Cache that allows entries to expire after
* a period of time. Items are evicted based on a combination
* of time, and usage. Adding items past the {@code maxSize}