Browse Source

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
renovate/org.robolectric-robolectric-4.x
Austin Huang 4 years ago
parent
commit
f3c50e87c4
No known key found for this signature in database GPG Key ID: 84C23AA04587A91F
  1. 1
      app/src/main/java/awais/instagrabber/adapters/DirectMessageItemsAdapter.java
  2. 1
      app/src/main/java/awais/instagrabber/adapters/viewholder/DirectMessageInboxItemViewHolder.java
  3. 2
      app/src/main/java/awais/instagrabber/adapters/viewholder/FeedGridItemViewHolder.java
  4. 13
      app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java
  5. 12
      app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageThreadFragment.java
  6. 4
      app/src/main/java/awais/instagrabber/fragments/settings/AboutFragment.java
  7. 3
      app/src/main/java/awais/instagrabber/models/enums/DirectItemType.java
  8. 6
      app/src/main/java/awais/instagrabber/utils/Constants.java
  9. 5
      app/src/main/java/awais/instagrabber/utils/ResponseBodyUtils.java
  10. 19
      app/src/main/res/layout/dialog_post_view.xml
  11. 3
      app/src/main/res/layout/fragment_profile.xml

1
app/src/main/java/awais/instagrabber/adapters/DirectMessageItemsAdapter.java

@ -107,6 +107,7 @@ public final class DirectMessageItemsAdapter extends ListAdapter<DirectItemModel
return new DirectMessageReelShareViewHolder(baseBinding, binding, onClickListener, mentionClickListener); return new DirectMessageReelShareViewHolder(baseBinding, binding, onClickListener, mentionClickListener);
} }
case MEDIA_SHARE: case MEDIA_SHARE:
case FELIX_SHARE:
case CLIP: { case CLIP: {
final LayoutDmMediaShareBinding binding = LayoutDmMediaShareBinding.inflate(layoutInflater, itemViewParent, false); final LayoutDmMediaShareBinding binding = LayoutDmMediaShareBinding.inflate(layoutInflater, itemViewParent, false);
return new DirectMessageMediaShareViewHolder(baseBinding, binding, onClickListener); return new DirectMessageMediaShareViewHolder(baseBinding, binding, onClickListener);

1
app/src/main/java/awais/instagrabber/adapters/viewholder/DirectMessageInboxItemViewHolder.java

@ -97,6 +97,7 @@ public final class DirectMessageInboxItemViewHolder extends RecyclerView.ViewHol
case MEDIA_SHARE: case MEDIA_SHARE:
case RAVEN_MEDIA: case RAVEN_MEDIA:
case CLIP: case CLIP:
case FELIX_SHARE:
messageText = context.getString(R.string.direct_messages_sent_media); messageText = context.getString(R.string.direct_messages_sent_media);
break; break;
case ACTION_LOG: case ACTION_LOG:

2
app/src/main/java/awais/instagrabber/adapters/viewholder/FeedGridItemViewHolder.java

@ -74,7 +74,7 @@ public class FeedGridItemViewHolder extends RecyclerView.ViewHolder {
} }
if (layoutPreferences.isNameVisible()) { if (layoutPreferences.isNameVisible()) {
binding.name.setVisibility(View.VISIBLE); binding.name.setVisibility(View.VISIBLE);
binding.name.setText(feedModel.getProfileModel().getName());
binding.name.setText(feedModel.getProfileModel().getUsername());
} else { } else {
binding.name.setVisibility(View.GONE); binding.name.setVisibility(View.GONE);
} }

13
app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java

@ -98,7 +98,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
private MediaService mediaService; private MediaService mediaService;
private Context context; private Context context;
private BottomSheetBehavior<NestedScrollView> bottomSheetBehavior; private BottomSheetBehavior<NestedScrollView> bottomSheetBehavior;
private boolean detailsVisible = true;
private boolean detailsVisible = true, video;
private VideoPlayerViewHelper videoPlayerViewHelper; private VideoPlayerViewHelper videoPlayerViewHelper;
private SliderItemsAdapter sliderItemsAdapter; private SliderItemsAdapter sliderItemsAdapter;
private boolean wasControlsVisible; private boolean wasControlsVisible;
@ -762,8 +762,10 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
} }
private void setupTitles() { 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.title.setOnClickListener(v -> navigateToProfile("@" + feedModel.getProfileModel().getUsername()));
binding.righttitle.setOnClickListener(v -> navigateToProfile("@" + feedModel.getProfileModel().getUsername()));
final String locationName = feedModel.getLocationName(); final String locationName = feedModel.getLocationName();
if (!TextUtils.isEmpty(locationName)) { if (!TextUtils.isEmpty(locationName)) {
binding.subtitle.setText(locationName); binding.subtitle.setText(locationName);
@ -1079,6 +1081,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
} }
private void enablePlayerControls(final boolean enable) { private void enablePlayerControls(final boolean enable) {
video = enable;
if (enable) { if (enable) {
binding.playerControlsToggle.setVisibility(View.VISIBLE); binding.playerControlsToggle.setVisibility(View.VISIBLE);
binding.playerControlsToggle.setOnClickListener(v -> { binding.playerControlsToggle.setOnClickListener(v -> {
@ -1165,6 +1168,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
binding.bottomBg.setVisibility(View.GONE); binding.bottomBg.setVisibility(View.GONE);
binding.likesCount.setVisibility(View.GONE); binding.likesCount.setVisibility(View.GONE);
binding.commentsCount.setVisibility(View.GONE); binding.commentsCount.setVisibility(View.GONE);
binding.comment.setVisibility(View.GONE);
binding.captionToggle.setVisibility(View.GONE); binding.captionToggle.setVisibility(View.GONE);
binding.playerControlsToggle.setVisibility(View.GONE); binding.playerControlsToggle.setVisibility(View.GONE);
binding.like.setVisibility(View.GONE); binding.like.setVisibility(View.GONE);
@ -1188,7 +1192,10 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
binding.likesCount.setVisibility(View.VISIBLE); binding.likesCount.setVisibility(View.VISIBLE);
binding.commentsCount.setVisibility(View.VISIBLE); binding.commentsCount.setVisibility(View.VISIBLE);
binding.captionToggle.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.download.setVisibility(View.VISIBLE);
binding.like.setVisibility(View.VISIBLE); binding.like.setVisibility(View.VISIBLE);
binding.save.setVisibility(View.VISIBLE); binding.save.setVisibility(View.VISIBLE);

12
app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageThreadFragment.java

@ -234,16 +234,9 @@ public class DirectMessageThreadFragment extends Fragment {
switch (itemType) { switch (itemType) {
case MEDIA_SHARE: case MEDIA_SHARE:
case CLIP: case CLIP:
case FELIX_SHARE:
final long postId = directItemModel.getMediaModel().getPk(); 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; break;
case LINK: case LINK:
Intent linkIntent = new Intent(Intent.ACTION_VIEW); Intent linkIntent = new Intent(Intent.ACTION_VIEW);
@ -322,6 +315,7 @@ public class DirectMessageThreadFragment extends Fragment {
switch (itemType) { switch (itemType) {
case MEDIA_SHARE: case MEDIA_SHARE:
case CLIP: case CLIP:
case FELIX_SHARE:
firstOption = R.string.view_post; firstOption = R.string.view_post;
break; break;
case LINK: case LINK:

4
app/src/main/java/awais/instagrabber/fragments/settings/AboutFragment.java

@ -55,7 +55,7 @@ public class AboutFragment extends BasePreferencesFragment {
preference.setIconSpaceReserved(false); preference.setIconSpaceReserved(false);
preference.setOnPreferenceClickListener(p -> { preference.setOnPreferenceClickListener(p -> {
final Intent intent = new Intent(Intent.ACTION_VIEW); 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); startActivity(intent);
return true; return true;
}); });
@ -71,7 +71,7 @@ public class AboutFragment extends BasePreferencesFragment {
preference.setIconSpaceReserved(false); preference.setIconSpaceReserved(false);
preference.setOnPreferenceClickListener(p -> { preference.setOnPreferenceClickListener(p -> {
final Intent intent = new Intent(Intent.ACTION_VIEW); 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); startActivity(intent);
return true; return true;
}); });

3
app/src/main/java/awais/instagrabber/models/enums/DirectItemType.java

@ -19,7 +19,8 @@ public enum DirectItemType implements Serializable {
ACTION_LOG(12), ACTION_LOG(12),
PLACEHOLDER(13), PLACEHOLDER(13),
STORY_SHARE(14), 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 final int id;
private static Map<Integer, DirectItemType> map = new HashMap<>(); private static Map<Integer, DirectItemType> map = new HashMap<>();

6
app/src/main/java/awais/instagrabber/utils/Constants.java

@ -58,10 +58,10 @@ public final class Constants {
// spoof // spoof
public static final String USER_AGENT = "Mozilla/5.0 (Linux; Android 8.1.0; motorola one Build/OPKS28.63-18-3; wv) " + 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 " + "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 = 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 // 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\":" + 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," + " \"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," +

5
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 ("voice_media".equals(itemType)) return DirectItemType.VOICE_MEDIA;
if ("story_share".equals(itemType)) return DirectItemType.STORY_SHARE; if ("story_share".equals(itemType)) return DirectItemType.STORY_SHARE;
if ("clip".equals(itemType)) return DirectItemType.CLIP; if ("clip".equals(itemType)) return DirectItemType.CLIP;
if ("felix_share".equals(itemType)) return DirectItemType.FELIX_SHARE;
return DirectItemType.TEXT; return DirectItemType.TEXT;
} }
@ -501,6 +502,10 @@ public final class ResponseBodyUtils {
directMedia = getDirectMediaModel(itemObject.getJSONObject("clip").getJSONObject("clip")); directMedia = getDirectMediaModel(itemObject.getJSONObject("clip").getJSONObject("clip"));
break; break;
case FELIX_SHARE:
directMedia = getDirectMediaModel(itemObject.getJSONObject("felix_share").getJSONObject("video"));
break;
case MEDIA: case MEDIA:
directMedia = getDirectMediaModel(itemObject.optJSONObject("media")); directMedia = getDirectMediaModel(itemObject.optJSONObject("media"));
break; break;

19
app/src/main/res/layout/dialog_post_view.xml

@ -63,7 +63,7 @@
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
android:id="@+id/title" android:id="@+id/title"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ellipsize="marquee" android:ellipsize="marquee"
android:singleLine="true" android:singleLine="true"
@ -71,9 +71,24 @@
android:textColor="@color/white" android:textColor="@color/white"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@id/subtitle" app:layout_constraintBottom_toTopOf="@id/subtitle"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintEnd_toEndOf="@id/righttitle"
app:layout_constraintStart_toEndOf="@id/profile_pic" app:layout_constraintStart_toEndOf="@id/profile_pic"
app:layout_constraintTop_toTopOf="@id/profile_pic" app:layout_constraintTop_toTopOf="@id/profile_pic"
tools:text="Username Username Username" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/righttitle"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:ellipsize="marquee"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.MaterialComponents.Subtitle1"
android:textColor="@color/grey_600"
app:layout_constraintBottom_toBottomOf="@id/title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/title"
app:layout_constraintTop_toTopOf="@id/title"
tools:text="Full name Full name Full name Full name Full name Full name Full name " /> tools:text="Full name Full name Full name Full name Full name Full name Full name " />
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView

3
app/src/main/res/layout/fragment_profile.xml

@ -27,7 +27,8 @@
android:id="@+id/mainProfileImage" android:id="@+id/mainProfileImage"
android:layout_width="@dimen/profile_picture_size" android:layout_width="@dimen/profile_picture_size"
android:layout_height="@dimen/profile_picture_size" android:layout_height="@dimen/profile_picture_size"
android:padding="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:transitionName="profile_pic" android:transitionName="profile_pic"
app:actualImageScaleType="centerCrop" app:actualImageScaleType="centerCrop"
app:layout_constraintEnd_toStartOf="@id/mainPostCount" app:layout_constraintEnd_toStartOf="@id/mainPostCount"

Loading…
Cancel
Save