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


Java ShareActionProvider.setShareIntent方法代码示例

本文整理汇总了Java中android.widget.ShareActionProvider.setShareIntent方法的典型用法代码示例。如果您正苦于以下问题:Java ShareActionProvider.setShareIntent方法的具体用法?Java ShareActionProvider.setShareIntent怎么用?Java ShareActionProvider.setShareIntent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.ShareActionProvider的用法示例。


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

示例1: onCreateOptionsMenu

import android.widget.ShareActionProvider; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.content_actions, menu);
    SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
    searchView.setOnQueryTextListener(this);

    // 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.
    Intent shareIntent = new org.bbs.apklauncher.emb.IntentHelper(Intent.ACTION_SEND);
    shareIntent.setType("image/*");
    Uri uri = Uri.fromFile(getFileStreamPath("shared.png"));
    shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
    actionProvider.setShareIntent(shareIntent);
    return true;
}
 
开发者ID:luoqii,项目名称:ApkLauncher,代码行数:21,代码来源:SystemUIModes.java

示例2: onCreateOptionsMenu

import android.widget.ShareActionProvider; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate your menu.
    getMenuInflater().inflate(R.menu.action_bar_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());

    // 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:luoqii,项目名称:ApkLauncher,代码行数:26,代码来源:ActionBarShareActionProviderActivity.java

示例3: onCreateOptionsMenu

import android.widget.ShareActionProvider; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.content_actions, menu);
    SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
    searchView.setOnQueryTextListener(this);

    // 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.
    Intent shareIntent = new Intent(Intent.ACTION_SEND);
    shareIntent.setType("image/*");
    Uri uri = Uri.fromFile(getFileStreamPath("shared.png"));
    shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
    actionProvider.setShareIntent(shareIntent);
    return true;
}
 
开发者ID:Sherchen,项目名称:ApiDemos,代码行数:21,代码来源:SystemUIModes.java

示例4: 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

示例5: onCreateOptionsMenu

import android.widget.ShareActionProvider; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
	// Inflate the menu; this adds items to the action bar if it is present.
	getMenuInflater().inflate(R.menu.menu_show_location, menu);

	final MenuItem item = menu.findItem(R.id.action_share_location);
	if (item.getActionProvider() != null && loc != null) {
		final ShareActionProvider mShareActionProvider = (ShareActionProvider) item.getActionProvider();
		final Intent shareIntent = new Intent();
		shareIntent.setAction(Intent.ACTION_SEND);
		shareIntent.putExtra(Intent.EXTRA_TEXT, createGeoUri().toString());
		shareIntent.setType("text/plain");
		mShareActionProvider.setShareIntent(shareIntent);
	} else {
		// This isn't really necessary, but while I was testing it was useful. Possibly remove it?
		item.setVisible(false);
	}

	return true;
}
 
开发者ID:kriztan,项目名称:OpenShareLocationPlugin,代码行数:21,代码来源:ShowLocationActivity.java

示例6: onCreateOptionsMenu

import android.widget.ShareActionProvider; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu items for use in the action bar
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.operations, menu);
    mActionBarMenu = menu;

    // Configure the standard share action provider
    MenuItem item = menu.findItem(R.id.action_share);
    mStandardShareActionProvider = (ShareActionProvider) item.getActionProvider();
    mStandardShareActionProvider.setShareHistoryFileName("standard_share_history.xml");
    if (mStandardShareIntent != null) {
        mStandardShareActionProvider.setShareIntent(mStandardShareIntent);
    }

    // Configure the panorama share action provider
    item = menu.findItem(R.id.action_share_panorama);
    mPanoramaShareActionProvider = (ShareActionProvider) item.getActionProvider();
    mPanoramaShareActionProvider.setShareHistoryFileName("panorama_share_history.xml");
    if (mPanoramaShareIntent != null) {
        mPanoramaShareActionProvider.setShareIntent(mPanoramaShareIntent);
    }

    return super.onCreateOptionsMenu(menu);
}
 
开发者ID:asm-products,项目名称:nexus-camera,代码行数:26,代码来源:CameraActivity.java

示例7: onCreateActionMode

import android.widget.ShareActionProvider; //导入方法依赖的package包/类
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
    // Inflate a menu resource providing context menu items
    MenuInflater inflater = mode.getMenuInflater();
    inflater.inflate(R.menu.context_action, menu);
    try {
        /** Getting the actionprovider associated with the menu item whose id is share */
        mShareActionProvider = (ShareActionProvider) menu.findItem(R.id.menu_item_share).getActionProvider();

        /** Setting a share intent */
        mShareActionProvider.setShareIntent(getStringShareIntent(""));
    }
    catch(Exception e){
        e.printStackTrace();
    }

    return true;
}
 
开发者ID:javawolfpack,项目名称:SuggestionApp,代码行数:19,代码来源:MainActivity.java

