From f3c50e87c4f23905e7afa94e595aaf43a144de45 Mon Sep 17 00:00:00 2001 From: Austin Huang Date: Sun, 1 Nov 2020 14:43:07 -0500 Subject: [PATCH] small fixes and general maintenance (see desc) * post view: 1. show username in bold, and full_name on the side 2. fix comment & control button hide timing * layout: show username instead of full_name in grids * profile: fix whitespace on avatar * dm: add FELIX_SHARE as a message type * general maintenance --- .../adapters/DirectMessageItemsAdapter.java | 1 + .../DirectMessageInboxItemViewHolder.java | 1 + .../viewholder/FeedGridItemViewHolder.java | 2 +- .../fragments/PostViewV2Fragment.java | 13 ++++++++++--- .../DirectMessageThreadFragment.java | 12 +++--------- .../fragments/settings/AboutFragment.java | 4 ++-- .../models/enums/DirectItemType.java | 3 ++- .../awais/instagrabber/utils/Constants.java | 6 +++--- .../instagrabber/utils/ResponseBodyUtils.java | 5 +++++ app/src/main/res/layout/dialog_post_view.xml | 19 +++++++++++++++++-- app/src/main/res/layout/fragment_profile.xml | 3 ++- 11 files changed, 47 insertions(+), 22 deletions(-) diff --git a/app/src/main/java/awais/instagrabber/adapters/DirectMessageItemsAdapter.java b/app/src/main/java/awais/instagrabber/adapters/DirectMessageItemsAdapter.java index 547f3cce..a344a238 100644 --- a/app/src/main/java/awais/instagrabber/adapters/DirectMessageItemsAdapter.java +++ b/app/src/main/java/awais/instagrabber/adapters/DirectMessageItemsAdapter.java @@ -107,6 +107,7 @@ public final class DirectMessageItemsAdapter extends ListAdapter bottomSheetBehavior; - private boolean detailsVisible = true; + private boolean detailsVisible = true, video; private VideoPlayerViewHelper videoPlayerViewHelper; private SliderItemsAdapter sliderItemsAdapter; private boolean wasControlsVisible; @@ -762,8 +762,10 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment { } private void setupTitles() { - binding.title.setText(feedModel.getProfileModel().getName()); + binding.title.setText(feedModel.getProfileModel().getUsername()); + binding.righttitle.setText(feedModel.getProfileModel().getName()); binding.title.setOnClickListener(v -> navigateToProfile("@" + feedModel.getProfileModel().getUsername())); + binding.righttitle.setOnClickListener(v -> navigateToProfile("@" + feedModel.getProfileModel().getUsername())); final String locationName = feedModel.getLocationName(); if (!TextUtils.isEmpty(locationName)) { binding.subtitle.setText(locationName); @@ -1079,6 +1081,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment { } private void enablePlayerControls(final boolean enable) { + video = enable; if (enable) { binding.playerControlsToggle.setVisibility(View.VISIBLE); binding.playerControlsToggle.setOnClickListener(v -> { @@ -1165,6 +1168,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment { binding.bottomBg.setVisibility(View.GONE); binding.likesCount.setVisibility(View.GONE); binding.commentsCount.setVisibility(View.GONE); + binding.comment.setVisibility(View.GONE); binding.captionToggle.setVisibility(View.GONE); binding.playerControlsToggle.setVisibility(View.GONE); binding.like.setVisibility(View.GONE); @@ -1188,7 +1192,10 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment { binding.likesCount.setVisibility(View.VISIBLE); binding.commentsCount.setVisibility(View.VISIBLE); binding.captionToggle.setVisibility(View.VISIBLE); - binding.playerControlsToggle.setVisibility(View.VISIBLE); + binding.comment.setVisibility(View.VISIBLE); + if (video) { + binding.playerControlsToggle.setVisibility(View.VISIBLE); + } binding.download.setVisibility(View.VISIBLE); binding.like.setVisibility(View.VISIBLE); binding.save.setVisibility(View.VISIBLE); 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 43325cca..3d7344f8 100644 --- a/app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageThreadFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageThreadFragment.java @@ -234,16 +234,9 @@ public class DirectMessageThreadFragment extends Fragment { switch (itemType) { case MEDIA_SHARE: case CLIP: + case FELIX_SHARE: final long postId = directItemModel.getMediaModel().getPk(); - final boolean isId = true; - final NavController navController = NavHostFragment.findNavController(this); - final NavDirections action = DirectMessageThreadFragmentDirections - .actionGlobalPostViewFragment( - 0, - new String[]{String.valueOf(postId)}, - isId - ); - navController.navigate(action); + // open post break; case LINK: Intent linkIntent = new Intent(Intent.ACTION_VIEW); @@ -322,6 +315,7 @@ public class DirectMessageThreadFragment extends Fragment { switch (itemType) { case MEDIA_SHARE: case CLIP: + case FELIX_SHARE: firstOption = R.string.view_post; break; case LINK: diff --git a/app/src/main/java/awais/instagrabber/fragments/settings/AboutFragment.java b/app/src/main/java/awais/instagrabber/fragments/settings/AboutFragment.java index 0e72d21f..56b150dc 100644 --- a/app/src/main/java/awais/instagrabber/fragments/settings/AboutFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/settings/AboutFragment.java @@ -55,7 +55,7 @@ public class AboutFragment extends BasePreferencesFragment { preference.setIconSpaceReserved(false); preference.setOnPreferenceClickListener(p -> { final Intent intent = new Intent(Intent.ACTION_VIEW); - intent.setData(Uri.parse("https://instagrabber.austinhuang.me")); + intent.setData(Uri.parse("https://barinsta.austinhuang.me")); startActivity(intent); return true; }); @@ -71,7 +71,7 @@ public class AboutFragment extends BasePreferencesFragment { preference.setIconSpaceReserved(false); preference.setOnPreferenceClickListener(p -> { final Intent intent = new Intent(Intent.ACTION_VIEW); - intent.setData(Uri.parse("https://github.com/austinhuang0131/instagrabber")); + intent.setData(Uri.parse("https://github.com/austinhuang0131/barinsta")); startActivity(intent); return true; }); diff --git a/app/src/main/java/awais/instagrabber/models/enums/DirectItemType.java b/app/src/main/java/awais/instagrabber/models/enums/DirectItemType.java index deb29467..3258cfbb 100755 --- a/app/src/main/java/awais/instagrabber/models/enums/DirectItemType.java +++ b/app/src/main/java/awais/instagrabber/models/enums/DirectItemType.java @@ -19,7 +19,8 @@ public enum DirectItemType implements Serializable { ACTION_LOG(12), PLACEHOLDER(13), STORY_SHARE(14), - CLIP(15); // clip is just media_share but reel + CLIP(15), // media_share but reel + FELIX_SHARE(16); // media_share but igtv private final int id; private static Map map = new HashMap<>(); diff --git a/app/src/main/java/awais/instagrabber/utils/Constants.java b/app/src/main/java/awais/instagrabber/utils/Constants.java index 8ead842b..72fa94b4 100644 --- a/app/src/main/java/awais/instagrabber/utils/Constants.java +++ b/app/src/main/java/awais/instagrabber/utils/Constants.java @@ -58,10 +58,10 @@ public final class Constants { // spoof public static final String USER_AGENT = "Mozilla/5.0 (Linux; Android 8.1.0; motorola one Build/OPKS28.63-18-3; wv) " + "AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/70.0.3538.80 Mobile Safari/537.36 " + - "Instagram 161.0.0.37.121 Android (27/8.1.0; 320dpi; 720x1362; motorola; motorola one; deen_sprout; qcom; pt_BR; 248310224)"; + "Instagram 165.1.0.29.119 Android (27/8.1.0; 320dpi; 720x1362; motorola; motorola one; deen_sprout; qcom; pt_BR; 253447818)"; public static final String I_USER_AGENT = - "Instagram 161.0.0.37.121 Android (27/8.1.0; 320dpi; 720x1362; motorola; motorola one; deen_sprout; qcom; pt_BR; 248310224)"; - public static final String A_USER_AGENT = "https://InstaGrabber.AustinHuang.me / mailto:InstaGrabber@AustinHuang.me"; + "Instagram 165.1.0.29.119 Android (27/8.1.0; 320dpi; 720x1362; motorola; motorola one; deen_sprout; qcom; pt_BR; 253447818)"; + public static final String A_USER_AGENT = "https://Barinsta.AustinHuang.me / mailto:Barinsta@AustinHuang.me"; // see https://github.com/dilame/instagram-private-api/blob/master/src/core/constants.ts public static final String SUPPORTED_CAPABILITIES = "[ { \"name\": \"SUPPORTED_SDK_VERSIONS\", \"value\":" + " \"13.0,14.0,15.0,16.0,17.0,18.0,19.0,20.0,21.0,22.0,23.0,24.0,25.0,26.0,27.0,28.0,29.0,30.0,31.0," + diff --git a/app/src/main/java/awais/instagrabber/utils/ResponseBodyUtils.java b/app/src/main/java/awais/instagrabber/utils/ResponseBodyUtils.java index 62cdc833..26172184 100644 --- a/app/src/main/java/awais/instagrabber/utils/ResponseBodyUtils.java +++ b/app/src/main/java/awais/instagrabber/utils/ResponseBodyUtils.java @@ -242,6 +242,7 @@ public final class ResponseBodyUtils { if ("voice_media".equals(itemType)) return DirectItemType.VOICE_MEDIA; if ("story_share".equals(itemType)) return DirectItemType.STORY_SHARE; if ("clip".equals(itemType)) return DirectItemType.CLIP; + if ("felix_share".equals(itemType)) return DirectItemType.FELIX_SHARE; return DirectItemType.TEXT; } @@ -501,6 +502,10 @@ public final class ResponseBodyUtils { directMedia = getDirectMediaModel(itemObject.getJSONObject("clip").getJSONObject("clip")); break; + case FELIX_SHARE: + directMedia = getDirectMediaModel(itemObject.getJSONObject("felix_share").getJSONObject("video")); + break; + case MEDIA: directMedia = getDirectMediaModel(itemObject.optJSONObject("media")); break; diff --git a/app/src/main/res/layout/dialog_post_view.xml b/app/src/main/res/layout/dialog_post_view.xml index 4f8bce5a..77d924a9 100644 --- a/app/src/main/res/layout/dialog_post_view.xml +++ b/app/src/main/res/layout/dialog_post_view.xml @@ -63,7 +63,7 @@ + +