Skip to content

Commit

Permalink
Merge pull request #202 from spocky/add-extra-shortcut-icon-resource
Browse files Browse the repository at this point in the history
Add extra shortcut icon resource to pick_icon response
  • Loading branch information
sarsamurmu authored Oct 6, 2024
2 parents 08090bb + 280b8c3 commit 1177a0f
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 1177a0f

Please sign in to comment.