From d7272d29de2214b00c3bc238b65496d9ebafb774 Mon Sep 17 00:00:00 2001 From: Emily Kager Date: Tue, 9 Apr 2019 15:36:21 -0700 Subject: [PATCH] For #1408 - Set Toolbar titles in code (vs in navgraph) --- app/src/main/java/org/mozilla/fenix/library/LibraryFragment.kt | 1 + .../org/mozilla/fenix/library/bookmarks/BookmarkFragment.kt | 1 + .../library/bookmarks/addfolder/AddBookmarkFolderFragment.kt | 2 ++ .../fenix/library/bookmarks/edit/EditBookmarkFragment.kt | 1 + .../bookmarks/selectfolder/SelectBookmarkFolderFragment.kt | 2 ++ .../java/org/mozilla/fenix/library/history/HistoryFragment.kt | 1 + .../main/java/org/mozilla/fenix/settings/SettingsFragment.kt | 1 + .../java/org/mozilla/fenix/settings/SitePermissionsFragment.kt | 1 + 8 files changed, 10 insertions(+) diff --git a/app/src/main/java/org/mozilla/fenix/library/LibraryFragment.kt b/app/src/main/java/org/mozilla/fenix/library/LibraryFragment.kt index 7ce5c1f18f..decb2b81d9 100644 --- a/app/src/main/java/org/mozilla/fenix/library/LibraryFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/library/LibraryFragment.kt @@ -37,6 +37,7 @@ class LibraryFragment : Fragment() { override fun onResume() { super.onResume() + (activity as AppCompatActivity).title = getString(R.string.library_title) (activity as AppCompatActivity).supportActionBar?.show() } diff --git a/app/src/main/java/org/mozilla/fenix/library/bookmarks/BookmarkFragment.kt b/app/src/main/java/org/mozilla/fenix/library/bookmarks/BookmarkFragment.kt index f1f2ca95f4..5f236e9c12 100644 --- a/app/src/main/java/org/mozilla/fenix/library/bookmarks/BookmarkFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/library/bookmarks/BookmarkFragment.kt @@ -66,6 +66,7 @@ class BookmarkFragment : Fragment(), CoroutineScope, BackHandler, AccountObserve override fun onResume() { super.onResume() + (activity as AppCompatActivity).title = getString(R.string.library_bookmarks) (activity as AppCompatActivity).supportActionBar?.show() checkIfSignedIn() } diff --git a/app/src/main/java/org/mozilla/fenix/library/bookmarks/addfolder/AddBookmarkFolderFragment.kt b/app/src/main/java/org/mozilla/fenix/library/bookmarks/addfolder/AddBookmarkFolderFragment.kt index c5e779750a..8b26d6519e 100644 --- a/app/src/main/java/org/mozilla/fenix/library/bookmarks/addfolder/AddBookmarkFolderFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/library/bookmarks/addfolder/AddBookmarkFolderFragment.kt @@ -54,6 +54,8 @@ class AddBookmarkFolderFragment : Fragment(), CoroutineScope { override fun onResume() { super.onResume() + (activity as AppCompatActivity).title = + getString(R.string.bookmark_add_folder_fragment_label) (activity as AppCompatActivity).supportActionBar?.show() launch(IO) { diff --git a/app/src/main/java/org/mozilla/fenix/library/bookmarks/edit/EditBookmarkFragment.kt b/app/src/main/java/org/mozilla/fenix/library/bookmarks/edit/EditBookmarkFragment.kt index 111b017b3b..d9cdcbb649 100644 --- a/app/src/main/java/org/mozilla/fenix/library/bookmarks/edit/EditBookmarkFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/library/bookmarks/edit/EditBookmarkFragment.kt @@ -69,6 +69,7 @@ class EditBookmarkFragment : Fragment(), CoroutineScope { override fun onResume() { super.onResume() + (activity as? AppCompatActivity)?.title = getString(R.string.edit_bookmark_fragment_title) (activity as? AppCompatActivity)?.supportActionBar?.show() guidToEdit = EditBookmarkFragmentArgs.fromBundle(arguments!!).guidToEdit diff --git a/app/src/main/java/org/mozilla/fenix/library/bookmarks/selectfolder/SelectBookmarkFolderFragment.kt b/app/src/main/java/org/mozilla/fenix/library/bookmarks/selectfolder/SelectBookmarkFolderFragment.kt index c8bd030c83..96077e1e0c 100644 --- a/app/src/main/java/org/mozilla/fenix/library/bookmarks/selectfolder/SelectBookmarkFolderFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/library/bookmarks/selectfolder/SelectBookmarkFolderFragment.kt @@ -89,6 +89,8 @@ class SelectBookmarkFolderFragment : Fragment(), CoroutineScope, AccountObserver override fun onResume() { super.onResume() + (activity as AppCompatActivity).title = + getString(R.string.bookmark_select_folder_fragment_label) (activity as AppCompatActivity).supportActionBar?.show() folderGuid = SelectBookmarkFolderFragmentArgs.fromBundle(arguments!!).folderGuid ?: BookmarkRoot.Root.id diff --git a/app/src/main/java/org/mozilla/fenix/library/history/HistoryFragment.kt b/app/src/main/java/org/mozilla/fenix/library/history/HistoryFragment.kt index ae03bd8d5b..efccc1347d 100644 --- a/app/src/main/java/org/mozilla/fenix/library/history/HistoryFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/library/history/HistoryFragment.kt @@ -63,6 +63,7 @@ class HistoryFragment : Fragment(), CoroutineScope, BackHandler { override fun onResume() { super.onResume() + (activity as AppCompatActivity).title = getString(R.string.library_history) (activity as AppCompatActivity).supportActionBar?.show() } diff --git a/app/src/main/java/org/mozilla/fenix/settings/SettingsFragment.kt b/app/src/main/java/org/mozilla/fenix/settings/SettingsFragment.kt index cb3f2ca8c9..8f7ae35b3e 100644 --- a/app/src/main/java/org/mozilla/fenix/settings/SettingsFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/settings/SettingsFragment.kt @@ -67,6 +67,7 @@ class SettingsFragment : PreferenceFragmentCompat(), CoroutineScope, AccountObse override fun onResume() { super.onResume() + (activity as AppCompatActivity).title = getString(R.string.settings_title) (activity as AppCompatActivity).supportActionBar?.show() val defaultBrowserPreference = findPreference(getString(R.string.pref_key_make_default_browser)) diff --git a/app/src/main/java/org/mozilla/fenix/settings/SitePermissionsFragment.kt b/app/src/main/java/org/mozilla/fenix/settings/SitePermissionsFragment.kt index 7bfe62aa27..4805d6103b 100644 --- a/app/src/main/java/org/mozilla/fenix/settings/SitePermissionsFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/settings/SitePermissionsFragment.kt @@ -22,6 +22,7 @@ class SitePermissionsFragment : PreferenceFragmentCompat() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + (activity as AppCompatActivity).title = getString(R.string.preferences_site_permissions) (activity as AppCompatActivity).supportActionBar?.show() }