当前位置: 首页>>代码示例>>Java>>正文


Java ShareActionProvider.setOnShareTargetSelectedListener方法代码示例

本文整理汇总了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;
}
 
开发者ID:asm-products,项目名称:nexus-gallery,代码行数:24,代码来源:ActionModeHandler.java

示例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;
}
 
开发者ID:asm-products,项目名称:nexus-gallery,代码行数:18,代码来源:FilterShowActivity.java

示例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;
		}
	});
}
 
开发者ID:videgro,项目名称:Ships,代码行数:16,代码来源:ShowMapFragment.java

示例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;
}
 
开发者ID:sunnygoyal,项目名称:PowerToggles,代码行数:12,代码来源:FolderFrag.java

示例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;
		}
	});
}
 
开发者ID:lookwhatlook,项目名称:WeiboWeiBaTong,代码行数:36,代码来源:CommentSingleChoiceModeListener.java

示例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;

}
 
开发者ID:lookwhatlook,项目名称:WeiboWeiBaTong,代码行数:39,代码来源:StatusSingleChoiceModeListener.java

示例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;
}
 
开发者ID:asm-products,项目名称:nexus-gallery,代码行数:13,代码来源:MultiChoiceManager.java

示例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;
        }
    });
}
 
开发者ID:dingyu,项目名称:Dingyu,代码行数:36,代码来源:CommentSingleChoiceModeListener.java

示例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;


    }
 
开发者ID:dingyu,项目名称:Dingyu,代码行数:39,代码来源:StatusSingleChoiceModeListener.java

示例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;
                }
            });
}
 
开发者ID:shawnlinboy,项目名称:siciyuan,代码行数:40,代码来源:CommentSingleChoiceModeListener.java

示例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;
    }
 
开发者ID:shawnlinboy,项目名称:siciyuan,代码行数:40,代码来源:StatusSingleChoiceModeListener.java

示例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;


}
 
开发者ID:misty-rain,项目名称:smartedu,代码行数:36,代码来源:StatusSingleChoiceModeListener.java

示例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;
}
 
开发者ID:sheimi,项目名称:SGit,代码行数:29,代码来源:CommitDiffActivity.java

示例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));
}
 
开发者ID:concentricsky,项目名称:android-viewer-for-khan-academy,代码行数:7,代码来源:VideoDetailActivity.java


注:本文中的android.widget.ShareActionProvider.setOnShareTargetSelectedListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。