2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-03 23:15:31 +00:00

[fenix] For https://github.com/mozilla-mobile/fenix/issues/21776 - Replace 'isEmpty' with 'ifEmpty'

This commit is contained in:
Gabriel Luong 2021-10-07 13:37:20 -04:00 committed by mergify[bot]
parent 853e159476
commit 999f0ab3c1
4 changed files with 4 additions and 10 deletions

View File

@ -156,9 +156,7 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), UserInteractionHan
// Reload bookmarks when returning to this fragment in case they have been edited
val args by navArgs<BookmarkFragmentArgs>()
val currentGuid = bookmarkStore.state.tree?.guid
?: if (args.currentRoot.isNotEmpty()) {
args.currentRoot
} else {
?: args.currentRoot.ifEmpty {
BookmarkRoot.Mobile.id
}
loadInitialBookmarkFolder(currentGuid)

View File

@ -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(

View File

@ -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)

View File

@ -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