From f46b5c7b9c7efb1e5a9b08bb9615da0741ceac86 Mon Sep 17 00:00:00 2001 From: zhpanvip Date: Tue, 14 Feb 2023 16:38:35 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20#299=20=20=E5=A6=82=E6=9E=9C=E4=B8=8D?= =?UTF-8?q?=E8=AE=BE=E7=BD=AElifecycleRegistry=EF=BC=8C=E4=BC=9A=E5=87=BA?= =?UTF-8?q?=E7=8E=B0=E7=A9=BA=E6=8C=87=E9=92=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/zhpan/bannerview/BannerViewPager.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bannerview/src/main/java/com/zhpan/bannerview/BannerViewPager.java b/bannerview/src/main/java/com/zhpan/bannerview/BannerViewPager.java index a5e6284..5f8cdc0 100644 --- a/bannerview/src/main/java/com/zhpan/bannerview/BannerViewPager.java +++ b/bannerview/src/main/java/com/zhpan/bannerview/BannerViewPager.java @@ -516,10 +516,10 @@ public void startLoop() { if (!isLooping && isAutoPlay() && mBannerPagerAdapter != null - && - mBannerPagerAdapter.getListSize() > 1 - && isAttachedToWindow() - && lifecycleRegistry.getCurrentState() == Lifecycle.State.RESUMED) { + && mBannerPagerAdapter.getListSize() > 1 + && isAttachedToWindow() && (lifecycleRegistry == null + || lifecycleRegistry.getCurrentState() == Lifecycle.State.RESUMED + || lifecycleRegistry.getCurrentState() == Lifecycle.State.CREATED)) { mHandler.postDelayed(mRunnable, getInterval()); isLooping = true; }