Commit 860d36c45c8257c37f528e4c56d2c913c4d85a76
1 parent
013cc9dc
second
Showing
33 changed files
with
2918 additions
and
12 deletions
.idea/gradle.xml
| 1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <project version="4"> | 2 | <project version="4"> |
| 3 | + <component name="GradleMigrationSettings" migrationVersion="1" /> | ||
| 3 | <component name="GradleSettings"> | 4 | <component name="GradleSettings"> |
| 4 | <option name="linkedExternalProjectsSettings"> | 5 | <option name="linkedExternalProjectsSettings"> |
| 5 | <GradleProjectSettings> | 6 | <GradleProjectSettings> |
| @@ -10,6 +11,7 @@ | @@ -10,6 +11,7 @@ | ||
| 10 | <option name="modules"> | 11 | <option name="modules"> |
| 11 | <set> | 12 | <set> |
| 12 | <option value="$PROJECT_DIR$" /> | 13 | <option value="$PROJECT_DIR$" /> |
| 14 | + <option value="$PROJECT_DIR$/OutSide_Share" /> | ||
| 13 | <option value="$PROJECT_DIR$/app" /> | 15 | <option value="$PROJECT_DIR$/app" /> |
| 14 | </set> | 16 | </set> |
| 15 | </option> | 17 | </option> |
.idea/jarRepositories.xml
| @@ -36,5 +36,10 @@ | @@ -36,5 +36,10 @@ | ||
| 36 | <option name="name" value="maven3" /> | 36 | <option name="name" value="maven3" /> |
| 37 | <option name="url" value="https://dl.bintray.com/granzon/cnliveLibs" /> | 37 | <option name="url" value="https://dl.bintray.com/granzon/cnliveLibs" /> |
| 38 | </remote-repository> | 38 | </remote-repository> |
| 39 | + <remote-repository> | ||
| 40 | + <option name="id" value="maven" /> | ||
| 41 | + <option name="name" value="maven" /> | ||
| 42 | + <option name="url" value="http://android.nexus.cnlive.com/repository/cnlive-mixed/" /> | ||
| 43 | + </remote-repository> | ||
| 39 | </component> | 44 | </component> |
| 40 | </project> | 45 | </project> |
| 41 | \ No newline at end of file | 46 | \ No newline at end of file |
OutSide_Share/.gitignore
0 → 100644
OutSide_Share/build.gradle
0 → 100644
| 1 | +apply plugin: 'com.android.library' | ||
| 2 | +apply from: './maven_push.gradle' | ||
| 3 | + | ||
| 4 | +android { | ||
| 5 | + compileSdkVersion "android-R" | ||
| 6 | + buildToolsVersion "29.0.3" | ||
| 7 | + | ||
| 8 | + defaultConfig { | ||
| 9 | + minSdkVersion 19 | ||
| 10 | + targetSdkVersion 29 | ||
| 11 | + versionCode 1 | ||
| 12 | + versionName "1.0" | ||
| 13 | + javaCompileOptions { | ||
| 14 | + annotationProcessorOptions { | ||
| 15 | + arguments = [AROUTER_MODULE_NAME: project.getName(), AROUTER_GENERATE_DOC: "enable"] | ||
| 16 | + } | ||
| 17 | + } | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + buildTypes { | ||
| 21 | + debug { | ||
| 22 | + resValue("string", "outshare", "网家家好友Debug") | ||
| 23 | + resValue("string", "outsharecircle", "网家家生活圈Debug") | ||
| 24 | + } | ||
| 25 | + release { | ||
| 26 | + resValue("string", "outshare", "网家家好友") | ||
| 27 | + resValue("string", "outsharecircle", "网家家生活圈") | ||
| 28 | + } | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + compileOptions { | ||
| 32 | + sourceCompatibility JavaVersion.VERSION_1_8 | ||
| 33 | + targetCompatibility JavaVersion.VERSION_1_8 | ||
| 34 | + } | ||
| 35 | +} | ||
| 36 | + | ||
| 37 | +dependencies { | ||
| 38 | + implementation fileTree(dir: "libs", include: ["*.jar"]) | ||
| 39 | + //androidX | ||
| 40 | + implementation "androidx.legacy:legacy-support-v4:$rootProject.androidX_legacy_support_v4" | ||
| 41 | + implementation "androidx.appcompat:appcompat:$rootProject.androidXAppcompat" | ||
| 42 | + implementation "androidx.recyclerview:recyclerview:$rootProject.androidXRecyclerview" | ||
| 43 | + implementation "androidx.constraintlayout:constraintlayout:$rootProject.androidXConstraintlayout" | ||
| 44 | + //glide | ||
| 45 | + implementation "com.github.bumptech.glide:glide:$rootProject.glide" | ||
| 46 | + implementation "jp.wasabeef:glide-transformations:$rootProject.glideTransformations" | ||
| 47 | + annotationProcessor "com.github.bumptech.glide:compiler:$rootProject.compiler" | ||
| 48 | + | ||
| 49 | + api "pub.devrel:easypermissions:$rootProject.easypermissions" | ||
| 50 | + | ||
| 51 | + implementation "com.qmuiteam:qmui:$rootProject.qmui" | ||
| 52 | + | ||
| 53 | + implementation "com.cnlive.libs:base:$rootProject.libBase" | ||
| 54 | + implementation "com.cnlive.libs:largeimage:$rootProject.libLargeImage" | ||
| 55 | + | ||
| 56 | + implementation 'com.github.chrisbanes:PhotoView:2.1.4' | ||
| 57 | + //ARouter | ||
| 58 | + implementation 'com.alibaba:arouter-api:1.5.0' // 换用最新版本 | ||
| 59 | + annotationProcessor 'com.alibaba:arouter-compiler:1.2.2' // 换用最新版本 | ||
| 60 | + implementation 'org.jsoup:jsoup:1.12.1' | ||
| 61 | + implementation "com.cnlive.libs:mediapicker:$rootProject.libMediaPicker" | ||
| 62 | + | ||
| 63 | +} | ||
| 0 | \ No newline at end of file | 64 | \ No newline at end of file |
OutSide_Share/consumer-rules.pro
0 → 100644
OutSide_Share/maven_push.gradle
0 → 100644
| 1 | +apply plugin: 'maven' | ||
| 2 | + | ||
| 3 | +uploadArchives() { | ||
| 4 | + repositories { | ||
| 5 | + mavenDeployer { | ||
| 6 | + def lib = out_shared | ||
| 7 | + //发布环境(正式/测试) | ||
| 8 | + android.defaultPublishConfig lib.debug ? "debug" : "release" | ||
| 9 | + //发布渠道(地址/账号) | ||
| 10 | + repository(url: maven.mavenMixedUrl) { | ||
| 11 | + authentication(userName: maven.mavenUserName, password: maven.mavenPwd) | ||
| 12 | + } | ||
| 13 | + //发布信息(包名/别名/版本) | ||
| 14 | + pom.project { | ||
| 15 | + groupId lib.packeg | ||
| 16 | + artifactId lib.name | ||
| 17 | + version = lib.debug ? lib.version.concat("-SNAPSHOT") : lib.version | ||
| 18 | + } | ||
| 19 | + pom.whenConfigured { pom -> | ||
| 20 | + List list = new ArrayList() | ||
| 21 | + //手动增加过滤项 | ||
| 22 | + pom.dependencies.findAll { | ||
| 23 | + dep -> dep.groupId == "pub.devrel" || dep.groupId == "com.chensl.rotatephotoview" | ||
| 24 | + }.collect { dep -> list.add(dep) } | ||
| 25 | + //移除支持库 | ||
| 26 | + pom.dependencies.clear() | ||
| 27 | + pom.dependencies.addAll(list) | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + } | ||
| 31 | + } | ||
| 32 | +} | ||
| 0 | \ No newline at end of file | 33 | \ No newline at end of file |
OutSide_Share/proguard-rules.pro
0 → 100644
| 1 | +# Add project specific ProGuard rules here. | ||
| 2 | +# You can control the set of applied configuration files using the | ||
| 3 | +# proguardFiles setting in build.gradle. | ||
| 4 | +# | ||
| 5 | +# For more details, see | ||
| 6 | +# http://developer.android.com/guide/developing/tools/proguard.html | ||
| 7 | + | ||
| 8 | +# If your project uses WebView with JS, uncomment the following | ||
| 9 | +# and specify the fully qualified class name to the JavaScript interface | ||
| 10 | +# class: | ||
| 11 | +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
| 12 | +# public *; | ||
| 13 | +#} | ||
| 14 | + | ||
| 15 | +# Uncomment this to preserve the line number information for | ||
| 16 | +# debugging stack traces. | ||
| 17 | +#-keepattributes SourceFile,LineNumberTable | ||
| 18 | + | ||
| 19 | +# If you keep the line number information, uncomment this to | ||
| 20 | +# hide the original source file name. | ||
| 21 | +#-renamesourcefileattribute SourceFile | ||
| 0 | \ No newline at end of file | 22 | \ No newline at end of file |
OutSide_Share/src/androidTest/java/com/cnlive/outside_share/ExampleInstrumentedTest.java
0 → 100644
| 1 | +package com.cnlive.outside_share; | ||
| 2 | + | ||
| 3 | +import android.content.Context; | ||
| 4 | + | ||
| 5 | +import androidx.test.platform.app.InstrumentationRegistry; | ||
| 6 | +import androidx.test.ext.junit.runners.AndroidJUnit4; | ||
| 7 | + | ||
| 8 | +import org.junit.Test; | ||
| 9 | +import org.junit.runner.RunWith; | ||
| 10 | + | ||
| 11 | +import static org.junit.Assert.*; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * Instrumented test, which will execute on an Android device. | ||
| 15 | + * | ||
| 16 | + * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
| 17 | + */ | ||
| 18 | +@RunWith(AndroidJUnit4.class) | ||
| 19 | +public class ExampleInstrumentedTest { | ||
| 20 | + @Test | ||
| 21 | + public void useAppContext() { | ||
| 22 | + // Context of the app under test. | ||
| 23 | + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); | ||
| 24 | + assertEquals("com.cnlive.outside_share.test", appContext.getPackageName()); | ||
| 25 | + } | ||
| 26 | +} | ||
| 0 | \ No newline at end of file | 27 | \ No newline at end of file |
OutSide_Share/src/main/AndroidManifest.xml
0 → 100644
| 1 | +<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 2 | + package="com.cnlive.outside_share"> | ||
| 3 | + <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
| 4 | + <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> | ||
| 5 | + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | ||
| 6 | + <uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY" /> | ||
| 7 | + <uses-permission android:name="com.sonyericsson.home.permission.BROADCAST_BADGE" /> | ||
| 8 | + <uses-permission android:name="com.sec.android.provider.badge.permission.READ" /> | ||
| 9 | + <uses-permission android:name="com.sec.android.provider.badge.permission.WRITE" /> | ||
| 10 | + | ||
| 11 | + <application | ||
| 12 | + android:largeHeap="true"> | ||
| 13 | + <activity | ||
| 14 | + android:name="com.cnlive.outside_share.activity.ShareIMActivity" | ||
| 15 | + android:configChanges="keyboardHidden|screenSize|orientation" | ||
| 16 | + android:launchMode="singleTask" | ||
| 17 | + android:theme="@style/MyTranslucentTheme"> | ||
| 18 | + | ||
| 19 | + </activity> | ||
| 20 | + | ||
| 21 | + <activity | ||
| 22 | + android:name="com.cnlive.outside_share.activity.ShareMomentActivity" | ||
| 23 | + android:configChanges="keyboardHidden|screenSize|orientation" | ||
| 24 | + android:launchMode="singleTask" | ||
| 25 | + android:theme="@style/MyTranslucentTheme"> | ||
| 26 | + </activity> | ||
| 27 | + </application> | ||
| 28 | +</manifest> | ||
| 0 | \ No newline at end of file | 29 | \ No newline at end of file |
OutSide_Share/src/main/java/com/cnlive/outside_share/activity/ShareIMActivity.java
0 → 100644
| 1 | +package com.cnlive.outside_share.activity; | ||
| 2 | + | ||
| 3 | +import android.Manifest; | ||
| 4 | +import android.annotation.TargetApi; | ||
| 5 | +import android.app.Activity; | ||
| 6 | +import android.content.ContentUris; | ||
| 7 | +import android.content.Context; | ||
| 8 | +import android.content.Intent; | ||
| 9 | +import android.content.SharedPreferences; | ||
| 10 | +import android.content.pm.PackageManager; | ||
| 11 | +import android.content.pm.ResolveInfo; | ||
| 12 | +import android.database.Cursor; | ||
| 13 | +import android.media.MediaPlayer; | ||
| 14 | +import android.net.Uri; | ||
| 15 | +import android.os.Build; | ||
| 16 | +import android.os.Bundle; | ||
| 17 | +import android.os.Environment; | ||
| 18 | +import android.provider.MediaStore; | ||
| 19 | +import android.provider.Settings; | ||
| 20 | +import android.text.TextUtils; | ||
| 21 | +import android.util.Log; | ||
| 22 | + | ||
| 23 | +import com.alibaba.android.arouter.launcher.ARouter; | ||
| 24 | +import com.cnlive.libs.base.application.AppConfig; | ||
| 25 | +import com.cnlive.libs.base.util.AlertUtil; | ||
| 26 | +import com.cnlive.libs.base.util.DoublePressed; | ||
| 27 | +import com.cnlive.libs.base.util.MD5Util; | ||
| 28 | +import com.cnlive.libs.base.util.StringUtils; | ||
| 29 | +import com.cnlive.libs.data.network.util.UriUtil; | ||
| 30 | +import com.cnlive.media.picker.utils.AndroidQUtil; | ||
| 31 | +import com.cnlive.media.picker.utils.BrandUtils; | ||
| 32 | +import com.cnlive.media.picker.utils.PermissionChecker; | ||
| 33 | +import com.cnlive.outside_share.R; | ||
| 34 | +import com.cnlive.outside_share.util.FileType; | ||
| 35 | +import com.cnlive.outside_share.util.FileUtil; | ||
| 36 | +import com.google.gson.Gson; | ||
| 37 | +import com.google.gson.reflect.TypeToken; | ||
| 38 | + | ||
| 39 | +import org.jsoup.Connection; | ||
| 40 | +import org.jsoup.Jsoup; | ||
| 41 | +import org.jsoup.nodes.Document; | ||
| 42 | +import org.jsoup.nodes.Element; | ||
| 43 | +import org.jsoup.select.Elements; | ||
| 44 | + | ||
| 45 | +import java.io.ByteArrayInputStream; | ||
| 46 | +import java.io.ByteArrayOutputStream; | ||
| 47 | +import java.io.File; | ||
| 48 | +import java.io.FileOutputStream; | ||
| 49 | +import java.io.IOException; | ||
| 50 | +import java.io.InputStream; | ||
| 51 | +import java.lang.reflect.Type; | ||
| 52 | +import java.util.ArrayList; | ||
| 53 | +import java.util.List; | ||
| 54 | +import java.util.Objects; | ||
| 55 | +import java.util.Timer; | ||
| 56 | +import java.util.TimerTask; | ||
| 57 | + | ||
| 58 | +import androidx.annotation.Nullable; | ||
| 59 | +import androidx.annotation.RequiresApi; | ||
| 60 | +import androidx.appcompat.app.AppCompatActivity; | ||
| 61 | + | ||
| 62 | +import static com.cnlive.media.picker.ui.PickerActivity.REQUEST_CODE_PERMISSION_CAMERA; | ||
| 63 | +import static com.cnlive.outside_share.activity.ShareMomentActivity.getFilePathFromURI; | ||
| 64 | +import static com.cnlive.outside_share.activity.ShareMomentActivity.getPath; | ||
| 65 | + | ||
| 66 | + | ||
| 67 | +public class ShareIMActivity extends AppCompatActivity { | ||
| 68 | + //以下是内部分享和外部分享公用的类型,与SelectForwardFragment中一致 | ||
| 69 | + public static final int TYPE_SHARE_LINK = 0x2001; | ||
| 70 | + public static final int TYPE_SHARE_IMAGE = 0x2002; | ||
| 71 | + public static final int TYPE_SHARE_VIDEO = 0x2003; | ||
| 72 | + public static final int TYPE_SHARE_TEXT = 0x2004; | ||
| 73 | + public static final int TYPE_SHARE_FILE = 0x2005; | ||
| 74 | + public static final int IN_TYPE_EXT_SHARE = 0x1003; | ||
| 75 | + //聊天页面文件最大100M | ||
| 76 | + public static final int FILE_MAX_SIZE = 100 * 1024 * 1024; | ||
| 77 | + //聊天页面视频文件最大100M | ||
| 78 | + public static final int VIDEO_MAX_SIZE = 100 * 1024 * 1024; | ||
| 79 | + //聊天页面图片文件最大100M | ||
| 80 | + public static final int IMAGE_MAX_SIZE = 25 * 1024 * 1024; | ||
| 81 | + | ||
| 82 | + private File filevideo; | ||
| 83 | + private Timer timer; | ||
| 84 | + private Timer photoTimer; | ||
| 85 | + private SharedPreferences preferences; | ||
| 86 | + private boolean isQ; | ||
| 87 | + private String outTyp, action, type; | ||
| 88 | + private Bundle bundle; | ||
| 89 | + private String TEXT = "android.intent.extra.TEXT"; | ||
| 90 | + private String SUBJECT = "android.intent.extra.SUBJECT"; | ||
| 91 | + private ArrayList<String> mutil; | ||
| 92 | + | ||
| 93 | + public static void start(Context context, String tag) { | ||
| 94 | + Intent intent = new Intent(context, ShareIMActivity.class); | ||
| 95 | + intent.putExtra("type", tag); | ||
| 96 | + context.startActivity(intent); | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + @RequiresApi(api = Build.VERSION_CODES.KITKAT) | ||
| 100 | + @Override | ||
| 101 | + protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
| 102 | + super.onCreate(savedInstanceState); | ||
| 103 | + setContentView(R.layout.sharemoment); | ||
| 104 | + timer = new Timer(); | ||
| 105 | + type = getIntent().getStringExtra("type"); | ||
| 106 | + bundle = getIntent().getBundleExtra("bundle"); | ||
| 107 | + action = getIntent().getStringExtra("action"); | ||
| 108 | + mutil = getIntent().getStringArrayListExtra("mutil"); | ||
| 109 | + outTyp = getIntent().getStringExtra("outType"); | ||
| 110 | + isQ = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q; | ||
| 111 | + checkIntent(); | ||
| 112 | + | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + | ||
| 116 | + @Override | ||
| 117 | + protected void onDestroy() { | ||
| 118 | + super.onDestroy(); | ||
| 119 | + if (timer != null) timer.cancel(); | ||
| 120 | + if (photoTimer != null) photoTimer.cancel(); | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + @TargetApi(Build.VERSION_CODES.KITKAT) | ||
| 124 | + public void checkIntent() { | ||
| 125 | + if (bundle != null && action != null) { | ||
| 126 | + switch (action) { | ||
| 127 | + case Intent.ACTION_SEND: | ||
| 128 | + jumpToSend(this, bundle); | ||
| 129 | + break; | ||
| 130 | + case Intent.ACTION_SEND_MULTIPLE: | ||
| 131 | + jumpToSendMultiple(this, mutil); | ||
| 132 | + break; | ||
| 133 | + default: | ||
| 134 | + AlertUtil.showDeftToast(this, "网家家暂不支持此类型信息分享."); | ||
| 135 | + break; | ||
| 136 | + } | ||
| 137 | + } | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + | ||
| 141 | + private boolean hasPermission() { | ||
| 142 | + return PermissionChecker.checkPermissions(this | ||
| 143 | + , new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE} | ||
| 144 | + , REQUEST_CODE_PERMISSION_CAMERA, com.cnlive.media.picker.R.string.dialog_imagepicker_permission_share_message); | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + public static String processUrlData(String shareInfoUrl) { | ||
| 148 | + Uri uri = Uri.parse(shareInfoUrl); | ||
| 149 | + String[] urls = shareInfoUrl.split("\\?"); | ||
| 150 | + String url = urls[0]; | ||
| 151 | + StringBuilder pageUrl = new StringBuilder(url); | ||
| 152 | + pageUrl.append("?"); | ||
| 153 | + for (String key : uri.getQueryParameterNames()) { | ||
| 154 | + String value = UriUtil.getQueryParameterWithDecode(uri.getEncodedQuery(), key); | ||
| 155 | + pageUrl.append(key).append("=").append(Uri.encode(TextUtils.isEmpty(value) ? "" : value)).append("&"); | ||
| 156 | + } | ||
| 157 | + pageUrl = deleteCharOfEnd(pageUrl, "&", true); | ||
| 158 | + shareInfoUrl = pageUrl.toString(); | ||
| 159 | + | ||
| 160 | + return shareInfoUrl; | ||
| 161 | + } | ||
| 162 | + | ||
| 163 | + public static StringBuilder deleteCharOfEnd(StringBuilder strBud, String item, boolean asLast) { | ||
| 164 | + if (strBud == null) return null; | ||
| 165 | + int index = asLast ? strBud.lastIndexOf(item) : strBud.indexOf(item); | ||
| 166 | + if (index == strBud.length() - 1) strBud.deleteCharAt(index); | ||
| 167 | + return strBud; | ||
| 168 | + } | ||
| 169 | + | ||
| 170 | + private String path; | ||
| 171 | + private String pathVideo; | ||
| 172 | + | ||
| 173 | + @RequiresApi(api = Build.VERSION_CODES.KITKAT) | ||
| 174 | + private void jumpToSend(Context context, Bundle bundle) { | ||
| 175 | + preferences = this.getSharedPreferences("OutShare", MODE_PRIVATE); | ||
| 176 | + | ||
| 177 | + if (type == null) { | ||
| 178 | + AlertUtil.showDeftToast(this, "数据获取异常,暂不支持此机型分享."); | ||
| 179 | + killTime(); | ||
| 180 | + } | ||
| 181 | + if (type.startsWith("text/")) { | ||
| 182 | + //case "text/plain": | ||
| 183 | + String link; | ||
| 184 | + Uri textUri = "shareIM".equals(outTyp) ? Uri.parse(preferences.getString("extrastream", "")) : bundle.getParcelable(Intent.EXTRA_STREAM); | ||
| 185 | + sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, textUri)); | ||
| 186 | + if (textUri == null || TextUtils.isEmpty(textUri.toString())) { | ||
| 187 | + if ("shareIM".equals(outTyp)) { | ||
| 188 | + link = preferences.getString("extratext", ""); | ||
| 189 | + } else { | ||
| 190 | + link = bundle == null ? "" : bundle.get(TEXT).toString(); | ||
| 191 | + } | ||
| 192 | + if (!TextUtils.isEmpty(link)) { | ||
| 193 | + if (("shareIM".equals(outTyp) ? preferences.getString("android.intent.extra.SUBJECT", "") : bundle.get("android.intent.extra.SUBJECT")) != null) { | ||
| 194 | + if (("shareIM".equals(outTyp) ? preferences.getString("extratext", "") : bundle.get(TEXT)).toString().contains("http") && Objects.requireNonNull("shareIM".equals(outTyp) ? preferences.getString("extratext", "") : bundle.get(TEXT)).toString().startsWith("http")) { | ||
| 195 | + if (("shareIM".equals(outTyp) ? preferences.getString("extratext", "") : bundle.get(TEXT)).toString().contains("mp.weixin.qq.com")) { | ||
| 196 | + new Thread(new Runnable() { | ||
| 197 | + | ||
| 198 | + private String srcjs; | ||
| 199 | + private String h2; | ||
| 200 | + | ||
| 201 | + @Override | ||
| 202 | + public void run() { | ||
| 203 | + Connection connect = Jsoup.connect(Objects.requireNonNull("shareIM".equals(outTyp) ? preferences.getString("extratext", "") : bundle.get(TEXT)).toString()); | ||
| 204 | + Document document = null; | ||
| 205 | + try { | ||
| 206 | + document = connect.get(); | ||
| 207 | + } catch (IOException e) { | ||
| 208 | + e.printStackTrace(); | ||
| 209 | + } | ||
| 210 | + if (document == null) return; | ||
| 211 | + | ||
| 212 | + Elements es_img = document.getElementsByTag("img"); | ||
| 213 | + if (es_img == null || es_img.size() <= 0) return; | ||
| 214 | + for (int i = 0; i < es_img.size(); i++) { | ||
| 215 | + Element element = es_img.get(i); | ||
| 216 | + String type = element.attr("data-type"); | ||
| 217 | + if (type != null && !"gif".equals(type) && !StringUtils.isEmpty(type) && !element.attr("data-src").endsWith("gif")) { | ||
| 218 | + srcjs = element.attr("data-src"); | ||
| 219 | + break; | ||
| 220 | + } | ||
| 221 | + } | ||
| 222 | + if (TextUtils.isEmpty(srcjs)) return; | ||
| 223 | + | ||
| 224 | + Elements es_h2 = document.getElementsByTag("h2"); | ||
| 225 | + if (es_h2 != null && es_h2.size() > 0) | ||
| 226 | + h2 = es_h2.get(0).ownText(); | ||
| 227 | + if (TextUtils.isEmpty(h2)) h2 = "链接"; | ||
| 228 | + | ||
| 229 | + String rich_media_content = document.getElementsByClass("rich_media_content").get(0).toString(); | ||
| 230 | + String reg = "[^\u4e00-\u9fa5]"; | ||
| 231 | + String s = rich_media_content.replaceAll(reg, ""); | ||
| 232 | + String desc = s.substring(0, Math.min(s.length(), 40)); | ||
| 233 | + startSelectForwardActivity(context, h2 == null ? Objects.requireNonNull("shareIM".equals(outTyp) ? preferences.getString("android.intent.extra.SUBJECT", "") : bundle.get("android.intent.extra.SUBJECT")).toString() : h2, desc, srcjs == null ? AppConfig.getShareLink() : srcjs, processUrlData(Objects.requireNonNull("shareIM".equals(outTyp) ? preferences.getString("extratext", "") : bundle.get(TEXT)).toString()), TYPE_SHARE_LINK); | ||
| 234 | + finish(); | ||
| 235 | + } | ||
| 236 | + }).start(); | ||
| 237 | + } else { | ||
| 238 | + startSelectForwardActivity(context, Objects.requireNonNull("shareIM".equals(outTyp) ? preferences.getString("android.intent.extra.SUBJECT", "") : bundle.get("android.intent.extra.SUBJECT")).toString(), "", AppConfig.getShareLink(), processUrlData(Objects.requireNonNull("shareIM".equals(outTyp) ? preferences.getString("extratext", "") : bundle.get(TEXT)).toString()), TYPE_SHARE_LINK); | ||
| 239 | + finish(); | ||
| 240 | + } | ||
| 241 | + } else if (("shareIM".equals(outTyp) ? preferences.getString("extratext", "") : bundle.get(TEXT)).toString().contains("http") && !Objects.requireNonNull("shareIM".equals(outTyp) ? preferences.getString("extratext", "") : bundle.get(TEXT)).toString().startsWith("http") && !("shareIM".equals(outTyp) ? preferences.getString("extratext", "") : bundle.get(TEXT)).toString().contains("mp.weixin.qq.com")) { | ||
| 242 | + int begin = Objects.requireNonNull("shareIM".equals(outTyp) ? preferences.getString("extratext", "") : bundle.get(TEXT)).toString().indexOf("http"); | ||
| 243 | + int end = Objects.requireNonNull("shareIM".equals(outTyp) ? preferences.getString("extratext", "") : bundle.get(TEXT)).toString().length(); | ||
| 244 | + if (begin > 0 && end > 0) { | ||
| 245 | + startSelectForwardActivity(context, Objects.requireNonNull("shareIM".equals(outTyp) ? preferences.getString("extratext", "") : bundle.get(TEXT)).toString().substring(0, begin), Objects.requireNonNull("shareIM".equals(outTyp) ? preferences.getString("extratext", "") : bundle.get(TEXT)).toString().substring(0, begin), AppConfig.getShareLink(), processUrlData(Objects.requireNonNull("shareIM".equals(outTyp) ? preferences.getString("extratext", "") : bundle.get(TEXT)).toString().substring(begin, end)), TYPE_SHARE_LINK); | ||
| 246 | + finish(); | ||
| 247 | + } | ||
| 248 | + } else if (("shareIM".equals(outTyp) ? preferences.getString("extratext", "") : bundle.get(TEXT)).toString().contains("http") && !Objects.requireNonNull("shareIM".equals(outTyp) ? preferences.getString("extratext", "") : bundle.get(TEXT)).toString().startsWith("http") && ("shareIM".equals(outTyp) ? preferences.getString("extratext", "") : bundle.get(TEXT)).toString().contains("mp.weixin.qq.com")) { | ||
| 249 | + new Thread(new Runnable() { | ||
| 250 | + | ||
| 251 | + private String srcjsoup; | ||
| 252 | + private String h2; | ||
| 253 | + | ||
| 254 | + @Override | ||
| 255 | + public void run() { | ||
| 256 | + int begin = Objects.requireNonNull("shareIM".equals(outTyp) ? preferences.getString("extratext", "") : bundle.get(TEXT)).toString().indexOf("http"); | ||
| 257 | + int end = Objects.requireNonNull("shareIM".equals(outTyp) ? preferences.getString("extratext", "") : bundle.get(TEXT)).toString().length(); | ||
| 258 | + String substring = Objects.requireNonNull("shareIM".equals(outTyp) ? preferences.getString("extratext", "") : bundle.get(TEXT)).toString().substring(begin, end); | ||
| 259 | + Connection connect = Jsoup.connect(substring); | ||
| 260 | + Document document = null; | ||
| 261 | + try { | ||
| 262 | + document = connect.get(); | ||
| 263 | + } catch (IOException e) { | ||
| 264 | + e.printStackTrace(); | ||
| 265 | + } | ||
| 266 | + Elements as = document.getElementsByTag("img"); | ||
| 267 | + if (document.getElementsByTag("h2") != null) { | ||
| 268 | + if (document.getElementsByTag("h2").size() > 0) { | ||
| 269 | + h2 = document.getElementsByTag("h2").get(0).ownText(); | ||
| 270 | + } else { | ||
| 271 | + h2 = "链接"; | ||
| 272 | + } | ||
| 273 | + } else { | ||
| 274 | + h2 = "链接"; | ||
| 275 | + } | ||
| 276 | + if (as != null) { | ||
| 277 | + for (int i = 0; i < as.size(); i++) { | ||
| 278 | + Element element = as.get(i); | ||
| 279 | + String type = element.attr("data-type"); | ||
| 280 | + if (type != null && !"gif".equals(type) && !StringUtils.isEmpty(type) && !element.attr("data-src").endsWith("gif")) { | ||
| 281 | + srcjsoup = element.attr("data-src"); | ||
| 282 | + break; | ||
| 283 | + } | ||
| 284 | + } | ||
| 285 | + } | ||
| 286 | + startSelectForwardActivity(context, h2, "", srcjsoup, processUrlData(substring), TYPE_SHARE_LINK); | ||
| 287 | + finish(); | ||
| 288 | + } | ||
| 289 | + }).start(); | ||
| 290 | + } else { | ||
| 291 | + startSelectForwardActivity(context, ("shareIM".equals(outTyp) ? preferences.getString("extratext", "") : bundle.get(TEXT)) == null ? ("shareIM".equals(outTyp) ? preferences.getString("android.intent.extra.SUBJECT", "") : bundle.get("android.intent.extra.SUBJECT")).toString() : ("shareIM".equals(outTyp) ? preferences.getString("extratext", "") : bundle.get(TEXT)).toString(), TYPE_SHARE_TEXT, IN_TYPE_EXT_SHARE); | ||
| 292 | + finish(); | ||
| 293 | + } | ||
| 294 | + } else { | ||
| 295 | + if (Objects.requireNonNull("shareIM".equals(outTyp) ? preferences.getString("extratext", "") : bundle.get(TEXT)).toString().startsWith("http")) { | ||
| 296 | + startSelectForwardActivity(context, "链接", "", AppConfig.getShareLink(), processUrlData(Objects.requireNonNull("shareIM".equals(outTyp) ? preferences.getString("extratext", "") : bundle.get(TEXT)).toString()), TYPE_SHARE_LINK); | ||
| 297 | + finish(); | ||
| 298 | + } else { | ||
| 299 | + String linkcontext = Objects.requireNonNull("shareIM".equals(outTyp) ? preferences.getString("extratext", "") : bundle.get(TEXT)).toString().replaceAll("\\s*", ""); | ||
| 300 | + int end; | ||
| 301 | + int begin = linkcontext.indexOf("http"); | ||
| 302 | + if (linkcontext.contains("(")) { | ||
| 303 | + end = linkcontext.indexOf("("); | ||
| 304 | + } else { | ||
| 305 | + end = linkcontext.length(); | ||
| 306 | + } | ||
| 307 | + | ||
| 308 | + if (begin > 0 && end > 0) { | ||
| 309 | + startSelectForwardActivity(context, Objects.requireNonNull("shareIM".equals(outTyp) ? preferences.getString("extratext", "") : bundle.get(TEXT)).toString().substring(0, begin), "", AppConfig.getShareLink(), linkcontext.substring(begin, end), TYPE_SHARE_LINK); | ||
| 310 | + finish(); | ||
| 311 | + } else { | ||
| 312 | + startSelectForwardActivity(context, ("shareIM".equals(outTyp) ? preferences.getString("android.intent.extra.SUBJECT", "") : bundle.get("android.intent.extra.SUBJECT")) == null ? ("shareIM".equals(outTyp) ? preferences.getString("extratext", "") : bundle.get(TEXT)).toString() : ("shareIM".equals(outTyp) ? preferences.getString("android.intent.extra.SUBJECT", "") : bundle.get("android.intent.extra.SUBJECT")).toString() + " " + ("shareIM".equals(outTyp) ? preferences.getString("extratext", "") : bundle.get(TEXT)).toString(), TYPE_SHARE_TEXT, IN_TYPE_EXT_SHARE); | ||
| 313 | + finish(); | ||
| 314 | + } | ||
| 315 | + } | ||
| 316 | + } | ||
| 317 | + } else { | ||
| 318 | + AlertUtil.showDeftToast(this, "网家家暂不支持此类型信息分享."); | ||
| 319 | + killTime(); | ||
| 320 | + } | ||
| 321 | + } else { | ||
| 322 | + if ((textUri + "").contains("file://")) { | ||
| 323 | + String pathImg = getPath(context, textUri); | ||
| 324 | + /* photoTimer.schedule(new TimerTask() { | ||
| 325 | + @Override | ||
| 326 | + public void run() {*/ | ||
| 327 | + | ||
| 328 | + | ||
| 329 | + Uri mediaUri = MediaStore.Files.getContentUri("external"); | ||
| 330 | + | ||
| 331 | + | ||
| 332 | + String[] projection = {MediaStore.Files.FileColumns._ID, | ||
| 333 | + MediaStore.Files.FileColumns.MIME_TYPE, | ||
| 334 | + MediaStore.Files.FileColumns.DATA, | ||
| 335 | + MediaStore.Files.FileColumns.SIZE, | ||
| 336 | + MediaStore.Files.FileColumns.TITLE | ||
| 337 | + }; | ||
| 338 | + Cursor cursor = context.getContentResolver().query(mediaUri, | ||
| 339 | + projection, | ||
| 340 | + null, | ||
| 341 | + null, | ||
| 342 | + null); | ||
| 343 | + Uri uri = null; | ||
| 344 | + if (cursor != null && cursor.moveToFirst()) { | ||
| 345 | + uri = ContentUris.withAppendedId(mediaUri, | ||
| 346 | + cursor.getLong(cursor.getColumnIndex(MediaStore.Files.FileColumns._ID))); | ||
| 347 | + String fileName = textUri.toString().substring(textUri.toString().lastIndexOf("/"), textUri.toString().lastIndexOf(".")); | ||
| 348 | + String fileType = textUri.toString().substring(textUri.toString().lastIndexOf("."), textUri.toString().length()); | ||
| 349 | + String path = AndroidQUtil.copyAndroidQFile(ShareIMActivity.this, uri.toString(), StringUtils.decode(fileName) + fileType); | ||
| 350 | + // String path = getPath(context, uri); | ||
| 351 | + startSelectForwardActivity(context, path, TYPE_SHARE_FILE, IN_TYPE_EXT_SHARE); | ||
| 352 | + killTime(); | ||
| 353 | + } else { | ||
| 354 | + AlertUtil.showDeftToast(context, "媒体库中暂未找到相关资源,请从手机相册中分享"); | ||
| 355 | + } | ||
| 356 | + if (cursor != null) cursor.close(); | ||
| 357 | + /* } | ||
| 358 | + }, 5000);*/ | ||
| 359 | + } else if (AndroidQUtil.isAndroidQ() && !(textUri + "").contains("file://")) { | ||
| 360 | + String chromePath = "shareIM".equals(type) ? preferences.getString("chromePath", "") : ""; | ||
| 361 | + if (textUri.toString().contains(".") && "".equals(chromePath)) { | ||
| 362 | + String fileName = textUri.toString().substring(textUri.toString().lastIndexOf("/"), textUri.toString().lastIndexOf(".")); | ||
| 363 | + String fileType = textUri.toString().substring(textUri.toString().lastIndexOf("."), textUri.toString().length()); | ||
| 364 | + String path = AndroidQUtil.copyAndroidQFile(ShareIMActivity.this, textUri.toString(), StringUtils.decode(fileName) + fileType); | ||
| 365 | + if (path != null) { | ||
| 366 | + File file = new File(path); | ||
| 367 | + if (file.length() > FILE_MAX_SIZE) { | ||
| 368 | + AlertUtil.showDeftToast(context, "文件太大无法发送(文件大小需小于100MB)"); | ||
| 369 | + killTime(); | ||
| 370 | + } else { | ||
| 371 | + startSelectForwardActivity(context, path, TYPE_SHARE_FILE, IN_TYPE_EXT_SHARE); | ||
| 372 | + killTime(); | ||
| 373 | + } | ||
| 374 | + } else { | ||
| 375 | + AlertUtil.showDeftToast(this, "网家家暂不支持此类型信息分享."); | ||
| 376 | + killTime(); | ||
| 377 | + } | ||
| 378 | + } else if (AndroidQUtil.isAndroidQ() && textUri.toString().contains("/") && !textUri.toString().contains(".") && "".equals(chromePath)) { | ||
| 379 | + String path = getPath(context, textUri);//该路径P30拿不到文件 | ||
| 380 | + if (path != null) { | ||
| 381 | + String substring = path.substring(path.lastIndexOf("/"), path.length()); | ||
| 382 | + String pathText = AndroidQUtil.copyAndroidQFile(ShareIMActivity.this, textUri.toString(), StringUtils.decode(substring)); | ||
| 383 | + startSelectForwardActivity(context, pathText, TYPE_SHARE_FILE, IN_TYPE_EXT_SHARE); | ||
| 384 | + } else { | ||
| 385 | + AlertUtil.showDeftToast(this, "网家家暂不支持此类型信息分享."); | ||
| 386 | + return; | ||
| 387 | + } | ||
| 388 | + killTime(); | ||
| 389 | + } else if (!"".equals(chromePath)) { | ||
| 390 | + startSelectForwardActivity(context, chromePath, TYPE_SHARE_FILE, IN_TYPE_EXT_SHARE); | ||
| 391 | + } else { | ||
| 392 | + String pathText = getPath(context, textUri); | ||
| 393 | + startSelectForwardActivity(context, pathText, TYPE_SHARE_FILE, IN_TYPE_EXT_SHARE); | ||
| 394 | + killTime(); | ||
| 395 | + } | ||
| 396 | + } else { | ||
| 397 | + String pathText = getPath(context, textUri); | ||
| 398 | + startSelectForwardActivity(context, pathText, TYPE_SHARE_FILE, IN_TYPE_EXT_SHARE); | ||
| 399 | + killTime(); | ||
| 400 | + } | ||
| 401 | + } | ||
| 402 | + } else if (type.startsWith("image/")) { | ||
| 403 | + if (bundle != null && bundle.get(TEXT) != null && bundle.getParcelable(Intent.EXTRA_STREAM) == null) { | ||
| 404 | + if (bundle.get(TEXT).toString().contains("@QQ浏览器") || bundle.get(TEXT).toString().contains("html5.qq.com") || bundle.get(TEXT).toString().contains("mbrowser.baidu.com")) { | ||
| 405 | + String qqLink = bundle.get(TEXT).toString().substring(bundle.get(TEXT).toString().indexOf("http")); | ||
| 406 | + String qqTitle = bundle.get(TEXT).toString().substring(0, bundle.get(TEXT).toString().indexOf("http")); | ||
| 407 | + startSelectForwardActivity(context, qqTitle, "", AppConfig.getShareLink(), qqLink, TYPE_SHARE_LINK); | ||
| 408 | + finish(); | ||
| 409 | + } | ||
| 410 | + } else if (bundle != null && bundle.get(TEXT) == null && bundle.get("weixin_text") != null && bundle.get("weixin_text").toString().contains("liebao.cn")) { | ||
| 411 | + String weixin_text = bundle.get("weixin_text").toString().substring(bundle.get("weixin_text").toString().indexOf("http")); | ||
| 412 | + String weixin_title = bundle.get("weixin_title").toString(); | ||
| 413 | + String weixin_img_url = bundle.get("weixin_img_url").toString(); | ||
| 414 | + startSelectForwardActivity(context, weixin_title, "", weixin_img_url, weixin_text, TYPE_SHARE_LINK); | ||
| 415 | + finish(); | ||
| 416 | + } else { | ||
| 417 | + if ("image/gif".equals(type) || "image/vnd.wap.wbmp".equals(type)) { | ||
| 418 | + if (DoublePressed.onDoublePressed()) return; | ||
| 419 | + AlertUtil.showDeftToast(context, "网家家暂不支持此格式图片分享."); | ||
| 420 | + killTime(); | ||
| 421 | + } else { | ||
| 422 | + Uri imageUri = "shareIM".equals(type) ? Uri.parse(preferences.getString("extrastream", "")) : bundle.getParcelable(Intent.EXTRA_STREAM); | ||
| 423 | + sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, imageUri)); | ||
| 424 | + if (AndroidQUtil.isAndroidQ()) { | ||
| 425 | + path = AndroidQUtil.copyAndroidQFile(ShareIMActivity.this, imageUri.toString(), System.currentTimeMillis() + ".png"); | ||
| 426 | + } else { | ||
| 427 | + path = getPath(context, imageUri); | ||
| 428 | + } | ||
| 429 | + | ||
| 430 | + String fileType = FileType.getFileType(path); | ||
| 431 | + | ||
| 432 | + if (path == null && ("shareIM".equals(outTyp) ? preferences.getString("extratext", "") : bundle.get(TEXT)) == null) { | ||
| 433 | + AlertUtil.showDeftToast(context, "该文件路径不存在,无法完成分享."); | ||
| 434 | + killTime(); | ||
| 435 | + } else if ("wbmp".equals(fileType)) { | ||
| 436 | + File file = new File(path); | ||
| 437 | + if (file.length() > FILE_MAX_SIZE) { | ||
| 438 | + AlertUtil.showDeftToast(context, "文件太大无法发送(文件大小需小于100MB)"); | ||
| 439 | + killTime(); | ||
| 440 | + } else { | ||
| 441 | + startSelectForwardActivity(context, path, TYPE_SHARE_FILE, IN_TYPE_EXT_SHARE); | ||
| 442 | + killTime(); | ||
| 443 | + } | ||
| 444 | + } else if ("video".equals(fileType) || "avi".equals(fileType)) { | ||
| 445 | + filevideo = new File(path); //pic 1 video 3 | ||
| 446 | + MediaPlayer mediaPlayer = new MediaPlayer(); | ||
| 447 | + try { | ||
| 448 | + mediaPlayer.setDataSource(filevideo.getPath()); | ||
| 449 | + mediaPlayer.prepare(); | ||
| 450 | + } catch (IOException e) { | ||
| 451 | + e.printStackTrace(); | ||
| 452 | + } | ||
| 453 | + if (filevideo.length() > VIDEO_MAX_SIZE) { | ||
| 454 | + AlertUtil.showDeftToast(context, "文件太大无法发送(文件大小需小于100MB)"); | ||
| 455 | + killTime(); | ||
| 456 | + } else if (path == null) { | ||
| 457 | + AlertUtil.showDeftToast(context, "该文件路径不存在,无法完成分享."); | ||
| 458 | + killTime(); | ||
| 459 | + } else { | ||
| 460 | + startSelectForwardActivity(context, path, TYPE_SHARE_VIDEO, IN_TYPE_EXT_SHARE); | ||
| 461 | + killTime(); | ||
| 462 | + } | ||
| 463 | + } else if (path != null && ("jpg".equals(fileType) || "png".equals(fileType) || path.endsWith("png") || path.endsWith("jpg")) && !(imageUri + "").contains("com.tencent.mtt")) { | ||
| 464 | + startSelectForwardActivity(context, path, TYPE_SHARE_IMAGE, IN_TYPE_EXT_SHARE); | ||
| 465 | + killTime(); | ||
| 466 | + } else if (("shareIM".equals(outTyp) ? preferences.getString("extratext", null) : bundle.get(TEXT)) != null && | ||
| 467 | + bundle.get(TEXT) != null && !(bundle.get(TEXT) + "").contains("http")) { //腾讯文件Android Q | ||
| 468 | + photoTimer.schedule(new TimerTask() { | ||
| 469 | + @Override | ||
| 470 | + public void run() { | ||
| 471 | + | ||
| 472 | + String pathImg = getPath(context, imageUri); | ||
| 473 | + Uri mediaUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; | ||
| 474 | + | ||
| 475 | + | ||
| 476 | + String[] projection = {MediaStore.Images.Media._ID, | ||
| 477 | + MediaStore.Images.Media.DATA, | ||
| 478 | + MediaStore.Images.Media.DATE_ADDED, | ||
| 479 | + MediaStore.Images.Thumbnails.DATA | ||
| 480 | + }; | ||
| 481 | + Cursor cursor = context.getContentResolver().query(mediaUri, | ||
| 482 | + projection, | ||
| 483 | + MediaStore.Images.Media.DISPLAY_NAME + "= ?", | ||
| 484 | + new String[]{pathImg.substring(pathImg.lastIndexOf("/") + 1)}, | ||
| 485 | + null); | ||
| 486 | + Log.d("asxsaxaxsax", pathImg); | ||
| 487 | + Uri uri = null; | ||
| 488 | + if (cursor != null && cursor.moveToFirst()) { | ||
| 489 | + uri = ContentUris.withAppendedId(mediaUri, | ||
| 490 | + cursor.getLong(cursor.getColumnIndex(MediaStore.Images.Media._ID))); | ||
| 491 | + startUriAddress(context, uri); | ||
| 492 | + } else { | ||
| 493 | + AlertUtil.showDeftToast(context, "媒体库中暂未找到相关资源,请从手机相册中分享"); | ||
| 494 | + killTime(); | ||
| 495 | + } | ||
| 496 | + if (cursor != null) cursor.close(); | ||
| 497 | + } | ||
| 498 | + }, 3000); | ||
| 499 | + } else if (("shareIM".equals(outTyp) ? preferences.getString("extratext", "") : bundle.get(TEXT)) != null && | ||
| 500 | + bundle.get(TEXT) != null && (bundle.get(TEXT) + "").contains("http")) { | ||
| 501 | + String link = Objects.requireNonNull("shareIM".equals(outTyp) ? preferences.getString("extratext", "") : bundle.get(TEXT)).toString(); | ||
| 502 | + if (link.contains("http") && !link.startsWith("http")) { | ||
| 503 | + int begin = link.indexOf("http"); | ||
| 504 | + int end = link.length(); | ||
| 505 | + if (begin > 0 && end > 0) { | ||
| 506 | + // String pictext =link.substring(0, begin); | ||
| 507 | + startSelectForwardActivity(context, "我分享的图片", | ||
| 508 | + "", AppConfig.getShareLink(), processUrlData(link.substring(begin, end)), TYPE_SHARE_LINK); | ||
| 509 | + } | ||
| 510 | + killTime(); | ||
| 511 | + } | ||
| 512 | + } else if (imageUri == null) { | ||
| 513 | + AlertUtil.showDeftToast(this, "网家家暂不支持此类型信息分享."); | ||
| 514 | + killTime(); | ||
| 515 | + } else if (String.valueOf(imageUri).startsWith("content://") && !"wbmp".equals(fileType)) { | ||
| 516 | + if (("shareIM".equals(outTyp))) { | ||
| 517 | + String chromePath = preferences.getString("chromePath", ""); | ||
| 518 | + String chromeName = preferences.getString("chromeName", ""); | ||
| 519 | + long chromeLength = preferences.getLong("chromeLength", 10); | ||
| 520 | + startSelectForwardActivity(context, chromePath, TYPE_SHARE_IMAGE, IN_TYPE_EXT_SHARE); | ||
| 521 | + killTime(); | ||
| 522 | + } else { | ||
| 523 | + startUriAddress(context, imageUri); | ||
| 524 | + } | ||
| 525 | + } else { | ||
| 526 | + String pathImg = getPath(context, imageUri); | ||
| 527 | + if (pathImg != null && pathImg.endsWith("wbmp")) { | ||
| 528 | + if (path == null) { | ||
| 529 | + AlertUtil.showDeftToast(context, "该文件路径不存在,无法完成分享."); | ||
| 530 | + killTime(); | ||
| 531 | + return; | ||
| 532 | + } else { | ||
| 533 | + File file = new File(pathImg); | ||
| 534 | + if (file.length() > FILE_MAX_SIZE) { | ||
| 535 | + AlertUtil.showDeftToast(context, "文件太大无法发送(文件大小需小于100MB)"); | ||
| 536 | + killTime(); | ||
| 537 | + return; | ||
| 538 | + } else { | ||
| 539 | + startSelectForwardActivity(context, pathImg, TYPE_SHARE_FILE, IN_TYPE_EXT_SHARE); | ||
| 540 | + } | ||
| 541 | + } | ||
| 542 | + }/* else { | ||
| 543 | + ImArouterUtil.startSelectForwardActivity(context, pathImg, TYPE_SHARE_IMAGE, IN_TYPE_EXT_SHARE); //测试网络环境 | ||
| 544 | + }*/ | ||
| 545 | + killTime(); | ||
| 546 | + } | ||
| 547 | + } | ||
| 548 | + } | ||
| 549 | + } else if (type.startsWith("video/")) { | ||
| 550 | + Uri videoUri = "shareIM".equals(type) ? Uri.parse(preferences.getString("extrastream", "")) : bundle.getParcelable(Intent.EXTRA_STREAM); | ||
| 551 | + if (videoUri == null) { | ||
| 552 | + AlertUtil.showDeftToast(this, "网家家暂不支持此类型信息分享."); | ||
| 553 | + killTime(); | ||
| 554 | + return; | ||
| 555 | + } | ||
| 556 | + sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, videoUri)); | ||
| 557 | + if ((videoUri + "").contains("file://")) { | ||
| 558 | + | ||
| 559 | + String pathImg = getPath(context, videoUri); | ||
| 560 | + Uri mediaUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI; | ||
| 561 | + | ||
| 562 | + | ||
| 563 | + String[] projection = {MediaStore.Video.Media._ID, | ||
| 564 | + MediaStore.Video.Media.DATA, | ||
| 565 | + MediaStore.Video.Media.DATE_ADDED, | ||
| 566 | + MediaStore.Video.Thumbnails.DATA | ||
| 567 | + }; | ||
| 568 | + Cursor cursor = context.getContentResolver().query(mediaUri, | ||
| 569 | + projection, | ||
| 570 | + MediaStore.Video.Media.DISPLAY_NAME + "= ?", | ||
| 571 | + new String[]{pathImg.substring(pathImg.lastIndexOf("/") + 1)}, | ||
| 572 | + null); | ||
| 573 | + | ||
| 574 | + if (cursor != null && cursor.moveToFirst()) { | ||
| 575 | + videoUri = ContentUris.withAppendedId(mediaUri, | ||
| 576 | + cursor.getLong(cursor.getColumnIndex(MediaStore.Video.Media._ID))); | ||
| 577 | + | ||
| 578 | + if (AndroidQUtil.isAndroidQ()) { | ||
| 579 | + pathVideo = AndroidQUtil.copyAndroidQFile(ShareIMActivity.this, videoUri.toString(), System.currentTimeMillis() + ".mp4"); | ||
| 580 | + } else { | ||
| 581 | + pathVideo = getPath(context, videoUri); | ||
| 582 | + } | ||
| 583 | + | ||
| 584 | + if (pathVideo == null) { | ||
| 585 | + AlertUtil.showDeftToast(context, "该文件路径不存在,无法完成分享."); | ||
| 586 | + killTime(); | ||
| 587 | + } else { | ||
| 588 | + File file = new File(pathVideo); //pic 1 video 3 | ||
| 589 | + MediaPlayer mediaPlayer = new MediaPlayer(); | ||
| 590 | + try { | ||
| 591 | + mediaPlayer.setDataSource(file.getPath()); | ||
| 592 | + mediaPlayer.prepare(); | ||
| 593 | + } catch (IOException e) { | ||
| 594 | + e.printStackTrace(); | ||
| 595 | + } | ||
| 596 | + if (file.length() <= VIDEO_MAX_SIZE) { | ||
| 597 | + startSelectForwardActivity(context, pathVideo, TYPE_SHARE_VIDEO, IN_TYPE_EXT_SHARE); | ||
| 598 | + finish(); | ||
| 599 | + } else if (file.length() > VIDEO_MAX_SIZE) { | ||
| 600 | + AlertUtil.showDeftToast(context, "文件太大无法压缩发送(原文件大小需小于100MB)"); | ||
| 601 | + killTime(); | ||
| 602 | + } | ||
| 603 | + } | ||
| 604 | + } else { | ||
| 605 | + AlertUtil.showDeftToast(context, "媒体库中暂未找到相关资源,请从手机相册中分享"); | ||
| 606 | + killTime(); | ||
| 607 | + } | ||
| 608 | + if (cursor != null) cursor.close(); | ||
| 609 | + } else { | ||
| 610 | + if (AndroidQUtil.isAndroidQ()) { | ||
| 611 | + pathVideo = AndroidQUtil.copyAndroidQFile(ShareIMActivity.this, videoUri.toString(), System.currentTimeMillis() + ".mp4"); | ||
| 612 | + } else { | ||
| 613 | + pathVideo = getPath(context, videoUri); | ||
| 614 | + } | ||
| 615 | + | ||
| 616 | + if (pathVideo == null) { | ||
| 617 | + AlertUtil.showDeftToast(context, "该文件路径不存在,无法完成分享."); | ||
| 618 | + killTime(); | ||
| 619 | + } else { | ||
| 620 | + File file = new File(pathVideo); //pic 1 video 3 | ||
| 621 | + MediaPlayer mediaPlayer = new MediaPlayer(); | ||
| 622 | + try { | ||
| 623 | + mediaPlayer.setDataSource(file.getPath()); | ||
| 624 | + mediaPlayer.prepare(); | ||
| 625 | + } catch (IOException e) { | ||
| 626 | + e.printStackTrace(); | ||
| 627 | + } | ||
| 628 | + if (file.length() <= VIDEO_MAX_SIZE) { | ||
| 629 | + startSelectForwardActivity(context, pathVideo, TYPE_SHARE_VIDEO, IN_TYPE_EXT_SHARE); | ||
| 630 | + finish(); | ||
| 631 | + } else if (file.length() > VIDEO_MAX_SIZE) { | ||
| 632 | + AlertUtil.showDeftToast(context, "文件太大无法压缩发送(原文件大小需小于100MB)"); | ||
| 633 | + killTime(); | ||
| 634 | + } | ||
| 635 | + } | ||
| 636 | + } | ||
| 637 | + } else if (type.startsWith("audio/")) { | ||
| 638 | + String pathAudio; | ||
| 639 | + Uri audioUri = "shareIM".equals(type) ? Uri.parse(preferences.getString("extrastream", "")) : bundle.getParcelable(Intent.EXTRA_STREAM); | ||
| 640 | + String chromePath = "shareIM".equals(type) ? preferences.getString("chromePath", "") : ""; | ||
| 641 | + if (audioUri == null) { | ||
| 642 | + AlertUtil.showDeftToast(this, "网家家暂不支持此类型信息分享."); | ||
| 643 | + killTime(); | ||
| 644 | + } else { | ||
| 645 | + if (AndroidQUtil.isAndroidQ() && audioUri.toString().contains("/") && audioUri.toString().contains(".") && "".equals(chromePath)) { | ||
| 646 | + String fileName = audioUri.toString().substring(audioUri.toString().lastIndexOf("/"), audioUri.toString().lastIndexOf(".")); | ||
| 647 | + String fileType = audioUri.toString().substring(audioUri.toString().lastIndexOf("."), audioUri.toString().length()); | ||
| 648 | + pathAudio = AndroidQUtil.copyAndroidQFile(ShareIMActivity.this, audioUri.toString(), StringUtils.decode(fileName) + fileType); | ||
| 649 | + } else if (AndroidQUtil.isAndroidQ() && audioUri.toString().contains("/") && !audioUri.toString().contains(".") && "".equals(chromePath)) { | ||
| 650 | + String path = getPath(context, audioUri);//该路径P30拿不到文件 | ||
| 651 | + if (path != null) { | ||
| 652 | + String substring = path.substring(path.lastIndexOf("/"), path.length()); | ||
| 653 | + pathAudio = AndroidQUtil.copyAndroidQFile(ShareIMActivity.this, audioUri.toString(), StringUtils.decode(substring)); | ||
| 654 | + } else { | ||
| 655 | + AlertUtil.showDeftToast(this, "网家家暂不支持此类型信息分享."); | ||
| 656 | + killTime(); | ||
| 657 | + return; | ||
| 658 | + } | ||
| 659 | + } else if (!"".equals(chromePath)) { | ||
| 660 | + pathAudio = chromePath; | ||
| 661 | + } else { | ||
| 662 | + pathAudio = getPath(context, audioUri); | ||
| 663 | + } | ||
| 664 | + if (pathAudio != null) { | ||
| 665 | + File file = new File(pathAudio); | ||
| 666 | + if (file.length() > FILE_MAX_SIZE) { | ||
| 667 | + AlertUtil.showDeftToast(context, "文件太大无法发送(文件大小需小于100MB)"); | ||
| 668 | + killTime(); | ||
| 669 | + } else { | ||
| 670 | + startSelectForwardActivity(context, pathAudio, TYPE_SHARE_FILE, IN_TYPE_EXT_SHARE); | ||
| 671 | + finish(); | ||
| 672 | + } | ||
| 673 | + } else { | ||
| 674 | + AlertUtil.showDeftToast(this, "网家家暂不支持此类型信息分享."); | ||
| 675 | + killTime(); | ||
| 676 | + } | ||
| 677 | + } | ||
| 678 | + } else if (type.startsWith("application") || type.startsWith("*/*")) { | ||
| 679 | + String pathapi; | ||
| 680 | + String fileName = ""; | ||
| 681 | + String fileType; | ||
| 682 | + Uri aplUri = "shareIM".equals(type) ? Uri.parse(preferences.getString("extrastream", "")) : bundle.getParcelable(Intent.EXTRA_STREAM); | ||
| 683 | + String chromePath = "shareIM".equals(type) ? preferences.getString("chromePath", "") : ""; | ||
| 684 | + if (aplUri == null && "".equals(chromePath)) { | ||
| 685 | + AlertUtil.showDeftToast(this, "网家家暂不支持此类型信息分享."); | ||
| 686 | + killTime(); | ||
| 687 | + } else { | ||
| 688 | + if (AndroidQUtil.isAndroidQ() && "".equals(chromePath)) { | ||
| 689 | + if (aplUri.toString().contains(".") && aplUri.toString().contains("/") && aplUri.toString().lastIndexOf(".") > aplUri.toString().lastIndexOf("/")) { | ||
| 690 | + fileName = aplUri.toString().substring(aplUri.toString().lastIndexOf("/"), aplUri.toString().lastIndexOf(".")); | ||
| 691 | + fileType = aplUri.toString().substring(aplUri.toString().lastIndexOf("."), aplUri.toString().length()); | ||
| 692 | + pathapi = AndroidQUtil.copyAndroidQFile(ShareIMActivity.this, aplUri.toString(), StringUtils.decode(fileName) + fileType); | ||
| 693 | + } else if (aplUri.toString().contains(".") && aplUri.toString().contains("/") && aplUri.toString().lastIndexOf(".") < aplUri.toString().lastIndexOf("/")) { | ||
| 694 | + fileName = aplUri.toString().substring(aplUri.toString().lastIndexOf("/"), aplUri.toString().length()); | ||
| 695 | + pathapi = AndroidQUtil.copyAndroidQFile(ShareIMActivity.this, aplUri.toString(), StringUtils.decode(fileName)); | ||
| 696 | + } else if (aplUri.toString().contains("/") && !aplUri.toString().contains(".")) { | ||
| 697 | + String path = getPath(context, aplUri);//该路径P30拿不到文件 | ||
| 698 | + if (path != null) { | ||
| 699 | + String substring = path.substring(path.lastIndexOf("/"), path.length()); | ||
| 700 | + pathapi = AndroidQUtil.copyAndroidQFile(ShareIMActivity.this, aplUri.toString(), StringUtils.decode(substring)); | ||
| 701 | + } else { | ||
| 702 | + AlertUtil.showDeftToast(this, "网家家暂不支持此类型信息分享."); | ||
| 703 | + killTime(); | ||
| 704 | + return; | ||
| 705 | + } | ||
| 706 | + | ||
| 707 | + } else { | ||
| 708 | + AlertUtil.showDeftToast(this, "网家家暂不支持此类型信息分享."); | ||
| 709 | + killTime(); | ||
| 710 | + return; | ||
| 711 | + } | ||
| 712 | + } else if (AndroidQUtil.isAndroidQ() && !"".equals(chromePath)) { | ||
| 713 | + pathapi = chromePath; | ||
| 714 | + } else { | ||
| 715 | + if (aplUri.toString().contains("media/external")) { | ||
| 716 | + pathapi = getPath(context, aplUri); | ||
| 717 | + } else { | ||
| 718 | + pathapi = getFilePathFromURI(context, aplUri); | ||
| 719 | + } | ||
| 720 | + } | ||
| 721 | + if (pathapi != null) { | ||
| 722 | + File file = new File(pathapi); | ||
| 723 | + if (file.length() > FILE_MAX_SIZE) { | ||
| 724 | + AlertUtil.showDeftToast(context, "文件太大无法发送(文件大小需小于100MB)"); | ||
| 725 | + killTime(); | ||
| 726 | + } else { | ||
| 727 | + startSelectForwardActivity(context, pathapi, TYPE_SHARE_FILE, IN_TYPE_EXT_SHARE); | ||
| 728 | + killTime(); | ||
| 729 | + } | ||
| 730 | + } else { | ||
| 731 | + AlertUtil.showDeftToast(this, "网家家暂不支持此类型信息分享."); | ||
| 732 | + killTime(); | ||
| 733 | + } | ||
| 734 | + } | ||
| 735 | + } | ||
| 736 | + } | ||
| 737 | + | ||
| 738 | + private void killTime() { | ||
| 739 | + timer.schedule(new TimerTask() { | ||
| 740 | + @Override | ||
| 741 | + public void run() { | ||
| 742 | + finish(); | ||
| 743 | + } | ||
| 744 | + }, 5000); | ||
| 745 | + } | ||
| 746 | + | ||
| 747 | + | ||
| 748 | + /** | ||
| 749 | + * 分享调用 | ||
| 750 | + * | ||
| 751 | + * @param context | ||
| 752 | + * @param shareTitle 分享title | ||
| 753 | + * @param shareDesc 分享描述 | ||
| 754 | + * @param shareImg 分享图片地址 | ||
| 755 | + * @param shareLink 分享链接的地址 | ||
| 756 | + * @param shareType SelectForwardFragment.TYPE_SHARE_LINK | ||
| 757 | + */ | ||
| 758 | + public static void startSelectForwardActivity(Context context, String shareTitle, String shareDesc, String shareImg, String shareLink, int shareType) { | ||
| 759 | + ARouter.getInstance().build("/cnconversation/SelectForwardActivity") | ||
| 760 | + .withString("shareTitle", shareTitle) | ||
| 761 | + .withString("shareDesc", shareDesc) | ||
| 762 | + .withString("shareImg", shareImg) | ||
| 763 | + .withString("shareLink", shareLink) | ||
| 764 | + .withInt("shareType", shareType) | ||
| 765 | + .withInt("inType", 0x1002) | ||
| 766 | + .navigation(context); | ||
| 767 | + } | ||
| 768 | + | ||
| 769 | + /** | ||
| 770 | + * 分享图片,视频,文件,纯文本 | ||
| 771 | + * | ||
| 772 | + * @param context | ||
| 773 | + * @param shareLocalContent 分享的视频、图片、文件的本地路径,纯文本的内容 | ||
| 774 | + * @param shareType 分享类型,视频、文件、图片、文本 | ||
| 775 | + */ | ||
| 776 | + public static void startSelectForwardActivity(Context context, String shareLocalContent, int shareType, int inType) { | ||
| 777 | + ARouter.getInstance().build("/cnconversation/SelectForwardActivity") | ||
| 778 | + .withString("shareLocalContent", shareLocalContent) | ||
| 779 | + .withInt("shareType", shareType) | ||
| 780 | + .withInt("inType", inType) | ||
| 781 | + .navigation(context); | ||
| 782 | + } | ||
| 783 | + | ||
| 784 | + /** | ||
| 785 | + * 外部分享多张图片 | ||
| 786 | + * | ||
| 787 | + * @param context | ||
| 788 | + * @param paths 分享的多张图片的本地地址 | ||
| 789 | + * @param shareType 分享类型,图片 | ||
| 790 | + */ | ||
| 791 | + public static void startSelectForwardActivity(Context context, ArrayList<String> paths, int shareType) { | ||
| 792 | + ARouter.getInstance().build("/cnconversation/SelectForwardActivity") | ||
| 793 | + .withStringArrayList("shareLocalPathList", paths) | ||
| 794 | + .withInt("shareType", shareType) | ||
| 795 | + .withInt("inType", 0x1003) | ||
| 796 | + .navigation(context); | ||
| 797 | + } | ||
| 798 | + | ||
| 799 | + | ||
| 800 | + private void startUriAddress(Context context, Uri imageUri) { | ||
| 801 | + String path = imageUri.getPath(); | ||
| 802 | + InputStream is; | ||
| 803 | + String md5; | ||
| 804 | + int byteread; | ||
| 805 | + String extension; | ||
| 806 | + | ||
| 807 | + try { | ||
| 808 | + context.grantUriPermission(AppConfig.getAppPackeg(), imageUri, Intent.FLAG_GRANT_READ_URI_PERMISSION); | ||
| 809 | + is = context.getContentResolver().openInputStream(imageUri); | ||
| 810 | + | ||
| 811 | + //--- | ||
| 812 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); | ||
| 813 | + byte[] buffer = new byte[1024]; | ||
| 814 | + int len; | ||
| 815 | + while ((len = is.read(buffer)) > -1) { | ||
| 816 | + baos.write(buffer, 0, len); | ||
| 817 | + } | ||
| 818 | + is.close(); | ||
| 819 | + baos.flush(); | ||
| 820 | + baos.close(); | ||
| 821 | + | ||
| 822 | + InputStream stream1 = new ByteArrayInputStream(baos.toByteArray()); | ||
| 823 | + InputStream stream2 = new ByteArrayInputStream(baos.toByteArray()); | ||
| 824 | + //--- | ||
| 825 | + | ||
| 826 | + | ||
| 827 | + md5 = MD5Util.getMD5(stream1); | ||
| 828 | + stream1.close(); | ||
| 829 | + | ||
| 830 | + File appDir = new File(isQ ? this.getExternalFilesDir("") : Environment.getExternalStorageDirectory(), "strike"); | ||
| 831 | + | ||
| 832 | + if (!appDir.exists()) appDir.mkdir(); | ||
| 833 | + | ||
| 834 | + extension = FileUtil.getExtensionName(path); | ||
| 835 | + extension = TextUtils.isEmpty(extension) ? "" : ("." + extension); | ||
| 836 | + | ||
| 837 | + File file = new File(appDir, md5 + extension); | ||
| 838 | + | ||
| 839 | + FileOutputStream fs = new FileOutputStream(file); | ||
| 840 | + byte[] buffer2 = new byte[1444]; | ||
| 841 | + while ((byteread = stream2.read(buffer2)) != -1) | ||
| 842 | + fs.write(buffer2, 0, byteread); | ||
| 843 | + stream2.close(); | ||
| 844 | + String path1 = file.getPath(); | ||
| 845 | + if (file.length() > IMAGE_MAX_SIZE) { | ||
| 846 | + AlertUtil.showDeftToast(context, "文件太大无法发送(文件大小需小于25MB)"); | ||
| 847 | + killTime(); | ||
| 848 | + return; | ||
| 849 | + } else { | ||
| 850 | + startSelectForwardActivity(context, path1, TYPE_SHARE_IMAGE, IN_TYPE_EXT_SHARE); | ||
| 851 | + } | ||
| 852 | + finish(); | ||
| 853 | + //TODO 文件缓存已经完成 待优化~!! | ||
| 854 | + } catch (Exception e) { | ||
| 855 | + Log.e("ShareIM", "Exception ", e); | ||
| 856 | + } | ||
| 857 | + } | ||
| 858 | + | ||
| 859 | + | ||
| 860 | + private void jumpToSendMultiple(Context context, ArrayList<String> urilist) { | ||
| 861 | + String replace = ""; | ||
| 862 | + if (type == null || type.startsWith("*")) { | ||
| 863 | + AlertUtil.showDeftToast(this, "网家家暂不支持此类型信息分享."); | ||
| 864 | + killTime(); | ||
| 865 | + } else { | ||
| 866 | + if (type.startsWith("image/")) { | ||
| 867 | + if (("shareIM".equals(outTyp))) { | ||
| 868 | + String clipDataImg = preferences.getString("clipDataImg", ""); | ||
| 869 | + Gson gson = new Gson(); | ||
| 870 | + Type listType = new TypeToken<List<String>>() { | ||
| 871 | + }.getType(); | ||
| 872 | + ArrayList<String> dataImg = gson.fromJson(clipDataImg, listType); | ||
| 873 | + startSelectForwardActivity(context, dataImg, TYPE_SHARE_IMAGE); | ||
| 874 | + killTime(); | ||
| 875 | + } else { | ||
| 876 | + ArrayList<String> imgurilist = new ArrayList<>(); | ||
| 877 | + for (int i = 0; i < urilist.size(); i++) { | ||
| 878 | + Uri uri = Uri.parse(urilist.get(i)); | ||
| 879 | + sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, uri)); | ||
| 880 | + if ((uri + "").contains("file://")) { | ||
| 881 | + String pathImg = getPath(context, uri); | ||
| 882 | + Uri mediaUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; | ||
| 883 | + String[] projection = {MediaStore.Images.Media._ID, | ||
| 884 | + MediaStore.Images.Media.DATA, | ||
| 885 | + MediaStore.Images.Media.DATE_ADDED, | ||
| 886 | + MediaStore.Images.Thumbnails.DATA | ||
| 887 | + }; | ||
| 888 | + Cursor cursor = context.getContentResolver().query(mediaUri, | ||
| 889 | + projection, | ||
| 890 | + MediaStore.Images.Media.DISPLAY_NAME + "= ?", | ||
| 891 | + new String[]{pathImg.substring(pathImg.lastIndexOf("/") + 1)}, | ||
| 892 | + null); | ||
| 893 | + if (cursor != null && cursor.moveToFirst()) { | ||
| 894 | + uri = ContentUris.withAppendedId(mediaUri, | ||
| 895 | + cursor.getLong(cursor.getColumnIndex(MediaStore.Images.Media._ID))); | ||
| 896 | + } else { | ||
| 897 | + AlertUtil.showDeftToast(context, "媒体库中暂未找到相关资源,请从手机相册中分享"); | ||
| 898 | + } | ||
| 899 | + if (cursor != null) cursor.close(); | ||
| 900 | + } | ||
| 901 | + if (AndroidQUtil.isAndroidQ()) { | ||
| 902 | + replace = AndroidQUtil.copyAndroidQFile(ShareIMActivity.this, uri.toString(), System.currentTimeMillis() + ".png"); | ||
| 903 | + } else { | ||
| 904 | + replace = String.valueOf(uri).replace("file:///", "/"); | ||
| 905 | + } | ||
| 906 | + if (replace.startsWith("content:")) { | ||
| 907 | + String uri1 = URItoPath(replace); | ||
| 908 | + imgurilist.add(uri1); | ||
| 909 | + } else { | ||
| 910 | + imgurilist.add(replace); | ||
| 911 | + } | ||
| 912 | + } | ||
| 913 | + if (imgurilist.size() > 9) { | ||
| 914 | + AlertUtil.showDeftToast(this, "最多只能选择九张图片,请重新选择."); | ||
| 915 | + killTime(); | ||
| 916 | + } else { | ||
| 917 | + startSelectForwardActivity(context, imgurilist, TYPE_SHARE_IMAGE); | ||
| 918 | + finish(); | ||
| 919 | + } | ||
| 920 | + } | ||
| 921 | + } | ||
| 922 | + } | ||
| 923 | + } | ||
| 924 | + | ||
| 925 | + private String URItoPath(String uri) { | ||
| 926 | + Uri uri1 = Uri.parse(uri); | ||
| 927 | + String[] proj = {MediaStore.Images.Media.DATA}; | ||
| 928 | + Cursor actualimagecursor = this.managedQuery(uri1, proj, null, null, null); | ||
| 929 | + int actual_image_column_index = actualimagecursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); | ||
| 930 | + actualimagecursor.moveToFirst(); | ||
| 931 | + String img_path = actualimagecursor.getString(actual_image_column_index); | ||
| 932 | + // File file = new File(img_path); | ||
| 933 | + // Uri fileUri = Uri.fromFile(file); | ||
| 934 | + return img_path; | ||
| 935 | + } | ||
| 936 | + | ||
| 937 | + | ||
| 938 | + public static void settingPermissionActivity(Activity activity, int CODE_REQUEST_CAMERA_PERMISSIONS) { | ||
| 939 | + //判断是否为小米系统 | ||
| 940 | + if (TextUtils.equals(BrandUtils.getSystemInfo().getOs(), BrandUtils.SYS_MIUI)) { | ||
| 941 | + Intent miuiIntent = new Intent("miui.intent.action.APP_PERM_EDITOR"); | ||
| 942 | + miuiIntent.putExtra("extra_pkgname", activity.getPackageName()); | ||
| 943 | + //检测是否有能接受该Intent的Activity存在 | ||
| 944 | + List<ResolveInfo> resolveInfos = activity.getPackageManager().queryIntentActivities(miuiIntent, PackageManager.MATCH_DEFAULT_ONLY); | ||
| 945 | + if (resolveInfos.size() > 0) { | ||
| 946 | + activity.startActivityForResult(miuiIntent, CODE_REQUEST_CAMERA_PERMISSIONS); | ||
| 947 | + return; | ||
| 948 | + } | ||
| 949 | + } | ||
| 950 | + //如果不是小米系统 则打开Android系统的应用设置页 | ||
| 951 | + Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); | ||
| 952 | + Uri uri = Uri.fromParts("package", activity.getPackageName(), null); | ||
| 953 | + intent.setData(uri); | ||
| 954 | + activity.startActivityForResult(intent, CODE_REQUEST_CAMERA_PERMISSIONS); | ||
| 955 | + } | ||
| 956 | +} |
OutSide_Share/src/main/java/com/cnlive/outside_share/activity/ShareMomentActivity.java
0 → 100644
| 1 | +package com.cnlive.outside_share.activity; | ||
| 2 | + | ||
| 3 | +import android.app.Activity; | ||
| 4 | +import android.content.ContentUris; | ||
| 5 | +import android.content.Context; | ||
| 6 | +import android.content.Intent; | ||
| 7 | +import android.content.SharedPreferences; | ||
| 8 | +import android.content.pm.PackageManager; | ||
| 9 | +import android.content.pm.ResolveInfo; | ||
| 10 | +import android.database.Cursor; | ||
| 11 | +import android.graphics.Bitmap; | ||
| 12 | +import android.media.MediaPlayer; | ||
| 13 | +import android.net.Uri; | ||
| 14 | +import android.os.Build; | ||
| 15 | +import android.os.Bundle; | ||
| 16 | +import android.os.Environment; | ||
| 17 | +import android.provider.DocumentsContract; | ||
| 18 | +import android.provider.MediaStore; | ||
| 19 | +import android.provider.Settings; | ||
| 20 | +import android.text.TextUtils; | ||
| 21 | +import android.util.Log; | ||
| 22 | + | ||
| 23 | +import com.alibaba.android.arouter.facade.annotation.Route; | ||
| 24 | +import com.alibaba.android.arouter.launcher.ARouter; | ||
| 25 | +import com.bumptech.glide.Glide; | ||
| 26 | +import com.cnlive.libs.base.application.AppConfig; | ||
| 27 | +import com.cnlive.libs.base.util.AlertUtil; | ||
| 28 | +import com.cnlive.libs.base.util.DoublePressed; | ||
| 29 | +import com.cnlive.libs.base.util.MD5Util; | ||
| 30 | +import com.cnlive.libs.base.util.ShareReleaseInfoUtil; | ||
| 31 | +import com.cnlive.libs.base.util.StringUtils; | ||
| 32 | +import com.cnlive.media.picker.entity.Media; | ||
| 33 | +import com.cnlive.media.picker.utils.AndroidQUtil; | ||
| 34 | +import com.cnlive.media.picker.utils.BrandUtils; | ||
| 35 | +import com.cnlive.outside_share.R; | ||
| 36 | +import com.cnlive.outside_share.util.FileType; | ||
| 37 | +import com.cnlive.outside_share.util.FileUtil; | ||
| 38 | +import com.google.gson.Gson; | ||
| 39 | +import com.google.gson.reflect.TypeToken; | ||
| 40 | + | ||
| 41 | +import org.jsoup.Connection; | ||
| 42 | +import org.jsoup.Jsoup; | ||
| 43 | +import org.jsoup.nodes.Document; | ||
| 44 | +import org.jsoup.nodes.Element; | ||
| 45 | +import org.jsoup.select.Elements; | ||
| 46 | + | ||
| 47 | +import java.io.BufferedInputStream; | ||
| 48 | +import java.io.BufferedOutputStream; | ||
| 49 | +import java.io.ByteArrayInputStream; | ||
| 50 | +import java.io.ByteArrayOutputStream; | ||
| 51 | +import java.io.File; | ||
| 52 | +import java.io.FileOutputStream; | ||
| 53 | +import java.io.IOException; | ||
| 54 | +import java.io.InputStream; | ||
| 55 | +import java.io.OutputStream; | ||
| 56 | +import java.lang.reflect.Type; | ||
| 57 | +import java.util.ArrayList; | ||
| 58 | +import java.util.List; | ||
| 59 | +import java.util.Timer; | ||
| 60 | +import java.util.TimerTask; | ||
| 61 | +import java.util.concurrent.ExecutionException; | ||
| 62 | + | ||
| 63 | +import androidx.annotation.Nullable; | ||
| 64 | +import androidx.annotation.RequiresApi; | ||
| 65 | +import androidx.appcompat.app.AppCompatActivity; | ||
| 66 | + | ||
| 67 | +@Route(path = "/out/ShareMomentActivity") | ||
| 68 | +public class ShareMomentActivity extends AppCompatActivity { | ||
| 69 | + | ||
| 70 | + | ||
| 71 | + private File filevideo; | ||
| 72 | + private String textUri = ""; | ||
| 73 | + private String text = ""; | ||
| 74 | + private String screenShot = ""; | ||
| 75 | + private String subject = ""; | ||
| 76 | + private SharedPreferences preferences; | ||
| 77 | + private Timer timer; | ||
| 78 | + private String chromePath; | ||
| 79 | + private String chromeName; | ||
| 80 | + private long chromeLength; | ||
| 81 | + private boolean isQ; | ||
| 82 | + private String clipDataImg = ""; | ||
| 83 | + private String type, action,outTyp; | ||
| 84 | + private Bundle bundle; | ||
| 85 | + private String TEXT = "android.intent.extra.TEXT"; | ||
| 86 | + private String SUBJECT = "android.intent.extra.SUBJECT"; | ||
| 87 | + private ArrayList<String> mutil; | ||
| 88 | + | ||
| 89 | + public static void start(Context context, String type, Bundle bundle, String action, ArrayList<String> arrayList,String outType,String outTypeUri) { | ||
| 90 | + Intent intent = new Intent(context, ShareMomentActivity.class); | ||
| 91 | + intent.putExtra("type", type); | ||
| 92 | + intent.putExtra("bundle", bundle); | ||
| 93 | + intent.putExtra("action",action); | ||
| 94 | + intent.putStringArrayListExtra("mutil", arrayList); | ||
| 95 | + intent.putExtra("outType",outType); | ||
| 96 | + intent.putExtra("outTypeUri",outTypeUri); | ||
| 97 | + context.startActivity(intent); | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + | ||
| 101 | + @RequiresApi(api = Build.VERSION_CODES.KITKAT) | ||
| 102 | + @Override | ||
| 103 | + protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
| 104 | + super.onCreate(savedInstanceState); | ||
| 105 | + setContentView(R.layout.sharemoment); | ||
| 106 | + AlertUtil.showDeftToast(this,"进入页面"); | ||
| 107 | + timer = new Timer(); | ||
| 108 | + type = getIntent().getStringExtra("type"); | ||
| 109 | + bundle = getIntent().getBundleExtra("bundle"); | ||
| 110 | + action = getIntent().getStringExtra("action"); | ||
| 111 | + mutil = getIntent().getStringArrayListExtra("mutil"); | ||
| 112 | + outTyp = getIntent().getStringExtra("outType"); | ||
| 113 | + | ||
| 114 | + checkIntent(); | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + private void killTime() { | ||
| 118 | + timer.schedule(new TimerTask() { | ||
| 119 | + @Override | ||
| 120 | + public void run() { | ||
| 121 | + finish(); | ||
| 122 | + } | ||
| 123 | + }, 5000); | ||
| 124 | + } | ||
| 125 | + | ||
| 126 | + @Override | ||
| 127 | + protected void onDestroy() { | ||
| 128 | + super.onDestroy(); | ||
| 129 | + if (timer != null) timer.cancel(); | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + @RequiresApi(api = Build.VERSION_CODES.KITKAT) | ||
| 133 | + public void checkIntent() { | ||
| 134 | + if (bundle != null && action != null) { | ||
| 135 | + switch (action) { | ||
| 136 | + case Intent.ACTION_SEND: | ||
| 137 | + jumpToSend(this, type, bundle); | ||
| 138 | + break; | ||
| 139 | + case Intent.ACTION_SEND_MULTIPLE: | ||
| 140 | + jumpToSendMultiple(this, mutil); | ||
| 141 | + break; | ||
| 142 | + default: | ||
| 143 | + AlertUtil.showDeftToast(this, "网家家暂不支持此类型信息分享."); | ||
| 144 | + break; | ||
| 145 | + } | ||
| 146 | + } | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + private String getPath(String cachePath) { | ||
| 150 | + String path = (isQ ? this.getExternalFilesDir("") : Environment.getExternalStorageDirectory()) + cachePath; | ||
| 151 | + File file = new File(path); | ||
| 152 | + if (file.mkdirs()) { | ||
| 153 | + return path; | ||
| 154 | + } | ||
| 155 | + return path; | ||
| 156 | + } | ||
| 157 | + | ||
| 158 | + String pathreal = ""; | ||
| 159 | + | ||
| 160 | + @RequiresApi(api = Build.VERSION_CODES.KITKAT) | ||
| 161 | + private void jumpToSend( Context context, String type, Bundle bundle) { | ||
| 162 | + File filelogo = new File(getPath("/strike/cache/") + "sharefirst.jpg"); | ||
| 163 | + preferences = this.getSharedPreferences("OutShare", MODE_PRIVATE); | ||
| 164 | + | ||
| 165 | + if (!filelogo.exists()) { | ||
| 166 | + new Thread() { | ||
| 167 | + @Override | ||
| 168 | + public void run() { | ||
| 169 | + try { | ||
| 170 | + File first = Glide.with(context).asFile().load(AppConfig.getShareLink()).submit().get(); | ||
| 171 | + String path = first.getPath(); | ||
| 172 | + FileUtil.copyFile(path, getPath("/strike/cache/") + "sharefirst.jpg"); | ||
| 173 | + } catch (InterruptedException e) { | ||
| 174 | + e.printStackTrace(); | ||
| 175 | + } catch (ExecutionException e) { | ||
| 176 | + e.printStackTrace(); | ||
| 177 | + } | ||
| 178 | + } | ||
| 179 | + }.start(); | ||
| 180 | + } | ||
| 181 | + if (bundle == null || type == null) { | ||
| 182 | + AlertUtil.showDeftToast(this, "数据获取异常,暂不支持此机型分享."); | ||
| 183 | + killTime(); | ||
| 184 | + } else if (type.startsWith("text/")) { | ||
| 185 | + //case "text/plain": | ||
| 186 | + String link; | ||
| 187 | + | ||
| 188 | + Uri textUri = "shareMom".equals(outTyp) ? Uri.parse(preferences.getString("extrastream", "")) : (Uri) bundle.getParcelable(Intent.EXTRA_STREAM); | ||
| 189 | + if (textUri == null || TextUtils.isEmpty(textUri.toString())) { | ||
| 190 | + if ("shareMom".equals(outTyp)) { | ||
| 191 | + link = preferences.getString("extratext", ""); | ||
| 192 | + } else { | ||
| 193 | + link = bundle.get(TEXT).toString(); | ||
| 194 | + } | ||
| 195 | + | ||
| 196 | + if (!TextUtils.isEmpty(link)) { | ||
| 197 | + if (link.startsWith("http")) { | ||
| 198 | + Uri screenShot = "shareMom".equals(outTyp) ? Uri.parse(preferences.getString("share_screenshot_as_stream", "")) : (Uri) bundle.getParcelable("share_screenshot_as_stream"); | ||
| 199 | + if (screenShot == null) { | ||
| 200 | + ShareReleaseInfoUtil.ShareConfig shareConfig = ShareReleaseInfoUtil.ShareConfig.newInstance(); | ||
| 201 | + shareConfig.setType(ShareReleaseInfoUtil.TYPE_HTML); | ||
| 202 | + shareConfig.setImage(AppConfig.getShareLink()); | ||
| 203 | + shareConfig.setSubTitle(""); | ||
| 204 | + shareConfig.setTitle(("shareMom".equals(outTyp) ? preferences.getString(SUBJECT, "") : bundle.get(SUBJECT)) == null ? "链接" : "shareMom".equals(outTyp) ? preferences.getString(SUBJECT, "") : bundle.get(SUBJECT).toString()); | ||
| 205 | + shareConfig.setUrl(link); | ||
| 206 | + shareConfig.shareRelease(this); | ||
| 207 | + finish(); | ||
| 208 | + } else { | ||
| 209 | + if (link.contains("mp.weixin.qq.com")) { | ||
| 210 | + new Thread(new Runnable() { | ||
| 211 | + @Override | ||
| 212 | + public void run() { | ||
| 213 | + ShareReleaseInfoUtil.ShareConfig shareConfig = ShareReleaseInfoUtil.ShareConfig.newInstance(); | ||
| 214 | + Connection connect = Jsoup.connect(link); | ||
| 215 | + Document document = null; | ||
| 216 | + try { | ||
| 217 | + document = connect.get(); | ||
| 218 | + } catch (IOException e) { | ||
| 219 | + e.printStackTrace(); | ||
| 220 | + } | ||
| 221 | + Elements as = document.getElementsByTag("img"); | ||
| 222 | + if (document.getElementsByTag("h2") != null) { | ||
| 223 | + if (document.getElementsByTag("h2").size() > 0) { | ||
| 224 | + String h2 = document.getElementsByTag("h2").get(0).ownText(); | ||
| 225 | + shareConfig.setTitle(h2 == null ? ("shareMom".equals(outTyp) ? preferences.getString(SUBJECT, "") : bundle.get(SUBJECT)) == null ? "链接" : "shareMom".equals(outTyp) ? preferences.getString(SUBJECT, "") : bundle.get(SUBJECT).toString() : h2); | ||
| 226 | + } else { | ||
| 227 | + shareConfig.setTitle(("shareMom".equals(outTyp) ? preferences.getString(SUBJECT, "") : bundle.get(SUBJECT)) == null ? "链接" : "shareMom".equals(outTyp) ? preferences.getString(SUBJECT, "") : bundle.get(SUBJECT).toString()); | ||
| 228 | + } | ||
| 229 | + } else { | ||
| 230 | + shareConfig.setTitle(("shareMom".equals(outTyp) ? preferences.getString(SUBJECT, "") : bundle.get(SUBJECT)) == null ? "链接" : "shareMom".equals(outTyp) ? preferences.getString(SUBJECT, "") : bundle.get(SUBJECT).toString()); | ||
| 231 | + } | ||
| 232 | + if (as != null) { | ||
| 233 | + for (int i = 0; i < as.size(); i++) { | ||
| 234 | + Element element = as.get(i); | ||
| 235 | + String type = element.attr("data-type"); | ||
| 236 | + if (type != null && !"gif".equals(type) && !StringUtils.isEmpty(type) && !element.attr("data-src").endsWith("gif")) { | ||
| 237 | + String src = element.attr("data-src"); | ||
| 238 | + shareConfig.setImage(src == null ? AppConfig.getShareLink() : src); | ||
| 239 | + break; | ||
| 240 | + } | ||
| 241 | + } | ||
| 242 | + } else { | ||
| 243 | + shareConfig.setImage(AppConfig.getShareLink()); | ||
| 244 | + } | ||
| 245 | + shareConfig.setType(ShareReleaseInfoUtil.TYPE_HTML); | ||
| 246 | + shareConfig.setSubTitle(""); | ||
| 247 | + shareConfig.setUrl(link); | ||
| 248 | + shareConfig.shareRelease(context); | ||
| 249 | + finish(); | ||
| 250 | + } | ||
| 251 | + }).start(); | ||
| 252 | + } else { | ||
| 253 | + if (("shareMom".equals(outTyp))) { | ||
| 254 | + ShareReleaseInfoUtil.ShareConfig shareConfig = ShareReleaseInfoUtil.ShareConfig.newInstance(); | ||
| 255 | + shareConfig.setType(ShareReleaseInfoUtil.TYPE_HTML); | ||
| 256 | + shareConfig.setImage(AppConfig.getShareLink()); | ||
| 257 | + shareConfig.setSubTitle(""); | ||
| 258 | + shareConfig.setTitle(("shareMom".equals(outTyp) ? preferences.getString(SUBJECT, "") : bundle.get(SUBJECT)) == null ? "链接" : "shareMom".equals(outTyp) ? preferences.getString(SUBJECT, "") : bundle.get(SUBJECT).toString()); | ||
| 259 | + shareConfig.setUrl(link); | ||
| 260 | + shareConfig.shareRelease(context); | ||
| 261 | + finish(); | ||
| 262 | + } else { | ||
| 263 | + try { | ||
| 264 | + //授权Uri的读取权限 | ||
| 265 | + //若不授权,在 Android 6.0 以上测试崩溃 | ||
| 266 | + //第一个参数为需要授权的apk包名 | ||
| 267 | + grantUriPermission("com.cnlive.strike", screenShot, Intent.FLAG_GRANT_READ_URI_PERMISSION); | ||
| 268 | + //通过 Uri 获取截屏图片的输入流 | ||
| 269 | + InputStream is = getContentResolver().openInputStream(screenShot); | ||
| 270 | + int index; | ||
| 271 | + byte[] bytes = new byte[1024]; | ||
| 272 | + FileOutputStream downloadFile = new FileOutputStream(getPath("/strike/cache/") + "share.jpg"); | ||
| 273 | + while ((index = is.read(bytes)) != -1) { | ||
| 274 | + downloadFile.write(bytes, 0, index); | ||
| 275 | + downloadFile.flush(); | ||
| 276 | + } | ||
| 277 | + is.close(); | ||
| 278 | + downloadFile.close(); | ||
| 279 | + } catch (Exception e) { | ||
| 280 | + e.printStackTrace(); | ||
| 281 | + } | ||
| 282 | + ShareReleaseInfoUtil.ShareConfig shareConfig = ShareReleaseInfoUtil.ShareConfig.newInstance(); | ||
| 283 | + shareConfig.setType(ShareReleaseInfoUtil.TYPE_HTML); | ||
| 284 | + shareConfig.setImage(AppConfig.getShareLink()); | ||
| 285 | + shareConfig.setSubTitle(""); | ||
| 286 | + shareConfig.setTitle(("shareMom".equals(outTyp) ? preferences.getString(SUBJECT, "") : bundle.get(SUBJECT)) == null ? "链接" : "shareMom".equals(outTyp) ? preferences.getString(SUBJECT, "") : bundle.get(SUBJECT).toString()); | ||
| 287 | + shareConfig.setUrl(link); | ||
| 288 | + shareConfig.shareRelease(context); | ||
| 289 | + finish(); | ||
| 290 | + } | ||
| 291 | + } | ||
| 292 | + } | ||
| 293 | + } else if (!link.startsWith("http") && !link.contains("http") && link.length() > 0) { | ||
| 294 | + jumpReleaseActivity(context, new ArrayList<Media>(), 3, link, "nocircle"); | ||
| 295 | + finish(); | ||
| 296 | + } else if (link.contains("http") && !link.startsWith("http")) { | ||
| 297 | + String linkcontext = link.replaceAll("\\s*", ""); | ||
| 298 | + int end; | ||
| 299 | + int begin = linkcontext.indexOf("http"); | ||
| 300 | + if (linkcontext.contains("(")) { | ||
| 301 | + end = linkcontext.indexOf("("); | ||
| 302 | + } else { | ||
| 303 | + end = linkcontext.length(); | ||
| 304 | + } | ||
| 305 | + String file = getIntent().getExtras().getString("file"); | ||
| 306 | + FileUtil.copyFile(file, getPath("/strike/cache/") + "share.jpg"); | ||
| 307 | + ShareReleaseInfoUtil.ShareConfig shareConfig = ShareReleaseInfoUtil.ShareConfig.newInstance(); | ||
| 308 | + shareConfig.setType(ShareReleaseInfoUtil.TYPE_HTML); | ||
| 309 | + String jsouplink = linkcontext.substring(begin, end); | ||
| 310 | + if (jsouplink.contains("mp.weixin.qq.com")) { | ||
| 311 | + new Thread(new Runnable() { | ||
| 312 | + @Override | ||
| 313 | + public void run() { | ||
| 314 | + Connection connect = Jsoup.connect(jsouplink); | ||
| 315 | + Document document = null; | ||
| 316 | + try { | ||
| 317 | + document = connect.get(); | ||
| 318 | + } catch (IOException e) { | ||
| 319 | + e.printStackTrace(); | ||
| 320 | + } | ||
| 321 | + Elements as = document.getElementsByTag("img"); | ||
| 322 | + if (document.getElementsByTag("h2") != null) { | ||
| 323 | + if (document.getElementsByTag("h2").size() > 0) { | ||
| 324 | + String h2 = document.getElementsByTag("h2").get(0).ownText(); | ||
| 325 | + shareConfig.setTitle(h2 == null ? ("shareMom".equals(outTyp) ? preferences.getString(SUBJECT, "") : bundle.get(SUBJECT)) == null ? link.substring(0, begin) : "shareMom".equals(outTyp) ? preferences.getString(SUBJECT, "") : bundle.get(SUBJECT).toString() : h2); | ||
| 326 | + } else { | ||
| 327 | + shareConfig.setTitle(("shareMom".equals(outTyp) ? preferences.getString(SUBJECT, "") : bundle.get(SUBJECT)) == null ? link.substring(0, begin) : "shareMom".equals(outTyp) ? preferences.getString(SUBJECT, "") : bundle.get(SUBJECT).toString()); | ||
| 328 | + } | ||
| 329 | + } else { | ||
| 330 | + shareConfig.setTitle(("shareMom".equals(outTyp) ? preferences.getString(SUBJECT, "") : bundle.get(SUBJECT)) == null ? link.substring(0, begin) : "shareMom".equals(outTyp) ? preferences.getString(SUBJECT, "") : bundle.get(SUBJECT).toString()); | ||
| 331 | + } | ||
| 332 | + if (as != null) { | ||
| 333 | + for (int i = 0; i < as.size(); i++) { | ||
| 334 | + Element element = as.get(i); | ||
| 335 | + String type = element.attr("data-type"); | ||
| 336 | + if (type != null && !"gif".equals(type) && !StringUtils.isEmpty(type) && !element.attr("data-src").endsWith("gif")) { | ||
| 337 | + String src = element.attr("data-src"); | ||
| 338 | + shareConfig.setImage(src == null ? AppConfig.getShareLink() : src); | ||
| 339 | + break; | ||
| 340 | + } | ||
| 341 | + } | ||
| 342 | + } else { | ||
| 343 | + shareConfig.setImage(AppConfig.getShareLink()); | ||
| 344 | + } | ||
| 345 | + shareConfig.setSubTitle(""); | ||
| 346 | + shareConfig.setUrl(jsouplink); | ||
| 347 | + shareConfig.shareRelease(context); | ||
| 348 | + finish(); | ||
| 349 | + } | ||
| 350 | + }).start(); | ||
| 351 | + } else { | ||
| 352 | + shareConfig.setImage(AppConfig.getShareLink()); | ||
| 353 | + shareConfig.setSubTitle(""); | ||
| 354 | + shareConfig.setTitle(link.substring(0, begin)); | ||
| 355 | + shareConfig.setUrl(jsouplink); | ||
| 356 | + shareConfig.shareRelease(context); | ||
| 357 | + finish(); | ||
| 358 | + } | ||
| 359 | + } else { | ||
| 360 | + AlertUtil.showDeftToast(this, "网家家暂不支持此类型信息分享."); | ||
| 361 | + killTime(); | ||
| 362 | + } | ||
| 363 | + } else { | ||
| 364 | + AlertUtil.showDeftToast(this, "网家家暂不支持此类型信息分享."); | ||
| 365 | + killTime(); | ||
| 366 | + } | ||
| 367 | + } else { | ||
| 368 | + AlertUtil.showDeftToast(this, "网家家暂不支持此类型信息分享"); | ||
| 369 | + killTime(); | ||
| 370 | + } | ||
| 371 | + } else if (type.startsWith("image/")) { | ||
| 372 | + //兼容QQ浏览器链接类型 | ||
| 373 | + if (bundle.get(TEXT) != null && bundle.getParcelable(Intent.EXTRA_STREAM) == null) { | ||
| 374 | + if (bundle.get(TEXT).toString().contains("@QQ浏览器") || bundle.get(TEXT).toString().contains("html5.qq.com") || bundle.get(TEXT).toString().contains("mbrowser.baidu.com")) { | ||
| 375 | + String qqLink = bundle.get(TEXT).toString().substring(bundle.get(TEXT).toString().indexOf("http")); | ||
| 376 | + String qqTitle = bundle.get(TEXT).toString().substring(0, bundle.get(TEXT).toString().indexOf("http")); | ||
| 377 | + Uri imageUri = "shareMom".equals(outTyp) ? Uri.parse(preferences.getString("extrastream", "")) : bundle.getParcelable(Intent.EXTRA_STREAM); | ||
| 378 | + //String qqPic = getPath(context, imageUri); | ||
| 379 | + ShareReleaseInfoUtil.ShareConfig shareConfig = ShareReleaseInfoUtil.ShareConfig.newInstance(); | ||
| 380 | + shareConfig.setType(ShareReleaseInfoUtil.TYPE_HTML); | ||
| 381 | + shareConfig.setImage(AppConfig.getShareLink()); | ||
| 382 | + shareConfig.setSubTitle(""); | ||
| 383 | + shareConfig.setTitle(qqTitle); | ||
| 384 | + shareConfig.setUrl(qqLink); | ||
| 385 | + shareConfig.shareRelease(context); | ||
| 386 | + finish(); | ||
| 387 | + } | ||
| 388 | + } else if (bundle.get(TEXT) == null && bundle.get("weixin_text") != null && bundle.get("weixin_text").toString().contains("liebao.cn")) { | ||
| 389 | + String weixin_text = bundle.get("weixin_text").toString().substring(bundle.get("weixin_text").toString().indexOf("http")); | ||
| 390 | + String weixin_title = bundle.get("weixin_title").toString(); | ||
| 391 | + String weixin_img_url = bundle.get("weixin_img_url").toString(); | ||
| 392 | + ShareReleaseInfoUtil.ShareConfig shareConfig = ShareReleaseInfoUtil.ShareConfig.newInstance(); | ||
| 393 | + shareConfig.setType(ShareReleaseInfoUtil.TYPE_HTML); | ||
| 394 | + shareConfig.setImage(weixin_img_url); | ||
| 395 | + shareConfig.setSubTitle(""); | ||
| 396 | + shareConfig.setTitle(weixin_title); | ||
| 397 | + shareConfig.setUrl(weixin_text); | ||
| 398 | + shareConfig.shareRelease(context); | ||
| 399 | + finish(); | ||
| 400 | + } else { | ||
| 401 | + Uri imageUri = "shareMom".equals(outTyp) ? Uri.parse(preferences.getString("extrastream", "")) : bundle.getParcelable(Intent.EXTRA_STREAM); | ||
| 402 | + if ("image/gif".equals(type) || "image/vnd.wap.wbmp".equals(type) || imageUri == null) { | ||
| 403 | + if (DoublePressed.onDoublePressed()) return; | ||
| 404 | + AlertUtil.showDeftToast(context, "网家家暂不支持此格式图片分享."); | ||
| 405 | + killTime(); | ||
| 406 | + } else { | ||
| 407 | + sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, imageUri)); | ||
| 408 | + String pathreal = getPath(context, imageUri); | ||
| 409 | + String fileType = FileType.getFileType(pathreal); | ||
| 410 | + if ("wbmp".equals(fileType)) { | ||
| 411 | + AlertUtil.showDeftToast(context, "网家家暂不支持此格式图片分享."); | ||
| 412 | + killTime(); | ||
| 413 | + } else if ("video".equals(fileType) || "avi".equals(fileType)) { | ||
| 414 | + filevideo = new File(pathreal); //pic 1 video 3 | ||
| 415 | + MediaPlayer mediaPlayer = new MediaPlayer(); | ||
| 416 | + try { | ||
| 417 | + mediaPlayer.setDataSource(filevideo.getPath()); | ||
| 418 | + mediaPlayer.prepare(); | ||
| 419 | + } catch (IOException e) { | ||
| 420 | + e.printStackTrace(); | ||
| 421 | + } | ||
| 422 | + long time = mediaPlayer.getDuration(); | ||
| 423 | + if (time > 10 * 60 * 1000) { | ||
| 424 | + AlertUtil.showDeftToast(context, "视频时长最大只支持10钟,请压缩或剪切后上传"); | ||
| 425 | + killTime(); | ||
| 426 | + } else { | ||
| 427 | + ArrayList<Media> medialist = new ArrayList<>(); | ||
| 428 | + Media media = new Media(filevideo.getPath(), filevideo.getName(), 1, 3, filevideo.length(), 0, "", (int) time, ""); | ||
| 429 | + medialist.add(media); | ||
| 430 | + jumpReleaseActivity(context, medialist, 3, "", "nocircle"); | ||
| 431 | + finish(); | ||
| 432 | + } | ||
| 433 | + } else if (("jpg".equals(fileType) || "png".equals(fileType)) && !(imageUri + "").contains("com.tencent.mtt")) { | ||
| 434 | + File file = new File(pathreal); //pic 1 video 3 | ||
| 435 | + ArrayList<Media> medialist = new ArrayList<>(); | ||
| 436 | + Media media = new Media(file.getPath(), file.getName(), 1, 1, file.length(), 0, "", ""); | ||
| 437 | + medialist.add(media); | ||
| 438 | + jumpReleaseActivity(context, medialist, 3, "", "nocircle"); | ||
| 439 | + finish(); | ||
| 440 | + } else if (("shareMom".equals(outTyp) ? preferences.getString("extratext", null) : bundle.get(TEXT)) != null && | ||
| 441 | + bundle.get(TEXT) != null && !(bundle.get(TEXT) + "").contains("http")) { //腾讯文件Android Q | ||
| 442 | + String pathImg = getPath(context, imageUri); | ||
| 443 | + Uri mediaUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; | ||
| 444 | + | ||
| 445 | + | ||
| 446 | + String[] projection = {MediaStore.Images.Media._ID, | ||
| 447 | + MediaStore.Images.Media.DATA, | ||
| 448 | + MediaStore.Images.Media.DATE_ADDED, | ||
| 449 | + MediaStore.Images.Thumbnails.DATA | ||
| 450 | + }; | ||
| 451 | + Cursor cursor = context.getContentResolver().query(mediaUri, | ||
| 452 | + projection, | ||
| 453 | + MediaStore.Images.Media.DISPLAY_NAME + "= ?", | ||
| 454 | + new String[]{pathImg.substring(pathImg.lastIndexOf("/") + 1)}, | ||
| 455 | + null); | ||
| 456 | + | ||
| 457 | + Uri uri = null; | ||
| 458 | + if (cursor != null && cursor.moveToFirst()) { | ||
| 459 | + uri = ContentUris.withAppendedId(mediaUri, | ||
| 460 | + cursor.getLong(cursor.getColumnIndex(MediaStore.Images.Media._ID))); | ||
| 461 | + startUriAddress(context, uri); | ||
| 462 | + } else { | ||
| 463 | + AlertUtil.showDeftToast(context, "媒体库中暂未找到相关资源,请从手机相册中分享"); | ||
| 464 | + killTime(); | ||
| 465 | + } | ||
| 466 | + if (cursor != null) cursor.close(); | ||
| 467 | + } else if (("shareMom".equals(outTyp) ? preferences.getString("extratext", null) : bundle.get(TEXT)) != null && | ||
| 468 | + bundle.get(TEXT) != null && (bundle.get(TEXT) + "").contains("http")) { // Q浏览器分享图片类型 | ||
| 469 | + String link = "shareMom".equals(outTyp) ? preferences.getString("extratext", "") : bundle.get(TEXT).toString(); | ||
| 470 | + if (link.contains("http") && !link.startsWith("http")) { | ||
| 471 | + int begin = link.indexOf("http"); | ||
| 472 | + int end = link.length(); | ||
| 473 | + // if (imageUri.toString().contains("QQBrowser") && imageUri.toString().endsWith(".png")) { | ||
| 474 | + FileUtil.copyFile(imageUri.toString(), getPath("/strike/cache/") + "share.jpg"); | ||
| 475 | + // } | ||
| 476 | + ShareReleaseInfoUtil.ShareConfig shareConfig = ShareReleaseInfoUtil.ShareConfig.newInstance(); | ||
| 477 | + shareConfig.setType(ShareReleaseInfoUtil.TYPE_HTML); | ||
| 478 | + shareConfig.setImage(AppConfig.getShareLink()); | ||
| 479 | + shareConfig.setSubTitle(""); | ||
| 480 | + shareConfig.setTitle("我分享的图片"); | ||
| 481 | + shareConfig.setUrl(link.substring(begin, end)); | ||
| 482 | + shareConfig.shareRelease(context); | ||
| 483 | + finish(); | ||
| 484 | + } | ||
| 485 | + } else if (imageUri == null) { | ||
| 486 | + AlertUtil.showDeftToast(this, "网家家暂不支持此类型信息分享."); | ||
| 487 | + killTime(); | ||
| 488 | + } else if (String.valueOf(imageUri).startsWith("content://")) { | ||
| 489 | + if (("shareMom".equals(outTyp))) { | ||
| 490 | + String chromePath = preferences.getString("chromePath", ""); | ||
| 491 | + String chromeName = preferences.getString("chromeName", ""); | ||
| 492 | + long chromeLength = preferences.getLong("chromeLength", 10); | ||
| 493 | + ArrayList<Media> medialist = new ArrayList<>(); | ||
| 494 | + Media media = new Media(chromePath, chromeName, 1, 1, chromeLength, 0, "", ""); | ||
| 495 | + medialist.add(media); | ||
| 496 | + jumpReleaseActivity(context, medialist, 3, "", "nocircle"); | ||
| 497 | + killTime(); | ||
| 498 | + } else { | ||
| 499 | + startUriAddress(context, imageUri); | ||
| 500 | + } | ||
| 501 | + } else { | ||
| 502 | + String pathImg = getPath(context, imageUri); | ||
| 503 | + if (pathImg == null && !imageUri.toString().contains("QQBrowser") && !imageUri.toString().endsWith(".png")) { | ||
| 504 | + AlertUtil.showDeftToast(this, "网家家暂不支持此类型信息分享."); | ||
| 505 | + killTime(); | ||
| 506 | + } else { | ||
| 507 | + if (pathImg != null && pathImg.endsWith("wbmp")) { | ||
| 508 | + AlertUtil.showDeftToast(this, "网家家暂不支持此格式图片分享."); | ||
| 509 | + killTime(); | ||
| 510 | + } else { | ||
| 511 | + File file = new File(pathImg); //pic 1 video 3 | ||
| 512 | + ArrayList<Media> medialist = new ArrayList<>(); | ||
| 513 | + Media media = new Media(file.getPath(), file.getName(), 1, 1, file.length(), 0, "", ""); | ||
| 514 | + medialist.add(media); | ||
| 515 | + jumpReleaseActivity(context, medialist, 3, "", "nocircle"); | ||
| 516 | + finish(); | ||
| 517 | + } | ||
| 518 | + } | ||
| 519 | + } | ||
| 520 | + } | ||
| 521 | + } | ||
| 522 | + | ||
| 523 | + } else if (type.startsWith("video/")) { | ||
| 524 | + Uri videoUri = "shareMom".equals(outTyp) ? Uri.parse(preferences.getString("extrastream", "")) : bundle.getParcelable(Intent.EXTRA_STREAM); | ||
| 525 | + if (videoUri == null) { | ||
| 526 | + AlertUtil.showDeftToast(this, "网家家暂不支持此类型信息分享."); | ||
| 527 | + killTime(); | ||
| 528 | + } else { | ||
| 529 | + sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, videoUri)); | ||
| 530 | + if ((videoUri + "").contains("file://")) { | ||
| 531 | + | ||
| 532 | + String pathImg = getPath(context, videoUri); | ||
| 533 | + Uri mediaUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI; | ||
| 534 | + | ||
| 535 | + | ||
| 536 | + String[] projection = {MediaStore.Video.Media._ID, | ||
| 537 | + MediaStore.Video.Media.DATA, | ||
| 538 | + MediaStore.Video.Media.DATE_ADDED, | ||
| 539 | + MediaStore.Video.Thumbnails.DATA | ||
| 540 | + }; | ||
| 541 | + Cursor cursor = context.getContentResolver().query(mediaUri, | ||
| 542 | + projection, | ||
| 543 | + MediaStore.Video.Media.DISPLAY_NAME + "= ?", | ||
| 544 | + new String[]{pathImg.substring(pathImg.lastIndexOf("/") + 1)}, | ||
| 545 | + null); | ||
| 546 | + | ||
| 547 | + //Uri uriQ = null; | ||
| 548 | + if (cursor != null && cursor.moveToFirst()) { | ||
| 549 | + videoUri = ContentUris.withAppendedId(mediaUri, | ||
| 550 | + cursor.getLong(cursor.getColumnIndex(MediaStore.Video.Media._ID))); | ||
| 551 | + } else { | ||
| 552 | + AlertUtil.showDeftToast(context, "媒体库中暂未找到相关资源,请从手机相册中分享"); | ||
| 553 | + killTime(); | ||
| 554 | + } | ||
| 555 | + if (cursor != null) cursor.close(); | ||
| 556 | + } | ||
| 557 | + | ||
| 558 | + if (AndroidQUtil.isAndroidQ()) { | ||
| 559 | + pathreal = AndroidQUtil.copyAndroidQFile(ShareMomentActivity.this, videoUri.toString(), System.currentTimeMillis() + ".mp4"); | ||
| 560 | + } else { | ||
| 561 | + pathreal = getPath(context, videoUri); | ||
| 562 | + } | ||
| 563 | + if (!StringUtils.isEmpty(pathreal)) { | ||
| 564 | + filevideo = new File(pathreal); //pic 1 video 3 | ||
| 565 | + MediaPlayer mediaPlayer = new MediaPlayer(); | ||
| 566 | + try { | ||
| 567 | + mediaPlayer.setDataSource(filevideo.getPath()); | ||
| 568 | + mediaPlayer.prepare(); | ||
| 569 | + } catch (IOException e) { | ||
| 570 | + e.printStackTrace(); | ||
| 571 | + } | ||
| 572 | + long time = mediaPlayer.getDuration(); | ||
| 573 | + if (time > 10 * 60 * 1000) { | ||
| 574 | + AlertUtil.showDeftToast(context, "视频时长最大只支持10分钟,请压缩或剪切后上传"); | ||
| 575 | + killTime(); | ||
| 576 | + } else { | ||
| 577 | + ArrayList<Media> medialist = new ArrayList<>(); | ||
| 578 | + Media media = new Media(filevideo.getPath(), filevideo.getName(), 1, 3, filevideo.length(), 0, "", (int) time, ""); | ||
| 579 | + medialist.add(media); | ||
| 580 | + jumpReleaseActivity(context, medialist, 3, "", "nocircle"); | ||
| 581 | + finish(); | ||
| 582 | + } | ||
| 583 | + } else { | ||
| 584 | + AlertUtil.showDeftToast(this, "网家家暂不支持此类型信息分享."); | ||
| 585 | + killTime(); | ||
| 586 | + } | ||
| 587 | + } | ||
| 588 | + } else { | ||
| 589 | + AlertUtil.showDeftToast(this, "网家家暂不支持此类型信息分享."); | ||
| 590 | + killTime(); | ||
| 591 | + } | ||
| 592 | + } | ||
| 593 | + | ||
| 594 | + | ||
| 595 | + private void startUriAddress(Context context, Uri imageUri) { | ||
| 596 | + String path = imageUri.getPath(); | ||
| 597 | + Bitmap bitmap; | ||
| 598 | + InputStream is = null; | ||
| 599 | + String md5 = null; | ||
| 600 | + int byteread = 0; | ||
| 601 | + String extension; | ||
| 602 | + | ||
| 603 | + try { | ||
| 604 | + context.grantUriPermission(AppConfig.getAppPackeg(), imageUri, Intent.FLAG_GRANT_READ_URI_PERMISSION); | ||
| 605 | + is = context.getContentResolver().openInputStream(imageUri); | ||
| 606 | + | ||
| 607 | + //--- | ||
| 608 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); | ||
| 609 | + byte[] buffer = new byte[1024]; | ||
| 610 | + int len; | ||
| 611 | + while ((len = is.read(buffer)) > -1) { | ||
| 612 | + baos.write(buffer, 0, len); | ||
| 613 | + } | ||
| 614 | + is.close(); | ||
| 615 | + baos.flush(); | ||
| 616 | + baos.close(); | ||
| 617 | + | ||
| 618 | + InputStream stream1 = new ByteArrayInputStream(baos.toByteArray()); | ||
| 619 | + InputStream stream2 = new ByteArrayInputStream(baos.toByteArray()); | ||
| 620 | + //--- | ||
| 621 | + | ||
| 622 | + | ||
| 623 | + md5 = MD5Util.getMD5(stream1); | ||
| 624 | + stream1.close(); | ||
| 625 | + | ||
| 626 | + File appDir = new File(isQ ? this.getExternalFilesDir("") : Environment.getExternalStorageDirectory(), "strike"); | ||
| 627 | + | ||
| 628 | + if (!appDir.exists()) appDir.mkdir(); | ||
| 629 | + | ||
| 630 | + extension = FileUtil.getExtensionName(path); | ||
| 631 | + extension = TextUtils.isEmpty(extension) ? "" : ("." + extension); | ||
| 632 | + | ||
| 633 | + File file = new File(appDir, md5 + extension); | ||
| 634 | + | ||
| 635 | + FileOutputStream fs = new FileOutputStream(file); | ||
| 636 | + byte[] buffer2 = new byte[1444]; | ||
| 637 | + while ((byteread = stream2.read(buffer2)) != -1) | ||
| 638 | + fs.write(buffer2, 0, byteread); | ||
| 639 | + stream2.close(); | ||
| 640 | + ArrayList<Media> medialist = new ArrayList<>(); | ||
| 641 | + if (file.getPath().endsWith("wbmp")) { | ||
| 642 | + AlertUtil.showDeftToast(this, "网家家暂不支持此格式图片分享."); | ||
| 643 | + killTime(); | ||
| 644 | + } else { | ||
| 645 | + Media media = new Media(file.getPath(), file.getName(), 1, 1, file.length(), 0, "", ""); | ||
| 646 | + medialist.add(media); | ||
| 647 | + jumpReleaseActivity(context, medialist, 3, "", "nocircle"); | ||
| 648 | + killTime(); | ||
| 649 | + } | ||
| 650 | + } catch (Exception e) { | ||
| 651 | + Log.e("ShareMoment", "Exception ", e); | ||
| 652 | + } | ||
| 653 | + } | ||
| 654 | + | ||
| 655 | + | ||
| 656 | + public static void settingPermissionActivity(Activity activity, int CODE_REQUEST_CAMERA_PERMISSIONS) { | ||
| 657 | + //判断是否为小米系统 | ||
| 658 | + if (TextUtils.equals(BrandUtils.getSystemInfo().getOs(), BrandUtils.SYS_MIUI)) { | ||
| 659 | + Intent miuiIntent = new Intent("miui.intent.action.APP_PERM_EDITOR"); | ||
| 660 | + miuiIntent.putExtra("extra_pkgname", activity.getPackageName()); | ||
| 661 | + //检测是否有能接受该Intent的Activity存在 | ||
| 662 | + List<ResolveInfo> resolveInfos = activity.getPackageManager().queryIntentActivities(miuiIntent, PackageManager.MATCH_DEFAULT_ONLY); | ||
| 663 | + if (resolveInfos.size() > 0) { | ||
| 664 | + activity.startActivityForResult(miuiIntent, CODE_REQUEST_CAMERA_PERMISSIONS); | ||
| 665 | + return; | ||
| 666 | + } | ||
| 667 | + } | ||
| 668 | + //如果不是小米系统 则打开Android系统的应用设置页 | ||
| 669 | + Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); | ||
| 670 | + Uri uri = Uri.fromParts("package", activity.getPackageName(), null); | ||
| 671 | + intent.setData(uri); | ||
| 672 | + activity.startActivityForResult(intent, CODE_REQUEST_CAMERA_PERMISSIONS); | ||
| 673 | + } | ||
| 674 | + | ||
| 675 | + public static String getFilePathFromURI(Context context, Uri contentUri) { | ||
| 676 | + String fileName = getFileName(contentUri); | ||
| 677 | + if (!TextUtils.isEmpty(fileName)) { | ||
| 678 | + File copyFile = new File(getRealPath(context, "/strike/cache/") + fileName); | ||
| 679 | + copy(context, contentUri, copyFile); | ||
| 680 | + return copyFile.getAbsolutePath(); | ||
| 681 | + } | ||
| 682 | + return null; | ||
| 683 | + } | ||
| 684 | + | ||
| 685 | + public void jumpReleaseActivity(Context context, ArrayList<Media> select, int type, String content, String isCircle) { | ||
| 686 | + if (select == null || select.size() == 0) return; | ||
| 687 | + else { | ||
| 688 | + ARouter.getInstance().build("/cnmain/ReleaseManagementAcityity") | ||
| 689 | + .withParcelableArrayList("select", select) | ||
| 690 | + .withInt("type", type) | ||
| 691 | + .withString("content", content) | ||
| 692 | + .withString("isCircle", isCircle) | ||
| 693 | + .navigation(context); | ||
| 694 | + } | ||
| 695 | + } | ||
| 696 | + | ||
| 697 | + private static String getRealPath(Context context, String cachePath) { | ||
| 698 | + String path = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q ? context.getExternalFilesDir("") : Environment.getExternalStorageDirectory()) + cachePath; | ||
| 699 | + File file = new File(path); | ||
| 700 | + if (file.mkdirs()) { | ||
| 701 | + return path; | ||
| 702 | + } | ||
| 703 | + return path; | ||
| 704 | + } | ||
| 705 | + | ||
| 706 | + public static String getFileName(Uri uri) { | ||
| 707 | + if (uri == null) return null; | ||
| 708 | + String fileName = null; | ||
| 709 | + String path = uri.getPath(); | ||
| 710 | + int cut = path.lastIndexOf('/'); | ||
| 711 | + if (cut != -1) { | ||
| 712 | + fileName = path.substring(cut + 1); | ||
| 713 | + } | ||
| 714 | + return fileName; | ||
| 715 | + } | ||
| 716 | + | ||
| 717 | + public static void copy(Context context, Uri srcUri, File dstFile) { | ||
| 718 | + try { | ||
| 719 | + InputStream inputStream = context.getContentResolver().openInputStream(srcUri); | ||
| 720 | + if (inputStream == null) return; | ||
| 721 | + OutputStream outputStream = new FileOutputStream(dstFile); | ||
| 722 | + copyy(inputStream, outputStream); | ||
| 723 | + inputStream.close(); | ||
| 724 | + outputStream.close(); | ||
| 725 | + } catch (IOException e) { | ||
| 726 | + e.printStackTrace(); | ||
| 727 | + } catch (Exception e) { | ||
| 728 | + e.printStackTrace(); | ||
| 729 | + } | ||
| 730 | + } | ||
| 731 | + | ||
| 732 | + public static int copyy(InputStream input, OutputStream output) throws Exception, IOException { | ||
| 733 | + byte[] buffer = new byte[1024 * 2]; | ||
| 734 | + | ||
| 735 | + BufferedInputStream in = new BufferedInputStream(input, 1024 * 2); | ||
| 736 | + BufferedOutputStream out = new BufferedOutputStream(output, 1024 * 2); | ||
| 737 | + int count = 0, n = 0; | ||
| 738 | + try { | ||
| 739 | + while ((n = in.read(buffer, 0, 1024 * 2)) != -1) { | ||
| 740 | + out.write(buffer, 0, n); | ||
| 741 | + count += n; | ||
| 742 | + } | ||
| 743 | + out.flush(); | ||
| 744 | + } finally { | ||
| 745 | + try { | ||
| 746 | + out.close(); | ||
| 747 | + } catch (IOException e) { | ||
| 748 | + Log.e(e.getMessage(), String.valueOf(e)); | ||
| 749 | + } | ||
| 750 | + try { | ||
| 751 | + in.close(); | ||
| 752 | + } catch (IOException e) { | ||
| 753 | + Log.e(e.getMessage(), String.valueOf(e)); | ||
| 754 | + } | ||
| 755 | + } | ||
| 756 | + return count; | ||
| 757 | + } | ||
| 758 | + | ||
| 759 | + | ||
| 760 | + @RequiresApi(api = Build.VERSION_CODES.KITKAT) | ||
| 761 | + public static String getPath(Context context, Uri uri) { | ||
| 762 | + | ||
| 763 | + final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;//sdk版本是否大于4.4 | ||
| 764 | + | ||
| 765 | + // DocumentProvider | ||
| 766 | + if (uri != null && isKitKat && DocumentsContract.isDocumentUri(context, uri)) { | ||
| 767 | + // ExternalStorageProvider | ||
| 768 | + if (isExternalStorageDocument(uri)) { | ||
| 769 | + final String docId = DocumentsContract.getDocumentId(uri); | ||
| 770 | + final String[] split = docId.split(":"); | ||
| 771 | + final String type = split[0]; | ||
| 772 | + | ||
| 773 | + if ("primary".equalsIgnoreCase(type)) { | ||
| 774 | + return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q ? context.getExternalFilesDir("") : Environment.getExternalStorageDirectory()) + "/" + split[1]; | ||
| 775 | + } | ||
| 776 | + } else if (isDownloadsDocument(uri)) { | ||
| 777 | + | ||
| 778 | + final String id = DocumentsContract.getDocumentId(uri); | ||
| 779 | + final Uri contentUri = ContentUris.withAppendedId( | ||
| 780 | + Uri.parse("content://downloads/public_downloads"), Long.valueOf(id)); | ||
| 781 | + | ||
| 782 | + return getDataColumn(context, contentUri, null, null); | ||
| 783 | + } | ||
| 784 | + // MediaProvider | ||
| 785 | + else if (isMediaDocument(uri)) { | ||
| 786 | + final String docId = DocumentsContract.getDocumentId(uri); | ||
| 787 | + final String[] split = docId.split(":"); | ||
| 788 | + final String type = split[0]; | ||
| 789 | + | ||
| 790 | + Uri contentUri = null; | ||
| 791 | + if ("image".equals(type)) { | ||
| 792 | + contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; | ||
| 793 | + } else if ("video".equals(type)) { | ||
| 794 | + contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI; | ||
| 795 | + } else if ("audio".equals(type)) { | ||
| 796 | + contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; | ||
| 797 | + } | ||
| 798 | + | ||
| 799 | + final String selection = "_id=?"; | ||
| 800 | + final String[] selectionArgs = new String[]{ | ||
| 801 | + split[1] | ||
| 802 | + }; | ||
| 803 | + | ||
| 804 | + return getDataColumn(context, contentUri, selection, selectionArgs); | ||
| 805 | + } | ||
| 806 | + } | ||
| 807 | + // MediaStore (and general) | ||
| 808 | + else if (uri != null && uri.getScheme() != null && "content".equalsIgnoreCase(uri.getScheme())) { | ||
| 809 | + | ||
| 810 | + // Return the remote address | ||
| 811 | + if (isGooglePhotosUri(uri)) | ||
| 812 | + return uri.getLastPathSegment(); | ||
| 813 | + | ||
| 814 | + return getDataColumn(context, uri, null, null); | ||
| 815 | + } | ||
| 816 | + // File | ||
| 817 | + else if (uri != null && uri.getScheme() != null && "file".equalsIgnoreCase(uri.getScheme())) { | ||
| 818 | + return uri.getPath(); | ||
| 819 | + } | ||
| 820 | + | ||
| 821 | + return null; | ||
| 822 | + } | ||
| 823 | + | ||
| 824 | + public static boolean isExternalStorageDocument(Uri uri) { | ||
| 825 | + return "com.android.externalstorage.documents".equals(uri.getAuthority()); | ||
| 826 | + } | ||
| 827 | + | ||
| 828 | + | ||
| 829 | + public static boolean isDownloadsDocument(Uri uri) { | ||
| 830 | + return "com.android.providers.downloads.documents".equals(uri.getAuthority()); | ||
| 831 | + } | ||
| 832 | + | ||
| 833 | + public static boolean isMediaDocument(Uri uri) { | ||
| 834 | + return "com.android.providers.media.documents".equals(uri.getAuthority()); | ||
| 835 | + } | ||
| 836 | + | ||
| 837 | + public static boolean isGooglePhotosUri(Uri uri) { | ||
| 838 | + return "com.google.android.apps.photos.content".equals(uri.getAuthority()); | ||
| 839 | + } | ||
| 840 | + | ||
| 841 | + public static String getDataColumn(Context context, Uri uri, String selection, | ||
| 842 | + String[] selectionArgs) { | ||
| 843 | + | ||
| 844 | + Cursor cursor = null; | ||
| 845 | + final String column = "_data"; | ||
| 846 | + final String[] projection = {column}; | ||
| 847 | + | ||
| 848 | + try { | ||
| 849 | + cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, | ||
| 850 | + null); | ||
| 851 | + if (cursor != null && cursor.moveToFirst()) { | ||
| 852 | + final int index = cursor.getColumnIndexOrThrow(column); | ||
| 853 | + return cursor.getString(index); | ||
| 854 | + } | ||
| 855 | + } catch (Exception e) { | ||
| 856 | + Log.e("data主键找不到", e.getMessage()); | ||
| 857 | + } finally { | ||
| 858 | + if (cursor != null) | ||
| 859 | + cursor.close(); | ||
| 860 | + } | ||
| 861 | + return null; | ||
| 862 | + } | ||
| 863 | + | ||
| 864 | + | ||
| 865 | + private void jumpToSendMultiple(Context context, ArrayList<String> urilist) { | ||
| 866 | + String replace = ""; | ||
| 867 | + if (type == null || type.startsWith("*")) { | ||
| 868 | + AlertUtil.showDeftToast(this, "网家家暂不支持此类型信息分享."); | ||
| 869 | + killTime(); | ||
| 870 | + } else { | ||
| 871 | + if (type.startsWith("image/")) { | ||
| 872 | + if ("shareMom".equals(outTyp)) { | ||
| 873 | + String clipDataImg = preferences.getString("clipDataImg", ""); | ||
| 874 | + Gson gson = new Gson(); | ||
| 875 | + Type listType = new TypeToken<List<Media>>() { | ||
| 876 | + }.getType(); | ||
| 877 | + ArrayList<Media> dataImg = gson.fromJson(clipDataImg, listType); | ||
| 878 | + jumpReleaseActivity(context, dataImg, 3, "", "nocircle"); | ||
| 879 | + killTime(); | ||
| 880 | + } else { | ||
| 881 | + ArrayList<Media> medialist = new ArrayList<>(); | ||
| 882 | + for (int i = 0; i < urilist.size(); i++) { | ||
| 883 | + Uri uri = Uri.parse(urilist.get(i)); | ||
| 884 | + | ||
| 885 | + sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, uri)); | ||
| 886 | + if ((uri + "").contains("file://")) { | ||
| 887 | + | ||
| 888 | + String pathImg = getPath(context, uri); | ||
| 889 | + Uri mediaUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; | ||
| 890 | + | ||
| 891 | + | ||
| 892 | + String[] projection = {MediaStore.Images.Media._ID, | ||
| 893 | + MediaStore.Images.Media.DATA, | ||
| 894 | + MediaStore.Images.Media.DATE_ADDED, | ||
| 895 | + MediaStore.Images.Thumbnails.DATA | ||
| 896 | + }; | ||
| 897 | + Cursor cursor = context.getContentResolver().query(mediaUri, | ||
| 898 | + projection, | ||
| 899 | + MediaStore.Images.Media.DISPLAY_NAME + "= ?", | ||
| 900 | + new String[]{pathImg.substring(pathImg.lastIndexOf("/") + 1)}, | ||
| 901 | + null); | ||
| 902 | + | ||
| 903 | + //Uri uriQ = null; | ||
| 904 | + if (cursor != null && cursor.moveToFirst()) { | ||
| 905 | + uri = ContentUris.withAppendedId(mediaUri, | ||
| 906 | + cursor.getLong(cursor.getColumnIndex(MediaStore.Images.Media._ID))); | ||
| 907 | + } else { | ||
| 908 | + AlertUtil.showDeftToast(context, "媒体库中暂未找到相关资源,请从手机相册中分享"); | ||
| 909 | + } | ||
| 910 | + if (cursor != null) cursor.close(); | ||
| 911 | + } | ||
| 912 | + if (AndroidQUtil.isAndroidQ()) { | ||
| 913 | + replace = AndroidQUtil.copyAndroidQFile(ShareMomentActivity.this, uri.toString(), System.currentTimeMillis() + ".png"); | ||
| 914 | + } else { | ||
| 915 | + replace = String.valueOf(uri).replace("file:///", "/"); | ||
| 916 | + } | ||
| 917 | + if (replace.startsWith("content:")) { | ||
| 918 | + String uri1 = URItoPath(replace); | ||
| 919 | + // String repl = String.valueOf(uri1).replace("file:///", "/"); | ||
| 920 | + File file = new File(uri1); | ||
| 921 | + Media media = new Media(file.getPath(), file.getName(), 1, 1, file.length(), i, "", ""); | ||
| 922 | + medialist.add(media); | ||
| 923 | + } else { | ||
| 924 | + File file = new File(replace); | ||
| 925 | + Media media = new Media(file.getPath(), file.getName(), 1, 1, file.length(), i, "", ""); | ||
| 926 | + medialist.add(media); | ||
| 927 | + } | ||
| 928 | + } | ||
| 929 | + if (medialist.size() > 9) { | ||
| 930 | + AlertUtil.showDeftToast(this, "发布生活圈最多只能选择九张图片,请重新选择."); | ||
| 931 | + killTime(); | ||
| 932 | + } else { | ||
| 933 | + jumpReleaseActivity(context, medialist, 3, "", "nocircle"); | ||
| 934 | + finish(); | ||
| 935 | + } | ||
| 936 | + } | ||
| 937 | + } | ||
| 938 | + } | ||
| 939 | + } | ||
| 940 | + | ||
| 941 | + private String URItoPath(String uri) { | ||
| 942 | + Uri uri1 = Uri.parse(uri); | ||
| 943 | + String[] proj = {MediaStore.Images.Media.DATA}; | ||
| 944 | + Cursor actualimagecursor = this.managedQuery(uri1, proj, null, null, null); | ||
| 945 | + int actual_image_column_index = actualimagecursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); | ||
| 946 | + actualimagecursor.moveToFirst(); | ||
| 947 | + String img_path = actualimagecursor.getString(actual_image_column_index); | ||
| 948 | + return img_path; | ||
| 949 | + } | ||
| 950 | +} |
OutSide_Share/src/main/java/com/cnlive/outside_share/util/FileType.java
0 → 100644
| 1 | +package com.cnlive.outside_share.util; | ||
| 2 | + | ||
| 3 | +import java.io.FileInputStream; | ||
| 4 | +import java.io.IOException; | ||
| 5 | +import java.util.HashMap; | ||
| 6 | + | ||
| 7 | +public class FileType { | ||
| 8 | + public static final HashMap<String, String> mFileTypes = new HashMap<String, String>(); | ||
| 9 | + | ||
| 10 | + static { | ||
| 11 | + //images | ||
| 12 | + mFileTypes.put("FFD8FF", "jpg"); | ||
| 13 | + mFileTypes.put("89504E", "png"); | ||
| 14 | + mFileTypes.put("47494638", "gif"); | ||
| 15 | + mFileTypes.put("49492A00", "tif"); | ||
| 16 | + mFileTypes.put("424D", "bmp"); | ||
| 17 | + mFileTypes.put("41433130", "dwg"); //CAD | ||
| 18 | + mFileTypes.put("38425053", "psd"); | ||
| 19 | + mFileTypes.put("7B5C727466", "rtf"); //日记本 | ||
| 20 | + mFileTypes.put("3C3F786D6C", "xml"); | ||
| 21 | + mFileTypes.put("68746D6C3E", "html"); | ||
| 22 | + mFileTypes.put("44656C69766572792D646174653A", "eml"); //邮件 | ||
| 23 | + mFileTypes.put("D0CF11E0", "doc"); | ||
| 24 | + mFileTypes.put("5374616E64617264204A", "mdb"); | ||
| 25 | + mFileTypes.put("252150532D41646F6265", "ps"); | ||
| 26 | + mFileTypes.put("255044462D312E", "pdf"); | ||
| 27 | + mFileTypes.put("504B0304", "zip"); | ||
| 28 | + mFileTypes.put("52617221", "rar"); | ||
| 29 | + mFileTypes.put("57415645", "wav"); | ||
| 30 | + mFileTypes.put("41564920", "avi"); | ||
| 31 | + mFileTypes.put("2E524D46", "rm"); | ||
| 32 | + mFileTypes.put("000001BA", "mpg"); | ||
| 33 | + mFileTypes.put("000001B3", "mpg"); | ||
| 34 | + mFileTypes.put("3026B2758E66CF11", "asf"); | ||
| 35 | + mFileTypes.put("4D546864", "mid"); | ||
| 36 | + mFileTypes.put("1F8B08", "gz"); | ||
| 37 | + mFileTypes.put("000000", "video"); | ||
| 38 | + mFileTypes.put("000086","wbmp"); | ||
| 39 | + mFileTypes.put("", ""); | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + public static String getFileType(String filePath) { | ||
| 43 | + return mFileTypes.get(getFileHeader(filePath)); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + //获取文件头信息 | ||
| 47 | + public static String getFileHeader(String filePath) { | ||
| 48 | + FileInputStream is = null; | ||
| 49 | + String value = null; | ||
| 50 | + try { | ||
| 51 | + is = new FileInputStream(filePath); | ||
| 52 | + byte[] b = new byte[3]; | ||
| 53 | + is.read(b, 0, b.length); | ||
| 54 | + value = bytesToHexString(b); | ||
| 55 | + } catch (Exception e) { | ||
| 56 | + } finally { | ||
| 57 | + if (null != is) { | ||
| 58 | + try { | ||
| 59 | + is.close(); | ||
| 60 | + } catch (IOException e) { | ||
| 61 | + } | ||
| 62 | + } | ||
| 63 | + } | ||
| 64 | + return value == null ? "" : value; | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + | ||
| 68 | + private static String bytesToHexString(byte[] src) { | ||
| 69 | + StringBuilder builder = new StringBuilder(); | ||
| 70 | + if (src == null || src.length <= 0) { | ||
| 71 | + return null; | ||
| 72 | + } | ||
| 73 | + String hv; | ||
| 74 | + for (int i = 0; i < src.length; i++) { | ||
| 75 | + hv = Integer.toHexString(src[i] & 0xFF).toUpperCase(); | ||
| 76 | + if (hv.length() < 2) { | ||
| 77 | + builder.append(0); | ||
| 78 | + } | ||
| 79 | + builder.append(hv); | ||
| 80 | + } | ||
| 81 | + return builder.toString(); | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + /*public static void main(String[] args) throws Exception { | ||
| 85 | + final String fileType = getFileType("D:/apache-tomcat-6.0.35.tar.gz"); | ||
| 86 | + System.out.println(fileType); | ||
| 87 | + }*/ | ||
| 88 | + | ||
| 89 | +} |
OutSide_Share/src/main/java/com/cnlive/outside_share/util/FileUtil.java
0 → 100644
| 1 | +package com.cnlive.outside_share.util; | ||
| 2 | + | ||
| 3 | +import android.content.ContentValues; | ||
| 4 | +import android.content.Context; | ||
| 5 | +import android.database.Cursor; | ||
| 6 | +import android.graphics.Bitmap; | ||
| 7 | +import android.net.Uri; | ||
| 8 | +import android.provider.MediaStore; | ||
| 9 | + | ||
| 10 | +import java.io.File; | ||
| 11 | +import java.io.FileInputStream; | ||
| 12 | +import java.io.FileOutputStream; | ||
| 13 | +import java.io.IOException; | ||
| 14 | +import java.io.InputStream; | ||
| 15 | +import java.util.UUID; | ||
| 16 | + | ||
| 17 | + | ||
| 18 | +public class FileUtil { | ||
| 19 | + /** | ||
| 20 | + * Java文件操作 获取文件扩展名 | ||
| 21 | + */ | ||
| 22 | + public static String getExtensionName(String filename) { | ||
| 23 | + if ((filename != null) && (filename.length() > 0)) { | ||
| 24 | + int dot = filename.lastIndexOf('.'); | ||
| 25 | + if ((dot > -1) && (dot < (filename.length() - 1))) { | ||
| 26 | + return filename.substring(dot + 1); | ||
| 27 | + } | ||
| 28 | + } | ||
| 29 | + return ""; | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * 转换 content:// uri | ||
| 35 | + * | ||
| 36 | + * @param imageFile | ||
| 37 | + * @return | ||
| 38 | + */ | ||
| 39 | + public static Uri getImageContentUri(Context context, File imageFile) { | ||
| 40 | + String filePath = imageFile.getAbsolutePath(); | ||
| 41 | + Cursor cursor = context.getContentResolver().query( | ||
| 42 | + MediaStore.Images.Media.EXTERNAL_CONTENT_URI, | ||
| 43 | + new String[]{MediaStore.Images.Media._ID}, | ||
| 44 | + MediaStore.Images.Media.DATA + "=? ", | ||
| 45 | + new String[]{filePath}, null); | ||
| 46 | + | ||
| 47 | + if (cursor != null && cursor.moveToFirst()) { | ||
| 48 | + int id = cursor.getInt(cursor | ||
| 49 | + .getColumnIndex(MediaStore.MediaColumns._ID)); | ||
| 50 | + Uri baseUri = Uri.parse("content://media/external/images/media"); | ||
| 51 | + return Uri.withAppendedPath(baseUri, "" + id); | ||
| 52 | + } else { | ||
| 53 | + if (imageFile.exists()) { | ||
| 54 | + ContentValues values = new ContentValues(); | ||
| 55 | + values.put(MediaStore.Images.Media.DATA, filePath); | ||
| 56 | + return context.getContentResolver().insert( | ||
| 57 | + MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values); | ||
| 58 | + } else { | ||
| 59 | + return null; | ||
| 60 | + } | ||
| 61 | + } | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + /** | ||
| 65 | + * 复制单个文件 | ||
| 66 | + * | ||
| 67 | + * @param oldPath String 原文件路径 如:c:/fqf.txt | ||
| 68 | + * @param newPath String 复制后路径 如:f:/fqf.txt | ||
| 69 | + * @return boolean | ||
| 70 | + */ | ||
| 71 | + public static void copyFile(String oldPath, String newPath) { | ||
| 72 | + try { | ||
| 73 | + int bytesum = 0; | ||
| 74 | + int byteread = 0; | ||
| 75 | + File oldfile = new File(oldPath); | ||
| 76 | + if (oldfile.exists()) { //文件存在时 | ||
| 77 | + InputStream inStream = new FileInputStream(oldPath); //读入原文件 | ||
| 78 | + FileOutputStream fs = new FileOutputStream(newPath); | ||
| 79 | + byte[] buffer = new byte[1444]; | ||
| 80 | + int length; | ||
| 81 | + while ((byteread = inStream.read(buffer)) != -1) { | ||
| 82 | + bytesum += byteread; //字节数 文件大小 | ||
| 83 | + System.out.println(bytesum); | ||
| 84 | + fs.write(buffer, 0, byteread); | ||
| 85 | + } | ||
| 86 | + inStream.close(); | ||
| 87 | + } | ||
| 88 | + } catch (Exception e) { | ||
| 89 | + System.out.println("复制单个文件操作出错"); | ||
| 90 | + e.printStackTrace(); | ||
| 91 | + | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + | ||
| 97 | + /** | ||
| 98 | + * 复制单个文件 | ||
| 99 | + * | ||
| 100 | + * @param oldPath String 原文件路径 如:c:/fqf.txt | ||
| 101 | + * @param newPath String 复制后路径 如:f:/fqf.txt | ||
| 102 | + * @return boolean | ||
| 103 | + */ | ||
| 104 | + public static void copyInternalFile(String oldPath, String newPath) { | ||
| 105 | + try { | ||
| 106 | + int bytesum = 0; | ||
| 107 | + int byteread = 0; | ||
| 108 | + File oldfile = new File(oldPath); | ||
| 109 | + if (oldfile.exists()) { //文件存在时 | ||
| 110 | + InputStream inStream = new FileInputStream(oldPath); //读入原文件 | ||
| 111 | + FileOutputStream fs = new FileOutputStream(newPath); | ||
| 112 | + byte[] buffer = new byte[1444]; | ||
| 113 | + int length; | ||
| 114 | + while ((byteread = inStream.read(buffer)) != -1) { | ||
| 115 | + bytesum += byteread; //字节数 文件大小 | ||
| 116 | + System.out.println(bytesum); | ||
| 117 | + fs.write(buffer, 0, byteread); | ||
| 118 | + } | ||
| 119 | + inStream.close(); | ||
| 120 | + } | ||
| 121 | + } catch (Exception e) { | ||
| 122 | + System.out.println("复制单个文件操作出错"); | ||
| 123 | + e.printStackTrace(); | ||
| 124 | + | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + public static String isExistDir(String saveDir) throws IOException { | ||
| 130 | + File downloadFile = new File(saveDir); | ||
| 131 | + if (!downloadFile.mkdirs()) { | ||
| 132 | + downloadFile.createNewFile(); | ||
| 133 | + } | ||
| 134 | + String savePath = downloadFile.getAbsolutePath(); | ||
| 135 | + return savePath; | ||
| 136 | + } | ||
| 137 | + | ||
| 138 | + /* | ||
| 139 | + * 保存bitmap到本地 | ||
| 140 | + * */ | ||
| 141 | + public static String saveBitmap(Context context, Bitmap mBitmap) { | ||
| 142 | + String savePath; | ||
| 143 | + File filePic; | ||
| 144 | + savePath = context.getCacheDir().getAbsolutePath(); | ||
| 145 | + try { | ||
| 146 | + filePic = new File(savePath + UUID.randomUUID().toString() + ".jpg"); | ||
| 147 | + if (!filePic.exists()) { | ||
| 148 | + filePic.getParentFile().mkdirs(); | ||
| 149 | + filePic.createNewFile(); | ||
| 150 | + } | ||
| 151 | + FileOutputStream fos = new FileOutputStream(filePic); | ||
| 152 | + mBitmap.compress(Bitmap.CompressFormat.JPEG, 100, fos); | ||
| 153 | + fos.flush(); | ||
| 154 | + fos.close(); | ||
| 155 | + } catch (IOException e) { | ||
| 156 | + // TODO Auto-generated catch block | ||
| 157 | + e.printStackTrace(); | ||
| 158 | + return null; | ||
| 159 | + } | ||
| 160 | + | ||
| 161 | + return filePic.getAbsolutePath(); | ||
| 162 | + } | ||
| 163 | + | ||
| 164 | + /** | ||
| 165 | + * 删除文件 | ||
| 166 | + * | ||
| 167 | + * @param file | ||
| 168 | + */ | ||
| 169 | + public static void deleteFile(File file) { | ||
| 170 | + if (file.exists()) { // 判断文件是否存在 | ||
| 171 | + if (file.isFile()) { // 判断是否是文件 | ||
| 172 | + file.delete(); // delete()方法 你应该知道 是删除的意思; | ||
| 173 | + } else if (file.isDirectory()) { // 否则如果它是一个目录 | ||
| 174 | + File files[] = file.listFiles(); // 声明目录下所有的文件 files[]; | ||
| 175 | + for (File file1 : files) { // 遍历目录下所有的文件 | ||
| 176 | + deleteFile(file1); // 把每个文件 用这个方法进行迭代 | ||
| 177 | + } | ||
| 178 | + } | ||
| 179 | + file.delete(); | ||
| 180 | + } else { | ||
| 181 | + | ||
| 182 | + } | ||
| 183 | + } | ||
| 184 | +} |
OutSide_Share/src/main/res/drawable-hdpi/shenghuoquan.webp
0 → 100644
No preview for this file type
OutSide_Share/src/main/res/drawable-hdpi/spinner.webp
0 → 100644
No preview for this file type
OutSide_Share/src/main/res/drawable-hdpi/wjjhaoyou.webp
0 → 100644
No preview for this file type
OutSide_Share/src/main/res/drawable-xhdpi/shenghuoquan.webp
0 → 100644
No preview for this file type
OutSide_Share/src/main/res/drawable-xhdpi/wjjhaoyou.webp
0 → 100644
No preview for this file type
OutSide_Share/src/main/res/drawable-xxhdpi/shenghuoquan.webp
0 → 100644
No preview for this file type
OutSide_Share/src/main/res/drawable-xxhdpi/wjjhaoyou.webp
0 → 100644
No preview for this file type
OutSide_Share/src/main/res/layout/sharemoment.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<RelativeLayout | ||
| 3 | + xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 4 | + android:layout_width="match_parent" | ||
| 5 | + android:layout_height="match_parent" | ||
| 6 | + android:background="@color/transparent" | ||
| 7 | + android:alpha="0.5" | ||
| 8 | + android:fitsSystemWindows="true" | ||
| 9 | + > | ||
| 10 | + | ||
| 11 | + | ||
| 12 | +</RelativeLayout> | ||
| 0 | \ No newline at end of file | 13 | \ No newline at end of file |
OutSide_Share/src/main/res/values-en/ssdk_country_arrays.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<resources> | ||
| 3 | + <string-array name="smssdk_country_group_a"> | ||
| 4 | + <item>Afghanistan,93,46,41220|41230|41240|41250|41201</item> | ||
| 5 | + <item>Albania,355,110,27601|27602|27603|27604</item> | ||
| 6 | + <item>Algeria,213,52,60303|60302|60301</item> | ||
| 7 | + <item>Andorra,376,121,21303</item> | ||
| 8 | + <item>Angola,244,79,63102|63104</item> | ||
| 9 | + <item>Anguilla,1264,199,365840</item> | ||
| 10 | + <item>Antigua and Barbuda,1268,200,338050|344030|344920</item> | ||
| 11 | + <item>Argentina,54,27,722070|72207|72236|722020|72201|72234|72202|722320|722310|722010|722340|722330|722341</item> | ||
| 12 | + <item>Armenia,374,119,28301|28310|28305|28304</item> | ||
| 13 | + <item>Aruba,297,102,36301|36302</item> | ||
| 14 | + <item>Australia,61,33,50507|50506|50519|50590|50572|50571|50530|50501|50512|50511|50503|50502|505060|50538|50516|505061|50526</item> | ||
| 15 | + <item>Austria,43,16,23207|23209|23210|23211|23201|23212|23202|23214|23203|23204|23215|23205|23206</item> | ||
| 16 | + <item>Azerbaijan,994,193,40002|40001|40004</item> | ||
| 17 | + </string-array> | ||
| 18 | + | ||
| 19 | + <string-array name="smssdk_country_group_b"> | ||
| 20 | + <item>Bahamas,1242,197,364390|36439</item> | ||
| 21 | + <item>Bahrain,973,186,42604|42605|42601|42602</item> | ||
| 22 | + <item>Bangladesh,880,172,47007|47005|47006|47003|47004|47001|47002</item> | ||
| 23 | + <item>Barbados,1246,198,342600</item> | ||
| 24 | + <item>Belarus,375,120,25704|25701|25702</item> | ||
| 25 | + <item>Belgium,32,9,20610|20620|20640|20606|20605|20601</item> | ||
| 26 | + <item>Belize,501,134,70267</item> | ||
| 27 | + <item>Benin,229,64,61605|61601|61602|61603|61604</item> | ||
| 28 | + <item>Bermuda,1441,204,350000</item> | ||
| 29 | + <item>Bhutan,975,188,40211|40277</item> | ||
| 30 | + <item>Bolivia,591,144,73603|73602|73601</item> | ||
| 31 | + <item>Bosnia and Herzegovina,387,129,21890|21805|21803</item> | ||
| 32 | + <item>Botswana,267,99,65202|65201|65204</item> | ||
| 33 | + <item>Brazil,55,28,72416|72405|72439|72406|72403|72415|72437|72404|72434|72423|72402|72432|72410|72433|72400|72411|72430|72431|72407</item> | ||
| 34 | + <item>Brunei,673,154,52811|52802</item> | ||
| 35 | + <item>Bulgaria,359,114,28401|28405|28403</item> | ||
| 36 | + <item>Burkina Faso,226,61,61301|61302|61303</item> | ||
| 37 | + <item>Burundi,257,90,64201|64203|64202|64207|64282</item> | ||
| 38 | + </string-array> | ||
| 39 | + | ||
| 40 | + <string-array name="smssdk_country_group_c"> | ||
| 41 | + <item>Cambodia,855,170,45602|45601|45608|45618|45609|45604|45603|45606|45605|23455-KH</item> | ||
| 42 | + <item>Cameroon,237,72,62401|62402|62404</item> | ||
| 43 | + <item>Canada,1,1,302657|302656|302710|302655|302500|302610|302720|302702|302270|302490|302880|302220|302680|302360|302690|302510|302653|302861|302222|302640|302651|302530|302221|302320</item> | ||
| 44 | + <item>Cape Verde,238,73,62501|62502</item> | ||
| 45 | + <item>Cayman Islands,1345,203,346140</item> | ||
| 46 | + <item>Central African Republic,236,71,62301|62302|62303|62304</item> | ||
| 47 | + <item>Chad,235,70,62201|62203</item> | ||
| 48 | + <item>Chile,56,29,73008|73006|73004|73002|73013|73003|73014|73011|73012|73001</item> | ||
| 49 | + <item>China,86,42,46006|46007|46005|46002|46003|46000|46001</item> | ||
| 50 | + <item>Colombia,57,30,732130|732020|732154|732111|732123|732101</item> | ||
| 51 | + <item>Comoros,269,101,65401</item> | ||
| 52 | + <item>Cook Islands,682,161,54801</item> | ||
| 53 | + <item>Costa Rica,506,139,71204|71203|71201</item> | ||
| 54 | + <item>Croatia,385,127,21902|21901|21912|21910</item> | ||
| 55 | + <item>Cuba,53,26,36801</item> | ||
| 56 | + <item>Cyprus,357,112,28022|28001|28020|28010</item> | ||
| 57 | + <item>Czech Republic,420,131,23001|23002|23003|23004|23005|23008</item> | ||
| 58 | + </string-array> | ||
| 59 | + | ||
| 60 | + <string-array name="smssdk_country_group_d"> | ||
| 61 | + <item>Democratic Republic of the Congo,243,78,63086|63001|63089|63002|63005</item> | ||
| 62 | + <item>Denmark,45,19,23801|23812|23802|23813|23803|23806|23828|23807|23808|23830|23820|23810|23866|23877</item> | ||
| 63 | + <item>Djibouti,253,86,63801</item> | ||
| 64 | + <item>Dominica,1767,210,366110</item> | ||
| 65 | + <item>Dominican Republic,1809,213,37001|37002|37003|37004</item> | ||
| 66 | + </string-array> | ||
| 67 | + | ||
| 68 | + <string-array name="smssdk_country_group_e"> | ||
| 69 | + <item>East Timor,670,153,51401|51402</item> | ||
| 70 | + <item>Ecuador,593,146,74002|74001|74000</item> | ||
| 71 | + <item>Egypt,20,5,60203|60202|60201</item> | ||
| 72 | + <item>El Salvador,503,136,70602|70601|70604|70603|70605</item> | ||
| 73 | + <item>Equatorial Guinea,240,75,62701|62703</item> | ||
| 74 | + <item>Estonia,372,117,24803|24802|24801</item> | ||
| 75 | + <item>Ethiopia,251,84,63601</item> | ||
| 76 | + </string-array> | ||
| 77 | + | ||
| 78 | + <string-array name="smssdk_country_group_f"> | ||
| 79 | + <item>Faroe Islands,298,103,28801|28802|28803</item> | ||
| 80 | + <item>Fiji,679,159,54202|54201</item> | ||
| 81 | + <item>Finland,358,113,24409|24432|24410|24421|24412|24411|24414|24403|24413|24405|24426|24404|24491</item> | ||
| 82 | + <item>France,33,10,20816|20804|20826|20815|20825|20813|20802|20823|20801|20811|20822|20888|20810|20821|20831|20820|20809|20808|20817</item> | ||
| 83 | + <item>French Guiana,594,147,74201|74220</item> | ||
| 84 | + <item>French Polynesia,689,165,54720</item> | ||
| 85 | + </string-array> | ||
| 86 | + | ||
| 87 | + <string-array name="smssdk_country_group_g"> | ||
| 88 | + <item>Gabon,241,76,62804|62801|62802|62803</item> | ||
| 89 | + <item>Gambia,220,55,60702|60701|60704|60703</item> | ||
| 90 | + <item>Georgia,995,194,28202|28201|28204|28205</item> | ||
| 91 | + <item>Germany,49,23,26203|26202|26205|26216|26204|26207|26217|26206|26209|26208|26243|26276|26220|26242|26212|26201|26211|26277</item> | ||
| 92 | + <item>Ghana,233,68,62001|62002|62003|62004|62006|62007</item> | ||
| 93 | + <item>Gibraltar,350,105,26606|26609|26601</item> | ||
| 94 | + <item>Greece,30,7,20203|20202|20201|20210|20209|20207|20205</item> | ||
| 95 | + <item>Greenland,299,104,29001</item> | ||
| 96 | + <item>Grenada,1473,205,352110</item> | ||
| 97 | + <item>Guadeloupe,590,143,34008|34003|34002|34001|34020</item> | ||
| 98 | + <item>Guam,1671,208,310400|310140|310470|310110</item> | ||
| 99 | + <item>Guatemala,502,135,70402|70401|70403</item> | ||
| 100 | + <item>Guinea,224,59,61105|61104|61103|61102|61101</item> | ||
| 101 | + <item>Guinea-Bissau,245,80,63202|63203</item> | ||
| 102 | + <item>Guyana,592,145,73802|73801</item> | ||
| 103 | + </string-array> | ||
| 104 | + | ||
| 105 | + <string-array name="smssdk_country_group_h"> | ||
| 106 | + <item>Haiti,509,142,37201|37202</item> | ||
| 107 | + <item>Honduras,504,137,70830|70840|70802|70801</item> | ||
| 108 | + <item>Hong Kong,852,168,45413|45412|45401|45404|45403|45414|45400|45411|45409|45406|45405|45416|45408|45419|45429|45407</item> | ||
| 109 | + <item>Hungary,36,12,21630|21670|21601</item> | ||
| 110 | + </string-array> | ||
| 111 | + | ||
| 112 | + <string-array name="smssdk_country_group_i"> | ||
| 113 | + <item>Iceland,354,109,27409|27411|27404|27401|27402|27407</item> | ||
| 114 | + <item>India,91,44,405893|405892|405895|405894|405897|405896|405899|405898|40501|40506|40505|405891|405890|40503|405889|405882|405881|405883|405886|405885|405888|405887|405880|405879|405878|405871|405750|405870|405873|405752|405872|405751|405875|405754|405874|405753|405877|405756|405876|405755|405868|405867|405869|405860|405862|405861|405864|405863|405866|405865|405856|405859|405858|40494|40493|40492|40491|40498|40497|40496|40495|40490|40483|40482|40481|40480|40487|40486|40485|405799|40484|40489|40488|40472|40471|40470|40476|40475|40474|40473|40479|40478|40477|40460|405930|405811|40462|405810|405931|40469|40468|40467|40466|405809|405802|405923|405801|405922|405804|405925|405803|405924|405806|405927|405805|405926|405808|405929|405807|405928|40450|40570|40454|40453|40452|405800|405921|40451|405920|40458|40457|40456|40455|40459|405919|405912|405914|405913|405916|405915|405918|405917|40443|40442|40441|40567|40446|40566|40449|405901|405900|405903|405902|405905|405904|405907|405906|40553|40552|40431|40551|40430|40436|40556|40435|40555|40434|40554|40433|40438|40437|405851|405850|40421|405853|40420|405852|405855|405854|40425|40424|40422|40429|40428|40427|40419|405846|405845|405848|405847|405849|405046|405045|405840|405047|40410|405842|405841|405843|40413|40412|405040|40411|40418|405042|40417|405041|40416|405044|40415|405043|40409|405835|405834|405837|405836|405839|405838|405035|405034|405037|405036|40520|405039|405831|405038|405830|405833|405832|40524|40403|40402|40523|40522|40401|40521|40400|40407|405031|40406|405030|40405|405033|40404|405032|40519|40518|405824|405823|405825|405828|405827|405829|405026|405025|405820|405027|405822|405029|405821|40513|40512|40511|40510|40517|40515|40514|40509|40508|40507|405813|405812|405815|405814|405817|405816|405819|405818</item> | ||
| 115 | + <item>Indonesia,62,34,51010|51021|51089|51001|51011|51027|51007|51028|51009|51008</item> | ||
| 116 | + <item>Iran,98,49,43235|43214|43220|43200|43211|43219</item> | ||
| 117 | + <item>Iraq,964,178,41805|41840|41820|41830|41845</item> | ||
| 118 | + <item>Ireland,353,108,27201|27213|27202|27211|27205|27203|27209</item> | ||
| 119 | + <item>Israel,972,185,42577|42516|42505|42506|42507|RESTRICTED-IL|42519|42508|42501|42512|42523|42502|42503|42514|42515</item> | ||
| 120 | + <item>Italy,39,13,22206|22207|22208|22210|22243|22288|22244|22299|22233|22201|22235|22204|22248|22205|22230</item> | ||
| 121 | + <item>Ivory Coast,225,60,61205|61204|61203|61202</item> | ||
| 122 | + </string-array> | ||
| 123 | + | ||
| 124 | + <string-array name="smssdk_country_group_j"> | ||
| 125 | + <item>Jamaica,1876,216,338180|338020|338110</item> | ||
| 126 | + <item>Japan,81,39,44027|44026|44029|44028|44023|44144|44022|44143|44025|44024|44145|44140|44021|44142|44141|44020|44016|44015|44018|44017|44012|44011|44099|44014|44013|44019|44090|44096|44095|44010|44098|44097|44092|44091|44094|44093|44004|44007|44006|44001|44089|44000|44088|44003|44002|44009|44008|44087|44199|44078|44198|44077|44079|44074|44194|44073|44076|44075|44191|44070|44190|44193|44072|44192|44071|44067|44066|44069|44068|44063|44062|44065|44064|44061|44060|44056|44055|44058|44052|44051|44054|44053|44050|44170|44049|44048|44045|44044|44165|44047|44046|44041|44162|44040|44161|44043|44164|44042|44163|44038|44037|44039|44034|44033|44036|44035|44030|44032|44031</item> | ||
| 127 | + <item>Jersey,44,17,</item> | ||
| 128 | + <item>Jordan,962,176,41601|41677|41603</item> | ||
| 129 | + </string-array> | ||
| 130 | + | ||
| 131 | + <string-array name="smssdk_country_group_k"> | ||
| 132 | + <item>Kazakhstan,7,4,40102|40101|40177|40108|40107</item> | ||
| 133 | + <item>Kenya,254,87,63905|63907|63903|63902</item> | ||
| 134 | + <item>Kiribati,686,163,54509</item> | ||
| 135 | + <item>Kuwait,965,179,41904|41903|41902</item> | ||
| 136 | + <item>Kyrgyzstan,996,195,43705|43701</item> | ||
| 137 | + </string-array> | ||
| 138 | + | ||
| 139 | + <string-array name="smssdk_country_group_l"> | ||
| 140 | + <item>Laos,856,171,45701|45708|45703|45702</item> | ||
| 141 | + <item>Latvia,371,116,24703|24706|24705|24708|24707|24709|24702|24701</item> | ||
| 142 | + <item>Lebanon,961,175,41503|41501</item> | ||
| 143 | + <item>Lesotho,266,98,65101|65102</item> | ||
| 144 | + <item>Liberia,231,66,61804|61807|61801|61802</item> | ||
| 145 | + <item>Libya,218,54,60603|60601|60600</item> | ||
| 146 | + <item>Liechtenstein,423,133,29501|29577|29505|29502</item> | ||
| 147 | + <item>Lithuania,370,115,24601|24603|24602</item> | ||
| 148 | + <item>Luxembourg,352,107,27099|27077|27001</item> | ||
| 149 | + </string-array> | ||
| 150 | + | ||
| 151 | + <string-array name="smssdk_country_group_m"> | ||
| 152 | + <item>Macau,853,169,45501|45500|45503|45502|45505|45504</item> | ||
| 153 | + <item>Macedonia,389,130,29402|29401|29403</item> | ||
| 154 | + <item>Madagascar,261,93,64601|64602|64604</item> | ||
| 155 | + <item>Malawi,265,97,65010|65001</item> | ||
| 156 | + <item>Malaysia,60,32,50220|50211|50213|502150|50212|502151|502152|50217|50216|50219|50218</item> | ||
| 157 | + <item>Maldives,960,174,47201|47202</item> | ||
| 158 | + <item>Mali,223,58,61002|61001</item> | ||
| 159 | + <item>Malta,356,111,27821|27877|27801</item> | ||
| 160 | + <item>Martinique,596,149,34003|34002|34001|34020</item> | ||
| 161 | + <item>Mauritania,222,57,60910|60902</item> | ||
| 162 | + <item>Mauritius,230,65,61710|61701|61702</item> | ||
| 163 | + <item>Mexico,52,25,33402|33403|33401|33450|33406|334090|33404|33405</item> | ||
| 164 | + <item>Micronesia,691,166,55001</item> | ||
| 165 | + <item>Moldova,373,118,25903|25902|25904|25901</item> | ||
| 166 | + <item>Monaco,377,122,21201</item> | ||
| 167 | + <item>Mongolia,976,189,42898|42888|42899|42801</item> | ||
| 168 | + <item>Montenegro,382,126,29703|29702|29701</item> | ||
| 169 | + <item>Montserrat,1664,207,354860</item> | ||
| 170 | + <item>Morocco,212,51,60405|60402|60401|60400</item> | ||
| 171 | + <item>Mozambique,258,91,64301|64304|64303</item> | ||
| 172 | + <item>Myanmar,95,48,41401|41406|41405</item> | ||
| 173 | + </string-array> | ||
| 174 | + | ||
| 175 | + <string-array name="smssdk_country_group_n"> | ||
| 176 | + <item>Namibia,264,96,64902|64901|64903</item> | ||
| 177 | + <item>Nepal,977,190,42901|42902</item> | ||
| 178 | + <item>Netherlands,31,8,20423|20412|20410|20465|20420|20462|20409|20408|20407|20418|20406|20417|20428|20416|20405|20415|20404|20414|20469|20403|20468|20424|20402</item> | ||
| 179 | + <item>Netherlands Antilles,599,152,36269|36202|36201|36251|36294|36282|36281</item> | ||
| 180 | + <item>New Caledonia,687,164,54601</item> | ||
| 181 | + <item>New Zealand,64,36,53001|53004|53005|53024|53002|53006</item> | ||
| 182 | + <item>Nicaragua,505,138,71021|71030</item> | ||
| 183 | + <item>Niger,227,62,61401|61402|61403|61404</item> | ||
| 184 | + <item>Nigeria,234,69,62150|62140|62130|62120|62125|23455-NG|62160</item> | ||
| 185 | + <item>North Korea,850,167,46703</item> | ||
| 186 | + <item>Norway,47,21,24208|24209|24220|24221|24222|24201|24223|24202|24224|24204|24205|24206</item> | ||
| 187 | + </string-array> | ||
| 188 | + | ||
| 189 | + <string-array name="smssdk_country_group_o"> | ||
| 190 | + <item>Oman,968,182,42202|42203</item> | ||
| 191 | + </string-array> | ||
| 192 | + | ||
| 193 | + <string-array name="smssdk_country_group_p"> | ||
| 194 | + <item>Pakistan,92,45,</item> | ||
| 195 | + <item>Palau,680,160,55201|55280</item> | ||
| 196 | + <item>Palestinian Territory,970,183,42506-PS|42505-PS</item> | ||
| 197 | + <item>Panama,507,140,71404|71402|71403|71401</item> | ||
| 198 | + <item>Papua New Guinea,675,155,53701|53702|53703</item> | ||
| 199 | + <item>Paraguay,595,148,74404|74403|74402|74401</item> | ||
| 200 | + <item>Peru,51,24,71610|71606|71617|71607|71615</item> | ||
| 201 | + <item>Philippines,63,35,51518|51502|51501|51503|51505</item> | ||
| 202 | + <item>Poland,48,22,26016|26038|26004|26018|26017|26006|26009|26019|26008|26010|26032|26001|26034|26012|26011|26003|26036|26014|26002|26013|26035</item> | ||
| 203 | + <item>Portugal,351,106,26804|26806|26801|26803</item> | ||
| 204 | + <item>Puerto Rico,1787,212,310970</item> | ||
| 205 | + </string-array> | ||
| 206 | + | ||
| 207 | + <string-array name="smssdk_country_group_q"> | ||
| 208 | + <item>Qatar,974,187,42701|42702</item> | ||
| 209 | + </string-array> | ||
| 210 | + | ||
| 211 | + <string-array name="smssdk_country_group_r"> | ||
| 212 | + <item>Republic Of The Congo,242,77,62907|62910|62901</item> | ||
| 213 | + <item>Réunion Island,262,94,64710|64702</item> | ||
| 214 | + <item>Romania,40,14,22603|22604|22605|22610|22601</item> | ||
| 215 | + <item>Russia,7,3,25020|25099|25035|25002|25012|25001|25003|25039|25005|25007</item> | ||
| 216 | + <item>Rwanda,250,83,63510|63512|63513|63514</item> | ||
| 217 | + </string-array> | ||
| 218 | + | ||
| 219 | + <string-array name="smssdk_country_group_s"> | ||
| 220 | + <item>Saint Kitts and Nevis,1869,215,356110|356070</item> | ||
| 221 | + <item>Saint Lucia,1758,209,358110</item> | ||
| 222 | + <item>Saint Pierre and Miquelon,508,141,30801</item> | ||
| 223 | + <item>Saint Vincent and The Grenadines,1784,211,360110</item> | ||
| 224 | + <item>Samoa,685,162,54900</item> | ||
| 225 | + <item>San Marino,378,123,29201</item> | ||
| 226 | + <item>Sao Tome and Principe,239,74,62601</item> | ||
| 227 | + <item>Saudi Arabia,966,180,42003|42004|42001|42006</item> | ||
| 228 | + <item>Senegal,221,56,60801|60803|60802</item> | ||
| 229 | + <item>Serbia,381,125,29341|22001|22003|22005</item> | ||
| 230 | + <item>Seychelles,248,81,63310|63301|63302</item> | ||
| 231 | + <item>Sierra Leone,232,67,61902|61903|61904|61905|61906|61909|61901</item> | ||
| 232 | + <item>Singapore,65,37,52502|52503|52512|52501|52505</item> | ||
| 233 | + <item>Slovakia,421,132,23199|23101|23102|23106</item> | ||
| 234 | + <item>Slovenia,386,128,29364|29341|29340|29370</item> | ||
| 235 | + <item>Solomon Islands,677,157,54010</item> | ||
| 236 | + <item>Somalia,252,85,63782|63760|63730|63701|63725|63704</item> | ||
| 237 | + <item>South Africa,27,6,65510|65512|65501|65502|65507|65519</item> | ||
| 238 | + <item>South Korea,82,40,45006|45005|45008|45002|45004</item> | ||
| 239 | + <item>South Sudan,211,50,65995</item> | ||
| 240 | + <item>Spain,34,11,21402|21401|21423|21411|21422|21410|21421|21432|21420|21409|21408|21419|21407|21418|21417|21406|21405|21427|21416|21404|21415|21425|21403</item> | ||
| 241 | + <item>Sri Lanka,94,47,41301|41305|41302|41308</item> | ||
| 242 | + <item>Sudan,249,82,63401|63402|63407</item> | ||
| 243 | + <item>Suriname,597,150,74604|74603|74602</item> | ||
| 244 | + <item>Swaziland,268,100,65310|65301</item> | ||
| 245 | + <item>Sweden,46,20,24035|24013|24036|24014|24037|24015|24038|24016|24039|24017|24018|24019|24030|24031|24010|24032|24033|24012|24034|24002|24003|24026|24027|24028|24006|24029|24007|24008|24040|24020|24043|24022|24000|24044|24023|24001|24045</item> | ||
| 246 | + <item>Switzerland,41,15,22812|22801|22802|22803|22805|22809|22851|22853|22854</item> | ||
| 247 | + <item>Syria,963,177,41701|41702</item> | ||
| 248 | + </string-array> | ||
| 249 | + | ||
| 250 | + <string-array name="smssdk_country_group_t"> | ||
| 251 | + <item>Taiwan,886,173,46602|46668|46603|46688|46699|46601|46689|46656|46697|46610|46609|46606|46607|46605|46693|46692</item> | ||
| 252 | + <item>Tajikistan,992,191,43605|43601|43602|43603|43604</item> | ||
| 253 | + <item>Tanzania,255,88,64011|64003|64002|64005|64004|64007|64006|64009|64008</item> | ||
| 254 | + <item>Thailand,66,38,52000|52099|52020|52003|52004|52015|52001|52023|52002|52018|52005</item> | ||
| 255 | + <item>Togo,228,63,61501|61503</item> | ||
| 256 | + <item>Tonga,676,156,53901</item> | ||
| 257 | + <item>Trinidad and Tobago,1868,214,374130|37412</item> | ||
| 258 | + <item>Tunisia,216,53,60503|60502|60501</item> | ||
| 259 | + <item>Turkey,90,43,28602|28603|28601|28604</item> | ||
| 260 | + <item>Turkmenistan,993,192,43801|43802</item> | ||
| 261 | + <item>Turks and Caicos Islands,1649,206,376352|376350</item> | ||
| 262 | + </string-array> | ||
| 263 | + | ||
| 264 | + <string-array name="smssdk_country_group_u"> | ||
| 265 | + <item>Uganda,256,89,64111|64133|64166|64122|64110|64101|64114</item> | ||
| 266 | + <item>Ukraine,380,124,25507|25506|25521|25501|25503|25502|25505|25504</item> | ||
| 267 | + <item>United Arab Emirates,971,184,42402|42403</item> | ||
| 268 | + <item>United Kingdom,44,18,23427|23428|23407|23409|23420|23400|23401|23423|23500|23424|23402|23403|23425|23426|23416|23417|23418|23419|23430|23431|23476|23410|23433|23455|23411|23478|23434|23458|23414|23415|23450|23451</item> | ||
| 269 | + <item>United States,1,2,311090|310080|311050|311370|310160|31150|311010|310680|310120|310560|311650|310880|310760|31190|310320|310630|310710|310090|310290|316993|310170|310050|31060|311580|310690|311020|311340|310570|311660|310450|310011|310770|316995|310012|316994|311730|310004|311610|310840|310005|310600|31100|311190|310180|31050|310060|316883|311150|310380|311030|310260|311230|310020|310340|311991|311430|316885|310660|310100|316884|310540|310023|310980|311740|310410|31016|310610|310016|31130|31011|31611|310190|311040|316011|310150|310790|310990|310870|310420|310300|310740|311710</item> | ||
| 270 | + <item>Uruguay,598,151,74803|74802|74801|74800|74810|74807</item> | ||
| 271 | + <item>Uzbekistan,998,196,43401|43402|43407|43403|43404|43405|43406</item> | ||
| 272 | + </string-array> | ||
| 273 | + | ||
| 274 | + <string-array name="smssdk_country_group_v"> | ||
| 275 | + <item>Vanuatu,678,158,54101|54105</item> | ||
| 276 | + <item>Venezuela,58,31,73406|73404|73401</item> | ||
| 277 | + <item>Vietnam,84,41,45204|45205|45202|45201|45207</item> | ||
| 278 | + <item>Virgin Islands, British,1340,202,348570|348170</item> | ||
| 279 | + <item>Virgin Islands, US,1284,201,311470</item> | ||
| 280 | + </string-array> | ||
| 281 | + | ||
| 282 | + <string-array name="smssdk_country_group_w"> | ||
| 283 | + | ||
| 284 | + </string-array> | ||
| 285 | + | ||
| 286 | + <string-array name="smssdk_country_group_x"> | ||
| 287 | + | ||
| 288 | + </string-array> | ||
| 289 | + | ||
| 290 | + <string-array name="smssdk_country_group_y"> | ||
| 291 | + <item>Yemen,967,181,42101|42102|42103</item> | ||
| 292 | + </string-array> | ||
| 293 | + | ||
| 294 | + <string-array name="smssdk_country_group_z"> | ||
| 295 | + <item>Zambia,260,92,64502|64501|64503</item> | ||
| 296 | + <item>Zimbabwe,263,95,64801|64803|64804</item> | ||
| 297 | + </string-array> | ||
| 298 | +</resources> | ||
| 0 | \ No newline at end of file | 299 | \ No newline at end of file |
OutSide_Share/src/main/res/values-en/ssdk_oks_strings.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<resources> | ||
| 3 | + <string name="ssdk_oks_share">Share</string> | ||
| 4 | + <string name="ssdk_oks_sharing">Sharing operation is working in the background…</string> | ||
| 5 | + <string name="ssdk_oks_share_failed">Operation failed</string> | ||
| 6 | + <string name="ssdk_oks_share_completed">Operation succeeded</string> | ||
| 7 | + <string name="ssdk_oks_share_canceled">Operation canceled</string> | ||
| 8 | + <string name="ssdk_oks_cancel">Cancel</string> | ||
| 9 | + <string name="ssdk_oks_multi_share">Photo Sharing</string> | ||
| 10 | + <string name="ssdk_oks_confirm">Confirm</string> | ||
| 11 | + <string name="ssdk_oks_contacts">Contacts</string> | ||
| 12 | + <string name="ssdk_oks_pull_to_refresh">Pull down to refresh</string> | ||
| 13 | + <string name="ssdk_oks_release_to_refresh">Release to refresh</string> | ||
| 14 | + <string name="ssdk_oks_refreshing">Refreshing…</string> | ||
| 15 | +</resources> |
OutSide_Share/src/main/res/values-en/ssdk_strings.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<resources> | ||
| 3 | + <string name="ssdk_weibo_oauth_regiseter">Authorization</string> | ||
| 4 | + <string name="ssdk_website">http://www.mob.com</string> | ||
| 5 | + <string name="ssdk_weibo_upload_content">分享图片</string> | ||
| 6 | + <string name="ssdk_wechat_client_inavailable">Wechat client not exists or the version is too low</string> | ||
| 7 | + <string name="ssdk_google_plus_client_inavailable">Google+ client not exists or the version is too low</string> | ||
| 8 | + <string name="ssdk_qq_client_inavailable">Mobile QQ client not exists or the version is too low</string> | ||
| 9 | + <string name="ssdk_pinterest_client_inavailable">Pinterest client not exists or the version is too low</string> | ||
| 10 | + <string name="ssdk_instagram_client_inavailable">Instagram client not exists or the version is too low</string> | ||
| 11 | + <string name="ssdk_yixin_client_inavailable">Yixin client not exists or the version is too low</string> | ||
| 12 | + <string name="ssdk_line_client_inavailable">Line client not exists or the version is too low</string> | ||
| 13 | + <string name="ssdk_kakaotalk_client_inavailable">KakaoTalk client not exists or the version is too low</string> | ||
| 14 | + <string name="ssdk_kakaostory_client_inavailable">KakaoStory client not exists or the version is too low</string> | ||
| 15 | + <string name="ssdk_whatsapp_client_inavailable">WhatsApp client not exists or the version is too low</string> | ||
| 16 | + <string name="ssdk_laiwang_client_inavailable">Laiwangs client not exists or the version is too low</string> | ||
| 17 | + <string name="ssdk_alipay_client_inavailable">Alipay client not exists or the version is too low</string> | ||
| 18 | + <string name="ssdk_facebookmessenger_client_inavailable">Facebookmessenger client not exists or the version is too low</string> | ||
| 19 | + <string name="ssdk_telegram_client_inavailable">Telegram client not exists or the version is too low</string> | ||
| 20 | + | ||
| 21 | + <string name="ssdk_sinaweibo">Sina Weibo</string> | ||
| 22 | + <string name="ssdk_tencentweibo">Tencent Weibo</string> | ||
| 23 | + <string name="ssdk_qzone">QZone</string> | ||
| 24 | + <string name="ssdk_wechat">WeChat</string> | ||
| 25 | + <string name="ssdk_wechatmoments">WeChat Moments</string> | ||
| 26 | + <string name="ssdk_wechatfavorite">WeChat Favorites</string> | ||
| 27 | + <string name="ssdk_facebook">Facebook</string> | ||
| 28 | + <string name="ssdk_twitter">Twitter</string> | ||
| 29 | + <string name="ssdk_renren">Renren</string> | ||
| 30 | + <string name="ssdk_kaixin">Kaixin</string> | ||
| 31 | + <string name="ssdk_email">Email</string> | ||
| 32 | + <string name="ssdk_shortmessage">Short Message</string> | ||
| 33 | + <string name="ssdk_sohumicroblog">Sohu Microblog</string> | ||
| 34 | + <string name="ssdk_neteasemicroblog">Netease Microblog</string> | ||
| 35 | + <string name="ssdk_douban">Douban</string> | ||
| 36 | + <string name="ssdk_youdao">Youdao</string> | ||
| 37 | + <string name="ssdk_evernote">Evernote</string> | ||
| 38 | + <string name="ssdk_linkedin">Linked in</string> | ||
| 39 | + <string name="ssdk_googleplus">Google+</string> | ||
| 40 | + <string name="ssdk_foursquare">FourSquare</string> | ||
| 41 | + <string name="ssdk_qq">QQ</string> | ||
| 42 | + <string name="ssdk_sohusuishenkan">Sohu Suishenkan</string> | ||
| 43 | + <string name="ssdk_pinterest">Pinterest</string> | ||
| 44 | + <string name="ssdk_flickr">Flickr</string> | ||
| 45 | + <string name="ssdk_tumblr">Tumblr</string> | ||
| 46 | + <string name="ssdk_dropbox">Dropbox</string> | ||
| 47 | + <string name="ssdk_vkontakte">VK</string> | ||
| 48 | + <string name="ssdk_instagram">Instagram</string> | ||
| 49 | + <string name="ssdk_yixin">Yixin</string> | ||
| 50 | + <string name="ssdk_yixinmoments">Yixin Moments</string> | ||
| 51 | + <string name="ssdk_mingdao">Mingdao</string> | ||
| 52 | + <string name="ssdk_kakaotalk">KakaoTalk</string> | ||
| 53 | + <string name="ssdk_kakaostory">KakaoStory</string> | ||
| 54 | + <string name="ssdk_line">Line</string> | ||
| 55 | + <string name="ssdk_bluetooth">Bluetooth</string> | ||
| 56 | + <string name="ssdk_whatsapp">WhatsApp</string> | ||
| 57 | + <string name="ssdk_pocket">Pocket</string> | ||
| 58 | + <string name="ssdk_instapaper">Instapaper</string> | ||
| 59 | + <string name="ssdk_instapaper_email">Email</string> | ||
| 60 | + <string name="ssdk_instapaper_pwd">Password</string> | ||
| 61 | + <string name="ssdk_instapaper_login">Sign In</string> | ||
| 62 | + <string name="ssdk_instapaper_logining">Sign In…</string> | ||
| 63 | + <string name="ssdk_instapager_email_or_password_incorrect">Email or Password incorrect</string> | ||
| 64 | + <string name="ssdk_facebookmessenger">Facebook Messenger</string> | ||
| 65 | + <string name="ssdk_laiwang">Laiwang</string> | ||
| 66 | + <string name="ssdk_laiwangmoments">Laiwang Moments</string> | ||
| 67 | + <string name="ssdk_alipay">Alipay</string> | ||
| 68 | + <string name="ssdk_alipaymoments">Alipay Moments</string> | ||
| 69 | + <string name="ssdk_plurk">Plurk</string> | ||
| 70 | + <string name="ssdk_dingding">Dingding</string> | ||
| 71 | + <string name="ssdk_meipai">Meipai</string> | ||
| 72 | + <string name="ssdk_youtube">Youtube</string> | ||
| 73 | + <string name="ssdk_telegram">Telegram</string> | ||
| 74 | + <string name="ssdk_cmcc">Cmcc</string> | ||
| 75 | + | ||
| 76 | + <string name="ssdk_share_to_qzone">Share To QZone</string> | ||
| 77 | + <string name="ssdk_share_to_qq">Share To QQ</string> | ||
| 78 | + <string name="ssdk_share_to_googleplus">Share To Google+</string> | ||
| 79 | + <string name="ssdk_share_to_facebook">Share To Facebook</string> | ||
| 80 | + <string name="ssdk_mingdao_share_content">Share webpage</string> | ||
| 81 | + <string name="ssdk_share_to_mingdao">Share To Mingdao</string> | ||
| 82 | + <string name="ssdk_share_to_qzone_default">Shared from %s</string> | ||
| 83 | + <string name="ssdk_share_to_youtube">Share To Youtube</string> | ||
| 84 | + <string name="ssdk_use_login_button">use login button instead</string> | ||
| 85 | + <string name="ssdk_dont_keep_activitys_client">Please turn off settings developers options don t keeps Activitys</string> | ||
| 86 | + | ||
| 87 | + <string name="ssdk_gender_male">Male</string> | ||
| 88 | + <string name="ssdk_gender_female">Female</string> | ||
| 89 | + <string name="ssdk_symbol_ellipsis">...</string> | ||
| 90 | + | ||
| 91 | + <!--sina web --> | ||
| 92 | + <string name="ssdk_sina_web_close">Close</string> | ||
| 93 | + <string name="ssdk_sina_web_net_error">A network error occurs, please tap the button to reload</string> | ||
| 94 | + <string name="ssdk_sina_web_refresh">channel_data_error</string> | ||
| 95 | + <string name="ssdk_sina_web_title">Weibo Share</string> | ||
| 96 | + <string name="ssdk_sina_web_login_title">Weibo Login</string> | ||
| 97 | + | ||
| 98 | + <!--sms login--> | ||
| 99 | + <string name="ssdk_sms_login">Message Login</string> | ||
| 100 | + <string name="ssdk_sms_top_text">Please input your phone number</string> | ||
| 101 | + <string name="ssdk_sms_top_identify_text">Please input the verification code</string> | ||
| 102 | + <string name="ssdk_sms_btn_next">Next</string> | ||
| 103 | + <string name="ssdk_sms_btn_submit">Submit</string> | ||
| 104 | + <string name="ssdk_sms_btn_sende_voice">Send voice code</string> | ||
| 105 | + <string name="ssdk_sms_zone">Country</string> | ||
| 106 | + <string name="ssdk_sms_china">China</string> | ||
| 107 | + <string name="ssdk_sms_phone">Phone NO.</string> | ||
| 108 | + <string name="ssdk_sms_code">Code</string> | ||
| 109 | + <string name="ssdk_sms_send_again">Send again</string> | ||
| 110 | + <string name="ssdk_sms_input_phone_hint">Input phone number</string> | ||
| 111 | + <string name="ssdk_sms_input_code_hint">Input Verification Code</string> | ||
| 112 | + <string name="ssdk_sms_input_voice_code"><Data>Can not be received? Please try the<font color=#2ba245>voice verification code</font></Data></string> | ||
| 113 | + <string name="ssdk_sms_dialog_btn_cancel">Cancel</string> | ||
| 114 | + <string name="ssdk_sms_dialog_btn_ok">OK</string> | ||
| 115 | + <string name="ssdk_sms_dialog_btn_wait">Wait</string> | ||
| 116 | + <string name="ssdk_sms_dialog_btn_back">Back</string> | ||
| 117 | + <string name="ssdk_sms_dialog_btn_sure">I konw</string> | ||
| 118 | + <string name="ssdk_sms_dialog_btn_login">Confirm landing</string> | ||
| 119 | + <string name="ssdk_sms_dialog_confirm_title">Confirm phone number</string> | ||
| 120 | + <string name="ssdk_sms_dialog_confirm_des">We will send verification code to this phone number:\n</string> | ||
| 121 | + <string name="ssdk_sms_dialog_error_title">Phone number error</string> | ||
| 122 | + <string name="ssdk_sms_dialog_error_des">Is an invalid phone number</string> | ||
| 123 | + <string name="ssdk_sms_dialog_close_identify_page">Verification code may be slightly delayed,confirm return\nand start over?</string> | ||
| 124 | + <string name="ssdk_sms_dialog_error_code">Verification code Incorrect,Please re-enter</string> | ||
| 125 | + <string name="ssdk_sms_dialog_voice_text">We will inform you of the verification code by telephone,\nPlease attention to answer</string> | ||
| 126 | + <string name="ssdk_sms_dialog_send_success">Send success</string> | ||
| 127 | + <string name="ssdk_sms_dialog_login_success">Login success</string> | ||
| 128 | + <string name="ssdk_sms_dialog_smart_title">Congratulations!The phone number has been checked by cloud detection</string> | ||
| 129 | + <string name="ssdk_sms_dialog_smart_dec">Your equipment is a safety device,The number has passed the intelligent\ncloud detection,sms authentication is not required\n(This verification process does not have any security risks)</string> | ||
| 130 | + | ||
| 131 | + | ||
| 132 | + <string name="ssdk_sms_choose_country">Choose country</string> | ||
| 133 | + <string name="ssdk_sms_country_search">Search</string> | ||
| 134 | + | ||
| 135 | + <string name="ssdk_sms_dialog_net_error">Network error, please try later</string> | ||
| 136 | + <string name="ssdk_sms_dialog_system_error">There is a minor problem with the system,Please try again later</string> | ||
| 137 | + <string name="ssdk_sms_dialog_error_desc_100">Server error</string> | ||
| 138 | + <string name="ssdk_sms_dialog_error_desc_101">No permission request</string> | ||
| 139 | + <string name="ssdk_sms_dialog_error_desc_102">Failed to decrypt data</string> | ||
| 140 | + <string name="ssdk_sms_dialog_error_desc_103">The requested argument list is missing the necessary data</string> | ||
| 141 | + <string name="ssdk_sms_dialog_error_desc_104">Request data illegal</string> | ||
| 142 | + <string name="ssdk_sms_dialog_error_desc_105">Verification code error</string> | ||
| 143 | + <string name="ssdk_sms_dialog_error_desc_106">Failed to request the send authentication code</string> | ||
| 144 | + <string name="ssdk_sms_dialog_error_desc_107">Sending text message to the phone number \nalready hit its limit, Please try again tomorrow</string> | ||
| 145 | + <string name="ssdk_sms_dialog_error_desc_108">Sending text message to the device \nalready hit its limit, Please try again tomorrow</string> | ||
| 146 | + <string name="ssdk_sms_dialog_error_desc_109">Sending validation code too frequently</string> | ||
| 147 | + | ||
| 148 | + <string name="ssdk_cmcc_auth">Provided by China Mobile</string> | ||
| 149 | + <string name="ssdk_cmcc_owner_number">Number</string> | ||
| 150 | + <string name="ssdk_cmcc_exchange_account">Switch</string> | ||
| 151 | + <string name="ssdk_cmcc_login_one_key">PhoneNum Login</string> | ||
| 152 | + <string name="ssdk_cmcc_title_logon">Sign in</string> | ||
| 153 | + <string name="ssdk_cmcc_login_argree">Sign in and agree</string> | ||
| 154 | + <string name="ssdk_cmcc_terms_of_service">《China Mobile Number Service Terms》</string> | ||
| 155 | + <string name="ssdk_cmcc_login_grant">And authorize the unified authentication fusion version to get the local number</string> | ||
| 156 | + <string name="ssdk_cmcc_login_again">Login failure, please use SMS verification code</string> | ||
| 157 | + <string name="ssdk_cmcc_send_sms_bar">Automatically send SMS verification,please allow</string> | ||
| 158 | + <string name="ssdk_cmcc_phone_number">Number</string> | ||
| 159 | + <string name="ssdk_cmcc_ver_code">Code</string> | ||
| 160 | + <string name="ssdk_cmcc_get_vercode">Get code</string> | ||
| 161 | + <string name="ssdk_cmcc_send_again">Send Again</string> | ||
| 162 | + <string name="ssdk_cmcc_quick_login">Quick login</string> | ||
| 163 | + <string name="ssdk_cmcc_loading_text">Verifying your identity, please wait...</string> | ||
| 164 | + | ||
| 165 | +</resources> | ||
| 0 | \ No newline at end of file | 166 | \ No newline at end of file |
OutSide_Share/src/main/res/values/colors.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<resources> | ||
| 3 | + | ||
| 4 | + <color name="white">#FFFFFFFF</color> | ||
| 5 | + <color name="transparent">#00000000</color> | ||
| 6 | + <color name="color_watching_info_top_bg">#aa66bdc9</color> | ||
| 7 | + <color name="black">#000000</color> | ||
| 8 | + <color name="share_bg">#b2000000</color> | ||
| 9 | + | ||
| 10 | +</resources> |
OutSide_Share/src/main/res/values/styles.xml
0 → 100644
| 1 | +<resources> | ||
| 2 | + <style name="MyTranslucentTheme" parent="Theme.AppCompat.Light.NoActionBar"> | ||
| 3 | + <item name="android:windowNoTitle">true</item> | ||
| 4 | + <item name="android:windowBackground">@color/transparent</item> | ||
| 5 | + <item name="android:windowIsTranslucent">true</item> | ||
| 6 | + </style> | ||
| 7 | +</resources> |
OutSide_Share/src/test/java/com/cnlive/outside_share/ExampleUnitTest.java
0 → 100644
| 1 | +package com.cnlive.outside_share; | ||
| 2 | + | ||
| 3 | +import org.junit.Test; | ||
| 4 | + | ||
| 5 | +import static org.junit.Assert.*; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * Example local unit test, which will execute on the development machine (host). | ||
| 9 | + * | ||
| 10 | + * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
| 11 | + */ | ||
| 12 | +public class ExampleUnitTest { | ||
| 13 | + @Test | ||
| 14 | + public void addition_isCorrect() { | ||
| 15 | + assertEquals(4, 2 + 2); | ||
| 16 | + } | ||
| 17 | +} | ||
| 0 | \ No newline at end of file | 18 | \ No newline at end of file |
app/build.gradle
| @@ -37,6 +37,7 @@ dependencies { | @@ -37,6 +37,7 @@ dependencies { | ||
| 37 | //glide | 37 | //glide |
| 38 | implementation "com.github.bumptech.glide:glide:$rootProject.glide" | 38 | implementation "com.github.bumptech.glide:glide:$rootProject.glide" |
| 39 | implementation "jp.wasabeef:glide-transformations:$rootProject.glideTransformations" | 39 | implementation "jp.wasabeef:glide-transformations:$rootProject.glideTransformations" |
| 40 | + implementation project(path: ':OutSide_Share') | ||
| 40 | annotationProcessor "com.github.bumptech.glide:compiler:$rootProject.compiler" | 41 | annotationProcessor "com.github.bumptech.glide:compiler:$rootProject.compiler" |
| 41 | 42 | ||
| 42 | implementation "pub.devrel:easypermissions:$rootProject.easypermissions" | 43 | implementation "pub.devrel:easypermissions:$rootProject.easypermissions" |
app/src/main/res/values/styles.xml
| 1 | <resources> | 1 | <resources> |
| 2 | - <!-- Base application theme. --> | ||
| 3 | - <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> | ||
| 4 | - <!-- Customize your theme here. --> | ||
| 5 | - <item name="colorPrimary">@color/colorPrimary</item> | ||
| 6 | - <item name="colorPrimaryDark">@color/colorPrimaryDark</item> | ||
| 7 | - <item name="colorAccent">@color/colorAccent</item> | 2 | + <style name="AppTheme" parent="QMUI.Compat.NoActionBar"> |
| 3 | + <!-- 配置Android提供的theme --> | ||
| 4 | + <item name="android:listPreferredItemHeight">?attr/qmui_list_item_height_higher</item> | ||
| 5 | + <item name="android:listPreferredItemHeightSmall">?attr/qmui_list_item_height</item> | ||
| 6 | + <item name="colorPrimaryDark">#00000000</item> | ||
| 7 | + <!-- 配置qmui提供的theme --> | ||
| 8 | + <item name="qmui_config_color_blue">#FFFFFF</item> | ||
| 9 | + <item name="qmui_content_spacing_horizontal">20dp</item> | ||
| 10 | + <item name="qmui_content_padding_horizontal">@dimen/qmui_content_spacing_horizontal</item> | ||
| 11 | + <item name="windowActionBar">false</item> | ||
| 12 | + <item name="windowNoTitle">true</item> | ||
| 13 | + <item name="qmui_bottom_sheet_grid_item_mini_width">96dp</item> | ||
| 8 | </style> | 14 | </style> |
| 9 | 15 | ||
| 10 | </resources> | 16 | </resources> |
| 11 | \ No newline at end of file | 17 | \ No newline at end of file |
build.gradle
| 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. | 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. |
| 2 | +apply from: "config.gradle" | ||
| 3 | + | ||
| 2 | buildscript { | 4 | buildscript { |
| 3 | repositories { | 5 | repositories { |
| 4 | google() | 6 | google() |
| @@ -16,10 +18,10 @@ allprojects { | @@ -16,10 +18,10 @@ allprojects { | ||
| 16 | repositories { | 18 | repositories { |
| 17 | google() | 19 | google() |
| 18 | jcenter() | 20 | jcenter() |
| 19 | - /*maven { | 21 | + maven { |
| 20 | url maven.mavenMixedUrl | 22 | url maven.mavenMixedUrl |
| 21 | credentials { username = nexusId;password = nexusPw } | 23 | credentials { username = nexusId;password = nexusPw } |
| 22 | - }*/ | 24 | + } |
| 23 | 25 | ||
| 24 | maven { | 26 | maven { |
| 25 | url "https://jitpack.io" | 27 | url "https://jitpack.io" |
config.gradle
| @@ -17,13 +17,13 @@ ext { | @@ -17,13 +17,13 @@ ext { | ||
| 17 | ] | 17 | ] |
| 18 | 18 | ||
| 19 | //Maven Base库配置 | 19 | //Maven Base库配置 |
| 20 | - OutSide_Share = [ | 20 | + out_shared = [ |
| 21 | //编译方式 | 21 | //编译方式 |
| 22 | debug : false, | 22 | debug : false, |
| 23 | //版本号 | 23 | //版本号 |
| 24 | - version: "1.0.0.0-androidx-beta1", | 24 | + version: "1.0.0.0", |
| 25 | //Lib库前缀 | 25 | //Lib库前缀 |
| 26 | - packeg : "com.cnlive.out", | 26 | + packeg : "com.cnlive.outside_share", |
| 27 | //Lib库名称 | 27 | //Lib库名称 |
| 28 | name : "out" | 28 | name : "out" |
| 29 | ] | 29 | ] |
gradle.properties
| @@ -15,5 +15,6 @@ org.gradle.jvmargs=-Xmx2048m | @@ -15,5 +15,6 @@ org.gradle.jvmargs=-Xmx2048m | ||
| 15 | # Android operating system, and which are packaged with your app"s APK | 15 | # Android operating system, and which are packaged with your app"s APK |
| 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn | 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn |
| 17 | android.useAndroidX=true | 17 | android.useAndroidX=true |
| 18 | +android.injected.testOnly=false | ||
| 18 | # Automatically convert third-party libraries to use AndroidX | 19 | # Automatically convert third-party libraries to use AndroidX |
| 19 | android.enableJetifier=true | 20 | android.enableJetifier=true |
| 20 | \ No newline at end of file | 21 | \ No newline at end of file |
settings.gradle
| 1 | +include ':OutSide_Share' | ||
| 1 | include ':app' | 2 | include ':app' |
| 2 | -rootProject.name = "out_shared" | ||
| 3 | \ No newline at end of file | 3 | \ No newline at end of file |
| 4 | +//---------- Maven 配置 ---------- | ||
| 5 | +def initMavenConfig() { | ||
| 6 | + Properties properties = new Properties() | ||
| 7 | + | ||
| 8 | + File propertyFile = new File(rootDir.getAbsolutePath() + "/local.properties") | ||
| 9 | + properties.load(propertyFile.newDataInputStream()) | ||
| 10 | + | ||
| 11 | + gradle.ext.mavenUrl = properties.getProperty('maven.url') | ||
| 12 | + gradle.ext.mavenDevUrl = properties.getProperty('maven.devurl') | ||
| 13 | + gradle.ext.mavenUserName = properties.getProperty('maven.username') | ||
| 14 | + gradle.ext.mavenPwd = properties.getProperty('maven.password') | ||
| 15 | +} | ||
| 16 | + | ||
| 17 | +initMavenConfig() | ||
| 18 | +//---------- Maven 配置 ---------- | ||
| 4 | \ No newline at end of file | 19 | \ No newline at end of file |