Skip to content

Commit b33eacd

Browse files
committed
Ignore the result of the on share callback in ShareActionProvider.
1. The reason for having this callback on the ShareActionProvider is to notify the client that a share happened so he can update the UI. Change-Id: I65e8a8db8d4add0cd23d53be0286b14b4b4640b4
1 parent f21bea2 commit b33eacd

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

core/java/android/widget/ShareActionProvider.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,22 @@ public interface OnShareTargetSelectedListener {
8080

8181
/**
8282
* Called when a share target has been selected. The client can
83-
* decide whether to handle the intent or rely on the default
84-
* behavior which is launching it.
83+
* decide whether to perform some action before the sharing is
84+
* actually performed.
8585
* <p>
8686
* <strong>Note:</strong> Modifying the intent is not permitted and
8787
* any changes to the latter will be ignored.
8888
* </p>
89+
* <p>
90+
* <strong>Note:</strong> You should <strong>not</strong> handle the
91+
* intent here. This callback aims to notify the client that a
92+
* sharing is being performed, so the client can update the UI
93+
* if necessary.
94+
* </p>
8995
*
9096
* @param source The source of the notification.
9197
* @param intent The intent for launching the chosen share target.
92-
* @return Whether the client has handled the intent.
98+
* @return The return result is ignored. Always return false for consistency.
9399
*/
94100
public boolean onShareTargetSelected(ShareActionProvider source, Intent intent);
95101
}
@@ -308,7 +314,7 @@ private class ShareAcitivityChooserModelPolicy implements OnChooseActivityListen
308314
@Override
309315
public boolean onChooseActivity(ActivityChooserModel host, Intent intent) {
310316
if (mOnShareTargetSelectedListener != null) {
311-
return mOnShareTargetSelectedListener.onShareTargetSelected(
317+
mOnShareTargetSelectedListener.onShareTargetSelected(
312318
ShareActionProvider.this, intent);
313319
}
314320
return false;

0 commit comments

Comments
 (0)