This commit is contained in:
Mariotaku Lee 2017-06-10 13:54:53 +08:00
parent 61371bf5c9
commit 4a51272509
No known key found for this signature in database
GPG Key ID: 15C10F89D7C33535
4 changed files with 13 additions and 33 deletions

View File

@ -8,8 +8,8 @@ import org.mariotaku.twidere.util.UriUtils
import org.mariotaku.twidere.util.Utils
val ParcelableStatus.originalId: String
get() = if (is_retweet) retweet_id else id
inline val ParcelableStatus.originalId: String
get() = if (is_retweet) (retweet_id ?: id) else id
val ParcelableStatus.media_type: Int
get() = media?.firstOrNull()?.type ?: 0

View File

@ -482,7 +482,7 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
if (status == null || activity == null) return
val args = Bundle {
this[EXTRA_ACCOUNT_KEY] = status.account_key
this[EXTRA_STATUS_ID] = status.load_info_id
this[EXTRA_STATUS_ID] = status.originalId
this[EXTRA_SINCE_ID] = sinceId
this[EXTRA_MAX_ID] = maxId
this[EXTRA_STATUS] = status
@ -500,7 +500,7 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
if (status == null || host == null || isDetached) return
val args = Bundle {
this[EXTRA_ACCOUNT_KEY] = status.account_key
this[EXTRA_STATUS_ID] = status.load_info_id
this[EXTRA_STATUS_ID] = status.originalId
}
if (activityLoaderInitialized) {
loaderManager.restartLoader(LOADER_ID_STATUS_ACTIVITY, args, statusActivityLoaderCallback)
@ -688,8 +688,7 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
} else {
dest = prefDest
}
val statusId = if (status.is_retweet) status.retweet_id else status.id
return twitter.showTranslation(statusId, dest)
return twitter.showTranslation(status.originalId, dest)
}
override fun onSucceed(callback: Any?, result: TranslationResult) {
@ -1243,22 +1242,12 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
if (count == null || status == null) return
when (count.type) {
KEY_RETWEET_COUNT -> {
if (status.is_retweet) {
IntentUtils.openStatusRetweeters(context, status.account_key,
status.retweet_id)
} else {
IntentUtils.openStatusRetweeters(context, status.account_key,
status.id)
}
IntentUtils.openStatusRetweeters(context, status.account_key,
status.originalId)
}
KEY_FAVORITE_COUNT -> {
if (status.is_retweet) {
IntentUtils.openStatusFavoriters(context, status.account_key,
status.retweet_id)
} else {
IntentUtils.openStatusFavoriters(context, status.account_key,
status.id)
}
IntentUtils.openStatusFavoriters(context, status.account_key,
status.originalId)
}
}
}
@ -2147,8 +2136,5 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
}
}
private inline val ParcelableStatus.load_info_id: String
get() = if (is_retweet) (retweet_id ?: id) else id
}
}

View File

@ -60,14 +60,11 @@ class ConversationLoader(
loadingMore: Boolean
) : AbsRequestStatusesLoader(context, status.account_key, adapterData, null, -1, fromUser, loadingMore) {
private val status = ParcelUtils.clone(status)
private val status = ParcelUtils.clone(status).apply { makeOriginal() }
var canLoadAllReplies: Boolean = false
private set
init {
status.makeOriginal()
}
@Throws(MicroBlogException::class)
override fun getStatuses(account: AccountDetails, paging: Paging): PaginatedList<ParcelableStatus> {
when (account.type) {

View File

@ -22,6 +22,7 @@ package org.mariotaku.twidere.util
import android.net.Uri
import org.mariotaku.twidere.TwidereConstants.*
import org.mariotaku.twidere.annotation.AccountType
import org.mariotaku.twidere.extension.model.originalId
import org.mariotaku.twidere.model.ParcelableStatus
import org.mariotaku.twidere.model.ParcelableUser
import org.mariotaku.twidere.model.UserKey
@ -107,11 +108,7 @@ object LinkCreator {
if (USER_TYPE_FANFOU_COM == status.account_key.host) {
return getFanfouStatusLink(status.id)
}
if (status.is_retweet) {
return getTwitterStatusLink(status.user_screen_name, status.retweet_id)
} else {
return getTwitterStatusLink(status.user_screen_name, status.id)
}
return getTwitterStatusLink(status.user_screen_name, status.originalId)
}
fun getQuotedStatusWebLink(status: ParcelableStatus): Uri {