slightly improved list performance

This commit is contained in:
Mariotaku Lee 2017-09-02 22:31:52 +08:00
parent b0cca160eb
commit 31393f1d9c
No known key found for this signature in database
GPG Key ID: 15C10F89D7C33535
4 changed files with 23 additions and 14 deletions

View File

@ -63,11 +63,6 @@ public class ParcelableMedia implements Parcelable {
@JsonField(name = "height") @JsonField(name = "height")
@ParcelableThisPlease @ParcelableThisPlease
public int height; public int height;
@JsonField(name = "video_info")
@ParcelableThisPlease
public VideoInfo video_info;
@ParcelableNoThanks
public ParcelableCardEntity card;
@JsonField(name = "page_url") @JsonField(name = "page_url")
public String page_url; public String page_url;
@ParcelableThisPlease @ParcelableThisPlease
@ -77,6 +72,15 @@ public class ParcelableMedia implements Parcelable {
@JsonField(name = "alt_text") @JsonField(name = "alt_text")
public String alt_text; public String alt_text;
@JsonField(name = "video_info")
@ParcelableThisPlease
@Nullable
public VideoInfo video_info;
@ParcelableNoThanks
@Nullable
public ParcelableCardEntity card;
public static final Creator<ParcelableMedia> CREATOR = new Creator<ParcelableMedia>() { public static final Creator<ParcelableMedia> CREATOR = new Creator<ParcelableMedia>() {
@Override @Override
public ParcelableMedia createFromParcel(Parcel source) { public ParcelableMedia createFromParcel(Parcel source) {

View File

@ -280,26 +280,28 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
public ParcelableLocation location; public ParcelableLocation location;
@JsonField(name = "place_full_name") @JsonField(name = "place_full_name")
@CursorField(value = Statuses.PLACE_FULL_NAME, converter = LoganSquareCursorFieldConverter.class) @CursorField(value = Statuses.PLACE_FULL_NAME)
public String place_full_name; public String place_full_name;
@JsonField(name = "mentions") @JsonField(name = "mentions")
@CursorField(value = Statuses.MENTIONS_JSON, converter = LoganSquareCursorFieldConverter.class) @CursorField(value = Statuses.MENTIONS_JSON, converter = LoganSquareCursorFieldConverter.class)
public ParcelableUserMention[] mentions; public ParcelableUserMention[] mentions;
// TODO: Simplify for list loader
@JsonField(name = "media") @JsonField(name = "media")
@CursorField(value = Statuses.MEDIA_JSON, converter = LoganSquareCursorFieldConverter.class) @CursorField(value = Statuses.MEDIA_JSON, converter = LoganSquareCursorFieldConverter.class)
@Nullable @Nullable
public ParcelableMedia[] media; public ParcelableMedia[] media;
// TODO: Simplify for list loader
@JsonField(name = "quoted_media") @JsonField(name = "quoted_media")
@CursorField(value = Statuses.QUOTED_MEDIA_JSON, converter = LoganSquareCursorFieldConverter.class) @CursorField(value = Statuses.QUOTED_MEDIA_JSON, converter = LoganSquareCursorFieldConverter.class)
@Nullable @Nullable
public ParcelableMedia[] quoted_media; public ParcelableMedia[] quoted_media;
@Nullable
@JsonField(name = "card") @JsonField(name = "card")
@CursorField(value = Statuses.CARD, converter = LoganSquareCursorFieldConverter.class) @CursorField(value = Statuses.CARD, converter = LoganSquareCursorFieldConverter.class)
@Nullable
public ParcelableCardEntity card; public ParcelableCardEntity card;
@JsonField(name = "extras") @JsonField(name = "extras")
@ -314,7 +316,6 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
@JsonField(name = "quoted_spans") @JsonField(name = "quoted_spans")
@CursorField(value = Statuses.QUOTED_SPANS, converter = LoganSquareCursorFieldConverter.class) @CursorField(value = Statuses.QUOTED_SPANS, converter = LoganSquareCursorFieldConverter.class)
public SpanItem[] quoted_spans; public SpanItem[] quoted_spans;
public transient boolean is_filtered;
@JsonField(name = "account_color") @JsonField(name = "account_color")
@CursorField(Statuses.ACCOUNT_COLOR) @CursorField(Statuses.ACCOUNT_COLOR)
@ -323,14 +324,13 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
@CursorField(Statuses.INSERTED_DATE) @CursorField(Statuses.INSERTED_DATE)
public long inserted_date; public long inserted_date;
public boolean is_pinned_status;
@FilterFlags @FilterFlags
@CursorField(Statuses.FILTER_FLAGS) @CursorField(Statuses.FILTER_FLAGS)
public long filter_flags; public long filter_flags;
public transient boolean is_pinned_status;
public transient boolean is_filtered;
public ParcelableStatus() { public ParcelableStatus() {
} }

View File

@ -347,7 +347,8 @@ abstract class CursorActivitiesFragment : AbsActivitiesFragment() {
} }
companion object { companion object {
val activityColumnsLite = Activities.COLUMNS - arrayOf(Activities.SOURCES,Activities.TARGETS, val activityColumnsLite = Activities.COLUMNS - arrayOf(Activities.SOURCES, Activities.TARGETS,
Activities.TARGET_OBJECTS) Activities.TARGET_OBJECTS)
} }
} }

View File

@ -124,7 +124,7 @@ abstract class CursorStatusesFragment : AbsStatusesFragment() {
where = accountWhere where = accountWhere
} }
adapter.showAccountsColor = accountKeys.size > 1 adapter.showAccountsColor = accountKeys.size > 1
val projection = Statuses.COLUMNS val projection = statusColumnsLite
val selectionArgs = Array(accountKeys.size) { val selectionArgs = Array(accountKeys.size) {
accountKeys[it].toString() accountKeys[it].toString()
} }
@ -314,4 +314,8 @@ abstract class CursorStatusesFragment : AbsStatusesFragment() {
} }
companion object {
private val statusColumnsLite = Statuses.COLUMNS - arrayOf(Statuses.MENTIONS_JSON,
Statuses.CARD)
}
} }