Skip to content

Instantly share code, notes, and snippets.

View travisdachi's full-sized avatar
🖖
Live long and prosper

Travis P travisdachi

🖖
Live long and prosper
View GitHub Profile
package com.blacklenspub.android.playground;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
public class FilterableArrayList<T> extends ArrayList<T> {
public FilterableArrayList(Collection<? extends T> c) {
super(c);
package com.blacklenspub.android.playground;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
public class ListUtil {
public static <T> List<T> filter(Iterable<T> source, Predicate<T> predicate) {
return filterTo(source, new ArrayList<T>(), predicate);
/**
* Pros:
* Super simple
*
* Cons:
* You need to [UseCase1.toObservable] and [Observable.blockingFirst] to exit Rx world
*/
interface UseCase1<T> {
fun toObservable(): Observable<T>
}
package net.appsynth.seven.domain
import io.reactivex.Completable
import io.reactivex.Observable
import net.appsynth.seven.models.promotion.PromotionData
object UseCase4
fun UseCase4.getPrepaid(): Observable<PromotionData> {
TODO()
class SampleTest {
lateinit var driver: AppiumDriver<WebElement>
val platform = MobilePlatform.IOS
@Before
fun setup() {
if (platform == MobilePlatform.ANDROID) {
val dir = System.getProperty("user.dir")
val path = Paths.get(dir, "apps/hello-appium.apk")
class SampleTest {
lateinit var driver: AppiumDriver<WebElement>
val platform = MobilePlatform.ANDROID
@Before
fun setup() {
if (platform == MobilePlatform.ANDROID) {
val dir = System.getProperty("user.dir")
val path = Paths.get(dir, "apps/hello-appium.apk")
@travisdachi
travisdachi / MainPage.kt
Last active August 25, 2017 07:42
MainPage for SampleTest
class MainPage(driver: AppiumDriver<WebElement>) {
init {
PageFactory.initElements(AppiumFieldDecorator(driver), this)
}
@AndroidFindBy(id = "com.blacklenspub.helloappium:id/tvLabel")
@iOSFindBy(xpath = "//XCUIElementTypeStaticText[1]")
lateinit var myLabel: WebElement
@AndroidFindBy(id = "com.blacklenspub.helloappium:id/btnGreet")
class Car {
val engine = Engine()
fun start() {
engine.start()
}
}
class Engine {
fun start() = //...
}
dependencies {
implementation 'com.google.code.gson:gson:2.8.5'
}
class Car(val engine: Engine) {
fun start() {
engine.start()
}
}