本文整理匯總了Java中android.widget.ShareActionProvider.setOnShareTargetSelectedListener方法的典型用法代碼示例。如果您正苦於以下問題:Java ShareActionProvider.setOnShareTargetSelectedListener方法的具體用法?Java ShareActionProvider.setOnShareTargetSelectedListener怎麽用?Java ShareActionProvider.setOnShareTargetSelectedListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.ShareActionProvider
的用法示例。
在下文中一共展示了ShareActionProvider.setOnShareTargetSelectedListener方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreateActionMode
import android.widget.ShareActionProvider; //導入方法依賴的package包/類
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
mode.getMenuInflater().inflate(R.menu.operation, menu);
mMenu = menu;
mSharePanoramaMenuItem = menu.findItem(R.id.action_share_panorama);
if (mSharePanoramaMenuItem != null) {
mSharePanoramaActionProvider = (ShareActionProvider) mSharePanoramaMenuItem
.getActionProvider();
mSharePanoramaActionProvider.setOnShareTargetSelectedListener(
mShareTargetSelectedListener);
mSharePanoramaActionProvider.setShareHistoryFileName("panorama_share_history.xml");
}
mShareMenuItem = menu.findItem(R.id.action_share);
if (mShareMenuItem != null) {
mShareActionProvider = (ShareActionProvider) mShareMenuItem
.getActionProvider();
mShareActionProvider.setOnShareTargetSelectedListener(
mShareTargetSelectedListener);
mShareActionProvider.setShareHistoryFileName("share_history.xml");
}
return true;
}
示例2: onCreateOptionsMenu
import android.widget.ShareActionProvider; //導入方法依賴的package包/類
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.filtershow_activity_menu, menu);
MenuItem showState = menu.findItem(R.id.showImageStateButton);
if (mShowingImageStatePanel) {
showState.setTitle(R.string.hide_imagestate_panel);
} else {
showState.setTitle(R.string.show_imagestate_panel);
}
mShareActionProvider = (ShareActionProvider) menu.findItem(R.id.menu_share)
.getActionProvider();
mShareActionProvider.setShareIntent(getDefaultShareIntent());
mShareActionProvider.setOnShareTargetSelectedListener(this);
mMenu = menu;
setupMenu();
return true;
}
示例3: onCreateOptionsMenu
import android.widget.ShareActionProvider; //導入方法依賴的package包/類
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
menu.setGroupVisible(R.id.main_menu_group_share, true);
final ShareActionProvider shareActionProvider = (ShareActionProvider) menu.findItem(R.id.menu_share).getActionProvider();
shareActionProvider.setShareIntent(getShareIntent());
shareActionProvider.setOnShareTargetSelectedListener(new OnShareTargetSelectedListener() {
@Override
public boolean onShareTargetSelected(ShareActionProvider actionProvider, Intent intent) {
Analytics.getInstance().logEvent(TAG, "share","");
takeScreenShotWithCheck();
return false;
}
});
}
示例4: onCreateActionMode
import android.widget.ShareActionProvider; //導入方法依賴的package包/類
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
mode.getMenuInflater().inflate(R.menu.folder_menu, menu);
ShareActionProvider shareAction = (ShareActionProvider) menu.findItem(R.id.mnu_share).getActionProvider();
shareAction.setOnShareTargetSelectedListener(this);
shareAction.setShareIntent(new Intent(Intent.ACTION_SEND)
.setType("application/zip")
.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(mContext.getFileStreamPath(SHARE_FILE_NAME))));
mMode = mode;
return true;
}
示例5: buildMenu
import android.widget.ShareActionProvider; //導入方法依賴的package包/類
protected void buildMenu(ActionMode mode, Menu menu) {
MenuInflater inflater = mode.getMenuInflater();
menu.clear();
boolean isMyComment = bean.getUser().getId().equals(GlobalContext.getInstance().getCurrentAccountId());
boolean isCommentUnderMyStatus = bean.getStatus().getUser().getId().equals(GlobalContext.getInstance().getCurrentAccountId());
if (isMyComment || isCommentUnderMyStatus) {
inflater.inflate(R.menu.contextual_menu_fragment_comment_listview_myself, menu);
} else {
inflater.inflate(R.menu.contextual_menu_fragment_comment_listview, menu);
}
mode.setTitle(bean.getUser().getScreen_name());
MenuItem item = menu.findItem(R.id.menu_share);
mShareActionProvider = (ShareActionProvider) item.getActionProvider();
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
sharingIntent.putExtra(Intent.EXTRA_TEXT, bean.getText());
PackageManager packageManager = getActivity().getPackageManager();
List<ResolveInfo> activities = packageManager.queryIntentActivities(sharingIntent, 0);
boolean isIntentSafe = activities.size() > 0;
if (isIntentSafe && mShareActionProvider != null) {
mShareActionProvider.setShareIntent(sharingIntent);
}
mShareActionProvider.setOnShareTargetSelectedListener(new ShareActionProvider.OnShareTargetSelectedListener() {
@Override
public boolean onShareTargetSelected(ShareActionProvider source, Intent intent) {
finish();
return false;
}
});
}
示例6: onPrepareActionMode
import android.widget.ShareActionProvider; //導入方法依賴的package包/類
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
MenuInflater inflater = mode.getMenuInflater();
menu.clear();
if (bean.getUser().getId().equals(GlobalContext.getInstance().getCurrentAccountId())) {
inflater.inflate(R.menu.contextual_menu_fragment_status_listview_myself, menu);
} else {
inflater.inflate(R.menu.contextual_menu_fragment_status_listview, menu);
}
mode.setTitle(bean.getUser().getScreen_name());
// fuck sina weibo
// MenuItem favItem = menu.findItem(R.id.menu_fav);
// MenuItem unFavItem = menu.findItem(R.id.menu_unfav);
// if (bean.isFavorited()) {
// favItem.setVisible(false);
// unFavItem.setVisible(true);
// } else {
// favItem.setVisible(true);
// unFavItem.setVisible(false);
// }
MenuItem item = menu.findItem(R.id.menu_share);
mShareActionProvider = (ShareActionProvider) item.getActionProvider();
if (fragment.getActivity() != null) {
Utility.setShareIntent(fragment.getActivity(), mShareActionProvider, bean);
}
mShareActionProvider.setOnShareTargetSelectedListener(new ShareActionProvider.OnShareTargetSelectedListener() {
@Override
public boolean onShareTargetSelected(ShareActionProvider source, Intent intent) {
finish();
return false;
}
});
return true;
}
示例7: onCreateActionMode
import android.widget.ShareActionProvider; //導入方法依賴的package包/類
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
mSelectionManager.setSelectedUriSource(this);
mActionMode = mode;
MenuInflater inflater = mode.getMenuInflater();
inflater.inflate(R.menu.gallery_multiselect, menu);
MenuItem menuItem = menu.findItem(R.id.menu_share);
mShareActionProvider = (ShareActionProvider) menuItem.getActionProvider();
mShareActionProvider.setOnShareTargetSelectedListener(this);
updateSelectedTitle(mode);
return true;
}
示例8: buildMenu
import android.widget.ShareActionProvider; //導入方法依賴的package包/類
protected void buildMenu(ActionMode mode, Menu menu) {
MenuInflater inflater = mode.getMenuInflater();
menu.clear();
boolean isMyComment = bean.getUser().getId().equals(GlobalContext.getInstance().getCurrentAccountId());
boolean isCommentUnderMyStatus = bean.getStatus().getUser().getId().equals(GlobalContext.getInstance().getCurrentAccountId());
if (isMyComment || isCommentUnderMyStatus) {
inflater.inflate(R.menu.contextual_menu_fragment_comment_listview_myself, menu);
} else {
inflater.inflate(R.menu.contextual_menu_fragment_comment_listview, menu);
}
mode.setTitle(bean.getUser().getScreen_name());
MenuItem item = menu.findItem(R.id.menu_share);
mShareActionProvider = (ShareActionProvider) item.getActionProvider();
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
sharingIntent.putExtra(Intent.EXTRA_TEXT, bean.getText());
PackageManager packageManager = getActivity().getPackageManager();
List<ResolveInfo> activities = packageManager.queryIntentActivities(sharingIntent, 0);
boolean isIntentSafe = activities.size() > 0;
if (isIntentSafe && mShareActionProvider != null) {
mShareActionProvider.setShareIntent(sharingIntent);
}
mShareActionProvider.setOnShareTargetSelectedListener(new ShareActionProvider.OnShareTargetSelectedListener() {
@Override
public boolean onShareTargetSelected(ShareActionProvider source, Intent intent) {
finish();
return false;
}
});
}
示例9: onPrepareActionMode
import android.widget.ShareActionProvider; //導入方法依賴的package包/類
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
MenuInflater inflater = mode.getMenuInflater();
menu.clear();
if (bean.getUser().getId().equals(GlobalContext.getInstance().getCurrentAccountId())) {
inflater.inflate(R.menu.contextual_menu_fragment_status_listview_myself, menu);
} else {
inflater.inflate(R.menu.contextual_menu_fragment_status_listview, menu);
}
mode.setTitle(bean.getUser().getScreen_name());
//fuck sina weibo
// MenuItem favItem = menu.findItem(R.id.menu_fav);
// MenuItem unFavItem = menu.findItem(R.id.menu_unfav);
// if (bean.isFavorited()) {
// favItem.setVisible(false);
// unFavItem.setVisible(true);
// } else {
// favItem.setVisible(true);
// unFavItem.setVisible(false);
// }
MenuItem item = menu.findItem(R.id.menu_share);
mShareActionProvider = (ShareActionProvider) item.getActionProvider();
if (fragment.getActivity() != null)
Utility.setShareIntent(fragment.getActivity(), mShareActionProvider, bean);
mShareActionProvider.setOnShareTargetSelectedListener(new ShareActionProvider.OnShareTargetSelectedListener() {
@Override
public boolean onShareTargetSelected(ShareActionProvider source, Intent intent) {
finish();
return false;
}
});
return true;
}
示例10: buildMenu
import android.widget.ShareActionProvider; //導入方法依賴的package包/類
protected void buildMenu(ActionMode mode, Menu menu) {
MenuInflater inflater = mode.getMenuInflater();
menu.clear();
boolean isMyComment = bean.getUser().getId()
.equals(GlobalContext.getInstance().getCurrentAccountId());
boolean isCommentUnderMyStatus = bean.getStatus().getUser().getId()
.equals(GlobalContext.getInstance().getCurrentAccountId());
if (isMyComment || isCommentUnderMyStatus) {
inflater.inflate(R.menu.contextual_menu_fragment_comment_listview_myself, menu);
} else {
inflater.inflate(R.menu.contextual_menu_fragment_comment_listview, menu);
}
mode.setTitle(bean.getUser().getScreen_name());
MenuItem item = menu.findItem(R.id.menu_share);
mShareActionProvider = (ShareActionProvider) item.getActionProvider();
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
sharingIntent.putExtra(Intent.EXTRA_TEXT, bean.getText());
PackageManager packageManager = getActivity().getPackageManager();
List<ResolveInfo> activities = packageManager.queryIntentActivities(sharingIntent, 0);
boolean isIntentSafe = activities.size() > 0;
if (isIntentSafe && mShareActionProvider != null) {
mShareActionProvider.setShareIntent(sharingIntent);
}
mShareActionProvider.setOnShareTargetSelectedListener(
new ShareActionProvider.OnShareTargetSelectedListener() {
@Override
public boolean onShareTargetSelected(ShareActionProvider source,
Intent intent) {
finish();
return false;
}
});
}
示例11: onPrepareActionMode
import android.widget.ShareActionProvider; //導入方法依賴的package包/類
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
MenuInflater inflater = mode.getMenuInflater();
menu.clear();
if (bean.getUser().getId().equals(GlobalContext.getInstance().getCurrentAccountId())) {
inflater.inflate(R.menu.contextual_menu_fragment_status_listview_myself, menu);
} else {
inflater.inflate(R.menu.contextual_menu_fragment_status_listview, menu);
}
mode.setTitle(bean.getUser().getScreen_name());
//fuck sina weibo
// MenuItem favItem = menu.findItem(R.id.menu_fav);
// MenuItem unFavItem = menu.findItem(R.id.menu_unfav);
// if (bean.isFavorited()) {
// favItem.setVisible(false);
// unFavItem.setVisible(true);
// } else {
// favItem.setVisible(true);
// unFavItem.setVisible(false);
// }
MenuItem item = menu.findItem(R.id.menu_share);
mShareActionProvider = (ShareActionProvider) item.getActionProvider();
if (fragment.getActivity() != null) {
Utility.setShareIntent(fragment.getActivity(), mShareActionProvider, bean);
}
mShareActionProvider.setOnShareTargetSelectedListener(
new ShareActionProvider.OnShareTargetSelectedListener() {
@Override
public boolean onShareTargetSelected(ShareActionProvider source,
Intent intent) {
finish();
return false;
}
});
return true;
}
示例12: onPrepareActionMode
import android.widget.ShareActionProvider; //導入方法依賴的package包/類
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
MenuInflater inflater = mode.getMenuInflater();
menu.clear();
if (bean.getUser().getId().equals(GlobalContext.getInstance().getCurrentAccountId())) {
inflater.inflate(R.menu.contextual_menu_fragment_status_listview_myself, menu);
} else {
inflater.inflate(R.menu.contextual_menu_fragment_status_listview, menu);
}
mode.setTitle(bean.getUser().getScreen_name());
MenuItem item = menu.findItem(R.id.menu_share);
mShareActionProvider = (ShareActionProvider) item.getActionProvider();
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
sharingIntent.putExtra(Intent.EXTRA_TEXT, bean.getText());
PackageManager packageManager = getActivity().getPackageManager();
List<ResolveInfo> activities = packageManager.queryIntentActivities(sharingIntent, 0);
boolean isIntentSafe = activities.size() > 0;
if (isIntentSafe && mShareActionProvider != null) {
mShareActionProvider.setShareIntent(sharingIntent);
}
mShareActionProvider.setOnShareTargetSelectedListener(new ShareActionProvider.OnShareTargetSelectedListener() {
@Override
public boolean onShareTargetSelected(ShareActionProvider source, Intent intent) {
finish();
return false;
}
});
return true;
}
示例13: onCreateOptionsMenu
import android.widget.ShareActionProvider; //導入方法依賴的package包/類
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.diff_commits, menu);
MenuItem item = menu.findItem(R.id.action_share_diff);
ShareActionProvider shareActionProvider = (ShareActionProvider) item.getActionProvider();
final Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Uri futurePathName = Uri.fromFile(sharedDiffPathName());
shareIntent.putExtra(Intent.EXTRA_STREAM, futurePathName);
shareIntent.setData(futurePathName);
shareIntent.setType("text/x-patch");
shareActionProvider.setOnShareTargetSelectedListener(new ShareActionProvider.OnShareTargetSelectedListener () {
public boolean onShareTargetSelected(ShareActionProvider source, Intent intent) {
try {
File diff = sharedDiffPathName();
saveDiff(new FileOutputStream(diff));
} catch (IOException e) {
showToastMessage(R.string.alert_file_creation_failure);
}
return false;
}
});
shareActionProvider.setShareIntent(shareIntent);
return true;
}
示例14: prepareShareActionItem
import android.widget.ShareActionProvider; //導入方法依賴的package包/類
private void prepareShareActionItem(MenuItem shareItem) {
shareActionProvider = (ShareActionProvider) shareItem.getActionProvider();
shareActionProvider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME);
shareActionProvider.setOnShareTargetSelectedListener(shareTargetSelectedListener);
shareActionProvider.setShareIntent(prepareShareIntent(video));
}