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


Java ShareActionProvider类代码示例

本文整理汇总了Java中com.actionbarsherlock.widget.ShareActionProvider的典型用法代码示例。如果您正苦于以下问题:Java ShareActionProvider类的具体用法?Java ShareActionProvider怎么用?Java ShareActionProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ShareActionProvider类属于com.actionbarsherlock.widget包,在下文中一共展示了ShareActionProvider类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreateOptionsMenu

import com.actionbarsherlock.widget.ShareActionProvider; //导入依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
	MenuInflater inflater = getSupportMenuInflater();
	inflater.inflate(R.menu.results, menu);

	MenuItem menuItem = menu.findItem(R.id.menu_share);

	ShareActionProvider mShareActionProvider = (ShareActionProvider) menuItem.getActionProvider();

	Intent shareIntent = new Intent(Intent.ACTION_SEND);
	shareIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
	shareIntent.setType("text/plain");

	shareIntent.putExtra(Intent.EXTRA_TEXT, getString(R.string.share_text, score));
	mShareActionProvider.setShareIntent(shareIntent);
	return true;
}
 
开发者ID:tamzi,项目名称:sophia,代码行数:18,代码来源:ResultsActivity.java

示例2: onCreateOptionsMenu

import com.actionbarsherlock.widget.ShareActionProvider; //导入依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate your menu.
    getSupportMenuInflater().inflate(R.menu.share_action_provider, menu);

    // Set file with share history to the provider and set the share intent.
    MenuItem actionItem = menu.findItem(R.id.menu_item_share_action_provider_action_bar);
    ShareActionProvider actionProvider = (ShareActionProvider) actionItem.getActionProvider();
    actionProvider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME);
    // Note that you can set/change the intent any time,
    // say when the user has selected an image.
    actionProvider.setShareIntent(createShareIntent());

    //XXX: For now, ShareActionProviders must be displayed on the action bar
    // Set file with share history to the provider and set the share intent.
    //MenuItem overflowItem = menu.findItem(R.id.menu_item_share_action_provider_overflow);
    //ShareActionProvider overflowProvider =
    //    (ShareActionProvider) overflowItem.getActionProvider();
    //overflowProvider.setShareHistoryFileName(
    //    ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME);
    // Note that you can set/change the intent any time,
    // say when the user has selected an image.
    //overflowProvider.setShareIntent(createShareIntent());

    return true;
}
 
开发者ID:Mobideck,项目名称:appdeck-android,代码行数:27,代码来源:ShareActionProviders.java

示例3: onCreateOptionsMenu

import com.actionbarsherlock.widget.ShareActionProvider; //导入依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate your menu.
    getSupportMenuInflater().inflate(R.menu.share_action_provider, menu);

    // Set file with share history to the provider and set the share intent.
    MenuItem actionItem = menu.findItem(R.id.menu_item_share_action_provider_action_bar);
    actionProvider = (ShareActionProvider) actionItem.getActionProvider();
    actionProvider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME);
    // Note that you can set/change the intent any time,
    // say when the user has selected an image.
    if (actionProvider != null) {
        actionProvider.setShareIntent(createShareIntent());
    }
    // menu.add(0, MENU_SAVE, 0, "Save").setShowAsAction(
    // MenuItem.SHOW_AS_ACTION_NEVER | MenuItem.SHOW_AS_ACTION_WITH_TEXT);

    menu.add(0, MENU_SET, 0, getString(R.string.menu_setaswallpaper)).setShowAsAction(
            MenuItem.SHOW_AS_ACTION_NEVER | MenuItem.SHOW_AS_ACTION_WITH_TEXT);

    return true;
}
 
开发者ID:snowdream,项目名称:android-wallpaper,代码行数:23,代码来源:ImagePagerActivity.java

示例4: onCreateOptionsMenu

