From 45ac649e3313c9f8276274d8972708ce7246b540 Mon Sep 17 00:00:00 2001 From: xxxifan <445947962@qq.com> Date: Sun, 24 Oct 2021 21:59:09 +0800 Subject: [PATCH] add startLoopNow() function make it can start looping immediately --- .../java/com/zhpan/bannerview/BannerViewPager.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bannerview/src/main/java/com/zhpan/bannerview/BannerViewPager.java b/bannerview/src/main/java/com/zhpan/bannerview/BannerViewPager.java index 734a991..a840721 100644 --- a/bannerview/src/main/java/com/zhpan/bannerview/BannerViewPager.java +++ b/bannerview/src/main/java/com/zhpan/bannerview/BannerViewPager.java @@ -500,6 +500,17 @@ public void startLoop() { } } + /** + * Start loop immediately + */ + public void startLoopNow() { + if (!isLooping && isAutoPlay() && mBannerPagerAdapter != null && + mBannerPagerAdapter.getListSize() > 1) { + mHandler.post(mRunnable); + isLooping = true; + } + } + /** * Stop loop */