增加首页-发现和修复部分汇总
This commit is contained in:
@ -94,6 +94,8 @@ public class ShareUtils {
|
||||
|
||||
private ShareType mShareType;
|
||||
|
||||
private Activity mActivity;
|
||||
|
||||
private Context mContext;
|
||||
//QQ或者QQ空间分享回调处理
|
||||
public IUiListener QqShareListener = new IUiListener() {
|
||||
@ -121,7 +123,7 @@ public class ShareUtils {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
public static ShareUtils getInstance(Activity context) {
|
||||
public static ShareUtils getInstance(Context context) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new ShareUtils(context);
|
||||
}
|
||||
@ -144,7 +146,8 @@ public class ShareUtils {
|
||||
}
|
||||
|
||||
|
||||
public void showShareWindows(View view, String url, String icon, String shareTitle, String shareSummary, ShareType shareType) {
|
||||
public void showShareWindows(Activity activity, View view, String url, String icon, String shareTitle, String shareSummary, ShareType shareType) {
|
||||
this.mActivity = activity;
|
||||
this.shareIcon = icon;
|
||||
this.shareUrl = url;
|
||||
this.mSummary = shareSummary;
|
||||
@ -211,7 +214,7 @@ public class ShareUtils {
|
||||
}
|
||||
|
||||
//QQ分享
|
||||
private void qqSahre() {
|
||||
private void qqShare() {
|
||||
Utils.toast(mContext, mContext.getString(R.string.share_skip));
|
||||
Bundle params = new Bundle();
|
||||
|
||||
@ -231,8 +234,7 @@ public class ShareUtils {
|
||||
params.putString(QQShare.SHARE_TO_QQ_IMAGE_URL, shareIcon);
|
||||
params.putString(QQShare.SHARE_TO_QQ_APP_NAME, mContext.getString(R.string.app_name));
|
||||
|
||||
mTencent.shareToQQ(
|
||||
(Activity) mContext, params, QqShareListener);
|
||||
mTencent.shareToQQ(mActivity, params, QqShareListener);
|
||||
|
||||
if (mShareType != ShareType.shareGh) {
|
||||
popupWindow.dismiss();
|
||||
@ -240,7 +242,7 @@ public class ShareUtils {
|
||||
}
|
||||
|
||||
//微信好友分享
|
||||
private void wechatSahre() {
|
||||
private void wechatShare() {
|
||||
Utils.toast(mContext, mContext.getString(R.string.share_skip));
|
||||
WXWebpageObject webpage = new WXWebpageObject();
|
||||
WXMediaMessage msg = new WXMediaMessage(webpage);
|
||||
@ -279,8 +281,12 @@ public class ShareUtils {
|
||||
@Override
|
||||
protected void onNewResultImpl(Bitmap bitmap) {
|
||||
Bitmap compressBp = compressBitmap(bitmap);
|
||||
Bitmap resultBp = addBackGround(compressBp);
|
||||
msg.thumbData = Util.bmpToByteArray(resultBp, true);
|
||||
if (mShareType == ShareType.askNormal || mShareType == ShareType.askInvite) {
|
||||
msg.thumbData = Util.bmpToByteArray(compressBp, true);
|
||||
} else {
|
||||
Bitmap resultBp = addBackGround(compressBp);
|
||||
msg.thumbData = Util.bmpToByteArray(resultBp, true);
|
||||
}
|
||||
mIWXAPI.sendReq(req);
|
||||
}
|
||||
|
||||
@ -338,7 +344,7 @@ public class ShareUtils {
|
||||
}
|
||||
|
||||
//QQ空间分享
|
||||
private void qZoneSahre() {
|
||||
private void qZoneShare() {
|
||||
Utils.toast(mContext, mContext.getString(R.string.share_skip));
|
||||
Bundle params = new Bundle();
|
||||
|
||||
@ -363,15 +369,14 @@ public class ShareUtils {
|
||||
params.putStringArrayList(QzoneShare.SHARE_TO_QQ_IMAGE_URL, imageUrls);
|
||||
params.putString(QzoneShare.SHARE_TO_QQ_APP_NAME, mContext.getString(R.string.app_name));
|
||||
|
||||
mTencent.shareToQzone(
|
||||
(Activity) mContext, params, QqShareListener);
|
||||
mTencent.shareToQzone(mActivity, params, QqShareListener);
|
||||
if (mShareType != ShareType.shareGh) {
|
||||
popupWindow.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
//微信朋友圈分享
|
||||
private void wechatMomentsSahre() {
|
||||
private void wechatMomentsShare() {
|
||||
Utils.toast(mContext, mContext.getString(R.string.share_skip));
|
||||
WXWebpageObject webpage = new WXWebpageObject();
|
||||
WXMediaMessage msg = new WXMediaMessage(webpage);
|
||||
@ -407,7 +412,7 @@ public class ShareUtils {
|
||||
}
|
||||
|
||||
//新浪微博分享
|
||||
private void sinaWeiboSahre() {
|
||||
private void sinaWeiboShare() {
|
||||
Intent intent = WeiBoShareActivity.getWeiboshareIntent(mContext,
|
||||
shareUrl, shareIcon, mTitle, mSummary, mShareType.toString());
|
||||
mContext.startActivity(intent);
|
||||
@ -418,7 +423,7 @@ public class ShareUtils {
|
||||
}
|
||||
|
||||
//短信分享
|
||||
private void shortMessageSahre() {
|
||||
private void shortMessageShare() {
|
||||
String smsBody;
|
||||
switch (mShareType) {
|
||||
case news:
|
||||
@ -485,22 +490,22 @@ public class ShareUtils {
|
||||
public void onClick(View v) {
|
||||
switch (holder.getPosition()) {
|
||||
case 0:
|
||||
wechatSahre();
|
||||
wechatShare();
|
||||
break;
|
||||
case 1:
|
||||
wechatMomentsSahre();
|
||||
wechatMomentsShare();
|
||||
break;
|
||||
case 2:
|
||||
qqSahre();
|
||||
qqShare();
|
||||
break;
|
||||
case 3:
|
||||
qZoneSahre();
|
||||
qZoneShare();
|
||||
break;
|
||||
case 4:
|
||||
sinaWeiboSahre();
|
||||
sinaWeiboShare();
|
||||
break;
|
||||
case 5:
|
||||
shortMessageSahre();
|
||||
shortMessageShare();
|
||||
break;
|
||||
case 6:
|
||||
if (mShareType == ShareType.askInvite || mShareType == ShareType.askNormal) {
|
||||
|
||||
Reference in New Issue
Block a user