Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
echo ""
echo "[Waiting for launcher to start]"
LAUNCHER_READY=
while [[ -z ${LAUNCHER_READY} ]]; do
UI_FOCUS=`adb shell dumpsys window windows 2>/dev/null | grep -i mCurrentFocus`
echo "(DEBUG) Current focus: ${UI_FOCUS}"
case $UI_FOCUS in
### proguard-rules.pro ###
-keep class this.and.That { *; }
-dontwarn com.on.**
android {
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
// Custom build type, just for running instrumentation tests!!!
instrum {
// "Inherit" from 'release' buildType
### proguard-rules.pro ###
# Standard rules for my App:
-keep class this.and.That { *; }
-dontwarn com.on.**
# Some more rules so that my instrumentation tests could run:
-keep class com.thirdparty.Z { *; }
android {
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// Also consider the library's custom ProGuard rules
proguardFiles "${project(':thelibrary').projectDir}/proguard-rules-app.pro"
}
}
### proguard-rules.pro ###
# Standard rules for my App:
-keep class this.and.That { *; }
-dontwarn com.on.**
android {
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
// ...
}
@d4vidi
d4vidi / VolatileLiveData.kt
Last active June 14, 2020 23:26
A MutableLiveData variant that introduces a volatile behavior
package com.und0.vocabularymate.x.utils
import androidx.annotation.MainThread
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Observer
import java.util.concurrent.atomic.AtomicInteger
/**
* A [MutableLiveData] variant that introduces a _volatile_ behavior. Namely, it has no "memory" of values set
@d4vidi
d4vidi / PerfLogger2.java
Last active December 26, 2018 15:34
This is an improvement of Parashuram's `PerfLogger` described in http://blog.nparashuram.com/2018/11/react-native-performance-playbook-part-i.html, which allows for custom sections / events reporting alongside RN core's markers, and also enables the alignment of the report's 0-time with `Appication.onCreate()`
package com.parashuram;
import android.os.Process;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.ViewTreeObserver;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.bridge.ReactContext;
RVPagerSnapHelperListenable().attachToRecyclerView(
recyclerView,
object : RVPagerStateListener {
override fun onPageScroll(pagesState: List<VisiblePageState>) {/*...*/}
override fun onPageSelected(index: Int) {/*...*/}
override fun onScrollStateChanged(state: RVPageScrollState) {/*...*/}
})