import com.actionbarsherlock.widget.ShareActionProvider; //导入依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {

	getSupportMenuInflater().inflate(R.menu.refresh_share_camera_items, menu);
	//刷新
	menuRefresh = menu.findItem(R.id.menu_refresh);
	menuRefresh.setActionView(R.layout.layout_menu_item_refresh);// 设置为一个ProgressBar
	setRefreshState(false);
	//分享
	mShareActionProvider = (ShareActionProvider) menu.findItem(
			R.id.menu_share).getActionProvider();
	mShareActionProvider.setShareHistoryFileName(null);// 最经常被使用到的,会记录在这里,首先将这个设置为null(1)
	mShareActionProvider.setShareIntent(getDefaultShareIntent());
	mShareActionProvider
			.setOnShareTargetSelectedListener(new OnShareTargetSelectedListener() {// 并且需要设置这个监听器,自己去启动Intent,就不会被记录到history了(2)

				@Override
				public boolean onShareTargetSelected(
						ShareActionProvider source, Intent intent) {

					ShareActionBarActivity.this.startActivity(intent);
					return true;
				}
			});
	//TODO 因为没有接口,无法实现,所以隐藏掉
	menu.findItem(R.id.menu_camera).setVisible(false);
	//是否已经参加了这个活动
	SubMenu subMenu = menu.findItem(R.id.menu_camera).getSubMenu();
	subItemCamera = subMenu.findItem(R.id.sub_item_camera);
	subItemCamera.setEnabled(false);
	subItemGallery = subMenu.findItem(R.id.sub_item_photo);
	subItemGallery.setEnabled(false);
	subItemJoin = subMenu.findItem(R.id.sub_item_join);
	subItemJoin.setEnabled(false);
	return super.onCreateOptionsMenu(menu);// 设置为不可点击
}
 
开发者ID:michaelye,项目名称:DoubanOnline,代码行数:37,代码来源:ShareActionBarActivity.java

示例5: onCreateOptionsMenu

import com.actionbarsherlock.widget.ShareActionProvider; //导入依赖的package包/类
@Override
public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater)
{
	inflater.inflate(R.menu.request_coins_fragment_options, menu);

	final MenuItem shareItem = menu.findItem(R.id.request_coins_options_share);
	shareActionProvider = (ShareActionProvider) shareItem.getActionProvider();

	updateShareIntent();

	super.onCreateOptionsMenu(menu, inflater);
}
 
开发者ID:9cat,项目名称:templecoin-android-wallet,代码行数:13,代码来源:RequestCoinsFragment.java

示例6: onCreateOptionsMenu

import com.actionbarsherlock.widget.ShareActionProvider; //导入依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {

	MenuItem item;
	
  
if(edit_mode){
	menu.add(0, 1, 0, getString(R.string.ok)).setIcon(R.drawable.accept)
			.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
}else{
	// Inflate your menu.
	getSupportMenuInflater().inflate(R.menu.share_action_provider, menu);

	// Set file with share history to the provider and set the share intent.
	MenuItem actionItem = menu
			.findItem(R.id.menu_item_share_action_provider_action_bar);
	ShareActionProvider actionProvider = (ShareActionProvider) actionItem
			.getActionProvider();
	actionProvider
			.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME);
	// Note that you can set/change the intent any time,
	// say when the user has selected an image.
	actionProvider.setShareIntent(createShareIntent());
}

	return true;

}
 
开发者ID:tarksgit,项目名称:Favorite-Android-Client-Example,代码行数:29,代码来源:GalleryView.java

示例7: shareText

import com.actionbarsherlock.widget.ShareActionProvider; //导入依赖的package包/类
public static void shareText(ShareActionProvider s, String text,String subject) {
	Intent shareIntent = new Intent(Intent.ACTION_SEND);
    shareIntent.setType("text/plain");
    shareIntent.putExtra(Intent.EXTRA_TEXT, text);
    shareIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
    s.setShareIntent(shareIntent);
}
 
开发者ID:Asdamp,项目名称:AsdampUtility,代码行数:8,代码来源:ShareUtility.java

示例8: onPrepareOptionsMenu

