Skip to content

Instantly share code, notes, and snippets.

@taptappub
taptappub / build.gradle
Last active September 30, 2020 10:06 — forked from KenVanHoeylandt/build.gradle
Gradle auto-installing pre-commit hook
// Add it to the bottom of the root "build.gradle" file
apply from: rootProject.file('gradle/install-git-hooks.gradle')
private fun getCachedPaymentManager(): PaymentSystemPaymentManager? {
if (currentPaymentManager == null) {
currentPaymentManager = getPaymentManagerByToken(CmtSdk.tokenManager.getCurrentContactlessCmtSdkToken())
}
return currentPaymentManager
}
fun processCommandApdu(commandApdu: ByteArray?, extras: Bundle?): ByteArray? {
return getCachedPaymentManager()?.processCommandApdu(commandApdu, extras) ?: return null
}
object Prefs {
var name by AndroidSharedPreference("")
var size: Int? by AndroidSharedPreference(0)
var rage: Boolean? by AndroidSharedPreference(true)
var rage2: Boolean? by AndroidSharedPreference(true)
class AndroidSharedPreference<T>(private val default: T) {
private val APP_PREFERENCES = "mysettings"
object Prefs {
var name by AndroidSharedPreference("")
var size: Int? by AndroidSharedPreference(0)
var rage: Boolean? by AndroidSharedPreference(true)
var rage2: Boolean? by AndroidSharedPreference(true)
class AndroidSharedPreference<T>(private val default: T) {
operator fun getValue(prefs: Prefs, property: KProperty<*>): T? {