improved status activity summary
This commit is contained in:
parent
bdd8a9bab6
commit
927e21891c
|
@ -46,8 +46,6 @@ public class StatusActivitySummary extends MicroBlogResponseObject implements Mi
|
|||
long repliersCount;
|
||||
@JsonField(name = "retweeters_count")
|
||||
long retweetersCount;
|
||||
@JsonField(name = "descendent_reply_count")
|
||||
long descendentReplyCount;
|
||||
|
||||
public IDs getFavoriters() {
|
||||
return favoriters;
|
||||
|
@ -73,10 +71,6 @@ public class StatusActivitySummary extends MicroBlogResponseObject implements Mi
|
|||
return retweetersCount;
|
||||
}
|
||||
|
||||
public long getDescendentReplyCount() {
|
||||
return descendentReplyCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
|
|
|
@ -22,7 +22,6 @@ package org.mariotaku.twidere.data.status
|
|||
import android.accounts.AccountManager
|
||||
import android.content.ContentValues
|
||||
import android.content.Context
|
||||
import org.mariotaku.ktextension.addAllTo
|
||||
import org.mariotaku.microblog.library.Twitter
|
||||
import org.mariotaku.microblog.library.model.Paging
|
||||
import org.mariotaku.sqliteqb.library.Expression
|
||||
|
@ -96,28 +95,22 @@ class StatusActivitySummaryLiveData(val context: Context) : ComputableExceptionL
|
|||
val status = showStatus(statusId)
|
||||
result.favoriteCount = status.favoriteCount
|
||||
result.retweetCount = status.retweetCount
|
||||
result.replyCount = status.descendentReplyCount
|
||||
result.replyCount = status.replyCount
|
||||
return result
|
||||
}
|
||||
|
||||
private fun Twitter.getActivitySummaryOfficial(statusId: String, account: AccountDetails): StatusActivity {
|
||||
val summary = getStatusActivitySummary(statusId)
|
||||
val relatedIds = mutableSetOf<String>()
|
||||
summary.favoriters?.iDs?.let {
|
||||
it.slice(0 until (10.coerceAtMost(it.size)))
|
||||
}?.addAllTo(relatedIds)
|
||||
summary.retweeters?.iDs?.let {
|
||||
it.slice(0 until (10.coerceAtMost(it.size)))
|
||||
}?.addAllTo(relatedIds)
|
||||
|
||||
val relatedUsers = lookupUsers(relatedIds.toTypedArray())
|
||||
val paging = Paging().count(5)
|
||||
val relatedUsers = (getRetweetedBy(statusId, paging) + getFavoritedBy(statusId, paging))
|
||||
.filterNot { DataStoreUtils.isFilteringUser(context, it.key) }
|
||||
.map { it.toParcelable(account) }
|
||||
|
||||
val result = StatusActivity(statusId, relatedUsers)
|
||||
|
||||
result.favoriteCount = summary.favoritersCount
|
||||
result.retweetCount = summary.retweetersCount
|
||||
result.replyCount = summary.descendentReplyCount
|
||||
val status = showStatus(statusId)
|
||||
result.favoriteCount = status.favoriteCount
|
||||
result.retweetCount = status.retweetCount
|
||||
result.replyCount = status.replyCount
|
||||
return result
|
||||
}
|
||||
|
||||
|
|
|
@ -143,7 +143,7 @@ fun Status.applyTo(accountKey: UserKey, accountType: String, profileImageSize: S
|
|||
result.addFilterFlag(ParcelableStatus.FilterFlags.QUOTE_NOT_AVAILABLE)
|
||||
}
|
||||
|
||||
result.reply_count = status.descendentReplyCount
|
||||
result.reply_count = status.replyCount
|
||||
result.retweet_count = status.retweetCount
|
||||
result.favorite_count = status.favoriteCount
|
||||
|
||||
|
|
|
@ -443,7 +443,7 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
|
|||
private fun loadActivity(status: ParcelableStatus?) {
|
||||
if (status == null || host == null || isDetached) return
|
||||
statusActivitySummaryLiveData.accountKey = status.account_key
|
||||
statusActivitySummaryLiveData.statusId = status.id
|
||||
statusActivitySummaryLiveData.statusId = status.originalId
|
||||
statusActivitySummaryLiveData.load()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue