mirror of
https://github.com/kuba2k2/NavLib.git
synced 2025-01-18 06:16:43 -06:00
Add exception catching in reflection. Fix deselecting mini drawer.
This commit is contained in:
parent
43f5ecdef5
commit
28cdab3414
@ -171,17 +171,18 @@ class NavDrawer(
|
||||
miniDrawer = MiniDrawerSliderView(context).apply {
|
||||
drawer = this@NavDrawer.drawer
|
||||
includeSecondaryDrawerItems = false
|
||||
this::class.java.getDeclaredField("onMiniDrawerItemClickListener").let {
|
||||
it.isAccessible = true
|
||||
it.set(this, { v: View?, position: Int, item: IDrawerItem<*>, type: Int ->
|
||||
if (item is MiniProfileDrawerItem) {
|
||||
profileSelectionOpen()
|
||||
open()
|
||||
true
|
||||
}
|
||||
else false
|
||||
})
|
||||
}
|
||||
try {
|
||||
this::class.java.getDeclaredField("onMiniDrawerItemClickListener").let {
|
||||
it.isAccessible = true
|
||||
it.set(this, { v: View?, position: Int, item: IDrawerItem<*>, type: Int ->
|
||||
if (item is MiniProfileDrawerItem) {
|
||||
profileSelectionOpen()
|
||||
open()
|
||||
true
|
||||
} else false
|
||||
})
|
||||
}
|
||||
} catch (_: Exception) { }
|
||||
}
|
||||
|
||||
updateMiniDrawer()
|
||||
@ -478,7 +479,7 @@ class NavDrawer(
|
||||
if (drawer.selectedItemIdentifier != id.toLong() || !fireOnClick)
|
||||
drawer.setSelection(id.toLong(), fireOnClick)
|
||||
|
||||
//miniDrawer.setSelection(-1L)
|
||||
miniDrawer.setSelection(-1L)
|
||||
if (drawerMode == DRAWER_MODE_MINI)
|
||||
miniDrawer.setSelection(id.toLong())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user