From 49e5b0431a0b379a0f4ca86287040713da1c249a Mon Sep 17 00:00:00 2001 From: tom79 Date: Sun, 5 Jan 2020 18:38:12 +0100 Subject: [PATCH] Fix live notifications --- app/build.gradle | 4 ++-- .../fedilab/android/client/Entities/Status.java | 15 +++++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 00fc450b3..5b5cb683b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -138,8 +138,8 @@ dependencies { implementation "ch.acra:acra-notification:$acraVersion" implementation 'com.github.stom79:Android-WYSIWYG-Editor:3.2.1' implementation 'com.github.duanhong169:colorpicker:1.1.6' - implementation 'com.github.penfeizhou.android.animation:apng:1.3.1' - implementation 'com.github.penfeizhou.android.animation:gif:1.3.1' + implementation 'com.github.penfeizhou.android.animation:apng:1.1.0' + implementation 'com.github.penfeizhou.android.animation:gif:1.1.0' implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0' implementation 'com.github.smarteist:autoimageslider:1.3.2' //debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0' diff --git a/app/src/main/java/app/fedilab/android/client/Entities/Status.java b/app/src/main/java/app/fedilab/android/client/Entities/Status.java index b8ef97fc3..350a48397 100644 --- a/app/src/main/java/app/fedilab/android/client/Entities/Status.java +++ b/app/src/main/java/app/fedilab/android/client/Entities/Status.java @@ -1057,9 +1057,16 @@ public class Status implements Parcelable { if (endPosition <= contentSpan.toString().length() && endPosition >= startPosition) { ImageSpan imageSpan; if (!disableAnimatedEmoji) { - resource.setBounds(0, 0, (int) Helper.convertDpToPixel(20, context), (int) Helper.convertDpToPixel(20, context)); - resource.setVisible(true, true); - imageSpan = new ImageSpan(resource); + try { + resource.setBounds(0, 0, (int) Helper.convertDpToPixel(20, context), (int) Helper.convertDpToPixel(20, context)); + resource.setVisible(true, true); + imageSpan = new ImageSpan(resource); + }catch (Exception e) { + Bitmap bitmap = drawableToBitmap(resource.getCurrent()); + imageSpan = new ImageSpan(context, + Bitmap.createScaledBitmap(bitmap, (int) Helper.convertDpToPixel(20, context), + (int) Helper.convertDpToPixel(20, context), false)); + } } else { Bitmap bitmap = drawableToBitmap(resource.getCurrent()); @@ -1126,7 +1133,7 @@ public class Status implements Parcelable { SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); boolean disableAnimatedEmoji = sharedpreferences.getBoolean(Helper.SET_DISABLE_ANIMATED_EMOJI, false); Poll poll = status.getReblog() == null ? status.getPoll() : status.getReblog().getPoll(); - if (poll == null) { + if (poll == null || poll.getOptionsList() == null) { status.setPollEmojiFound(true); return; }