Browse Source

fix story linked post, video post, and clicking back button too early on pvv2

renovate/org.robolectric-robolectric-4.x
Austin Huang 4 years ago
parent
commit
7678446ba6
No known key found for this signature in database GPG Key ID: 84C23AA04587A91F
  1. 3
      app/src/main/java/awais/instagrabber/asyncs/PostFetcher.java
  2. 15
      app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java
  3. 2
      app/src/main/java/awais/instagrabber/webservices/StoriesService.java

3
app/src/main/java/awais/instagrabber/asyncs/PostFetcher.java

@ -117,6 +117,9 @@ public final class PostFetcher extends AsyncTask<Void, Void, FeedModel> {
.setPostId(media.getString(Constants.EXTRAS_ID))
.setDisplayUrl(isVideo ? media.getString("video_url")
: ResponseBodyUtils.getHighQualityImage(media))
.setThumbnailUrl(media.getString("display_url"))
.setImageHeight(media.getJSONObject("dimensions").getInt("height"))
.setImageWidth(media.getJSONObject("dimensions").getInt("width"))
.setShortCode(shortCode)
.setPostCaption(TextUtils.isEmpty(postCaption) ? null : postCaption)
.setProfileModel(profileModel)

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

@ -717,12 +717,15 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
}
private void setupCounts() {
final int commentsCount = (int) feedModel.getCommentsCount();
final String commentsString = getResources().getQuantityString(R.plurals.comments_count, commentsCount, commentsCount);
binding.commentsCount.setText(commentsString);
final int likesCount = (int) feedModel.getLikesCount();
final String likesString = getResources().getQuantityString(R.plurals.likes_count, likesCount, likesCount);
binding.likesCount.setText(likesString);
try {
final int commentsCount = (int) feedModel.getCommentsCount();
final String commentsString = getResources().getQuantityString(R.plurals.comments_count, commentsCount, commentsCount);
binding.commentsCount.setText(commentsString);
final int likesCount = (int) feedModel.getLikesCount();
final String likesString = getResources().getQuantityString(R.plurals.likes_count, likesCount, likesCount);
binding.likesCount.setText(likesString);
}
catch (IllegalStateException e) {}
}
private void setupPostTypeLayout() {

2
app/src/main/java/awais/instagrabber/webservices/StoriesService.java

@ -188,7 +188,7 @@ public class StoriesService extends BaseService {
model.setVideoUrl(ResponseBodyUtils.getHighQualityPost(videoResources, true, true, false));
if (data.has("story_feed_media")) {
model.setTappableShortCode(data.getJSONArray("story_feed_media").getJSONObject(0).optString("media_id"));
model.setTappableShortCode(data.getJSONArray("story_feed_media").getJSONObject(0).optString("media_code"));
}
// TODO: this may not be limited to spotify

Loading…
Cancel
Save