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
mDividerItemDecoration = new DividerItemDecoration(recyclerView.getContext(), | |
mLayoutManager.getOrientation()); | |
recyclerView.addItemDecoration(mDividerItemDecoration); |
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
public boolean canReuseUpdatedViewHolder(@NonNull RecyclerView.ViewHolder viewHolder) { | |
return true; | |
} |
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
public ItemHolderInfo recordPreLayoutInformation(@NonNull RecyclerView.State state, @NonNull RecyclerView.ViewHolder viewHolder, int changeFlags, @NonNull List<Object> payloads) { | |
if (changeFlags == FLAG_CHANGED) { | |
for (Object payload : payloads) { | |
if (payload instanceof String) { | |
return new CharacterItemHolderInfo((String) payload); | |
} | |
} | |
} | |
return super.recordPreLayoutInformation(state, viewHolder, changeFlags, payloads); | |
} |
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
@Override | |
public boolean animateChange(@NonNull RecyclerView.ViewHolder oldHolder, | |
@NonNull RecyclerView.ViewHolder newHolder, | |
@NonNull ItemHolderInfo preInfo, | |
@NonNull ItemHolderInfo postInfo) { | |
if (preInfo instanceof CharacterItemHolderInfo) { | |
CharacterItemHolderInfo recipesItemHolderInfo = (CharacterItemHolderInfo) preInfo; | |
CharacterRVAdapter.CharacterViewHolder holder = (CharacterRVAdapter.CharacterViewHolder) newHolder; | |
if (CharacterRVAdapter.ACTION_LIKE_IMAGE_DOUBLE_CLICKED.equals(recipesItemHolderInfo.updateAction)) { |
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
android { | |
… | |
defaultConfig { | |
… | |
} | |
… | |
signingConfigs { | |
release { | |
storeFile file(“app.keystore”) // Your Keystore file path | |
storePassword “password” // Your Keystore password |
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
private void getMovies() { | |
MoviesService service = retrofit.create(MoviesService.class); | |
Call<List<Movie>> call = service.getMovies(); | |
call.enqueue(new Callback<List<Movie>>() { | |
@Override | |
public void onResponse(Response<List<Movie>> response, Retrofit retrofit) { | |
saveMovies(response.body()) | |
getMovieCasts(response.body()) | |
} |
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
compile 'io.reactivex.rxjava2:rxjava:2.0.1' | |
compile 'io.reactivex.rxjava2:rxandroid:2.0.1' | |
compile 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0' |
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
public interface MoviesService { | |
@GET("v2/movies/trending") | |
Observable<List<Movie>> getMovies(); | |
@GET("v2/movies/{movieId}/casts") | |
Observable<List<Cast>> getCasts(@Path(movieId) String movieId); | |
} |
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
private List<Movies> movies = new ArrayList<>(); | |
movieService.getMovies() | |
.flatMap(new Function<List<Movie>, ObservableSource<Movie>>() { | |
@Override | |
public ObservableSource<Movie> apply(List<Movie> movies) | |
throws Exception { | |
return Observable.fromIterable(movies); | |
} | |
}) |
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
public interface MoviesService { | |
@GET("v2/movies/trending") | |
Call<List<Movie>> getMovies(); | |
@GET("v2/movies/{movieId}/casts") | |
Call<List<Cast>> getCasts(@Path(movieId) String movieId); | |
} |
OlderNewer