File tree Expand file tree Collapse file tree
library/src/main/java/me/zhanghai/android/fastscroll Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2727import android .graphics .PixelFormat ;
2828import android .graphics .Rect ;
2929import android .graphics .drawable .Drawable ;
30+ import android .os .Build ;
3031import android .view .View ;
3132
3233import androidx .annotation .NonNull ;
@@ -139,6 +140,13 @@ public boolean getPadding(@NonNull Rect padding) {
139140
140141 @ Override
141142 public void getOutline (@ NonNull Outline outline ) {
143+ if (Build .VERSION .SDK_INT < Build .VERSION_CODES .Q && !mPath .isConvex ()) {
144+ // The outline path must be convex before Q, but we may run into floating point error
145+ // caused by calculation involving sqrt(2) or OEM implementation difference, so in this
146+ // case we just omit the shadow instead of crashing.
147+ super .getOutline (outline );
148+ return ;
149+ }
142150 outline .setConvexPath (mPath );
143151 }
144152}
You can’t perform that action at this time.
0 commit comments