mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2025-02-01 09:16:47 +01:00
fixed #615
This commit is contained in:
parent
556e08a5f2
commit
c5a7399807
@ -187,16 +187,22 @@ class UpdateStatusTask(
|
||||
private fun shortenStatus(shortener: StatusShortenerInterface?,
|
||||
update: ParcelableStatusUpdate,
|
||||
pending: PendingStatusUpdate) {
|
||||
if (shortener == null || !shortener.waitForService()) return
|
||||
if (shortener == null) return
|
||||
stateCallback.onShorteningStatus()
|
||||
val sharedShortened = HashMap<UserKey, StatusShortenResult>()
|
||||
for (i in 0..pending.length - 1) {
|
||||
for (i in 0 until pending.length) {
|
||||
val account = update.accounts[i]
|
||||
val text = pending.overrideTexts[i]
|
||||
val textLimit = TwidereValidator.getTextLimit(account)
|
||||
if (textLimit >= 0 && text.length <= textLimit) {
|
||||
continue
|
||||
}
|
||||
shortener.waitForService()
|
||||
// Skip upload if this shared media found
|
||||
val accountKey = account.key
|
||||
var shortenResult: StatusShortenResult? = sharedShortened[accountKey]
|
||||
if (shortenResult == null) {
|
||||
shortenResult = shortener.shorten(update, accountKey, pending.overrideTexts[i]) ?: run {
|
||||
shortenResult = shortener.shorten(update, accountKey, text) ?: run {
|
||||
throw ShortenException()
|
||||
}
|
||||
if (shortenResult.shortened == null) {
|
||||
|
@ -94,12 +94,12 @@ class StatusViewHolder(private val adapter: IStatusesAdapter<*>, itemView: View)
|
||||
nameView.setScreenName("@" + Constants.TWIDERE_PREVIEW_SCREEN_NAME)
|
||||
nameView.updateText(adapter.bidiFormatter)
|
||||
if (adapter.linkHighlightingStyle == VALUE_LINK_HIGHLIGHT_OPTION_CODE_NONE) {
|
||||
textView.text = toPlainText(Constants.TWIDERE_PREVIEW_TEXT_HTML)
|
||||
} else {
|
||||
val linkify = adapter.twidereLinkify
|
||||
val text = HtmlSpanBuilder.fromHtml(Constants.TWIDERE_PREVIEW_TEXT_HTML)
|
||||
linkify.applyAllLinks(text, null, -1, false, adapter.linkHighlightingStyle, true)
|
||||
textView.text = text
|
||||
} else {
|
||||
textView.text = toPlainText(Constants.TWIDERE_PREVIEW_TEXT_HTML)
|
||||
}
|
||||
timeView.setTime(System.currentTimeMillis())
|
||||
val showCardActions = isCardActionsShown
|
||||
|
Loading…
x
Reference in New Issue
Block a user