mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2025-01-20 20:18:35 +01:00
normalizes composing text
fixed NPE
This commit is contained in:
parent
4a36a4b857
commit
121950dc92
@ -107,6 +107,7 @@ import org.mariotaku.twidere.view.helper.SimpleItemTouchHelperCallback
|
||||
import org.mariotaku.twidere.view.holder.compose.MediaPreviewViewHolder
|
||||
import java.io.IOException
|
||||
import java.lang.ref.WeakReference
|
||||
import java.text.Normalizer
|
||||
import java.util.*
|
||||
import javax.inject.Inject
|
||||
import kotlin.collections.ArrayList
|
||||
@ -1405,7 +1406,7 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
||||
if (accountKeys.isEmpty()) throw NoAccountException()
|
||||
val update = ParcelableStatusUpdate()
|
||||
val media = this.media
|
||||
val text = editText.text?.toString().orEmpty()
|
||||
val text = editText.string?.let { Normalizer.normalize(it, Normalizer.Form.NFC) }.orEmpty()
|
||||
val accounts = AccountUtils.getAllAccountDetails(AccountManager.get(this), accountKeys, true)
|
||||
val maxLength = statusTextCount.maxLength
|
||||
val inReplyTo = inReplyToStatus
|
||||
|
@ -66,6 +66,7 @@ import org.mariotaku.microblog.library.twitter.model.User
|
||||
import org.mariotaku.restfu.http.Endpoint
|
||||
import org.mariotaku.restfu.oauth.OAuthToken
|
||||
import org.mariotaku.restfu.oauth2.OAuth2Authorization
|
||||
import org.mariotaku.twidere.BuildConfig
|
||||
import org.mariotaku.twidere.R
|
||||
import org.mariotaku.twidere.TwidereConstants.*
|
||||
import org.mariotaku.twidere.annotation.AccountType
|
||||
@ -664,8 +665,12 @@ class SignInActivity : BaseActivity(), OnClickListener, TextWatcher,
|
||||
val dialog = dialog ?: return
|
||||
val listView = dialog.findViewById(R.id.expandableList) as ExpandableListView
|
||||
val configGroup = data.groupBy { it.type ?: AccountType.TWITTER }
|
||||
(listView.expandableListAdapter as LoginTypeAdapter).data = arrayOf(AccountType.TWITTER,
|
||||
AccountType.FANFOU, AccountType.MASTODON, AccountType.STATUSNET).mapNotNull { type ->
|
||||
val supportedAccountTypes = if (BuildConfig.DEBUG) {
|
||||
arrayOf(AccountType.TWITTER, AccountType.FANFOU, AccountType.MASTODON, AccountType.STATUSNET)
|
||||
} else {
|
||||
arrayOf(AccountType.TWITTER, AccountType.FANFOU, AccountType.STATUSNET)
|
||||
}
|
||||
(listView.expandableListAdapter as LoginTypeAdapter).data = supportedAccountTypes.mapNotNull { type ->
|
||||
if (type == AccountType.MASTODON) return@mapNotNull LoginType(type,
|
||||
listOf(CustomAPIConfig.mastodon(context)))
|
||||
return@mapNotNull configGroup[type]?.let { list -> LoginType(type, list) }
|
||||
|
@ -295,7 +295,7 @@ class ParcelableActivitiesAdapter(
|
||||
if (mentionsOnly) return ITEM_VIEW_TYPE_EMPTY
|
||||
filteredUserKeys?.let {
|
||||
ParcelableActivityUtils.initAfterFilteredSourceIds(activity, it, followingOnly)
|
||||
if (activity.after_filtered_source_ids.isEmpty()) {
|
||||
if (activity.after_filtered_source_ids.isNullOrEmpty()) {
|
||||
return ITEM_VIEW_TYPE_EMPTY
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user