use of se.zinokader.spotiq.util.type.Empty in project SpotiQ by ZinoKader.
the class SongRecyclerAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(SongHolder songHolder, int i) {
Song song = songs.get(i);
Context context = songHolder.itemView.getContext();
songHolder.itemView.setOnClickListener(view -> onClickSubject.onNext(song));
songHolder.itemView.setOnLongClickListener(view -> {
curentlyLongClicking = true;
onLongClickSubject.onNext(song);
return true;
});
songHolder.itemView.setOnTouchListener((view, motionEvent) -> {
view.onTouchEvent(motionEvent);
if (motionEvent.getAction() == MotionEvent.ACTION_UP && curentlyLongClicking) {
onLongClickEndSubject.onNext(new Empty());
curentlyLongClicking = false;
}
return true;
});
String artistsName = ArtistMapper.joinArtistNames(song.getArtists());
Glide.with(context).load(song.getAlbumArtUrl()).diskCacheStrategy(DiskCacheStrategy.SOURCE).placeholder(R.drawable.image_album_placeholder).fitCenter().override(ApplicationConstants.LOW_QUALITY_ALBUM_ART_DIMENSION, ApplicationConstants.LOW_QUALITY_ALBUM_ART_DIMENSION).into(songHolder.albumArt);
songHolder.songName.setText(song.getName());
songHolder.artistsName.setText(artistsName);
songHolder.albumName.setText(song.getAlbum().name);
}
use of se.zinokader.spotiq.util.type.Empty in project SpotiQ by ZinoKader.
the class LoginPresenter method logInFailed.
void logInFailed(boolean hasPremium) {
String errorMessage = hasPremium ? "Something went wrong on Spotify authentication" : "You need a Spotify Premium account to log in";
Observable.just(new Empty()).observeOn(AndroidSchedulers.mainThread()).delay(ApplicationConstants.SHORT_ACTION_DELAY_SEC, TimeUnit.SECONDS, AndroidSchedulers.mainThread()).compose(this.deliverFirst()).subscribe(delayFinishedDelivery -> delayFinishedDelivery.split((loginView, empty) -> {
loginView.resetProgress();
loginView.showMessage(errorMessage);
}, (loginView, throwable) -> {
loginView.showMessage("Login failed, please try again");
}));
}
Aggregations