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 LoginViewModel { | |
| /* Inputs */ | |
| val userName: Subject<String> | |
| val password: Subject<String> | |
| val passwordRepetition: Subject<String> | |
| val login: Trigger | |
| /* Outputs */ |
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
| if (typeof kotlin === 'undefined') { | |
| throw new Error("Error loading module 'output'. Its dependency 'kotlin' was not found. Please, check whether 'kotlin' is loaded prior to 'output'."); | |
| } | |
| var output = function (_, Kotlin) { | |
| 'use strict'; | |
| var throwUPAE = Kotlin.throwUPAE; | |
| var Unit = Kotlin.kotlin.Unit; | |
| var IllegalStateException_init = Kotlin.kotlin.IllegalStateException_init; | |
| var toString = Kotlin.toString; | |
| var println = Kotlin.kotlin.io.println_s8jyv4$; |
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 MainActivity : AppCompatActivity() { | |
| private lateinit var textView: TextView | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| setContentView(R.layout.activity_main) | |
| textView = findViewById(R.id.text_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 MyActivity: AppCompatActivity() { | |
| private val lifecycleProvider = AndroidLifecycle.createLifecycleProvider(::getLifecycle) | |
| fun onCreate() { | |
| super.onCreate() | |
| fetchData() | |
| .flatMap(::prepareData) | |
| .compose(lifecycleProvider.bindToLifecycle()) |
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 MyActivity { | |
| var fetchDataDisposable: Disposable? = null | |
| /* ... */ | |
| fun onCreate() { | |
| super.onCreate() | |
| /* stuff */ | |
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
| val patternDetector: PatternDetector = (TrendDownPatternDetector().combineWithoutOverlap(TrendUpPatternDetector())) | |
| .combine(CheatDayPatternDetector().combineWithoutOverlap(SelfLyingPatternDetector()) | |
| .combine(DietPatternDetector()) | |
| .combine(MotivationBoostPatternDetector()) | |
| .combine(...) | |
| ... |
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
| fun PatternDetector.combineWithoutOverlap(other: PatternDetector): PatternDetector { | |
| return OverlapFreePatternConnector(this, other) | |
| } |
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 OverlapFreePatternDetectorConenctor ( | |
| private val first: PatternDetector, | |
| private val second: PatternDetector): PatternDetector { | |
| override fun findPatterns(data: List<Weight>): List<Pattern> { | |
| val firstPatterns = first(data) | |
| val secondPatterns = second(data) | |
| val overlaps = overlaps(firstPatterns, secondPatterns) |
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
| val patternDetector: PatternDetector = TrendDownPatternDetector() | |
| .combine(TrendUpPatternDetector()) | |
| .combine(CheatDayPatternDetector()) | |
| .combine(DietPatternDetector()) | |
| .combine(SelfLyingPatternDetector()) | |
| .combine(MotivationBoostPatternDetector()) | |
| .combine(...) | |
| ... |
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
| fun PatternDetector.combine(other: PatternDetector): PatternDetector { | |
| return PatternDetectorConnector(this, other) | |
| } |
NewerOlder