This commit is contained in:
stom79 2019-01-24 09:54:26 +01:00
parent 5363207263
commit 0ce3c871f0
1 changed files with 13 additions and 19 deletions

View File

@ -221,6 +221,10 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
pixelfedListAdapter = new PixelfedListAdapter(context, type, this.statuses); pixelfedListAdapter = new PixelfedListAdapter(context, type, this.statuses);
lv_status.setAdapter(pixelfedListAdapter); lv_status.setAdapter(pixelfedListAdapter);
}else if( instanceType.equals("ART")){ }else if( instanceType.equals("ART")){
List<TagTimeline> tagTimelines = new SearchDAO(context, db).getTimelineInfo(tag);
if( tagTimelines != null && tagTimelines.size() > 0) {
tagTimeline = tagTimelines.get(0);
}
artListAdapter = new ArtListAdapter(context, this.statuses); artListAdapter = new ArtListAdapter(context, this.statuses);
lv_status.setAdapter(artListAdapter); lv_status.setAdapter(artListAdapter);
} }
@ -808,7 +812,6 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
if(swipeRefreshLayout == null) if(swipeRefreshLayout == null)
return; return;
swipeRefreshLayout.setRefreshing(false); swipeRefreshLayout.setRefreshing(false);
if( isSwipped && this.statuses != null && this.statuses.size() > 0) { if( isSwipped && this.statuses != null && this.statuses.size() > 0) {
for (Status status : this.statuses) { for (Status status : this.statuses) {
status.setNew(false); status.setNew(false);
@ -848,25 +851,16 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
for (int i = statuses.size() - 1; i >= 0; i--) { for (int i = statuses.size() - 1; i >= 0; i--) {
if( this.statuses != null) { if( this.statuses != null) {
if( type != RetrieveFeedsAsyncTask.Type.HOME){ if( type != RetrieveFeedsAsyncTask.Type.HOME){
if( tagTimeline == null || !tagTimeline.isART() || (tagTimeline.isART() && tagTimeline.isNSFW())) { if( tagTimeline != null && instanceType.equals("ART") && !tagTimeline.isNSFW() ){
if( !statuses.get(i).isSensitive()) {
this.statuses.add(0, statuses.get(i));
inserted++;
}
}else {
if (this.statuses.size() == 0 || statuses.get(i).getCreated_at().after(this.statuses.get(0).getCreated_at())) { if (this.statuses.size() == 0 || statuses.get(i).getCreated_at().after(this.statuses.get(0).getCreated_at())) {
inserted++; inserted++;
this.statuses.add(0, statuses.get(i)); this.statuses.add(0, statuses.get(i));
} }
}else{
ArrayList<Status> safeStatuses = new ArrayList<>();
for(Status status: statuses){
if( !status.isSensitive())
safeStatuses.add(status);
}
this.statuses.addAll(safeStatuses);
if( instanceType.equals("MASTODON") || instanceType.equals("MISSKEY"))
statusListAdapter.notifyItemRangeInserted(0, safeStatuses.size());
else if( instanceType.equals("PIXELFED"))
pixelfedListAdapter.notifyItemRangeInserted(0, safeStatuses.size());
else if( instanceType.equals("ART"))
artListAdapter.notifyItemRangeInserted(0, safeStatuses.size());
} }
}else { }else {
if( lastReadTootDate != null && statuses.get(i).getCreated_at().after(lastReadTootDate)) { if( lastReadTootDate != null && statuses.get(i).getCreated_at().after(lastReadTootDate)) {
@ -880,11 +874,11 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
} }
} }
} }
if( instanceType.equals("MASTODON") || instanceType.equals("MISSKEY")) if( statusListAdapter != null && (instanceType.equals("MASTODON") || instanceType.equals("MISSKEY")))
statusListAdapter.notifyItemRangeInserted(0, inserted); statusListAdapter.notifyItemRangeInserted(0, inserted);
else if( instanceType.equals("PIXELFED")) else if( pixelfedListAdapter != null && instanceType.equals("PIXELFED"))
pixelfedListAdapter.notifyItemRangeInserted(0, inserted); pixelfedListAdapter.notifyItemRangeInserted(0, inserted);
else if( instanceType.equals("ART")) else if( artListAdapter != null && instanceType.equals("ART"))
artListAdapter.notifyItemRangeInserted(0, inserted); artListAdapter.notifyItemRangeInserted(0, inserted);
try { try {
if( type == RetrieveFeedsAsyncTask.Type.HOME) if( type == RetrieveFeedsAsyncTask.Type.HOME)