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 5cb66e7a41..320e5af787 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 @@ -156,9 +156,7 @@ class BookmarkFragment : LibraryPageFragment(), UserInteractionHan // Reload bookmarks when returning to this fragment in case they have been edited val args by navArgs() val currentGuid = bookmarkStore.state.tree?.guid - ?: if (args.currentRoot.isNotEmpty()) { - args.currentRoot - } else { + ?: args.currentRoot.ifEmpty { BookmarkRoot.Mobile.id } loadInitialBookmarkFolder(currentGuid) diff --git a/app/src/main/java/org/mozilla/fenix/library/recentlyclosed/RecentlyClosedItemViewHolder.kt b/app/src/main/java/org/mozilla/fenix/library/recentlyclosed/RecentlyClosedItemViewHolder.kt index 50dbb39472..becc98fc1d 100644 --- a/app/src/main/java/org/mozilla/fenix/library/recentlyclosed/RecentlyClosedItemViewHolder.kt +++ b/app/src/main/java/org/mozilla/fenix/library/recentlyclosed/RecentlyClosedItemViewHolder.kt @@ -33,7 +33,7 @@ class RecentlyClosedItemViewHolder( fun bind(item: RecoverableTab) { binding.historyLayout.titleView.text = - if (item.title.isNotEmpty()) item.title else item.url + item.title.ifEmpty { item.url } binding.historyLayout.urlView.text = item.url binding.historyLayout.setSelectionInteractor( diff --git a/app/src/main/java/org/mozilla/fenix/search/toolbar/ToolbarView.kt b/app/src/main/java/org/mozilla/fenix/search/toolbar/ToolbarView.kt index 1462be820f..3bee9bc61e 100644 --- a/app/src/main/java/org/mozilla/fenix/search/toolbar/ToolbarView.kt +++ b/app/src/main/java/org/mozilla/fenix/search/toolbar/ToolbarView.kt @@ -135,9 +135,7 @@ class ToolbarView( if (searchState.pastedText.isNullOrEmpty()) { // If we're in edit mode, setting the search term will update the toolbar, // so we make sure we have the correct term/query to show. - val termOrQuery = if (searchState.searchTerms.isNotEmpty()) { - searchState.searchTerms - } else { + val termOrQuery = searchState.searchTerms.ifEmpty { searchState.query } view.setSearchTerms(termOrQuery) diff --git a/app/src/main/java/org/mozilla/fenix/tabstray/browser/AbstractBrowserTabViewHolder.kt b/app/src/main/java/org/mozilla/fenix/tabstray/browser/AbstractBrowserTabViewHolder.kt index bd377a86ff..7157c3df32 100644 --- a/app/src/main/java/org/mozilla/fenix/tabstray/browser/AbstractBrowserTabViewHolder.kt +++ b/app/src/main/java/org/mozilla/fenix/tabstray/browser/AbstractBrowserTabViewHolder.kt @@ -124,9 +124,7 @@ abstract class AbstractBrowserTabViewHolder( } private fun updateTitle(tab: TabSessionState) { - val title = if (tab.content.title.isNotEmpty()) { - tab.content.title - } else { + val title = tab.content.title.ifEmpty { tab.content.url } titleView.text = title