當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。