Android: fix npe

This commit is contained in:
王劲鹏 2023-06-14 16:01:05 +08:00 committed by osborn
parent 722d0873d4
commit fdc5fb4555
2 changed files with 3 additions and 3 deletions

View File

@ -76,7 +76,7 @@ class SlideAdapter extends RecyclerView.Adapter<SlideAdapter.DoricViewHolder> {
sliderNode.getDoricContext().getDriver().getRegistry().onException(sliderNode.getDoricContext(), e);
}
if (sliderNode.slideStyle.equals("gallery")) {
if ("gallery".equals(sliderNode.slideStyle)) {
holder.itemView.getLayoutParams().width = DoricUtils.dp2px(this.itemWidth);
}
}

View File

@ -99,7 +99,7 @@ public class SliderNode extends SuperNode<RecyclerView> {
recyclerView.addItemDecoration(new RecyclerView.ItemDecoration() {
@Override
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
if (slideStyle.equals("gallery")) {
if ("gallery".equals(slideStyle)) {
int position = parent.getChildAdapterPosition(view);
LinearLayoutManager layoutManager = (LinearLayoutManager) parent.getLayoutManager();
@ -334,7 +334,7 @@ public class SliderNode extends SuperNode<RecyclerView> {
mView.scrollToPosition(page);
}
if (slideStyle.equals("gallery")) {
if ("gallery".equals(slideStyle)) {
mView.post(new Runnable() {
@Override
public void run() {