public static void setStatusShareMenu(MenuItem shareItem, StatusContent status) { String url = null; if (status.getPic_urls() != null && status.getPic_urls().length > 0) { url = status.getPic_urls()[0].getThumbnail_pic(); } else if (!TextUtils.isEmpty(status.getThumbnail_pic())) { url = status.getThumbnail_pic(); } if (!TextUtils.isEmpty(url)) { File file = BitmapLoader.getInstance().getCacheFile(url.replace("thumbnail", "large")); if (file.exists()) { url = url.replace("thumbnail", "large"); } else { file = BitmapLoader.getInstance().getCacheFile(url.replace("thumbnail", "bmiddle")); if (file.exists()) { url = url.replace("thumbnail", "bmiddle"); } } } Intent shareIntent = Utils.getShareIntent(status.getText(), status.getText(), url); ShareActionProvider shareProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(shareItem); shareProvider.setShareHistoryFileName("channe_share.xml"); shareProvider.setShareIntent(shareIntent); }
public static void onMenuClicked(ABaseFragment fragment, int menuId, StatusContent status) { switch (menuId) { case R.id.comment: BizFragment.getBizFragment(fragment).commentCreate(status); break; case R.id.repost: BizFragment.getBizFragment(fragment).statusRepost(status); break; case R.id.fav: BizFragment.getBizFragment(fragment).favorityCreate(status.getId() + "", null); break; case R.id.fav_destory: BizFragment.getBizFragment(fragment).favorityDestory(status.getId() + "", null); break; case R.id.copy: copyToClipboard(status.getText()); ViewUtils.showMessage(R.string.msg_text_copyed); break; case R.id.delete: deleteStatus(fragment, status); break; case R.id.weiguan: PublishActivity.publishStatusRepostAndWeiguan(fragment.getActivity(), null, status); break; case R.id.share: break; } }
public static void timelineMenuSelected( final ABaseFragment fragment, String selectedItem, final StatusContent status) { final String[] timelineMenuArr = GlobalContext.getInstance().getResources().getStringArray(R.array.timeline_menus); try { int position = 0; for (int i = 0; i < timelineMenuArr.length; i++) { if (timelineMenuArr[i].equals(selectedItem)) { position = i; break; } } switch (position) { // 原微博 case 0: TimelineCommentFragment.launch(fragment.getActivity(), status.getRetweeted_status()); break; // 复制 case 1: AisenUtils.copyToClipboard(status.getText()); ViewUtils.showMessage(R.string.msg_text_copyed); break; // 转发 case 2: BizFragment.getBizFragment(fragment).statusRepost(status); break; // 评论 case 3: BizFragment.getBizFragment(fragment).commentCreate(status); break; // 收藏 case 4: BizFragment.getBizFragment(fragment).favorityCreate(status.getId() + "", null); break; // 取消收藏 case 5: BizFragment.getBizFragment(fragment).favorityDestory(status.getId() + "", null); break; // 删除微博 case 6: deleteStatus(fragment, status); break; // 屏蔽微博 case 7: shieldStatus(fragment, status); break; // 围观 case 8: PublishActivity.publishStatusRepostAndWeiguan(fragment.getActivity(), null, status); break; } } catch (Exception e) { e.printStackTrace(); } }