From 66d5ec7c2f9e1b209addca96bf7346e17b2a3dbb Mon Sep 17 00:00:00 2001 From: Austin Huang Date: Wed, 4 Nov 2020 11:26:29 -0500 Subject: [PATCH] add postviewv2 to dm thread, and fix sidecar video --- .../java/awais/instagrabber/asyncs/PostFetcher.java | 3 +++ .../directmessages/DirectMessageThreadFragment.java | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/awais/instagrabber/asyncs/PostFetcher.java b/app/src/main/java/awais/instagrabber/asyncs/PostFetcher.java index 556bd073..04543061 100755 --- a/app/src/main/java/awais/instagrabber/asyncs/PostFetcher.java +++ b/app/src/main/java/awais/instagrabber/asyncs/PostFetcher.java @@ -151,6 +151,9 @@ public final class PostFetcher extends AsyncTask { .setVideoViews(isChildVideo && childNode.has("video_view_count") ? childNode.getLong("video_view_count") : -1) + .setThumbnailUrl(childNode.getString("display_url")) + .setHeight(childNode.getJSONObject("dimensions").getInt("height")) + .setWidth(childNode.getJSONObject("dimensions").getInt("width")) .build()); // DownloadUtils.checkExistence(downloadDir, customDir, true, postModels.get(i)); } diff --git a/app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageThreadFragment.java b/app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageThreadFragment.java index 1cb3d474..a225a376 100644 --- a/app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageThreadFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageThreadFragment.java @@ -58,10 +58,12 @@ import awais.instagrabber.ProfileNavGraphDirections; import awais.instagrabber.R; import awais.instagrabber.adapters.DirectMessageItemsAdapter; import awais.instagrabber.asyncs.ImageUploader; +import awais.instagrabber.asyncs.PostFetcher; import awais.instagrabber.asyncs.direct_messages.DirectMessageInboxThreadFetcher; import awais.instagrabber.asyncs.direct_messages.DirectThreadBroadcaster; import awais.instagrabber.customviews.helpers.RecyclerLazyLoader; import awais.instagrabber.databinding.FragmentDirectMessagesThreadBinding; +import awais.instagrabber.fragments.PostViewV2Fragment; import awais.instagrabber.interfaces.FetchListener; import awais.instagrabber.interfaces.MentionClickListener; import awais.instagrabber.models.ImageUploadOptions; @@ -240,8 +242,13 @@ public class DirectMessageThreadFragment extends Fragment { case MEDIA_SHARE: case CLIP: case FELIX_SHARE: - final long postId = directItemModel.getMediaModel().getPk(); - // open post + final String shortCode = directItemModel.getMediaModel().getCode(); + new PostFetcher(shortCode, feedModel -> { + final PostViewV2Fragment fragment = PostViewV2Fragment + .builder(feedModel) + .build(); + fragment.show(getChildFragmentManager(), "post_view"); + }).execute(); break; case LINK: Intent linkIntent = new Intent(Intent.ACTION_VIEW);