@Override public void onStart() { super.onStart(); favedCommentService .favedCommentIds() .compose(bindToLifecycle()) .subscribe(commentsAdapter::setFavedComments); }
@Override public void onCommentMarkAsFavoriteClicked(Comment comment, boolean markAsFavorite) { Observable<Void> result; if (markAsFavorite) { result = favedCommentService.save( ImmutableFavedComment.builder() .id(comment.getId()) .name(comment.getName()) .content(comment.getContent()) .created(comment.getCreated()) .up(comment.getUp()) .down(comment.getDown()) .mark(comment.getMark()) .thumb(feedItem.getThumb()) .itemId(feedItem.getId()) .flags(feedItem.getFlags()) .build()); } else { result = favedCommentService.delete(comment.getId()); } result .compose(bindUntilEvent(FragmentEvent.DESTROY_VIEW)) .subscribe(Actions.empty(), defaultOnError()); if (singleShotService.isFirstTime("kfav-userscript-hint")) { DialogBuilder.start(getContext()) .content(R.string.hint_kfav_userscript) .positive( R.string.open_website, di -> { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://goo.gl/py7xNW")); getContext().startActivity(intent); }) .negative(R.string.ignore) .show(); } }