From fdc5fb4555b0dd4ebf749ae2770bab5487976edc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=8A=B2=E9=B9=8F?= Date: Wed, 14 Jun 2023 16:01:05 +0800 Subject: [PATCH] Android: fix npe --- .../src/main/java/pub/doric/shader/slider/SlideAdapter.java | 2 +- .../src/main/java/pub/doric/shader/slider/SliderNode.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doric-android/doric/src/main/java/pub/doric/shader/slider/SlideAdapter.java b/doric-android/doric/src/main/java/pub/doric/shader/slider/SlideAdapter.java index 6b140676..62e79c1a 100644 --- a/doric-android/doric/src/main/java/pub/doric/shader/slider/SlideAdapter.java +++ b/doric-android/doric/src/main/java/pub/doric/shader/slider/SlideAdapter.java @@ -76,7 +76,7 @@ class SlideAdapter extends RecyclerView.Adapter { 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); } } diff --git a/doric-android/doric/src/main/java/pub/doric/shader/slider/SliderNode.java b/doric-android/doric/src/main/java/pub/doric/shader/slider/SliderNode.java index 8f01dbe5..142bc467 100644 --- a/doric-android/doric/src/main/java/pub/doric/shader/slider/SliderNode.java +++ b/doric-android/doric/src/main/java/pub/doric/shader/slider/SliderNode.java @@ -99,7 +99,7 @@ public class SliderNode extends SuperNode { 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 { mView.scrollToPosition(page); } - if (slideStyle.equals("gallery")) { + if ("gallery".equals(slideStyle)) { mView.post(new Runnable() { @Override public void run() {