feat:春节活动—集“萌兔福签”,得新年好礼—客户端 https://jira.shanqu.cc/browse/GHZS-802
This commit is contained in:
@ -43,6 +43,7 @@ import com.tencent.connect.share.QQShare;
|
||||
import com.tencent.mm.opensdk.modelmsg.SendMessageToWX;
|
||||
import com.tencent.mm.opensdk.modelmsg.WXImageObject;
|
||||
import com.tencent.mm.opensdk.modelmsg.WXMediaMessage;
|
||||
import com.tencent.mm.opensdk.modelmsg.WXTextObject;
|
||||
import com.tencent.mm.opensdk.openapi.IWXAPI;
|
||||
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
|
||||
import com.tencent.open.TDialog;
|
||||
@ -311,6 +312,51 @@ public class MessageShareUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public void shareTextFromWeb(Activity activity, String text, String type) {
|
||||
switch (type) {
|
||||
case "qq":
|
||||
Utils.toast(mContext, "分享跳转中...");
|
||||
if (ShareUtils.isQQClientAvailable(activity)) {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(Intent.ACTION_SEND);
|
||||
intent.putExtra(Intent.EXTRA_TEXT, text);
|
||||
intent.setType("text/plain");
|
||||
intent.setPackage("com.tencent.mobileqq");
|
||||
intent.setClassName("com.tencent.mobileqq", "com.tencent.mobileqq.activity.JumpActivity");
|
||||
try {
|
||||
activity.startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
Utils.toast(mContext, "分享失败");
|
||||
}
|
||||
} else {
|
||||
Utils.toast(mContext, "请安装QQ客户端");
|
||||
}
|
||||
break;
|
||||
case "wechat":
|
||||
Utils.toast(mContext, "分享跳转中...");
|
||||
|
||||
if (!mIWXAPI.isWXAppInstalled() && !PermissionHelper.isGetInstalledListPermissionDisabled(mContext)) {
|
||||
Utils.toast(mContext, mContext.getString(R.string.share_no_wechat_hint));
|
||||
return;
|
||||
}
|
||||
|
||||
WXTextObject textObj = new WXTextObject();
|
||||
textObj.text = text;
|
||||
|
||||
WXMediaMessage msg = new WXMediaMessage();
|
||||
msg.mediaObject = textObj;
|
||||
msg.description = text;
|
||||
|
||||
SendMessageToWX.Req req = new SendMessageToWX.Req();
|
||||
req.transaction = buildTransaction("text");
|
||||
req.message = msg;
|
||||
req.scene = SendMessageToWX.Req.WXSceneSession;
|
||||
|
||||
mIWXAPI.sendReq(req);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//QQ分享
|
||||
private void qqShare() {
|
||||
Utils.toast(mContext, "分享跳转中...");
|
||||
|
||||
Reference in New Issue
Block a user