mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 741435 - Web App shortcuts should use the App Icon 'as is' and not add a background r=wesj a=blocking-fennec
This commit is contained in:
parent
fc6acd9b05
commit
ba79c882dc
@ -107,6 +107,9 @@ public class GeckoAppShell
|
||||
static public final int WPL_STATE_IS_DOCUMENT = 0x00020000;
|
||||
static public final int WPL_STATE_IS_NETWORK = 0x00040000;
|
||||
|
||||
public static final String SHORTCUT_TYPE_WEBAPP = "webapp";
|
||||
public static final String SHORTCUT_TYPE_BOOKMARK = "bookmark";
|
||||
|
||||
static private File sCacheFile = null;
|
||||
static private int sFreeSpace = -1;
|
||||
static File sHomeDir = null;
|
||||
@ -732,7 +735,7 @@ public class GeckoAppShell
|
||||
|
||||
// the intent to be launched by the shortcut
|
||||
Intent shortcutIntent = new Intent();
|
||||
if (aType.equalsIgnoreCase("webapp")) {
|
||||
if (aType.equalsIgnoreCase(SHORTCUT_TYPE_WEBAPP)) {
|
||||
shortcutIntent.setAction(GeckoApp.ACTION_WEBAPP);
|
||||
shortcutIntent.setData(Uri.parse(aURI));
|
||||
} else {
|
||||
@ -748,7 +751,7 @@ public class GeckoAppShell
|
||||
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, aTitle);
|
||||
else
|
||||
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, aURI);
|
||||
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, getLauncherIcon(aIcon));
|
||||
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, getLauncherIcon(aIcon, aType));
|
||||
|
||||
// Do not allow duplicate items
|
||||
intent.putExtra("duplicate", false);
|
||||
@ -759,7 +762,7 @@ public class GeckoAppShell
|
||||
});
|
||||
}
|
||||
|
||||
static private Bitmap getLauncherIcon(Bitmap aSource) {
|
||||
static private Bitmap getLauncherIcon(Bitmap aSource, String aType) {
|
||||
final int kOffset = 6;
|
||||
final int kRadius = 5;
|
||||
int kIconSize;
|
||||
@ -782,9 +785,14 @@ public class GeckoAppShell
|
||||
Bitmap bitmap = Bitmap.createBitmap(kIconSize, kIconSize, Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(bitmap);
|
||||
|
||||
if (aType.equalsIgnoreCase(SHORTCUT_TYPE_WEBAPP)) {
|
||||
Rect iconBounds = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
|
||||
canvas.drawBitmap(aSource, null, iconBounds, null);
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
// draw a base color
|
||||
Paint paint = new Paint();
|
||||
|
||||
if (aSource == null) {
|
||||
float[] hsv = new float[3];
|
||||
hsv[0] = 32.0f;
|
||||
|
@ -123,11 +123,9 @@ function onUninstall(aEvent) {
|
||||
}
|
||||
|
||||
function createShortcut(aTitle, aURL, aIconURL, aType) {
|
||||
// The background images are 72px, but Android will resize as needed.
|
||||
// The images are 64px, but Android will resize as needed.
|
||||
// Bigger is better than too small.
|
||||
const kIconSize = 72;
|
||||
const kOverlaySize = 32;
|
||||
const kOffset = 20;
|
||||
const kIconSize = 64;
|
||||
|
||||
let canvas = document.createElement("canvas");
|
||||
|
||||
@ -147,8 +145,7 @@ function createShortcut(aTitle, aURL, aIconURL, aType) {
|
||||
|
||||
let favicon = new Image();
|
||||
favicon.onload = function() {
|
||||
// Center the favicon and overlay it on the background
|
||||
ctx.drawImage(favicon, kOffset, kOffset, kOverlaySize, kOverlaySize);
|
||||
ctx.drawImage(favicon, 0, 0, kIconSize, kIconSize);
|
||||
_createShortcut();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user