mirror of
https://github.com/kuba2k2/NavLib.git
synced 2025-02-23 06:54:44 +01:00
Fix removing badges on other profiles. Deselect mini drawer if item not present.
This commit is contained in:
parent
3ed34a4705
commit
8a707ebec7
@ -23,6 +23,7 @@ import com.mikepenz.materialdrawer.holder.StringHolder
|
||||
import com.mikepenz.materialdrawer.model.BaseDrawerItem
|
||||
import com.mikepenz.materialdrawer.model.ProfileDrawerItem
|
||||
import com.mikepenz.materialdrawer.model.ProfileSettingDrawerItem
|
||||
import com.mikepenz.materialdrawer.model.interfaces.Badgeable
|
||||
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem
|
||||
import com.mikepenz.materialdrawer.model.interfaces.IProfile
|
||||
import pl.szczodrzynski.navlib.*
|
||||
@ -491,6 +492,7 @@ class NavDrawer(
|
||||
if (drawer?.currentSelection != id.toLong() || !fireOnClick)
|
||||
drawer?.setSelection(id.toLong(), fireOnClick)
|
||||
|
||||
miniDrawer?.setSelection(-1L)
|
||||
if (drawerMode == DRAWER_MODE_MINI)
|
||||
miniDrawer?.setSelection(id.toLong())
|
||||
}
|
||||
@ -629,6 +631,13 @@ class NavDrawer(
|
||||
|
||||
currentProfileObj = profileList.singleOrNull { it.id == currentProfile }
|
||||
|
||||
drawer?.drawerItems?.forEachIndexed { index, item ->
|
||||
if (item is Badgeable<*>) {
|
||||
item.withBadge(null)
|
||||
drawer!!.updateItem(item)
|
||||
}
|
||||
}
|
||||
|
||||
Log.d("NavDebug", "updateBadges()")
|
||||
unreadCounterList.map {
|
||||
it.drawerItemId = unreadCounterTypeMap[it.type]
|
||||
|
@ -48,6 +48,7 @@
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<pl.szczodrzynski.navlib.NavToolbar
|
||||
style="@style/Widget.MaterialComponents.Toolbar.Surface"
|
||||
android:id="@+id/nv_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
|
Loading…
x
Reference in New Issue
Block a user