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

This commit is contained in:
Austin Huang 2020-11-04 13:46:49 -05:00
parent e32002fac8
commit 7678446ba6
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F
3 changed files with 13 additions and 7 deletions

View File

@ -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)

View File

@ -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() {

View File

@ -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