mirror of
https://github.com/kuba2k2/NavLib.git
synced 2024-11-09 19:50:26 -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 {
|
miniDrawer = MiniDrawerSliderView(context).apply {
|
||||||
drawer = this@NavDrawer.drawer
|
drawer = this@NavDrawer.drawer
|
||||||
includeSecondaryDrawerItems = false
|
includeSecondaryDrawerItems = false
|
||||||
this::class.java.getDeclaredField("onMiniDrawerItemClickListener").let {
|
try {
|
||||||
it.isAccessible = true
|
this::class.java.getDeclaredField("onMiniDrawerItemClickListener").let {
|
||||||
it.set(this, { v: View?, position: Int, item: IDrawerItem<*>, type: Int ->
|
it.isAccessible = true
|
||||||
if (item is MiniProfileDrawerItem) {
|
it.set(this, { v: View?, position: Int, item: IDrawerItem<*>, type: Int ->
|
||||||
profileSelectionOpen()
|
if (item is MiniProfileDrawerItem) {
|
||||||
open()
|
profileSelectionOpen()
|
||||||
true
|
open()
|
||||||
}
|
true
|
||||||
else false
|
} else false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
} catch (_: Exception) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
updateMiniDrawer()
|
updateMiniDrawer()
|
||||||
@ -478,7 +479,7 @@ class NavDrawer(
|
|||||||
if (drawer.selectedItemIdentifier != id.toLong() || !fireOnClick)
|
if (drawer.selectedItemIdentifier != id.toLong() || !fireOnClick)
|
||||||
drawer.setSelection(id.toLong(), fireOnClick)
|
drawer.setSelection(id.toLong(), fireOnClick)
|
||||||
|
|
||||||
//miniDrawer.setSelection(-1L)
|
miniDrawer.setSelection(-1L)
|
||||||
if (drawerMode == DRAWER_MODE_MINI)
|
if (drawerMode == DRAWER_MODE_MINI)
|
||||||
miniDrawer.setSelection(id.toLong())
|
miniDrawer.setSelection(id.toLong())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user