nex3z / ToggleButtonGroup

A group of flowable toggle buttons, with multiple / single selection support and button customization.
Apache License 2.0
421 stars 48 forks source link

Android 9 Error #48

Closed behiunforgiven closed 5 years ago

behiunforgiven commented 5 years ago

The library encounter error with android 9

Fatal Exception: java.lang.IllegalArgumentException: Invalid Region.Op - only INTERSECT and DIFFERENCE are allowed at android.graphics.Canvas.checkValidClipOp(Canvas.java:779) at android.graphics.Canvas.clipPath(Canvas.java:1007) at co.ceryle.radiorealbutton.RoundedCornerLayout.dispatchDraw(RoundedCornerLayout.java:80) at android.view.View.buildDrawingCacheImpl(View.java:21122) at android.view.View.buildDrawingCache(View.java:20988) at android.view.View.draw(View.java:21577) at android.view.ViewGroup.drawChild(ViewGroup.java:4546) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4321) at android.view.View.updateDisplayListIfDirty(View.java:20718) at android.view.View.draw(View.java:21585) at android.view.ViewGroup.drawChild(ViewGroup.java:4546) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4321) at android.view.View.updateDisplayListIfDirty(View.java:20718) at android.view.View.draw(View.java:21585) at android.view.ViewGroup.drawChild(ViewGroup.java:4546) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4321) at android.view.View.updateDisplayListIfDirty(View.java:20718) at android.view.View.draw(View.java:21585) at android.view.ViewGroup.drawChild(ViewGroup.java:4546) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4321) at android.view.View.updateDisplayListIfDirty(View.java:20718) at android.view.View.draw(View.java:21585) at android.view.ViewGroup.drawChild(ViewGroup.java:4546) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4321) at android.view.View.updateDisplayListIfDirty(View.java:20718) at android.view.View.draw(View.java:21585) at android.view.ViewGroup.drawChild(ViewGroup.java:4546) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4321) at android.view.View.draw(View.java:21862) at android.widget.ScrollView.draw(ScrollView.java:2768) at android.view.View.updateDisplayListIfDirty(View.java:20732) at android.view.View.draw(View.java:21585) at android.view.ViewGroup.drawChild(ViewGroup.java:4546) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4321) at android.support.constraint.ConstraintLayout.dispatchDraw(ConstraintLayout.java:2023) at android.view.View.updateDisplayListIfDirty(View.java:20718) at android.view.View.draw(View.java:21585) at android.view.ViewGroup.drawChild(ViewGroup.java:4546) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4321) at android.view.View.updateDisplayListIfDirty(View.java:20718) at android.view.View.draw(View.java:21585) at android.view.ViewGroup.drawChild(ViewGroup.java:4546) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4321) at android.view.View.updateDisplayListIfDirty(View.java:20718) at android.view.View.draw(View.java:21585) at android.view.ViewGroup.drawChild(ViewGroup.java:4546) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4321) at android.view.View.updateDisplayListIfDirty(View.java:20718) at android.view.View.draw(View.java:21585) at android.view.ViewGroup.drawChild(ViewGroup.java:4546) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4321) at android.view.View.updateDisplayListIfDirty(View.java:20718) at android.view.View.draw(View.java:21585) at android.view.ViewGroup.drawChild(ViewGroup.java:4546) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4321) at android.view.View.draw(View.java:21862) at com.android.internal.policy.DecorView.draw(DecorView.java:1083) at android.view.View.updateDisplayListIfDirty(View.java:20732) at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:725) at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:731) at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:840) at android.view.ViewRootImpl.draw(ViewRootImpl.java:3909) at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:3683) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2991) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1850) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8455) 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:214) at android.app.ActivityThread.main(ActivityThread.java:6981) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1445)

nex3z commented 5 years ago

Could you please provide more information about how to reproduce this error?

behiunforgiven commented 5 years ago

targetSdkVersion 28 Device: Galaxy S9+ , Android 9 Emulator: Pixel 2, API 28

<com.nex3z.togglebuttongroup.SingleSelectToggleGroup
                    android:id="@+id/buy_or_not_switch"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_margin="4dp">

                    <com.nex3z.togglebuttongroup.button.LabelToggle
                        android:id="@+id/choice_buy"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_margin="4dp"
                        android:text="@string/buy"
                        app:tbgMarkerColor="@color/colorAccent" />

                    <com.nex3z.togglebuttongroup.button.LabelToggle
                        android:id="@+id/choice_noBuy"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_margin="4dp"
                        android:text="@string/noBuy"
                        app:tbgMarkerColor="@color/colorAccent" />

                    <com.nex3z.togglebuttongroup.button.LabelToggle
                        android:id="@+id/choice_closed"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_margin="4dp"
                        android:text="@string/closed"
                        app:tbgMarkerColor="@color/colorAccent" />

</com.nex3z.togglebuttongroup.SingleSelectToggleGroup>
nex3z commented 5 years ago

It's wired that the layout works on my Android 9 phone and emulator. image

I've updated the compile and target SDK version of the library to 28 in version 1.1.9. Please give it a try.

implementation 'com.nex3z:toggle-button-group:1.1.9'
behiunforgiven commented 5 years ago

thank for your try. but it still has error

screenshot_5

nex3z commented 5 years ago

Looks like the exception comes from RoundedCornerLayout. There is a related issue and solution.

behiunforgiven commented 5 years ago

WOW, that was my mistake, sorry and thank you for your help.