This file contains hidden or 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
operator fun invoke(): Flow<State> = timeApi | |
.ticker() | |
.combine(transitionApi.observeTransitionLog()) { now, transition -> | |
transition.toState(now) | |
} | |
.distinctUntilChanged() | |
.onEach { | |
try { | |
if (it is State.Pomodoro) turnOnZenMode() else turnOffZenMode() | |
} catch (e: Exception) { |
This file contains hidden or 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
@Provides | |
fun provideTimeApi() = object : TimeApi { | |
override fun now() = Instant.now().epochSecond.toInt() | |
override fun ticker(): Flow<Int> = kotlinx.coroutines.channels | |
.ticker(1_000) | |
.receiveAsFlow() | |
.map { now() } | |
} |
This file contains hidden or 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
$ cat .bash_profile | |
export JAVA_HOME=$(/usr/libexec/java_home) | |
export PATH="/usr/local/sbin:$PATH" | |
export PATH="/usr/local/bin:${PATH}" | |
export ANDROID_SDK_ROOT="/usr/local/share/android-sdk" | |
export ANDROID_HOME="/usr/local/share/android-sdk" | |
export ANDROID_NDK="$ANDROID_HOME/ndk-bundle" |
This file contains hidden or 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
env: | |
global: | |
- ANDROID_HOME=$HOME/android-sdk | |
- ANDROID_SDK_ROOT=$ANDROID_HOME | |
- PATH=$ANDROID_HOME/tools/bin:$PATH | |
- PATH=$ANDROID_HOME/platform-tools:$PATH | |
- PATH=$ANDROID_HOME/emulator:$PATH |
This file contains hidden or 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
language: java | |
jdk: | |
- oraclejdk8 |
This file contains hidden or 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 Presenter { | |
fun m() { | |
val questions = if(version == j) [ {A.text="English"}, {B}, {C} ] else [ {A.text = "japones"}, {B}, {C}, {D}] | |
view.showQuestions(questions) | |
} | |
} | |
interface View { |
This file contains hidden or 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 FormActivityTest { | |
companion object { | |
val ANY_NAME = "Gianpa" | |
val ANY_PHONE = "5512341234" | |
} | |
// For dealing with threads and ViewModels | |
@Rule | |
@JvmField |
This file contains hidden or 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
android { | |
... | |
defaultConfig { | |
... | |
testInstrumentationRunner "io.github.gianpamx.android.architecture.CustomTestRunner" | |
... | |
} | |
... |
This file contains hidden or 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 CustomTestRunner : AndroidJUnitRunner() { | |
@Throws(InstantiationException::class, IllegalAccessException::class, ClassNotFoundException::class) | |
override fun newApplication(cl: ClassLoader, className: String, context: Context): Application { | |
return super.newApplication(cl, TestApp::class.java!!.getName(), context) | |
} | |
} |
This file contains hidden or 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
interface TestAppComponent { | |
... | |
fun inject(formActivityTest: FormActivityTest) | |
... | |
} |