Fix removing badges on other profiles. Deselect mini drawer if item not present.

This commit is contained in:
kubasz 2019-09-13 16:53:54 +02:00
parent 3ed34a4705
commit 8a707ebec7
2 changed files with 10 additions and 0 deletions

View File

@ -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]

View File

@ -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"