import com.actionbarsherlock.widget.ShareActionProvider; //导入依赖的package包/类
@Override
    public void onPrepareOptionsMenu(Menu menu) {
        mOptionsMenuOptions = isContactOptionsChangeEnabled();
        mOptionsMenuEditable = isContactEditable();
        mOptionsMenuShareable = isContactShareable();
        mOptionsMenuCanCreateShortcut = isContactCanCreateShortcut();
        if (mContactData != null) {
            mCustomRingtone = mContactData.getCustomRingtone();
        }

        final MenuItem optionsRingtone = menu.findItem(R.id.menu_set_ringtone);
        if (optionsRingtone != null) {
            optionsRingtone.setVisible(mOptionsMenuOptions);
        }
        
        final MenuItem editMenu = menu.findItem(R.id.menu_edit);
        editMenu.setVisible(mOptionsMenuEditable);

        final MenuItem deleteMenu = menu.findItem(R.id.menu_delete);
        deleteMenu.setVisible(mOptionsMenuEditable);

        final MenuItem shareMenu = menu.findItem(R.id.menu_share);
        shareMenu.setVisible(mOptionsMenuShareable);
        mShareActionProvider = (ShareActionProvider)shareMenu.getActionProvider();

//        final MenuItem createContactShortcutMenu = menu.findItem(R.id.menu_create_contact_shortcut);
//        createContactShortcutMenu.setVisible(mOptionsMenuCanCreateShortcut);
    }
 
开发者ID:SilentCircle,项目名称:silent-contacts-android,代码行数:29,代码来源:ContactLoaderFragment.java

示例9: onCreateOptionsMenu

import com.actionbarsherlock.widget.ShareActionProvider; //导入依赖的package包/类
@Override
public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) {
    inflater.inflate(R.menu.result_menu, menu);
    super.onCreateOptionsMenu(menu, inflater);

    if (updateShareIntent()) {
        ShareActionProvider shareActionProvider = (ShareActionProvider) menu.findItem(R.id.menu_share).getActionProvider();
        shareActionProvider.setShareIntent(shareIntent);
    } else {
        menu.removeItem(R.id.menu_share);
    }
}
 
开发者ID:tschut,项目名称:matchmylife,代码行数:13,代码来源:BioMatchResultFragment.java

示例10: updateMenu

import com.actionbarsherlock.widget.ShareActionProvider; //导入依赖的package包/类
@UiThread
protected void updateMenu(Menu menu, boolean addShareIntent) {
    if (addShareIntent) {
        ShareActionProvider shareActionProvider = (ShareActionProvider) menu.findItem(R.id.menu_share).getActionProvider();
        shareActionProvider.setShareIntent(shareIntent);
    } else {
        menu.removeItem(R.id.menu_share);
    }
}
 
开发者ID:tschut,项目名称:matchmylife,代码行数:10,代码来源:BioMatchResultCombinedFragment.java

示例11: shareDefaultIntent

import com.actionbarsherlock.widget.ShareActionProvider; //导入依赖的package包/类
public static void shareDefaultIntent(ShareActionProvider s) {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("text/plain");
    s.setShareIntent(intent);
}
 
开发者ID:Asdamp,项目名称:AsdampUtility,代码行数:6,代码来源:ShareUtility.java

示例12: onCreateOptionsMenu

import com.actionbarsherlock.widget.ShareActionProvider; //导入依赖的package包/类
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);

    if (mPost != null) {

        inflater.inflate(R.menu.post_detail, menu);

        menu.findItem(R.id.menu_make_comment).setVisible(mPost.getComment_status().equals("open"));

        menu.findItem(R.id.menu_view_comments).setVisible((mPost.getComment_count() > 0));

        MenuItem actionItem = menu.findItem(R.id.menu_item_share_action_provider_action_bar);

        mActionProvider = (ShareActionProvider) actionItem.getActionProvider();
        mActionProvider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME);

        mActionProvider.setShareIntent(createShareIntent());
    }
}
 
开发者ID:kmonaghan,项目名称:Broadsheet.ie-Android,代码行数:21,代码来源:PostDetailFragment.java


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