Skip to content

Instantly share code, notes, and snippets.

@prilaga
prilaga / LiveTemplates.txt
Created August 24, 2023 10:36
Android Studio templates to speed up writing boilerplate code.
1. mlData (applicable in Kotlin except Comment)
private val _$NAME$ = MutableLiveData<$PARAM_TYPE$>($INITIAL_VALUE$)
val $NAME$ : LiveData<$PARAM_TYPE$> = _$NAME$
2. sleData (applicable in Kotlin except Comment)
private val _$NAME$ = SingleLiveEvent<$PARAM_TYPE$>()
val $NAME$ : LiveData<$PARAM_TYPE$> = _$NAME$
3. hiltvm (applicable in top-level)
@dagger.hilt.android.lifecycle.HiltViewModel
import android.os.SystemClock
import android.view.View
/**
* Implements the "throttle first" mechanism for click listeners, to prevent double taps.
*
* How it works:
* - Define a sampling window time (default: 500ms)
* - when you click at time T0, the first click gets dispatched and the subsequent ones happening
* between T0 and T0 + WindowTime gets ignored
{
"rules": {
// Admin access.
".read": "auth.token.admin === true",
".write": "auth.token.admin === true",
"admins": {
".read": "false", // Only a cloud function or admins can update this.
".write": "false", // Only a cloud function or admins can update this.
"$index": {
"email": {
/**
* https://hannesdorfmann.com/abstraction-text-resource/
*/
sealed class TextResource {
class Raw(val str: String) : TextResource()
class TextId(val id: Int) : TextResource()
class TextIdArgString(val id: Int, val arg: String) : TextResource()
class TextIdArgInt(val id: Int, val arg: Int) : TextResource()
class TextIdArgId(val id: Int, val argRes: Int) : TextResource()
@prilaga
prilaga / genymotionwithplay.md
Created November 23, 2016 10:03 — forked from udev/genymotionwithplay.md
Genymotion with Google Play Services

#Download the following ZIPs: ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)

#Download the correct GApps for your Android version: Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip) Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip) Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip) Google Apps for Android 4.4.4 (https://www.androidfilehost.com/?fid=23501681358544845 - gapps-kk-20140606-signed.zip) Google Apps for Android 4.3 (https://www.androidfilehost.com/?fid=23060877490000124 - gapps-jb-20130813-signed.zip) Google Apps for Android 4.2 (https://www.androidfilehost.com/?fid=23060877490000128 - gapps-jb-20130812-signed.zip)