mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 808029 - Build AllPagesTab's context menu from favicon cache (r=mfinkle)
This commit is contained in:
parent
82d7df8ec6
commit
4cf713a9e1
@ -54,6 +54,7 @@ import android.widget.TabHost.TabContentFactory;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -265,9 +266,20 @@ public class AllPagesTab extends AwesomeBarTab implements GeckoEventListener {
|
||||
if (keywordCol != -1)
|
||||
keyword = mCursor.getString(keywordCol);
|
||||
|
||||
return new ContextMenuSubject(id,
|
||||
mCursor.getString(mCursor.getColumnIndexOrThrow(URLColumns.URL)),
|
||||
mCursor.getBlob(mCursor.getColumnIndexOrThrow(URLColumns.FAVICON)),
|
||||
final String url = mCursor.getString(mCursor.getColumnIndexOrThrow(URLColumns.URL));
|
||||
|
||||
Favicons favicons = GeckoApp.mAppContext.getFavicons();
|
||||
Drawable faviconDrawable = favicons.getFaviconFromMemCache(url);
|
||||
byte[] favicon = null;
|
||||
|
||||
if (faviconDrawable != null) {
|
||||
Bitmap bitmap = ((BitmapDrawable) faviconDrawable).getBitmap();
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
|
||||
favicon = stream.toByteArray();
|
||||
}
|
||||
|
||||
return new ContextMenuSubject(id, url, favicon,
|
||||
mCursor.getString(mCursor.getColumnIndexOrThrow(URLColumns.TITLE)),
|
||||
keyword,
|
||||
mCursor.getInt(mCursor.getColumnIndexOrThrow(Combined.DISPLAY)));
|
||||
|
Loading…
Reference in New Issue
Block a user