patch downloaded check

This commit is contained in:
Austin Huang 2021-06-21 23:42:14 -04:00
parent bf9d847e4b
commit 65624f0b42
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F

View File

@ -24,6 +24,7 @@ import awais.instagrabber.models.PostsLayoutPreferences;
import awais.instagrabber.models.enums.MediaItemType; import awais.instagrabber.models.enums.MediaItemType;
import awais.instagrabber.repositories.responses.Media; import awais.instagrabber.repositories.responses.Media;
import awais.instagrabber.repositories.responses.User; import awais.instagrabber.repositories.responses.User;
import awais.instagrabber.utils.AppExecutors;
import awais.instagrabber.utils.DownloadUtils; import awais.instagrabber.utils.DownloadUtils;
import awais.instagrabber.utils.ResponseBodyUtils; import awais.instagrabber.utils.ResponseBodyUtils;
import awais.instagrabber.utils.TextUtils; import awais.instagrabber.utils.TextUtils;
@ -105,10 +106,13 @@ public class FeedGridItemViewHolder extends RecyclerView.ViewHolder {
binding.typeIcon.setVisibility(View.VISIBLE); binding.typeIcon.setVisibility(View.VISIBLE);
binding.typeIcon.setImageResource(typeIconRes); binding.typeIcon.setImageResource(typeIconRes);
} }
binding.downloaded.setVisibility(View.GONE);
AppExecutors.INSTANCE.getTasksThread().execute(() -> {
final List<Boolean> checkList = DownloadUtils.checkDownloaded(media); final List<Boolean> checkList = DownloadUtils.checkDownloaded(media);
if (checkList.isEmpty()) { if (checkList.isEmpty()) {
return; return;
} }
AppExecutors.INSTANCE.getMainThread().execute(() -> {
switch (media.getMediaType()) { switch (media.getMediaType()) {
case MEDIA_TYPE_IMAGE: case MEDIA_TYPE_IMAGE:
case MEDIA_TYPE_VIDEO: case MEDIA_TYPE_VIDEO:
@ -127,6 +131,8 @@ public class FeedGridItemViewHolder extends RecyclerView.ViewHolder {
break; break;
default: default:
} }
});
});
} }
private void setThumbImage(final String thumbnailUrl) { private void setThumbImage(final String thumbnailUrl) {