Goooler 2023-03-02 04:06:55 +08:00 committed by GitHub
commit ca29ee2b0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 17 additions and 17 deletions

View file

@ -463,8 +463,8 @@ class AccountActivity : BottomSheetActivity(), ActionButtonActivity, MenuProvide
val emojifiedNote = account.note.parseAsMastodonHtml().emojify(account.emojis, binding.accountNoteTextView, animateEmojis)
setClickableText(binding.accountNoteTextView, emojifiedNote, emptyList(), null, this)
accountFieldAdapter.fields = account.fields ?: emptyList()
accountFieldAdapter.emojis = account.emojis ?: emptyList()
accountFieldAdapter.fields = account.fields.orEmpty()
accountFieldAdapter.emojis = account.emojis.orEmpty()
accountFieldAdapter.notifyDataSetChanged()
binding.accountLockedImageView.visible(account.locked)

View file

@ -145,7 +145,7 @@ fun TimelineAccount.toEntity() =
username = username,
displayName = name,
avatar = avatar,
emojis = emojis ?: emptyList()
emojis = emojis.orEmpty()
)
fun Status.toEntity(

View file

@ -207,7 +207,7 @@ class AccountPreferencesFragment : PreferenceFragmentCompat(), Injectable {
entryValues = (listOf("") + locales.map { it.language }).toTypedArray()
key = PrefKeys.DEFAULT_POST_LANGUAGE
icon = makeIcon(requireContext(), GoogleMaterial.Icon.gmd_translate, iconSize)
value = accountManager.activeAccount?.defaultPostLanguage ?: ""
value = accountManager.activeAccount?.defaultPostLanguage.orEmpty()
isPersistent = false // This will be entirely server-driven
setSummaryProvider { entry }
@ -339,7 +339,7 @@ class AccountPreferencesFragment : PreferenceFragmentCompat(), Injectable {
it.defaultPostPrivacy = account.source?.privacy
?: Status.Visibility.PUBLIC
it.defaultMediaSensitivity = account.source?.sensitive ?: false
it.defaultPostLanguage = language ?: ""
it.defaultPostLanguage = language.orEmpty()
accountManager.saveAccount(it)
}
} else {

View file

@ -54,7 +54,7 @@ class ReportNoteFragment : Fragment(R.layout.fragment_report_note), Injectable {
private fun handleChanges() {
binding.editNote.doAfterTextChanged {
viewModel.reportNote = it?.toString() ?: ""
viewModel.reportNote = it?.toString().orEmpty()
}
binding.checkIsNotifyRemote.setOnCheckedChangeListener { _, isChecked ->
viewModel.isRemoteNotify = isChecked

View file

@ -114,7 +114,7 @@ class SearchActivity : BottomSheetActivity(), HasAndroidInjector, MenuProvider {
private fun handleIntent(intent: Intent) {
if (Intent.ACTION_SEARCH == intent.action) {
viewModel.currentQuery = intent.getStringExtra(SearchManager.QUERY) ?: ""
viewModel.currentQuery = intent.getStringExtra(SearchManager.QUERY).orEmpty()
viewModel.search(viewModel.currentQuery)
}
}

View file

@ -468,7 +468,7 @@ class SearchStatusesFragment : SearchFragment<StatusViewData.Concrete>(), Status
val intent = ComposeActivity.startIntent(
requireContext(),
ComposeOptions(
content = redraftStatus.text ?: "",
content = redraftStatus.text.orEmpty(),
inReplyToId = redraftStatus.inReplyToId,
visibility = redraftStatus.visibility,
contentWarning = redraftStatus.spoilerText,

View file

@ -72,7 +72,7 @@ class TrendingAdapter(
is TrendingViewData.Tag -> {
val maxTrendingValue = currentList
.flatMap { trendingViewData ->
trendingViewData.asTagOrNull()?.tag?.history ?: emptyList()
trendingViewData.asTagOrNull()?.tag?.history.orEmpty()
}
.mapNotNull { it.uses.toLongOrNull() }
.maxOrNull() ?: 1