diff --git a/navlib/consumer-rules.pro b/navlib/consumer-rules.pro index aafd4e8..619be6d 100644 --- a/navlib/consumer-rules.pro +++ b/navlib/consumer-rules.pro @@ -1,2 +1 @@ -keep class androidx.drawerlayout.widget.DrawerLayout { *; } --keep class androidx.customview.widget.ViewDragHelper { *; } \ No newline at end of file diff --git a/navlib/proguard-rules.pro b/navlib/proguard-rules.pro index a00c1d5..06b02c6 100644 --- a/navlib/proguard-rules.pro +++ b/navlib/proguard-rules.pro @@ -21,4 +21,3 @@ #-renamesourcefileattribute SourceFile -keep class androidx.drawerlayout.widget.DrawerLayout { *; } --keep class androidx.customview.widget.ViewDragHelper { *; } \ No newline at end of file diff --git a/navlib/src/main/java/pl/szczodrzynski/navlib/drawer/NavDrawer.kt b/navlib/src/main/java/pl/szczodrzynski/navlib/drawer/NavDrawer.kt index e936ae5..611e950 100644 --- a/navlib/src/main/java/pl/szczodrzynski/navlib/drawer/NavDrawer.kt +++ b/navlib/src/main/java/pl/szczodrzynski/navlib/drawer/NavDrawer.kt @@ -280,19 +280,17 @@ class NavDrawer( val mDrawerLayout = drawerLayout val mDragger = mDrawerLayout::class.java.getDeclaredField( "mLeftDragger" - )//mRightDragger for right obviously + ) mDragger.isAccessible = true val draggerObj = mDragger.get(mDrawerLayout) as ViewDragHelper? + draggerObj?.edgeSize = size.toInt() - val mEdgeSize = draggerObj?.javaClass?.getDeclaredField( - "mEdgeSize" + // update for SDK >= 29 (Android 10) + val useSystemInsets = mDrawerLayout::class.java.getDeclaredField( + "sEdgeSizeUsingSystemGestureInsets" ) - mEdgeSize?.isAccessible = true - - mEdgeSize?.setInt( - draggerObj, - size.toInt() - ) //optimal value as for me, you may set any constant in dp + useSystemInsets.isAccessible = true + useSystemInsets.set(null, false) } catch (e: Exception) { e.printStackTrace()