Commit b73e404d010e62ff277ca8a2f9ad8025e3adc918

Authored by 袁思汶
1 parent 24032922

升级

OutSide_Share/src/main/java/com/cnlive/outside_share/activity/ShareIMActivity.java
... ... @@ -23,7 +23,6 @@ import com.alibaba.android.arouter.facade.annotation.Route;
23 23 import com.alibaba.android.arouter.launcher.ARouter;
24 24 import com.cnlive.libs.base.application.AppConfig;
25 25 import com.cnlive.libs.base.util.AlertUtil;
26   -import com.cnlive.libs.base.util.DoublePressed;
27 26 import com.cnlive.libs.base.util.MD5Util;
28 27 import com.cnlive.libs.base.util.StatusBarUtil2;
29 28 import com.cnlive.libs.base.util.StringUtils;
... ... @@ -125,17 +124,17 @@ public class ShareIMActivity extends AppCompatActivity {
125 124 public void checkIntent() {
126 125 equals = "shareIM".equals(outTyp); //是否二次登陆 以下所有type均需要判断是否二次登录
127 126 preferences = this.getSharedPreferences("OutShare", MODE_PRIVATE);
128   - switch (action) {
129   - case Intent.ACTION_SEND:
130   - jumpToSend(this, bundle);
131   - break;
132   - case Intent.ACTION_SEND_MULTIPLE:
133   - jumpToSendMultiple(this, mutil);
134   - break;
135   - default:
136   - AlertUtil.showDeftToast(this, "网家家暂不支持此类型信息分享.");
137   - break;
138   - }
  127 + switch (action) {
  128 + case Intent.ACTION_SEND:
  129 + jumpToSend(this, bundle);
  130 + break;
  131 + case Intent.ACTION_SEND_MULTIPLE:
  132 + jumpToSendMultiple(this, mutil);
  133 + break;
  134 + default:
  135 + AlertUtil.showDeftToast(this, "网家家暂不支持此类型信息分享.");
  136 + break;
  137 + }
139 138 }
140 139  
141 140 public static String processUrlData(String shareInfoUrl) {
... ... @@ -317,12 +316,12 @@ public class ShareIMActivity extends AppCompatActivity {
317 316 /*if (cursor != null && cursor.moveToFirst()) {
318 317 uri = ContentUris.withAppendedId(mediaUri,
319 318 cursor.getLong(cursor.getColumnIndex(MediaStore.Files.FileColumns._ID)));*/
320   - String fileName = textUri.toString().substring(textUri.toString().lastIndexOf("/"), textUri.toString().lastIndexOf("."));
321   - String fileType = textUri.toString().substring(textUri.toString().lastIndexOf("."), textUri.toString().length());
322   - String path = AndroidQUtil.copyAndroidQFile(ShareIMActivity.this, textUri.toString(), StringUtils.decode(fileName) + fileType);
323   - // String path = getPath(context, uri);
324   - startSelectForwardActivity(context, path, TYPE_SHARE_FILE, IN_TYPE_EXT_SHARE);
325   - killTime();
  319 + String fileName = textUri.toString().substring(textUri.toString().lastIndexOf("/"), textUri.toString().lastIndexOf("."));
  320 + String fileType = textUri.toString().substring(textUri.toString().lastIndexOf("."), textUri.toString().length());
  321 + String path = AndroidQUtil.copyAndroidQFile(ShareIMActivity.this, textUri.toString(), StringUtils.decode(fileName) + fileType);
  322 + // String path = getPath(context, uri);
  323 + startSelectForwardActivity(context, path, TYPE_SHARE_FILE, IN_TYPE_EXT_SHARE);
  324 + killTime();
326 325 /* } else {
327 326 AlertUtil.showDeftToast(context, "媒体库中暂未找到相关资源,请从手机相册中分享");
328 327 }
... ... @@ -387,21 +386,20 @@ public class ShareIMActivity extends AppCompatActivity {
387 386 startSelectForwardActivity(context, weixin_title, "", weixin_img_url, weixin_text, TYPE_SHARE_LINK);
388 387 killTime();
389 388 } else {
390   - if ("image/gif".equals(type) || "image/vnd.wap.wbmp".equals(type)) {
391   - if (DoublePressed.onDoublePressed()) return;
  389 + Uri imageUri = equals ? Uri.parse(preferences.getString("extrastream", "")) : bundle.getParcelable(Intent.EXTRA_STREAM);
  390 + if ("image/gif".equals(type) || "image/vnd.wap.wbmp".equals(type) || imageUri == null) {
392 391 AlertUtil.showDeftToast(context, "网家家暂不支持此格式图片分享.");
393 392 killTime();
394 393 } else {
395   - Uri imageUri = equals ? Uri.parse(preferences.getString("extrastream", "")) : bundle.getParcelable(Intent.EXTRA_STREAM);
396 394 sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, imageUri));
397   - if (AndroidQUtil.isAndroidQ()) {
398   - path = AndroidQUtil.copyAndroidQFile(ShareIMActivity.this, imageUri.toString(), System.currentTimeMillis() + ".png");
  395 + if (imageUri.toString().contains("/") && imageUri.toString().contains(".")) {
  396 + String fileName = imageUri.toString().substring(imageUri.toString().lastIndexOf("/"), imageUri.toString().lastIndexOf("."));
  397 + String fileType = imageUri.toString().substring(imageUri.toString().lastIndexOf("."), imageUri.toString().length());
  398 + path = AndroidQUtil.copyAndroidQFile(this, imageUri.toString(), StringUtils.decode(fileName) + fileType);
399 399 } else {
400   - path = getPath(context, imageUri);
  400 + path = AndroidQUtil.copyAndroidQFile(this, imageUri.toString(), System.currentTimeMillis() + ".png");
401 401 }
402   -
403 402 String fileType = FileType.getFileType(path);
404   -
405 403 if (path == null && (equals ? preferences.getString("extratext", "") : bundle.get(TEXT)) == null) {
406 404 AlertUtil.showDeftToast(context, "该文件路径不存在,无法完成分享.");
407 405 killTime();
... ... @@ -437,7 +435,7 @@ public class ShareIMActivity extends AppCompatActivity {
437 435 startSelectForwardActivity(context, path, TYPE_SHARE_IMAGE, IN_TYPE_EXT_SHARE);
438 436 killTime();
439 437 } else if ((equals ? preferences.getString("extratext", null) : bundle.get(TEXT)) != null &&
440   - bundle!= null && !(bundle.get(TEXT) + "").contains("http")) { //腾讯文件Android Q
  438 + bundle != null && !(bundle.get(TEXT) + "").contains("http")) { //腾讯文件Android Q
441 439 photoTimer.schedule(new TimerTask() {
442 440 @Override
443 441 public void run() {
... ... @@ -481,7 +479,7 @@ public class ShareIMActivity extends AppCompatActivity {
481 479 }
482 480 killTime();
483 481 }
484   - } else if (imageUri == null && path.endsWith("gif")) {
  482 + } else if (path.endsWith("gif")) {
485 483 AlertUtil.showDeftToast(this, "网家家暂不支持此类型信息分享.");
486 484 killTime();
487 485 } else if (String.valueOf(imageUri).startsWith("content://") && !"wbmp".equals(fileType)) {
... ...
config.gradle
... ... @@ -21,7 +21,7 @@ ext {
21 21 //编译方式
22 22 debug : false,
23 23 //版本号
24   - version: "1.0.1.9",
  24 + version: "1.0.2.0",
25 25 //Lib库前缀
26 26 packeg : "com.cnlive.outside_share",
27 27 //Lib库名称
... ...