mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-07 03:07:26 +01:00
Fix parsing Reddit gallery posts error when they contain a gif. Fix progress bar not showing in item_post_detail_gallery.
This commit is contained in:
parent
09efd35b29
commit
39ae0d3aaf
@ -398,7 +398,17 @@ public class ParsePost {
|
||||
String galleryId = galleryIdsArray.getJSONObject(i).getString(JSONUtils.MEDIA_ID_KEY);
|
||||
JSONObject singleGalleryObject = galleryObject.getJSONObject(galleryId);
|
||||
String mimeType = singleGalleryObject.getString(JSONUtils.M_KEY);
|
||||
String galleryItemUrl = singleGalleryObject.getJSONObject(JSONUtils.S_KEY).getString(JSONUtils.U_KEY);
|
||||
String galleryItemUrl;
|
||||
if (mimeType.contains("jpg") || mimeType.contains("png")) {
|
||||
galleryItemUrl = singleGalleryObject.getJSONObject(JSONUtils.S_KEY).getString(JSONUtils.U_KEY);
|
||||
} else {
|
||||
JSONObject sourceObject = singleGalleryObject.getJSONObject(JSONUtils.S_KEY);
|
||||
if (mimeType.contains("gif")) {
|
||||
galleryItemUrl = sourceObject.getString(JSONUtils.GIF_KEY);
|
||||
} else {
|
||||
galleryItemUrl = sourceObject.getString(JSONUtils.MP4_KEY);
|
||||
}
|
||||
}
|
||||
if ((previewUrl.equals("")) && mimeType.contains("jpg") || mimeType.contains("png")) {
|
||||
previewUrl = galleryItemUrl;
|
||||
post.setPreviewUrl(previewUrl);
|
||||
|
@ -122,4 +122,5 @@ public class JSONUtils {
|
||||
public static final String X_KEY = "x";
|
||||
public static final String Y_KEY = "y";
|
||||
public static final String DEST_KEY = "dest";
|
||||
public static final String GIF_KEY = "gif";
|
||||
}
|
||||
|
@ -212,8 +212,7 @@
|
||||
android:id="@+id/load_wrapper_item_post_detail_gallery"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:visibility="gone">
|
||||
android:layout_centerInParent="true">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_bar_item_post_detail_gallery"
|
||||
|
Loading…
Reference in New Issue
Block a user