mirror of
https://github.com/TeamNewPipe/NewPipe/
synced 2024-12-11 17:15:47 +01:00
Don't show any channel notification thumbnail if it could not be loaded
This commit is contained in:
parent
e68d49e7df
commit
fcd2d63df4
@ -84,8 +84,8 @@ class NotificationHelper(val context: Context) {
|
||||
)
|
||||
)
|
||||
|
||||
PicassoHelper.loadNotificationIcon(data.avatarUrl, context) { bitmap ->
|
||||
builder.setLargeIcon(bitmap)
|
||||
PicassoHelper.loadNotificationIcon(data.avatarUrl) { bitmap ->
|
||||
bitmap?.let { builder.setLargeIcon(it) } // set only if != null
|
||||
manager.notify(data.pseudoId, builder.build())
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import static org.schabi.newpipe.extractor.utils.Utils.isBlank;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
import com.squareup.picasso.Cache;
|
||||
@ -165,7 +164,6 @@ public final class PicassoHelper {
|
||||
|
||||
|
||||
public static void loadNotificationIcon(final String url,
|
||||
final Context context,
|
||||
final Consumer<Bitmap> bitmapConsumer) {
|
||||
loadImageDefault(url, R.drawable.ic_newpipe_triangle_white)
|
||||
.into(new Target() {
|
||||
@ -176,8 +174,7 @@ public final class PicassoHelper {
|
||||
|
||||
@Override
|
||||
public void onBitmapFailed(final Exception e, final Drawable errorDrawable) {
|
||||
bitmapConsumer.accept(BitmapFactory.decodeResource(context.getResources(),
|
||||
R.drawable.ic_newpipe_triangle_white));
|
||||
bitmapConsumer.accept(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user