mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2025-02-02 09:46:51 +01:00
fixed #817
This commit is contained in:
parent
eb8377a899
commit
b7b9b0bb20
@ -41,7 +41,6 @@ import org.mariotaku.twidere.provider.TwidereDataStore.Statuses;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
|
||||
@ -74,13 +73,12 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
|
||||
public long _id;
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
|
||||
@JsonField(name = "id")
|
||||
@CursorField(Statuses.ID)
|
||||
@NonNull
|
||||
public String id;
|
||||
@SuppressWarnings("NullableProblems")
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@JsonField(name = "account_id", typeConverter = UserKeyConverter.class)
|
||||
@CursorField(value = Statuses.ACCOUNT_KEY, converter = UserKeyCursorFieldConverter.class)
|
||||
@NonNull
|
||||
@ -387,7 +385,7 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
|
||||
", favorite_count=" + favorite_count +
|
||||
", reply_count=" + reply_count +
|
||||
", in_reply_to_status_id='" + in_reply_to_status_id + '\'' +
|
||||
", in_reply_to_user_id=" + in_reply_to_user_key +
|
||||
", in_reply_to_user_key=" + in_reply_to_user_key +
|
||||
", my_retweet_id='" + my_retweet_id + '\'' +
|
||||
", quoted_id='" + quoted_id + '\'' +
|
||||
", quoted_timestamp=" + quoted_timestamp +
|
||||
@ -435,6 +433,7 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
|
||||
", account_color=" + account_color +
|
||||
", inserted_date=" + inserted_date +
|
||||
", is_pinned_status=" + is_pinned_status +
|
||||
", filter_flags=" + filter_flags +
|
||||
'}';
|
||||
}
|
||||
|
||||
|
@ -1419,24 +1419,26 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
|
||||
val fragment: StatusFragment
|
||||
) : LoadMoreSupportAdapter<ViewHolder>(fragment.context, Glide.with(fragment)),
|
||||
IStatusesAdapter<List<ParcelableStatus>>, IItemCountsAdapter {
|
||||
private val inflater: LayoutInflater
|
||||
|
||||
override val twidereLinkify: TwidereLinkify
|
||||
|
||||
override var statusClickListener: StatusClickListener? = null
|
||||
private var recyclerView: RecyclerView? = null
|
||||
private var detachedStatusViewHolder: DetailStatusViewHolder? = null
|
||||
|
||||
override val itemCounts = ItemCounts(ITEM_TYPES_SUM)
|
||||
|
||||
private val cardBackgroundColor: Int
|
||||
override val nameFirst = preferences[nameFirstKey]
|
||||
override val mediaPreviewStyle = preferences[mediaPreviewStyleKey]
|
||||
override val linkHighlightingStyle = preferences[linkHighlightOptionKey]
|
||||
override val lightFont = preferences[lightFontKey]
|
||||
override val mediaPreviewEnabled = preferences[mediaPreviewKey]
|
||||
override val sensitiveContentEnabled = preferences[displaySensitiveContentsKey]
|
||||
private val showCardActions = !preferences[hideCardActionsKey]
|
||||
override val useStarsForLikes = preferences[iWantMyStarsBackKey]
|
||||
|
||||
private val inflater: LayoutInflater
|
||||
private val cardBackgroundColor: Int
|
||||
private val showCardActions = !preferences[hideCardActionsKey]
|
||||
private var recyclerView: RecyclerView? = null
|
||||
private var detachedStatusViewHolder: DetailStatusViewHolder? = null
|
||||
private var mDetailMediaExpanded: Boolean = false
|
||||
|
||||
var status: ParcelableStatus? = null
|
||||
@ -1488,10 +1490,16 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
|
||||
override fun getStatus(position: Int, raw: Boolean): ParcelableStatus {
|
||||
when (getItemCountIndex(position, raw)) {
|
||||
ITEM_IDX_CONVERSATION -> {
|
||||
return data!![position - getIndexStart(ITEM_IDX_CONVERSATION)]
|
||||
var idx = position - getIndexStart(ITEM_IDX_CONVERSATION)
|
||||
if (data!![idx].is_filtered) idx++
|
||||
return data!![idx]
|
||||
}
|
||||
ITEM_IDX_REPLY -> {
|
||||
return data!![position - getIndexStart(ITEM_IDX_CONVERSATION) - getTypeCount(ITEM_IDX_CONVERSATION) - getTypeCount(ITEM_IDX_STATUS) + replyStart]
|
||||
var idx = position - getIndexStart(ITEM_IDX_CONVERSATION) -
|
||||
getTypeCount(ITEM_IDX_CONVERSATION) - getTypeCount(ITEM_IDX_STATUS) +
|
||||
replyStart
|
||||
if (data!![idx].is_filtered) idx++
|
||||
return data!![idx]
|
||||
}
|
||||
ITEM_IDX_STATUS -> {
|
||||
return status!!
|
||||
@ -1567,14 +1575,18 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
|
||||
var replyStart = -1
|
||||
data.forEachIndexed { i, item ->
|
||||
if (item.sort_id < sortId) {
|
||||
conversationCount++
|
||||
if (!item.is_filtered) {
|
||||
conversationCount++
|
||||
}
|
||||
} else if (status.id == item.id) {
|
||||
this.status = item
|
||||
} else if (item.sort_id > sortId) {
|
||||
if (replyStart < 0) {
|
||||
replyStart = i
|
||||
}
|
||||
replyCount++
|
||||
if (!item.is_filtered) {
|
||||
replyCount++
|
||||
}
|
||||
}
|
||||
}
|
||||
setTypeCount(ITEM_IDX_CONVERSATION, conversationCount)
|
||||
@ -1890,6 +1902,7 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
|
||||
const val VIEW_TYPE_REPLY_ERROR = 4
|
||||
const val VIEW_TYPE_CONVERSATION_ERROR = 5
|
||||
const val VIEW_TYPE_SPACE = 6
|
||||
const val VIEW_TYPE_EMPTY = 7
|
||||
|
||||
const val ITEM_IDX_CONVERSATION_LOAD_MORE = 0
|
||||
const val ITEM_IDX_CONVERSATION_ERROR = 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user