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
Observable.combineLatest( | |
ApiProvider.requestSource1(param1), | |
ApiProvider.requestSource2(param2), | |
this::combinedResponses) | |
.map(responseObject -> saveResponse(responseObject, context)) | |
.subscribeOn(Schedulers.io()) | |
.observeOn(AndroidSchedulers.mainThread()) | |
.subscribe(responseObject -> onResponseReceived(responseObject, listener), | |
null != errorCallback ? errorCallback : this::onFetchObjectFailed); |
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' | |
apply plugin: 'kotlin-android' | |
android { | |
compileSdkVersion 22 | |
buildToolsVersion "22.0.0" | |
defaultConfig { | |
applicationId "com.cavega.kotlinmusings" | |
minSdkVersion 16 |
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
// ** Kotlin implementation ** | |
// Singleton with inner trait | |
object LastFmManager { | |
public trait TopArtistsFetchEvent { | |
public fun topArtistsFetchSucceeded(artists: List<LastFmArtist>) | |
public fun topArtistsFetchFailed(throwable: Throwable) | |
} | |
// Other logic here |
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
<?xml version="1.0" encoding="utf-8"?> | |
<android.support.design.widget.CoordinatorLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<android.support.design.widget.AppBarLayout | |
android:id="@+id/appbar" | |
android:layout_width="match_parent" |