diff --git a/app/src/main/java/awais/instagrabber/adapters/FeedAdapterV2.java b/app/src/main/java/awais/instagrabber/adapters/FeedAdapterV2.java index 102640a6..0090de16 100644 --- a/app/src/main/java/awais/instagrabber/adapters/FeedAdapterV2.java +++ b/app/src/main/java/awais/instagrabber/adapters/FeedAdapterV2.java @@ -208,15 +208,11 @@ public final class FeedAdapterV2 extends ListAdapter { if (!selectionModeActive && feedItemCallback != null) { - feedItemCallback.onPostClick(media, binding.profilePic, binding.postImage); + feedItemCallback.onPostClick(media); return; } if (selectionModeActive && adapterSelectionCallback != null) { diff --git a/app/src/main/java/awais/instagrabber/adapters/viewholder/feed/FeedPhotoViewHolder.java b/app/src/main/java/awais/instagrabber/adapters/viewholder/feed/FeedPhotoViewHolder.java index 22724897..f96d9fb9 100644 --- a/app/src/main/java/awais/instagrabber/adapters/viewholder/feed/FeedPhotoViewHolder.java +++ b/app/src/main/java/awais/instagrabber/adapters/viewholder/feed/FeedPhotoViewHolder.java @@ -61,7 +61,7 @@ public class FeedPhotoViewHolder extends FeedItemViewHolder { @Override public boolean onSingleTapConfirmed(final MotionEvent e) { if (feedItemCallback != null) { - feedItemCallback.onPostClick(media, binding.itemFeedTop.ivProfilePic, binding.imageViewer); + feedItemCallback.onPostClick(media); return true; } return false; diff --git a/app/src/main/java/awais/instagrabber/adapters/viewholder/feed/FeedVideoViewHolder.java b/app/src/main/java/awais/instagrabber/adapters/viewholder/feed/FeedVideoViewHolder.java index 885632c1..b2eaaef4 100644 --- a/app/src/main/java/awais/instagrabber/adapters/viewholder/feed/FeedVideoViewHolder.java +++ b/app/src/main/java/awais/instagrabber/adapters/viewholder/feed/FeedVideoViewHolder.java @@ -70,7 +70,7 @@ public class FeedVideoViewHolder extends FeedItemViewHolder { @Override public void onThumbnailClick() { - feedItemCallback.onPostClick(media, binding.itemFeedTop.ivProfilePic, binding.videoPost.thumbnail); + feedItemCallback.onPostClick(media); } @Override diff --git a/app/src/main/java/awais/instagrabber/fragments/CollectionPostsFragment.java b/app/src/main/java/awais/instagrabber/fragments/CollectionPostsFragment.java index 533a116f..fc3991fb 100644 --- a/app/src/main/java/awais/instagrabber/fragments/CollectionPostsFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/CollectionPostsFragment.java @@ -2,7 +2,6 @@ package awais.instagrabber.fragments; import android.animation.ArgbEvaluator; import android.content.Context; -import android.content.pm.PackageManager; import android.graphics.Color; import android.graphics.PorterDuff; import android.graphics.drawable.Animatable; @@ -107,13 +106,13 @@ public class CollectionPostsFragment extends Fragment implements SwipeRefreshLay }); private final FeedAdapterV2.FeedItemCallback feedItemCallback = new FeedAdapterV2.FeedItemCallback() { @Override - public void onPostClick(final Media feedModel, final View profilePicView, final View mainPostImage) { - openPostDialog(feedModel, profilePicView, mainPostImage, -1); + public void onPostClick(final Media feedModel) { + openPostDialog(feedModel, -1); } @Override public void onSliderClick(final Media feedModel, final int position) { - openPostDialog(feedModel, null, null, position); + openPostDialog(feedModel, position); } @Override @@ -151,12 +150,12 @@ public class CollectionPostsFragment extends Fragment implements SwipeRefreshLay } @Override - public void onNameClick(final Media feedModel, final View profilePicView) { + public void onNameClick(final Media feedModel) { navigateToProfile("@" + feedModel.getUser().getUsername()); } @Override - public void onProfilePicClick(final Media feedModel, final View profilePicView) { + public void onProfilePicClick(final Media feedModel) { navigateToProfile("@" + feedModel.getUser().getUsername()); } @@ -170,10 +169,7 @@ public class CollectionPostsFragment extends Fragment implements SwipeRefreshLay Utils.openEmailAddress(getContext(), emailId); } - private void openPostDialog(final Media feedModel, - final View profilePicView, - final View mainPostImage, - final int position) { + private void openPostDialog(final Media feedModel, final int position) { final NavController navController = NavHostFragment.findNavController(CollectionPostsFragment.this); final Bundle bundle = new Bundle(); bundle.putSerializable(PostViewV2Fragment.ARG_MEDIA, feedModel); diff --git a/app/src/main/java/awais/instagrabber/fragments/HashTagFragment.java b/app/src/main/java/awais/instagrabber/fragments/HashTagFragment.java index f1c08306..2967c7fe 100644 --- a/app/src/main/java/awais/instagrabber/fragments/HashTagFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/HashTagFragment.java @@ -2,7 +2,6 @@ package awais.instagrabber.fragments; import android.annotation.SuppressLint; import android.content.Context; -import android.content.pm.PackageManager; import android.graphics.Typeface; import android.os.Bundle; import android.os.Handler; @@ -53,7 +52,7 @@ import awais.instagrabber.dialogs.PostsLayoutPreferencesDialogFragment; import awais.instagrabber.models.PostsLayoutPreferences; import awais.instagrabber.models.enums.FavoriteType; import awais.instagrabber.models.enums.FollowingType; -import awais.instagrabber.repositories.requests.StoryViewerOptions; +//import awais.instagrabber.repositories.requests.StoryViewerOptions; import awais.instagrabber.repositories.responses.Hashtag; import awais.instagrabber.repositories.responses.Location; import awais.instagrabber.repositories.responses.Media; @@ -125,13 +124,13 @@ public class HashTagFragment extends Fragment implements SwipeRefreshLayout.OnRe }); private final FeedAdapterV2.FeedItemCallback feedItemCallback = new FeedAdapterV2.FeedItemCallback() { @Override - public void onPostClick(final Media feedModel, final View profilePicView, final View mainPostImage) { - openPostDialog(feedModel, profilePicView, mainPostImage, -1); + public void onPostClick(final Media feedModel) { + openPostDialog(feedModel, -1); } @Override public void onSliderClick(final Media feedModel, final int position) { - openPostDialog(feedModel, null, null, position); + openPostDialog(feedModel, position); } @Override @@ -171,12 +170,12 @@ public class HashTagFragment extends Fragment implements SwipeRefreshLayout.OnRe } @Override - public void onNameClick(final Media feedModel, final View profilePicView) { + public void onNameClick(final Media feedModel) { navigateToProfile("@" + feedModel.getUser().getUsername()); } @Override - public void onProfilePicClick(final Media feedModel, final View profilePicView) { + public void onProfilePicClick(final Media feedModel) { navigateToProfile("@" + feedModel.getUser().getUsername()); } @@ -190,10 +189,7 @@ public class HashTagFragment extends Fragment implements SwipeRefreshLayout.OnRe Utils.openEmailAddress(getContext(), emailId); } - private void openPostDialog(@NonNull final Media feedModel, - final View profilePicView, - final View mainPostImage, - final int position) { + private void openPostDialog(@NonNull final Media feedModel, final int position) { if (opening) return; final User user = feedModel.getUser(); if (user == null) return; @@ -207,7 +203,7 @@ public class HashTagFragment extends Fragment implements SwipeRefreshLayout.OnRe return; } if (media == null) return; - AppExecutors.INSTANCE.getMainThread().execute(() -> openPostDialog(media, profilePicView, mainPostImage, position)); + AppExecutors.INSTANCE.getMainThread().execute(() -> openPostDialog(media, position)); }, Dispatchers.getIO())); return; } diff --git a/app/src/main/java/awais/instagrabber/fragments/LocationFragment.java b/app/src/main/java/awais/instagrabber/fragments/LocationFragment.java index 17aad8aa..93c3e13f 100644 --- a/app/src/main/java/awais/instagrabber/fragments/LocationFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/LocationFragment.java @@ -3,7 +3,6 @@ package awais.instagrabber.fragments; import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; -import android.content.pm.PackageManager; import android.net.Uri; import android.os.Bundle; import android.os.Handler; @@ -50,7 +49,7 @@ import awais.instagrabber.db.repositories.FavoriteRepository; import awais.instagrabber.dialogs.PostsLayoutPreferencesDialogFragment; import awais.instagrabber.models.PostsLayoutPreferences; import awais.instagrabber.models.enums.FavoriteType; -import awais.instagrabber.repositories.requests.StoryViewerOptions; +//import awais.instagrabber.repositories.requests.StoryViewerOptions; import awais.instagrabber.repositories.responses.Location; import awais.instagrabber.repositories.responses.Media; import awais.instagrabber.repositories.responses.User; @@ -119,13 +118,13 @@ public class LocationFragment extends Fragment implements SwipeRefreshLayout.OnR }); private final FeedAdapterV2.FeedItemCallback feedItemCallback = new FeedAdapterV2.FeedItemCallback() { @Override - public void onPostClick(final Media feedModel, final View profilePicView, final View mainPostImage) { - openPostDialog(feedModel, profilePicView, mainPostImage, -1); + public void onPostClick(final Media feedModel) { + openPostDialog(feedModel, -1); } @Override public void onSliderClick(final Media feedModel, final int position) { - openPostDialog(feedModel, null, null, position); + openPostDialog(feedModel, position); } @Override @@ -163,12 +162,12 @@ public class LocationFragment extends Fragment implements SwipeRefreshLayout.OnR } @Override - public void onNameClick(final Media feedModel, final View profilePicView) { + public void onNameClick(final Media feedModel) { navigateToProfile("@" + feedModel.getUser().getUsername()); } @Override - public void onProfilePicClick(final Media feedModel, final View profilePicView) { + public void onProfilePicClick(final Media feedModel) { navigateToProfile("@" + feedModel.getUser().getUsername()); } @@ -182,10 +181,7 @@ public class LocationFragment extends Fragment implements SwipeRefreshLayout.OnR Utils.openEmailAddress(getContext(), emailId); } - private void openPostDialog(@NonNull final Media feedModel, - final View profilePicView, - final View mainPostImage, - final int position) { + private void openPostDialog(@NonNull final Media feedModel, final int position) { if (opening) return; final User user = feedModel.getUser(); if (user == null) return; @@ -200,7 +196,7 @@ public class LocationFragment extends Fragment implements SwipeRefreshLayout.OnR return; } if (media == null) return; - openPostDialog(media, profilePicView, mainPostImage, position); + openPostDialog(media, position); })) ); return; diff --git a/app/src/main/java/awais/instagrabber/fragments/SavedViewerFragment.java b/app/src/main/java/awais/instagrabber/fragments/SavedViewerFragment.java index c7f59fcf..6325794e 100644 --- a/app/src/main/java/awais/instagrabber/fragments/SavedViewerFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/SavedViewerFragment.java @@ -1,7 +1,6 @@ package awais.instagrabber.fragments; import android.content.Context; -import android.content.pm.PackageManager; import android.os.Bundle; import android.os.Handler; import android.util.Log; @@ -90,13 +89,13 @@ public final class SavedViewerFragment extends Fragment implements SwipeRefreshL }); private final FeedAdapterV2.FeedItemCallback feedItemCallback = new FeedAdapterV2.FeedItemCallback() { @Override - public void onPostClick(final Media feedModel, final View profilePicView, final View mainPostImage) { - openPostDialog(feedModel, profilePicView, mainPostImage, -1); + public void onPostClick(final Media feedModel) { + openPostDialog(feedModel, -1); } @Override public void onSliderClick(final Media feedModel, final int position) { - openPostDialog(feedModel, null, null, position); + openPostDialog(feedModel, position); } @Override @@ -134,12 +133,12 @@ public final class SavedViewerFragment extends Fragment implements SwipeRefreshL } @Override - public void onNameClick(final Media feedModel, final View profilePicView) { + public void onNameClick(final Media feedModel) { navigateToProfile("@" + feedModel.getUser().getUsername()); } @Override - public void onProfilePicClick(final Media feedModel, final View profilePicView) { + public void onProfilePicClick(final Media feedModel) { navigateToProfile("@" + feedModel.getUser().getUsername()); } @@ -153,10 +152,7 @@ public final class SavedViewerFragment extends Fragment implements SwipeRefreshL Utils.openEmailAddress(getContext(), emailId); } - private void openPostDialog(final Media feedModel, - final View profilePicView, - final View mainPostImage, - final int position) { + private void openPostDialog(final Media feedModel, final int position) { final NavController navController = NavHostFragment.findNavController(SavedViewerFragment.this); final Bundle bundle = new Bundle(); bundle.putSerializable(PostViewV2Fragment.ARG_MEDIA, feedModel); diff --git a/app/src/main/java/awais/instagrabber/fragments/TopicPostsFragment.java b/app/src/main/java/awais/instagrabber/fragments/TopicPostsFragment.java index 1d05ddca..39c4e6a4 100644 --- a/app/src/main/java/awais/instagrabber/fragments/TopicPostsFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/TopicPostsFragment.java @@ -2,7 +2,6 @@ package awais.instagrabber.fragments; import android.animation.ArgbEvaluator; import android.content.Context; -import android.content.pm.PackageManager; import android.graphics.Color; import android.graphics.PorterDuff; import android.graphics.drawable.Animatable; @@ -101,13 +100,13 @@ public class TopicPostsFragment extends Fragment implements SwipeRefreshLayout.O }); private final FeedAdapterV2.FeedItemCallback feedItemCallback = new FeedAdapterV2.FeedItemCallback() { @Override - public void onPostClick(final Media feedModel, final View profilePicView, final View mainPostImage) { - openPostDialog(feedModel, profilePicView, mainPostImage, -1); + public void onPostClick(final Media feedModel) { + openPostDialog(feedModel, -1); } @Override public void onSliderClick(final Media feedModel, final int position) { - openPostDialog(feedModel, null, null, position); + openPostDialog(feedModel, position); } @Override @@ -145,12 +144,12 @@ public class TopicPostsFragment extends Fragment implements SwipeRefreshLayout.O } @Override - public void onNameClick(final Media feedModel, final View profilePicView) { + public void onNameClick(final Media feedModel) { navigateToProfile("@" + feedModel.getUser().getUsername()); } @Override - public void onProfilePicClick(final Media feedModel, final View profilePicView) { + public void onProfilePicClick(final Media feedModel) { navigateToProfile("@" + feedModel.getUser().getUsername()); } @@ -164,10 +163,7 @@ public class TopicPostsFragment extends Fragment implements SwipeRefreshLayout.O Utils.openEmailAddress(getContext(), emailId); } - private void openPostDialog(final Media feedModel, - final View profilePicView, - final View mainPostImage, - final int position) { + private void openPostDialog(final Media feedModel, final int position) { final NavController navController = NavHostFragment.findNavController(TopicPostsFragment.this); final Bundle bundle = new Bundle(); bundle.putSerializable(PostViewV2Fragment.ARG_MEDIA, feedModel); diff --git a/app/src/main/java/awais/instagrabber/fragments/main/FeedFragment.java b/app/src/main/java/awais/instagrabber/fragments/main/FeedFragment.java index eb2909d2..539c8361 100644 --- a/app/src/main/java/awais/instagrabber/fragments/main/FeedFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/main/FeedFragment.java @@ -92,13 +92,13 @@ public class FeedFragment extends Fragment implements SwipeRefreshLayout.OnRefre private final FeedAdapterV2.FeedItemCallback feedItemCallback = new FeedAdapterV2.FeedItemCallback() { @Override - public void onPostClick(final Media feedModel, final View profilePicView, final View mainPostImage) { - openPostDialog(feedModel, profilePicView, mainPostImage, -1); + public void onPostClick(final Media feedModel) { + openPostDialog(feedModel, -1); } @Override public void onSliderClick(final Media feedModel, final int position) { - openPostDialog(feedModel, null, null, position); + openPostDialog(feedModel, position); } @Override @@ -140,13 +140,13 @@ public class FeedFragment extends Fragment implements SwipeRefreshLayout.OnRefre } @Override - public void onNameClick(final Media feedModel, final View profilePicView) { + public void onNameClick(final Media feedModel) { if (feedModel.getUser() == null) return; navigateToProfile("@" + feedModel.getUser().getUsername()); } @Override - public void onProfilePicClick(final Media feedModel, final View profilePicView) { + public void onProfilePicClick(final Media feedModel) { if (feedModel.getUser() == null) return; navigateToProfile("@" + feedModel.getUser().getUsername()); } @@ -161,16 +161,7 @@ public class FeedFragment extends Fragment implements SwipeRefreshLayout.OnRefre Utils.openEmailAddress(getContext(), emailId); } - private void openPostDialog(final Media feedModel, - final View profilePicView, - final View mainPostImage, - final int position) { - // ViewCompat.setTransitionName(profilePicView, "profile_pic"); - // ViewCompat.setTransitionName(mainPostImage, "post_image"); - // final FragmentNavigator.Extras extras = new FragmentNavigator.Extras.Builder() - // .addSharedElement(profilePicView, "profile_pic") - // .addSharedElement(mainPostImage, "post_image") - // .build(); + private void openPostDialog(final Media feedModel, final int position) { final NavController navController = NavHostFragment.findNavController(FeedFragment.this); final Bundle bundle = new Bundle(); bundle.putSerializable(PostViewV2Fragment.ARG_MEDIA, feedModel); diff --git a/app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.kt b/app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.kt index 0784b8ed..326bc57a 100644 --- a/app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.kt +++ b/app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.kt @@ -92,15 +92,15 @@ class ProfileFragment : Fragment(), OnRefreshListener, ConfirmDialogFragmentCall private val bioDialogRequestCode = 102 private val translationDialogRequestCode = 103 private val feedItemCallback: FeedAdapterV2.FeedItemCallback = object : FeedAdapterV2.FeedItemCallback { - override fun onPostClick(media: Media?, profilePicView: View?, mainPostImage: View?) { + override fun onPostClick(media: Media) { openPostDialog(media ?: return, -1) } - override fun onProfilePicClick(media: Media?, profilePicView: View?) { + override fun onProfilePicClick(media: Media) { navigateToProfile(media?.user?.username) } - override fun onNameClick(media: Media?, profilePicView: View?) { + override fun onNameClick(media: Media) { navigateToProfile(media?.user?.username) }