Dim scSize As Int, scOutputSize As Int, tImg As Bitmap, tbmp As Bitmap, OutPNG As Bitmap
tbmp = Common.GetAppIcon
scSize = tbmp.Height
Dim dScale As Float
dScale = GetDeviceLayoutValues.Scale
' _m = 72x72; _h = 96x96 ' Adds to the filename depending on what icon size we want (medium or high density icons)
' _m works for most but not all
Select Case dScale
Case 1
scOutputSize = 48
imageFN = imageFN & "_m.png"
Case 1.5
scOutputSize = 72
imageFN = imageFN & "_m.png"
Case Else
scOutputSize = 96
imageFN = imageFN & "_h.png"
End Select
tImg = LoadBitmap(File.DirAssets, imageFN)
tImg = Common.CreateScaledBitmap (tImg, scOutputSize, scOutputSize,True)
OutPNG = tImg
ToastMessageShow ("Device scale is " & dScale & CRLF & "App shortcut icon size is " & tbmp.Height & "h X " & tbmp.Width & "w" & CRLF & "Shortcut icon size assigned was " & tImg.Height & "h X " & tImg.Width & "w", True)
Dim shortcutIntent As Intent
shortcutIntent.Initialize("", "")
shortcutIntent.SetComponent(Common.ShortcutPackage & "/.shortcutexec")
shortcutIntent.PutExtra("from_shortcut", True)
shortcutIntent.PutExtra("sc_type", SCType)
shortcutIntent.PutExtra("sc_value", SCValue)
shortcutIntent.PutExtra("sc_destination", SCDestination)
shortcutIntent.PutExtra("sc_toast", SCToast)
shortcutIntent.PutExtra("sc_notification", SCNotification)
shortcutIntent.PutExtra("sc_extra1", "")
shortcutIntent.PutExtra("sc_extra2", "")
Dim in As Intent
in.Initialize("", "")
in.PutExtra("android.intent.extra.shortcut.INTENT", shortcutIntent)
in.PutExtra("android.intent.extra.shortcut.NAME", txtName.Text)
in.PutExtra("android.intent.extra.shortcut.ICON", OutPNG)
Activity.SetActivityResult(-1, in)
Activity.Finish