diff --git a/app/src/main/java/awais/instagrabber/utils/ResponseBodyUtils.java b/app/src/main/java/awais/instagrabber/utils/ResponseBodyUtils.java index aefc94f3..b3968fdd 100644 --- a/app/src/main/java/awais/instagrabber/utils/ResponseBodyUtils.java +++ b/app/src/main/java/awais/instagrabber/utils/ResponseBodyUtils.java @@ -2,7 +2,6 @@ package awais.instagrabber.utils; import android.net.Uri; import android.util.Log; -import android.util.Pair; import androidx.annotation.Nullable; @@ -1042,7 +1041,7 @@ public final class ResponseBodyUtils { tappableObject.getString("question"), tappableObject.getString("emoji"), tappableObject.getBoolean("viewer_can_vote"), - tappableObject.getDouble("slider_vote_average"), + tappableObject.optDouble("slider_vote_average"), tappableObject.getInt("slider_vote_count"), tappableObject.optDouble("viewer_vote") )); diff --git a/app/src/main/java/awais/instagrabber/webservices/StoriesService.java b/app/src/main/java/awais/instagrabber/webservices/StoriesService.java index 09a3a6b7..169f630a 100644 --- a/app/src/main/java/awais/instagrabber/webservices/StoriesService.java +++ b/app/src/main/java/awais/instagrabber/webservices/StoriesService.java @@ -193,8 +193,7 @@ public class StoriesService extends BaseService { node.getInt("media_count"), false, node.optBoolean("has_besties_media"))); - } - catch (Exception e) {} // to cover promotional reels with non-long user pk's + } catch (Exception e) {} // to cover promotional reels with non-long user pk's } final JSONArray broadcasts = new JSONObject(body).getJSONArray("broadcasts"); for (int i = 0; i < broadcasts.length(); ++i) { @@ -371,7 +370,8 @@ public class StoriesService extends BaseService { final String url = buildUrl(options); final Call userStoryCall = repository.getUserStory(url); final boolean isLocOrHashtag = options.getType() == StoryViewerOptions.Type.LOCATION || options.getType() == StoryViewerOptions.Type.HASHTAG; - final boolean isHighlight = options.getType() == StoryViewerOptions.Type.HIGHLIGHT || options.getType() == StoryViewerOptions.Type.STORY_ARCHIVE; + final boolean isHighlight = options.getType() == StoryViewerOptions.Type.HIGHLIGHT || options + .getType() == StoryViewerOptions.Type.STORY_ARCHIVE; userStoryCall.enqueue(new Callback() { @Override public void onResponse(@NonNull final Call call, @NonNull final Response response) { @@ -412,7 +412,7 @@ public class StoriesService extends BaseService { callback.onSuccess(null); } } catch (JSONException e) { - Log.e(TAG, "Error parsing string"); + Log.e(TAG, "Error parsing string", e); } } diff --git a/app/src/main/java/awais/instagrabber/workers/DownloadWorker.java b/app/src/main/java/awais/instagrabber/workers/DownloadWorker.java index 1648a4ad..09d61c25 100644 --- a/app/src/main/java/awais/instagrabber/workers/DownloadWorker.java +++ b/app/src/main/java/awais/instagrabber/workers/DownloadWorker.java @@ -57,9 +57,6 @@ import static awais.instagrabber.utils.BitmapUtils.THUMBNAIL_SIZE; import static awais.instagrabber.utils.Constants.DOWNLOAD_CHANNEL_ID; import static awais.instagrabber.utils.Constants.NOTIF_GROUP_NAME; -//import awaisomereport.LogCollector; -//import static awais.instagrabber.utils.Utils.logCollector; - public class DownloadWorker extends Worker { private static final String TAG = "DownloadWorker"; private static final String DOWNLOAD_GROUP = "DOWNLOAD_GROUP"; @@ -340,13 +337,22 @@ public class DownloadWorker extends Worker { return bitmap; } if (mimeType.startsWith("video")) { - try (MediaMetadataRetriever retriever = new MediaMetadataRetriever()) { + try { + MediaMetadataRetriever retriever = new MediaMetadataRetriever(); try { - retriever.setDataSource(context, uri); - } catch (final Exception e) { - retriever.setDataSource(file.getAbsolutePath()); + try { + retriever.setDataSource(context, uri); + } catch (final Exception e) { + retriever.setDataSource(file.getAbsolutePath()); + } + bitmap = retriever.getFrameAtTime(); + } finally { + try { + retriever.release(); + } catch (Exception e) { + Log.e(TAG, "getThumbnail: ", e); + } } - bitmap = retriever.getFrameAtTime(); } catch (final Exception e) { Log.e(TAG, "", e); }