I'm trying to add Android shortcuts into the application, including dynamic shortcuts and icons for them will be created from bitmaps. Right now it looks like this:
As you can see, the dynamic shortcut icons have a square image in center, but I need it to take all space of an icon, so there would be no white background. The code:
Bitmap interlocutorAvatar = BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_conference);
ShortcutInfo shortcutInfo = new ShortcutInfo.Builder(context, peer.getId())
.setLongLabel("Dynamic shortcut")
.setShortLabel("Dynamic")
.setIcon(Icon.createWithBitmap(interlocutorAvatar))
.setIntent(new Intent(Intent.ACTION_VIEW).setClass(context, VCEngine.appInfo().getActivity(ActivitySwitcher.ActivityType.CHAT))
.putExtra(CustomIntent.EXTRA_PEER_ID, peer.getId())
.putExtra(CustomIntent.EXTRA_CHAT_ID, peer.getId()))
.build();
I think I've found one possible solution, and that is to use adaptive icons. It looks a little bit weird to me, but hey as long as it works. I've used AdaptiveIconDrawable and here is how to do it:
The code to convert bitmap to Adaptive Bitmap:
Then you could set the Icon of your shortcut like this :