1
0
mirror of https://github.com/TwidereProject/Twidere-Android synced 2025-01-14 09:26:24 +01:00

fixed account menu icon color

This commit is contained in:
Mariotaku Lee 2016-12-09 20:22:17 +08:00
parent 27193addeb
commit b9fc3813de
2 changed files with 13 additions and 2 deletions

View File

@ -19,6 +19,7 @@
package org.mariotaku.ktextension
import android.graphics.drawable.Drawable
import android.support.v4.view.MenuItemCompat
import android.view.Menu
@ -41,6 +42,10 @@ fun Menu.setMenuItemIcon(id: Int, icon: Int) {
findItem(id)?.setIcon(icon)
}
fun Menu.setMenuItemIcon(id: Int, icon: Drawable) {
findItem(id)?.setIcon(icon)
}
fun Menu.setMenuItemTitle(id: Int, title: Int) {
findItem(id)?.setTitle(title)
}

View File

@ -42,7 +42,9 @@ import android.os.Looper
import android.support.design.widget.NavigationView
import android.support.v4.app.LoaderManager.LoaderCallbacks
import android.support.v4.content.AsyncTaskLoader
import android.support.v4.content.ContextCompat
import android.support.v4.content.Loader
import android.support.v4.graphics.drawable.DrawableCompat
import android.support.v4.view.MenuItemCompat
import android.support.v4.view.ViewPager
import android.support.v7.view.SupportMenuInflater
@ -344,10 +346,14 @@ class AccountsDashboardFragment : BaseSupportFragment(), LoaderCallbacks<Account
if (useStarsForLikes) {
menu.setMenuItemTitle(R.id.favorites, R.string.favorites)
menu.setMenuItemIcon(R.id.favorites, R.drawable.ic_action_star)
val icon = ContextCompat.getDrawable(context, R.drawable.ic_action_star)
DrawableCompat.setTintList(icon, navigationView.itemIconTintList)
menu.setMenuItemIcon(R.id.favorites, icon)
} else {
menu.setMenuItemTitle(R.id.favorites, R.string.likes)
menu.setMenuItemIcon(R.id.favorites, R.drawable.ic_action_heart)
val icon = ContextCompat.getDrawable(context, R.drawable.ic_action_heart)
DrawableCompat.setTintList(icon, navigationView.itemIconTintList)
menu.setMenuItemIcon(R.id.favorites, icon)
}
var hasLists = false
var hasGroups = false