Improve title setting

This commit is contained in:
Phillip Thelen 2020-11-05 14:03:25 +01:00
parent f6717e8c50
commit 59b3d6beb3
3 changed files with 13 additions and 5 deletions

View file

@ -256,8 +256,16 @@ open class MainActivity : BaseActivity(), TutorialView.OnTutorialReaction {
}
}
override fun setTitle(title: CharSequence?) {
binding.toolbarTitle.text = title
}
override fun setTitle(titleId: Int) {
binding.toolbarTitle.text = getString(titleId)
}
private fun updateToolbarTitle(destination: NavDestination, arguments: Bundle?) {
binding.toolbarTitle.text = if (destination.id == R.id.promoInfoFragment) {
title = if (destination.id == R.id.promoInfoFragment) {
""
} else if (destination.id == R.id.petDetailRecyclerFragment || destination.id == R.id.mountDetailRecyclerFragment) {
arguments?.getString("type")

View file

@ -68,9 +68,7 @@ class PreferencesFragment : BasePreferencesFragment(), SharedPreferences.OnShare
val useEmailNotifications = preferenceManager.sharedPreferences.getBoolean("useEmailNotifications", true)
emailNotificationsPreference?.isEnabled = useEmailNotifications
classSelectionPreference = findPreference("choose_class")
classSelectionPreference?.isVisible = false
serverUrlPreference = findPreference("server_url") as? ListPreference
serverUrlPreference?.isVisible = false
@ -265,11 +263,12 @@ class PreferencesFragment : BasePreferencesFragment(), SharedPreferences.OnShare
classSelectionPreference?.title = getString(R.string.change_class)
classSelectionPreference?.summary = getString(R.string.change_class_description)
}
classSelectionPreference?.isVisible = true
} else {
classSelectionPreference?.title = getString(R.string.enable_class)
classSelectionPreference?.isVisible = true
}
classSelectionPreference?.isVisible = true
} else {
classSelectionPreference?.isVisible = false
}
val cdsTimePreference = findPreference("cds_time") as? TimePreference
cdsTimePreference?.text = user?.preferences?.dayStart.toString() + ":00"

View file

@ -85,6 +85,7 @@ class InboxMessageListFragment : BaseMainFragment<FragmentInboxMessageListBindin
}
compositeSubscription.add(observable.subscribe( { member ->
setReceivingUser(member.username, member.id)
activity?.title = member.displayName
chatAdapter = InboxAdapter(user, member)
viewModel?.messages?.observe(this.viewLifecycleOwner, { chatAdapter?.submitList(it) })