|
|
@@ -111,6 +111,10 @@ import static com.sheep.gamegroup.util.UMConfigUtils.Event.LINK_SHARE;
|
|
|
import static com.sheep.gamegroup.util.UMConfigUtils.Event.NEWBIE_TASK;
|
|
|
import static com.sheep.gamegroup.util.UMConfigUtils.Event.QR_COPY;
|
|
|
import static com.sheep.gamegroup.util.UMConfigUtils.Event.RECEIVE_AWARD_GAME_TASK;
|
|
|
+import static com.sheep.gamegroup.util.UMConfigUtils.Event.SHARE_SYS_SEND;
|
|
|
+import static com.sheep.gamegroup.util.UMConfigUtils.Event.SHARE_TO_QQ;
|
|
|
+import static com.sheep.gamegroup.util.UMConfigUtils.Event.SHARE_TO_WEIXIN_CIRCLE;
|
|
|
+import static com.sheep.gamegroup.util.UMConfigUtils.Event.SHARE_TO_WX;
|
|
|
import static com.sheep.gamegroup.util.UMConfigUtils.Event.XIAOMI_GAME_RECEIVE;
|
|
|
import static com.sheep.gamegroup.util.ViewUtil.mRobTask;
|
|
|
import static com.sheep.gamegroup.view.adapter.TryMakeMoneyAdp.PUBLIC_TAG_PREFIX_TEXTVIEW_LIST;
|
|
|
@@ -799,26 +803,8 @@ public class CommonUtil {
|
|
|
ViewUtil.newInstance().showShare(activity, realUrl, description);
|
|
|
return;
|
|
|
case DialogShare.SYS_SEND:
|
|
|
- PackageInfo packageInfo = ApkUtils.getPackageInfo(SheepApp.getInstance().getPackageName());
|
|
|
- if(packageInfo != null && packageInfo.applicationInfo != null && !TextUtils.isEmpty(packageInfo.applicationInfo.sourceDir)){
|
|
|
- String dir = DIR;
|
|
|
- //File dir = SheepApp.getInstance().getDir("apk", Context.MODE_PRIVATE);
|
|
|
- File file = new File(dir, String.format(Locale.CHINA, "sheep_release_v%s_%d-%s.apk", packageInfo.versionName, packageInfo.versionCode, DataUtil.getInstance().getInvitationCode()));
|
|
|
- if(!file.exists()){
|
|
|
- try {
|
|
|
- FileUtil.copyFile(new File(packageInfo.applicationInfo.sourceDir), file);
|
|
|
- ZipChannelUtil.writeQUA(file, DataUtil.getInstance().getInvitationCode());
|
|
|
- } catch (IOException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- if(file.exists())
|
|
|
- shareFile(activity, file);
|
|
|
- else
|
|
|
- G.showToast("暂不支持,或未打开权限");
|
|
|
- } else {
|
|
|
- G.showToast("暂不支持");
|
|
|
- }
|
|
|
+ SHARE_SYS_SEND.onEvent();
|
|
|
+ shareBySysSend(activity);
|
|
|
return;
|
|
|
case DialogShare.FACE_TO_FACE:
|
|
|
ViewUtil.showQR(activity, realUrl);
|
|
|
@@ -837,13 +823,16 @@ public class CommonUtil {
|
|
|
}));
|
|
|
return;
|
|
|
case DialogShare.QQ:
|
|
|
+ SHARE_TO_QQ.onEvent();
|
|
|
share_media = SHARE_MEDIA.QQ;
|
|
|
break;
|
|
|
case DialogShare.WX:
|
|
|
+ SHARE_TO_WX.onEvent();
|
|
|
share_media = SHARE_MEDIA.WEIXIN;
|
|
|
break;
|
|
|
case DialogShare.WEIXIN_CIRCLE:
|
|
|
default:
|
|
|
+ SHARE_TO_WEIXIN_CIRCLE.onEvent();
|
|
|
share_media = SHARE_MEDIA.WEIXIN_CIRCLE;
|
|
|
break;
|
|
|
}
|
|
|
@@ -858,6 +847,30 @@ public class CommonUtil {
|
|
|
.setCallback(new UMShareListener())
|
|
|
.share();
|
|
|
}
|
|
|
+
|
|
|
+ public void shareBySysSend(Activity activity) {
|
|
|
+ PackageInfo packageInfo = ApkUtils.getPackageInfo(SheepApp.getInstance().getPackageName());
|
|
|
+ if(packageInfo != null && packageInfo.applicationInfo != null && !TextUtils.isEmpty(packageInfo.applicationInfo.sourceDir)){
|
|
|
+ String dir = DIR;
|
|
|
+ //File dir = SheepApp.getInstance().getDir("apk", Context.MODE_PRIVATE);
|
|
|
+ File file = new File(dir, String.format(Locale.CHINA, "sheep_release_v%s_%d-%s.apk", packageInfo.versionName, packageInfo.versionCode, DataUtil.getInstance().getInvitationCode()));
|
|
|
+ if(!file.exists()){
|
|
|
+ try {
|
|
|
+ FileUtil.copyFile(new File(packageInfo.applicationInfo.sourceDir), file);
|
|
|
+ ZipChannelUtil.writeQUA(file, DataUtil.getInstance().getInvitationCode());
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(file.exists())
|
|
|
+ shareFile(activity, file);
|
|
|
+ else
|
|
|
+ G.showToast("暂不支持,或未打开权限");
|
|
|
+ } else {
|
|
|
+ G.showToast("暂不支持");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 調用系統方法分享文件
|
|
|
public static void shareFile(Context context, File file) {
|
|
|
if (null != file && file.exists()) {
|