mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-14 18:21:57 +00:00
Set notifications count to badge in drawer
This commit is contained in:
parent
e232a9b016
commit
15a352982b
2 changed files with 10 additions and 0 deletions
|
|
@ -374,6 +374,7 @@ open class MainActivity : BaseActivity(), TutorialView.OnTutorialReaction {
|
|||
displayDeathDialogIfNeeded()
|
||||
YesterdailyDialog.showDialogIfNeeded(this, user?.id, userRepository, taskRepository)
|
||||
|
||||
drawerFragment?.setNotificationsCount(this.user?.notifications?.count() ?: 0)
|
||||
drawerFragment?.setMessagesCount(this.user?.inbox?.newMessages ?: 0)
|
||||
drawerFragment?.setSettingsCount(if (this.user?.flags?.isVerifiedUsername != true) 1 else 0 )
|
||||
|
||||
|
|
|
|||
|
|
@ -306,6 +306,15 @@ class NavigationDrawerFragment : DialogFragment() {
|
|||
outState.putInt(STATE_SELECTED_POSITION, mCurrentSelectedPosition)
|
||||
}
|
||||
|
||||
fun setNotificationsCount(unreadNotifications: Int) {
|
||||
if (unreadNotifications == 0) {
|
||||
notificationsBadge.visibility = View.GONE
|
||||
} else {
|
||||
notificationsBadge.visibility = View.VISIBLE
|
||||
notificationsBadge.text = unreadNotifications.toString()
|
||||
}
|
||||
}
|
||||
|
||||
fun setMessagesCount(unreadMessages: Int) {
|
||||
if (unreadMessages == 0) {
|
||||
messagesBadge.visibility = View.GONE
|
||||
|
|
|
|||
Loading…
Reference in a new issue