Skip to content

Commit

Permalink
[Fix] Card list blank
Browse files Browse the repository at this point in the history
  • Loading branch information
rh-id committed Aug 8, 2023
1 parent 7ccedb4 commit 6e5c7a9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;

import co.rh.id.lib.rx3_utils.subject.SerialBehaviorSubject;
import co.rh.id.lib.rx3_utils.subject.SerialOptionalBehaviorSubject;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.schedulers.Schedulers;
import io.reactivex.rxjava3.subjects.PublishSubject;
Expand Down Expand Up @@ -59,10 +59,10 @@ public class CardListSV extends StatefulView<Activity> implements RequireCompone
private transient CardRecyclerViewAdapter mCardRecyclerViewAdapter;
private transient RecyclerView.OnScrollListener mOnScrollListener;

private final SerialBehaviorSubject<Long> mDeckId;
private final SerialOptionalBehaviorSubject<Long> mDeckId;

public CardListSV() {
mDeckId = new SerialBehaviorSubject<>();
mDeckId = new SerialOptionalBehaviorSubject<>(null);
}

@Override
Expand Down Expand Up @@ -114,7 +114,7 @@ protected View createView(Activity activity, ViewGroup container) {
mRxDisposer.add("createView_onDeckIdChanged",
mDeckId.getSubject().observeOn(AndroidSchedulers.mainThread())
.subscribe(aLong -> {
mPagedCardItemsCmd.setDeckId(aLong);
mPagedCardItemsCmd.setDeckId(aLong.orElse(null));
mPagedCardItemsCmd.refresh();
}));
mRxDisposer
Expand Down Expand Up @@ -171,7 +171,7 @@ public void onRefresh() {
mPagedCardItemsCmd.refresh();
}

public void setDeckId(long deckId) {
public void setDeckId(Long deckId) {
mDeckId.onNext(deckId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ protected void initState(Activity activity) {
Args args = Args.of(mNavRoute);
if (args != null) {
mCardListSV.setDeckId(args.getDeck().id);
} else {
mCardListSV.setDeckId(Long.MIN_VALUE);
}
}

Expand Down

0 comments on commit 6e5c7a9

Please sign in to comment.