This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'com.android.application' | |
android { | |
compileSdkVersion 21 | |
buildToolsVersion "21.1.2" | |
defaultConfig { | |
applicationId "test.co.vv.myapplication" | |
minSdkVersion 15 | |
targetSdkVersion 21 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.android.builder.testing.ConnectedDeviceProvider | |
def DEVICES_PROPERTY = "devices" | |
ConnectedDeviceProvider.metaClass.getProperty = { String name -> | |
def metaProperty = delegate.metaClass.getMetaProperty(name) | |
def property = metaProperty.getProperty(delegate) | |
if (name.equals(DEVICES_PROPERTY) && project.hasProperty(DEVICES_PROPERTY)) { | |
def devicesSerials = project.getProperties().get(DEVICES_PROPERTY).split(/,/) | |
def devices = property.findAll {devicesSerials.contains(it.serialNumber)} | |
property = devices | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
D=$(pwd) | |
G="gradlew" | |
while [ ! -x "$D/$G" -a "$D" != "/" ]; do | |
D=$(dirname $D) | |
done | |
if [ ! -x "$D/$G" ]; then | |
echo "No Gradle found in current or parent directories!" | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
project.afterEvaluate { | |
project.("connectedDebugAndroidTest").doFirst { | |
def originalProvider = deviceProvider | |
deviceProvider = [ | |
getName : { originalProvider.getName() }, | |
init : { originalProvider.init() }, | |
terminate : { originalProvider.terminate() }, | |
getDevices : { filterDevices(originalProvider.getDevices()) }, | |
getTimeoutInMs: { originalProvider.getTimeoutInMs() }, | |
isConfigured : { originalProvider.isConfigured() }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.annotation.SuppressLint | |
import android.content.Context | |
import android.support.annotation.AttrRes | |
import android.support.design.widget.CoordinatorLayout | |
import android.support.v4.view.NestedScrollingChild2 | |
import android.support.v4.view.NestedScrollingChildHelper | |
import android.util.AttributeSet | |
import android.view.View | |
import com.douglas.startpage.R |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.animation.Animator | |
import android.animation.AnimatorListenerAdapter | |
import android.animation.TimeInterpolator | |
import android.content.Context | |
import android.support.design.animation.AnimationUtils | |
import android.support.design.widget.CoordinatorLayout | |
import android.support.design.widget.Snackbar | |
import android.support.v4.view.ViewCompat | |
import android.support.v7.widget.RecyclerView | |
import android.util.AttributeSet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.annotation.SuppressLint | |
import android.content.Context | |
import android.util.AttributeSet | |
import android.view.KeyEvent | |
import android.view.MotionEvent | |
import androidx.viewpager.widget.ViewPager | |
class NoSwipeabaleViewPager @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : ViewPager(context, attrs) { | |
@SuppressLint("ClickableViewAccessibility") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AccountOwnerTypeViewModelTest { | |
@Rule | |
@JvmField | |
val rule = InstantTaskExecutorRule() | |
val mainThreadSurrogate = newSingleThreadContext("UI thread") | |
@Before | |
fun setUp() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun <T: Any> notNull(lazyMessage: () -> Any): ReadWriteProperty<Any?, T> = NotNullVar(lazyMessage) | |
private class NotNullVar<T: Any>(val lazyMessage: () -> Any) : ReadWriteProperty<Any?, T> { | |
private var value: T? = null | |
override fun getValue(thisRef: Any?, property: KProperty<*>): T { | |
return value ?: throw IllegalStateException(lazyMessage.toString()) | |
} | |
override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
recycler_view.withBindings { | |
+DateBinding() | |
+IncomingMessageBinding() | |
+OutgoingMessageBinding() | |
} | |
recycler_view.submitList(listOf<Widget.State>(...)) | |
//**************************************************************// | |
class DateBinding : ItemBinding<DateWidget.State, DateWidget> { |
OlderNewer