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 ->
|
PicassoHelper.loadNotificationIcon(data.avatarUrl) { bitmap ->
|
||||||
builder.setLargeIcon(bitmap)
|
bitmap?.let { builder.setLargeIcon(it) } // set only if != null
|
||||||
manager.notify(data.pseudoId, builder.build())
|
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.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
|
||||||
import com.squareup.picasso.Cache;
|
import com.squareup.picasso.Cache;
|
||||||
@ -165,7 +164,6 @@ public final class PicassoHelper {
|
|||||||
|
|
||||||
|
|
||||||
public static void loadNotificationIcon(final String url,
|
public static void loadNotificationIcon(final String url,
|
||||||
final Context context,
|
|
||||||
final Consumer<Bitmap> bitmapConsumer) {
|
final Consumer<Bitmap> bitmapConsumer) {
|
||||||
loadImageDefault(url, R.drawable.ic_newpipe_triangle_white)
|
loadImageDefault(url, R.drawable.ic_newpipe_triangle_white)
|
||||||
.into(new Target() {
|
.into(new Target() {
|
||||||
@ -176,8 +174,7 @@ public final class PicassoHelper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBitmapFailed(final Exception e, final Drawable errorDrawable) {
|
public void onBitmapFailed(final Exception e, final Drawable errorDrawable) {
|
||||||
bitmapConsumer.accept(BitmapFactory.decodeResource(context.getResources(),
|
bitmapConsumer.accept(null);
|
||||||
R.drawable.ic_newpipe_triangle_white));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user