本文整理汇总了Java中com.tencent.connect.share.QzoneShare类的典型用法代码示例。如果您正苦于以下问题:Java QzoneShare类的具体用法?Java QzoneShare怎么用?Java QzoneShare使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
QzoneShare类属于com.tencent.connect.share包,在下文中一共展示了QzoneShare类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shareToQzone
import com.tencent.connect.share.QzoneShare; //导入依赖的package包/类
public static void shareToQzone (final Activity activity,final String url,final String title,final String desc,final String img,IUiListener listener) {
if (api == null) {
api = Tencent.createInstance(APP_ID, MainApp.getContext());
}
if(api==null){
return;
}
ArrayList<String> imgs=new ArrayList<>();
if(!StringUtils.isEmpty(img)) {
imgs.add(img);
}else{
imgs.add("http://youkes.oss.aliyuncs.com/icon/icon_96.png");
}
final Bundle params = new Bundle();
params.putString(QzoneShare.SHARE_TO_QQ_TITLE, title);//必填
params.putString(QzoneShare.SHARE_TO_QQ_SUMMARY, desc);//选填
params.putString(QzoneShare.SHARE_TO_QQ_TARGET_URL, url);//必填
params.putStringArrayList(QzoneShare.SHARE_TO_QQ_IMAGE_URL, imgs);
api.shareToQzone(activity, params, listener);
}
示例2: doShareToQQZone
import com.tencent.connect.share.QzoneShare; //导入依赖的package包/类
private void doShareToQQZone() {
if (Content.Type.LINK != shareContent.getType()) {
LogUtils.e("%s: Unsupported content, finish.", TAG);
Toast.makeText(this, R.string.share_failed, Toast.LENGTH_SHORT).show();
finish();
return;
}
Bundle params = new Bundle();
params.putString(QzoneShare.SHARE_TO_QQ_TITLE, shareContent.getTitle());
params.putString(QzoneShare.SHARE_TO_QQ_SUMMARY, shareContent.getSummary());
ArrayList<String> imageUrls = new ArrayList<>();
imageUrls.add(shareContent.getImageUrl());
params.putStringArrayList(QzoneShare.SHARE_TO_QQ_IMAGE_URL, imageUrls);
params.putString(QzoneShare.SHARE_TO_QQ_TARGET_URL, shareContent.getTargetUrl());
api.shareToQzone(QQEnrtyActivity.this, params, qqShareListener);
}
示例3: shareAppToQzone
import com.tencent.connect.share.QzoneShare; //导入依赖的package包/类
public void shareAppToQzone(Activity activity, SKTencentContent content, final SKShare.ShareCallback callback) {
mActivity = activity;
this.callback = callback;
Bundle bundle = new Bundle();
bundle.putInt(QzoneShare.SHARE_TO_QZONE_KEY_TYPE, QzoneShare.SHARE_TO_QZONE_TYPE_APP);
bundle.putString(QzoneShare.SHARE_TO_QQ_TITLE, content.title);
bundle.putString(QzoneShare.SHARE_TO_QQ_SUMMARY, content.content);
bundle.putString(QzoneShare.SHARE_TO_QQ_TARGET_URL, content.url);
if (!TextUtils.isEmpty(content.url)) {
bundle.putString(QzoneShare.SHARE_TO_QQ_IMAGE_LOCAL_URL, content.imageUrl);
ArrayList<String> imageUrls = new ArrayList<>();
imageUrls.add(content.imageUrl);
bundle.putStringArrayList(QzoneShare.SHARE_TO_QQ_IMAGE_URL, imageUrls);
}
bundle.putString(QzoneShare.SHARE_TO_QQ_APP_NAME, content.appName);
mTencent.shareToQzone(activity, bundle, iUiListener);
}
示例4: shareImageText
import com.tencent.connect.share.QzoneShare; //导入依赖的package包/类
private void shareImageText(BaseShareParam params, ShareImage image) throws ShareException {
if (TextUtils.isEmpty(params.getTitle()) || TextUtils.isEmpty(params.getTargetUrl())) {
throw new InvalidParamException("Title or target url is empty or illegal");
}
Log.d(TAG, "share image text");
Bundle bundle = new Bundle();
bundle.putInt(QzoneShare.SHARE_TO_QZONE_KEY_TYPE, QzoneShare.SHARE_TO_QZONE_TYPE_IMAGE_TEXT);
bundle.putString(QzoneShare.SHARE_TO_QQ_TITLE, params.getTitle());
bundle.putString(QzoneShare.SHARE_TO_QQ_SUMMARY, params.getContent());
bundle.putString(QzoneShare.SHARE_TO_QQ_TARGET_URL, params.getTargetUrl());
ArrayList<String> imageUrls = new ArrayList<>();
if (image != null) {
if (image.isNetImage()) {
imageUrls.add(image.getNetImageUrl());
} else if (image.isLocalImage()) {
imageUrls.add(image.getLocalPath());
}
}
bundle.putStringArrayList(QzoneShare.SHARE_TO_QQ_IMAGE_URL, imageUrls);
doShareToQQ((Activity) getContext(), bundle);
}
示例5: shareToQZone
import com.tencent.connect.share.QzoneShare; //导入依赖的package包/类
/**
* 分享到QQ空间
*/
static void shareToQZone(final Activity activity, final ShareContent shareContent) {
DebugLog.d(TAG, "shareToQZone() shareContent = " + shareContent);
new Thread(new Runnable() {
@Override
public void run() {
Bundle params = new Bundle();
params.putInt(QzoneShare.SHARE_TO_QZONE_KEY_TYPE, QzoneShare.SHARE_TO_QZONE_TYPE_IMAGE_TEXT);
params.putString(QzoneShare.SHARE_TO_QQ_TITLE, shareContent.getTitle());
params.putString(QzoneShare.SHARE_TO_QQ_SUMMARY, shareContent.getSummary());
//注意:APP分享不支持传目标链接
params.putString(QzoneShare.SHARE_TO_QQ_TARGET_URL, shareContent.getLinkUrl());
params.putStringArrayList(QzoneShare.SHARE_TO_QQ_IMAGE_URL, shareContent.getImages());
Tencent tencent = MyApp.getApp().getTencent();
tencent.shareToQzone(activity, params, null);
}
}).start();
}
示例6: qzoneShare
import com.tencent.connect.share.QzoneShare; //导入依赖的package包/类
public void qzoneShare(ShareData shareData, QQListener qzoneShareListener) {
Bundle bundle = new Bundle();
bundle.putInt(QzoneShare.SHARE_TO_QZONE_KEY_TYPE, QzoneShare.SHARE_TO_QZONE_TYPE_IMAGE_TEXT);
bundle.putString(QzoneShare.SHARE_TO_QQ_TITLE, shareData.title);
bundle.putString(QzoneShare.SHARE_TO_QQ_SUMMARY, shareData.content);
bundle.putString(QzoneShare.SHARE_TO_QQ_TARGET_URL, shareData.targetUrl);
bundle.putStringArrayList(QzoneShare.SHARE_TO_QQ_IMAGE_URL, shareData.imgList);
// ArrayList<String> imgList = new ArrayList<String>(1);
// imgList.add("http://p2.so.qhimg.com/t01dba9a5ac5641a797.jpg");
// bundle.putStringArrayList(QzoneShare.SHARE_TO_QQ_IMAGE_URL, imgList);
if (null != tencent) {
tencent.shareToQzone(context, bundle, qzoneShareListener);
} else {
LogUtils.e("tencent未初始化");
Toast.makeText(context, "tencent未初始化", Toast.LENGTH_SHORT).show();
}
}
示例7: shareMsg
import com.tencent.connect.share.QzoneShare; //导入依赖的package包/类
@Override
public void shareMsg(Activity ctx, AbsShareMsg msg, CallbackListener listener) {
MsgImagesText mt = null;
if (msg instanceof MsgImagesText) {
mt = (MsgImagesText) msg;
final Bundle params = new Bundle();
params.putInt(QzoneShare.SHARE_TO_QZONE_KEY_TYPE, QzoneShare.SHARE_TO_QZONE_TYPE_IMAGE_TEXT);
params.putString(QzoneShare.SHARE_TO_QQ_TITLE, mt.title);
params.putString(QzoneShare.SHARE_TO_QQ_SUMMARY, mt.summary);
params.putString(QzoneShare.SHARE_TO_QQ_TARGET_URL, mt.targetUrl);
params.putString(QzoneShare.SHARE_TO_QQ_IMAGE_URL, mt.imageUrls.get(0));
mQzoneShare.shareToQQ(ctx, params, new BaseUiListener(listener));
}else if(msg instanceof MsgImage){
shareImageMsg(ctx, (MsgImage) msg, listener);
}
}
示例8: shareToQZoneForText
import com.tencent.connect.share.QzoneShare; //导入依赖的package包/类
private void shareToQZoneForText(String text, Activity activity, ShareListener listener) {
final Bundle params = new Bundle();
params.putInt(QzoneShare.SHARE_TO_QZONE_KEY_TYPE,
QzonePublish.PUBLISH_TO_QZONE_TYPE_PUBLISHMOOD);
params.putString(QzoneShare.SHARE_TO_QQ_SUMMARY, text);
mTencent.publishToQzone(activity, params, listener);
}
示例9: shareToQZoneForMedia
import com.tencent.connect.share.QzoneShare; //导入依赖的package包/类
private void shareToQZoneForMedia(String title, String targetUrl, String summary,
String imageUrl, Activity activity, ShareListener listener) {
final Bundle params = new Bundle();
final ArrayList<String> image = new ArrayList<>();
image.add(imageUrl);
params.putInt(QzoneShare.SHARE_TO_QZONE_KEY_TYPE,
QzoneShare.SHARE_TO_QZONE_TYPE_IMAGE_TEXT);
params.putString(QzoneShare.SHARE_TO_QQ_TITLE, title);
params.putString(QzoneShare.SHARE_TO_QQ_SUMMARY, summary);
params.putString(QzoneShare.SHARE_TO_QQ_TARGET_URL, targetUrl);
params.putStringArrayList(QzoneShare.SHARE_TO_QQ_IMAGE_URL, image);
mTencent.shareToQzone(activity, params, listener);
}
示例10: shareToQzoneForImage
import com.tencent.connect.share.QzoneShare; //导入依赖的package包/类
private void shareToQzoneForImage(String imagePath, Activity activity, ShareListener listener) {
final Bundle params = new Bundle();
final ArrayList<String> image = new ArrayList<>();
image.add(imagePath);
params.putInt(QzoneShare.SHARE_TO_QZONE_KEY_TYPE,
QzonePublish.PUBLISH_TO_QZONE_TYPE_PUBLISHMOOD);
params.putStringArrayList(QzoneShare.SHARE_TO_QQ_IMAGE_URL, image);
mTencent.publishToQzone(activity, params, listener);
}
示例11: shareToQZone
import com.tencent.connect.share.QzoneShare; //导入依赖的package包/类
public static void shareToQZone(Context context, String appId, String title, String summary, String url,
String imageUrl, IUiListener listener) {
Bundle params = new Bundle();
params.putInt(QzoneShare.SHARE_TO_QZONE_KEY_TYPE, QzoneShare.SHARE_TO_QZONE_TYPE_IMAGE_TEXT);
params.putString(QzoneShare.SHARE_TO_QQ_TITLE, title);
params.putString(QzoneShare.SHARE_TO_QQ_SUMMARY, summary);
params.putString(QzoneShare.SHARE_TO_QQ_TARGET_URL, url);
ArrayList<String> imgs = new ArrayList<String>();
imgs.add(imageUrl);
params.putStringArrayList(QzoneShare.SHARE_TO_QQ_IMAGE_URL, imgs);
Tencent tencent = getInstance(context, appId);
tencent.shareToQzone((Activity) context, params, listener);
}
示例12: shareToQzone
import com.tencent.connect.share.QzoneShare; //导入依赖的package包/类
public void shareToQzone() {
final QQToken token = getToken();
if (token != null) {
QzoneShare qzoneShare = new QzoneShare(this, token);
Bundle bundle = new Bundle();
bundle.putInt("req_type", 1);
bundle.putString("title", this.model.a);
bundle.putString("summary", this.model.b);
bundle.putString("targetUrl", this.model.d);
ArrayList arrayList = new ArrayList();
f.b(f.d, "-->shareToQzone : mIconUrl = " + this.model.c);
arrayList.add(this.model.c);
bundle.putStringArrayList("imageUrl", arrayList);
qzoneShare.shareToQzone(this, bundle, new IUiListener(this) {
final /* synthetic */ AppbarActivity b;
public void onError(UiError uiError) {
f.b(f.d, "-->(AppbarActivity)shareToQzone onError");
this.b.jsBridge.responseShareFail(2);
}
public void onComplete(Object obj) {
f.b(f.d, "-->(AppbarActivity)shareToQzone onComplete");
this.b.jsBridge.responseShare(2);
a.a(token.getAppId(), PLAYER.PLAY, "SDK.APPBAR.HOME.SHARE.QZ");
}
public void onCancel() {
f.b(f.d, "-->(AppbarActivity)shareToQzone onCancel");
this.b.jsBridge.responseShareFail(2);
}
});
a.a(token.getAppId(), "200", "SDK.APPBAR.HOME.SHARE.QZ");
}
}
示例13: shareText
import com.tencent.connect.share.QzoneShare; //导入依赖的package包/类
@Override
public void shareText(int shareTarget, Activity activity, ShareObj shareMediaObj) {
if (shareTarget == Target.SHARE_QQ_FRIENDS) {
shareTextByIntent(activity, shareMediaObj, SocialConstants.QQ_PKG, SocialConstants.QQ_FRIENDS_PAGE);
} else if (shareTarget == Target.SHARE_QQ_ZONE) {
final Bundle params = new Bundle();
params.putInt(QzoneShare.SHARE_TO_QZONE_KEY_TYPE, QzonePublish.PUBLISH_TO_QZONE_TYPE_PUBLISHMOOD);
params.putString(QzoneShare.SHARE_TO_QQ_SUMMARY, shareMediaObj.getSummary());
mTencentApi.publishToQzone(activity, params, mIUiListenerWrap);
}
}
示例14: shareVideo
import com.tencent.connect.share.QzoneShare; //导入依赖的package包/类
@Override
public void shareVideo(int shareTarget, Activity activity, ShareObj obj) {
if (shareTarget == Target.SHARE_QQ_FRIENDS) {
if (obj.isShareByIntent()) {
shareVideoByIntent(activity, obj, SocialConstants.QQ_PKG, SocialConstants.QQ_FRIENDS_PAGE);
} else {
// 使用 web 格式分享
LogUtils.e(TAG, "qq不支持分享视频,使用web分享代替");
obj.setTargetUrl(obj.getMediaPath());
shareWeb(shareTarget, activity, obj);
}
} else if (shareTarget == Target.SHARE_QQ_ZONE) {
// qq 空间支持本地文件发布
if (!FileUtils.isHttpPath(obj.getMediaPath())) {
LogUtils.e(TAG, "qq空间本地视频分享");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
&& activity.checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_DENIED) {
this.mIUiListenerWrap.onError(new SocialException("没有获取到读存储卡的权限,qq 空间分享本地视频功能无法继续"));
return;
}
final Bundle params = new Bundle();
params.putInt(QzoneShare.SHARE_TO_QZONE_KEY_TYPE, QzonePublish.PUBLISH_TO_QZONE_TYPE_PUBLISHVIDEO);
params.putString(QzonePublish.PUBLISH_TO_QZONE_VIDEO_PATH, obj.getMediaPath());
mTencentApi.publishToQzone(activity, params, mIUiListenerWrap);
} else {
LogUtils.e(TAG, "qq空间网络视频,使用web形式分享");
shareWeb(shareTarget, activity, obj);
}
}
}
示例15: shareImageToQzone
import com.tencent.connect.share.QzoneShare; //导入依赖的package包/类
public void shareImageToQzone(Activity activity, SKTencentContent content, final SKShare.ShareCallback callback) {
mActivity = activity;
this.callback = callback;
Bundle bundle = new Bundle();
bundle.putInt(QzoneShare.SHARE_TO_QZONE_KEY_TYPE, QzoneShare.SHARE_TO_QZONE_TYPE_IMAGE_TEXT);
bundle.putString(QzoneShare.SHARE_TO_QQ_TITLE, content.title);
bundle.putString(QzoneShare.SHARE_TO_QQ_SUMMARY, content.content);
bundle.putString(QzoneShare.SHARE_TO_QQ_TARGET_URL, content.url);
//bundle.putString(QzoneShare.SHARE_TO_QQ_IMAGE_LOCAL_URL, content.imageUrl);
ArrayList<String> imageUrls = new ArrayList<>();
imageUrls.add(content.imageUrl);
bundle.putStringArrayList(QzoneShare.SHARE_TO_QQ_IMAGE_URL, imageUrls);
mTencent.shareToQzone(activity, bundle, iUiListener);
}