use view binding elements to set toolbar title

This commit is contained in:
dkanada 2021-04-25 10:29:00 +09:00
commit 3c4822329e
7 changed files with 9 additions and 7 deletions

View file

@ -101,7 +101,7 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
binding.appbar.setBackgroundColor(primaryColor);
binding.toolbar.setBackgroundColor(primaryColor);
binding.toolbar.setNavigationIcon(R.drawable.ic_menu_white_24dp);
requireActivity().setTitle(R.string.app_name);
binding.toolbar.setTitle(R.string.app_name);
getMainActivity().setSupportActionBar(binding.toolbar);
}

View file

@ -223,6 +223,7 @@ public class CardPlayerFragment extends AbsPlayerFragment implements PlayerAlbum
int res = favorite ? R.drawable.ic_favorite_white_24dp : R.drawable.ic_favorite_border_white_24dp;
int color = ToolbarContentTintHelper.toolbarContentColor(getActivity(), Color.TRANSPARENT);
Drawable drawable = ImageUtil.getTintedVectorDrawable(getActivity(), res, color);
binding.playerToolbar.getMenu().findItem(R.id.action_toggle_favorite)
.setIcon(drawable)
.setTitle(favorite ? getString(R.string.action_remove_from_favorites) : getString(R.string.action_add_to_favorites));

View file

@ -223,6 +223,7 @@ public class FlatPlayerFragment extends AbsPlayerFragment implements PlayerAlbum
int res = favorite ? R.drawable.ic_favorite_white_24dp : R.drawable.ic_favorite_border_white_24dp;
int color = ToolbarContentTintHelper.toolbarContentColor(requireActivity(), Color.TRANSPARENT);
Drawable drawable = ImageUtil.getTintedVectorDrawable(requireActivity(), res, color);
binding.playerToolbar.getMenu().findItem(R.id.action_toggle_favorite)
.setIcon(drawable)
.setTitle(favorite ? getString(R.string.action_remove_from_favorites) : getString(R.string.action_add_to_favorites));