调用系统短信分享,删除shareSDK

This commit is contained in:
khy
2016-11-24 18:30:34 +08:00
parent 2dabd5492f
commit 82cf8cb877
33 changed files with 23 additions and 3546 deletions

View File

@ -10,6 +10,7 @@ import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.widget.GridLayoutManager;
@ -44,14 +45,8 @@ import com.tencent.tauth.UiError;
import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import cn.sharesdk.framework.Platform;
import cn.sharesdk.framework.PlatformActionListener;
import cn.sharesdk.framework.ShareSDK;
import cn.sharesdk.system.text.ShortMessage;
/**
* Created by khy on 2016/9/4.
*/
@ -362,44 +357,22 @@ public class ShareUtils {
//短信分享
private void shortMessageSahre(){
ShortMessage.ShareParams shortMessageParams = new ShortMessage.ShareParams();
String smsBody;
if (shareNewsTitle != null){
shortMessageParams.setText(shareNewsTitle + shareUrl);
smsBody = shareNewsTitle + shareUrl;
}else {
if (isPlugin){
shortMessageParams.setText("向你推荐:" + shareGameName + "(光环加速版)" + shareUrl);
smsBody = "向你推荐:" + shareGameName + "(光环加速版)" + shareUrl;
}else {
shortMessageParams.setText("向你推荐:" + shareGameName + shareUrl);
smsBody = "向你推荐:" + shareGameName + shareUrl;
}
}
shortMessageParams.setUrl(shareUrl);
shortMessageParams.setTitleUrl(shareUrl);
sharePlatform(shortMessageParams, ShortMessage.NAME);
}
Intent sendIntent = new Intent(Intent.ACTION_VIEW, Uri.parse( "smsto:" ));
sendIntent.putExtra( "sms_body", smsBody);
sendIntent.setType( "vnd.android-dir/mms-sms" );
context.startActivity(sendIntent);
//分享平台回调
private void sharePlatform(Platform.ShareParams params, String name) {
Utils.toast(context,"分享跳转中...");
Platform platform = ShareSDK.getPlatform(name);
platform.setPlatformActionListener(new PlatformActionListener() {
@Override
public void onComplete(Platform platform, int i, HashMap<String, Object> hashMap) {
Utils.log("分享成功");
}
@Override
public void onError(Platform platform, int i, Throwable throwable) {
Utils.log("分享失败");
}
@Override
public void onCancel(Platform platform, int i) {
Utils.log("取消分享");
}
});
platform.share(params);
popupWindow.dismiss();
}