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
interface PlacesService { | |
@GET("places/{id}") | |
Observable<Place> getPlaceById(@Path("id") int placeId); | |
} | |
interface UsersService { | |
@GET("users") | |
Observable<List<User>> listUsers(); | |
} |
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
interface PlacesService { | |
@GET("places/{id}") | |
Call<Place> getPlaceById(@Path("id") int placeId); | |
} | |
interface UsersService { | |
@GET("users") | |
Call<List<User>> listUsers(); | |
} |
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<Car> carsObservable = getBestSellingCarsObservable(); | |
carsObservable.subscribeOn(Schedulers.io()) | |
.filter(car -> car.type == Car.Type.ALL_ELECTRIC) | |
.filter(car -> car.price < 90000) | |
.map(car -> car.year + " " + car.make + " " + car.model) | |
.distinct() | |
.take(5) | |
.observeOn(AndroidSchedulers.mainThread()) | |
.subscribe(this::updateUi); |
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
getPerson(person => { | |
getPlanet(person, (planet) => { | |
getGalaxy(planet, (galaxy) => { | |
console.log(galaxy); | |
}); | |
}); | |
}); |
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
package com.example.pkg.myimageview; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.widget.ImageView; | |
import com.example.pkg.myimageviewlibrary.MyImageViewBasic; | |
public class MainActivity extends AppCompatActivity { |
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.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
tools:context=".MainActivity"> | |
<com.example.pkg.myimageviewlibrary.MyImageViewBasic | |
android:id="@+id/blackAndWhiteImage" |
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
package com.example.pkg.myimageviewlibrary; | |
import android.content.Context; | |
import android.content.res.TypedArray; | |
import android.graphics.ColorMatrix; | |
import android.graphics.ColorMatrixColorFilter; | |
import android.graphics.drawable.Drawable; | |
import android.util.AttributeSet; | |
import android.widget.ImageView; | |
import android.widget.RelativeLayout; |
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"?> | |
<resources> | |
<declare-styleable name="MyImageViewBasic"> | |
<attr name="imageSrc" format="reference"/> | |
<attr name="imagePlaceholder" format="reference"/> | |
<attr name="imageError" format="reference"/> | |
<attr name="isBlackAndWhite" format="boolean"/> | |
</declare-styleable> | |
</resources> |
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
package com.example.pkg.myimageviewlibrary; | |
import android.content.Context; | |
import android.util.AttributeSet; | |
import android.widget.RelativeLayout; | |
public class MyImageViewBasic extends RelativeLayout { | |
public MyImageViewBasic(Context context) { | |
super(context); | |
} |
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"?> | |
<FrameLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<ImageView | |
android:id="@+id/my_image_view" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" /> |
NewerOlder