zhpanvip / viewpagerindicator

🔥 Worked with ViewPager and ViewPager2,support multiple slider styles and multiple slide mode.This repo was split from BannerViewPager-
https://github.com/zhpanvip/BannerViewPager
Apache License 2.0
712 stars 59 forks source link

Indicator style Scale is not working with SCALE & ROUND_RECT #24

Closed Rad-98 closed 2 years ago

Rad-98 commented 2 years ago

I try use SCALE mode and ROUND_RECT style, but is not working

indicator.setupWithViewPager(viewPagerGraffiti); indicator.setSliderColor(Color.parseColor("#ffffff"),Color.parseColor("#1FC0EB")); indicator.setSlideMode(IndicatorSlideMode.SCALE); indicator.setIndicatorStyle(IndicatorStyle.ROUND_RECT); indicator.setSliderHeight(20f); indicator.setSliderWidth(5,10);

Error: E/AndroidRuntime: FATAL EXCEPTION: main Process: ir.faraketab.player, PID: 3491 kotlin.TypeCastException: null cannot be cast to non-null type kotlin.Int at com.zhpan.indicator.drawer.CircleDrawer.drawScaleSlider(CircleDrawer.kt:87) at com.zhpan.indicator.drawer.CircleDrawer.drawSlider(CircleDrawer.kt:49) at com.zhpan.indicator.drawer.CircleDrawer.onDraw(CircleDrawer.kt:30) at com.zhpan.indicator.drawer.DrawerProxy.onDraw(DrawerProxy.kt:42) at com.zhpan.indicator.IndicatorView.onDraw(IndicatorView.kt:60) at android.view.View.draw(View.java:20207) at android.view.View.updateDisplayListIfDirty(View.java:19082) at android.view.View.draw(View.java:19935) at android.view.ViewGroup.drawChild(ViewGroup.java:4333) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112) at android.view.View.updateDisplayListIfDirty(View.java:19073) at android.view.View.draw(View.java:19935) at android.view.ViewGroup.drawChild(ViewGroup.java:4333) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112) at android.view.View.updateDisplayListIfDirty(View.java:19073) at android.view.View.draw(View.java:19935) at android.view.ViewGroup.drawChild(ViewGroup.java:4333) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112) at android.view.View.draw(View.java:20210) at androidx.core.widget.NestedScrollView.draw(NestedScrollView.java:1999) at android.view.View.updateDisplayListIfDirty(View.java:19082) at android.view.View.draw(View.java:19935) at android.view.ViewGroup.drawChild(ViewGroup.java:4333) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112) at android.view.View.draw(View.java:20210) at android.view.View.updateDisplayListIfDirty(View.java:19082) at android.view.View.draw(View.java:19935) at android.view.ViewGroup.drawChild(ViewGroup.java:4333) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112) at android.view.View.draw(View.java:20210) at androidx.viewpager.widget.ViewPager.draw(ViewPager.java:2426) at android.view.View.updateDisplayListIfDirty(View.java:19082) at android.view.View.draw(View.java:19935) at android.view.ViewGroup.drawChild(ViewGroup.java:4333) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112) at android.view.View.draw(View.java:20210) at android.view.View.updateDisplayListIfDirty(View.java:19082) at android.view.View.draw(View.java:19935) at android.view.ViewGroup.drawChild(ViewGroup.java:4333) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112) at android.view.View.updateDisplayListIfDirty(View.java:19073) at android.view.View.draw(View.java:19935) at android.view.ViewGroup.drawChild(ViewGroup.java:4333) at androidx.drawerlayout.widget.DrawerLayout.drawChild(DrawerLayout.java:1426) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112) at android.view.View.draw(View.java:20210) at android.view.View.updateDisplayListIfDirty(View.java:19082) at android.view.View.draw(View.java:19935) at android.view.ViewGroup.drawChild(ViewGroup.java:4333) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112) at android.view.View.updateDisplayListIfDirty(View.java:19073) at android.view.View.draw(View.java:19935) at android.view.ViewGroup.drawChild(ViewGroup.java:4333) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112) at android.view.View.updateDisplayListIfDirty(View.java:19073) at android.view.View.draw(View.java:19935) at android.view.ViewGroup.drawChild(ViewGroup.java:4333) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112) at android.view.View.updateDisplayListIfDirty(View.java:19073) at android.view.View.draw(View.java:19935) at android.view.ViewGroup.drawChild(ViewGroup.java:4333) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112) at android.view.View.updateDisplayListIfDirty(View.java:19073) at android.view.View.draw(View.java:19935) at android.view.ViewGroup.drawChild(ViewGroup.java:4333) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112) at android.view.View.updateDisplayListIfDirty(View.java:19073) E/AndroidRuntime: at android.view.View.draw(View.java:19935) at android.view.ViewGroup.drawChild(ViewGroup.java:4333) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112) at android.view.View.draw(View.java:20210) at com.android.internal.policy.DecorView.draw(DecorView.java:780) at android.view.View.updateDisplayListIfDirty(View.java:19082) at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:686) at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:692) at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:801) at android.view.ViewRootImpl.draw(ViewRootImpl.java:3312) at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:3116) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2485) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1460) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7184) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:949) at android.view.Choreographer.doCallbacks(Choreographer.java:761) at android.view.Choreographer.doFrame(Choreographer.java:696) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:935) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

zhpanvip commented 2 years ago

what version are you using?

Rad-98 commented 2 years ago

v1.2.1

zhpanvip commented 2 years ago

I think the cause of the crash is “setupWithViewPager”, this method should be called at the end.

Rad-98 commented 2 years ago

tnx