Commit b73e404d010e62ff277ca8a2f9ad8025e3adc918
1 parent
24032922
升级
Showing
2 changed files
with
27 additions
and
29 deletions
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,7 +23,6 @@ import com.alibaba.android.arouter.facade.annotation.Route; | ||
| 23 | import com.alibaba.android.arouter.launcher.ARouter; | 23 | import com.alibaba.android.arouter.launcher.ARouter; |
| 24 | import com.cnlive.libs.base.application.AppConfig; | 24 | import com.cnlive.libs.base.application.AppConfig; |
| 25 | import com.cnlive.libs.base.util.AlertUtil; | 25 | import com.cnlive.libs.base.util.AlertUtil; |
| 26 | -import com.cnlive.libs.base.util.DoublePressed; | ||
| 27 | import com.cnlive.libs.base.util.MD5Util; | 26 | import com.cnlive.libs.base.util.MD5Util; |
| 28 | import com.cnlive.libs.base.util.StatusBarUtil2; | 27 | import com.cnlive.libs.base.util.StatusBarUtil2; |
| 29 | import com.cnlive.libs.base.util.StringUtils; | 28 | import com.cnlive.libs.base.util.StringUtils; |
| @@ -125,17 +124,17 @@ public class ShareIMActivity extends AppCompatActivity { | @@ -125,17 +124,17 @@ public class ShareIMActivity extends AppCompatActivity { | ||
| 125 | public void checkIntent() { | 124 | public void checkIntent() { |
| 126 | equals = "shareIM".equals(outTyp); //是否二次登陆 以下所有type均需要判断是否二次登录 | 125 | equals = "shareIM".equals(outTyp); //是否二次登陆 以下所有type均需要判断是否二次登录 |
| 127 | preferences = this.getSharedPreferences("OutShare", MODE_PRIVATE); | 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 | public static String processUrlData(String shareInfoUrl) { | 140 | public static String processUrlData(String shareInfoUrl) { |
| @@ -317,12 +316,12 @@ public class ShareIMActivity extends AppCompatActivity { | @@ -317,12 +316,12 @@ public class ShareIMActivity extends AppCompatActivity { | ||
| 317 | /*if (cursor != null && cursor.moveToFirst()) { | 316 | /*if (cursor != null && cursor.moveToFirst()) { |
| 318 | uri = ContentUris.withAppendedId(mediaUri, | 317 | uri = ContentUris.withAppendedId(mediaUri, |
| 319 | cursor.getLong(cursor.getColumnIndex(MediaStore.Files.FileColumns._ID)));*/ | 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 | /* } else { | 325 | /* } else { |
| 327 | AlertUtil.showDeftToast(context, "媒体库中暂未找到相关资源,请从手机相册中分享"); | 326 | AlertUtil.showDeftToast(context, "媒体库中暂未找到相关资源,请从手机相册中分享"); |
| 328 | } | 327 | } |
| @@ -387,21 +386,20 @@ public class ShareIMActivity extends AppCompatActivity { | @@ -387,21 +386,20 @@ public class ShareIMActivity extends AppCompatActivity { | ||
| 387 | startSelectForwardActivity(context, weixin_title, "", weixin_img_url, weixin_text, TYPE_SHARE_LINK); | 386 | startSelectForwardActivity(context, weixin_title, "", weixin_img_url, weixin_text, TYPE_SHARE_LINK); |
| 388 | killTime(); | 387 | killTime(); |
| 389 | } else { | 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 | AlertUtil.showDeftToast(context, "网家家暂不支持此格式图片分享."); | 391 | AlertUtil.showDeftToast(context, "网家家暂不支持此格式图片分享."); |
| 393 | killTime(); | 392 | killTime(); |
| 394 | } else { | 393 | } else { |
| 395 | - Uri imageUri = equals ? Uri.parse(preferences.getString("extrastream", "")) : bundle.getParcelable(Intent.EXTRA_STREAM); | ||
| 396 | sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, imageUri)); | 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 | } else { | 399 | } else { |
| 400 | - path = getPath(context, imageUri); | 400 | + path = AndroidQUtil.copyAndroidQFile(this, imageUri.toString(), System.currentTimeMillis() + ".png"); |
| 401 | } | 401 | } |
| 402 | - | ||
| 403 | String fileType = FileType.getFileType(path); | 402 | String fileType = FileType.getFileType(path); |
| 404 | - | ||
| 405 | if (path == null && (equals ? preferences.getString("extratext", "") : bundle.get(TEXT)) == null) { | 403 | if (path == null && (equals ? preferences.getString("extratext", "") : bundle.get(TEXT)) == null) { |
| 406 | AlertUtil.showDeftToast(context, "该文件路径不存在,无法完成分享."); | 404 | AlertUtil.showDeftToast(context, "该文件路径不存在,无法完成分享."); |
| 407 | killTime(); | 405 | killTime(); |
| @@ -437,7 +435,7 @@ public class ShareIMActivity extends AppCompatActivity { | @@ -437,7 +435,7 @@ public class ShareIMActivity extends AppCompatActivity { | ||
| 437 | startSelectForwardActivity(context, path, TYPE_SHARE_IMAGE, IN_TYPE_EXT_SHARE); | 435 | startSelectForwardActivity(context, path, TYPE_SHARE_IMAGE, IN_TYPE_EXT_SHARE); |
| 438 | killTime(); | 436 | killTime(); |
| 439 | } else if ((equals ? preferences.getString("extratext", null) : bundle.get(TEXT)) != null && | 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 | photoTimer.schedule(new TimerTask() { | 439 | photoTimer.schedule(new TimerTask() { |
| 442 | @Override | 440 | @Override |
| 443 | public void run() { | 441 | public void run() { |
| @@ -481,7 +479,7 @@ public class ShareIMActivity extends AppCompatActivity { | @@ -481,7 +479,7 @@ public class ShareIMActivity extends AppCompatActivity { | ||
| 481 | } | 479 | } |
| 482 | killTime(); | 480 | killTime(); |
| 483 | } | 481 | } |
| 484 | - } else if (imageUri == null && path.endsWith("gif")) { | 482 | + } else if (path.endsWith("gif")) { |
| 485 | AlertUtil.showDeftToast(this, "网家家暂不支持此类型信息分享."); | 483 | AlertUtil.showDeftToast(this, "网家家暂不支持此类型信息分享."); |
| 486 | killTime(); | 484 | killTime(); |
| 487 | } else if (String.valueOf(imageUri).startsWith("content://") && !"wbmp".equals(fileType)) { | 485 | } else if (String.valueOf(imageUri).startsWith("content://") && !"wbmp".equals(fileType)) { |
config.gradle