示例8: 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.main_menu, menu);
	// Locate MenuItem with ShareActionProvider
	MenuItem item = menu.findItem(R.id.action_share);
	// Fetch and store ShareActionProvider
	ShareActionProvider shareActionProvider = (ShareActionProvider) item
			.getActionProvider();

	// set the log content as share content
	Intent shareIntent = new Intent();
	shareIntent.setAction(Intent.ACTION_SEND);
	shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
			getResources().getString(R.string.action_share_subject));
	shareIntent.putExtra(Intent.EXTRA_TEXT, AppController.getInstance()
			.getLog());
	shareIntent.setType("text/plain");
	shareActionProvider.setShareIntent(shareIntent);
	return true;
}
 
开发者ID:johnzweng,项目名称:bankomatinfos,代码行数:22,代码来源:ResultActivity.java

示例9: onCreateOptionsMenu

import android.widget.ShareActionProvider; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate menu resource file.
    getMenuInflater().inflate(R.menu.share_menu, menu);

    // Locate MenuItem with ShareActionProvider
    MenuItem item = menu.findItem(R.id.menu_item_share);

    // Fetch and store ShareActionProvider
    mShareActionProvider = (ShareActionProvider) item.getActionProvider();
    Intent shareIntent = new Intent();
       shareIntent.setAction(Intent.ACTION_SEND);
       shareIntent.putExtra(Intent.EXTRA_TEXT, " https://play.google.com/store/apps/details?id=com.icareyou.highwaycal");
       shareIntent.setType("text/plain");
       if (mShareActionProvider != null) 
       	mShareActionProvider.setShareIntent(shareIntent);
    return true;
}
 
开发者ID:cnevinc,项目名称:Traffic_Freeway,代码行数:19,代码来源:MainActivity.java

示例10: 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.recipe_viewer, menu);

    // Locate MenuItem with ShareActionProvider
    MenuItem item = menu.findItem(R.id.menu_item_share);

    // Fetch and store ShareActionProvider
    ShareActionProvider mShareActionProvider = (ShareActionProvider) item.getActionProvider();
    Intent sendIntent = new Intent();
    sendIntent.setAction(Intent.ACTION_SEND);
    sendIntent.putExtra(Intent.EXTRA_TEXT, name+": "+url);
    sendIntent.setType("text/plain");
    mShareActionProvider.setShareIntent(sendIntent);
    return true;
}
 
开发者ID:lcneves,项目名称:cookme,代码行数:18,代码来源:RecipeViewer.java

示例11: onCreateOptionsMenu

import android.widget.ShareActionProvider; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
	// 创建标题栏菜单
	getMenuInflater().inflate(R.menu.main, menu);

	// 设置分享
	MenuItem item = menu.findItem(R.id.action_share);
	ShareActionProvider provider = (ShareActionProvider) item
			.getActionProvider();
	// 定义分享的Intent
	Intent intent = new Intent(Intent.ACTION_SEND);
	intent.setType("text/plain");
	intent.putExtra(Intent.EXTRA_SUBJECT, "share");
	intent.putExtra(Intent.EXTRA_TEXT, "share by Action Provider");
	provider.setShareIntent(intent);

	return true;
}
 
开发者ID:ZhaoKaiQiang,项目名称:actionbartabs,代码行数:19,代码来源:MainActivity.java

示例12: onCreateOptionsMenu

import android.widget.ShareActionProvider; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) 
{
    getMenuInflater().inflate(R.menu.webview_menu, menu);
    
    
    // Set up browser controls
    browserControls.backItem = menu.findItem(R.id.browser_back);
    browserControls.forwardItem= menu.findItem(R.id.browser_forward);
    browserControls.reloadItem = menu.findItem(R.id.browser_reload);
    browserControls.mobilizerItem = menu.findItem(R.id.browser_reader_toggle);       
    // Set up ShareActionProvider
    browserControls.shareItem = menu.findItem(R.id.browser_share);
    mShareActionProvider = (ShareActionProvider) browserControls.shareItem.getActionProvider();
    // Show the last app used:
    //mShareActionProvider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME);
    // Set a "send action" intent
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("text/plain");
    intent.putExtra(Intent.EXTRA_TEXT, articleLink);
    mShareActionProvider.setShareIntent(browserControls.createShareIntent());
    browserControls.update();
    
    return true;
}
 
开发者ID:oguzbilgener,项目名称:hnreader,代码行数:26,代码来源:ReaderWebView.java

示例13: 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

示例14: 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

示例15: onCreateOptionsMenu

import android.widget.ShareActionProvider; //导入方法依赖的package包/类
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
	inflater.inflate(R.menu.tweet, menu);
	MenuItem share = menu.findItem(R.id.share);
	mShareActionProvider = (ShareActionProvider) share.getActionProvider();
	mShareActionProvider.setShareIntent(mShareIntent);
}
 
开发者ID:missmisslonely,项目名称:fakeweibo,代码行数:8,代码来源:TweetFragment.java


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