View GsonKotlinAdapterFactory
private val TAG: String = "GsonKotlinAdapter" | |
/** | |
* GsonKotlinAdapterFactory inspired by https://github.com/sargunv/gson-kotlin | |
*/ | |
internal class GsonKotlinAdapterFactory : TypeAdapterFactory { | |
private val Class<*>.isKotlinClass: Boolean | |
get() = declaredAnnotations.find { it.annotationClass.java.name == "kotlin.Metadata" } != null |
View OptionalExtension.kt
package com.aracem.android | |
inline fun <T, K> T?.ifPresent(block: (T) -> K): K? { | |
return this?.let { block.invoke(it) } | |
} | |
inline fun <K> K?.orElse(block: () -> K): K { | |
return this?.let { it } ?: block.invoke() | |
} |
View OnPageChangeListenerAdapter
open class OnPageChangeListenerAdapter : OnPageChangeListener { | |
override fun onPageScrollStateChanged(state: Int) { | |
} | |
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) { | |
} | |
override fun onPageSelected(position: Int) { | |
} | |
} |
View LaunchTestFromTerminal.txt
// Launch a test from a terminal | |
./gradlew :module:testFlavourBuildType --tests "*ClassNameTest" | |
./gradlew :module:testFlavourBuildType --tests "com.aracem.android.ClasNameTest" | |
// To attach Android Studio debugger | |
./gradlew :module:testFlavourBuildType --tests "*ClassNameTest" --debug-jvm | |
// Then wait until the compilation finished and attach a debuger. In Android studio use CTRL + SHIFT + A, | |
// search for "Debugger" and select attach to local source |
View TextColorMatcher
package com.homerthebulldog.android.matcher; | |
import android.content.res.Resources; | |
import android.support.annotation.ColorRes; | |
import android.support.test.espresso.matcher.BoundedMatcher; | |
import android.view.View; | |
import android.widget.TextView; | |
import org.hamcrest.Description; | |
import org.hamcrest.Matcher; |
View MasterTrackingHelper.java
package com.aracem.sample.tracking; | |
import android.app.Activity; | |
import android.app.Application; | |
import android.content.Context; | |
import android.support.annotation.NonNull; | |
import android.support.annotation.Nullable; | |
import com.aracem.sample.tracking.trackingservice.MixpanelTrackingHelper; | |
import com.aracem.sample.tracking.trackingservice.GoogleAnalyticsTrackingHelper; |
View Proguard config
# Add project specific ProGuard rules here. | |
# By default, the flags in this file are appended to flags specified | |
# in /Users/panavtec/Documents/android-sdk-macosx/tools/proguard/proguard-android.txt | |
# You can edit the include path and order by changing the ProGuard | |
# include property in project.properties. | |
# | |
# For more details, see | |
# http://developer.android.com/guide/developing/tools/proguard.html | |
# Add any project specific keep options here: |
View AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?> | |
<!-- | |
~ Copyright (c) 2015 Upclose.me All rights reserved. | |
~ | |
~ 0000000 xx | |
~ 00000000 xxxx | |
~ 0000000000 xxl | |
~ 00000000000000 | |
~ 000000000000 | |
~ 00000000 |
View AnimationViewUtils
package com.aracem.utils.animation; | |
import android.animation.Animator; | |
import android.animation.AnimatorListenerAdapter; | |
import android.animation.Keyframe; | |
import android.animation.ObjectAnimator; | |
import android.animation.PropertyValuesHolder; | |
import android.annotation.TargetApi; | |
import android.content.Context; | |
import android.os.Build; |
View RippleDelayedRunner.java
package com.fewlaps.android.quitnow.base.customview; | |
import android.os.Handler; | |
import android.view.View; | |
/** | |
* A simple way to call the common new Handler().postDelayed(..., time); | |
* to show the Ripple animation completely and then run a Runnable. This class | |
* have to be used like a {@link android.view.View.OnClickListener} | |
* |
NewerOlder