Draw favicons on white background

pull/184/head
M66B 4 years ago
parent d26d9b3cac
commit 9de9aae364

@ -27,6 +27,8 @@ import android.database.ContentObserver;
import android.database.Cursor; import android.database.Cursor;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.net.ConnectivityManager; import android.net.ConnectivityManager;
import android.net.NetworkInfo; import android.net.NetworkInfo;
import android.net.Uri; import android.net.Uri;
@ -474,8 +476,14 @@ public class ContactInfo {
Bitmap bitmap = BitmapFactory.decodeStream(connection.getInputStream()); Bitmap bitmap = BitmapFactory.decodeStream(connection.getInputStream());
if (bitmap == null) if (bitmap == null)
throw new FileNotFoundException("decodeStream"); throw new FileNotFoundException("decodeStream");
else else {
return bitmap; Bitmap favicon = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), bitmap.getConfig());
favicon.eraseColor(Color.WHITE);
Canvas canvas = new Canvas(favicon);
canvas.drawBitmap(bitmap, 0, 0, null);
bitmap.recycle();
return favicon;
}
} finally { } finally {
connection.disconnect(); connection.disconnect();
} }

Loading…
Cancel
Save