Skip to content

Commit

Permalink
add extra shortcut icon resource to pick_icon response
Browse files Browse the repository at this point in the history
  • Loading branch information
spocky committed Oct 4, 2024
1 parent 08090bb commit 280b8c3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions library/src/main/java/candybar/lib/helpers/IconsHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ public static void selectIcon(@NonNull Context context, int action, Icon icon) {
public void handleResult(Bitmap resource) {
Intent intent = new Intent();
intent.putExtra("icon", resource);

// Also add the direct icon resource ID to the intent for launchers that support it
Intent.ShortcutIconResource iconRes = Intent.ShortcutIconResource.fromContext(context, icon.getRes());
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconRes);
((AppCompatActivity) context).setResult(resource != null ?
Activity.RESULT_OK : Activity.RESULT_CANCELED, intent);
((AppCompatActivity) context).finish();
Expand Down

0 comments on commit 280b8c3

Please sign in to comment.