Commit 1c7d10188a6facb4ebd34e5e5260d21e28526baa
Merge branch 'master' of bj.gitlab.cnlive.com:cnlive-team/newModuleStrike
# Conflicts: # app/strike/src/main/java/com/cnlive/strike/MyActivity.java # settings.gradle
Showing
112 changed files
with
7293 additions
and
101 deletions
app/strike/src/main/java/com/cnlive/strike/MyActivity.java
| 1 | 1 | package com.cnlive.strike; |
| 2 | 2 | |
| 3 | 3 | |
| 4 | -import android.os.Handler; | |
| 5 | -import android.os.Message; | |
| 4 | +import android.content.Intent; | |
| 6 | 5 | import android.text.TextUtils; |
| 7 | - | |
| 8 | -import androidx.annotation.NonNull; | |
| 6 | +import android.view.View; | |
| 9 | 7 | |
| 10 | 8 | import com.alibaba.android.arouter.facade.annotation.Route; |
| 11 | 9 | import com.cnlive.core.libs.base.frame.activity.BaseActivity; |
| 12 | -import com.cnlive.core.libs.base.util.QMUITipDialogUtil; | |
| 10 | +import com.cnlive.core.libs.base.util.NetworkUtil; | |
| 11 | +import com.cnlive.moudle.collectionTrace.commonInfo.CollCommonInfo; | |
| 12 | +import com.cnlive.moudle.collectionTrace.ui.activity.RaceListActivity; | |
| 13 | 13 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; |
| 14 | +import com.cnlive.moudle.pedometer.ui.activity.RunLineActivity; | |
| 15 | +import com.cnlive.moudle.pedometer.ui.fragment.RunLineFragment; | |
| 14 | 16 | import com.cnlive.strike.databinding.ActivityMyBinding; |
| 15 | 17 | import com.cnlive.strike.user.auth.UserService; |
| 16 | 18 | import com.cnlive.strike.xiaojiaspeaker.commonInfo.XiaoJIaCommInfo; |
| ... | ... | @@ -18,7 +20,7 @@ import com.cnlive.strike.xiaojiaspeaker.commonInfo.XiaoJIaCommInfo; |
| 18 | 20 | @Route(path = "/strick/MyActivity") |
| 19 | 21 | public class MyActivity extends BaseActivity { |
| 20 | 22 | public ActivityMyBinding binding; |
| 21 | - private Handler testHandler; | |
| 23 | + | |
| 22 | 24 | // @Override |
| 23 | 25 | // protected int getBindLayoutId() { |
| 24 | 26 | // return R.layout.activity_my; |
| ... | ... | @@ -32,17 +34,9 @@ public class MyActivity extends BaseActivity { |
| 32 | 34 | |
| 33 | 35 | @Override |
| 34 | 36 | protected void initView() { |
| 35 | - testHandler = getMyActHandler(); | |
| 36 | - testHandler.sendEmptyMessageAtTime(0, 0); | |
| 37 | -// testHandler.postDelayed(new Runnable() { | |
| 38 | -// @Override | |
| 39 | -// public void run() { | |
| 40 | -// QMUITipDialogUtil.successDialog(MyActivity.this, "测试", 5); | |
| 41 | -// } | |
| 42 | -// },5000); | |
| 43 | 37 | // loadRootFragment(new EmptyFragment()); |
| 44 | -// initXiaoJiaSoundBoxData(); | |
| 45 | -// startActivity(new Intent(MyActivity.this, RunLineActivity.class)); | |
| 38 | + initXiaoJiaSoundBoxData(); | |
| 39 | + startActivity(new Intent(MyActivity.this, RunLineActivity.class)); | |
| 46 | 40 | // RaceListActivity.newInstance(me, UserService.getUid(me), |
| 47 | 41 | // UserService.getInstance(me).getAppAccount().getNickName(), |
| 48 | 42 | // UserService.getInstance(me).getAppAccount().getFaceUrl()); |
| ... | ... | @@ -94,12 +88,6 @@ public class MyActivity extends BaseActivity { |
| 94 | 88 | } |
| 95 | 89 | |
| 96 | 90 | @Override |
| 97 | - public void onReceiveActHandleMessage(@NonNull Message msg) { | |
| 98 | - super.onReceiveActHandleMessage(msg); | |
| 99 | - QMUITipDialogUtil.successDialog(MyActivity.this, "测试", 5); | |
| 100 | - } | |
| 101 | - | |
| 102 | - @Override | |
| 103 | 91 | protected void initData() { |
| 104 | 92 | } |
| 105 | 93 | ... | ... |
app/strike/src/main/java/com/cnlive/strike/imgutil/ImgActivity.java
build.gradle
| ... | ... | @@ -8,6 +8,8 @@ static void imput(String type, Project project, Object dependencyNotation) { |
| 8 | 8 | |
| 9 | 9 | buildscript { |
| 10 | 10 | repositories { |
| 11 | + //关联微博 | |
| 12 | + maven { url "https://dl.bintray.com/thelasterstar/maven/" } | |
| 11 | 13 | google() |
| 12 | 14 | jcenter() |
| 13 | 15 | |
| ... | ... | @@ -22,14 +24,6 @@ buildscript { |
| 22 | 24 | } |
| 23 | 25 | |
| 24 | 26 | allprojects { |
| 25 | - repositories { | |
| 26 | - google() | |
| 27 | - jcenter() | |
| 28 | - | |
| 29 | - } | |
| 30 | -} | |
| 31 | - | |
| 32 | -allprojects { | |
| 33 | 27 | // configurations.all { |
| 34 | 28 | ////// resolutionStrategy.force 'androidx.appcompat:appcompat:1.1.0' |
| 35 | 29 | // } |
| ... | ... | @@ -130,11 +124,15 @@ allprojects { |
| 130 | 124 | repositories { |
| 131 | 125 | google() |
| 132 | 126 | jcenter() |
| 127 | + | |
| 133 | 128 | maven { |
| 134 | 129 | url maven.mixedUrl |
| 135 | 130 | credentials { username = nexusId; password = nexusPw } |
| 136 | 131 | } |
| 137 | 132 | //------------------ 资源库配置 END------------------ |
| 133 | + | |
| 134 | + //关联微博 | |
| 135 | + maven { url "https://dl.bintray.com/thelasterstar/maven/" } | |
| 138 | 136 | maven { |
| 139 | 137 | url 'https://dl.bintray.com/granzon/cnlive' |
| 140 | 138 | } | ... | ... |
cloud/share/.gitignore
0 → 100644
| 1 | +/build | ... | ... |
cloud/share/build.gradle
0 → 100644
| 1 | +apply plugin: 'com.android.library' | |
| 2 | + | |
| 3 | +android { | |
| 4 | +// compileSdkVersion rootProject.ext.compileSdkVersion | |
| 5 | +// buildToolsVersion rootProject.ext.buildToolsVersion | |
| 6 | +// | |
| 7 | +// defaultConfig { | |
| 8 | +// minSdkVersion rootProject.ext.minSdkVersion | |
| 9 | +// targetSdkVersion rootProject.ext.targetSdkVersion | |
| 10 | +// versionCode rootProject.ext.versionCode | |
| 11 | +// versionName rootProject.ext.versionName | |
| 12 | +// javaCompileOptions { | |
| 13 | +// annotationProcessorOptions { | |
| 14 | +// arguments = [AROUTER_MODULE_NAME: project.getName(), AROUTER_GENERATE_DOC: "enable"] | |
| 15 | +// } | |
| 16 | +// } | |
| 17 | +// } | |
| 18 | + compileOptions { | |
| 19 | + sourceCompatibility JavaVersion.VERSION_1_8 | |
| 20 | + targetCompatibility JavaVersion.VERSION_1_8 | |
| 21 | + } | |
| 22 | + | |
| 23 | + dataBinding { | |
| 24 | + enabled true | |
| 25 | + } | |
| 26 | + dexOptions { | |
| 27 | + javaMaxHeapSize '4g' | |
| 28 | + } | |
| 29 | + | |
| 30 | + buildTypes { | |
| 31 | + | |
| 32 | + debug { | |
| 33 | + zipAlignEnabled true | |
| 34 | + buildConfigField("String", "QQ_SHARE", stringValue("1106866745")) | |
| 35 | + buildConfigField("String", "WECHAT_SHARE", stringValue("wx9b7f9443a8ccf15a")) | |
| 36 | + buildConfigField("String", "WECHAT_KEY", stringValue("8d9970bf2901411d8dd2bffb344f147e")) | |
| 37 | + buildConfigField("String", "SEND_AUTH_REQ_STATE", stringValue("com_cnlive_strike_debug")) | |
| 38 | + manifestPlaceholders = [ | |
| 39 | + QQ_APPKEY: "tencent1106866745" | |
| 40 | + ] | |
| 41 | + } | |
| 42 | + release { | |
| 43 | + zipAlignEnabled true | |
| 44 | + buildConfigField("String", "QQ_SHARE", stringValue("1106691520")) | |
| 45 | + buildConfigField("String", "WECHAT_SHARE", stringValue("wxed528fc749b7ee88")) | |
| 46 | + buildConfigField("String", "WECHAT_KEY", stringValue("729c3d3055fe336bcdef7020c2548e89")) | |
| 47 | + buildConfigField("String", "SEND_AUTH_REQ_STATE", stringValue("com_cnlive_strike")) | |
| 48 | + manifestPlaceholders = [ | |
| 49 | + QQ_APPKEY: "tencent1106691520" | |
| 50 | + ] | |
| 51 | + } | |
| 52 | + } | |
| 53 | + | |
| 54 | +} | |
| 55 | + | |
| 56 | +static def stringValue(def value) { | |
| 57 | + return "\"${value}\"" | |
| 58 | +} | |
| 59 | + | |
| 60 | +dependencies { | |
| 61 | + implementation fileTree(include: ['*.jar'], dir: 'libs') | |
| 62 | + //CNLive Encipher | |
| 63 | + implementation "com.cnlive.libs:analytics:1.1.2" | |
| 64 | + implementation 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:5.3.1' | |
| 65 | + implementation files('libs/open_sdk_r6008_lite.jar') | |
| 66 | + //微博 | |
| 67 | + implementation 'com.sina.weibo.sdk:core:4.4.1:openDefaultRelease@aar' | |
| 68 | + | |
| 69 | + implementation project(':core:network') | |
| 70 | + implementation project(':core:base') | |
| 71 | + implementation project (':cloud:user') | |
| 72 | +} | ... | ... |
cloud/share/libs/open_sdk_r6008_lite.jar
0 → 100644
No preview for this file type
cloud/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 | ... | ... |
cloud/share/src/debug/AndroidManifest.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<manifest xmlns:android="http://schemas.android.com/apk/res/android" > | |
| 3 | + | |
| 4 | + <application> | |
| 5 | + | |
| 6 | + | |
| 7 | + <activity | |
| 8 | + android:name="com.cnlive.strike.debug.wxapi.WXEntryActivity" | |
| 9 | + android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" | |
| 10 | + android:label="@string/app_name" | |
| 11 | + android:exported="true" | |
| 12 | + android:launchMode="singleTop"> | |
| 13 | + </activity> | |
| 14 | + | |
| 15 | + </application> | |
| 16 | + | |
| 17 | +</manifest> | |
| 0 | 18 | \ No newline at end of file | ... | ... |
cloud/share/src/debug/java/com/cnlive/strike/debug/wxapi/WXEntryActivity.java
0 → 100644
| 1 | +package com.cnlive.strike.debug.wxapi; | |
| 2 | + | |
| 3 | +import android.app.Activity; | |
| 4 | +import android.content.ComponentName; | |
| 5 | +import android.content.Intent; | |
| 6 | +import android.content.SharedPreferences; | |
| 7 | +import android.os.Bundle; | |
| 8 | +import android.os.Handler; | |
| 9 | +import android.os.Message; | |
| 10 | +import android.text.TextUtils; | |
| 11 | +import android.util.Log; | |
| 12 | +import android.widget.Toast; | |
| 13 | + | |
| 14 | +import com.cnlive.core.libs.base.application.AppConfig; | |
| 15 | +import com.cnlive.core.libs.base.util.AlertUtil; | |
| 16 | +import com.cnlive.share.BuildConfig; | |
| 17 | +import com.cnlive.share.arouter.ARouterUtil; | |
| 18 | +import com.cnlive.share.data.ShareIntegralTypeInfo; | |
| 19 | +import com.cnlive.share.data.WeChatInfo; | |
| 20 | +import com.cnlive.share.observable.WechatLoginObservable; | |
| 21 | +import com.cnlive.share.observable.WechatShareObservable; | |
| 22 | +import com.cnlive.share.util.DateTimeUtil; | |
| 23 | +import com.cnlive.share.util.OkHttpUtils; | |
| 24 | +import com.cnlive.strike.user.auth.UserService; | |
| 25 | +import com.google.gson.Gson; | |
| 26 | +import com.tencent.mm.opensdk.constants.ConstantsAPI; | |
| 27 | +import com.tencent.mm.opensdk.modelbase.BaseReq; | |
| 28 | +import com.tencent.mm.opensdk.modelbase.BaseResp; | |
| 29 | +import com.tencent.mm.opensdk.modelmsg.SendAuth; | |
| 30 | +import com.tencent.mm.opensdk.openapi.IWXAPI; | |
| 31 | +import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler; | |
| 32 | +import com.tencent.mm.opensdk.openapi.WXAPIFactory; | |
| 33 | + | |
| 34 | +import org.json.JSONException; | |
| 35 | +import org.json.JSONObject; | |
| 36 | + | |
| 37 | +import java.lang.ref.WeakReference; | |
| 38 | + | |
| 39 | +/** | |
| 40 | + * 作者: 吴奎庆 | |
| 41 | + * <p> | |
| 42 | + * 时间: 2018/8/23 | |
| 43 | + * <p> | |
| 44 | + * 简介: | |
| 45 | + */ | |
| 46 | + | |
| 47 | +public class WXEntryActivity extends Activity implements IWXAPIEventHandler { | |
| 48 | + | |
| 49 | + private IWXAPI api; | |
| 50 | + | |
| 51 | + @Override | |
| 52 | + public void onCreate(Bundle savedInstanceState) { | |
| 53 | + super.onCreate(savedInstanceState); | |
| 54 | + | |
| 55 | + api = WXAPIFactory.createWXAPI(this, BuildConfig.WECHAT_SHARE,false); | |
| 56 | + api.handleIntent(getIntent(), this); | |
| 57 | + } | |
| 58 | + | |
| 59 | + @Override | |
| 60 | + protected void onNewIntent(Intent intent) { | |
| 61 | + super.onNewIntent(intent); | |
| 62 | + setIntent(intent); | |
| 63 | + api.handleIntent(intent, this); | |
| 64 | + } | |
| 65 | + | |
| 66 | + @Override | |
| 67 | + public void onReq(BaseReq baseReq) { | |
| 68 | + } | |
| 69 | + | |
| 70 | + | |
| 71 | + private SendAuth.Resp resp; | |
| 72 | + | |
| 73 | + @Override | |
| 74 | + public void onResp(BaseResp baseResp) { | |
| 75 | + | |
| 76 | + //微信登录为getType为1,分享为0 | |
| 77 | + if (baseResp.getType() == 1) { | |
| 78 | + //登录回调 | |
| 79 | + resp = (SendAuth.Resp) baseResp; | |
| 80 | + switch (resp.errCode) { | |
| 81 | + case BaseResp.ErrCode.ERR_OK: | |
| 82 | + String code = String.valueOf(resp.code); | |
| 83 | + //获取用户信息 | |
| 84 | + getAccessToken(code); | |
| 85 | + break; | |
| 86 | + case BaseResp.ErrCode.ERR_AUTH_DENIED://用户拒绝授权 | |
| 87 | + AlertUtil.showDeftToast(this, "用户拒绝授权"); | |
| 88 | + this.finish(); | |
| 89 | + break; | |
| 90 | + case BaseResp.ErrCode.ERR_USER_CANCEL://用户取消 | |
| 91 | + AlertUtil.showDeftToast(this, "用户取消登录"); | |
| 92 | + this.finish(); | |
| 93 | + break; | |
| 94 | + default: | |
| 95 | + this.finish(); | |
| 96 | + break; | |
| 97 | + } | |
| 98 | + } else { | |
| 99 | + String result = ""; | |
| 100 | + switch (baseResp.errCode) { | |
| 101 | + case BaseResp.ErrCode.ERR_OK: | |
| 102 | + result = "分享成功"; | |
| 103 | + WechatShareObservable.getInstance().update(1); | |
| 104 | + break; | |
| 105 | + case BaseResp.ErrCode.ERR_USER_CANCEL: | |
| 106 | + result = "分享取消"; | |
| 107 | + WechatShareObservable.getInstance().update(2); | |
| 108 | + break; | |
| 109 | + case BaseResp.ErrCode.ERR_AUTH_DENIED: | |
| 110 | + result = "分享失败"; | |
| 111 | + WechatShareObservable.getInstance().update(3); | |
| 112 | + break; | |
| 113 | + default: | |
| 114 | + result = "分享失败"; | |
| 115 | + break; | |
| 116 | + } | |
| 117 | + | |
| 118 | + | |
| 119 | + AlertUtil.showDeftToast(this, result); | |
| 120 | + this.finish(); | |
| 121 | + processShareType(baseResp); | |
| 122 | + } | |
| 123 | + | |
| 124 | + | |
| 125 | + } | |
| 126 | + | |
| 127 | + private void getAccessToken(String code) { | |
| 128 | + String getTokenUrl = String.format("https://api.weixin.qq.com/sns/oauth2/access_token?" + | |
| 129 | + "appid=%s&secret=%s&code=%s&grant_type=authorization_code", AppConfig.getWechatAppid(), | |
| 130 | + BuildConfig.WECHAT_KEY, code); | |
| 131 | + OkHttpUtils.ResultCallback<String> resultCallback = new OkHttpUtils.ResultCallback<String>() { | |
| 132 | + @Override | |
| 133 | + public void onSuccess(String response) { | |
| 134 | + String access = null; | |
| 135 | + String openId = null; | |
| 136 | + try { | |
| 137 | + JSONObject jsonObject = new JSONObject(response); | |
| 138 | + access = jsonObject.getString("access_token"); | |
| 139 | + openId = jsonObject.getString("openid"); | |
| 140 | + } catch (JSONException e) { | |
| 141 | + e.printStackTrace(); | |
| 142 | + } | |
| 143 | + //获取个人信息 | |
| 144 | + String getUserInfo = "https://api.weixin.qq.com/sns/userinfo?access_token=" + access + "&openid=" + openId + ""; | |
| 145 | + OkHttpUtils.ResultCallback<WeChatInfo> resultCallback = new OkHttpUtils.ResultCallback<WeChatInfo>() { | |
| 146 | + @Override | |
| 147 | + public void onSuccess(WeChatInfo response) { | |
| 148 | + response.setErrCode(resp.errCode); | |
| 149 | + if (response != null) WechatLoginObservable.getInstance().update(response); | |
| 150 | + finish(); | |
| 151 | + } | |
| 152 | + | |
| 153 | + @Override | |
| 154 | + public void onFailure(Exception e) { | |
| 155 | + Toast.makeText(WXEntryActivity.this, "登录失败", Toast.LENGTH_SHORT).show(); | |
| 156 | + } | |
| 157 | + }; | |
| 158 | + OkHttpUtils.get(getUserInfo, resultCallback); | |
| 159 | + } | |
| 160 | + | |
| 161 | + @Override | |
| 162 | + public void onFailure(Exception e) { | |
| 163 | + Toast.makeText(WXEntryActivity.this, "登录失败", Toast.LENGTH_SHORT).show(); | |
| 164 | + } | |
| 165 | + }; | |
| 166 | + OkHttpUtils.get(getTokenUrl, resultCallback); | |
| 167 | + | |
| 168 | + } | |
| 169 | + | |
| 170 | + | |
| 171 | + /** | |
| 172 | + * 更具不同的分享类型处理不同的 分享逻辑 | |
| 173 | + * | |
| 174 | + * @param baseResp | |
| 175 | + */ | |
| 176 | + private void processShareType(BaseResp baseResp) { | |
| 177 | + String shareType = baseResp.transaction; | |
| 178 | + if (TextUtils.isEmpty(shareType)) return; | |
| 179 | + try { | |
| 180 | + Gson gson = new Gson(); | |
| 181 | + ShareIntegralTypeInfo integralTypeInfo = gson.fromJson(shareType, ShareIntegralTypeInfo.class); | |
| 182 | + | |
| 183 | + if ("witnessVideo".equals(integralTypeInfo.getShareType())) { | |
| 184 | + SharedPreferences preferences = this.getSharedPreferences("sharevideo", MODE_PRIVATE); | |
| 185 | + boolean status = preferences.getBoolean(UserService.getUid(this), false); | |
| 186 | + String newTime = DateTimeUtil.getCurrentTime(); | |
| 187 | + String oldtime = preferences.getString(UserService.getUid(this) + "time", "2019-04-10"); | |
| 188 | + boolean sameDay = DateTimeUtil.isSameDay(newTime, oldtime); | |
| 189 | + if (!status) { | |
| 190 | + ARouterUtil.addIntegrationPic(this, "share_video", integralTypeInfo.getContentId(), "sharevideo"); | |
| 191 | + } | |
| 192 | + if (status && !sameDay) { | |
| 193 | + ARouterUtil.addIntegrationPic(this, "share_video", integralTypeInfo.getContentId(), "sharevideo"); | |
| 194 | + } | |
| 195 | + | |
| 196 | + } else if (integralTypeInfo.getShareType() != null) { | |
| 197 | + SharedPreferences preferences = this.getSharedPreferences("sharearticle", MODE_PRIVATE); | |
| 198 | + boolean status = preferences.getBoolean(UserService.getUid(this), false); | |
| 199 | + String newTime = DateTimeUtil.getCurrentTime(); | |
| 200 | + String oldtime = preferences.getString(UserService.getUid(this) + "time", "2019-04-10"); | |
| 201 | + boolean sameDay = DateTimeUtil.isSameDay(newTime, oldtime); | |
| 202 | + if (!status) { | |
| 203 | + ARouterUtil.addIntegrationPic(this, "share_article", integralTypeInfo.getContentId(), "sharearticle"); | |
| 204 | + } | |
| 205 | + if (status && !sameDay) { | |
| 206 | + ARouterUtil.addIntegrationPic(this, "share_article", integralTypeInfo.getContentId(), "sharearticle"); | |
| 207 | + } | |
| 208 | + } | |
| 209 | + | |
| 210 | + } catch (Exception e) { | |
| 211 | + return; | |
| 212 | + } | |
| 213 | + } | |
| 214 | + | |
| 215 | +} | ... | ... |
cloud/share/src/main/AndroidManifest.xml
0 → 100644
| 1 | +<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
| 2 | + | |
| 3 | + package="com.cnlive.share"> | |
| 4 | + | |
| 5 | + <!-- 添加必要的权限 --> | |
| 6 | + <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | |
| 7 | + <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | |
| 8 | + <uses-permission android:name="android.permission.GET_TASKS" /> | |
| 9 | + <uses-permission android:name="android.permission.INTERNET" /> | |
| 10 | + <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | |
| 11 | + <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | |
| 12 | + <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> | |
| 13 | + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | |
| 14 | + <uses-permission android:name="android.permission.READ_PHONE_STATE" /> | |
| 15 | + | |
| 16 | + <application android:largeHeap="true"> | |
| 17 | + | |
| 18 | + <meta-data | |
| 19 | + android:name="WEIBO_APPKEY" | |
| 20 | + android:value="3884700821" /> | |
| 21 | + <meta-data | |
| 22 | + android:name="WEIBO_CHANNEL" | |
| 23 | + android:value="weibo" /> | |
| 24 | + | |
| 25 | + <activity android:name=".ui.ShareImgActivity" | |
| 26 | + android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" | |
| 27 | + android:launchMode="singleTop" | |
| 28 | + android:theme="@style/ShareActivityTheme" | |
| 29 | + /> | |
| 30 | + <activity | |
| 31 | + android:name="com.tencent.connect.common.AssistActivity" | |
| 32 | + android:configChanges="orientation|keyboardHidden|screenSize" | |
| 33 | + android:theme="@android:style/Theme.Translucent.NoTitleBar" /> | |
| 34 | + <activity | |
| 35 | + android:name="com.tencent.tauth.AuthActivity" | |
| 36 | + android:launchMode="singleTop" | |
| 37 | + android:noHistory="true"> | |
| 38 | + <intent-filter> | |
| 39 | + <action android:name="android.intent.action.VIEW" /> | |
| 40 | + | |
| 41 | + <category android:name="android.intent.category.DEFAULT" /> | |
| 42 | + <category android:name="android.intent.category.BROWSABLE" /> | |
| 43 | + | |
| 44 | + <data android:scheme="${QQ_APPKEY}" /> | |
| 45 | + </intent-filter> | |
| 46 | + </activity> | |
| 47 | + <activity | |
| 48 | + android:name=".ui.ShareActivity" | |
| 49 | + android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" | |
| 50 | + android:launchMode="singleTop" | |
| 51 | + android:theme="@style/ShareActivityTheme" /> | |
| 52 | + <activity | |
| 53 | + android:name="com.cnlive.share.ui.WechatAppletActivity" | |
| 54 | + android:exported="true" | |
| 55 | + android:label="@string/app_name" | |
| 56 | + android:launchMode="singleTop" | |
| 57 | + android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" /> | |
| 58 | + </application> | |
| 59 | + | |
| 60 | +</manifest> | |
| 0 | 61 | \ No newline at end of file | ... | ... |
cloud/share/src/main/java/com/cnlive/share/QQListener.java
0 → 100644
| 1 | +package com.cnlive.share; | |
| 2 | + | |
| 3 | +import android.util.Log; | |
| 4 | + | |
| 5 | +import com.tencent.tauth.IUiListener; | |
| 6 | +import com.tencent.tauth.UiError; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * 作者: 吴奎庆 | |
| 10 | + * <p> | |
| 11 | + * 时间: 2018/8/23 | |
| 12 | + * <p> | |
| 13 | + * 简介: | |
| 14 | + */ | |
| 15 | + | |
| 16 | +public class QQListener implements IUiListener { | |
| 17 | + @Override | |
| 18 | + public void onComplete(Object o) { | |
| 19 | + Log.e("",""); | |
| 20 | + } | |
| 21 | + | |
| 22 | + @Override | |
| 23 | + public void onError(UiError uiError) { | |
| 24 | + Log.e("",""); | |
| 25 | + } | |
| 26 | + | |
| 27 | + @Override | |
| 28 | + public void onCancel() { | |
| 29 | + Log.e("",""); | |
| 30 | + } | |
| 31 | +} | ... | ... |
cloud/share/src/main/java/com/cnlive/share/adapter/DataBindingAdapter.java
0 → 100644
| 1 | +package com.cnlive.share.adapter; | |
| 2 | + | |
| 3 | +import android.content.Context; | |
| 4 | +import android.view.LayoutInflater; | |
| 5 | +import android.view.View; | |
| 6 | +import android.view.ViewGroup; | |
| 7 | + | |
| 8 | +import com.cnlive.core.libs.base.frame.adapter.BaseRecyclerAdapter; | |
| 9 | +import com.cnlive.core.libs.base.frame.adapter.holder.DataBindingViewHolder; | |
| 10 | + | |
| 11 | +import androidx.annotation.NonNull; | |
| 12 | +import androidx.databinding.DataBindingUtil; | |
| 13 | +import androidx.databinding.ViewDataBinding; | |
| 14 | +import androidx.recyclerview.widget.RecyclerView; | |
| 15 | + | |
| 16 | +import com.cnlive.share.BR; | |
| 17 | + | |
| 18 | +/** | |
| 19 | + * Created by gujun on 2017/5/23. | |
| 20 | + */ | |
| 21 | + | |
| 22 | +public class DataBindingAdapter<T> extends BaseRecyclerAdapter<T> { | |
| 23 | + private int layoutId; | |
| 24 | + protected int itemBRId; | |
| 25 | + | |
| 26 | + protected OnAdapterViewClickListener<T> l; | |
| 27 | + protected OnAdapterViewLoadMoreListener loadMoreListener; | |
| 28 | + | |
| 29 | + public DataBindingAdapter(Context context) { | |
| 30 | + super(context); | |
| 31 | + } | |
| 32 | + | |
| 33 | + public DataBindingAdapter(Context context, int layoutId, int itemBRId) { | |
| 34 | + super(context); | |
| 35 | + this.layoutId = layoutId; | |
| 36 | + this.itemBRId = itemBRId; | |
| 37 | + } | |
| 38 | + | |
| 39 | + public void setOnViewClickListener(OnAdapterViewClickListener listener) { | |
| 40 | + l = listener; | |
| 41 | + } | |
| 42 | + | |
| 43 | + public void setOnLoadMoreListener(OnAdapterViewLoadMoreListener listener) { | |
| 44 | + loadMoreListener = listener; | |
| 45 | + } | |
| 46 | + | |
| 47 | + @NonNull | |
| 48 | + @Override | |
| 49 | + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { | |
| 50 | + ViewDataBinding binding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), layoutId, parent, false); | |
| 51 | + DataBindingViewHolder viewHolder = new DataBindingViewHolder(binding.getRoot()); | |
| 52 | + viewHolder.setBinding(binding); | |
| 53 | + return viewHolder; | |
| 54 | + } | |
| 55 | + | |
| 56 | + @Override | |
| 57 | + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { | |
| 58 | + DataBindingViewHolder videoListViewHolder = (DataBindingViewHolder) holder; | |
| 59 | + videoListViewHolder.getBinding().setVariable(itemBRId, getItem(position)); | |
| 60 | + if (l != null) | |
| 61 | + videoListViewHolder.getBinding().setVariable(BR.viewClickListener, l); | |
| 62 | + videoListViewHolder.getBinding().executePendingBindings(); | |
| 63 | + if (loadMoreListener != null && position == getList().size() - 1) { | |
| 64 | + loadMoreListener.onLoadMore(); | |
| 65 | + } | |
| 66 | + } | |
| 67 | + | |
| 68 | + | |
| 69 | + public interface OnAdapterViewClickListener<T> { | |
| 70 | + void onViewClick(View v, T program); | |
| 71 | + } | |
| 72 | + | |
| 73 | + public interface OnAdapterViewLoadMoreListener { | |
| 74 | + void onLoadMore(); | |
| 75 | + } | |
| 76 | + | |
| 77 | +} | ... | ... |
cloud/share/src/main/java/com/cnlive/share/api/ApiShareService.java
0 → 100644
| 1 | +package com.cnlive.share.api; | |
| 2 | + | |
| 3 | +import com.cnlive.core.network.model.BaseResult; | |
| 4 | +import com.cnlive.share.model.ShortLinkInfo; | |
| 5 | + | |
| 6 | +import java.util.Map; | |
| 7 | + | |
| 8 | +import io.reactivex.Observable; | |
| 9 | +import retrofit2.http.POST; | |
| 10 | +import retrofit2.http.QueryMap; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * created by hanyayun | |
| 14 | + * on 2019/12/3 | |
| 15 | + */ | |
| 16 | +public interface ApiShareService { | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * 预约 | |
| 20 | + * | |
| 21 | + * @param maps | |
| 22 | + * @return | |
| 23 | + */ | |
| 24 | + @POST("Daren/announcementCheck/genShortLinks.action") | |
| 25 | + Observable<BaseResult<ShortLinkInfo>> genShortLinks(@QueryMap() Map<String, String> maps); | |
| 26 | + | |
| 27 | +} | ... | ... |
cloud/share/src/main/java/com/cnlive/share/arouter/ARouterUtil.java
0 → 100644
| 1 | +package com.cnlive.share.arouter; | |
| 2 | + | |
| 3 | +import android.content.Context; | |
| 4 | + | |
| 5 | +import com.alibaba.android.arouter.launcher.ARouter; | |
| 6 | +import com.cnlive.core.libs.base.util.SharedPreferencesHelper; | |
| 7 | +import com.cnlive.core.network.action.CoinRainAction; | |
| 8 | +import com.cnlive.strike.user.auth.UserService; | |
| 9 | + | |
| 10 | +public class ARouterUtil { | |
| 11 | + /** | |
| 12 | + * 分享完成 增加积分 | |
| 13 | + */ | |
| 14 | + public static void addIntegrationPic(Context context, String taskId, String contentId, String addtype) { | |
| 15 | + Boolean app_is_show_integral = SharedPreferencesHelper.getInstance(context).getBoolValue("APP_IS_SHOW_INTEGRAL"); | |
| 16 | + if (app_is_show_integral) { | |
| 17 | + CoinRainAction.code(context, UserService.getUid(context), taskId, contentId, addtype,false); | |
| 18 | + } | |
| 19 | + } | |
| 20 | + | |
| 21 | + /** | |
| 22 | + * 打开举报的h5页面 | |
| 23 | + * | |
| 24 | + * @param context | |
| 25 | + * @param url | |
| 26 | + */ | |
| 27 | + public static void startReportActivity(Context context, String url) { | |
| 28 | + ARouter.getInstance().build("/web/WebViewActivity") | |
| 29 | + .withString("rUrl", url) | |
| 30 | + .navigation(context); | |
| 31 | + } | |
| 32 | + | |
| 33 | + | |
| 34 | +} | ... | ... |
cloud/share/src/main/java/com/cnlive/share/data/FullVideoShareItemData.java
0 → 100644
| 1 | +package com.cnlive.share.data; | |
| 2 | + | |
| 3 | +public class FullVideoShareItemData { | |
| 4 | + | |
| 5 | + public static final int TYPE_WEIXIN = 0X1001; | |
| 6 | + public static final int TYPE_PENG_YOU_QUAN = 0X1002; | |
| 7 | + public static final int TYPE_WJJ = 0X1003; | |
| 8 | + public static final int TYPE_WJJ_QUAN = 0X1004; | |
| 9 | + public static final int TYPE_QQ = 0X1005; | |
| 10 | + public static final int TYPE_BROWSER = 0X1006; | |
| 11 | + public static final int TYPE_WEIBO = 0X1007; | |
| 12 | + | |
| 13 | + private int iconId; | |
| 14 | + private String title; | |
| 15 | + private int type; | |
| 16 | + | |
| 17 | + public FullVideoShareItemData(int iconId, String title, int type) { | |
| 18 | + this.iconId = iconId; | |
| 19 | + this.title = title; | |
| 20 | + this.type = type; | |
| 21 | + } | |
| 22 | + | |
| 23 | + public int getIconId() { | |
| 24 | + return iconId; | |
| 25 | + } | |
| 26 | + | |
| 27 | + public void setIconId(int iconId) { | |
| 28 | + this.iconId = iconId; | |
| 29 | + } | |
| 30 | + | |
| 31 | + public String getTitle() { | |
| 32 | + return title; | |
| 33 | + } | |
| 34 | + | |
| 35 | + public void setTitle(String title) { | |
| 36 | + this.title = title; | |
| 37 | + } | |
| 38 | + | |
| 39 | + public int getType() { | |
| 40 | + return type; | |
| 41 | + } | |
| 42 | + | |
| 43 | + public void setType(int type) { | |
| 44 | + this.type = type; | |
| 45 | + } | |
| 46 | +} | ... | ... |
cloud/share/src/main/java/com/cnlive/share/data/IconInfo.java
0 → 100644
| 1 | +package com.cnlive.share.data; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Created by Lynn on 2018/8/23. | |
| 5 | + */ | |
| 6 | + | |
| 7 | +public class IconInfo { | |
| 8 | + public static final String WJJ_FRIEND = "wjj_friend";//网家家好友 | |
| 9 | + public static final String WJJ_CIRCLE = "wjj_circle";//网家家生活圈 | |
| 10 | + public static final String WECHAT_FRIEND = "weChat_friend";//微信好友 | |
| 11 | + public static final String WECHAT_CIRCLE = "weChat_circle";//微信朋友圈 | |
| 12 | + public static final String QQ = "qq";//qq | |
| 13 | + public static final String WEBO = "webo";//微博 | |
| 14 | + public static final String BROWSER = "browser";//浏览器打开 | |
| 15 | + public static final String REPORT = "report"; //举报 | |
| 16 | + public static final String DOWNLOAD_ALBUM_IMG = "down_album_img"; | |
| 17 | + private String id; | |
| 18 | + private String title; | |
| 19 | + private int icon; | |
| 20 | + | |
| 21 | + public IconInfo(String id, String title, int icon) { | |
| 22 | + this.id = id; | |
| 23 | + this.title = title; | |
| 24 | + this.icon = icon; | |
| 25 | + } | |
| 26 | + | |
| 27 | + public String getId() { | |
| 28 | + return id; | |
| 29 | + } | |
| 30 | + | |
| 31 | + public void setId(String id) { | |
| 32 | + this.id = id; | |
| 33 | + } | |
| 34 | + | |
| 35 | + public String getTitle() { | |
| 36 | + return title; | |
| 37 | + } | |
| 38 | + | |
| 39 | + public void setTitle(String title) { | |
| 40 | + this.title = title; | |
| 41 | + } | |
| 42 | + | |
| 43 | + public int getIcon() { | |
| 44 | + return icon; | |
| 45 | + } | |
| 46 | + | |
| 47 | + public void setIcon(int icon) { | |
| 48 | + this.icon = icon; | |
| 49 | + } | |
| 50 | +} | ... | ... |
cloud/share/src/main/java/com/cnlive/share/data/ShareInfo.java
0 → 100644
| 1 | +package com.cnlive.share.data; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * 创建:wukuiqing | |
| 5 | + * <p> | |
| 6 | + * 时间:2017/11/13 | |
| 7 | + * <p> | |
| 8 | + * 描述:分享的 数据类型 | |
| 9 | + */ | |
| 10 | + | |
| 11 | +public class ShareInfo { | |
| 12 | + //分享的标题 | |
| 13 | + private String title; | |
| 14 | + //分享的简介 | |
| 15 | + private String content; | |
| 16 | + //分享的图片 | |
| 17 | + private String imgurl; | |
| 18 | + private String siteUrl; | |
| 19 | + //分享的Url | |
| 20 | + private String url; | |
| 21 | + //分享的类型 (默认: share_article 积分用) | |
| 22 | + private String shareType; | |
| 23 | + //分享的内容id | |
| 24 | + private String contentId; | |
| 25 | + //兼容低版本的网页链接 | |
| 26 | + private String webpageUrl; | |
| 27 | + //小程序原始id 示例(gh_d43f693ca31f); | |
| 28 | + private String userName; | |
| 29 | + //小程序页面路径 示例 ("/pages/media") | |
| 30 | + private String path; | |
| 31 | + //(int类型) 正式版:0,测试版:1,体验版:2 | |
| 32 | + private int miniprogramType; | |
| 33 | + // 1:目击者 2:生活圈 3:H5 4:点播 5:直播 | |
| 34 | + | |
| 35 | + //举报类型 | |
| 36 | + private String reportType; | |
| 37 | + //是否展示投诉的页面 | |
| 38 | + public boolean isReport; | |
| 39 | + | |
| 40 | + //是否是网家家生活圈内容的分享 | |
| 41 | + private boolean isProcessWjjShare; | |
| 42 | + | |
| 43 | + //网家家分享区分外部内部时 内部用的url | |
| 44 | + private String wjjShareUrl; | |
| 45 | + | |
| 46 | + | |
| 47 | + public boolean isProcessWjjShare() { | |
| 48 | + return isProcessWjjShare; | |
| 49 | + } | |
| 50 | + | |
| 51 | + public void setProcessWjjShare(boolean processWjjShare) { | |
| 52 | + isProcessWjjShare = processWjjShare; | |
| 53 | + } | |
| 54 | + | |
| 55 | + public String getWjjShareUrl() { | |
| 56 | + return wjjShareUrl; | |
| 57 | + } | |
| 58 | + | |
| 59 | + public void setWjjShareUrl(String wjjShareUrl) { | |
| 60 | + this.wjjShareUrl = wjjShareUrl; | |
| 61 | + } | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + public String getReportType() { | |
| 66 | + return reportType; | |
| 67 | + } | |
| 68 | + | |
| 69 | + public void setReportType(String reportType) { | |
| 70 | + this.reportType = reportType; | |
| 71 | + } | |
| 72 | + | |
| 73 | + | |
| 74 | + public String getWebpageUrl() { | |
| 75 | + return webpageUrl; | |
| 76 | + } | |
| 77 | + | |
| 78 | + public void setWebpageUrl(String webpageUrl) { | |
| 79 | + this.webpageUrl = webpageUrl; | |
| 80 | + } | |
| 81 | + | |
| 82 | + public String getUserName() { | |
| 83 | + return userName; | |
| 84 | + } | |
| 85 | + | |
| 86 | + public void setUserName(String userName) { | |
| 87 | + this.userName = userName; | |
| 88 | + } | |
| 89 | + | |
| 90 | + public String getPath() { | |
| 91 | + return path; | |
| 92 | + } | |
| 93 | + | |
| 94 | + public void setPath(String path) { | |
| 95 | + this.path = path; | |
| 96 | + } | |
| 97 | + | |
| 98 | + public int getMiniprogramType() { | |
| 99 | + return miniprogramType; | |
| 100 | + } | |
| 101 | + | |
| 102 | + public void setMiniprogramType(int miniprogramType) { | |
| 103 | + this.miniprogramType = miniprogramType; | |
| 104 | + } | |
| 105 | + | |
| 106 | + | |
| 107 | + public String getShareType() { | |
| 108 | + return shareType; | |
| 109 | + } | |
| 110 | + | |
| 111 | + public void setShareType(String shareType) { | |
| 112 | + if (shareType == null) { | |
| 113 | + shareType = "share_article"; | |
| 114 | + } | |
| 115 | + this.shareType = shareType; | |
| 116 | + } | |
| 117 | + | |
| 118 | + public String getContentId() { | |
| 119 | + return contentId; | |
| 120 | + } | |
| 121 | + | |
| 122 | + public void setContentId(String contentId) { | |
| 123 | + if (contentId == null) { | |
| 124 | + contentId = ""; | |
| 125 | + } | |
| 126 | + this.contentId = contentId; | |
| 127 | + } | |
| 128 | + | |
| 129 | + public String getTitle() { | |
| 130 | + return title; | |
| 131 | + } | |
| 132 | + | |
| 133 | + public void setTitle(String title) { | |
| 134 | + if (title != null && title.length() >= 200) | |
| 135 | + title = title.substring(0, 200); | |
| 136 | + | |
| 137 | + this.title = title; | |
| 138 | + } | |
| 139 | + | |
| 140 | + public String getContent() { | |
| 141 | + return content; | |
| 142 | + } | |
| 143 | + | |
| 144 | + public void setContent(String content) { | |
| 145 | + if (content != null && content.length() >= 200) | |
| 146 | + content = content.substring(0, 200); | |
| 147 | + | |
| 148 | + this.content = content; | |
| 149 | + } | |
| 150 | + | |
| 151 | + public String getImgurl() { | |
| 152 | + return imgurl; | |
| 153 | + } | |
| 154 | + | |
| 155 | + public void setImgurl(String imgurl) { | |
| 156 | + this.imgurl = imgurl; | |
| 157 | + } | |
| 158 | + | |
| 159 | + public String getSiteUrl() { | |
| 160 | + return siteUrl; | |
| 161 | + } | |
| 162 | + | |
| 163 | + public void setSiteUrl(String siteUrl) { | |
| 164 | + this.siteUrl = siteUrl; | |
| 165 | + } | |
| 166 | + | |
| 167 | + public String getUrl() { | |
| 168 | + return url; | |
| 169 | + } | |
| 170 | + | |
| 171 | + public void setUrl(String url) { | |
| 172 | + this.url = url; | |
| 173 | + } | |
| 174 | +} | ... | ... |
cloud/share/src/main/java/com/cnlive/share/data/ShareIntegralTypeInfo.java
0 → 100644
| 1 | +package com.cnlive.share.data; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * 作者: 吴奎庆 | |
| 5 | + * <p> | |
| 6 | + * 时间: 2019/3/9 | |
| 7 | + * <p> | |
| 8 | + * 简介: 分享 | |
| 9 | + */ | |
| 10 | +public class ShareIntegralTypeInfo { | |
| 11 | + public String getShareType() { | |
| 12 | + return shareType; | |
| 13 | + } | |
| 14 | + | |
| 15 | + public void setShareType(String shareType) { | |
| 16 | + this.shareType = shareType; | |
| 17 | + } | |
| 18 | + | |
| 19 | + public String getContentId() { | |
| 20 | + return contentId; | |
| 21 | + } | |
| 22 | + | |
| 23 | + public void setContentId(String contentId) { | |
| 24 | + this.contentId = contentId; | |
| 25 | + } | |
| 26 | + | |
| 27 | + private String shareType; | |
| 28 | + private String contentId; | |
| 29 | +} | ... | ... |
cloud/share/src/main/java/com/cnlive/share/data/WeChatInfo.java
0 → 100644
| 1 | +package com.cnlive.share.data; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * 作者: 吴奎庆 | |
| 5 | + * <p> | |
| 6 | + * 时间: 2019/8/30 | |
| 7 | + * <p> | |
| 8 | + * 简介: | |
| 9 | + */ | |
| 10 | + | |
| 11 | +public class WeChatInfo { | |
| 12 | + private int errCode; | |
| 13 | + | |
| 14 | + private String openid; | |
| 15 | + | |
| 16 | + //普通用户性别,1为男性,2为女性 | |
| 17 | + private int sex; | |
| 18 | + | |
| 19 | + private String nickname; | |
| 20 | + | |
| 21 | + private String headimgurl; | |
| 22 | + | |
| 23 | + private String province; | |
| 24 | + | |
| 25 | + private String language; | |
| 26 | + | |
| 27 | + private String country; | |
| 28 | + | |
| 29 | + private String unionid; | |
| 30 | + | |
| 31 | + public String getOpenid() { | |
| 32 | + return openid; | |
| 33 | + } | |
| 34 | + | |
| 35 | + public void setOpenid(String openid) { | |
| 36 | + this.openid = openid; | |
| 37 | + } | |
| 38 | + | |
| 39 | + public String getNickname() { | |
| 40 | + return nickname; | |
| 41 | + } | |
| 42 | + | |
| 43 | + public void setNickname(String nickname) { | |
| 44 | + this.nickname = nickname; | |
| 45 | + } | |
| 46 | + | |
| 47 | + public String getHeadimgurl() { | |
| 48 | + return headimgurl; | |
| 49 | + } | |
| 50 | + | |
| 51 | + public void setHeadimgurl(String headimgurl) { | |
| 52 | + this.headimgurl = headimgurl; | |
| 53 | + } | |
| 54 | + | |
| 55 | + public String getSex() { | |
| 56 | + return "" + sex; | |
| 57 | + } | |
| 58 | + | |
| 59 | + public String getProvince() { | |
| 60 | + return province; | |
| 61 | + } | |
| 62 | + | |
| 63 | + public void setProvince(String province) { | |
| 64 | + this.province = province; | |
| 65 | + } | |
| 66 | + | |
| 67 | + public String getLanguage() { | |
| 68 | + return language; | |
| 69 | + } | |
| 70 | + | |
| 71 | + public void setLanguage(String language) { | |
| 72 | + this.language = language; | |
| 73 | + } | |
| 74 | + | |
| 75 | + public String getCountry() { | |
| 76 | + return country; | |
| 77 | + } | |
| 78 | + | |
| 79 | + public void setCountry(String country) { | |
| 80 | + this.country = country; | |
| 81 | + } | |
| 82 | + | |
| 83 | + public String getUnionid() { | |
| 84 | + return unionid; | |
| 85 | + } | |
| 86 | + | |
| 87 | + public void setUnionid(String unionid) { | |
| 88 | + this.unionid = unionid; | |
| 89 | + } | |
| 90 | + | |
| 91 | + public void setSex(int sex) { | |
| 92 | + this.sex = sex; | |
| 93 | + } | |
| 94 | + | |
| 95 | + public int getErrCode() { | |
| 96 | + return errCode; | |
| 97 | + } | |
| 98 | + | |
| 99 | + public void setErrCode(int errCode) { | |
| 100 | + this.errCode = errCode; | |
| 101 | + } | |
| 102 | + | |
| 103 | + @Override | |
| 104 | + public String toString() { | |
| 105 | + return "WeChatInfo{" + | |
| 106 | + "errCode='" + errCode + '\'' + | |
| 107 | + ", openid='" + openid + '\'' + | |
| 108 | + ", sex=" + sex + | |
| 109 | + ", nickname='" + nickname + '\'' + | |
| 110 | + ", headimgurl='" + headimgurl + '\'' + | |
| 111 | + ", province='" + province + '\'' + | |
| 112 | + ", language='" + language + '\'' + | |
| 113 | + ", country='" + country + '\'' + | |
| 114 | + ", unionid='" + unionid + '\'' + | |
| 115 | + '}'; | |
| 116 | + } | |
| 117 | +} | ... | ... |
cloud/share/src/main/java/com/cnlive/share/model/ShareReleaseInfoUtil.java
0 → 100644
| 1 | +package com.cnlive.share.model; | |
| 2 | + | |
| 3 | +import android.content.Context; | |
| 4 | +import android.content.Intent; | |
| 5 | +import android.net.Uri; | |
| 6 | + | |
| 7 | + | |
| 8 | +import com.cnlive.core.libs.base.application.AppConfig; | |
| 9 | + | |
| 10 | +import java.io.Serializable; | |
| 11 | + | |
| 12 | +public class ShareReleaseInfoUtil { | |
| 13 | + | |
| 14 | + public static final String SHARE_TYPE = "strike.intent.extra.TYPE"; | |
| 15 | + public static final String SHARE_IMAGE = "strike.intent.extra.IMAGE"; | |
| 16 | + | |
| 17 | + public static final String ACTION_SHARE_SEND = "netpp.intent.action.SHARE_SEND"; | |
| 18 | + public static final String ACTION_SHARE_RELEASE = "netpp.intent.action.SHARE_RELEASE"; | |
| 19 | + | |
| 20 | + //分享类型 | |
| 21 | + public static final String TYPE_HTML = "strike.intent.type.HTML"; | |
| 22 | + | |
| 23 | + private ShareConfig config; | |
| 24 | + | |
| 25 | + public static final class ShareConfig implements Serializable { | |
| 26 | + | |
| 27 | + public static ShareConfig newInstance() { | |
| 28 | + return new ShareConfig(); | |
| 29 | + } | |
| 30 | + | |
| 31 | + public static ShareConfig parse(Intent intent) { | |
| 32 | + if (intent == null) return new ShareConfig(); | |
| 33 | + | |
| 34 | + String title = intent.getStringExtra(Intent.EXTRA_TITLE); | |
| 35 | + String subTitle = intent.getStringExtra(Intent.EXTRA_TEXT); | |
| 36 | + String url = intent.getStringExtra(Intent.EXTRA_SUBJECT); | |
| 37 | + String type = intent.getStringExtra(ShareReleaseInfoUtil.SHARE_TYPE); | |
| 38 | + String image = intent.getStringExtra(ShareReleaseInfoUtil.SHARE_IMAGE); | |
| 39 | + | |
| 40 | + return new ShareConfig(title, subTitle, image, url, type); | |
| 41 | + } | |
| 42 | + | |
| 43 | + private ShareConfig() { | |
| 44 | + | |
| 45 | + } | |
| 46 | + | |
| 47 | + private ShareConfig(String title, String subTitle, String image, String url, String type) { | |
| 48 | + this.title = title; | |
| 49 | + this.subTitle = subTitle; | |
| 50 | + this.image = image; | |
| 51 | + this.url = url; | |
| 52 | + this.type = type; | |
| 53 | + } | |
| 54 | + | |
| 55 | + //分享标题 | |
| 56 | + private String title = ""; | |
| 57 | + //分享副标题 | |
| 58 | + private String subTitle = ""; | |
| 59 | + //分享图标 | |
| 60 | + private String image = ""; | |
| 61 | + //分享URL地址 | |
| 62 | + private String url = ""; | |
| 63 | + //分享类型 | |
| 64 | + private String type = ""; | |
| 65 | + //分享文件地址(通过输入流读取) | |
| 66 | + private Uri uri; | |
| 67 | + | |
| 68 | + public ShareReleaseInfoUtil build() { | |
| 69 | + return new ShareReleaseInfoUtil(this); | |
| 70 | + } | |
| 71 | + | |
| 72 | + public void shareSend(Context context) { | |
| 73 | + new ShareReleaseInfoUtil(this).share(context, ACTION_SHARE_SEND); | |
| 74 | + } | |
| 75 | + | |
| 76 | + public void shareRelease(Context context) { | |
| 77 | + new ShareReleaseInfoUtil(this).share(context, ACTION_SHARE_RELEASE); | |
| 78 | + } | |
| 79 | + | |
| 80 | + public String getTitle() { | |
| 81 | + return title; | |
| 82 | + } | |
| 83 | + | |
| 84 | + public ShareConfig setTitle(String title) { | |
| 85 | + this.title = title; | |
| 86 | + return this; | |
| 87 | + } | |
| 88 | + | |
| 89 | + public String getSubTitle() { | |
| 90 | + return subTitle; | |
| 91 | + } | |
| 92 | + | |
| 93 | + public ShareConfig setSubTitle(String subTitle) { | |
| 94 | + this.subTitle = subTitle; | |
| 95 | + return this; | |
| 96 | + } | |
| 97 | + | |
| 98 | + public String getImage() { | |
| 99 | + return image; | |
| 100 | + } | |
| 101 | + | |
| 102 | + public ShareConfig setImage(String image) { | |
| 103 | + this.image = image; | |
| 104 | + return this; | |
| 105 | + } | |
| 106 | + | |
| 107 | + public String getUrl() { | |
| 108 | + return url; | |
| 109 | + } | |
| 110 | + | |
| 111 | + public ShareConfig setUrl(String url) { | |
| 112 | + this.url = url; | |
| 113 | + return this; | |
| 114 | + } | |
| 115 | + | |
| 116 | + public String getType() { | |
| 117 | + return type; | |
| 118 | + } | |
| 119 | + | |
| 120 | + public ShareConfig setType(String type) { | |
| 121 | + this.type = type; | |
| 122 | + return this; | |
| 123 | + } | |
| 124 | + | |
| 125 | + public Uri getUri() { | |
| 126 | + return uri; | |
| 127 | + } | |
| 128 | + | |
| 129 | + public void setUri(Uri uri) { | |
| 130 | + this.uri = uri; | |
| 131 | + } | |
| 132 | + } | |
| 133 | + | |
| 134 | + private ShareReleaseInfoUtil(ShareConfig config) { | |
| 135 | + this.config = config; | |
| 136 | + } | |
| 137 | + | |
| 138 | + public void shareSend(Context context) { | |
| 139 | + share(context, ACTION_SHARE_SEND); | |
| 140 | + } | |
| 141 | + | |
| 142 | + public void shareRelease(Context context) { | |
| 143 | + share(context, ACTION_SHARE_RELEASE); | |
| 144 | + } | |
| 145 | + | |
| 146 | + public void share(Context context, String action) { | |
| 147 | + Intent intent = new Intent(action); | |
| 148 | + intent.setPackage(AppConfig.getAppPackeg()); | |
| 149 | + intent.setType("text/plain"); | |
| 150 | + intent.putExtra(Intent.EXTRA_TITLE, config.title); | |
| 151 | + intent.putExtra(Intent.EXTRA_TEXT, config.subTitle); | |
| 152 | + intent.putExtra(Intent.EXTRA_SUBJECT, config.url); | |
| 153 | + intent.putExtra(ShareReleaseInfoUtil.SHARE_TYPE, config.type); | |
| 154 | + intent.putExtra(ShareReleaseInfoUtil.SHARE_IMAGE, config.image); | |
| 155 | + context.startActivity(intent); | |
| 156 | + } | |
| 157 | +} | ... | ... |
cloud/share/src/main/java/com/cnlive/share/model/ShareStateInfo.java
0 → 100644
| 1 | +package com.cnlive.share.model; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * 作者: 吴奎庆 | |
| 5 | + * <p> | |
| 6 | + * 时间: 2019/10/23 | |
| 7 | + * <p> | |
| 8 | + * 简介: | |
| 9 | + */ | |
| 10 | +public class ShareStateInfo { | |
| 11 | + | |
| 12 | + // 1 网家家好友 2 网家家生活圈 3 微信好友 4 微信朋友圈 5 qq 6 微博 7 外部 8 举报 9 其他 | |
| 13 | + String type; | |
| 14 | + //商城的分享的类型 | |
| 15 | + String shopShareType; | |
| 16 | + //是否分享成功 | |
| 17 | + boolean isShareSuccess; | |
| 18 | + | |
| 19 | + public String getType() { | |
| 20 | + return type; | |
| 21 | + } | |
| 22 | + | |
| 23 | + public void setType(String type) { | |
| 24 | + this.type = type; | |
| 25 | + } | |
| 26 | + | |
| 27 | + public String getShopShareType() { | |
| 28 | + return shopShareType; | |
| 29 | + } | |
| 30 | + | |
| 31 | + public void setShopShareType(String shopShareType) { | |
| 32 | + this.shopShareType = shopShareType; | |
| 33 | + } | |
| 34 | + | |
| 35 | + public boolean isShareSuccess() { | |
| 36 | + return isShareSuccess; | |
| 37 | + } | |
| 38 | + | |
| 39 | + public void setShareSuccess(boolean shareSuccess) { | |
| 40 | + isShareSuccess = shareSuccess; | |
| 41 | + } | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | +} | ... | ... |
cloud/share/src/main/java/com/cnlive/share/model/ShortLinkInfo.java
0 → 100644
| 1 | +package com.cnlive.share.model; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * 作者: 吴奎庆 | |
| 5 | + * <p> | |
| 6 | + * 时间: 2019/1/15 | |
| 7 | + * <p> | |
| 8 | + * 简介: 长短链接切换的bena | |
| 9 | + */ | |
| 10 | +public class ShortLinkInfo { | |
| 11 | + public String getShortUrl() { | |
| 12 | + return shortUrl; | |
| 13 | + } | |
| 14 | + | |
| 15 | + public void setShortUrl(String shortUrl) { | |
| 16 | + this.shortUrl = shortUrl; | |
| 17 | + } | |
| 18 | + | |
| 19 | + String shortUrl; | |
| 20 | + | |
| 21 | +} | ... | ... |
cloud/share/src/main/java/com/cnlive/share/observable/ShareClickObservable.java
0 → 100644
| 1 | +package com.cnlive.share.observable; | |
| 2 | + | |
| 3 | +import java.util.Observable; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * 作者: 吴奎庆 | |
| 7 | + * <p> | |
| 8 | + * 时间: 2019/9/25 | |
| 9 | + * <p> | |
| 10 | + * 简介: 分享点击的观察者 | |
| 11 | + */ | |
| 12 | +public class ShareClickObservable extends Observable { | |
| 13 | + | |
| 14 | + private static ShareClickObservable instance; | |
| 15 | + | |
| 16 | + public static ShareClickObservable getInstance() { | |
| 17 | + | |
| 18 | + synchronized (ShareClickObservable.class) { | |
| 19 | + if (instance == null) { | |
| 20 | + instance = new ShareClickObservable(); | |
| 21 | + } | |
| 22 | + } | |
| 23 | + return instance; | |
| 24 | + } | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * @param type 1 网家家好友 2 网家家生活圈 3 微信好友 4 微信朋友圈 5 qq 6 微博 7 外部 8 举报 | |
| 28 | + */ | |
| 29 | + public void update(int type) { | |
| 30 | + setChanged(); | |
| 31 | + notifyObservers(type); | |
| 32 | + } | |
| 33 | + | |
| 34 | +} | ... | ... |
cloud/share/src/main/java/com/cnlive/share/observable/ShareStateObservable.java
0 → 100644
| 1 | +package com.cnlive.share.observable; | |
| 2 | + | |
| 3 | +import com.cnlive.share.model.ShareStateInfo; | |
| 4 | + | |
| 5 | +import java.util.Observable; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * 作者: 吴奎庆 | |
| 9 | + * <p> | |
| 10 | + * 时间: 2019/10/23 | |
| 11 | + * <p> | |
| 12 | + * 简介: 三方分享的状态回调 | |
| 13 | + */ | |
| 14 | +public class ShareStateObservable extends Observable { | |
| 15 | + | |
| 16 | + static ShareStateObservable instance; | |
| 17 | + | |
| 18 | + public static ShareStateObservable newInstance() { | |
| 19 | + | |
| 20 | + synchronized (ShareStateObservable.class) { | |
| 21 | + if (instance == null) { | |
| 22 | + instance = new ShareStateObservable(); | |
| 23 | + } | |
| 24 | + } | |
| 25 | + return instance; | |
| 26 | + } | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * 更新分享的状态 | |
| 30 | + * @param info | |
| 31 | + */ | |
| 32 | + public void update(ShareStateInfo info) { | |
| 33 | + setChanged(); | |
| 34 | + notifyObservers(info); | |
| 35 | + | |
| 36 | + } | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | +} | ... | ... |
cloud/share/src/main/java/com/cnlive/share/observable/ShareWjjStateObservable.java
0 → 100644
| 1 | +package com.cnlive.share.observable; | |
| 2 | + | |
| 3 | +import java.util.Observable; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * 作者: 吴奎庆 | |
| 7 | + * <p> | |
| 8 | + * 时间: 2019/10/23 | |
| 9 | + * <p> | |
| 10 | + * 简介: 网++分享成功的状态 | |
| 11 | + */ | |
| 12 | +public class ShareWjjStateObservable extends Observable { | |
| 13 | + | |
| 14 | + static ShareWjjStateObservable instance; | |
| 15 | + | |
| 16 | + public static ShareWjjStateObservable newInstance() { | |
| 17 | + | |
| 18 | + synchronized (ShareWjjStateObservable.class) { | |
| 19 | + if (instance == null) { | |
| 20 | + instance = new ShareWjjStateObservable(); | |
| 21 | + } | |
| 22 | + return instance; | |
| 23 | + } | |
| 24 | + } | |
| 25 | + | |
| 26 | + public void update(boolean isSuccessed){ | |
| 27 | + setChanged(); | |
| 28 | + notifyObservers(isSuccessed); | |
| 29 | + } | |
| 30 | +} | ... | ... |
cloud/share/src/main/java/com/cnlive/share/observable/WechatLoginObservable.java
0 → 100644
| 1 | +package com.cnlive.share.observable; | |
| 2 | + | |
| 3 | +import com.cnlive.share.data.WeChatInfo; | |
| 4 | + | |
| 5 | +import java.util.Observable; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * 作者: 吴奎庆 | |
| 9 | + * <p> | |
| 10 | + * 时间: 2019/9/10 | |
| 11 | + * <p> | |
| 12 | + * 简介: 微信三方登陆的观察者 | |
| 13 | + * | |
| 14 | + */ | |
| 15 | +public class WechatLoginObservable extends Observable { | |
| 16 | + static WechatLoginObservable wechatLoginObservable; | |
| 17 | + | |
| 18 | + public static WechatLoginObservable getInstance() { | |
| 19 | + if (wechatLoginObservable == null) | |
| 20 | + synchronized (WechatLoginObservable.class) { | |
| 21 | + if (wechatLoginObservable == null) | |
| 22 | + wechatLoginObservable = new WechatLoginObservable(); | |
| 23 | + } | |
| 24 | + return wechatLoginObservable; | |
| 25 | + } | |
| 26 | + | |
| 27 | + | |
| 28 | + public void update(WeChatInfo wechatInfo) { | |
| 29 | + setChanged(); | |
| 30 | + notifyObservers(wechatInfo); | |
| 31 | + } | |
| 32 | + | |
| 33 | +} | ... | ... |
cloud/share/src/main/java/com/cnlive/share/observable/WechatShareObservable.java
0 → 100644
| 1 | +package com.cnlive.share.observable; | |
| 2 | + | |
| 3 | +import java.util.Observable; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * 作者: 吴奎庆 | |
| 7 | + * <p> | |
| 8 | + * 时间: 2019/9/18 | |
| 9 | + * <p> | |
| 10 | + * 简介: 微信分享完成 | |
| 11 | + */ | |
| 12 | +public class WechatShareObservable extends Observable { | |
| 13 | + | |
| 14 | + static WechatShareObservable wechatLoginObservable; | |
| 15 | + | |
| 16 | + public static WechatShareObservable getInstance() { | |
| 17 | + if (wechatLoginObservable == null) | |
| 18 | + synchronized (WechatLoginObservable.class) { | |
| 19 | + if (wechatLoginObservable == null) | |
| 20 | + wechatLoginObservable = new WechatShareObservable(); | |
| 21 | + } | |
| 22 | + return wechatLoginObservable; | |
| 23 | + } | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 1 分享完成 2 取消 3 失败 | |
| 27 | + * @param state | |
| 28 | + */ | |
| 29 | + public void update(int state) { | |
| 30 | + setChanged(); | |
| 31 | + notifyObservers(state); | |
| 32 | + } | |
| 33 | + | |
| 34 | +} | ... | ... |
cloud/share/src/main/java/com/cnlive/share/ui/FullVideoShareView.java
0 → 100644
| 1 | +package com.cnlive.share.ui; | |
| 2 | + | |
| 3 | +import android.app.Activity; | |
| 4 | +import android.content.Context; | |
| 5 | +import android.text.TextUtils; | |
| 6 | +import android.util.AttributeSet; | |
| 7 | +import android.view.LayoutInflater; | |
| 8 | +import android.view.View; | |
| 9 | +import android.widget.RelativeLayout; | |
| 10 | + | |
| 11 | +import com.cnlive.core.libs.base.application.AppConfig; | |
| 12 | +import com.cnlive.share.R; | |
| 13 | +import com.cnlive.share.BR; | |
| 14 | +import com.cnlive.share.adapter.DataBindingAdapter; | |
| 15 | +import com.cnlive.share.data.FullVideoShareItemData; | |
| 16 | +import com.cnlive.share.data.ShareInfo; | |
| 17 | +import com.cnlive.share.databinding.LayoutFullVideoShareBinding; | |
| 18 | +import com.cnlive.share.model.ShareReleaseInfoUtil; | |
| 19 | +import com.cnlive.share.observable.ShareClickObservable; | |
| 20 | +import com.cnlive.share.util.ShareUtils; | |
| 21 | +import com.cnlive.share.util.Util; | |
| 22 | + | |
| 23 | +import java.util.ArrayList; | |
| 24 | +import java.util.List; | |
| 25 | + | |
| 26 | +import androidx.databinding.DataBindingUtil; | |
| 27 | +import androidx.recyclerview.widget.GridLayoutManager; | |
| 28 | + | |
| 29 | +/** | |
| 30 | + * 视频横屏状态下的分享视图 | |
| 31 | + */ | |
| 32 | + | |
| 33 | +public class FullVideoShareView extends RelativeLayout implements DataBindingAdapter.OnAdapterViewClickListener<FullVideoShareItemData> { | |
| 34 | + private LayoutFullVideoShareBinding binding; | |
| 35 | + private DataBindingAdapter<FullVideoShareItemData> adapter; | |
| 36 | + private FullVideoShareListener listener; | |
| 37 | + private ShareInfo shareInfo; | |
| 38 | + private ShareReleaseInfoUtil.ShareConfig config; | |
| 39 | + public static final String SHARE_TITLE = "快来加入中国网家家,优享美好生活!"; | |
| 40 | + public static final String SHARE_CONTENT = "中国网家家 让生活更美好!"; | |
| 41 | + public static final String SHARE_END = ""; | |
| 42 | + | |
| 43 | + Context mContext; | |
| 44 | + | |
| 45 | + public FullVideoShareView(Context context) { | |
| 46 | + this(context, null); | |
| 47 | + } | |
| 48 | + | |
| 49 | + public FullVideoShareView(Context context, AttributeSet attrs) { | |
| 50 | + this(context, attrs, 0); | |
| 51 | + } | |
| 52 | + | |
| 53 | + public FullVideoShareView(Context context, AttributeSet attrs, int defStyleAttr) { | |
| 54 | + super(context, attrs, defStyleAttr); | |
| 55 | + init(context); | |
| 56 | + mContext = context; | |
| 57 | + } | |
| 58 | + | |
| 59 | + public void setListener(FullVideoShareListener listener) { | |
| 60 | + this.listener = listener; | |
| 61 | + } | |
| 62 | + | |
| 63 | + public void setData(String title, String des, String imageUrl, String shareUrl, String shareType, String contentId) { | |
| 64 | + shareInfo = new ShareInfo(); | |
| 65 | + | |
| 66 | + shareUrl = TextUtils.isEmpty(shareUrl) ? AppConfig.getShareDownload() : shareUrl; | |
| 67 | + shareInfo.setUrl(shareUrl); | |
| 68 | + | |
| 69 | + title = TextUtils.isEmpty(title) ? SHARE_TITLE : title; | |
| 70 | + shareInfo.setTitle(title); | |
| 71 | + | |
| 72 | + des = TextUtils.isEmpty(des) ? SHARE_CONTENT : des; | |
| 73 | + shareInfo.setContent(des); | |
| 74 | + | |
| 75 | + imageUrl = TextUtils.isEmpty(imageUrl) ? AppConfig.getShareIcon() : imageUrl; | |
| 76 | + shareInfo.setImgurl(imageUrl); | |
| 77 | + | |
| 78 | + shareInfo.setContentId(contentId); | |
| 79 | + shareInfo.setShareType(shareType); | |
| 80 | + } | |
| 81 | + | |
| 82 | + public void updateShareUrl(String shareUrl) { | |
| 83 | + shareUrl = TextUtils.isEmpty(shareUrl) ? AppConfig.getShareDownload() : shareUrl; | |
| 84 | + shareInfo.setUrl(shareUrl); | |
| 85 | + } | |
| 86 | + | |
| 87 | + public void setPaddingRight(int paddingRight) { | |
| 88 | + binding.setPaddingRight(paddingRight); | |
| 89 | + } | |
| 90 | + | |
| 91 | + private void init(Context context) { | |
| 92 | + binding = DataBindingUtil.inflate(LayoutInflater.from(context), R.layout.layout_full_video_share, this, true); | |
| 93 | + binding.shareRecyclerView.setLayoutManager(new GridLayoutManager(context, 4)); | |
| 94 | + binding.shareOutClickView.setOnClickListener(new OnClickListener() { | |
| 95 | + @Override | |
| 96 | + public void onClick(View v) { | |
| 97 | + setVisibility(GONE); | |
| 98 | + if (listener != null) | |
| 99 | + listener.onFullVideoShareDismiss(); | |
| 100 | + } | |
| 101 | + }); | |
| 102 | + binding.shareRightLayout.setOnClickListener(new OnClickListener() { | |
| 103 | + @Override | |
| 104 | + public void onClick(View v) { | |
| 105 | + | |
| 106 | + } | |
| 107 | + }); | |
| 108 | + | |
| 109 | + List<FullVideoShareItemData> list = new ArrayList<>(); | |
| 110 | + list.add(new FullVideoShareItemData(R.drawable.wjjhaoyou, "网家家好友", FullVideoShareItemData.TYPE_WJJ)); | |
| 111 | + list.add(new FullVideoShareItemData(R.drawable.shenghuoquan, "生活圈", FullVideoShareItemData.TYPE_WJJ_QUAN)); | |
| 112 | + list.add(new FullVideoShareItemData(R.drawable.pengyouquan, "朋友圈", FullVideoShareItemData.TYPE_PENG_YOU_QUAN)); | |
| 113 | + list.add(new FullVideoShareItemData(R.drawable.wechat, "微信", FullVideoShareItemData.TYPE_WEIXIN)); | |
| 114 | + list.add(new FullVideoShareItemData(R.drawable.qq, "QQ", FullVideoShareItemData.TYPE_QQ)); | |
| 115 | + list.add(new FullVideoShareItemData(R.drawable.weibo, "微博", FullVideoShareItemData.TYPE_WEIBO)); | |
| 116 | + list.add(new FullVideoShareItemData(R.drawable.browser, "浏览器", FullVideoShareItemData.TYPE_BROWSER)); | |
| 117 | + | |
| 118 | + adapter = new DataBindingAdapter(context, R.layout.list_item_full_video_share, BR.data); | |
| 119 | + adapter.setOnViewClickListener(this); | |
| 120 | + adapter.updateItems(list); | |
| 121 | + binding.shareRecyclerView.setAdapter(adapter); | |
| 122 | + | |
| 123 | + } | |
| 124 | + | |
| 125 | + @Override | |
| 126 | + public void onViewClick(View v, FullVideoShareItemData program) { | |
| 127 | + if (shareInfo == null) return; | |
| 128 | + if (listener != null) | |
| 129 | + listener.onFullVideoShareDismiss(); | |
| 130 | + setVisibility(GONE); | |
| 131 | + if (shareInfo.getUrl()==null || !Util.isNetUrl(shareInfo.getUrl())){ | |
| 132 | + shareInfo.setUrl(AppConfig.getShareDownload()); | |
| 133 | + } | |
| 134 | + switch (program.getType()) { | |
| 135 | + case FullVideoShareItemData.TYPE_BROWSER: | |
| 136 | + ShareUtils.startBrowser(getContext(), shareInfo.getUrl()); | |
| 137 | + ShareClickObservable.getInstance().update(7); | |
| 138 | + break; | |
| 139 | + case FullVideoShareItemData.TYPE_QQ: | |
| 140 | + ShareUtils.shareQQ(shareInfo, (Activity) getContext()); | |
| 141 | + ShareClickObservable.getInstance().update(1); | |
| 142 | + break; | |
| 143 | + case FullVideoShareItemData.TYPE_WEIXIN: | |
| 144 | + ShareUtils.shareWechat(shareInfo, getContext()); | |
| 145 | + ShareClickObservable.getInstance().update(3); | |
| 146 | + break; | |
| 147 | + case FullVideoShareItemData.TYPE_PENG_YOU_QUAN: | |
| 148 | + ShareUtils.shareWCE(shareInfo, getContext()); | |
| 149 | + ShareClickObservable.getInstance().update(4); | |
| 150 | + break; | |
| 151 | + case FullVideoShareItemData.TYPE_WJJ_QUAN: | |
| 152 | + ShareUtils.shareAppMoment(shareInfo, mContext); | |
| 153 | + ShareClickObservable.getInstance().update(2); | |
| 154 | + break; | |
| 155 | + case FullVideoShareItemData.TYPE_WJJ: | |
| 156 | + ShareUtils.shareAppIM(shareInfo, mContext); | |
| 157 | + ShareClickObservable.getInstance().update(1); | |
| 158 | + break; | |
| 159 | + case FullVideoShareItemData.TYPE_WEIBO: | |
| 160 | + ShareUtils.shareWeiBo((Activity) mContext,shareInfo); | |
| 161 | + ShareClickObservable.getInstance().update(6); | |
| 162 | + break; | |
| 163 | + } | |
| 164 | + | |
| 165 | + } | |
| 166 | + | |
| 167 | + public interface FullVideoShareListener { | |
| 168 | + void onFullVideoShareDismiss(); | |
| 169 | + } | |
| 170 | +} | ... | ... |
cloud/share/src/main/java/com/cnlive/share/ui/ShareActivity.java
0 → 100644
| 1 | +package com.cnlive.share.ui; | |
| 2 | + | |
| 3 | +import android.content.Intent; | |
| 4 | +import android.os.Bundle; | |
| 5 | +import android.text.TextUtils; | |
| 6 | +import android.view.View; | |
| 7 | +import android.view.ViewGroup; | |
| 8 | +import android.widget.LinearLayout; | |
| 9 | + | |
| 10 | +import com.alibaba.android.arouter.facade.annotation.Route; | |
| 11 | +import com.cnlive.core.libs.base.application.AppConfig; | |
| 12 | +import com.cnlive.core.libs.base.util.AlertUtil; | |
| 13 | +import com.cnlive.core.libs.base.util.DoublePressed; | |
| 14 | +import com.cnlive.core.libs.base.util.SharedPreferencesHelper; | |
| 15 | +import com.cnlive.share.R; | |
| 16 | +import com.cnlive.share.data.IconInfo; | |
| 17 | +import com.cnlive.share.data.ShareInfo; | |
| 18 | +import com.cnlive.share.observable.ShareClickObservable; | |
| 19 | +import com.cnlive.share.model.ShareStateInfo; | |
| 20 | +import com.cnlive.share.observable.ShareStateObservable; | |
| 21 | +import com.cnlive.share.observable.ShareWjjStateObservable; | |
| 22 | +import com.cnlive.share.observable.WechatShareObservable; | |
| 23 | +import com.cnlive.share.util.ShareOtherUtil; | |
| 24 | +import com.cnlive.share.util.ShareUtils; | |
| 25 | +import com.cnlive.share.util.Util; | |
| 26 | +import com.sina.weibo.sdk.share.WbShareCallback; | |
| 27 | +import com.sina.weibo.sdk.share.WbShareHandler; | |
| 28 | +import com.tencent.connect.common.Constants; | |
| 29 | +import com.tencent.tauth.IUiListener; | |
| 30 | +import com.tencent.tauth.Tencent; | |
| 31 | +import com.cnlive.share.BuildConfig; | |
| 32 | +import com.tencent.tauth.UiError; | |
| 33 | + | |
| 34 | +import java.util.ArrayList; | |
| 35 | +import java.util.List; | |
| 36 | +import java.util.Observer; | |
| 37 | + | |
| 38 | +import androidx.annotation.Nullable; | |
| 39 | +import androidx.appcompat.app.AppCompatActivity; | |
| 40 | +import androidx.recyclerview.widget.LinearLayoutManager; | |
| 41 | +import androidx.recyclerview.widget.RecyclerView; | |
| 42 | + | |
| 43 | +/** | |
| 44 | + * 作者: 吴奎庆 | |
| 45 | + * <p> | |
| 46 | + * 时间: 2018/11/30 | |
| 47 | + * <p> | |
| 48 | + * 简介: | |
| 49 | + */ | |
| 50 | + | |
| 51 | +@Route(path = "/share/ShareActivity") | |
| 52 | +public class ShareActivity extends AppCompatActivity implements View.OnClickListener, ShareDialogListAdapter.ItemClick, IUiListener, WbShareCallback, Observer { | |
| 53 | + public static final String SHARE_TITLE = "快来加入中国网家家,优享美好生活!"; | |
| 54 | + public static final String SHARE_CONTENT = "中国网家家 让生活更美好!"; | |
| 55 | + private LinearLayout ll_cancle; | |
| 56 | + private ShareInfo info; | |
| 57 | + private RecyclerView shareRv; | |
| 58 | + private RecyclerView shareOther; | |
| 59 | + private ShareDialogListAdapter adapter; | |
| 60 | + | |
| 61 | + | |
| 62 | + private boolean isShowWjjLife; | |
| 63 | + private boolean isShowWjjFriend; | |
| 64 | + private boolean isShowOther; | |
| 65 | + private boolean isShowReport; | |
| 66 | + //是否打开eventbus 三方分享得通知 | |
| 67 | + private boolean isOpenShareCallBackEentBus; | |
| 68 | + | |
| 69 | + private boolean showThirdPlatShare = true; | |
| 70 | + private WbShareHandler shareHandler; | |
| 71 | + private String shopShareType; | |
| 72 | + | |
| 73 | + @Override | |
| 74 | + protected void onCreate(@Nullable Bundle savedInstanceState) { | |
| 75 | + super.onCreate(savedInstanceState); | |
| 76 | + setContentView(R.layout.activity_share_dialog); | |
| 77 | + WechatShareObservable.getInstance().addObserver(this); | |
| 78 | + ShareWjjStateObservable.newInstance().addObserver(this); | |
| 79 | + getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); | |
| 80 | + showThirdPlatShare = SharedPreferencesHelper.getInstance(this).getBoolean("SHOW_THIRD_PLAT_SHARE", true); | |
| 81 | + initView(); | |
| 82 | + initData(getIntent()); | |
| 83 | + | |
| 84 | + } | |
| 85 | + | |
| 86 | + private void initData(Intent intent) { | |
| 87 | + if (intent == null) { | |
| 88 | + AlertUtil.showDeftToast(this, "数据异常"); | |
| 89 | + finish(); | |
| 90 | + } | |
| 91 | + String title = getIntent().getStringExtra("title"); | |
| 92 | + if (TextUtils.isEmpty(title)) title = SHARE_TITLE; | |
| 93 | + String subTitle = getIntent().getStringExtra("subTitle"); | |
| 94 | + if (TextUtils.isEmpty(subTitle)) subTitle = SHARE_CONTENT; | |
| 95 | + | |
| 96 | + String shareUrl = getIntent().getStringExtra("shareUrl"); | |
| 97 | + isOpenShareCallBackEentBus = getIntent().getBooleanExtra("isOpenEventBusCallBack", false); | |
| 98 | + if (TextUtils.isEmpty(shareUrl)) shareUrl = AppConfig.getShareDownload(); | |
| 99 | + //拼接电商商品分享的相关参数 | |
| 100 | + //// 商品分享类型 1:商品 | |
| 101 | + shopShareType = getIntent().getStringExtra("shopShareType"); | |
| 102 | + | |
| 103 | + String shareUrlImg = getIntent().getStringExtra("shareUrlImg"); | |
| 104 | + if (TextUtils.isEmpty(shareUrlImg)) shareUrlImg = AppConfig.getShareIcon(); | |
| 105 | + | |
| 106 | + String webpageUrl = getIntent().getStringExtra("webpageUrl"); | |
| 107 | + String userName = getIntent().getStringExtra("userName"); | |
| 108 | + String path = getIntent().getStringExtra("path"); | |
| 109 | + int miniprogramType = getIntent().getIntExtra("miniprogramType", -1); | |
| 110 | + | |
| 111 | + String type = getIntent().getStringExtra("shareType"); | |
| 112 | + String contentId = getIntent().getStringExtra("contentId"); | |
| 113 | + String reportType = getIntent().getStringExtra("reportType"); | |
| 114 | + //网家家分享区分外部内部时 内部用的url | |
| 115 | + String wjjShareUrl = getIntent().getStringExtra("wjjShareUrl"); | |
| 116 | + | |
| 117 | + isShowWjjLife = getIntent().getBooleanExtra("isShowWjjLife", false); | |
| 118 | + isShowWjjFriend = getIntent().getBooleanExtra("isShowWjjFriend", false); | |
| 119 | + isShowOther = getIntent().getBooleanExtra("isShowOther", false); | |
| 120 | + isShowReport = getIntent().getBooleanExtra("isShowReport", false); | |
| 121 | + | |
| 122 | + | |
| 123 | + info = new ShareInfo(); | |
| 124 | + info.setUrl(shareUrl); | |
| 125 | + info.setTitle(title); | |
| 126 | + info.setContent(subTitle); | |
| 127 | + info.setImgurl(shareUrlImg); | |
| 128 | + info.setShareType(type); | |
| 129 | + info.setContentId(contentId); | |
| 130 | + | |
| 131 | + if (!TextUtils.isEmpty(wjjShareUrl)) { | |
| 132 | + info.setProcessWjjShare(true); | |
| 133 | + info.setWjjShareUrl(wjjShareUrl); | |
| 134 | + } | |
| 135 | + | |
| 136 | + if (TextUtils.isEmpty(reportType)) reportType = "3"; | |
| 137 | + info.setReportType(reportType); | |
| 138 | + | |
| 139 | + //小程序用的参数 | |
| 140 | + info.setMiniprogramType(miniprogramType); | |
| 141 | + info.setPath(path); | |
| 142 | + info.setUserName(userName); | |
| 143 | + info.setWebpageUrl(webpageUrl); | |
| 144 | + | |
| 145 | + init(); | |
| 146 | + } | |
| 147 | + | |
| 148 | + private void initView() { | |
| 149 | + shareRv = findViewById(R.id.share_rv); | |
| 150 | + shareOther = findViewById(R.id.share_other); | |
| 151 | + ll_cancle = findViewById(R.id.ll_cancle); | |
| 152 | + ll_cancle.setOnClickListener(this); | |
| 153 | + } | |
| 154 | + | |
| 155 | + private List<IconInfo> initList() { | |
| 156 | + //注册微博 | |
| 157 | + if (Util.isWeiboInstallAndInit(this)) { | |
| 158 | + shareHandler = new WbShareHandler(this); | |
| 159 | + shareHandler.registerApp(); | |
| 160 | + } | |
| 161 | + Tencent tencent = Tencent.createInstance(BuildConfig.QQ_SHARE, this.getApplicationContext()); | |
| 162 | + List<IconInfo> list = new ArrayList<>(); | |
| 163 | + if (isShowWjjFriend) | |
| 164 | + list.add(new IconInfo(IconInfo.WJJ_FRIEND, "网家家好友", R.drawable.wjjhaoyou)); | |
| 165 | + if (isShowWjjLife) | |
| 166 | + list.add(new IconInfo(IconInfo.WJJ_CIRCLE, "网家家生活圈", R.drawable.shenghuoquan)); | |
| 167 | + | |
| 168 | + if ((AppConfig.getShareDownload().equals(info.getUrl())) | |
| 169 | + || (info.getUrl().contains("wjjh5.cnlive.com") || info.getUrl().contains("wjjh5test.cnlive.com")) | |
| 170 | + || (!info.getUrl().contains("wjjh5.cnlive.com") && !info.getUrl().contains("wjjh5test.cnlive.com") && showThirdPlatShare)) { | |
| 171 | + list.add(new IconInfo(IconInfo.WECHAT_FRIEND, "微信好友", R.drawable.wechat)); | |
| 172 | + list.add(new IconInfo(IconInfo.WECHAT_CIRCLE, "微信朋友圈", R.drawable.pengyouquan)); | |
| 173 | + list.add(new IconInfo(IconInfo.QQ, "QQ好友", R.drawable.qq)); | |
| 174 | + list.add(new IconInfo(IconInfo.WEBO, "微博", R.drawable.weibo)); | |
| 175 | + } | |
| 176 | + if (isShowOther) list.add(new IconInfo(IconInfo.BROWSER, "在浏览器打开", R.drawable.browser)); | |
| 177 | + return list; | |
| 178 | + } | |
| 179 | + | |
| 180 | + private List<IconInfo> initListOther() { | |
| 181 | + List<IconInfo> list = new ArrayList<>(); | |
| 182 | + if (info != null && isShowReport) | |
| 183 | + list.add(new IconInfo(IconInfo.REPORT, "投诉", R.drawable.report_icon)); | |
| 184 | + return list; | |
| 185 | + } | |
| 186 | + | |
| 187 | + private void init() { | |
| 188 | + adapter = new ShareDialogListAdapter(this, initList()); | |
| 189 | + adapter.setItemClick(this); | |
| 190 | + LinearLayoutManager manager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false); | |
| 191 | + shareRv.setLayoutManager(manager); | |
| 192 | + shareRv.setAdapter(adapter); | |
| 193 | + | |
| 194 | + if (info != null && isShowReport) { | |
| 195 | + shareOther.setVisibility(View.VISIBLE); | |
| 196 | + findViewById(R.id.line).setVisibility(View.VISIBLE); | |
| 197 | + ShareDialogListAdapter adapterOther = new ShareDialogListAdapter(this, initListOther()); | |
| 198 | + adapterOther.setItemClick(this); | |
| 199 | + LinearLayoutManager layoutManagerOther = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false); | |
| 200 | + shareOther.setLayoutManager(layoutManagerOther); | |
| 201 | + shareOther.setAdapter(adapterOther); | |
| 202 | + } | |
| 203 | + | |
| 204 | + } | |
| 205 | + | |
| 206 | + @Override | |
| 207 | + public void onClick(View v) { | |
| 208 | + int i = v.getId(); | |
| 209 | + if (i == R.id.ll_cancle) { | |
| 210 | + finish(); | |
| 211 | + } | |
| 212 | + } | |
| 213 | + | |
| 214 | + @Override | |
| 215 | + protected void onRestart() { | |
| 216 | + super.onRestart(); | |
| 217 | + } | |
| 218 | + | |
| 219 | + @Override | |
| 220 | + public void onItemClick(int position, String type) { | |
| 221 | + if (info.getUrl() == null || !Util.isNetUrl(info.getUrl())) { | |
| 222 | + info.setUrl(AppConfig.getShareDownload()); | |
| 223 | + } | |
| 224 | + if (DoublePressed.onDoublePressed(false, 1000L)) return; | |
| 225 | + switch (type) { | |
| 226 | + case IconInfo.WJJ_FRIEND: | |
| 227 | + ShareUtils.shareAppIM(info, this); | |
| 228 | + ShareClickObservable.getInstance().update(1); | |
| 229 | +// finish(); | |
| 230 | + break; | |
| 231 | + case IconInfo.WJJ_CIRCLE: | |
| 232 | + ShareUtils.shareAppMoment(info, this); | |
| 233 | + ShareClickObservable.getInstance().update(2); | |
| 234 | +// finish(); | |
| 235 | + break; | |
| 236 | + case IconInfo.WECHAT_FRIEND: | |
| 237 | + if (!TextUtils.isEmpty(info.getPath()) && !TextUtils.isEmpty(info.getUserName()) && !TextUtils.isEmpty(info.getWebpageUrl()) && info.getMiniprogramType() != -1) { | |
| 238 | + ShareUtils.shareWechatApplet(this, info); | |
| 239 | + ShareClickObservable.getInstance().update(3); | |
| 240 | + } else { | |
| 241 | + ShareUtils.shareWechat(info, this); | |
| 242 | + } | |
| 243 | + | |
| 244 | + break; | |
| 245 | + case IconInfo.WECHAT_CIRCLE: | |
| 246 | + ShareUtils.shareWCE(info, this); | |
| 247 | + ShareClickObservable.getInstance().update(3); | |
| 248 | + break; | |
| 249 | + case IconInfo.QQ: | |
| 250 | + ShareUtils.shareQQActivity(info, this, this); | |
| 251 | + ShareClickObservable.getInstance().update(5); | |
| 252 | + break; | |
| 253 | + case IconInfo.WEBO: | |
| 254 | + ShareUtils.shareWeiBo(this, info); | |
| 255 | + ShareClickObservable.getInstance().update(6); | |
| 256 | + break; | |
| 257 | + case IconInfo.BROWSER: | |
| 258 | + ShareUtils.startBrowser(this, info.getUrl()); | |
| 259 | + ShareClickObservable.getInstance().update(7); | |
| 260 | + finish(); | |
| 261 | + break; | |
| 262 | + case IconInfo.REPORT: | |
| 263 | + if (info != null && !TextUtils.isEmpty(info.getContentId())) { | |
| 264 | + ShareOtherUtil.report(this, info.getContentId(), info.getReportType()); | |
| 265 | + ShareClickObservable.getInstance().update(8); | |
| 266 | + } else { | |
| 267 | + AlertUtil.showDeftToast(this, "数据异常"); | |
| 268 | + } | |
| 269 | + finish(); | |
| 270 | + break; | |
| 271 | + } | |
| 272 | + } | |
| 273 | + | |
| 274 | + @Override | |
| 275 | + public void finish() { | |
| 276 | + super.finish(); | |
| 277 | + overridePendingTransition(R.anim.share_activity_in, R.anim.share_activity_out); | |
| 278 | + } | |
| 279 | + | |
| 280 | + @Override | |
| 281 | + protected void onDestroy() { | |
| 282 | + super.onDestroy(); | |
| 283 | + WechatShareObservable.getInstance().deleteObserver(this); | |
| 284 | + ShareWjjStateObservable.newInstance().deleteObserver(this); | |
| 285 | + } | |
| 286 | + | |
| 287 | + public void showMessage(String msg) { | |
| 288 | + AlertUtil.showDeftToast(this, msg); | |
| 289 | + } | |
| 290 | + | |
| 291 | + @Override | |
| 292 | + protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { | |
| 293 | + super.onActivityResult(requestCode, resultCode, data); | |
| 294 | + if (shareHandler != null) shareHandler.doResultIntent(data, this); | |
| 295 | + // 官方文档没这句代码, 但是很很很重要, 不然不会回调! | |
| 296 | + Tencent.onActivityResultData(requestCode, resultCode, data, this); | |
| 297 | + if (requestCode == Constants.REQUEST_API) { | |
| 298 | + if (resultCode == Constants.REQUEST_QQ_SHARE || | |
| 299 | + resultCode == Constants.REQUEST_QZONE_SHARE || | |
| 300 | + resultCode == Constants.REQUEST_OLD_SHARE) { | |
| 301 | + Tencent.handleResultData(data, this); | |
| 302 | + } | |
| 303 | + } | |
| 304 | + } | |
| 305 | + | |
| 306 | + @Override | |
| 307 | + public void onComplete(Object o) { | |
| 308 | + if (isOpenShareCallBackEentBus) { | |
| 309 | + shopCallback("5", true); | |
| 310 | + } else { | |
| 311 | + ShareUtils.processQQCallBack(this, info.getShareType(), info.getContentId()); | |
| 312 | + showMessage("分享成功"); | |
| 313 | + } | |
| 314 | + finish(); | |
| 315 | + } | |
| 316 | + | |
| 317 | + @Override | |
| 318 | + public void onError(UiError uiError) { | |
| 319 | + if (isOpenShareCallBackEentBus) { | |
| 320 | + shopCallback("5", false); | |
| 321 | + } else { | |
| 322 | + showMessage("分享失败"); | |
| 323 | + } | |
| 324 | + finish(); | |
| 325 | + } | |
| 326 | + | |
| 327 | + @Override | |
| 328 | + public void onCancel() { | |
| 329 | + if (isOpenShareCallBackEentBus) { | |
| 330 | + shopCallback("5", false); | |
| 331 | + } else { | |
| 332 | + showMessage("分享取消"); | |
| 333 | + } | |
| 334 | + finish(); | |
| 335 | + } | |
| 336 | + | |
| 337 | + @Override | |
| 338 | + public void onWbShareSuccess() { | |
| 339 | + if (isOpenShareCallBackEentBus) { | |
| 340 | + shopCallback("6", true); | |
| 341 | + } else { | |
| 342 | + showMessage("分享成功"); | |
| 343 | + } | |
| 344 | + finish(); | |
| 345 | + } | |
| 346 | + | |
| 347 | + @Override | |
| 348 | + public void onWbShareCancel() { | |
| 349 | + if (isOpenShareCallBackEentBus) { | |
| 350 | + shopCallback("6", false); | |
| 351 | + } else { | |
| 352 | + showMessage("分享取消"); | |
| 353 | + } | |
| 354 | + finish(); | |
| 355 | + } | |
| 356 | + | |
| 357 | + @Override | |
| 358 | + public void onWbShareFail() { | |
| 359 | + if (isOpenShareCallBackEentBus) { | |
| 360 | + shopCallback("6", false); | |
| 361 | + } else { | |
| 362 | + showMessage("分享失败"); | |
| 363 | + } | |
| 364 | + finish(); | |
| 365 | + } | |
| 366 | + | |
| 367 | + private void shopCallback(String type, boolean isSuccess) { | |
| 368 | + if (isOpenShareCallBackEentBus) { | |
| 369 | + Intent intent = new Intent(); | |
| 370 | + intent.putExtra("shopShareType", shopShareType); | |
| 371 | + intent.putExtra("isShareSuccess", isSuccess); | |
| 372 | + setResult(10010, intent); | |
| 373 | + | |
| 374 | + ShareStateInfo info = new ShareStateInfo(); | |
| 375 | + info.setShareSuccess(isSuccess); | |
| 376 | + info.setShopShareType(shopShareType); | |
| 377 | + info.setType(type); | |
| 378 | + ShareStateObservable.newInstance().update(info); | |
| 379 | + } | |
| 380 | + | |
| 381 | + } | |
| 382 | + | |
| 383 | + @Override | |
| 384 | + public void update(java.util.Observable observable, Object o) { | |
| 385 | + if (observable instanceof WechatShareObservable && o != null) { | |
| 386 | + int state = (int) o; | |
| 387 | + if (1 == state) { | |
| 388 | + //成功 | |
| 389 | + shopCallback("3", true); | |
| 390 | + } else if (2 == state) { | |
| 391 | + //取消 | |
| 392 | + if (isOpenShareCallBackEentBus) { | |
| 393 | + shopCallback("3", false); | |
| 394 | + } | |
| 395 | + } else if (3 == state) { | |
| 396 | + //失败 | |
| 397 | + shopCallback("3", false); | |
| 398 | + } else { | |
| 399 | + //其他 | |
| 400 | + shopCallback("3", false); | |
| 401 | + } | |
| 402 | + finish(); | |
| 403 | + } else if (observable instanceof ShareWjjStateObservable && o != null) { | |
| 404 | + boolean isSuccess= (boolean) o; | |
| 405 | + if (isSuccess){ | |
| 406 | + shopCallback("1", true); | |
| 407 | + }else { | |
| 408 | + shopCallback("1", false); | |
| 409 | + } | |
| 410 | + finish(); | |
| 411 | + } | |
| 412 | + } | |
| 413 | +} | ... | ... |
cloud/share/src/main/java/com/cnlive/share/ui/ShareDialogListAdapter.java
0 → 100644
| 1 | +package com.cnlive.share.ui; | |
| 2 | + | |
| 3 | +import android.content.Context; | |
| 4 | +import android.view.LayoutInflater; | |
| 5 | +import android.view.View; | |
| 6 | +import android.view.ViewGroup; | |
| 7 | +import android.widget.ImageView; | |
| 8 | +import android.widget.TextView; | |
| 9 | + | |
| 10 | +import com.cnlive.share.R; | |
| 11 | +import com.cnlive.share.data.IconInfo; | |
| 12 | + | |
| 13 | +import java.util.List; | |
| 14 | + | |
| 15 | +import androidx.annotation.NonNull; | |
| 16 | +import androidx.recyclerview.widget.RecyclerView; | |
| 17 | + | |
| 18 | +/** | |
| 19 | + * Created by Lynn on 2018/8/23. | |
| 20 | + */ | |
| 21 | + | |
| 22 | +public class ShareDialogListAdapter extends RecyclerView.Adapter<ShareDialogListAdapter.ShareDialogViewHolder> { | |
| 23 | + private Context context; | |
| 24 | + private List<IconInfo> data; | |
| 25 | + private ItemClick itemClick; | |
| 26 | + | |
| 27 | + public ShareDialogListAdapter(Context context, List<IconInfo> data) { | |
| 28 | + this.data = data; | |
| 29 | + this.context = context; | |
| 30 | + } | |
| 31 | + | |
| 32 | + public void setItemClick(ItemClick itemClick) { | |
| 33 | + this.itemClick = itemClick; | |
| 34 | + } | |
| 35 | + | |
| 36 | + @NonNull | |
| 37 | + @Override | |
| 38 | + public ShareDialogListAdapter.ShareDialogViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { | |
| 39 | + View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.share_dialog_item, parent, false); | |
| 40 | + ShareDialogViewHolder holder = new ShareDialogViewHolder(view); | |
| 41 | + return holder; | |
| 42 | + } | |
| 43 | + | |
| 44 | + @Override | |
| 45 | + public void onBindViewHolder(@NonNull ShareDialogListAdapter.ShareDialogViewHolder holder, final int position) { | |
| 46 | + holder.name.setText(data.get(position).getTitle()); | |
| 47 | + holder.icon.setImageResource(data.get(position).getIcon()); | |
| 48 | + holder.itemView.setOnClickListener(new View.OnClickListener() { | |
| 49 | + @Override | |
| 50 | + public void onClick(View v) { | |
| 51 | + if (itemClick != null) { | |
| 52 | + itemClick.onItemClick(position, data.get(position).getId()); | |
| 53 | + } | |
| 54 | + } | |
| 55 | + }); | |
| 56 | + } | |
| 57 | + | |
| 58 | + @Override | |
| 59 | + public int getItemCount() { | |
| 60 | + return data.size(); | |
| 61 | + } | |
| 62 | + | |
| 63 | + public void updateItems(List<IconInfo> newData) { | |
| 64 | + if (data != null) { | |
| 65 | + data.clear(); | |
| 66 | + data.addAll(newData); | |
| 67 | + notifyDataSetChanged(); | |
| 68 | + } | |
| 69 | + } | |
| 70 | + | |
| 71 | + class ShareDialogViewHolder extends RecyclerView.ViewHolder { | |
| 72 | + public TextView name; | |
| 73 | + public ImageView icon; | |
| 74 | + | |
| 75 | + public ShareDialogViewHolder(View itemView) { | |
| 76 | + super(itemView); | |
| 77 | + name = itemView.findViewById(R.id.name); | |
| 78 | + icon = itemView.findViewById(R.id.icon); | |
| 79 | + } | |
| 80 | + } | |
| 81 | + | |
| 82 | + public interface ItemClick { | |
| 83 | + void onItemClick(int position, String type); | |
| 84 | + } | |
| 85 | +} | ... | ... |
cloud/share/src/main/java/com/cnlive/share/ui/ShareImgActivity.java
0 → 100644
| 1 | +package com.cnlive.share.ui; | |
| 2 | + | |
| 3 | + | |
| 4 | +import android.content.Context; | |
| 5 | +import android.content.Intent; | |
| 6 | +import android.content.SharedPreferences; | |
| 7 | +import android.graphics.Bitmap; | |
| 8 | +import android.graphics.BitmapFactory; | |
| 9 | +import android.net.Uri; | |
| 10 | +import android.os.Build; | |
| 11 | +import android.os.Bundle; | |
| 12 | +import android.os.Environment; | |
| 13 | +import android.util.Base64; | |
| 14 | +import android.view.ViewGroup; | |
| 15 | +import android.widget.LinearLayout; | |
| 16 | + | |
| 17 | +import com.alibaba.android.arouter.facade.annotation.Route; | |
| 18 | +import com.cnlive.core.libs.base.util.AlertUtil; | |
| 19 | +import com.cnlive.core.libs.base.util.DoublePressed; | |
| 20 | +import com.cnlive.share.BuildConfig; | |
| 21 | +import com.cnlive.share.R; | |
| 22 | +import com.cnlive.share.data.IconInfo; | |
| 23 | +import com.cnlive.share.observable.ShareClickObservable; | |
| 24 | +import com.cnlive.share.util.ShareUtils; | |
| 25 | +import com.cnlive.share.util.Util; | |
| 26 | +import com.cnlive.strike.user.auth.UserService; | |
| 27 | +import com.sina.weibo.sdk.share.WbShareCallback; | |
| 28 | +import com.sina.weibo.sdk.share.WbShareHandler; | |
| 29 | +import com.tencent.connect.common.Constants; | |
| 30 | +import com.tencent.tauth.IUiListener; | |
| 31 | +import com.tencent.tauth.Tencent; | |
| 32 | +import com.tencent.tauth.UiError; | |
| 33 | + | |
| 34 | +import java.io.File; | |
| 35 | +import java.io.FileOutputStream; | |
| 36 | +import java.io.IOException; | |
| 37 | +import java.text.SimpleDateFormat; | |
| 38 | +import java.util.ArrayList; | |
| 39 | +import java.util.Date; | |
| 40 | +import java.util.List; | |
| 41 | + | |
| 42 | +import androidx.annotation.Nullable; | |
| 43 | +import androidx.appcompat.app.AppCompatActivity; | |
| 44 | +import androidx.recyclerview.widget.LinearLayoutManager; | |
| 45 | +import androidx.recyclerview.widget.RecyclerView; | |
| 46 | + | |
| 47 | +/** | |
| 48 | + * Created by hanyayun 019/06/18. | |
| 49 | + */ | |
| 50 | +@Route(path = "/share/ShareImgActivity") | |
| 51 | +public class ShareImgActivity extends AppCompatActivity implements ShareDialogListAdapter.ItemClick, IUiListener, WbShareCallback { | |
| 52 | + private RecyclerView shareRv; | |
| 53 | + private LinearLayout cancle; | |
| 54 | + private ShareDialogListAdapter adapter; | |
| 55 | + private Bitmap bitmap; | |
| 56 | + private File file; | |
| 57 | + private String fileName; | |
| 58 | + private boolean isShowWjjLife; | |
| 59 | + private boolean isShowWjjFriend; | |
| 60 | + private boolean isShowOther; | |
| 61 | + private boolean isShowReport; | |
| 62 | + private boolean isShowQQ; | |
| 63 | + private boolean isShowWB; | |
| 64 | + private boolean isShowWC; | |
| 65 | + private boolean isShowSave; | |
| 66 | + private WbShareHandler shareHandler; | |
| 67 | + | |
| 68 | + @Override | |
| 69 | + protected void onCreate(Bundle savedInstanceState) { | |
| 70 | + super.onCreate(savedInstanceState); | |
| 71 | + setContentView(R.layout.activity_share_img); | |
| 72 | + getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); | |
| 73 | + isShowWjjLife = getIntent().getBooleanExtra("isShowWjjLife", true); | |
| 74 | + isShowWjjFriend = getIntent().getBooleanExtra("isShowWjjFriend", true); | |
| 75 | + isShowOther = getIntent().getBooleanExtra("isShowOther", true); | |
| 76 | + isShowReport = getIntent().getBooleanExtra("isShowReport", true); | |
| 77 | + isShowQQ = getIntent().getBooleanExtra("isShowReport", true); | |
| 78 | + isShowWB = getIntent().getBooleanExtra("isShowReport", true); | |
| 79 | + isShowWC = getIntent().getBooleanExtra("isShowReport", true); | |
| 80 | + isShowSave = getIntent().getBooleanExtra("isShowReport", true); | |
| 81 | + initView(); | |
| 82 | + initList(); | |
| 83 | + } | |
| 84 | + | |
| 85 | + private void initView() { | |
| 86 | + shareRv = findViewById(R.id.share_img_rv); | |
| 87 | + cancle = findViewById(R.id.ll_img_cancle); | |
| 88 | + findViewById(R.id.ry_share).setOnClickListener(v -> finish()); | |
| 89 | + cancle.setOnClickListener(v -> finish()); | |
| 90 | + } | |
| 91 | + | |
| 92 | + private void initList() { | |
| 93 | + if (getIntent().getStringExtra("fileName") != null) | |
| 94 | + fileName = UserService.getUid(this) + getIntent().getStringExtra("fileName"); | |
| 95 | + SharedPreferences sp = this.getSharedPreferences("sp", Context.MODE_PRIVATE); | |
| 96 | + String bt = sp.getString("share_img_string", ""); | |
| 97 | + bitmap = convertStringToIcon(bt); | |
| 98 | + List<IconInfo> list = new ArrayList<>(); | |
| 99 | + if (isShowWjjFriend) | |
| 100 | + list.add(new IconInfo(IconInfo.WJJ_FRIEND, "网家家好友", R.drawable.wjjhaoyou)); | |
| 101 | + if (isShowWjjLife) | |
| 102 | + list.add(new IconInfo(IconInfo.WJJ_CIRCLE, "生活圈", R.drawable.shenghuoquan)); | |
| 103 | + if (isShowWC) { | |
| 104 | + list.add(new IconInfo(IconInfo.WECHAT_FRIEND, "微信好友", R.drawable.wechat)); | |
| 105 | + list.add(new IconInfo(IconInfo.WECHAT_CIRCLE, "微信朋友圈", R.drawable.pengyouquan)); | |
| 106 | + } | |
| 107 | + if (isShowWB) { | |
| 108 | + //注册微博 | |
| 109 | + if (Util.isWeiboInstallAndInit(this)) { | |
| 110 | + shareHandler = new WbShareHandler(this); | |
| 111 | + shareHandler.registerApp(); | |
| 112 | + } | |
| 113 | + list.add(new IconInfo(IconInfo.WEBO, "微博", R.drawable.weibo)); | |
| 114 | + } | |
| 115 | + if (isShowQQ) { | |
| 116 | + Tencent tencent = Tencent.createInstance(BuildConfig.QQ_SHARE, this.getApplicationContext()); | |
| 117 | + list.add(new IconInfo(IconInfo.QQ, "QQ好友", R.drawable.qq)); | |
| 118 | + } | |
| 119 | + if (isShowSave) | |
| 120 | + list.add(new IconInfo(IconInfo.DOWNLOAD_ALBUM_IMG, "保存到相册", R.drawable.download_album)); | |
| 121 | + | |
| 122 | + | |
| 123 | + adapter = new ShareDialogListAdapter(this, list); | |
| 124 | + adapter.setItemClick(this); | |
| 125 | + LinearLayoutManager manager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false); | |
| 126 | + shareRv.setLayoutManager(manager); | |
| 127 | + shareRv.setAdapter(adapter); | |
| 128 | + } | |
| 129 | + | |
| 130 | + | |
| 131 | + /** | |
| 132 | + * string转成bitmap | |
| 133 | + * | |
| 134 | + * @param str | |
| 135 | + */ | |
| 136 | + public static Bitmap convertStringToIcon(String str) { | |
| 137 | + Bitmap bitmap = null; | |
| 138 | + try { | |
| 139 | + byte[] bitmapArray; | |
| 140 | + bitmapArray = Base64.decode(str, Base64.DEFAULT); | |
| 141 | + bitmap = | |
| 142 | + BitmapFactory.decodeByteArray(bitmapArray, 0, | |
| 143 | + bitmapArray.length); | |
| 144 | + return bitmap; | |
| 145 | + } catch (Exception e) { | |
| 146 | + return null; | |
| 147 | + } | |
| 148 | + } | |
| 149 | + | |
| 150 | + | |
| 151 | + @Override | |
| 152 | + public void onItemClick(int position, String type) { | |
| 153 | + if (DoublePressed.onDoublePressed(false, 1000L)) return; | |
| 154 | + switch (type) { | |
| 155 | + case IconInfo.WJJ_FRIEND: | |
| 156 | + if (saveImageToGallery(bitmap, file, "friends") == null) | |
| 157 | + AlertUtil.showDeftToast(this, "图片异常"); | |
| 158 | + break; | |
| 159 | + case IconInfo.WJJ_CIRCLE: | |
| 160 | + if (saveImageToGallery(bitmap, file, "life") == null) | |
| 161 | + AlertUtil.showDeftToast(this, "图片异常"); | |
| 162 | + break; | |
| 163 | + case IconInfo.WECHAT_FRIEND: | |
| 164 | + ShareUtils.shareWechatPic(this, bitmap, true); | |
| 165 | + finish(); | |
| 166 | + break; | |
| 167 | + | |
| 168 | + | |
| 169 | + case IconInfo.QQ: | |
| 170 | + File shareFile; | |
| 171 | + if(file != null){ | |
| 172 | + shareFile = file; | |
| 173 | + }else { | |
| 174 | + shareFile = saveImageToGallery(bitmap, null, ""); | |
| 175 | + if(shareFile == null) { | |
| 176 | + AlertUtil.showDeftToast(this, "图片异常"); | |
| 177 | + return; | |
| 178 | + } | |
| 179 | + } | |
| 180 | + //图片地址 根据文件去getPath或者其余方法进行分享 | |
| 181 | + if (shareFile.exists()){ | |
| 182 | + if (shareFile.length()<=5*1024*1024){ | |
| 183 | + ShareUtils.showQQPic(shareFile, this); | |
| 184 | + ShareClickObservable.getInstance().update(5); | |
| 185 | + }else { | |
| 186 | + showMessage("图片超过"); | |
| 187 | + } | |
| 188 | + }else { | |
| 189 | + showMessage("图片异常"); | |
| 190 | + } | |
| 191 | + break; | |
| 192 | + case IconInfo.WEBO: | |
| 193 | + if (bitmap!=null){ | |
| 194 | + ShareUtils.shareWbPic(this, bitmap); | |
| 195 | + ShareClickObservable.getInstance().update(6); | |
| 196 | + }else { | |
| 197 | + showMessage("图片异常"); | |
| 198 | + } | |
| 199 | + break; | |
| 200 | + | |
| 201 | + | |
| 202 | + case IconInfo.WECHAT_CIRCLE: | |
| 203 | + ShareUtils.shareWechatPic(this, bitmap, false); | |
| 204 | + finish(); | |
| 205 | + break; | |
| 206 | + case IconInfo.DOWNLOAD_ALBUM_IMG: | |
| 207 | + if (saveImageToGallery(bitmap, file, "send") == null) { | |
| 208 | + AlertUtil.showDeftToast(this, "保存失败,请重新点击下载"); | |
| 209 | + } else { | |
| 210 | + AlertUtil.showDeftToast(this, "保存成功"); | |
| 211 | + finish(); | |
| 212 | + } | |
| 213 | + break; | |
| 214 | + } | |
| 215 | + } | |
| 216 | + | |
| 217 | + | |
| 218 | + public File saveImageToGallery(Bitmap bmp, File file, String type) { | |
| 219 | + //生成路径 | |
| 220 | + if (file != null) { | |
| 221 | + if (type.equals("friends")) { | |
| 222 | + ShareUtils.getForwardingImgPath(ShareImgActivity.this, type, file.getPath()); | |
| 223 | + } else if (type.equals("life")) { | |
| 224 | + ShareUtils.getForwardingImgPath(ShareImgActivity.this, type, file.getPath()); | |
| 225 | + } else { | |
| 226 | + sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(new File(file.getPath())))); | |
| 227 | + } | |
| 228 | + return file; | |
| 229 | + } | |
| 230 | + String root = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q ? getExternalFilesDir(Environment.DIRECTORY_PICTURES)+"" :Environment.getExternalStorageDirectory().getAbsolutePath(); | |
| 231 | + String dirName = "erweimaWjj"; | |
| 232 | + File appDir = new File(root, dirName); | |
| 233 | + if (!appDir.exists()) { | |
| 234 | + appDir.mkdirs(); | |
| 235 | + } | |
| 236 | + | |
| 237 | + //文件名 | |
| 238 | + String fileNames = ""; | |
| 239 | + if (fileName != null) { | |
| 240 | + fileNames = fileName + ".jpg"; | |
| 241 | + if (new File(appDir, fileNames).exists()) new File(appDir, fileNames).delete(); | |
| 242 | + } else { | |
| 243 | + long timeStamp = System.currentTimeMillis(); | |
| 244 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 245 | + String sd = sdf.format(new Date(timeStamp)); | |
| 246 | + fileNames = sd + ".jpg"; | |
| 247 | + } | |
| 248 | + //获取文件 | |
| 249 | + file = new File(appDir, fileNames); | |
| 250 | + FileOutputStream fos = null; | |
| 251 | + try { | |
| 252 | + fos = new FileOutputStream(file); | |
| 253 | + bmp.compress(Bitmap.CompressFormat.JPEG, 100, fos); | |
| 254 | + fos.flush(); | |
| 255 | + //通知系统相册刷新 | |
| 256 | + if (type.equals("friends")) { | |
| 257 | + ShareUtils.getForwardingImgPath(ShareImgActivity.this, type, file.getPath()); | |
| 258 | + } else if (type.equals("life")) { | |
| 259 | + ShareUtils.getForwardingImgPath(ShareImgActivity.this, type, file.getPath()); | |
| 260 | + } else { | |
| 261 | + sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(new File(file.getPath())))); | |
| 262 | + } | |
| 263 | + return file; | |
| 264 | + } catch (Exception e) { | |
| 265 | + e.printStackTrace(); | |
| 266 | + }finally { | |
| 267 | + try { | |
| 268 | + if (fos != null) { | |
| 269 | + fos.close(); | |
| 270 | + } | |
| 271 | + } catch (IOException e) { | |
| 272 | + e.printStackTrace(); | |
| 273 | + } | |
| 274 | + } | |
| 275 | + return null; | |
| 276 | + } | |
| 277 | + | |
| 278 | + @Override | |
| 279 | + protected void onRestart() { | |
| 280 | + super.onRestart(); | |
| 281 | + } | |
| 282 | + | |
| 283 | + @Override | |
| 284 | + public void finish() { | |
| 285 | + super.finish(); | |
| 286 | + overridePendingTransition(R.anim.share_activity_in, R.anim.share_activity_out); | |
| 287 | + } | |
| 288 | + | |
| 289 | + @Override | |
| 290 | + protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { | |
| 291 | + super.onActivityResult(requestCode, resultCode, data); | |
| 292 | + if (shareHandler != null) shareHandler.doResultIntent(data, this); | |
| 293 | + // 官方文档没这句代码, 但是很很很重要, 不然不会回调! | |
| 294 | + Tencent.onActivityResultData(requestCode, resultCode, data, this); | |
| 295 | + if (requestCode == Constants.REQUEST_QQ_SHARE) { | |
| 296 | + Tencent.handleResultData(data, this); | |
| 297 | + } | |
| 298 | + } | |
| 299 | + | |
| 300 | + public void showMessage(String msg) { | |
| 301 | + AlertUtil.showDeftToast(this, msg); | |
| 302 | + } | |
| 303 | + | |
| 304 | + @Override | |
| 305 | + public void onComplete(Object o) { | |
| 306 | + showMessage("分享成功"); | |
| 307 | + finish(); | |
| 308 | + } | |
| 309 | + | |
| 310 | + @Override | |
| 311 | + public void onError(UiError uiError) { | |
| 312 | + showMessage("分享失败"); | |
| 313 | + } | |
| 314 | + | |
| 315 | + @Override | |
| 316 | + public void onCancel() { | |
| 317 | + showMessage("分享取消"); | |
| 318 | + } | |
| 319 | + | |
| 320 | + @Override | |
| 321 | + public void onWbShareSuccess() { | |
| 322 | + showMessage("分享成功"); | |
| 323 | + finish(); | |
| 324 | + } | |
| 325 | + | |
| 326 | + @Override | |
| 327 | + public void onWbShareCancel() { | |
| 328 | + showMessage("分享取消"); | |
| 329 | + } | |
| 330 | + | |
| 331 | + @Override | |
| 332 | + public void onWbShareFail() { | |
| 333 | + showMessage("分享失败"); | |
| 334 | + } | |
| 335 | +} | ... | ... |
cloud/share/src/main/java/com/cnlive/share/ui/WechatAppletActivity.java
0 → 100644
| 1 | +package com.cnlive.share.ui; | |
| 2 | + | |
| 3 | +import android.app.Activity; | |
| 4 | +import android.content.res.Resources; | |
| 5 | +import android.graphics.Bitmap; | |
| 6 | +import android.graphics.BitmapFactory; | |
| 7 | +import android.os.Bundle; | |
| 8 | +import android.text.TextUtils; | |
| 9 | + | |
| 10 | +import com.alibaba.android.arouter.facade.annotation.Route; | |
| 11 | +import com.bumptech.glide.Glide; | |
| 12 | +import com.bumptech.glide.request.RequestOptions; | |
| 13 | +import com.cnlive.core.libs.base.application.AppConfig; | |
| 14 | +import com.cnlive.share.BuildConfig; | |
| 15 | +import com.cnlive.share.R; | |
| 16 | +import com.cnlive.share.util.Util; | |
| 17 | +import com.tencent.mm.opensdk.modelmsg.SendMessageToWX; | |
| 18 | +import com.tencent.mm.opensdk.modelmsg.WXMediaMessage; | |
| 19 | +import com.tencent.mm.opensdk.modelmsg.WXMiniProgramObject; | |
| 20 | +import com.tencent.mm.opensdk.openapi.IWXAPI; | |
| 21 | +import com.tencent.mm.opensdk.openapi.WXAPIFactory; | |
| 22 | + | |
| 23 | +import java.util.concurrent.TimeUnit; | |
| 24 | + | |
| 25 | + | |
| 26 | +/** | |
| 27 | + * 作者: 吴奎庆 | |
| 28 | + * <p> | |
| 29 | + * 时间: 2019/3/20 | |
| 30 | + * <p> | |
| 31 | + * 简介: | |
| 32 | + */ | |
| 33 | +@Route(path = "/share/WechatAppletActivity") | |
| 34 | +public class WechatAppletActivity extends Activity { | |
| 35 | + | |
| 36 | + private String webpageUrl; | |
| 37 | + private int miniprogramType; | |
| 38 | + private String userName; | |
| 39 | + private String path; | |
| 40 | + private String title; | |
| 41 | + private String description; | |
| 42 | + | |
| 43 | + @Override | |
| 44 | + protected void onCreate(Bundle savedInstanceState) { | |
| 45 | + super.onCreate(savedInstanceState); | |
| 46 | + webpageUrl = getIntent().getStringExtra("webpageUrl"); | |
| 47 | + miniprogramType = getIntent().getIntExtra("miniprogramType", -1); | |
| 48 | + userName = getIntent().getStringExtra("userName"); | |
| 49 | + path = getIntent().getStringExtra("path"); | |
| 50 | + title = getIntent().getStringExtra("title"); | |
| 51 | + description = getIntent().getStringExtra("description"); | |
| 52 | + String shareImgUrl = getIntent().getStringExtra("shareImgUrl"); | |
| 53 | + | |
| 54 | + if (TextUtils.isEmpty(shareImgUrl)) shareImgUrl = AppConfig.getShareIcon(); | |
| 55 | + processImgUrlData(shareImgUrl); | |
| 56 | + } | |
| 57 | + | |
| 58 | + private void processImgUrlData(String imgUrl) { | |
| 59 | + new Thread(new Runnable() { | |
| 60 | + @Override | |
| 61 | + public void run() { | |
| 62 | + try { | |
| 63 | + Bitmap bitmap = Glide.with(WechatAppletActivity.this) | |
| 64 | + .setDefaultRequestOptions(new RequestOptions().centerCrop()) | |
| 65 | + .asBitmap() | |
| 66 | + .load(imgUrl) | |
| 67 | + .into(120, 120) | |
| 68 | + .get(2, TimeUnit.SECONDS); | |
| 69 | + if (bitmap == null) { | |
| 70 | + Resources res = getResources(); | |
| 71 | + Bitmap bmp = BitmapFactory.decodeResource(res, R.drawable.share_logo_share_module); | |
| 72 | + Bitmap thumbBmp = Bitmap.createScaledBitmap(bmp, 120, 120, true); | |
| 73 | + shareWechatApplet(thumbBmp); | |
| 74 | + return; | |
| 75 | + } | |
| 76 | + shareWechatApplet(bitmap); | |
| 77 | + } catch (Exception e) { | |
| 78 | + Resources res = getResources(); | |
| 79 | + Bitmap bmp = BitmapFactory.decodeResource(res, R.drawable.share_logo_share_module); | |
| 80 | + Bitmap thumbBmp = Bitmap.createScaledBitmap(bmp, 120, 120, true); | |
| 81 | + shareWechatApplet(thumbBmp); | |
| 82 | + } | |
| 83 | + | |
| 84 | + } | |
| 85 | + }).start(); | |
| 86 | + } | |
| 87 | + | |
| 88 | + private void shareWechatApplet(Bitmap thumbBmp) { | |
| 89 | + IWXAPI api = WXAPIFactory.createWXAPI(this, BuildConfig.WECHAT_SHARE); | |
| 90 | + WXMiniProgramObject miniProgramObj = new WXMiniProgramObject(); | |
| 91 | + miniProgramObj.webpageUrl = webpageUrl; // 兼容低版本的网页链接 | |
| 92 | + miniProgramObj.miniprogramType = miniprogramType;// 正式版:0,测试版:1,体验版:2 | |
| 93 | + miniProgramObj.userName = userName; // 小程序原始id | |
| 94 | + miniProgramObj.path = path; //小程序页面路径 | |
| 95 | + WXMediaMessage msg = new WXMediaMessage(miniProgramObj); | |
| 96 | + msg.title = title; // 小程序消息title | |
| 97 | + msg.description = description; // 小程序消息desc | |
| 98 | + msg.thumbData = Util.bmpToByteArray(thumbBmp, true); // 小程序消息封面图片,小于128k | |
| 99 | + | |
| 100 | + SendMessageToWX.Req req = new SendMessageToWX.Req(); | |
| 101 | + req.transaction = Util.buildTransaction("miniProgram"); | |
| 102 | + req.message = msg; | |
| 103 | + req.scene = SendMessageToWX.Req.WXSceneSession; // 目前只支持会话 | |
| 104 | + api.sendReq(req); | |
| 105 | + finish(); | |
| 106 | + } | |
| 107 | +} | ... | ... |
cloud/share/src/main/java/com/cnlive/share/ui/dialog/ShareDialog.java
0 → 100644
| 1 | +package com.cnlive.share.ui.dialog; | |
| 2 | + | |
| 3 | + | |
| 4 | +import android.app.Activity; | |
| 5 | +import android.app.Dialog; | |
| 6 | +import android.os.Bundle; | |
| 7 | +import android.text.TextUtils; | |
| 8 | +import android.util.DisplayMetrics; | |
| 9 | +import android.view.View; | |
| 10 | +import android.view.ViewGroup; | |
| 11 | +import android.view.Window; | |
| 12 | +import android.view.WindowManager; | |
| 13 | +import android.widget.LinearLayout; | |
| 14 | + | |
| 15 | +import com.cnlive.core.libs.base.application.AppConfig; | |
| 16 | +import com.cnlive.core.libs.base.util.AlertUtil; | |
| 17 | +import com.cnlive.core.libs.base.util.SharedPreferencesHelper; | |
| 18 | +import com.cnlive.share.R; | |
| 19 | +import com.cnlive.share.data.IconInfo; | |
| 20 | +import com.cnlive.share.data.ShareInfo; | |
| 21 | +import com.cnlive.share.model.ShareReleaseInfoUtil; | |
| 22 | +import com.cnlive.share.observable.ShareClickObservable; | |
| 23 | +import com.cnlive.share.ui.ShareDialogListAdapter; | |
| 24 | +import com.cnlive.share.util.ShareOtherUtil; | |
| 25 | +import com.cnlive.share.util.ShareUtils; | |
| 26 | +import com.cnlive.share.util.Util; | |
| 27 | + | |
| 28 | +import java.util.ArrayList; | |
| 29 | +import java.util.List; | |
| 30 | + | |
| 31 | +import androidx.annotation.NonNull; | |
| 32 | +import androidx.recyclerview.widget.LinearLayoutManager; | |
| 33 | +import androidx.recyclerview.widget.RecyclerView; | |
| 34 | + | |
| 35 | +/** | |
| 36 | + * 创建:wukuiqing | |
| 37 | + * <p> | |
| 38 | + * 时间:2017/10/11A | |
| 39 | + * <p> | |
| 40 | + * 描述:分享的dialog | |
| 41 | + */ | |
| 42 | + | |
| 43 | +public class ShareDialog extends Dialog implements View.OnClickListener, ShareDialogListAdapter.ItemClick { | |
| 44 | + | |
| 45 | + private Activity mContext; | |
| 46 | + private LinearLayout ll_cancle; | |
| 47 | + private ShareInfo info; | |
| 48 | + private RecyclerView shareRv; | |
| 49 | + private RecyclerView shareOther; | |
| 50 | + | |
| 51 | + private ShareDialogListAdapter adapter; | |
| 52 | + private boolean showOther; | |
| 53 | + private boolean showWjj; | |
| 54 | + | |
| 55 | + private ShareReleaseInfoUtil.ShareConfig config; | |
| 56 | + | |
| 57 | + public static final String SHARE_TITLE = "快来加入中国网家家,优享美好生活!"; | |
| 58 | + public static final String SHARE_MOMENT = "生活圈内容"; | |
| 59 | + public static final String SHARE_CONTENT = "中国网家家 让生活更美好!"; | |
| 60 | + public static final String SHARE_END = ""; | |
| 61 | + private ShareDialogListAdapter adapterOther; | |
| 62 | + private boolean showThirdPlatShare = true; | |
| 63 | + | |
| 64 | + | |
| 65 | + public static boolean checkEndTag(String str) { | |
| 66 | + return !TextUtils.isEmpty(str) && !TextUtils.isEmpty(SHARE_END) && str.endsWith(SHARE_END); | |
| 67 | + } | |
| 68 | + | |
| 69 | + public ShareDialog(@NonNull Activity context) { | |
| 70 | + this(context, true, true); | |
| 71 | + } | |
| 72 | + | |
| 73 | + public ShareDialog(@NonNull Activity context, boolean showOther, boolean showWjj) { | |
| 74 | + super(context, R.style.ShareDialogStyle); | |
| 75 | + mContext = context; | |
| 76 | + info = new ShareInfo(); | |
| 77 | + info.setUrl(AppConfig.getShareDownload()); | |
| 78 | + info.setTitle(SHARE_TITLE); | |
| 79 | + info.setContent(SHARE_CONTENT); | |
| 80 | + info.setImgurl(AppConfig.getShareIcon()); | |
| 81 | + | |
| 82 | + this.showOther = showOther; | |
| 83 | + this.showWjj = showWjj; | |
| 84 | + | |
| 85 | + config = ShareReleaseInfoUtil.ShareConfig.newInstance(); | |
| 86 | + } | |
| 87 | + | |
| 88 | + | |
| 89 | + @Override | |
| 90 | + protected void onCreate(Bundle savedInstanceState) { | |
| 91 | + super.onCreate(savedInstanceState); | |
| 92 | + setContentView(R.layout.layout_share_dialog); | |
| 93 | + Window window = getWindow(); | |
| 94 | + window.setWindowAnimations(R.style.Animation_Bottom_Rising); | |
| 95 | + | |
| 96 | + showThirdPlatShare = SharedPreferencesHelper.getInstance(mContext).getBoolean("SHOW_THIRD_PLAT_SHARE", true); | |
| 97 | + | |
| 98 | + shareRv = findViewById(R.id.share_rv); | |
| 99 | + shareOther = findViewById(R.id.share_other); | |
| 100 | + | |
| 101 | + ll_cancle = findViewById(R.id.ll_cancle); | |
| 102 | + ll_cancle.setOnClickListener(this); | |
| 103 | + setViewLocation(); | |
| 104 | + setCanceledOnTouchOutside(true);//外部点击取消 | |
| 105 | + | |
| 106 | + init(); | |
| 107 | + | |
| 108 | + } | |
| 109 | + | |
| 110 | + private List<IconInfo> initList() { | |
| 111 | + | |
| 112 | + | |
| 113 | + List<IconInfo> list = new ArrayList<>(); | |
| 114 | + if (showWjj) { | |
| 115 | + list.add(new IconInfo(IconInfo.WJJ_FRIEND, "网家家好友", R.drawable.wjjhaoyou)); | |
| 116 | + list.add(new IconInfo(IconInfo.WJJ_CIRCLE, "网家家生活圈", R.drawable.shenghuoquan)); | |
| 117 | + | |
| 118 | + | |
| 119 | + } | |
| 120 | + if ((AppConfig.getShareDownload().equals(info.getUrl())) | |
| 121 | + || (info.getUrl().contains("wjjh5.cnlive.com") || info.getUrl().contains("wjjh5test.cnlive.com")) | |
| 122 | + || (!info.getUrl().contains("wjjh5.cnlive.com") && !info.getUrl().contains("wjjh5test.cnlive.com") && showThirdPlatShare)) { | |
| 123 | + list.add(new IconInfo(IconInfo.WECHAT_FRIEND, "微信好友", R.drawable.wechat)); | |
| 124 | + list.add(new IconInfo(IconInfo.WECHAT_CIRCLE, "微信朋友圈", R.drawable.pengyouquan)); | |
| 125 | + list.add(new IconInfo(IconInfo.QQ, "QQ好友", R.drawable.qq)); | |
| 126 | + list.add(new IconInfo(IconInfo.WEBO, "微博", R.drawable.weibo)); | |
| 127 | + } | |
| 128 | +// list.add(new IconInfo(IconInfo.WEBO, "微博", R.drawable.weibo)); | |
| 129 | + if (showOther) | |
| 130 | + list.add(new IconInfo(IconInfo.BROWSER, "在浏览器打开", R.drawable.browser)); | |
| 131 | + return list; | |
| 132 | + } | |
| 133 | + | |
| 134 | + private List<IconInfo> initListOther() { | |
| 135 | + List<IconInfo> list = new ArrayList<>(); | |
| 136 | + if (info != null && info.isReport) | |
| 137 | + list.add(new IconInfo(IconInfo.REPORT, "投诉", R.drawable.report_icon)); | |
| 138 | + return list; | |
| 139 | + } | |
| 140 | + | |
| 141 | + private void init() { | |
| 142 | + adapter = new ShareDialogListAdapter(mContext, initList()); | |
| 143 | + adapter.setItemClick(this); | |
| 144 | + LinearLayoutManager layoutManager1 = new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false); | |
| 145 | + | |
| 146 | + shareRv.setLayoutManager(layoutManager1); | |
| 147 | + shareRv.setAdapter(adapter); | |
| 148 | + | |
| 149 | + if (info != null && info.isReport) { | |
| 150 | + shareOther.setVisibility(View.VISIBLE); | |
| 151 | + findViewById(R.id.line).setVisibility(View.VISIBLE); | |
| 152 | + adapterOther = new ShareDialogListAdapter(mContext, initListOther()); | |
| 153 | + adapterOther.setItemClick(this); | |
| 154 | + LinearLayoutManager layoutManagerOther = new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false); | |
| 155 | + shareOther.setLayoutManager(layoutManagerOther); | |
| 156 | + shareOther.setAdapter(adapterOther); | |
| 157 | + | |
| 158 | + } | |
| 159 | + } | |
| 160 | + | |
| 161 | + | |
| 162 | + @Override | |
| 163 | + public void onClick(View v) { | |
| 164 | + int i = v.getId(); | |
| 165 | + if (i == R.id.ll_cancle) { | |
| 166 | + cancel(); | |
| 167 | + } | |
| 168 | + } | |
| 169 | + | |
| 170 | + /** | |
| 171 | + * 设置dialog位于屏幕底部 | |
| 172 | + */ | |
| 173 | + private void setViewLocation() { | |
| 174 | + DisplayMetrics dm = new DisplayMetrics(); | |
| 175 | + mContext.getWindowManager().getDefaultDisplay().getMetrics(dm); | |
| 176 | + int height = dm.heightPixels; | |
| 177 | + Window window = this.getWindow(); | |
| 178 | + WindowManager.LayoutParams lp = window.getAttributes(); | |
| 179 | + lp.x = 0; | |
| 180 | + lp.y = height; | |
| 181 | + lp.width = ViewGroup.LayoutParams.MATCH_PARENT; | |
| 182 | + lp.height = ViewGroup.LayoutParams.WRAP_CONTENT; | |
| 183 | + // 设置显示位置 | |
| 184 | + onWindowAttributesChanged(lp); | |
| 185 | + } | |
| 186 | + | |
| 187 | + public void setUrl(String url) { | |
| 188 | + if (info != null) | |
| 189 | + info.setUrl(TextUtils.isEmpty(url) ? AppConfig.getShareDownload() : url); | |
| 190 | + if (adapter != null) | |
| 191 | + adapter.updateItems(initList()); | |
| 192 | + } | |
| 193 | + | |
| 194 | + public void setReport(boolean isReport) { | |
| 195 | + if (info != null) info.isReport = isReport; | |
| 196 | + } | |
| 197 | + | |
| 198 | + public void setTitle(String content) { | |
| 199 | + if (info != null) { | |
| 200 | + String title = TextUtils.isEmpty(content) ? SHARE_TITLE : content; | |
| 201 | + if (!title.contains("中国 网++") && !TextUtils.isEmpty(SHARE_END)) | |
| 202 | + title = title.concat(SHARE_END); | |
| 203 | + if (!title.contains("中国 网家家") && !TextUtils.isEmpty(SHARE_END)) | |
| 204 | + title = title.concat(SHARE_END); | |
| 205 | + info.setTitle(title); | |
| 206 | + } | |
| 207 | + } | |
| 208 | + | |
| 209 | + public void setDes(String des) { | |
| 210 | + if (info != null) { | |
| 211 | + String subTitle = TextUtils.isEmpty(des) ? SHARE_CONTENT : des; | |
| 212 | + info.setContent(subTitle); | |
| 213 | + } | |
| 214 | + } | |
| 215 | + | |
| 216 | + //设置网家家分享的url 网家家好友 生活圈 和微信qq区分开分享 | |
| 217 | + public void setWjjShareUrl(String wjjLifeCircleContentUrl) { | |
| 218 | + if (info != null && !TextUtils.isEmpty(wjjLifeCircleContentUrl)) { | |
| 219 | + info.setWjjShareUrl(wjjLifeCircleContentUrl); | |
| 220 | + info.setProcessWjjShare(true); | |
| 221 | + } | |
| 222 | + } | |
| 223 | + | |
| 224 | + public void setImgurl(String image) { | |
| 225 | + if (info != null) | |
| 226 | + info.setImgurl(TextUtils.isEmpty(image) ? AppConfig.getShareIcon() : image); | |
| 227 | + } | |
| 228 | + | |
| 229 | + public void setContentId(String id) { | |
| 230 | + if (info != null) | |
| 231 | + info.setContentId(TextUtils.isEmpty(id) ? "" : id); | |
| 232 | + } | |
| 233 | + | |
| 234 | + public void setReportType(String type) { | |
| 235 | + if (info != null) | |
| 236 | + info.setReportType(TextUtils.isEmpty(type) ? "3" : type); | |
| 237 | + } | |
| 238 | + | |
| 239 | + public void setShareType(String type) { | |
| 240 | + if (info != null) | |
| 241 | + info.setShareType(TextUtils.isEmpty(type) ? "" : type); | |
| 242 | + } | |
| 243 | + | |
| 244 | + @Override | |
| 245 | + public void onItemClick(int position, String type) { | |
| 246 | + if (info.getUrl() == null || !Util.isNetUrl(info.getUrl())) { | |
| 247 | + info.setUrl(AppConfig.getShareDownload()); | |
| 248 | + } | |
| 249 | + switch (type) { | |
| 250 | + case IconInfo.WJJ_FRIEND: | |
| 251 | + ShareUtils.shareAppIM(info, mContext); | |
| 252 | + ShareClickObservable.getInstance().update(1); | |
| 253 | + dismiss(); | |
| 254 | + break; | |
| 255 | + case IconInfo.WJJ_CIRCLE: | |
| 256 | + ShareUtils.shareAppMoment(info, mContext); | |
| 257 | + ShareClickObservable.getInstance().update(2); | |
| 258 | + dismiss(); | |
| 259 | + break; | |
| 260 | + case IconInfo.WECHAT_FRIEND: | |
| 261 | + ShareUtils.shareWechat(info, mContext); | |
| 262 | + ShareClickObservable.getInstance().update(3); | |
| 263 | + dismiss(); | |
| 264 | + break; | |
| 265 | + case IconInfo.WECHAT_CIRCLE: | |
| 266 | + ShareUtils.shareWCE(info, mContext); | |
| 267 | + ShareClickObservable.getInstance().update(4); | |
| 268 | + dismiss(); | |
| 269 | + break; | |
| 270 | + case IconInfo.QQ: | |
| 271 | + ShareUtils.shareQQ(info, mContext); | |
| 272 | + ShareClickObservable.getInstance().update(5); | |
| 273 | + dismiss(); | |
| 274 | + break; | |
| 275 | + case IconInfo.WEBO: | |
| 276 | + ShareUtils.shareWeiBo(mContext, info); | |
| 277 | + ShareClickObservable.getInstance().update(6); | |
| 278 | + dismiss(); | |
| 279 | + break; | |
| 280 | + case IconInfo.BROWSER: | |
| 281 | + ShareUtils.startBrowser(mContext, info.getUrl()); | |
| 282 | + ShareClickObservable.getInstance().update(7); | |
| 283 | + dismiss(); | |
| 284 | + break; | |
| 285 | + case IconInfo.REPORT: | |
| 286 | + if (info != null && !TextUtils.isEmpty(info.getContentId())) { | |
| 287 | + ShareOtherUtil.report(mContext, info.getContentId(), info.getReportType()); | |
| 288 | + ShareClickObservable.getInstance().update(8); | |
| 289 | + dismiss(); | |
| 290 | + } else { | |
| 291 | + AlertUtil.showDeftToast(mContext, "数据异常"); | |
| 292 | + } | |
| 293 | + break; | |
| 294 | + | |
| 295 | + } | |
| 296 | + } | |
| 297 | +} | |
| 0 | 298 | \ No newline at end of file | ... | ... |
cloud/share/src/main/java/com/cnlive/share/util/BindingAdapterUtil.java
0 → 100644
| 1 | +package com.cnlive.share.util; | |
| 2 | + | |
| 3 | +import android.widget.ImageView; | |
| 4 | + | |
| 5 | +import androidx.databinding.BindingAdapter; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * Created by gujun on 2017/5/24. | |
| 9 | + * 工具 | |
| 10 | + */ | |
| 11 | + | |
| 12 | +public class BindingAdapterUtil { | |
| 13 | + | |
| 14 | + /** | |
| 15 | + * 加载本地资源文件 | |
| 16 | + * | |
| 17 | + * @param view | |
| 18 | + * @param res | |
| 19 | + */ | |
| 20 | + @BindingAdapter({"imageSYS"}) | |
| 21 | + public static void loadSYSIMage(ImageView view, int res) { | |
| 22 | + view.setImageResource(res); | |
| 23 | + } | |
| 24 | + | |
| 25 | +} | ... | ... |
cloud/share/src/main/java/com/cnlive/share/util/DateTimeUtil.java
0 → 100644
| 1 | +package com.cnlive.share.util; | |
| 2 | + | |
| 3 | +import android.annotation.SuppressLint; | |
| 4 | +import android.util.Log; | |
| 5 | + | |
| 6 | +import java.text.DateFormat; | |
| 7 | +import java.text.ParseException; | |
| 8 | +import java.text.ParsePosition; | |
| 9 | +import java.text.SimpleDateFormat; | |
| 10 | +import java.util.Calendar; | |
| 11 | +import java.util.Date; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * 时间、日期工具类 | |
| 15 | + * Created by fanji on 2017/7/19. | |
| 16 | + */ | |
| 17 | + | |
| 18 | +public class DateTimeUtil { | |
| 19 | + | |
| 20 | + static SimpleDateFormat format; | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 日期格式:yyyy-MM-dd HH:mm:ss | |
| 24 | + **/ | |
| 25 | + public static final String DF_YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * 日期格式:yyyy-MM-dd HH:mm | |
| 29 | + **/ | |
| 30 | + public static final String DF_YYYY_MM_DD_HH_MM = "yyyy-MM-dd HH:mm"; | |
| 31 | + // yyyy-MM-dd-HH-mm | |
| 32 | + | |
| 33 | + /** | |
| 34 | + * 日期格式:yyyy-MM-dd | |
| 35 | + **/ | |
| 36 | + public static final String DF_YYYY_MM_DD = "yyyy-MM-dd"; | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * 日期格式:HH:mm:ss | |
| 40 | + **/ | |
| 41 | + public static final String DF_HH_MM_SS = "HH:mm:ss"; | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * 日期格式:HH:mm | |
| 45 | + **/ | |
| 46 | + public static final String DF_HH_MM = "HH:mm"; | |
| 47 | + | |
| 48 | + private final static long minute = 60 * 1000;// 1分钟 | |
| 49 | + private final static long hour = 60 * minute;// 1小时 | |
| 50 | + private final static long day = 24 * hour;// 1天 | |
| 51 | + private final static long month = 31 * day;// 月 | |
| 52 | + private final static long year = 12 * month;// 年 | |
| 53 | + | |
| 54 | + | |
| 55 | + public DateTimeUtil() { | |
| 56 | + | |
| 57 | + } | |
| 58 | + | |
| 59 | + /** | |
| 60 | + * 将日期格式化成友好的字符串:几分钟前、几小时前、几天前、几月前、几年前、刚刚 | |
| 61 | + * | |
| 62 | + * @param date | |
| 63 | + * @return | |
| 64 | + */ | |
| 65 | + public static String formatFriendly(Date date) { | |
| 66 | + if (date == null) { | |
| 67 | + return null; | |
| 68 | + } | |
| 69 | + long diff = new Date().getTime() - date.getTime(); | |
| 70 | + long r = 0; | |
| 71 | + if (diff > year) { | |
| 72 | + r = (diff / year); | |
| 73 | + return r + "年前"; | |
| 74 | + } | |
| 75 | + if (diff > month) { | |
| 76 | + r = (diff / month); | |
| 77 | + return r + "个月前"; | |
| 78 | + } | |
| 79 | + if (diff > day) { | |
| 80 | + r = (diff / day); | |
| 81 | + return r + "天前"; | |
| 82 | + } | |
| 83 | + if (diff > hour) { | |
| 84 | + r = (diff / hour); | |
| 85 | + return r + "个小时前"; | |
| 86 | + } | |
| 87 | + if (diff > minute) { | |
| 88 | + r = (diff / minute); | |
| 89 | + return r + "分钟前"; | |
| 90 | + } | |
| 91 | + return "刚刚"; | |
| 92 | + } | |
| 93 | + | |
| 94 | + /** | |
| 95 | + * 生活圈模仿微信时间展示样式 | |
| 96 | + * | |
| 97 | + * @param date | |
| 98 | + * @return | |
| 99 | + */ | |
| 100 | + public static String formatNewFriendly(Date date) { | |
| 101 | + if (date == null) { | |
| 102 | + return null; | |
| 103 | + } | |
| 104 | + long diff = new Date().getTime() - date.getTime(); | |
| 105 | + long r = 0; | |
| 106 | + if (diff > day) { | |
| 107 | + r = (diff / day); | |
| 108 | + if (r==1){ | |
| 109 | + return"昨天"; | |
| 110 | + }else { | |
| 111 | + return r + "天前"; | |
| 112 | + } | |
| 113 | + } | |
| 114 | + if (diff > hour) { | |
| 115 | + r = (diff / hour); | |
| 116 | + return r + "小时前"; | |
| 117 | + } | |
| 118 | + if (diff > minute) { | |
| 119 | + r = (diff / minute); | |
| 120 | + return r + "分钟前"; | |
| 121 | + } | |
| 122 | + return "1分钟前"; | |
| 123 | + } | |
| 124 | + | |
| 125 | + /** | |
| 126 | + * 将日期以yyyy-MM-dd HH:mm:ss格式化 | |
| 127 | + * | |
| 128 | + * @param dateL 日期 | |
| 129 | + * @return | |
| 130 | + */ | |
| 131 | + @SuppressLint("SimpleDateFormat") | |
| 132 | + public static String formatDateTime(long dateL) { | |
| 133 | + SimpleDateFormat sdf = new SimpleDateFormat(DF_YYYY_MM_DD_HH_MM_SS); | |
| 134 | + Date date = new Date(dateL); | |
| 135 | + return sdf.format(date); | |
| 136 | + } | |
| 137 | + | |
| 138 | + /** | |
| 139 | + * 将日期以yyyy-MM-dd HH:mm:ss格式化 | |
| 140 | + * | |
| 141 | + * @param dateL 日期 | |
| 142 | + * @return | |
| 143 | + */ | |
| 144 | + @SuppressLint("SimpleDateFormat") | |
| 145 | + public static String formatDateTime(long dateL, String pattern) { | |
| 146 | + SimpleDateFormat sdf = new SimpleDateFormat(pattern); | |
| 147 | + Date date = new Date(dateL); | |
| 148 | + return sdf.format(date); | |
| 149 | + } | |
| 150 | + | |
| 151 | + | |
| 152 | + /** | |
| 153 | + * 将日期以yyyy-MM-dd HH:mm:ss格式化 | |
| 154 | + * | |
| 155 | + * @param date 日期 | |
| 156 | + * @param formater | |
| 157 | + * @return | |
| 158 | + */ | |
| 159 | + @SuppressLint("SimpleDateFormat") | |
| 160 | + public static String formatDateTime(Date date, String formater) { | |
| 161 | + SimpleDateFormat sdf = new SimpleDateFormat(formater); | |
| 162 | + return sdf.format(date); | |
| 163 | + } | |
| 164 | + | |
| 165 | + /** | |
| 166 | + * 将日期字符串转成日期 | |
| 167 | + * | |
| 168 | + * @param strDate 字符串日期 | |
| 169 | + * @return java.util.date日期类型 | |
| 170 | + */ | |
| 171 | + @SuppressLint("SimpleDateFormat") | |
| 172 | + public static Date parseDate(String strDate) { | |
| 173 | + DateFormat dateFormat = new SimpleDateFormat(DF_YYYY_MM_DD_HH_MM_SS); | |
| 174 | + Date returnDate = null; | |
| 175 | + try { | |
| 176 | + returnDate = dateFormat.parse(strDate); | |
| 177 | + } catch (ParseException e) { | |
| 178 | + | |
| 179 | + } | |
| 180 | + return returnDate; | |
| 181 | + | |
| 182 | + } | |
| 183 | + | |
| 184 | + /** | |
| 185 | + * 获取系统当前日期 | |
| 186 | + * | |
| 187 | + * @return | |
| 188 | + */ | |
| 189 | + public static Date gainCurrentDate() { | |
| 190 | + return new Date(); | |
| 191 | + } | |
| 192 | + | |
| 193 | + /** | |
| 194 | + * 验证日期是否比当前日期早 | |
| 195 | + * | |
| 196 | + * @param target1 比较时间1 | |
| 197 | + * @param target2 比较时间2 | |
| 198 | + * @return true 则代表target1比target2晚或等于target2,否则比target2早 | |
| 199 | + */ | |
| 200 | + public static boolean compareDate(Date target1, Date target2) { | |
| 201 | + boolean flag = false; | |
| 202 | + try { | |
| 203 | + String target1DateTime = formatDateTime(target1, DF_YYYY_MM_DD_HH_MM_SS); | |
| 204 | + String target2DateTime = formatDateTime(target2, DF_YYYY_MM_DD_HH_MM_SS); | |
| 205 | + if (target1DateTime.compareTo(target2DateTime) <= 0) { | |
| 206 | + flag = true; | |
| 207 | + } | |
| 208 | + } catch (Exception e) { | |
| 209 | + System.out.println("比较失败,原因:" + e.getMessage()); | |
| 210 | + } | |
| 211 | + return flag; | |
| 212 | + } | |
| 213 | + | |
| 214 | + /** | |
| 215 | + * 对日期进行增加操作 | |
| 216 | + * | |
| 217 | + * @param target 需要进行运算的日期 | |
| 218 | + * @param hour 小时 | |
| 219 | + * @return | |
| 220 | + */ | |
| 221 | + public static Date addDateTime(Date target, double hour) { | |
| 222 | + if (null == target || hour < 0) { | |
| 223 | + return target; | |
| 224 | + } | |
| 225 | + | |
| 226 | + return new Date(target.getTime() + (long) (hour * 60 * 60 * 1000)); | |
| 227 | + } | |
| 228 | + | |
| 229 | + /** | |
| 230 | + * 对日期进行相减操作 | |
| 231 | + * | |
| 232 | + * @param target 需要进行运算的日期 | |
| 233 | + * @param hour 小时 | |
| 234 | + * @return | |
| 235 | + */ | |
| 236 | + public static Date subDateTime(Date target, double hour) { | |
| 237 | + if (null == target || hour < 0) { | |
| 238 | + return target; | |
| 239 | + } | |
| 240 | + | |
| 241 | + return new Date(target.getTime() - (long) (hour * 60 * 60 * 1000)); | |
| 242 | + } | |
| 243 | + | |
| 244 | + /** | |
| 245 | + * 获取系统时间的方法:月/日 时:分:秒 | |
| 246 | + */ | |
| 247 | + public static String getFormateDate() { | |
| 248 | + Calendar calendar = Calendar.getInstance(); | |
| 249 | + int month = (calendar.get(Calendar.MONTH) + 1); | |
| 250 | + int day = calendar.get(Calendar.DAY_OF_MONTH); | |
| 251 | + int hour = calendar.get(Calendar.HOUR_OF_DAY); | |
| 252 | + int minute = calendar.get(Calendar.MINUTE); | |
| 253 | + int second = calendar.get(Calendar.SECOND); | |
| 254 | + | |
| 255 | + String systemTime = (month < 10 ? "0" + month : month) + "/" + (day < 10 ? "0" + day : day) + " " + (hour < 10 ? "0" + hour : hour) + ":" + (minute < 10 ? "0" + minute : minute) + ":" + (second < 10 ? "0" + second : second); | |
| 256 | + return systemTime; | |
| 257 | + } | |
| 258 | + | |
| 259 | + /** | |
| 260 | + * 获取系统时间的方法:时:分:秒 | |
| 261 | + */ | |
| 262 | + public static String getHourAndMinute() { | |
| 263 | + Calendar calendar = Calendar.getInstance(); | |
| 264 | + int hour = calendar.get(Calendar.HOUR_OF_DAY); | |
| 265 | + int minute = calendar.get(Calendar.MINUTE); | |
| 266 | + return (hour < 10 ? "0" + hour : hour) + ":" + (minute < 10 ? "0" + minute : minute); | |
| 267 | + } | |
| 268 | + | |
| 269 | + /** | |
| 270 | + * 获取分钟 | |
| 271 | + */ | |
| 272 | + public static int getMinute() { | |
| 273 | + Calendar calendar = Calendar.getInstance(); | |
| 274 | + int hour = calendar.get(Calendar.HOUR_OF_DAY); | |
| 275 | + int minute = calendar.get(Calendar.MINUTE); | |
| 276 | + return minute; | |
| 277 | + } | |
| 278 | + | |
| 279 | + /** | |
| 280 | + * 获取系统时间的方法:时 | |
| 281 | + */ | |
| 282 | + public static String getHour() { | |
| 283 | + Calendar calendar = Calendar.getInstance(); | |
| 284 | + int hour = calendar.get(Calendar.HOUR_OF_DAY); | |
| 285 | + return ((hour < 10 ? "0" + hour : hour) + ""); | |
| 286 | + } | |
| 287 | + | |
| 288 | + /** | |
| 289 | + * 将2017-07-10 00:00:00 换2017-07-10 | |
| 290 | + * | |
| 291 | + * @param strDate | |
| 292 | + * @return | |
| 293 | + */ | |
| 294 | + public static String strFormatStr(String strDate) { | |
| 295 | + if (strDate.equals("")) { | |
| 296 | + return ""; | |
| 297 | + } | |
| 298 | + return dateToStr(strToDate(strDate)); | |
| 299 | + } | |
| 300 | + | |
| 301 | + /** | |
| 302 | + * 2015-01-07 15:05:34 | |
| 303 | + * | |
| 304 | + * @param strDate | |
| 305 | + * @return | |
| 306 | + */ | |
| 307 | + @SuppressLint("SimpleDateFormat") | |
| 308 | + public static Date strToDateHHMMSS(String strDate) { | |
| 309 | + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 310 | + ParsePosition pos = new ParsePosition(0); | |
| 311 | + Date strtodate = formatter.parse(strDate, pos); | |
| 312 | + return strtodate; | |
| 313 | + } | |
| 314 | + | |
| 315 | + /** | |
| 316 | + * 2015-01-07 15:05 | |
| 317 | + * | |
| 318 | + * @param strDate | |
| 319 | + * @return | |
| 320 | + */ | |
| 321 | + @SuppressLint("SimpleDateFormat") | |
| 322 | + public static Date strToDateHHMM(String strDate) { | |
| 323 | + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 324 | + ParsePosition pos = new ParsePosition(0); | |
| 325 | + Date strtodate = formatter.parse(strDate, pos); | |
| 326 | + return strtodate; | |
| 327 | + } | |
| 328 | + | |
| 329 | + /** | |
| 330 | + * 2015-01-07 | |
| 331 | + * | |
| 332 | + * @param strDate | |
| 333 | + * @return | |
| 334 | + */ | |
| 335 | + @SuppressLint("SimpleDateFormat") | |
| 336 | + public static Date strToDate(String strDate) { | |
| 337 | + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); | |
| 338 | + ParsePosition pos = new ParsePosition(0); | |
| 339 | + Date strtodate = formatter.parse(strDate, pos); | |
| 340 | + return strtodate; | |
| 341 | + } | |
| 342 | + | |
| 343 | + /** | |
| 344 | + * 2015.01.07 | |
| 345 | + * | |
| 346 | + * @param strDate | |
| 347 | + * @return | |
| 348 | + */ | |
| 349 | + @SuppressLint("SimpleDateFormat") | |
| 350 | + public static Date strToDateDorp(String strDate) { | |
| 351 | + SimpleDateFormat formatter = new SimpleDateFormat("yyyy.MM.dd"); | |
| 352 | + ParsePosition pos = new ParsePosition(0); | |
| 353 | + Date strtodate = formatter.parse(strDate, pos); | |
| 354 | + return strtodate; | |
| 355 | + } | |
| 356 | + | |
| 357 | + @SuppressLint("SimpleDateFormat") | |
| 358 | + public static String dateToStr(Date dateDate) { | |
| 359 | + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); | |
| 360 | + String dateString = formatter.format(dateDate); | |
| 361 | + return dateString; | |
| 362 | + } | |
| 363 | + | |
| 364 | + /** | |
| 365 | + * 传入一个String转化为long | |
| 366 | + */ | |
| 367 | + @SuppressLint("SimpleDateFormat") | |
| 368 | + public static Long stringParserLong(String param) throws ParseException { | |
| 369 | + format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 370 | + return format.parse(param).getTime(); | |
| 371 | + } | |
| 372 | + | |
| 373 | + /** | |
| 374 | + * 传入一个String转化为long | |
| 375 | + */ | |
| 376 | + @SuppressLint("SimpleDateFormat") | |
| 377 | + public static Long stringParserLong1(String param) throws ParseException { | |
| 378 | + format = new SimpleDateFormat("yyyyMMddHHmmss"); | |
| 379 | + return format.parse(param).getTime(); | |
| 380 | + } | |
| 381 | + | |
| 382 | + /** | |
| 383 | + * 当前时间转换为long | |
| 384 | + */ | |
| 385 | + @SuppressLint("SimpleDateFormat") | |
| 386 | + public static Long currentDateParserLong() throws ParseException { | |
| 387 | + format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 388 | + return format.parse(format.format(Calendar.getInstance().getTime())).getTime(); | |
| 389 | + } | |
| 390 | + | |
| 391 | + /** | |
| 392 | + * 当前时间 如: 2013-04-22 10:37:00 | |
| 393 | + */ | |
| 394 | + @SuppressLint("SimpleDateFormat") | |
| 395 | + public static String getCurrentDate() { | |
| 396 | + format = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 397 | + return format.format(Calendar.getInstance().getTime()); | |
| 398 | + } | |
| 399 | + | |
| 400 | + /** | |
| 401 | + * 当前时间 如: 10:37 | |
| 402 | + */ | |
| 403 | + @SuppressLint("SimpleDateFormat") | |
| 404 | + public static String getCurrentDateHHMM() { | |
| 405 | + format = new SimpleDateFormat("HH:mm"); | |
| 406 | + return format.format(Calendar.getInstance().getTime()); | |
| 407 | + } | |
| 408 | + | |
| 409 | + /** | |
| 410 | + * 当前时间 如: 10:37 | |
| 411 | + * | |
| 412 | + * @throws ParseException | |
| 413 | + */ | |
| 414 | + @SuppressLint("SimpleDateFormat") | |
| 415 | + public static String getCurrentDateHHMMSS() { | |
| 416 | + format = new SimpleDateFormat("HH:mm:ss"); | |
| 417 | + return format.format(Calendar.getInstance().getTime()); | |
| 418 | + } | |
| 419 | + | |
| 420 | + /** | |
| 421 | + * 当前时间 如: 20130422 | |
| 422 | + */ | |
| 423 | + @SuppressLint("SimpleDateFormat") | |
| 424 | + public static String getCurrentDateString() { | |
| 425 | + format = new SimpleDateFormat("yyyyMMddHHmm"); | |
| 426 | + return format.format(Calendar.getInstance().getTime()); | |
| 427 | + } | |
| 428 | + | |
| 429 | + /** | |
| 430 | + * 当前时间 如: 2013-04-22 | |
| 431 | + */ | |
| 432 | + @SuppressLint("SimpleDateFormat") | |
| 433 | + public static String getCurrentTime() { | |
| 434 | + format = new SimpleDateFormat("yyyy-MM-dd"); | |
| 435 | + return format.format(Calendar.getInstance().getTime()); | |
| 436 | + } | |
| 437 | + | |
| 438 | + @SuppressLint("SimpleDateFormat") | |
| 439 | + public static String getSWAHDate() { | |
| 440 | + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 441 | + return format.format(Calendar.getInstance().getTime()); | |
| 442 | + } | |
| 443 | + | |
| 444 | + @SuppressLint("SimpleDateFormat") | |
| 445 | + public static Long stringToLongD(String param) throws ParseException { | |
| 446 | + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); | |
| 447 | + return format.parse(param.substring(0, param.length() - 4)).getTime(); | |
| 448 | + } | |
| 449 | + | |
| 450 | + @SuppressLint("SimpleDateFormat") | |
| 451 | + public static Long stringToLong(String param) throws ParseException { | |
| 452 | + SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmm"); | |
| 453 | + return format.parse(param).getTime(); | |
| 454 | + } | |
| 455 | + | |
| 456 | + /** | |
| 457 | + * 获取两个日期之间的间隔天数 | |
| 458 | + * | |
| 459 | + * @return | |
| 460 | + */ | |
| 461 | + @SuppressLint("SimpleDateFormat") | |
| 462 | + public static int getGapCount(Date startDate, Date endDate) { | |
| 463 | + Calendar fromCalendar = Calendar.getInstance(); | |
| 464 | + fromCalendar.setTime(startDate); | |
| 465 | + fromCalendar.set(Calendar.HOUR_OF_DAY, 0); | |
| 466 | + fromCalendar.set(Calendar.MINUTE, 0); | |
| 467 | + fromCalendar.set(Calendar.SECOND, 0); | |
| 468 | + fromCalendar.set(Calendar.MILLISECOND, 0); | |
| 469 | + | |
| 470 | + Calendar toCalendar = Calendar.getInstance(); | |
| 471 | + toCalendar.setTime(endDate); | |
| 472 | + toCalendar.set(Calendar.HOUR_OF_DAY, 0); | |
| 473 | + toCalendar.set(Calendar.MINUTE, 0); | |
| 474 | + toCalendar.set(Calendar.SECOND, 0); | |
| 475 | + toCalendar.set(Calendar.MILLISECOND, 0); | |
| 476 | + | |
| 477 | + return (int) ((toCalendar.getTime().getTime() - fromCalendar.getTime().getTime()) / (1000 * 60 * 60 * 24)); | |
| 478 | + } | |
| 479 | + | |
| 480 | + /** | |
| 481 | + * 日期转换成Java字符串 | |
| 482 | + * | |
| 483 | + * @param date | |
| 484 | + * @return str | |
| 485 | + */ | |
| 486 | + @SuppressLint("SimpleDateFormat") | |
| 487 | + public static String DateToStr(Date date) { | |
| 488 | + | |
| 489 | + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 490 | + String str = format.format(date); | |
| 491 | + return str; | |
| 492 | + } | |
| 493 | + | |
| 494 | + /** | |
| 495 | + * 字符串转换成日期 | |
| 496 | + * | |
| 497 | + * @param str | |
| 498 | + * @return date | |
| 499 | + */ | |
| 500 | + @SuppressLint("SimpleDateFormat") | |
| 501 | + public static Date StrToDate(String str) { | |
| 502 | + | |
| 503 | + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); | |
| 504 | + Date date = null; | |
| 505 | + try { | |
| 506 | + date = format.parse(str); | |
| 507 | + } catch (ParseException e) { | |
| 508 | + e.printStackTrace(); | |
| 509 | + } | |
| 510 | + return date; | |
| 511 | + } | |
| 512 | + | |
| 513 | + /** | |
| 514 | + * 字符串转换成日期 | |
| 515 | + * | |
| 516 | + * @param str | |
| 517 | + * @return date | |
| 518 | + */ | |
| 519 | + @SuppressLint("SimpleDateFormat") | |
| 520 | + public static Date StrToDateDrop(String str) { | |
| 521 | + | |
| 522 | + SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd"); | |
| 523 | + Date date = null; | |
| 524 | + try { | |
| 525 | + date = format.parse(str); | |
| 526 | + } catch (ParseException e) { | |
| 527 | + e.printStackTrace(); | |
| 528 | + } | |
| 529 | + return date; | |
| 530 | + } | |
| 531 | + | |
| 532 | + /** | |
| 533 | + * @param time | |
| 534 | + * @return | |
| 535 | + */ | |
| 536 | + @SuppressLint("SimpleDateFormat") | |
| 537 | + public static long getLongTime(String time) { | |
| 538 | + long ct = 0; | |
| 539 | + try { | |
| 540 | + format = new SimpleDateFormat("HH:mm:ss"); | |
| 541 | + ct = format.parse(time).getTime(); | |
| 542 | + } catch (Exception e) { | |
| 543 | + e.printStackTrace(); | |
| 544 | + } | |
| 545 | + return ct; | |
| 546 | + } | |
| 547 | + | |
| 548 | + /** | |
| 549 | + * 判断两日期是否同一天 | |
| 550 | + * | |
| 551 | + * @param str1 | |
| 552 | + * @param str2 | |
| 553 | + * @return | |
| 554 | + */ | |
| 555 | + @SuppressLint("SimpleDateFormat") | |
| 556 | + public static boolean isSameDay(String str1, String str2) { | |
| 557 | + | |
| 558 | + Date day1 = null, day2 = null; | |
| 559 | + day1 = DateTimeUtil.strToDate(str1); | |
| 560 | + day2 = DateTimeUtil.strToDate(str2); | |
| 561 | + | |
| 562 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |
| 563 | + | |
| 564 | + String ds1 = sdf.format(day1); | |
| 565 | + | |
| 566 | + String ds2 = sdf.format(day2); | |
| 567 | + | |
| 568 | + if (ds1.equals(ds2)) { | |
| 569 | + return true; | |
| 570 | + } else { | |
| 571 | + return false; | |
| 572 | + } | |
| 573 | + | |
| 574 | + } | |
| 575 | + | |
| 576 | + /** | |
| 577 | + * 获取两个日期的时间差 | |
| 578 | + */ | |
| 579 | + @SuppressLint("SimpleDateFormat") | |
| 580 | + public static int getTimeInterval(String date) { | |
| 581 | + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 582 | + int interval = 0; | |
| 583 | + try { | |
| 584 | + Date currentTime = new Date();// 获取现在的时间 | |
| 585 | + Date beginTime = dateFormat.parse(date); | |
| 586 | + interval = (int) ((beginTime.getTime() - currentTime.getTime()) / (1000));// 时间差 | |
| 587 | + // 单位秒 | |
| 588 | + } catch (ParseException e) { | |
| 589 | + e.printStackTrace(); | |
| 590 | + } | |
| 591 | + return interval; | |
| 592 | + } | |
| 593 | + | |
| 594 | + /** | |
| 595 | + * 获取两个日期的时间差 yyyy.MM.dd HH.mm.ss | |
| 596 | + */ | |
| 597 | + @SuppressLint("SimpleDateFormat") | |
| 598 | + public static int getInterval(String bDate, String eDate) { | |
| 599 | + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd"); | |
| 600 | + int interval = 0; | |
| 601 | + try { | |
| 602 | + Date currentTime = dateFormat.parse(eDate);// 获取现在的时间 | |
| 603 | + Date beginTime = dateFormat.parse(bDate); | |
| 604 | + interval = (int) ((beginTime.getTime() - currentTime.getTime()));// 时间差 | |
| 605 | + // 单位秒 | |
| 606 | + } catch (ParseException e) { | |
| 607 | + e.printStackTrace(); | |
| 608 | + } | |
| 609 | + return interval; | |
| 610 | + } | |
| 611 | + | |
| 612 | + /** | |
| 613 | + * 两个时间之差 求出一个long Time | |
| 614 | + * | |
| 615 | + * @param date | |
| 616 | + * @return | |
| 617 | + */ | |
| 618 | + @SuppressLint("SimpleDateFormat") | |
| 619 | + public static long getTime(String date) { | |
| 620 | + | |
| 621 | + DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 622 | + long diff = 0; | |
| 623 | + try { | |
| 624 | + Date currentTime = new Date();// 获取现在的时间 | |
| 625 | + Date getdate = df.parse(date); | |
| 626 | + diff = getdate.getTime() - currentTime.getTime(); | |
| 627 | + | |
| 628 | + } catch (Exception e) { | |
| 629 | + } | |
| 630 | + return diff; | |
| 631 | + } | |
| 632 | + | |
| 633 | + | |
| 634 | + /** | |
| 635 | + * 日期转换成Java字符串 | |
| 636 | + * | |
| 637 | + * @param DATE1 | |
| 638 | + * @param DATE2 | |
| 639 | + * @return | |
| 640 | + */ | |
| 641 | + @SuppressLint("SimpleDateFormat") | |
| 642 | + public static int compare_date(String DATE1, String DATE2) { | |
| 643 | + DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); | |
| 644 | + try { | |
| 645 | + Date dt1 = df.parse(DATE1); | |
| 646 | + Date dt2 = df.parse(DATE2); | |
| 647 | + if (dt1.getTime() >= dt2.getTime()) { | |
| 648 | + return 1; | |
| 649 | + } else if (dt1.getTime() < dt2.getTime()) { | |
| 650 | + return -1; | |
| 651 | + } else { | |
| 652 | + return 0; | |
| 653 | + } | |
| 654 | + } catch (Exception exception) { | |
| 655 | + exception.printStackTrace(); | |
| 656 | + } | |
| 657 | + return 0; | |
| 658 | + } | |
| 659 | + | |
| 660 | + /** | |
| 661 | + * 传入时间 算出星期几 | |
| 662 | + * | |
| 663 | + * @param str 2014年1月3日 | |
| 664 | + * @param days 1:2014年1月4日 类推 | |
| 665 | + * @return | |
| 666 | + */ | |
| 667 | + @SuppressLint("SimpleDateFormat") | |
| 668 | + public static String formatDate(String str, int days) { | |
| 669 | + | |
| 670 | + String dateStr = ""; | |
| 671 | + try { | |
| 672 | + DateFormat df = DateFormat.getDateInstance(DateFormat.LONG); | |
| 673 | + Date date = df.parse(str); | |
| 674 | + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); | |
| 675 | + Calendar c = Calendar.getInstance(); | |
| 676 | + Date d = dateFormat.parse(dateFormat.format(date)); | |
| 677 | + c.setTime(d); | |
| 678 | + c.add(Calendar.DAY_OF_MONTH, days); | |
| 679 | + switch (c.get(Calendar.DAY_OF_WEEK) - 1) { | |
| 680 | + case 0: | |
| 681 | + dateStr = "周日"; | |
| 682 | + break; | |
| 683 | + case 1: | |
| 684 | + dateStr = "周一"; | |
| 685 | + break; | |
| 686 | + case 2: | |
| 687 | + dateStr = "周二"; | |
| 688 | + break; | |
| 689 | + case 3: | |
| 690 | + dateStr = "周三"; | |
| 691 | + break; | |
| 692 | + case 4: | |
| 693 | + dateStr = "周四"; | |
| 694 | + break; | |
| 695 | + case 5: | |
| 696 | + dateStr = "周五"; | |
| 697 | + break; | |
| 698 | + case 6: | |
| 699 | + dateStr = "周六"; | |
| 700 | + break; | |
| 701 | + default: | |
| 702 | + break; | |
| 703 | + } | |
| 704 | + } catch (Exception e) { | |
| 705 | + e.printStackTrace(); | |
| 706 | + } | |
| 707 | + | |
| 708 | + return dateStr; | |
| 709 | + } | |
| 710 | + | |
| 711 | + /** | |
| 712 | + * 根据提供的年月日获取该月份的第一天 | |
| 713 | + */ | |
| 714 | + public static String getSupportBeginDayofMonth(int year, int monthOfYear) { | |
| 715 | + Calendar cal = Calendar.getInstance(); | |
| 716 | + cal.set(Calendar.YEAR, year); | |
| 717 | + cal.set(Calendar.MONTH, monthOfYear - 1); | |
| 718 | + cal.set(Calendar.DAY_OF_MONTH, 1); | |
| 719 | + cal.set(Calendar.HOUR_OF_DAY, 0); | |
| 720 | + cal.set(Calendar.MINUTE, 0); | |
| 721 | + cal.set(Calendar.SECOND, 0); | |
| 722 | + | |
| 723 | + cal.set(Calendar.DAY_OF_MONTH, 1); | |
| 724 | + return cal.getTimeInMillis() + ""; | |
| 725 | + } | |
| 726 | + | |
| 727 | + /** | |
| 728 | + * 根据提供的年月获取该月份的最后一天 | |
| 729 | + * | |
| 730 | + * @return | |
| 731 | + */ | |
| 732 | + public static String getSupportEndDayofMonth(int year, int monthOfYear) { | |
| 733 | + Calendar cal = Calendar.getInstance(); | |
| 734 | + cal.set(Calendar.YEAR, year); | |
| 735 | + cal.set(Calendar.MONTH, monthOfYear); | |
| 736 | + cal.set(Calendar.DAY_OF_MONTH, 1); | |
| 737 | + cal.set(Calendar.HOUR_OF_DAY, 23); | |
| 738 | + cal.set(Calendar.MINUTE, 59); | |
| 739 | + cal.set(Calendar.SECOND, 59); | |
| 740 | + | |
| 741 | + cal.add(Calendar.DAY_OF_MONTH, -1); | |
| 742 | + return cal.getTimeInMillis() + ""; | |
| 743 | + } | |
| 744 | + | |
| 745 | + public static String getYear(long millseconds) { | |
| 746 | + | |
| 747 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); | |
| 748 | + Date date = new Date(millseconds); | |
| 749 | + return sdf.format(date).substring(0, 4); | |
| 750 | + } | |
| 751 | + | |
| 752 | + public static String getMonth(long millseconds) { | |
| 753 | + | |
| 754 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); | |
| 755 | + Date date = new Date(millseconds); | |
| 756 | + return sdf.format(date).substring(4, 6); | |
| 757 | + } | |
| 758 | + | |
| 759 | + public static String formatFriendly(String timeStr) { | |
| 760 | + String time = ""; | |
| 761 | + try { | |
| 762 | + time = DateTimeUtil.formatFriendly(new Date(Long.valueOf(timeStr) * 1000L)); | |
| 763 | + } catch (Exception e) { | |
| 764 | + Log.e("FriendCircleMessage", "Time format exception.", e); | |
| 765 | + } | |
| 766 | + return time; | |
| 767 | + } | |
| 768 | + | |
| 769 | +} | ... | ... |
cloud/share/src/main/java/com/cnlive/share/util/OkHttpUtils.java
0 → 100644
| 1 | +package com.cnlive.share.util; | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | +import android.os.Handler; | |
| 6 | +import android.os.Looper; | |
| 7 | + | |
| 8 | +import com.google.gson.Gson; | |
| 9 | +import com.google.gson.internal.$Gson$Types; | |
| 10 | + | |
| 11 | +import java.io.IOException; | |
| 12 | +import java.lang.reflect.ParameterizedType; | |
| 13 | +import java.lang.reflect.Type; | |
| 14 | +import java.util.List; | |
| 15 | +import java.util.concurrent.TimeUnit; | |
| 16 | + | |
| 17 | +import okhttp3.Call; | |
| 18 | +import okhttp3.Callback; | |
| 19 | +import okhttp3.FormBody; | |
| 20 | +import okhttp3.OkHttpClient; | |
| 21 | +import okhttp3.Request; | |
| 22 | +import okhttp3.RequestBody; | |
| 23 | +import okhttp3.Response; | |
| 24 | + | |
| 25 | +/** | |
| 26 | + * | |
| 27 | + */ | |
| 28 | +public class OkHttpUtils { | |
| 29 | + | |
| 30 | + private static final String TAG = "OkHttpUtils"; | |
| 31 | + | |
| 32 | + private static OkHttpUtils mInstance; | |
| 33 | + private OkHttpClient mOkHttpClient; | |
| 34 | + private Handler mDelivery; | |
| 35 | + private Gson mGson; | |
| 36 | + | |
| 37 | + private OkHttpUtils() { | |
| 38 | + mOkHttpClient = new OkHttpClient.Builder() | |
| 39 | + .connectTimeout(10, TimeUnit.SECONDS) | |
| 40 | + .writeTimeout(10, TimeUnit.SECONDS) | |
| 41 | + .readTimeout(30, TimeUnit.SECONDS) | |
| 42 | + .build(); | |
| 43 | + mGson = new Gson(); | |
| 44 | + mDelivery = new Handler(Looper.getMainLooper()); | |
| 45 | + } | |
| 46 | + | |
| 47 | + private synchronized static OkHttpUtils getmInstance() { | |
| 48 | + if (mInstance == null) { | |
| 49 | + mInstance = new OkHttpUtils(); | |
| 50 | + } | |
| 51 | + return mInstance; | |
| 52 | + } | |
| 53 | + | |
| 54 | + private void getRequest(String url, final ResultCallback callback) { | |
| 55 | + final Request request = new Request.Builder().url(url).build(); | |
| 56 | + deliveryResult(callback, request); | |
| 57 | + } | |
| 58 | + | |
| 59 | + private void postRequest(String url, final ResultCallback callback, List<Param> params) { | |
| 60 | + Request request = buildPostRequest(url, params); | |
| 61 | + deliveryResult(callback, request); | |
| 62 | + } | |
| 63 | + | |
| 64 | + /** | |
| 65 | + * 处理结果 | |
| 66 | + * @param callback | |
| 67 | + * @param request | |
| 68 | + */ | |
| 69 | + private void deliveryResult(final ResultCallback callback, Request request) { | |
| 70 | + | |
| 71 | + mOkHttpClient.newCall(request).enqueue(new Callback() { | |
| 72 | + @Override | |
| 73 | + public void onFailure(Call call, IOException e) { | |
| 74 | + sendFailCallback(callback, e); | |
| 75 | + } | |
| 76 | + | |
| 77 | + @Override | |
| 78 | + public void onResponse(Call call, Response response) throws IOException { | |
| 79 | + try { | |
| 80 | + String str = response.body().string(); | |
| 81 | + if (callback.mType == String.class) { | |
| 82 | + /** | |
| 83 | + * 返回字符串 | |
| 84 | + */ | |
| 85 | + sendSuccessCallBack(callback, str); | |
| 86 | + } else { | |
| 87 | + /** | |
| 88 | + * 这里处理解析返回对象 | |
| 89 | + */ | |
| 90 | + Object object = mGson.fromJson(str, callback.mType); | |
| 91 | + sendSuccessCallBack(callback, object); | |
| 92 | + | |
| 93 | + } | |
| 94 | + } catch (final Exception e) { | |
| 95 | +// LogUtils.e(TAG, "convert json failure", e); | |
| 96 | + sendFailCallback(callback, e); | |
| 97 | + } | |
| 98 | + } | |
| 99 | + }); | |
| 100 | + } | |
| 101 | + | |
| 102 | + private void sendFailCallback(final ResultCallback callback, final Exception e) { | |
| 103 | + mDelivery.post(new Runnable() { | |
| 104 | + @Override | |
| 105 | + public void run() { | |
| 106 | + if (callback != null) { | |
| 107 | + callback.onFailure(e); | |
| 108 | + } | |
| 109 | + } | |
| 110 | + }); | |
| 111 | + } | |
| 112 | + | |
| 113 | + private void sendSuccessCallBack(final ResultCallback callback, final Object obj) { | |
| 114 | + mDelivery.post(new Runnable() { | |
| 115 | + @Override | |
| 116 | + public void run() { | |
| 117 | + if (callback != null) { | |
| 118 | + callback.onSuccess(obj); | |
| 119 | + } | |
| 120 | + } | |
| 121 | + }); | |
| 122 | + } | |
| 123 | + | |
| 124 | + private Request buildPostRequest(String url, List<Param> params) { | |
| 125 | + FormBody.Builder builder= new FormBody.Builder(); | |
| 126 | + for (Param param : params) { | |
| 127 | + builder.add(param.key, param.value); | |
| 128 | + } | |
| 129 | + RequestBody requestBody = builder.build(); | |
| 130 | + return new Request.Builder().url(url).post(requestBody).build(); | |
| 131 | + } | |
| 132 | + | |
| 133 | + | |
| 134 | + /**********************对外接口************************/ | |
| 135 | + | |
| 136 | + /** | |
| 137 | + * get请求 | |
| 138 | + * @param url 请求url | |
| 139 | + * @param callback 请求回调 | |
| 140 | + */ | |
| 141 | + public static void get(String url, ResultCallback callback) { | |
| 142 | + getmInstance().getRequest(url, callback); | |
| 143 | + } | |
| 144 | + | |
| 145 | + /** | |
| 146 | + * post请求 | |
| 147 | + * @param url 请求url | |
| 148 | + * @param callback 请求回调 | |
| 149 | + * @param params 请求参数 | |
| 150 | + */ | |
| 151 | + public static void post(String url, final ResultCallback callback, List<Param> params) { | |
| 152 | + getmInstance().postRequest(url, callback, params); | |
| 153 | + } | |
| 154 | + | |
| 155 | + /** | |
| 156 | + * http请求回调类,回调方法在UI线程中执行 | |
| 157 | + * @param <T> | |
| 158 | + */ | |
| 159 | + public static abstract class ResultCallback<T> { | |
| 160 | + | |
| 161 | + Type mType; | |
| 162 | + | |
| 163 | + public ResultCallback(){ | |
| 164 | + mType = getSuperclassTypeParameter(getClass()); | |
| 165 | + } | |
| 166 | + | |
| 167 | + static Type getSuperclassTypeParameter(Class<?> subclass) { | |
| 168 | + Type superclass = subclass.getGenericSuperclass(); | |
| 169 | + if (superclass instanceof Class) { | |
| 170 | + throw new RuntimeException("Missing type parameter."); | |
| 171 | + } | |
| 172 | + ParameterizedType parameterized = (ParameterizedType) superclass; | |
| 173 | + return $Gson$Types.canonicalize(parameterized.getActualTypeArguments()[0]); | |
| 174 | + } | |
| 175 | + | |
| 176 | + /** | |
| 177 | + * 请求成功回调 | |
| 178 | + * @param response | |
| 179 | + */ | |
| 180 | + public abstract void onSuccess(T response); | |
| 181 | + | |
| 182 | + /** | |
| 183 | + * 请求失败回调 | |
| 184 | + * @param e | |
| 185 | + */ | |
| 186 | + public abstract void onFailure(Exception e); | |
| 187 | + } | |
| 188 | + | |
| 189 | + /** | |
| 190 | + * post请求参数类 这里可以根据项目抽取成泛型 | |
| 191 | + */ | |
| 192 | + public static class Param { | |
| 193 | + | |
| 194 | + String key; | |
| 195 | + String value; | |
| 196 | + | |
| 197 | + public Param() { | |
| 198 | + } | |
| 199 | + | |
| 200 | + public Param(String key, String value) { | |
| 201 | + this.key = key; | |
| 202 | + this.value = value; | |
| 203 | + } | |
| 204 | + | |
| 205 | + } | |
| 206 | + | |
| 207 | + | |
| 208 | +} | |
| 0 | 209 | \ No newline at end of file | ... | ... |
cloud/share/src/main/java/com/cnlive/share/util/ShareOtherUtil.java
0 → 100644
| 1 | +package com.cnlive.share.util; | |
| 2 | + | |
| 3 | +import android.content.Context; | |
| 4 | +import android.net.Uri; | |
| 5 | +import android.text.TextUtils; | |
| 6 | + | |
| 7 | +import com.cnlive.core.libs.base.application.AppConfig; | |
| 8 | +import com.cnlive.core.libs.base.util.AlertUtil; | |
| 9 | +import com.cnlive.share.arouter.ARouterUtil; | |
| 10 | + | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * 作者: 吴奎庆 | |
| 14 | + * <p> | |
| 15 | + * 时间: 2019/4/25 | |
| 16 | + * <p> | |
| 17 | + * 简介: 分享框的其他页面的工具类 | |
| 18 | + */ | |
| 19 | +public class ShareOtherUtil { | |
| 20 | + /** | |
| 21 | + * 举报的的功能处理 | |
| 22 | + * | |
| 23 | + * @param context | |
| 24 | + * @param contentId | |
| 25 | + */ | |
| 26 | + public static void report(Context context, String contentId) { | |
| 27 | + String url = AppConfig.getReportUrl(); | |
| 28 | +// contentId(内容id)、sid(举报者sid)、toSid(被举报者sid)、rtType(1-内容投诉 2-用户投诉)、rtSource(来源 1-目击者 2-生活圈 3-H5) | |
| 29 | + if (!TextUtils.isEmpty(url)) { | |
| 30 | + url = url.concat("contentId=" + contentId).concat("&rtType=1").concat("&rtSource=3"); | |
| 31 | + ARouterUtil.startReportActivity(context, url); | |
| 32 | + } | |
| 33 | + } | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * 举报的的功能处理 | |
| 37 | + * | |
| 38 | + * @param context | |
| 39 | + * @param contentId | |
| 40 | + */ | |
| 41 | + public static void report(Context context, String contentId, String type) { | |
| 42 | + String url = AppConfig.getReportUrl(); | |
| 43 | +// contentId(内容id)、sid(举报者sid)、toSid(被举报者sid)、rtType(1-内容投诉 2-用户投诉)、rtSource(来源 1-目击者 2-生活圈 3-H5 4:点播 5:直播) | |
| 44 | + if (TextUtils.isEmpty(contentId) || TextUtils.isEmpty(type)) { | |
| 45 | + AlertUtil.showDeftToast(context, "数据异常"); | |
| 46 | + return; | |
| 47 | + } | |
| 48 | + if (!TextUtils.isEmpty(url)) { | |
| 49 | + if (contentId == null) contentId = ""; | |
| 50 | + contentId = Uri.encode(contentId); | |
| 51 | + url = url.concat("contentId=" + contentId).concat("&rtType=1").concat("&rtSource=").concat(type); | |
| 52 | + ARouterUtil.startReportActivity(context, url); | |
| 53 | + } | |
| 54 | + } | |
| 55 | + | |
| 56 | +} | ... | ... |
cloud/share/src/main/java/com/cnlive/share/util/ShareUtils.java
0 → 100644
| 1 | +package com.cnlive.share.util; | |
| 2 | + | |
| 3 | +import android.app.Activity; | |
| 4 | +import android.content.Context; | |
| 5 | +import android.content.Intent; | |
| 6 | +import android.content.SharedPreferences; | |
| 7 | +import android.content.res.Resources; | |
| 8 | +import android.graphics.Bitmap; | |
| 9 | +import android.graphics.BitmapFactory; | |
| 10 | +import android.net.Uri; | |
| 11 | +import android.os.Bundle; | |
| 12 | +import android.text.TextUtils; | |
| 13 | +import android.util.Log; | |
| 14 | + | |
| 15 | +import com.alibaba.android.arouter.launcher.ARouter; | |
| 16 | +import com.bumptech.glide.Glide; | |
| 17 | +import com.bumptech.glide.request.RequestOptions; | |
| 18 | +import com.cnlive.core.libs.base.application.AppConfig; | |
| 19 | +import com.cnlive.core.libs.base.util.AlertUtil; | |
| 20 | +import com.cnlive.core.libs.base.util.FileUtils; | |
| 21 | +import com.cnlive.core.libs.base.util.NetworkUtil; | |
| 22 | +import com.cnlive.core.network.HttpConn; | |
| 23 | +import com.cnlive.core.network.NetCallBack; | |
| 24 | +import com.cnlive.core.network.model.BaseResult; | |
| 25 | +import com.cnlive.core.network.request.BaseRequest; | |
| 26 | +import com.cnlive.libs.base.analytics.AppProbeUtil; | |
| 27 | +import com.cnlive.share.BuildConfig; | |
| 28 | +import com.cnlive.share.QQListener; | |
| 29 | +import com.cnlive.share.R; | |
| 30 | +import com.cnlive.share.api.ApiShareService; | |
| 31 | +import com.cnlive.share.arouter.ARouterUtil; | |
| 32 | +import com.cnlive.share.data.ShareInfo; | |
| 33 | +import com.cnlive.share.data.ShareIntegralTypeInfo; | |
| 34 | +import com.cnlive.share.model.ShareReleaseInfoUtil; | |
| 35 | +import com.cnlive.share.model.ShortLinkInfo; | |
| 36 | +import com.cnlive.strike.user.auth.UserService; | |
| 37 | +import com.google.gson.Gson; | |
| 38 | +import com.sina.weibo.sdk.api.ImageObject; | |
| 39 | +import com.sina.weibo.sdk.api.TextObject; | |
| 40 | +import com.sina.weibo.sdk.api.WeiboMultiMessage; | |
| 41 | +import com.sina.weibo.sdk.share.WbShareHandler; | |
| 42 | +import com.tencent.connect.share.QQShare; | |
| 43 | +import com.tencent.mm.opensdk.modelmsg.SendMessageToWX; | |
| 44 | +import com.tencent.mm.opensdk.modelmsg.WXImageObject; | |
| 45 | +import com.tencent.mm.opensdk.modelmsg.WXMediaMessage; | |
| 46 | +import com.tencent.mm.opensdk.modelmsg.WXMiniProgramObject; | |
| 47 | +import com.tencent.mm.opensdk.modelmsg.WXWebpageObject; | |
| 48 | +import com.tencent.mm.opensdk.openapi.IWXAPI; | |
| 49 | +import com.tencent.mm.opensdk.openapi.WXAPIFactory; | |
| 50 | +import com.tencent.tauth.IUiListener; | |
| 51 | +import com.tencent.tauth.Tencent; | |
| 52 | +import com.tencent.tauth.UiError; | |
| 53 | + | |
| 54 | +import java.io.File; | |
| 55 | +import java.util.HashMap; | |
| 56 | +import java.util.Map; | |
| 57 | +import java.util.concurrent.TimeUnit; | |
| 58 | + | |
| 59 | +import io.reactivex.Observable; | |
| 60 | +import io.reactivex.ObservableOnSubscribe; | |
| 61 | +import io.reactivex.Observer; | |
| 62 | +import io.reactivex.android.schedulers.AndroidSchedulers; | |
| 63 | +import io.reactivex.disposables.Disposable; | |
| 64 | +import io.reactivex.schedulers.Schedulers; | |
| 65 | +import retrofit2.adapter.rxjava2.Result; | |
| 66 | + | |
| 67 | +import static android.content.Context.MODE_PRIVATE; | |
| 68 | +import static com.cnlive.share.util.Util.buildTransaction; | |
| 69 | + | |
| 70 | +/** | |
| 71 | + * 创建:wukuiqing | |
| 72 | + * <p> | |
| 73 | + * 时间:2017/10/17 | |
| 74 | + * <p> | |
| 75 | + * 描述: 分享的工具类 | |
| 76 | + */ | |
| 77 | + | |
| 78 | +public class ShareUtils { | |
| 79 | + private static ShareReleaseInfoUtil.ShareConfig config; | |
| 80 | + public static final String SHARE_TITLE = "快来加入中国网家家,优享美好生活!"; | |
| 81 | + | |
| 82 | + /** | |
| 83 | + * 分享到微信 | |
| 84 | + */ | |
| 85 | + public static void shareWechat(final ShareInfo shareInfo, final Context mContext) { | |
| 86 | + AppProbeUtil.Probe_ShareTimes_To(mContext, AppProbeUtil.TYPE_WX_FRIEND); | |
| 87 | + if (!NetworkUtil.isConnectInternet(mContext)) { | |
| 88 | + AlertUtil.showDeftToast(mContext, "网络异常,请检查您的网络"); | |
| 89 | + return; | |
| 90 | + } | |
| 91 | + if (Util.isWeixinAvilible(mContext) || Util.isWXAppInstalledAndSupported(mContext)) { | |
| 92 | + new Thread(new Runnable() { | |
| 93 | + @Override | |
| 94 | + public void run() { | |
| 95 | + try { | |
| 96 | + Bitmap bitmap = Glide.with(mContext) | |
| 97 | + .setDefaultRequestOptions(new RequestOptions().centerCrop()) | |
| 98 | + .asBitmap() | |
| 99 | + .load(shareInfo.getImgurl()) | |
| 100 | + .into(120, 120) | |
| 101 | + .get(2, TimeUnit.SECONDS); | |
| 102 | + if (bitmap == null) { | |
| 103 | + Resources res = mContext.getResources(); | |
| 104 | + Bitmap bmp = BitmapFactory.decodeResource(res, R.drawable.share_logo_share_module); | |
| 105 | + Bitmap thumbBmp = Bitmap.createScaledBitmap(bmp, 120, 120, true); | |
| 106 | + shareWx(thumbBmp, shareInfo, mContext, true); | |
| 107 | + return; | |
| 108 | + } | |
| 109 | + shareWx(bitmap, shareInfo, mContext, true); | |
| 110 | + } catch (Exception e) { | |
| 111 | + Resources res = mContext.getResources(); | |
| 112 | + Bitmap bmp = BitmapFactory.decodeResource(res, R.drawable.share_logo_share_module); | |
| 113 | + Bitmap thumbBmp = Bitmap.createScaledBitmap(bmp, 120, 120, true); | |
| 114 | + shareWx(thumbBmp, shareInfo, mContext, true); | |
| 115 | + } | |
| 116 | + | |
| 117 | + } | |
| 118 | + }).start(); | |
| 119 | + } else { | |
| 120 | + AlertUtil.showDeftToast(mContext, "您未安装该第三方应用,无法分享信息到该应用中!"); | |
| 121 | + } | |
| 122 | + | |
| 123 | + } | |
| 124 | + | |
| 125 | + private static void shareWx(Bitmap thumbBmp, ShareInfo shareInfo, Context mContext, boolean isWechat) { | |
| 126 | + if (!NetworkUtil.isConnectInternet(mContext)) { | |
| 127 | + AlertUtil.showDeftToast(mContext, "网络异常,请检查您的网络"); | |
| 128 | + } | |
| 129 | + String url = Util.processUrlData(shareInfo.getUrl(), mContext, false); | |
| 130 | + WXWebpageObject webpage = new WXWebpageObject(); | |
| 131 | + IWXAPI api = WXAPIFactory.createWXAPI(mContext, AppConfig.getWechatAppid()); | |
| 132 | + webpage.webpageUrl = url; | |
| 133 | + WXMediaMessage msg = new WXMediaMessage(webpage); | |
| 134 | + msg.title = shareInfo.getTitle(); | |
| 135 | + msg.description = shareInfo.getContent(); | |
| 136 | + msg.thumbData = Util.bmpToByteArray(thumbBmp, true); | |
| 137 | + SendMessageToWX.Req req = new SendMessageToWX.Req(); | |
| 138 | + if (TextUtils.isEmpty(shareInfo.getShareType())) { | |
| 139 | + req.transaction = buildTransaction("webpage"); | |
| 140 | + } else { | |
| 141 | + //封装的微信分享的gson数据 | |
| 142 | + ShareIntegralTypeInfo integralTypeInfo = new ShareIntegralTypeInfo(); | |
| 143 | + integralTypeInfo.setContentId(shareInfo.getContentId()); | |
| 144 | + integralTypeInfo.setShareType(shareInfo.getShareType()); | |
| 145 | + Gson gson = new Gson(); | |
| 146 | + String shareType = gson.toJson(integralTypeInfo); | |
| 147 | + req.transaction = shareType; | |
| 148 | + } | |
| 149 | + req.message = msg; | |
| 150 | + req.scene = isWechat ? SendMessageToWX.Req.WXSceneSession : SendMessageToWX.Req.WXSceneTimeline; | |
| 151 | + api.sendReq(req);//发送到微信 | |
| 152 | + if (thumbBmp != null) | |
| 153 | + thumbBmp.recycle(); | |
| 154 | + | |
| 155 | + } | |
| 156 | + | |
| 157 | + | |
| 158 | + /** | |
| 159 | + * 分享qq | |
| 160 | + * | |
| 161 | + * @param shareInfo | |
| 162 | + * @param mContext | |
| 163 | + */ | |
| 164 | + public static void shareQQ(ShareInfo shareInfo, Activity mContext) { | |
| 165 | + if (mContext == null) return; | |
| 166 | + if (!NetworkUtil.isConnectInternet(mContext)) { | |
| 167 | + AlertUtil.showDeftToast(mContext, "网络异常,请检查您的网络"); | |
| 168 | + return; | |
| 169 | + } | |
| 170 | + if (shareInfo == null || TextUtils.isEmpty(shareInfo.getUrl())) { | |
| 171 | + AlertUtil.showDeftToast(mContext, "数据异常"); | |
| 172 | + } | |
| 173 | + AppProbeUtil.Probe_ShareTimes_To(mContext, AppProbeUtil.TYPE_QQ_FRIEND); | |
| 174 | + String url = Util.processUrlData(shareInfo.getUrl(), mContext, false); | |
| 175 | + if (!TextUtils.isEmpty(url) && url.length() >= 512) { | |
| 176 | + Map<String, String> requestMap = new HashMap<>(); | |
| 177 | + requestMap.put("longUrl", url); | |
| 178 | + HttpConn.action(BaseRequest.init().service(ApiShareService.class) | |
| 179 | + .genShortLinks(requestMap), new NetCallBack<BaseResult<ShortLinkInfo>>() { | |
| 180 | + @Override | |
| 181 | + public void onRequestState(int state) { | |
| 182 | + | |
| 183 | + } | |
| 184 | + | |
| 185 | + @Override | |
| 186 | + public void onSuccess(BaseResult<ShortLinkInfo> data) { | |
| 187 | + if (!TextUtils.isEmpty(data.getData().getShortUrl())) { | |
| 188 | + showQQ(shareInfo, mContext, data.getData().getShortUrl()); | |
| 189 | + } else { | |
| 190 | + AlertUtil.showDeftToast(mContext, "数据异常"); | |
| 191 | + } | |
| 192 | + } | |
| 193 | + | |
| 194 | + @Override | |
| 195 | + public void onFailure(String errCode, String errMsg) { | |
| 196 | + AlertUtil.showDeftToast(mContext, errMsg); | |
| 197 | + } | |
| 198 | + }); | |
| 199 | + } else { | |
| 200 | + showQQ(shareInfo, mContext, url); | |
| 201 | + } | |
| 202 | + | |
| 203 | + } | |
| 204 | + | |
| 205 | + private static void showQQ(ShareInfo shareInfo, Activity mContext, String url) { | |
| 206 | + Tencent mTencent = Tencent.createInstance(BuildConfig.QQ_SHARE, mContext); | |
| 207 | + String imgUrl; | |
| 208 | + if (!TextUtils.isEmpty(shareInfo.getImgurl()) && shareInfo.getImgurl().contains("http")) { | |
| 209 | + imgUrl = shareInfo.getImgurl(); | |
| 210 | + } else { | |
| 211 | + imgUrl = AppConfig.getShareIcon(); | |
| 212 | + } | |
| 213 | + if (Util.checkQQ(mContext) || Util.isQQClientAvailable(mContext) || mTencent.isQQInstalled(mContext)) { | |
| 214 | + Bundle params = new Bundle(); | |
| 215 | + params.putInt(QQShare.SHARE_TO_QQ_KEY_TYPE, QQShare.SHARE_TO_QQ_TYPE_DEFAULT); | |
| 216 | + params.putString(QQShare.SHARE_TO_QQ_TITLE, shareInfo.getTitle());// 标题 | |
| 217 | + params.putString(QQShare.SHARE_TO_QQ_SUMMARY, shareInfo.getContent());// 摘要 | |
| 218 | + params.putString(QQShare.SHARE_TO_QQ_TARGET_URL, url);// 内容地址 | |
| 219 | + params.putString(QQShare.SHARE_TO_QQ_IMAGE_URL, imgUrl);// 网络图片地址 | |
| 220 | + params.putString(QQShare.SHARE_TO_QQ_APP_NAME, "网家家");// 应用名称 | |
| 221 | + // 分享操作要在主线程中完成 | |
| 222 | + mTencent.shareToQQ(mContext, params, new QQListener() { | |
| 223 | + @Override | |
| 224 | + public void onComplete(Object o) { | |
| 225 | + processQQCallBack(mContext, shareInfo.getShareType(), shareInfo.getContentId()); | |
| 226 | + AlertUtil.showDeftToast(mContext, "分享成功"); | |
| 227 | + | |
| 228 | + } | |
| 229 | + | |
| 230 | + @Override | |
| 231 | + public void onError(UiError uiError) { | |
| 232 | + AlertUtil.showDeftToast(mContext, "分享失败"); | |
| 233 | + } | |
| 234 | + | |
| 235 | + @Override | |
| 236 | + public void onCancel() { | |
| 237 | + AlertUtil.showDeftToast(mContext, "取消分享"); | |
| 238 | + } | |
| 239 | + }); | |
| 240 | + } else { | |
| 241 | + AlertUtil.showDeftToast(mContext, "您未安装该第三方应用,无法分享信息到该应用中!"); | |
| 242 | + } | |
| 243 | + } | |
| 244 | + | |
| 245 | + //分享纯图片到qq | |
| 246 | + | |
| 247 | + public static void showQQPic(File file, Activity mContext) { | |
| 248 | + Tencent mTencent = Tencent.createInstance(BuildConfig.QQ_SHARE, mContext); | |
| 249 | + if (Util.checkQQ(mContext) || Util.isQQClientAvailable(mContext) || mTencent.isQQInstalled(mContext)) { | |
| 250 | + | |
| 251 | + Bundle params = new Bundle(); | |
| 252 | + params.putString(QQShare.SHARE_TO_QQ_IMAGE_LOCAL_URL, file.getAbsolutePath()); | |
| 253 | + params.putString(QQShare.SHARE_TO_QQ_APP_NAME, ""); | |
| 254 | + params.putInt(QQShare.SHARE_TO_QQ_KEY_TYPE, QQShare.SHARE_TO_QQ_TYPE_IMAGE); | |
| 255 | + mTencent.shareToQQ(mContext, params, new IUiListener() { | |
| 256 | + @Override | |
| 257 | + public void onComplete(Object o) { | |
| 258 | + | |
| 259 | + } | |
| 260 | + | |
| 261 | + @Override | |
| 262 | + public void onError(UiError uiError) { | |
| 263 | + | |
| 264 | + } | |
| 265 | + | |
| 266 | + @Override | |
| 267 | + public void onCancel() { | |
| 268 | + | |
| 269 | + } | |
| 270 | + }); | |
| 271 | + | |
| 272 | + } else { | |
| 273 | + AlertUtil.showDeftToast(mContext, "您未安装该第三方应用,无法分享信息到该应用中!"); | |
| 274 | + } | |
| 275 | + } | |
| 276 | + | |
| 277 | + | |
| 278 | + /** | |
| 279 | + * 处理qq成功回调的数据 | |
| 280 | + * | |
| 281 | + * @param mContext | |
| 282 | + * @param shareType 分享的类型 | |
| 283 | + * @param contentId 用与统计的内容ID | |
| 284 | + */ | |
| 285 | + public static void processQQCallBack(Activity mContext, String shareType, String contentId) { | |
| 286 | + if (TextUtils.isEmpty(shareType)) return; | |
| 287 | + switch (shareType) { | |
| 288 | + case "witnessVideo": | |
| 289 | + SharedPreferences preferences = mContext.getSharedPreferences("sharevideo", MODE_PRIVATE); | |
| 290 | + boolean status = preferences.getBoolean(UserService.getUid(mContext), false); | |
| 291 | + String newTime = DateTimeUtil.getCurrentTime(); | |
| 292 | + String oldtime = preferences.getString(UserService.getUid(mContext) + "time", "2019-04-10"); | |
| 293 | + boolean sameDay = DateTimeUtil.isSameDay(newTime, oldtime); | |
| 294 | + if (!status) { | |
| 295 | + ARouterUtil.addIntegrationPic(mContext, "share_video", contentId, "sharevideo"); | |
| 296 | + } | |
| 297 | + if (status && !sameDay) { | |
| 298 | + ARouterUtil.addIntegrationPic(mContext, "share_video", contentId, "sharevideo"); | |
| 299 | + } | |
| 300 | + break; | |
| 301 | + default: | |
| 302 | + SharedPreferences preferences1 = mContext.getSharedPreferences("sharearticle", MODE_PRIVATE); | |
| 303 | + boolean status1 = preferences1.getBoolean(UserService.getUid(mContext), false); | |
| 304 | + String newTime1 = DateTimeUtil.getCurrentTime(); | |
| 305 | + String oldtime1 = preferences1.getString(UserService.getUid(mContext) + "time", "2019-04-10"); | |
| 306 | + boolean sameDay1 = DateTimeUtil.isSameDay(newTime1, oldtime1); | |
| 307 | + if (!status1) { | |
| 308 | + ARouterUtil.addIntegrationPic(mContext, "share_article", contentId, "sharearticle"); | |
| 309 | + } | |
| 310 | + if (status1 && !sameDay1) { | |
| 311 | + ARouterUtil.addIntegrationPic(mContext, "share_article", contentId, "sharearticle"); | |
| 312 | + } | |
| 313 | + break; | |
| 314 | + } | |
| 315 | + } | |
| 316 | + | |
| 317 | + /** | |
| 318 | + * 分享到朋友圈 | |
| 319 | + */ | |
| 320 | + public static void shareWCE(final ShareInfo shareInfo, final Context mContext) { | |
| 321 | + AppProbeUtil.Probe_ShareTimes_To(mContext, AppProbeUtil.TYPE_WX_MOMENT); | |
| 322 | + if (!NetworkUtil.isConnectInternet(mContext)) { | |
| 323 | + AlertUtil.showDeftToast(mContext, "网络异常,请检查您的网络"); | |
| 324 | + return; | |
| 325 | + } | |
| 326 | + if (Util.checkWechat(mContext)) { | |
| 327 | + | |
| 328 | + new Thread(new Runnable() { | |
| 329 | + @Override | |
| 330 | + public void run() { | |
| 331 | + try { | |
| 332 | + Bitmap bitmap = Glide.with(mContext) | |
| 333 | + .setDefaultRequestOptions(new RequestOptions().centerCrop()) | |
| 334 | + .asBitmap() | |
| 335 | + .load(shareInfo.getImgurl()) | |
| 336 | + .into(120, 120) | |
| 337 | + .get(2, TimeUnit.SECONDS); | |
| 338 | + if (bitmap == null) { | |
| 339 | + Resources res = mContext.getResources(); | |
| 340 | + Bitmap bmp = BitmapFactory.decodeResource(res, R.drawable.share_logo_share_module); | |
| 341 | + Bitmap thumbBmp = Bitmap.createScaledBitmap(bmp, 120, 120, true); | |
| 342 | + shareWx(thumbBmp, shareInfo, mContext, false); | |
| 343 | + return; | |
| 344 | + } | |
| 345 | + shareWx(bitmap, shareInfo, mContext, false); | |
| 346 | + } catch (Exception e) { | |
| 347 | + Resources res = mContext.getResources(); | |
| 348 | + Bitmap bmp = BitmapFactory.decodeResource(res, R.drawable.share_logo_share_module); | |
| 349 | + Bitmap thumbBmp = Bitmap.createScaledBitmap(bmp, 120, 120, true); | |
| 350 | + shareWx(thumbBmp, shareInfo, mContext, false); | |
| 351 | + } | |
| 352 | + | |
| 353 | + | |
| 354 | + } | |
| 355 | + }).start(); | |
| 356 | + } else { | |
| 357 | + AlertUtil.showDeftToast(mContext, "您未安装该第三方应用,无法分享信息到该应用中!"); | |
| 358 | + } | |
| 359 | + } | |
| 360 | + | |
| 361 | + /** | |
| 362 | + * 小程序分享 | |
| 363 | + * | |
| 364 | + * @param context | |
| 365 | + */ | |
| 366 | + public static void shareWechatApplet(Context context, | |
| 367 | + ShareInfo shareInfo) { | |
| 368 | + new Thread(new Runnable() { | |
| 369 | + @Override | |
| 370 | + public void run() { | |
| 371 | + try { | |
| 372 | + Bitmap bitmap = Glide.with(context) | |
| 373 | + .setDefaultRequestOptions(new RequestOptions().centerCrop()) | |
| 374 | + .asBitmap() | |
| 375 | + .load(shareInfo.getImgurl()) | |
| 376 | + .into(120, 120) | |
| 377 | + .get(2, TimeUnit.SECONDS); | |
| 378 | + if (bitmap == null) { | |
| 379 | + Resources res = context.getResources(); | |
| 380 | + Bitmap bmp = BitmapFactory.decodeResource(res, R.drawable.share_logo_share_module); | |
| 381 | + Bitmap thumbBmp = Bitmap.createScaledBitmap(bmp, 120, 120, true); | |
| 382 | + WechatApplet(context, shareInfo, thumbBmp); | |
| 383 | + return; | |
| 384 | + } | |
| 385 | + WechatApplet(context, shareInfo, bitmap); | |
| 386 | + } catch (Exception e) { | |
| 387 | + Resources res = context.getResources(); | |
| 388 | + Bitmap bmp = BitmapFactory.decodeResource(res, R.drawable.share_logo_share_module); | |
| 389 | + Bitmap thumbBmp = Bitmap.createScaledBitmap(bmp, 120, 120, true); | |
| 390 | + WechatApplet(context, shareInfo, thumbBmp); | |
| 391 | + } | |
| 392 | + | |
| 393 | + } | |
| 394 | + }).start(); | |
| 395 | + } | |
| 396 | + | |
| 397 | + private static void WechatApplet(Context context, | |
| 398 | + ShareInfo info, Bitmap thumbBmp) { | |
| 399 | + IWXAPI api = WXAPIFactory.createWXAPI(context, BuildConfig.WECHAT_SHARE); | |
| 400 | + WXMiniProgramObject miniProgramObj = new WXMiniProgramObject(); | |
| 401 | + miniProgramObj.webpageUrl = info.getWebpageUrl(); // 兼容低版本的网页链接 | |
| 402 | + miniProgramObj.miniprogramType = info.getMiniprogramType();// 正式版:0,测试版:1,体验版:2 | |
| 403 | + miniProgramObj.userName = info.getUserName(); // 小程序原始id | |
| 404 | + miniProgramObj.path = info.getPath(); //小程序页面路径 | |
| 405 | + WXMediaMessage msg = new WXMediaMessage(miniProgramObj); | |
| 406 | + msg.title = info.getTitle(); // 小程序消息title | |
| 407 | + msg.description = info.getContent(); // 小程序消息desc | |
| 408 | + msg.thumbData = Util.bmpToByteArray(thumbBmp, true); // 小程序消息封面图片,小于128k | |
| 409 | + | |
| 410 | + SendMessageToWX.Req req = new SendMessageToWX.Req(); | |
| 411 | + req.transaction = buildTransaction("miniProgram"); | |
| 412 | + req.message = msg; | |
| 413 | + req.scene = SendMessageToWX.Req.WXSceneSession; // 目前只支持会话 | |
| 414 | + api.sendReq(req); | |
| 415 | + } | |
| 416 | + | |
| 417 | + | |
| 418 | + /** | |
| 419 | + * 跳转到浏览器 | |
| 420 | + * | |
| 421 | + * @param context | |
| 422 | + * @param url | |
| 423 | + */ | |
| 424 | + public static void startBrowser(Context context, String url) { | |
| 425 | + AppProbeUtil.Probe_ShareTimes_To(context, AppProbeUtil.TYPE_BROWSER); | |
| 426 | + Intent intent = new Intent(); | |
| 427 | + intent.setAction("android.intent.action.VIEW"); | |
| 428 | + Uri content_url = Uri.parse(Util.processUrlData(url, context, false)); | |
| 429 | + intent.setData(content_url); | |
| 430 | + context.startActivity(intent); | |
| 431 | + } | |
| 432 | + | |
| 433 | + private static ShareReleaseInfoUtil.ShareConfig initAppShareConfig(ShareInfo info, Context context) { | |
| 434 | + if (config == null) config = ShareReleaseInfoUtil.ShareConfig.newInstance(); | |
| 435 | + if (info != null) { | |
| 436 | + if (info.isProcessWjjShare()) { | |
| 437 | + info.setUrl(TextUtils.isEmpty(info.getWjjShareUrl()) ? AppConfig.getShareDownload() : info.getWjjShareUrl()); | |
| 438 | + } | |
| 439 | + String WJJ_FRIEND = Util.processUrlData(info.getUrl(), context, true); | |
| 440 | + info.setUrl(WJJ_FRIEND); | |
| 441 | + } | |
| 442 | + return config | |
| 443 | + .setImage(info.getImgurl()) | |
| 444 | + .setTitle(info.getTitle()) | |
| 445 | + .setSubTitle(info.getContent()) | |
| 446 | + .setUrl(info.getUrl()) | |
| 447 | + .setType(ShareReleaseInfoUtil.TYPE_HTML); | |
| 448 | + } | |
| 449 | + | |
| 450 | + public static void shareAppMoment(ShareInfo shareInfo, Context context) { | |
| 451 | + AppProbeUtil.Probe_ShareTimes_To(context, AppProbeUtil.TYPE_WJJ_MOMENT); | |
| 452 | + initAppShareConfig(shareInfo, context).shareRelease(context); | |
| 453 | + } | |
| 454 | + | |
| 455 | + public static void shareAppIM(ShareInfo shareInfo, Context context) { | |
| 456 | + AppProbeUtil.Probe_ShareTimes_To(context, AppProbeUtil.TYPE_WJJ_FRIEND); | |
| 457 | + initAppShareConfig(shareInfo, context).shareSend(context); | |
| 458 | + } | |
| 459 | + | |
| 460 | + /** | |
| 461 | + * 分享 图片到生活圈和分享图片到好友 | |
| 462 | + * | |
| 463 | + * @param context | |
| 464 | + * @param bmp | |
| 465 | + * @param isWechat 是否是分享到好友 | |
| 466 | + */ | |
| 467 | + public static void shareWechatPic(Context context, Bitmap bmp, boolean isWechat) { | |
| 468 | + if (Util.isWeixinAvilible(context) || Util.isWXAppInstalledAndSupported(context)) { | |
| 469 | + | |
| 470 | + try { | |
| 471 | + IWXAPI api = WXAPIFactory.createWXAPI(context, BuildConfig.WECHAT_SHARE); | |
| 472 | + if (bmp == null) { | |
| 473 | + bmp = BitmapFactory.decodeResource(context.getResources(), R.drawable.share_logo_share_module); | |
| 474 | + } | |
| 475 | + | |
| 476 | + //初始化 WXImageObject 和 WXMediaMessage 对象 | |
| 477 | + WXImageObject imgObj = new WXImageObject(bmp); | |
| 478 | + WXMediaMessage msg = new WXMediaMessage(); | |
| 479 | + msg.mediaObject = imgObj; | |
| 480 | + | |
| 481 | + //设置缩略图 | |
| 482 | + Bitmap thumbBmp = Bitmap.createScaledBitmap(bmp, 120, 120, true); | |
| 483 | + bmp.recycle(); | |
| 484 | + msg.thumbData = Util.bmpToByteArray(thumbBmp, true); | |
| 485 | + | |
| 486 | + //构造一个Req | |
| 487 | + SendMessageToWX.Req req = new SendMessageToWX.Req(); | |
| 488 | + req.transaction = buildTransaction("img"); | |
| 489 | + req.message = msg; | |
| 490 | + req.scene = isWechat ? SendMessageToWX.Req.WXSceneSession : SendMessageToWX.Req.WXSceneTimeline; | |
| 491 | + ; | |
| 492 | + //调用api接口,发送数据到微信 | |
| 493 | + api.sendReq(req); | |
| 494 | + } catch (Exception e) { | |
| 495 | + Log.e("异常:", e.getMessage()); | |
| 496 | + } | |
| 497 | + | |
| 498 | + } else { | |
| 499 | + AlertUtil.showDeftToast(context, "您未安装该第三方应用,无法分享信息到该应用中!"); | |
| 500 | + } | |
| 501 | + | |
| 502 | + } | |
| 503 | + | |
| 504 | + | |
| 505 | + /** | |
| 506 | + * 分享图片到生活圈与好友 | |
| 507 | + * | |
| 508 | + * @param mContext | |
| 509 | + * @param type | |
| 510 | + * @param imgUrl | |
| 511 | + */ | |
| 512 | + public static void getForwardingImgPath(Activity mContext, String type, String imgUrl) { | |
| 513 | + if (TextUtils.isEmpty(imgUrl)) return; | |
| 514 | + if (mContext == null) return; | |
| 515 | + Observable.create((ObservableOnSubscribe<String>) emitter -> { | |
| 516 | + if (FileUtils.isFileExists(imgUrl) && FileUtils.getFileByPath(imgUrl).length() > 0) { | |
| 517 | + emitter.onNext(imgUrl); | |
| 518 | + } else { | |
| 519 | + if (imgUrl.contains("http")) { | |
| 520 | + File file = Glide.with(mContext).asFile().load(imgUrl).submit().get(); | |
| 521 | + if (file != null && file.exists() && file.length() > 0) { | |
| 522 | + String path = file.getAbsolutePath(); | |
| 523 | + emitter.onNext(path); | |
| 524 | + } else { | |
| 525 | + emitter.onError(new Throwable("非法图片地址")); | |
| 526 | + } | |
| 527 | + } else { | |
| 528 | + emitter.onError(new Throwable("非法图片地址")); | |
| 529 | + } | |
| 530 | + | |
| 531 | + } | |
| 532 | + | |
| 533 | + }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<String>() { | |
| 534 | + @Override | |
| 535 | + public void onSubscribe(Disposable d) { | |
| 536 | + | |
| 537 | + } | |
| 538 | + | |
| 539 | + @Override | |
| 540 | + public void onNext(String content) { | |
| 541 | + if (!TextUtils.isEmpty(content)) { | |
| 542 | + if (type.equals("friends")) { | |
| 543 | + ARouter.getInstance().build("/cnconversation/SelectForwardActivity") | |
| 544 | + .withString("shareLocalContent", content) | |
| 545 | + .withInt("shareType", 0x2002) | |
| 546 | + .withInt("inType", 0x1002) | |
| 547 | + .navigation(mContext); | |
| 548 | + mContext.finish(); | |
| 549 | + } else if (type.equals("life")) { | |
| 550 | + File file = new File(content); //pic 1 video 3 | |
| 551 | + if (!FileUtils.isFileExists(content)) return; | |
| 552 | + ARouter.getInstance().build("/cnmain/ReleaseManagementAcityity") | |
| 553 | + .withInt("type", 4) | |
| 554 | + .withString("path", file.getPath()) | |
| 555 | + .withString("name", file.getName()) | |
| 556 | + .withString("parentDir", "") | |
| 557 | + .withInt("mediaType", 1) | |
| 558 | + .withInt("id", 0) | |
| 559 | + .withLong("time", 1) | |
| 560 | + .withLong("size", file.length()) | |
| 561 | + .navigation(mContext); | |
| 562 | + mContext.finish(); | |
| 563 | + } else { | |
| 564 | + AlertUtil.showDeftToast(mContext, "类型异常"); | |
| 565 | + } | |
| 566 | + } else { | |
| 567 | + AlertUtil.showDeftToast(mContext, "非法图片地址"); | |
| 568 | + } | |
| 569 | + } | |
| 570 | + | |
| 571 | + @Override | |
| 572 | + public void onError(Throwable e) { | |
| 573 | + AlertUtil.showDeftToast(mContext, e.getMessage()); | |
| 574 | + } | |
| 575 | + | |
| 576 | + @Override | |
| 577 | + public void onComplete() { | |
| 578 | + | |
| 579 | + } | |
| 580 | + }); | |
| 581 | + } | |
| 582 | + | |
| 583 | + public static void shareWeiBo(Activity mContext, ShareInfo shareInfo) { | |
| 584 | + if (!NetworkUtil.isConnectInternet(mContext)) { | |
| 585 | + AlertUtil.showDeftToast(mContext, "网络异常,请检查您的网络"); | |
| 586 | + return; | |
| 587 | + } | |
| 588 | + if (Util.isWeiboInstallAndInit(mContext)) { | |
| 589 | + //注册微博 | |
| 590 | + WbShareHandler shareHandler = new WbShareHandler(mContext); | |
| 591 | + shareHandler.registerApp(); | |
| 592 | + ImageObject imageObject = new ImageObject(); | |
| 593 | + WeiboMultiMessage weiboMessage = new WeiboMultiMessage(); | |
| 594 | + TextObject textObject = new TextObject(); | |
| 595 | + textObject.text = shareInfo.getContent() + shareInfo.getUrl(); | |
| 596 | + weiboMessage.textObject = textObject; | |
| 597 | + | |
| 598 | + | |
| 599 | + weiboMessage.imageObject = imageObject; | |
| 600 | + new Thread(new Runnable() { | |
| 601 | + @Override | |
| 602 | + public void run() { | |
| 603 | + try { | |
| 604 | + Bitmap bitmap = Glide.with(mContext) | |
| 605 | + .setDefaultRequestOptions(new RequestOptions().centerCrop()) | |
| 606 | + .asBitmap() | |
| 607 | + .load(shareInfo.getImgurl()) | |
| 608 | + .into(120, 120) | |
| 609 | + .get(2, TimeUnit.SECONDS); | |
| 610 | + if (bitmap == null) { | |
| 611 | + Resources res = mContext.getResources(); | |
| 612 | + Bitmap bmp = BitmapFactory.decodeResource(res, R.drawable.share_logo_share_module); | |
| 613 | + imageObject.setImageObject(bmp); | |
| 614 | + shareHandler.shareMessage(weiboMessage, false); | |
| 615 | + return; | |
| 616 | + } else { | |
| 617 | + imageObject.setImageObject(bitmap); | |
| 618 | + shareHandler.shareMessage(weiboMessage, false); | |
| 619 | + } | |
| 620 | + } catch (Exception e) { | |
| 621 | + Resources res = mContext.getResources(); | |
| 622 | + Bitmap bmp = BitmapFactory.decodeResource(res, R.drawable.share_logo_share_module); | |
| 623 | + imageObject.setImageObject(bmp); | |
| 624 | + shareHandler.shareMessage(weiboMessage, false); | |
| 625 | + } | |
| 626 | + | |
| 627 | + } | |
| 628 | + }).start(); | |
| 629 | + } else { | |
| 630 | + AlertUtil.showDeftToast(mContext, "您未安装该第三方应用,无法分享信息到该应用中!"); | |
| 631 | + } | |
| 632 | + | |
| 633 | + } | |
| 634 | + | |
| 635 | + | |
| 636 | + public static void shareWbPic(Activity context, Bitmap bitmap) { | |
| 637 | + if (Util.isWeiboInstallAndInit(context)) { | |
| 638 | + ImageObject imageObject = new ImageObject(); | |
| 639 | + imageObject.setImageObject(bitmap); | |
| 640 | + WeiboMultiMessage weiboMessage = new WeiboMultiMessage(); | |
| 641 | + weiboMessage.imageObject = imageObject; | |
| 642 | + WbShareHandler shareHandler = new WbShareHandler(context); | |
| 643 | + shareHandler.registerApp(); | |
| 644 | + shareHandler.shareMessage(weiboMessage, false); | |
| 645 | + } else { | |
| 646 | + AlertUtil.showDeftToast(context, "您未安装该第三方应用,无法分享信息到该应用中!"); | |
| 647 | + } | |
| 648 | + | |
| 649 | + } | |
| 650 | + | |
| 651 | + /** | |
| 652 | + * 分享qq | |
| 653 | + * | |
| 654 | + * @param shareInfo | |
| 655 | + * @param mContext | |
| 656 | + */ | |
| 657 | + public static void shareQQActivity(ShareInfo shareInfo, Activity mContext, IUiListener listener) { | |
| 658 | + if (mContext == null) return; | |
| 659 | + if (!NetworkUtil.isConnectInternet(mContext)) { | |
| 660 | + AlertUtil.showDeftToast(mContext, "网络异常,请检查您的网络"); | |
| 661 | + return; | |
| 662 | + } | |
| 663 | + if (shareInfo == null || TextUtils.isEmpty(shareInfo.getUrl())) { | |
| 664 | + AlertUtil.showDeftToast(mContext, "数据异常"); | |
| 665 | + } | |
| 666 | + AppProbeUtil.Probe_ShareTimes_To(mContext, AppProbeUtil.TYPE_QQ_FRIEND); | |
| 667 | + String url = Util.processUrlData(shareInfo.getUrl(), mContext, false); | |
| 668 | + if (!TextUtils.isEmpty(url) && url.length() >= 512) { | |
| 669 | + HashMap<String, String> requestMap = new HashMap<>(); | |
| 670 | + requestMap.put("longUrl", url); | |
| 671 | + HttpConn.action(BaseRequest.init() | |
| 672 | + .service(ApiShareService.class) | |
| 673 | + .genShortLinks(requestMap), new NetCallBack<BaseResult<ShortLinkInfo>>() { | |
| 674 | + @Override | |
| 675 | + public void onRequestState(int state) { | |
| 676 | + | |
| 677 | + } | |
| 678 | + | |
| 679 | + @Override | |
| 680 | + public void onSuccess(BaseResult<ShortLinkInfo> data) { | |
| 681 | + if (!TextUtils.isEmpty(data.getData().getShortUrl())) { | |
| 682 | + showQQ(shareInfo, mContext, data.getData().getShortUrl(), listener); | |
| 683 | + } else { | |
| 684 | + AlertUtil.showDeftToast(mContext, "数据异常"); | |
| 685 | + } | |
| 686 | + } | |
| 687 | + | |
| 688 | + @Override | |
| 689 | + public void onFailure(String errCode, String errMsg) { | |
| 690 | + AlertUtil.showDeftToast(mContext, errMsg); | |
| 691 | + } | |
| 692 | + }); | |
| 693 | + } else { | |
| 694 | + showQQ(shareInfo, mContext, url, listener); | |
| 695 | + } | |
| 696 | + | |
| 697 | + } | |
| 698 | + | |
| 699 | + /** | |
| 700 | + * 自己实现监听 | |
| 701 | + * | |
| 702 | + * @param shareInfo | |
| 703 | + * @param mContext | |
| 704 | + * @param url | |
| 705 | + * @param listener | |
| 706 | + */ | |
| 707 | + private static void showQQ(ShareInfo shareInfo, Activity mContext, String url, IUiListener listener) { | |
| 708 | + Tencent mTencent = Tencent.createInstance(BuildConfig.QQ_SHARE, mContext); | |
| 709 | + String imgUrl; | |
| 710 | + if (!TextUtils.isEmpty(shareInfo.getImgurl()) && shareInfo.getImgurl().contains("http")) { | |
| 711 | + imgUrl = shareInfo.getImgurl(); | |
| 712 | + } else { | |
| 713 | + imgUrl = AppConfig.getShareIcon(); | |
| 714 | + } | |
| 715 | + if (Util.checkQQ(mContext) || Util.isQQClientAvailable(mContext) || mTencent.isQQInstalled(mContext)) { | |
| 716 | + Bundle params = new Bundle(); | |
| 717 | + params.putInt(QQShare.SHARE_TO_QQ_KEY_TYPE, QQShare.SHARE_TO_QQ_TYPE_DEFAULT); | |
| 718 | + params.putString(QQShare.SHARE_TO_QQ_TITLE, shareInfo.getTitle());// 标题 | |
| 719 | + params.putString(QQShare.SHARE_TO_QQ_SUMMARY, shareInfo.getContent());// 摘要 | |
| 720 | + params.putString(QQShare.SHARE_TO_QQ_TARGET_URL, url);// 内容地址 | |
| 721 | + params.putString(QQShare.SHARE_TO_QQ_IMAGE_URL, imgUrl);// 网络图片地址 | |
| 722 | + params.putString(QQShare.SHARE_TO_QQ_APP_NAME, "网家家");// 应用名称 | |
| 723 | + // 分享操作要在主线程中完成 | |
| 724 | + mTencent.shareToQQ(mContext, params, listener); | |
| 725 | + } else { | |
| 726 | + AlertUtil.showDeftToast(mContext, "您未安装该第三方应用,无法分享信息到该应用中!"); | |
| 727 | + } | |
| 728 | + } | |
| 729 | + | |
| 730 | +} | ... | ... |
cloud/share/src/main/java/com/cnlive/share/util/Util.java
0 → 100644
| 1 | +package com.cnlive.share.util; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * 作者: 吴奎庆 | |
| 5 | + * <p> | |
| 6 | + * 时间: 2018/8/22 | |
| 7 | + * <p> | |
| 8 | + * 简介: | |
| 9 | + */ | |
| 10 | + | |
| 11 | + | |
| 12 | +import android.content.Context; | |
| 13 | +import android.content.Intent; | |
| 14 | +import android.content.pm.PackageInfo; | |
| 15 | +import android.content.pm.PackageManager; | |
| 16 | +import android.graphics.Bitmap; | |
| 17 | +import android.graphics.Bitmap.CompressFormat; | |
| 18 | +import android.graphics.Canvas; | |
| 19 | +import android.graphics.Rect; | |
| 20 | +import android.net.Uri; | |
| 21 | +import android.text.TextUtils; | |
| 22 | + | |
| 23 | +import com.cnlive.core.libs.base.application.AppConfig; | |
| 24 | +import com.cnlive.core.network.util.UriUtil; | |
| 25 | +import com.cnlive.share.BuildConfig; | |
| 26 | +import com.cnlive.strike.user.auth.UserService; | |
| 27 | +import com.sina.weibo.sdk.WbSdk; | |
| 28 | +import com.sina.weibo.sdk.auth.AuthInfo; | |
| 29 | +import com.tencent.mm.opensdk.openapi.IWXAPI; | |
| 30 | +import com.tencent.mm.opensdk.openapi.WXAPIFactory; | |
| 31 | + | |
| 32 | +import java.io.ByteArrayOutputStream; | |
| 33 | +import java.io.InputStream; | |
| 34 | +import java.util.List; | |
| 35 | + | |
| 36 | + | |
| 37 | +public class Util { | |
| 38 | + | |
| 39 | + public static byte[] bmpToByteArray(final Bitmap bmp, final boolean needRecycle) { | |
| 40 | + | |
| 41 | + if (bmp == null) return null; | |
| 42 | + int i; | |
| 43 | + int j; | |
| 44 | + if (bmp.getHeight() > bmp.getWidth()) { | |
| 45 | + i = bmp.getWidth(); | |
| 46 | + j = bmp.getWidth(); | |
| 47 | + } else { | |
| 48 | + i = bmp.getHeight(); | |
| 49 | + j = bmp.getHeight(); | |
| 50 | + } | |
| 51 | + | |
| 52 | + Bitmap localBitmap = Bitmap.createBitmap(i, j, Bitmap.Config.RGB_565); | |
| 53 | + Canvas localCanvas = new Canvas(localBitmap); | |
| 54 | + | |
| 55 | + while (true) { | |
| 56 | + localCanvas.drawBitmap(bmp, new Rect(0, 0, i, j), new Rect(0, 0, i, j), null); | |
| 57 | + if (needRecycle) | |
| 58 | + bmp.recycle(); | |
| 59 | + ByteArrayOutputStream localByteArrayOutputStream = new ByteArrayOutputStream(); | |
| 60 | + localBitmap.compress(CompressFormat.JPEG, 100, | |
| 61 | + localByteArrayOutputStream); | |
| 62 | + localBitmap.recycle(); | |
| 63 | + byte[] arrayOfByte = localByteArrayOutputStream.toByteArray(); | |
| 64 | + try { | |
| 65 | + localByteArrayOutputStream.close(); | |
| 66 | + return arrayOfByte; | |
| 67 | + } catch (Exception e) { | |
| 68 | + // F.out(e); | |
| 69 | + } | |
| 70 | + i = bmp.getHeight(); | |
| 71 | + j = bmp.getHeight(); | |
| 72 | + } | |
| 73 | + } | |
| 74 | + | |
| 75 | + public static byte[] inputStreamToByte(InputStream is) { | |
| 76 | + try { | |
| 77 | + ByteArrayOutputStream bytestream = new ByteArrayOutputStream(); | |
| 78 | + int ch; | |
| 79 | + while ((ch = is.read()) != -1) { | |
| 80 | + bytestream.write(ch); | |
| 81 | + } | |
| 82 | + byte imgdata[] = bytestream.toByteArray(); | |
| 83 | + bytestream.close(); | |
| 84 | + return imgdata; | |
| 85 | + } catch (Exception e) { | |
| 86 | + e.printStackTrace(); | |
| 87 | + } | |
| 88 | + | |
| 89 | + return null; | |
| 90 | + } | |
| 91 | + | |
| 92 | + /** | |
| 93 | + * 判断是否安装了微信客户端 | |
| 94 | + */ | |
| 95 | + public static boolean isWXAppInstalledAndSupported(Context context) { | |
| 96 | + IWXAPI api = WXAPIFactory.createWXAPI(context, BuildConfig.WECHAT_SHARE); | |
| 97 | + return api.isWXAppInstalled(); | |
| 98 | + } | |
| 99 | + | |
| 100 | + | |
| 101 | + public static boolean isWeixinAvilible(Context context) { | |
| 102 | + PackageManager packageManager = context.getPackageManager();// 获取packagemanager | |
| 103 | + List<PackageInfo> pinfo = packageManager.getInstalledPackages(0);// 获取所有已安装程序的包信息 | |
| 104 | + if (pinfo != null) { | |
| 105 | + for (int i = 0; i < pinfo.size(); i++) { | |
| 106 | + String pn = pinfo.get(i).packageName; | |
| 107 | + if (pn.equals("com.tencent.mm")) { | |
| 108 | + return true; | |
| 109 | + } | |
| 110 | + } | |
| 111 | + } | |
| 112 | + return false; | |
| 113 | + } | |
| 114 | + | |
| 115 | + /** | |
| 116 | + * 判断qq是否可用 | |
| 117 | + * | |
| 118 | + * @param context | |
| 119 | + * @return | |
| 120 | + */ | |
| 121 | + public static boolean isQQClientAvailable(Context context) { | |
| 122 | + final PackageManager packageManager = context.getPackageManager(); | |
| 123 | + List<PackageInfo> pinfo = packageManager.getInstalledPackages(0); | |
| 124 | + if (pinfo != null) { | |
| 125 | + for (int i = 0; i < pinfo.size(); i++) { | |
| 126 | + String pn = pinfo.get(i).packageName; | |
| 127 | + if (pn.equals("com.tencent.mobileqq")) { | |
| 128 | + return true; | |
| 129 | + } | |
| 130 | + } | |
| 131 | + } | |
| 132 | + return false; | |
| 133 | + } | |
| 134 | + | |
| 135 | + | |
| 136 | + //Scheme 检测QQ分享 | |
| 137 | + public static boolean checkQQ(Context context) { | |
| 138 | + if (context == null || context.getPackageManager() == null) return false; | |
| 139 | + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("mqqapi://share")); | |
| 140 | + return !context.getPackageManager().queryIntentActivities(intent, 0).isEmpty(); | |
| 141 | + } | |
| 142 | + | |
| 143 | + public static boolean checkWechat(Context context) { | |
| 144 | + if (context == null || context.getPackageManager() == null) return false; | |
| 145 | + if (Util.isWXAppInstalledAndSupported(context)) return true; | |
| 146 | + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("weixin://")); | |
| 147 | + return !context.getPackageManager().queryIntentActivities(intent, 0).isEmpty(); | |
| 148 | + } | |
| 149 | + | |
| 150 | + | |
| 151 | + /** | |
| 152 | + * 处理分享地址 | |
| 153 | + * | |
| 154 | + * @param shareInfoUrl | |
| 155 | + * @param mContext | |
| 156 | + */ | |
| 157 | + public static String processUrlData(String shareInfoUrl, Context mContext, boolean isToWjj) { | |
| 158 | + if (shareInfoUrl.contains("http://wjjh5.cnlive.com") || shareInfoUrl.contains("http://wjjh5test.cnlive.com")) { | |
| 159 | + Uri oldUri = Uri.parse(shareInfoUrl); | |
| 160 | + //判断分享地址中是否有参数,如果没有则先拼接问号 | |
| 161 | + if (oldUri.getQueryParameterNames().size() <= 0) { | |
| 162 | + if (!shareInfoUrl.contains("?")) | |
| 163 | + shareInfoUrl = shareInfoUrl.concat("?"); | |
| 164 | + } | |
| 165 | + if (!shareInfoUrl.contains("?sid=") && !shareInfoUrl.contains("&sid=")) { | |
| 166 | + StringBuilder pageUrl = new StringBuilder(shareInfoUrl); | |
| 167 | + pageUrl.append(oldUri.getQueryParameterNames().size() <= 0 ? "sid=" : "&sid=").append(UserService.getUid(mContext)); | |
| 168 | + shareInfoUrl = pageUrl.toString(); | |
| 169 | + } | |
| 170 | + | |
| 171 | + if (!shareInfoUrl.contains("?shareSid=") && !shareInfoUrl.contains("&shareSid=")) { | |
| 172 | + StringBuilder pageUrl = new StringBuilder(shareInfoUrl); | |
| 173 | + pageUrl.append("&shareSid=").append(UserService.getUid(mContext)); | |
| 174 | + shareInfoUrl = pageUrl.toString(); | |
| 175 | + } | |
| 176 | + if (!shareInfoUrl.contains("?isApp=") && !shareInfoUrl.contains("&isApp=")) { | |
| 177 | + StringBuilder pageUrl = new StringBuilder(shareInfoUrl); | |
| 178 | + pageUrl.append("&isApp=").append(isToWjj); | |
| 179 | + shareInfoUrl = pageUrl.toString(); | |
| 180 | + } | |
| 181 | + | |
| 182 | + | |
| 183 | + if (!shareInfoUrl.contains("?ver=") && !shareInfoUrl.contains("&ver=")) { | |
| 184 | + StringBuilder pageUrl = new StringBuilder(shareInfoUrl); | |
| 185 | + pageUrl.append("&ver=").append(AppConfig.getAppVersion()); | |
| 186 | + shareInfoUrl = pageUrl.toString(); | |
| 187 | + } | |
| 188 | + | |
| 189 | + if (!shareInfoUrl.contains("?plat=") && !shareInfoUrl.contains("&plat=")) { | |
| 190 | + StringBuilder pageUrl = new StringBuilder(shareInfoUrl); | |
| 191 | + pageUrl.append("&plat=").append("a"); | |
| 192 | + shareInfoUrl = pageUrl.toString(); | |
| 193 | + } | |
| 194 | + | |
| 195 | + if (!shareInfoUrl.contains("?wjjFrom=") && !shareInfoUrl.contains("&wjjFrom=")) { | |
| 196 | + StringBuilder pageUrl = new StringBuilder(shareInfoUrl); | |
| 197 | + pageUrl.append("&wjjFrom=").append(AppConfig.getAppChannel()); | |
| 198 | + shareInfoUrl = pageUrl.toString(); | |
| 199 | + } | |
| 200 | + if (!shareInfoUrl.contains("?appId=") && !shareInfoUrl.contains("&appId=")) { | |
| 201 | + StringBuilder pageUrl = new StringBuilder(shareInfoUrl); | |
| 202 | + pageUrl.append("&appId=").append(AppConfig.getAppId()); | |
| 203 | + shareInfoUrl = pageUrl.toString(); | |
| 204 | + } | |
| 205 | + Uri uri = Uri.parse(shareInfoUrl); | |
| 206 | + | |
| 207 | + String[] urls = shareInfoUrl.split("\\?"); | |
| 208 | + String url = urls[0]; | |
| 209 | + StringBuilder pageUrl = new StringBuilder(url); | |
| 210 | + pageUrl.append("?"); | |
| 211 | + for (String key : uri.getQueryParameterNames()) { | |
| 212 | + if ("sid".equals(key)) { | |
| 213 | + pageUrl.append(key).append("=").append(Uri.encode(TextUtils.isEmpty(UserService.getUid(mContext)) ? "" : UserService.getUid(mContext))).append("&"); | |
| 214 | + } else if ("ver".equals(key)) { | |
| 215 | + pageUrl.append(key).append("=").append(Uri.encode(TextUtils.isEmpty(AppConfig.getAppVersion()) ? "" : AppConfig.getAppVersion())).append("&"); | |
| 216 | + } else if ("plat".equals(key)) { | |
| 217 | + pageUrl.append(key).append("=").append(Uri.encode("a")).append("&"); | |
| 218 | + } else if ("shareSid".equals(key)) { | |
| 219 | + pageUrl.append(key).append("=").append(Uri.encode(TextUtils.isEmpty(UserService.getUid(mContext)) ? "" : UserService.getUid(mContext))).append("&"); | |
| 220 | + } else if ("isApp".equals(key)) { | |
| 221 | + pageUrl.append(key).append("=").append(isToWjj).append("&"); | |
| 222 | + } else if ("wjjFrom".equals(key)) { | |
| 223 | + pageUrl.append(key).append("=").append(Uri.encode(AppConfig.getAppChannel())).append("&"); | |
| 224 | + } else if ("appId".equals(key)) { | |
| 225 | + pageUrl.append(key).append("=").append(Uri.encode(AppConfig.getAppId())).append("&"); | |
| 226 | + } else { | |
| 227 | + String value = UriUtil.getQueryParameterWithDecode(uri.getEncodedQuery(), key); | |
| 228 | + pageUrl.append(key).append("=").append(Uri.encode(TextUtils.isEmpty(value) ? "" : value)).append("&"); | |
| 229 | + } | |
| 230 | + } | |
| 231 | + pageUrl = deleteCharOfEnd(pageUrl, "&", true); | |
| 232 | + shareInfoUrl = pageUrl.toString(); | |
| 233 | + | |
| 234 | + | |
| 235 | + } | |
| 236 | + return shareInfoUrl; | |
| 237 | + } | |
| 238 | + | |
| 239 | + public static StringBuilder deleteCharOfEnd(StringBuilder strBud, String item, boolean asLast) { | |
| 240 | + if (strBud == null) return null; | |
| 241 | + int index = asLast ? strBud.lastIndexOf(item) : strBud.indexOf(item); | |
| 242 | + if (index == strBud.length() - 1) strBud.deleteCharAt(index); | |
| 243 | + return strBud; | |
| 244 | + } | |
| 245 | + | |
| 246 | + public static String buildTransaction(final String type) { | |
| 247 | + return (type == null) ? String.valueOf(System.currentTimeMillis()) : type + System.currentTimeMillis(); | |
| 248 | + } | |
| 249 | + | |
| 250 | + public static boolean isNetUrl(String url) { | |
| 251 | + | |
| 252 | + if (TextUtils.isEmpty(url)) return false; | |
| 253 | + | |
| 254 | + if (url.startsWith("http://") || url.startsWith("https://") || url.startsWith("rtsp:") || url.startsWith("ftp:")) { | |
| 255 | + return true; | |
| 256 | + } else { | |
| 257 | + return false; | |
| 258 | + } | |
| 259 | +// String UrlEndAppendNextChars = "(http[s]{0,1}|ftp)://[a-zA-Z0-9\\.\\-]+\\.([a-zA-Z]{2,4})(:\\d+)?(/[a-zA-Z0-9\\.\\-~!@#$%^&*+?:;_/=<>]*)?"; | |
| 260 | +// | |
| 261 | +// // 邮箱验证规则 | |
| 262 | +// // 编译正则表达式 | |
| 263 | +// | |
| 264 | +// Pattern pattern = Pattern.compile(UrlEndAppendNextChars); | |
| 265 | +// // 忽略大小写的写法 | |
| 266 | +// // Pattern pat = Pattern.compile(regEx, Pattern.CASE_INSENSITIVE); | |
| 267 | +// Matcher matcher = pattern.matcher(url); | |
| 268 | +// // 字符串是否与正则表达式相匹配 | |
| 269 | +// boolean rs = matcher.matches(); | |
| 270 | +// return Patterns.WEB_URL.matcher(url).matches(); | |
| 271 | + } | |
| 272 | + | |
| 273 | + public static boolean isWeiboInstallAndInit(Context context) { | |
| 274 | + if (context == null || context.getPackageManager() == null) return false; | |
| 275 | + if (!WbSdk.isWbInstall(context)) return false; | |
| 276 | + if (!Util.initWeibo(context)) return false; | |
| 277 | + return true; | |
| 278 | + } | |
| 279 | + | |
| 280 | + public static boolean initWeibo(Context context) { | |
| 281 | + try { | |
| 282 | + AuthInfo info = new AuthInfo(context, "3884700821", | |
| 283 | + "http://wjjh5.cnlive.com/apkdownload.php", | |
| 284 | + "email,direct_messages_read,direct_messages_write," | |
| 285 | + + "friendships_groups_read,friendships_groups_write,statuses_to_me_read," | |
| 286 | + + "follow_app_official_microblog," + "invitation_write"); | |
| 287 | + WbSdk.install(context, info); | |
| 288 | + WbSdk.checkInit(); | |
| 289 | + return true; | |
| 290 | + } catch (Exception ignored) { | |
| 291 | + } | |
| 292 | + return false; | |
| 293 | + } | |
| 294 | + | |
| 295 | +} | ... | ... |
cloud/share/src/main/res/anim/share_activity_in.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<set xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | + android:duration="@android:integer/config_mediumAnimTime" | |
| 4 | + android:interpolator="@android:anim/decelerate_interpolator" | |
| 5 | + android:shareInterpolator="false"> | |
| 6 | + | |
| 7 | + <alpha | |
| 8 | + android:fromAlpha="0.0" | |
| 9 | + android:toAlpha="1.0"/> | |
| 10 | + | |
| 11 | + <translate | |
| 12 | + android:fromXDelta="0%" | |
| 13 | + android:fromYDelta="100%" | |
| 14 | + android:toXDelta="0%" | |
| 15 | + android:toYDelta="0%"/> | |
| 16 | +</set> | |
| 0 | 17 | \ No newline at end of file | ... | ... |
cloud/share/src/main/res/anim/share_activity_out.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<set xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | + android:duration="@android:integer/config_mediumAnimTime" | |
| 4 | + > | |
| 5 | + <translate | |
| 6 | + android:fromXDelta="0%" | |
| 7 | + android:fromYDelta="0%" | |
| 8 | + android:toXDelta="0%" | |
| 9 | + android:toYDelta="100%"/> | |
| 10 | +</set> | |
| 0 | 11 | \ No newline at end of file | ... | ... |
cloud/share/src/main/res/anim/share_slide_in_bottom.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<set xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | + android:duration="100" | |
| 4 | + android:interpolator="@android:anim/decelerate_interpolator" | |
| 5 | + android:shareInterpolator="false"> | |
| 6 | + | |
| 7 | + <alpha | |
| 8 | + android:fromAlpha="0.0" | |
| 9 | + android:toAlpha="1.0"/> | |
| 10 | + | |
| 11 | + <translate | |
| 12 | + android:fromXDelta="0%" | |
| 13 | + android:fromYDelta="100%" | |
| 14 | + android:toXDelta="0%" | |
| 15 | + android:toYDelta="0%"/> | |
| 16 | +</set> | |
| 0 | 17 | \ No newline at end of file | ... | ... |
cloud/share/src/main/res/anim/share_slide_out_bottom.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<set xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | + android:duration="100" | |
| 4 | + android:interpolator="@android:anim/decelerate_interpolator" | |
| 5 | + android:shareInterpolator="false"> | |
| 6 | + <alpha | |
| 7 | + android:fromAlpha="1.0" | |
| 8 | + android:toAlpha="0.5"/> | |
| 9 | + <translate | |
| 10 | + android:fromXDelta="0%" | |
| 11 | + android:fromYDelta="0%" | |
| 12 | + android:toXDelta="0%" | |
| 13 | + android:toYDelta="100%"/> | |
| 14 | +</set> | |
| 0 | 15 | \ No newline at end of file | ... | ... |
cloud/share/src/main/res/drawable-hdpi/browser.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable-hdpi/download_album.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable-hdpi/drd_quxiao.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable-hdpi/pengyouquan.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable-hdpi/qq.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable-hdpi/report_icon.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable-hdpi/shenghuoquan.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable-hdpi/ssdk_oks_ptr_ptr.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable-hdpi/wechat.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable-hdpi/weibo.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable-hdpi/wjjhaoyou.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable-xhdpi/browser.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable-xhdpi/download_album.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable-xhdpi/drd_pengyouquan.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable-xhdpi/drd_qq.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable-xhdpi/drd_quxiao.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable-xhdpi/drd_weixin.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable-xhdpi/pengyouquan.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable-xhdpi/qq.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable-xhdpi/report_icon.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable-xhdpi/share_logo_share_module.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable-xhdpi/shenghuoquan.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable-xhdpi/wechat.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable-xhdpi/weibo.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable-xhdpi/white.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable-xhdpi/wjjhaoyou.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable-xxhdpi/browser.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable-xxhdpi/download_album.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable-xxhdpi/pengyouquan.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable-xxhdpi/qq.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable-xxhdpi/report_icon.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable-xxhdpi/shenghuoquan.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable-xxhdpi/wechat.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable-xxhdpi/weibo.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable-xxhdpi/wjjhaoyou.webp
0 → 100644
No preview for this file type
cloud/share/src/main/res/drawable/ssdk_oks_classic_platform_cell_back.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<selector xmlns:android="http://schemas.android.com/apk/res/android" > | |
| 3 | + <item android:state_pressed="true" android:drawable="@drawable/ssdk_oks_classic_platfrom_cell_back_sel"/> | |
| 4 | + <item android:drawable="@drawable/ssdk_oks_classic_platfrom_cell_back_nor"/> | |
| 5 | +</selector> | ... | ... |
cloud/share/src/main/res/drawable/ssdk_oks_classic_progressbar.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<rotate xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | + android:fromDegrees="0" | |
| 4 | + android:pivotX="50%" | |
| 5 | + android:pivotY="50%" | |
| 6 | + android:toDegrees="360" > | |
| 7 | + <shape | |
| 8 | + android:innerRadiusRatio="3" | |
| 9 | + android:shape="ring" | |
| 10 | + android:thicknessRatio="8" | |
| 11 | + android:useLevel="false" > | |
| 12 | + <gradient | |
| 13 | + android:centerColor="#12ff0e" | |
| 14 | + android:centerX="0.50" | |
| 15 | + android:centerY="0.50" | |
| 16 | + android:endColor="#09bb07" | |
| 17 | + android:startColor="#ffffff" | |
| 18 | + android:type="sweep" | |
| 19 | + android:useLevel="false" /> | |
| 20 | + </shape> | |
| 21 | +</rotate> | ... | ... |
cloud/share/src/main/res/layout/activity_share_dialog.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | + | |
| 3 | +<RelativeLayout 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 | + | |
| 8 | +<LinearLayout | |
| 9 | + android:layout_alignParentBottom="true" | |
| 10 | + android:layout_width="match_parent" | |
| 11 | + android:layout_height="wrap_content" | |
| 12 | + android:background="@drawable/white" | |
| 13 | + android:orientation="vertical"> | |
| 14 | + | |
| 15 | + <LinearLayout | |
| 16 | + android:layout_width="wrap_content" | |
| 17 | + android:layout_height="wrap_content" | |
| 18 | + android:layout_marginLeft="16dp" | |
| 19 | + android:layout_marginTop="20dp"> | |
| 20 | + | |
| 21 | + <TextView | |
| 22 | + android:layout_width="wrap_content" | |
| 23 | + android:layout_height="wrap_content" | |
| 24 | + android:text="分享到其他 :" | |
| 25 | + android:textColor="#ff858585" | |
| 26 | + android:textSize="12sp" /> | |
| 27 | + | |
| 28 | + </LinearLayout> | |
| 29 | + | |
| 30 | + <androidx.recyclerview.widget.RecyclerView | |
| 31 | + android:id="@+id/share_rv" | |
| 32 | + android:layout_width="match_parent" | |
| 33 | + android:layout_height="wrap_content" /> | |
| 34 | + | |
| 35 | + <View | |
| 36 | + android:layout_width="match_parent" | |
| 37 | + android:layout_height="0.5dp" | |
| 38 | + android:background="#EAEAEA" /> | |
| 39 | + | |
| 40 | + | |
| 41 | + <androidx.recyclerview.widget.RecyclerView | |
| 42 | + android:id="@+id/share_other" | |
| 43 | + android:layout_width="match_parent" | |
| 44 | + android:layout_height="wrap_content" | |
| 45 | + android:visibility="gone" /> | |
| 46 | + <View | |
| 47 | + android:id="@+id/line" | |
| 48 | + android:visibility="gone" | |
| 49 | + android:layout_width="match_parent" | |
| 50 | + android:layout_height="0.5dp" | |
| 51 | + android:background="#EAEAEA" /> | |
| 52 | + <LinearLayout | |
| 53 | + android:id="@+id/ll_cancle" | |
| 54 | + android:layout_width="match_parent" | |
| 55 | + android:layout_height="wrap_content" | |
| 56 | + android:layout_gravity="center_horizontal" | |
| 57 | + android:gravity="center" | |
| 58 | + android:padding="16dp"> | |
| 59 | + | |
| 60 | + <TextView | |
| 61 | + android:layout_width="wrap_content" | |
| 62 | + android:layout_height="wrap_content" | |
| 63 | + android:text="取消" | |
| 64 | + android:textColor="#ff2c2c2d" | |
| 65 | + android:textSize="16sp" /> | |
| 66 | + | |
| 67 | + </LinearLayout> | |
| 68 | + | |
| 69 | + | |
| 70 | + <TextView | |
| 71 | + android:id="@+id/tv_cancle" | |
| 72 | + android:layout_width="match_parent" | |
| 73 | + android:layout_height="wrap_content" | |
| 74 | + android:layout_marginBottom="10dp" | |
| 75 | + android:layout_marginLeft="20dp" | |
| 76 | + android:layout_marginRight="20dp" | |
| 77 | + android:layout_marginTop="20dp" | |
| 78 | + android:background="@color/white" | |
| 79 | + android:gravity="center" | |
| 80 | + android:padding="10dp" | |
| 81 | + android:text="取消" | |
| 82 | + android:textColor="#333" | |
| 83 | + android:textSize="15sp" | |
| 84 | + android:visibility="gone" /> | |
| 85 | + | |
| 86 | +</LinearLayout> | |
| 87 | + | |
| 88 | + | |
| 89 | +</RelativeLayout> | |
| 0 | 90 | \ No newline at end of file | ... | ... |
cloud/share/src/main/res/layout/activity_share_img.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | + android:layout_width="match_parent" | |
| 4 | + android:layout_height="match_parent" | |
| 5 | + android:background="@color/transparent" | |
| 6 | + android:id="@+id/ry_share"> | |
| 7 | + | |
| 8 | + <LinearLayout | |
| 9 | + android:id="@+id/ly_share" | |
| 10 | + android:layout_width="match_parent" | |
| 11 | + android:layout_height="wrap_content" | |
| 12 | + android:layout_alignParentBottom="true" | |
| 13 | + android:background="@drawable/white" | |
| 14 | + android:clickable="false" | |
| 15 | + android:orientation="vertical"> | |
| 16 | + | |
| 17 | + <androidx.recyclerview.widget.RecyclerView | |
| 18 | + android:id="@+id/share_img_rv" | |
| 19 | + android:layout_width="match_parent" | |
| 20 | + android:layout_height="wrap_content" /> | |
| 21 | + | |
| 22 | + <View | |
| 23 | + android:layout_width="match_parent" | |
| 24 | + android:layout_height="0.5dp" | |
| 25 | + android:background="#EAEAEA" /> | |
| 26 | + | |
| 27 | + <LinearLayout | |
| 28 | + android:id="@+id/ll_img_cancle" | |
| 29 | + android:layout_width="match_parent" | |
| 30 | + android:layout_height="wrap_content" | |
| 31 | + android:layout_gravity="center_horizontal" | |
| 32 | + android:gravity="center" | |
| 33 | + android:padding="16dp"> | |
| 34 | + | |
| 35 | + <TextView | |
| 36 | + android:layout_width="wrap_content" | |
| 37 | + android:layout_height="wrap_content" | |
| 38 | + android:text="取消" | |
| 39 | + android:textColor="#ff2c2c2d" | |
| 40 | + android:textSize="16sp" /> | |
| 41 | + | |
| 42 | + </LinearLayout> | |
| 43 | + | |
| 44 | + </LinearLayout> | |
| 45 | + | |
| 46 | +</RelativeLayout> | |
| 0 | 47 | \ No newline at end of file | ... | ... |
cloud/share/src/main/res/layout/layout_full_video_share.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<layout xmlns:android="http://schemas.android.com/apk/res/android"> | |
| 3 | + | |
| 4 | + <data> | |
| 5 | + | |
| 6 | + <variable | |
| 7 | + name="paddingRight" | |
| 8 | + type="int" /> | |
| 9 | + | |
| 10 | + </data> | |
| 11 | + | |
| 12 | + <RelativeLayout | |
| 13 | + android:layout_width="match_parent" | |
| 14 | + android:layout_height="match_parent"> | |
| 15 | + | |
| 16 | + <View | |
| 17 | + android:id="@+id/shareOutClickView" | |
| 18 | + android:layout_width="match_parent" | |
| 19 | + android:layout_height="match_parent" | |
| 20 | + android:layout_toLeftOf="@+id/shareRightLayout" /> | |
| 21 | + | |
| 22 | + <RelativeLayout | |
| 23 | + android:id="@+id/shareRightLayout" | |
| 24 | + android:layout_width="wrap_content" | |
| 25 | + android:layout_height="match_parent" | |
| 26 | + android:layout_alignParentRight="true" | |
| 27 | + android:background="@color/share_bg" | |
| 28 | + android:paddingRight="@{paddingRight}"> | |
| 29 | + | |
| 30 | + <TextView | |
| 31 | + android:id="@+id/shareTitle" | |
| 32 | + android:layout_width="wrap_content" | |
| 33 | + android:layout_height="wrap_content" | |
| 34 | + android:layout_marginLeft="20dp" | |
| 35 | + android:layout_marginTop="28dp" | |
| 36 | + android:text="分享视频" | |
| 37 | + android:textColor="#ffffff" | |
| 38 | + android:textSize="18sp" /> | |
| 39 | + | |
| 40 | + <androidx.recyclerview.widget.RecyclerView | |
| 41 | + android:id="@+id/shareRecyclerView" | |
| 42 | + android:layout_width="wrap_content" | |
| 43 | + android:layout_height="match_parent" | |
| 44 | + android:layout_below="@+id/shareTitle" | |
| 45 | + android:layout_marginTop="50dp" /> | |
| 46 | + | |
| 47 | + </RelativeLayout> | |
| 48 | + | |
| 49 | + </RelativeLayout> | |
| 50 | +</layout> | |
| 51 | + | ... | ... |
cloud/share/src/main/res/layout/layout_share_dialog.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | + xmlns:zhy="http://schemas.android.com/apk/res-auto" | |
| 4 | + android:layout_width="match_parent" | |
| 5 | + android:layout_height="match_parent" | |
| 6 | + android:background="@drawable/white" | |
| 7 | + android:orientation="vertical"> | |
| 8 | + | |
| 9 | + <LinearLayout | |
| 10 | + android:layout_width="wrap_content" | |
| 11 | + android:layout_height="wrap_content" | |
| 12 | + android:layout_marginLeft="16dp" | |
| 13 | + android:layout_marginTop="20dp"> | |
| 14 | + | |
| 15 | + <TextView | |
| 16 | + android:layout_width="wrap_content" | |
| 17 | + android:layout_height="wrap_content" | |
| 18 | + android:text="分享到其他 :" | |
| 19 | + android:textColor="#ff858585" | |
| 20 | + android:textSize="12sp" /> | |
| 21 | + | |
| 22 | + </LinearLayout> | |
| 23 | + | |
| 24 | + <androidx.recyclerview.widget.RecyclerView | |
| 25 | + android:id="@+id/share_rv" | |
| 26 | + android:layout_width="match_parent" | |
| 27 | + android:layout_height="wrap_content" /> | |
| 28 | + | |
| 29 | + <View | |
| 30 | + android:layout_width="match_parent" | |
| 31 | + android:layout_height="0.5dp" | |
| 32 | + android:background="#EAEAEA" /> | |
| 33 | + | |
| 34 | + <androidx.recyclerview.widget.RecyclerView | |
| 35 | + android:id="@+id/share_other" | |
| 36 | + android:layout_width="match_parent" | |
| 37 | + android:layout_height="wrap_content" | |
| 38 | + android:visibility="gone" /> | |
| 39 | + | |
| 40 | + <View | |
| 41 | + android:id="@+id/line" | |
| 42 | + android:layout_width="match_parent" | |
| 43 | + android:layout_height="0.5dp" | |
| 44 | + android:background="#EAEAEA" | |
| 45 | + android:visibility="gone" /> | |
| 46 | + | |
| 47 | + <LinearLayout | |
| 48 | + android:id="@+id/ll_cancle" | |
| 49 | + android:layout_width="match_parent" | |
| 50 | + android:layout_height="wrap_content" | |
| 51 | + android:layout_gravity="center_horizontal" | |
| 52 | + android:gravity="center" | |
| 53 | + android:padding="16dp"> | |
| 54 | + | |
| 55 | + <TextView | |
| 56 | + android:layout_width="wrap_content" | |
| 57 | + android:layout_height="wrap_content" | |
| 58 | + android:text="取消" | |
| 59 | + android:textColor="#ff2c2c2d" | |
| 60 | + android:textSize="16sp" /> | |
| 61 | + | |
| 62 | + </LinearLayout> | |
| 63 | + | |
| 64 | +</LinearLayout> | |
| 0 | 65 | \ No newline at end of file | ... | ... |
cloud/share/src/main/res/layout/list_item_full_video_share.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | + | |
| 3 | +<layout xmlns:android="http://schemas.android.com/apk/res/android"> | |
| 4 | + | |
| 5 | + <data> | |
| 6 | + | |
| 7 | + <import type="com.cnlive.share.data.FullVideoShareItemData" /> | |
| 8 | + | |
| 9 | + <import type="com.cnlive.share.adapter.DataBindingAdapter.OnAdapterViewClickListener" /> | |
| 10 | + | |
| 11 | + <variable | |
| 12 | + name="data" | |
| 13 | + type="FullVideoShareItemData" /> | |
| 14 | + | |
| 15 | + <variable | |
| 16 | + name="viewClickListener" | |
| 17 | + type="OnAdapterViewClickListener<FullVideoShareItemData>" /> | |
| 18 | + </data> | |
| 19 | + | |
| 20 | + <LinearLayout xmlns:bind="http://schemas.android.com/tools" | |
| 21 | + android:layout_width="wrap_content" | |
| 22 | + android:layout_height="wrap_content" | |
| 23 | + android:gravity="center" | |
| 24 | + android:onClick="@{(view)->viewClickListener.onViewClick(view,data)}" | |
| 25 | + android:orientation="vertical"> | |
| 26 | + | |
| 27 | + <ImageView | |
| 28 | + android:id="@+id/icon" | |
| 29 | + android:layout_width="41dp" | |
| 30 | + android:layout_height="41dp" | |
| 31 | + android:layout_marginLeft="20dp" | |
| 32 | + android:layout_marginRight="20dp" | |
| 33 | + bind:imageSYS="@{data.iconId}" /> | |
| 34 | + | |
| 35 | + <TextView | |
| 36 | + android:id="@+id/title" | |
| 37 | + android:layout_width="wrap_content" | |
| 38 | + android:layout_height="wrap_content" | |
| 39 | + android:layout_below="@+id/icon" | |
| 40 | + android:layout_marginTop="10dp" | |
| 41 | + android:textSize="11sp" | |
| 42 | + android:textColor="#ffffff" | |
| 43 | + android:layout_marginBottom="30dp" | |
| 44 | + android:text="@{data.title}" /> | |
| 45 | + | |
| 46 | + </LinearLayout> | |
| 47 | +</layout> | ... | ... |
cloud/share/src/main/res/layout/share_dialog_item.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | + android:layout_width="90dp" | |
| 4 | + android:layout_height="wrap_content" | |
| 5 | + android:gravity="center" | |
| 6 | + android:orientation="vertical" | |
| 7 | + android:paddingTop="10dp" | |
| 8 | + android:paddingBottom="10dp"> | |
| 9 | + | |
| 10 | + <ImageView | |
| 11 | + android:id="@+id/icon" | |
| 12 | + android:layout_width="50dp" | |
| 13 | + android:layout_height="50dp" /> | |
| 14 | + | |
| 15 | + <TextView | |
| 16 | + android:id="@+id/name" | |
| 17 | + android:layout_width="wrap_content" | |
| 18 | + android:layout_height="wrap_content" | |
| 19 | + android:layout_gravity="center_horizontal" | |
| 20 | + android:layout_marginLeft="5dp" | |
| 21 | + android:layout_marginTop="10.5dp" | |
| 22 | + android:layout_marginRight="5dp" | |
| 23 | + android:gravity="center" | |
| 24 | + android:maxLines="2" | |
| 25 | + android:textColor="#ff2c2c2d" | |
| 26 | + android:textSize="12sp" /> | |
| 27 | + | |
| 28 | +</LinearLayout> | |
| 0 | 29 | \ No newline at end of file | ... | ... |
cloud/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 | 299 | \ No newline at end of file | ... | ... |
cloud/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> | ... | ... |
cloud/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 | 166 | \ No newline at end of file | ... | ... |
cloud/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 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + <color name="color_watching_info_top_bg">#aa66bdc9</color> | |
| 11 | + | |
| 12 | + <color name="black">#000000</color> | |
| 13 | + | |
| 14 | + <color name="share_bg">#b2000000</color> | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | +</resources> | ... | ... |
cloud/share/src/main/res/values/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>阿尔巴尼亚,355,110,27601|27602|27603|27604</item> | |
| 5 | + <item>阿尔及利亚,213,52,60303|60302|60301</item> | |
| 6 | + <item>阿富汗,93,46,41220|41230|41240|41250|41201</item> | |
| 7 | + <item>阿根廷,54,27,722070|72207|72236|722020|72201|72234|72202|722320|722310|722010|722340|722330|722341</item> | |
| 8 | + <item>阿拉伯联合酋长国,971,184,42402|42403</item> | |
| 9 | + <item>阿鲁巴岛,297,102,36301|36302</item> | |
| 10 | + <item>阿曼,968,182,42202|42203</item> | |
| 11 | + <item>阿塞拜疆,994,193,40002|40001|40004</item> | |
| 12 | + <item>埃及,20,5,60203|60202|60201</item> | |
| 13 | + <item>埃塞俄比亚,251,84,63601</item> | |
| 14 | + <item>爱尔兰,353,108,27201|27213|27202|27211|27205|27203|27209</item> | |
| 15 | + <item>爱沙尼亚,372,117,24803|24802|24801</item> | |
| 16 | + <item>安道尔,376,121,21303</item> | |
| 17 | + <item>安哥拉,244,79,63102|63104</item> | |
| 18 | + <item>安圭拉岛,1264,199,365840</item> | |
| 19 | + <item>安提瓜和巴布达,1268,200,338050|344030|344920</item> | |
| 20 | + <item>奥地利,43,16,23207|23209|23210|23211|23201|23212|23202|23214|23203|23204|23215|23205|23206</item> | |
| 21 | + <item>澳大利亚,61,33,50507|50506|50519|50590|50572|50571|50530|50501|50512|50511|50503|50502|505060|50538|50516|505061|50526</item> | |
| 22 | + <item>澳门,853,169,45501|45500|45503|45502|45505|45504</item> | |
| 23 | + </string-array> | |
| 24 | + | |
| 25 | + <string-array name="smssdk_country_group_b"> | |
| 26 | + <item>巴巴多斯,1246,198,342600</item> | |
| 27 | + <item>巴布亚新几内亚,675,155,53701|53702|53703</item> | |
| 28 | + <item>巴哈马群岛,1242,197,364390|36439</item> | |
| 29 | + <item>巴基斯坦,92,45,</item> | |
| 30 | + <item>巴拉圭,595,148,74404|74403|74402|74401</item> | |
| 31 | + <item>巴勒斯坦领土,970,183,42506-PS|42505-PS</item> | |
| 32 | + <item>巴林,973,186,42604|42605|42601|42602</item> | |
| 33 | + <item>巴拿马,507,140,71404|71402|71403|71401</item> | |
| 34 | + <item>巴西,55,28,72416|72405|72439|72406|72403|72415|72437|72404|72434|72423|72402|72432|72410|72433|72400|72411|72430|72431|72407</item> | |
| 35 | + <item>白俄罗斯,375,120,25704|25701|25702</item> | |
| 36 | + <item>百慕大群岛,1441,204,350000</item> | |
| 37 | + <item>保加利亚,359,114,28401|28405|28403</item> | |
| 38 | + <item>贝宁,229,64,61605|61601|61602|61603|61604</item> | |
| 39 | + <item>比利时,32,9,20610|20620|20640|20606|20605|20601</item> | |
| 40 | + <item>冰岛,354,109,27409|27411|27404|27401|27402|27407</item> | |
| 41 | + <item>波多黎各,1787,212,310970</item> | |
| 42 | + <item>波兰,48,22,26016|26038|26004|26018|26017|26006|26009|26019|26008|26010|26032|26001|26034|26012|26011|26003|26036|26014|26002|26013|26035</item> | |
| 43 | + <item>波利尼西亚(法属),689,165,54720</item> | |
| 44 | + <item>波斯尼亚和黑塞哥维那,387,129,21890|21805|21803</item> | |
| 45 | + <item>玻利维亚,591,144,73603|73602|73601</item> | |
| 46 | + <item>伯利兹,501,134,70267</item> | |
| 47 | + <item>博茨瓦纳,267,99,65202|65201|65204</item> | |
| 48 | + <item>不丹,975,188,40211|40277</item> | |
| 49 | + <item>布基纳法索,226,61,61301|61302|61303</item> | |
| 50 | + <item>布隆迪,257,90,64201|64203|64202|64207|64282</item> | |
| 51 | + </string-array> | |
| 52 | + | |
| 53 | + <string-array name="smssdk_country_group_c"> | |
| 54 | + <item>朝鲜,850,167,46703</item> | |
| 55 | + <item>赤道几内亚,240,75,62701|62703</item> | |
| 56 | + </string-array> | |
| 57 | + | |
| 58 | + <string-array name="smssdk_country_group_d"> | |
| 59 | + <item>丹麦,45,19,23801|23812|23802|23813|23803|23806|23828|23807|23808|23830|23820|23810|23866|23877</item> | |
| 60 | + <item>德国,49,23,26203|26202|26205|26216|26204|26207|26217|26206|26209|26208|26243|26276|26220|26242|26212|26201|26211|26277</item> | |
| 61 | + <item>东帝汶,670,153,51401|51402</item> | |
| 62 | + <item>多哥,228,63,61501|61503</item> | |
| 63 | + <item>多米尼加共和国,1809,213,37001|37002|37003|37004</item> | |
| 64 | + <item>多米尼克,1767,210,366110</item> | |
| 65 | + </string-array> | |
| 66 | + | |
| 67 | + <string-array name="smssdk_country_group_e"> | |
| 68 | + <item>俄罗斯,7,3,25020|25099|25035|25002|25012|25001|25003|25039|25005|25007</item> | |
| 69 | + <item>厄瓜多尔,593,146,74002|74001|74000</item> | |
| 70 | + </string-array> | |
| 71 | + | |
| 72 | + <string-array name="smssdk_country_group_f"> | |
| 73 | + <item>法国,33,10,20816|20804|20826|20815|20825|20813|20802|20823|20801|20811|20822|20888|20810|20821|20831|20820|20809|20808|20817</item> | |
| 74 | + <item>法罗群岛,298,103,28801|28802|28803</item> | |
| 75 | + <item>菲律宾,63,35,51518|51502|51501|51503|51505</item> | |
| 76 | + <item>斐济,679,159,54202|54201</item> | |
| 77 | + <item>芬兰,358,113,24409|24432|24410|24421|24412|24411|24414|24403|24413|24405|24426|24404|24491</item> | |
| 78 | + <item>佛得角,238,73,62501|62502</item> | |
| 79 | + </string-array> | |
| 80 | + | |
| 81 | + <string-array name="smssdk_country_group_g"> | |
| 82 | + <item>冈比亚,220,55,60702|60701|60704|60703</item> | |
| 83 | + <item>刚果共和国,242,77,62907|62910|62901</item> | |
| 84 | + <item>刚果民主共和国,243,78,63086|63001|63089|63002|63005</item> | |
| 85 | + <item>哥伦比亚,57,30,732130|732020|732154|732111|732123|732101</item> | |
| 86 | + <item>哥斯达黎加,506,139,71204|71203|71201</item> | |
| 87 | + <item>格林纳达,1473,205,352110</item> | |
| 88 | + <item>格陵兰岛,299,104,29001</item> | |
| 89 | + <item>格鲁吉亚,995,194,28202|28201|28204|28205</item> | |
| 90 | + <item>古巴,53,26,36801</item> | |
| 91 | + <item>瓜德罗普岛,590,143,34008|34003|34002|34001|34020</item> | |
| 92 | + <item>关岛,1671,208,310400|310140|310470|310110</item> | |
| 93 | + <item>圭亚那,592,145,73802|73801</item> | |
| 94 | + <item>圭亚那(法属),594,147,74201|74220</item> | |
| 95 | + </string-array> | |
| 96 | + | |
| 97 | + <string-array name="smssdk_country_group_h"> | |
| 98 | + <item>哈萨克斯坦,7,4,40102|40101|40177|40108|40107</item> | |
| 99 | + <item>海地,509,142,37201|37202</item> | |
| 100 | + <item>韩国,82,40,45006|45005|45008|45002|45004</item> | |
| 101 | + <item>荷兰,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> | |
| 102 | + <item>荷属安的列斯群岛,599,152,36269|36202|36201|36251|36294|36282|36281</item> | |
| 103 | + <item>黑山共和国,382,126,29703|29702|29701</item> | |
| 104 | + <item>洪都拉斯,504,137,70830|70840|70802|70801</item> | |
| 105 | + </string-array> | |
| 106 | + | |
| 107 | + <string-array name="smssdk_country_group_i"> | |
| 108 | + | |
| 109 | + </string-array> | |
| 110 | + | |
| 111 | + <string-array name="smssdk_country_group_j"> | |
| 112 | + <item>基里巴斯,686,163,54509</item> | |
| 113 | + <item>吉布提,253,86,63801</item> | |
| 114 | + <item>吉尔吉斯斯坦,996,195,43705|43701</item> | |
| 115 | + <item>几内亚,224,59,61105|61104|61103|61102|61101</item> | |
| 116 | + <item>几内亚比绍,245,80,63202|63203</item> | |
| 117 | + <item>加拿大,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> | |
| 118 | + <item>加纳,233,68,62001|62002|62003|62004|62006|62007</item> | |
| 119 | + <item>加蓬,241,76,62804|62801|62802|62803</item> | |
| 120 | + <item>柬埔寨,855,170,45602|45601|45608|45618|45609|45604|45603|45606|45605|23455-KH</item> | |
| 121 | + <item>捷克共和国,420,131,23001|23002|23003|23004|23005|23008</item> | |
| 122 | + <item>津巴布韦,263,95,64801|64803|64804</item> | |
| 123 | + </string-array> | |
| 124 | + | |
| 125 | + <string-array name="smssdk_country_group_k"> | |
| 126 | + <item>喀麦隆,237,72,62401|62402|62404</item> | |
| 127 | + <item>卡塔尔,974,187,42701|42702</item> | |
| 128 | + <item>开曼群岛,1345,203,346140</item> | |
| 129 | + <item>科摩罗,269,101,65401</item> | |
| 130 | + <item>科特迪瓦,225,60,61205|61204|61203|61202</item> | |
| 131 | + <item>科威特,965,179,41904|41903|41902</item> | |
| 132 | + <item>克罗地亚,385,127,21902|21901|21912|21910</item> | |
| 133 | + <item>肯尼亚,254,87,63905|63907|63903|63902</item> | |
| 134 | + <item>库克群岛,682,161,54801</item> | |
| 135 | + </string-array> | |
| 136 | + | |
| 137 | + <string-array name="smssdk_country_group_l"> | |
| 138 | + <item>拉脱维亚,371,116,24703|24706|24705|24708|24707|24709|24702|24701</item> | |
| 139 | + <item>莱索托,266,98,65101|65102</item> | |
| 140 | + <item>老挝,856,171,45701|45708|45703|45702</item> | |
| 141 | + <item>黎巴嫩,961,175,41503|41501</item> | |
| 142 | + <item>立陶宛,370,115,24601|24603|24602</item> | |
| 143 | + <item>利比里亚,231,66,61804|61807|61801|61802</item> | |
| 144 | + <item>利比亚,218,54,60603|60601|60600</item> | |
| 145 | + <item>列支敦士登,423,133,29501|29577|29505|29502</item> | |
| 146 | + <item>法属留尼汪岛,262,94,64710|64702</item> | |
| 147 | + <item>卢森堡,352,107,27099|27077|27001</item> | |
| 148 | + <item>卢旺达,250,83,63510|63512|63513|63514</item> | |
| 149 | + <item>罗马尼亚,40,14,22603|22604|22605|22610|22601</item> | |
| 150 | + </string-array> | |
| 151 | + | |
| 152 | + <string-array name="smssdk_country_group_m"> | |
| 153 | + <item>马达加斯加,261,93,64601|64602|64604</item> | |
| 154 | + <item>马尔代夫,960,174,47201|47202</item> | |
| 155 | + <item>马耳他,356,111,27821|27877|27801</item> | |
| 156 | + <item>马拉维,265,97,65010|65001</item> | |
| 157 | + <item>马来西亚,60,32,50220|50211|50213|502150|50212|502151|502152|50217|50216|50219|50218</item> | |
| 158 | + <item>马里,223,58,61002|61001</item> | |
| 159 | + <item>马其顿,389,130,29402|29401|29403</item> | |
| 160 | + <item>马提尼克,596,149,34003|34002|34001|34020</item> | |
| 161 | + <item>毛里求斯,230,65,61710|61701|61702</item> | |
| 162 | + <item>毛里塔尼亚,222,57,60910|60902</item> | |
| 163 | + <item>美国,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> | |
| 164 | + <item>蒙古,976,189,42898|42888|42899|42801</item> | |
| 165 | + <item>蒙特塞拉特岛,1664,207,354860</item> | |
| 166 | + <item>孟加拉国,880,172,47007|47005|47006|47003|47004|47001|47002</item> | |
| 167 | + <item>秘鲁,51,24,71610|71606|71617|71607|71615</item> | |
| 168 | + <item>密克罗尼西亚,691,166,55001</item> | |
| 169 | + <item>缅甸,95,48,41401|41406|41405</item> | |
| 170 | + <item>摩尔多瓦,373,118,25903|25902|25904|25901</item> | |
| 171 | + <item>摩洛哥,212,51,60405|60402|60401|60400</item> | |
| 172 | + <item>摩纳哥,377,122,21201</item> | |
| 173 | + <item>莫桑比克,258,91,64301|64304|64303</item> | |
| 174 | + <item>墨西哥,52,25,33402|33403|33401|33450|33406|334090|33404|33405</item> | |
| 175 | + </string-array> | |
| 176 | + | |
| 177 | + <string-array name="smssdk_country_group_n"> | |
| 178 | + <item>纳米比亚,264,96,64902|64901|64903</item> | |
| 179 | + <item>南非,27,6,65510|65512|65501|65502|65507|65519</item> | |
| 180 | + <item>南苏丹,211,50,65995</item> | |
| 181 | + <item>尼泊尔,977,190,42901|42902</item> | |
| 182 | + <item>尼加拉瓜,505,138,71021|71030</item> | |
| 183 | + <item>尼日尔,227,62,61401|61402|61403|61404</item> | |
| 184 | + <item>尼日利亚,234,69,62150|62140|62130|62120|62125|23455-NG|62160</item> | |
| 185 | + <item>挪威,47,21,24208|24209|24220|24221|24222|24201|24223|24202|24224|24204|24205|24206</item> | |
| 186 | + </string-array> | |
| 187 | + | |
| 188 | + <string-array name="smssdk_country_group_o"> | |
| 189 | + | |
| 190 | + </string-array> | |
| 191 | + | |
| 192 | + <string-array name="smssdk_country_group_p"> | |
| 193 | + <item>帕劳,680,160,55201|55280</item> | |
| 194 | + <item>葡萄牙,351,106,26804|26806|26801|26803</item> | |
| 195 | + </string-array> | |
| 196 | + | |
| 197 | + <string-array name="smssdk_country_group_q"> | |
| 198 | + </string-array> | |
| 199 | + | |
| 200 | + <string-array name="smssdk_country_group_r"> | |
| 201 | + <item>日本,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> | |
| 202 | + <item>瑞典,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> | |
| 203 | + <item>瑞士,41,15,22812|22801|22802|22803|22805|22809|22851|22853|22854</item> | |
| 204 | + </string-array> | |
| 205 | + | |
| 206 | + <string-array name="smssdk_country_group_s"> | |
| 207 | + <item>萨尔瓦多,503,136,70602|70601|70604|70603|70605</item> | |
| 208 | + <item>萨摩亚,685,162,54900</item> | |
| 209 | + <item>塞尔维亚,381,125,29341|22001|22003|22005</item> | |
| 210 | + <item>塞拉利昂,232,67,61902|61903|61904|61905|61906|61909|61901</item> | |
| 211 | + <item>塞内加尔,221,56,60801|60803|60802</item> | |
| 212 | + <item>塞浦路斯,357,112,28022|28001|28020|28010</item> | |
| 213 | + <item>塞舌尔,248,81,63310|63301|63302</item> | |
| 214 | + <item>沙特阿拉伯,966,180,42003|42004|42001|42006</item> | |
| 215 | + <item>圣多美和普林西比,239,74,62601</item> | |
| 216 | + <item>圣基茨和尼维斯,1869,215,356110|356070</item> | |
| 217 | + <item>圣卢西亚,1758,209,358110</item> | |
| 218 | + <item>圣马力诺,378,123,29201</item> | |
| 219 | + <item>圣皮埃尔和密克隆岛,508,141,30801</item> | |
| 220 | + <item>圣文森特和格林纳丁斯,1784,211,360110</item> | |
| 221 | + <item>斯里兰卡,94,47,41301|41305|41302|41308</item> | |
| 222 | + <item>斯洛伐克,421,132,23199|23101|23102|23106</item> | |
| 223 | + <item>斯洛文尼亚,386,128,29364|29341|29340|29370</item> | |
| 224 | + <item>斯威士兰,268,100,65310|65301</item> | |
| 225 | + <item>苏丹,249,82,63401|63402|63407</item> | |
| 226 | + <item>苏里南,597,150,74604|74603|74602</item> | |
| 227 | + <item>所罗门群岛,677,157,54010</item> | |
| 228 | + <item>索马里,252,85,63782|63760|63730|63701|63725|63704</item> | |
| 229 | + </string-array> | |
| 230 | + | |
| 231 | + <string-array name="smssdk_country_group_t"> | |
| 232 | + <item>塔吉克斯坦,992,191,43605|43601|43602|43603|43604</item> | |
| 233 | + <item>台湾,886,173,46602|46668|46603|46688|46699|46601|46689|46656|46697|46610|46609|46606|46607|46605|46693|46692</item> | |
| 234 | + <item>泰国,66,38,52000|52099|52020|52003|52004|52015|52001|52023|52002|52018|52005</item> | |
| 235 | + <item>坦桑尼亚,255,88,64011|64003|64002|64005|64004|64007|64006|64009|64008</item> | |
| 236 | + <item>汤加,676,156,53901</item> | |
| 237 | + <item>特克斯和凯科斯群岛,1649,206,376352|376350</item> | |
| 238 | + <item>特立尼达,多巴哥,1868,214,374130|37412</item> | |
| 239 | + <item>突尼斯,216,53,60503|60502|60501</item> | |
| 240 | + <item>土耳其,90,43,28602|28603|28601|28604</item> | |
| 241 | + <item>土库曼斯坦,993,192,43801|43802</item> | |
| 242 | + </string-array> | |
| 243 | + | |
| 244 | + <string-array name="smssdk_country_group_u"> | |
| 245 | + | |
| 246 | + </string-array> | |
| 247 | + | |
| 248 | + <string-array name="smssdk_country_group_v"> | |
| 249 | + | |
| 250 | + </string-array> | |
| 251 | + | |
| 252 | + <string-array name="smssdk_country_group_w"> | |
| 253 | + <item>瓦努阿图,678,158,54101|54105</item> | |
| 254 | + <item>危地马拉,502,135,70402|70401|70403</item> | |
| 255 | + <item>维尔京群岛(美属),1284,201,311470</item> | |
| 256 | + <item>维尔京群岛(英属),1340,202,348570|348170</item> | |
| 257 | + <item>委内瑞拉,58,31,73406|73404|73401</item> | |
| 258 | + <item>文莱,673,154,52811|52802</item> | |
| 259 | + <item>乌干达,256,89,64111|64133|64166|64122|64110|64101|64114</item> | |
| 260 | + <item>乌克兰,380,124,25507|25506|25521|25501|25503|25502|25505|25504</item> | |
| 261 | + <item>乌拉圭,598,151,74803|74802|74801|74800|74810|74807</item> | |
| 262 | + <item>乌兹别克斯坦,998,196,43401|43402|43407|43403|43404|43405|43406</item> | |
| 263 | + </string-array> | |
| 264 | + | |
| 265 | + <string-array name="smssdk_country_group_x"> | |
| 266 | + <item>西班牙,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> | |
| 267 | + <item>希腊,30,7,20203|20202|20201|20210|20209|20207|20205</item> | |
| 268 | + <item>香港,852,168,45413|45412|45401|45404|45403|45414|45400|45411|45409|45406|45405|45416|45408|45419|45429|45407</item> | |
| 269 | + <item>新加坡,65,37,52502|52503|52512|52501|52505</item> | |
| 270 | + <item>新喀里多尼亚,687,164,54601</item> | |
| 271 | + <item>新西兰,64,36,53001|53004|53005|53024|53002|53006</item> | |
| 272 | + <item>匈牙利,36,12,21630|21670|21601</item> | |
| 273 | + <item>叙利亚,963,177,41701|41702</item> | |
| 274 | + </string-array> | |
| 275 | + | |
| 276 | + <string-array name="smssdk_country_group_y"> | |
| 277 | + <item>牙买加,1876,216,338180|338020|338110</item> | |
| 278 | + <item>亚美尼亚,374,119,28301|28310|28305|28304</item> | |
| 279 | + <item>也门,967,181,42101|42102|42103</item> | |
| 280 | + <item>伊拉克,964,178,41805|41840|41820|41830|41845</item> | |
| 281 | + <item>伊朗,98,49,43235|43214|43220|43200|43211|43219</item> | |
| 282 | + <item>以色列,972,185,42577|42516|42505|42506|42507|RESTRICTED-IL|42519|42508|42501|42512|42523|42502|42503|42514|42515</item> | |
| 283 | + <item>意大利,39,13,22206|22207|22208|22210|22243|22288|22244|22299|22233|22201|22235|22204|22248|22205|22230</item> | |
| 284 | + <item>印度,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> | |
| 285 | + <item>印度尼西亚,62,34,51010|51021|51089|51001|51011|51027|51007|51028|51009|51008</item> | |
| 286 | + <item>英国,44,17,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> | |
| 287 | + <item>约旦,962,176,41601|41677|41603</item> | |
| 288 | + <item>越南,84,41,45204|45205|45202|45201|45207</item> | |
| 289 | + </string-array> | |
| 290 | + | |
| 291 | + <string-array name="smssdk_country_group_z"> | |
| 292 | + <item>赞比亚,260,92,64502|64501|64503</item> | |
| 293 | + <item>泽西,44,18,</item> | |
| 294 | + <item>乍得,235,70,62201|62203</item> | |
| 295 | + <item>直布罗陀,350,105,26606|26609|26601</item> | |
| 296 | + <item>智利,56,29,73008|73006|73004|73002|73013|73003|73014|73011|73012|73001</item> | |
| 297 | + <item>中非共和国,236,71,62301|62302|62303|62304</item> | |
| 298 | + <item>中国,86,42,46006|46007|46005|46002|46003|46000|46001</item> | |
| 299 | + </string-array> | |
| 300 | +</resources> | |
| 0 | 301 | \ No newline at end of file | ... | ... |
cloud/share/src/main/res/values/ssdk_instapaper_strings.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | + | |
| 3 | +<resources> | |
| 4 | + <string name="ssdk_instapager_login_html" formatted="false"><![CDATA[ | |
| 5 | +<!DOCTYPE html> | |
| 6 | +<html> | |
| 7 | +<head> | |
| 8 | +<meta content=\"text/html; charset=utf-8\" http-equiv=\"Content-Type\"> | |
| 9 | +<meta content=\"width=device-width,minimum-scale=1,maximum-scale=1,initial-scale=1,user-scalable=no\" id=\"viewport\" name=\"viewport\"> | |
| 10 | +<meta content=\"yes\" name=\"apple-mobile-web-app-capable\"> | |
| 11 | +<title>%s</title> | |
| 12 | +<style type=\"text/css\"> | |
| 13 | +body{margin:0;padding:0} | |
| 14 | +.inputstyle { | |
| 15 | + -webkit-tap-highlight-color:rgba(255,255,255,0); | |
| 16 | + width:100%%; | |
| 17 | + height:44px; | |
| 18 | + color:#000; | |
| 19 | + background:0; | |
| 20 | + border:0; | |
| 21 | + font-size:16px; | |
| 22 | + outline: none; | |
| 23 | + -webkit-appearance:none | |
| 24 | +} | |
| 25 | + | |
| 26 | +.btn { | |
| 27 | + width:90%%; | |
| 28 | + height:44px; | |
| 29 | + line-height:44px; | |
| 30 | + background:#A0C035; | |
| 31 | + border:0; | |
| 32 | + border-radius:4px; | |
| 33 | + color:#fff; | |
| 34 | + font-size:16px; | |
| 35 | + text-align:center; | |
| 36 | + margin-top:15px; | |
| 37 | + display:block | |
| 38 | +} | |
| 39 | +.btn:disabled { | |
| 40 | + background: #dddddd; | |
| 41 | +} | |
| 42 | +.error { | |
| 43 | + color:red; | |
| 44 | +} | |
| 45 | +</style> | |
| 46 | +</head> | |
| 47 | + | |
| 48 | +<body> | |
| 49 | +<script type=\"text/javascript\"> | |
| 50 | +function login(form){ | |
| 51 | + var u=form[\"u\"].value,p=form[\"p\"].value; | |
| 52 | + if(!u || !p) | |
| 53 | + return false; | |
| 54 | + form[\"s\"].disabled = true; | |
| 55 | + return true; | |
| 56 | +} | |
| 57 | +</script> | |
| 58 | +<form style=\"margin-top:45px;\" action=\"%s\" metho=\"get\" onsubmit=\"return login(this);\"> | |
| 59 | +%s | |
| 60 | +<div style=\"padding-left:15px;border-top:1px solid #E3E3E5;border-bottom:1px solid #E3E3E5;\"> | |
| 61 | + <input type=\"hidden\" name=\"ID_SIGN\" value=\"OWELJSFPWECSFEW\"/> | |
| 62 | + <input class=\"inputstyle\" id=\"u\" name=\"u\" type=\"text\" value=\"%s\" placeholder=\"%s\" style=\"border-bottom:1px solid #E3E3E5;\"/> | |
| 63 | + <input class=\"inputstyle\" id=\"p\" name=\"p\" type=\"password\" placeholder=\"%s\"/> | |
| 64 | +</div> | |
| 65 | +<p><input style=\"margin:0 auto;\" type=\"submit\" name=\"s\" value=\" %s \" class=\"btn\"/></p> | |
| 66 | +</form> | |
| 67 | +</body> | |
| 68 | +</html> | |
| 69 | +]]></string> | |
| 70 | +</resources> | |
| 0 | 71 | \ No newline at end of file | ... | ... |
cloud/share/src/main/res/values/ssdk_oks_color_drawables.xml
0 → 100644
cloud/share/src/main/res/values/ssdk_oks_strings.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<resources> | |
| 3 | + <string name="ssdk_oks_share">分享</string> | |
| 4 | + <string name="ssdk_oks_sharing">分享操作正在后台进行…</string> | |
| 5 | + <string name="ssdk_oks_share_failed">分享失败</string> | |
| 6 | + <string name="ssdk_oks_share_completed">分享成功</string> | |
| 7 | + <string name="ssdk_oks_share_canceled">分享已取消</string> | |
| 8 | + <string name="ssdk_oks_cancel">取消</string> | |
| 9 | + <string name="ssdk_oks_multi_share">图文分享</string> | |
| 10 | + <string name="ssdk_oks_confirm">确定</string> | |
| 11 | + <string name="ssdk_oks_contacts">联系人</string> | |
| 12 | + <string name="ssdk_oks_pull_to_refresh">下拉刷新</string> | |
| 13 | + <string name="ssdk_oks_release_to_refresh">松开刷新</string> | |
| 14 | + <string name="ssdk_oks_refreshing">刷新中…</string> | |
| 15 | +</resources> | ... | ... |
cloud/share/src/main/res/values/ssdk_strings.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<resources> | |
| 3 | + <string name="ssdk_weibo_oauth_regiseter">应用授权</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">目前您的微信版本过低或未安装微信,需要安装微信才能使用</string> | |
| 7 | + <string name="ssdk_google_plus_client_inavailable">Google+ 版本过低或者没有安装,需要升级或安装Google+才能使用!</string> | |
| 8 | + <string name="ssdk_qq_client_inavailable">QQ 版本过低或者没有安装,需要升级或安装QQ才能使用!</string> | |
| 9 | + <string name="ssdk_pinterest_client_inavailable">Pinterest版本过低或者没有安装,需要升级或安装Pinterest才能使用!</string> | |
| 10 | + <string name="ssdk_instagram_client_inavailable">Instagram版本过低或者没有安装,需要升级或安装Instagram才能使用!</string> | |
| 11 | + <string name="ssdk_yixin_client_inavailable">目前您的易信版本过低或未安装,需要安装易信才能使用</string> | |
| 12 | + <string name="ssdk_line_client_inavailable">目前您的Line版本过低或未安装,需要安装Line才能使用</string> | |
| 13 | + <string name="ssdk_kakaotalk_client_inavailable">目前您的KakaoTalk版本过低或未安装,需要安装KakaoTalk才能使用</string> | |
| 14 | + <string name="ssdk_kakaostory_client_inavailable">目前您的KakaoStory版本过低或未安装,需要安装KakaoStory才能使用</string> | |
| 15 | + <string name="ssdk_whatsapp_client_inavailable">目前您的WhatsApp版本过低或未安装,需要安装WhatsApp才能使用</string> | |
| 16 | + <string name="ssdk_laiwang_client_inavailable">目前您的来往版本过低或未安装,需要安装来往才能使用</string> | |
| 17 | + <string name="ssdk_alipay_client_inavailable">目前您的支付宝版本过低或未安装,需要安装支付宝才能使用</string> | |
| 18 | + <string name="ssdk_facebookmessenger_client_inavailable">目前您的FacebookMessenger版本过低或未安装,需要安装才能使用</string> | |
| 19 | + <string name="ssdk_telegram_client_inavailable">目前您的Telegram版本过低或未安装,需要安装才能使用</string> | |
| 20 | + <string name="ssdk_dont_keep_activitys_client">由于您已开启 不保留活动 ,导致授权功能无法正常使用.我们建议您点击左下方 设置 按钮,在 开发者选项 中关闭 不保留活动 功能.</string> | |
| 21 | + | |
| 22 | + <string name="ssdk_sinaweibo">新浪微博</string> | |
| 23 | + <string name="ssdk_tencentweibo">腾讯微博</string> | |
| 24 | + <string name="ssdk_qzone">QQ空间</string> | |
| 25 | + <string name="ssdk_wechat">微信好友</string> | |
| 26 | + <string name="ssdk_wechatmoments">微信朋友圈</string> | |
| 27 | + <string name="ssdk_wechatfavorite">微信收藏</string> | |
| 28 | + <string name="ssdk_facebook">Facebook</string> | |
| 29 | + <string name="ssdk_twitter">Twitter</string> | |
| 30 | + <string name="ssdk_renren">人人网</string> | |
| 31 | + <string name="ssdk_kaixin">开心网</string> | |
| 32 | + <string name="ssdk_email">邮件</string> | |
| 33 | + <string name="ssdk_shortmessage">信息</string> | |
| 34 | + <string name="ssdk_sohumicroblog">搜狐微博</string> | |
| 35 | + <string name="ssdk_sohusuishenkan">搜狐随身看</string> | |
| 36 | + <string name="ssdk_neteasemicroblog">网易微博</string> | |
| 37 | + <string name="ssdk_douban">豆瓣</string> | |
| 38 | + <string name="ssdk_youdao">有道云笔记</string> | |
| 39 | + <string name="ssdk_evernote">印象笔记</string> | |
| 40 | + <string name="ssdk_linkedin">领英</string> | |
| 41 | + <string name="ssdk_googleplus">Google+</string> | |
| 42 | + <string name="ssdk_foursquare">FourSquare</string> | |
| 43 | + <string name="ssdk_qq">QQ</string> | |
| 44 | + <string name="ssdk_pinterest">Pinterest</string> | |
| 45 | + <string name="ssdk_flickr">Flickr</string> | |
| 46 | + <string name="ssdk_tumblr">Tumblr</string> | |
| 47 | + <string name="ssdk_dropbox">Dropbox</string> | |
| 48 | + <string name="ssdk_vkontakte">VK</string> | |
| 49 | + <string name="ssdk_instagram">Instagram</string> | |
| 50 | + <string name="ssdk_yixin">易信</string> | |
| 51 | + <string name="ssdk_yixinmoments">易信朋友圈</string> | |
| 52 | + <string name="ssdk_mingdao">明道</string> | |
| 53 | + <string name="ssdk_kakaotalk">KakaoTalk</string> | |
| 54 | + <string name="ssdk_kakaostory">KakaoStory</string> | |
| 55 | + <string name="ssdk_line">Line</string> | |
| 56 | + <string name="ssdk_bluetooth">蓝牙</string> | |
| 57 | + <string name="ssdk_whatsapp">WhatsApp</string> | |
| 58 | + <string name="ssdk_pocket">Pocket</string> | |
| 59 | + <string name="ssdk_instapaper">Instapaper</string> | |
| 60 | + <string name="ssdk_instapaper_email">邮箱</string> | |
| 61 | + <string name="ssdk_instapaper_pwd">密码</string> | |
| 62 | + <string name="ssdk_instapaper_login">登录</string> | |
| 63 | + <string name="ssdk_instapaper_logining">登录中…</string> | |
| 64 | + <string name="ssdk_instapager_email_or_password_incorrect">Email或密码不正确</string> | |
| 65 | + <string name="ssdk_facebookmessenger">Facebook Messenger</string> | |
| 66 | + <string name="ssdk_laiwang">来往</string> | |
| 67 | + <string name="ssdk_laiwangmoments">来往动态</string> | |
| 68 | + <string name="ssdk_alipay">支付宝好友</string> | |
| 69 | + <string name="ssdk_alipaymoments">支付宝生活圈</string> | |
| 70 | + <string name="ssdk_plurk">Plurk</string> | |
| 71 | + <string name="ssdk_youtube">Youtube</string> | |
| 72 | + <string name="ssdk_dingding">钉钉</string> | |
| 73 | + <string name="ssdk_meipai">美拍</string> | |
| 74 | + <string name="ssdk_telegram">Telegram</string> | |
| 75 | + <string name="ssdk_cmcc">中国移动</string> | |
| 76 | + <string name="ssdk_share_to_qzone">分享到QQ空间</string> | |
| 77 | + <string name="ssdk_share_to_qq">分享到QQ</string> | |
| 78 | + <string name="ssdk_share_to_facebook">分享到Facebook</string> | |
| 79 | + <string name="ssdk_mingdao_share_content">网页分享</string> | |
| 80 | + <string name="ssdk_share_to_mingdao">分享到明道</string> | |
| 81 | + <string name="ssdk_share_to_googleplus">分享到Google+</string> | |
| 82 | + <string name="ssdk_share_to_qzone_default">来自%s的分享</string> | |
| 83 | + <string name="ssdk_use_login_button">请改用“登录”按钮</string> | |
| 84 | + <string name="ssdk_share_to_youtube">分享到Youtube</string> | |
| 85 | + | |
| 86 | + <string name="ssdk_gender_male">男</string> | |
| 87 | + <string name="ssdk_gender_female">女</string> | |
| 88 | + <string name="ssdk_symbol_ellipsis">...</string> | |
| 89 | + | |
| 90 | + <!--sina web --> | |
| 91 | + <string name="ssdk_sina_web_close">关闭</string> | |
| 92 | + <string name="ssdk_sina_web_net_error">网络出错啦,请点击按钮重新加载</string> | |
| 93 | + <string name="ssdk_sina_web_refresh">重新加载</string> | |
| 94 | + <string name="ssdk_sina_web_title">微博分享</string> | |
| 95 | + <string name="ssdk_sina_web_login_title">登录-新浪微博</string> | |
| 96 | + | |
| 97 | + | |
| 98 | + <!-- sms login --> | |
| 99 | + <string name="ssdk_sms_login">短信登录</string> | |
| 100 | + <string name="ssdk_sms_top_identify_text">短信已发送,请填写验证码</string> | |
| 101 | + <string name="ssdk_sms_btn_next">下一步</string> | |
| 102 | + <string name="ssdk_sms_btn_submit">提交</string> | |
| 103 | + <string name="ssdk_sms_btn_sende_voice">发送语音验证</string> | |
| 104 | + <string name="ssdk_sms_zone">国家/地区</string> | |
| 105 | + <string name="ssdk_sms_china">中国</string> | |
| 106 | + <string name="ssdk_sms_phone">手机号</string> | |
| 107 | + <string name="ssdk_sms_top_text">请输入您的手机号</string> | |
| 108 | + <string name="ssdk_sms_code">验证码</string> | |
| 109 | + <string name="ssdk_sms_send_again">重新发送</string> | |
| 110 | + <string name="ssdk_sms_input_phone_hint">请输入手机号码</string> | |
| 111 | + <string name="ssdk_sms_input_code_hint">请输入验证码</string> | |
| 112 | + <string name="ssdk_sms_input_voice_code"><Data>短信验证码收不到?请尝试<font color=#2ba245>语音验证码</font></Data></string> | |
| 113 | + <string name="ssdk_sms_dialog_btn_cancel">取消</string> | |
| 114 | + <string name="ssdk_sms_dialog_btn_ok">好</string> | |
| 115 | + <string name="ssdk_sms_dialog_btn_wait">等待</string> | |
| 116 | + <string name="ssdk_sms_dialog_btn_back">返回</string> | |
| 117 | + <string name="ssdk_sms_dialog_btn_sure">我知道了</string> | |
| 118 | + <string name="ssdk_sms_dialog_btn_login">确认登录</string> | |
| 119 | + <string name="ssdk_sms_dialog_confirm_title">确认手机号码</string> | |
| 120 | + <string name="ssdk_sms_dialog_confirm_des">我们将发送验证码短信到这个手机号:\n</string> | |
| 121 | + <string name="ssdk_sms_dialog_error_title">手机号码错误</string> | |
| 122 | + <string name="ssdk_sms_dialog_error_des">您输入的是一个无效手机号码</string> | |
| 123 | + <string name="ssdk_sms_dialog_close_identify_page">验证码短信可能略有延迟,确定返回\n并重新开始?</string> | |
| 124 | + <string name="ssdk_sms_dialog_error_code">验证码不正确,请重新填写</string> | |
| 125 | + <string name="ssdk_sms_dialog_voice_text">我们将以电话的方式告知您验证码,\n请注意接听</string> | |
| 126 | + <string name="ssdk_sms_dialog_send_success">发送成功</string> | |
| 127 | + <string name="ssdk_sms_dialog_login_success">登录成功</string> | |
| 128 | + <string name="ssdk_sms_dialog_smart_title">恭喜!该号码已通过云检测</string> | |
| 129 | + <string name="ssdk_sms_dialog_smart_dec">您的设备为安全设备,该号码已通过智能\n云验证,无需短信验证\n(本验证过程不存在任何安全隐患)</string> | |
| 130 | + <string name="ssdk_sms_choose_country">选择国家和地区</string> | |
| 131 | + <string name="ssdk_sms_country_search">搜索</string> | |
| 132 | + | |
| 133 | + <string name="ssdk_sms_dialog_net_error">网络不给力,请稍后重试</string> | |
| 134 | + <string name="ssdk_sms_dialog_system_error">系统有点小问题,请稍后重试</string> | |
| 135 | + <string name="ssdk_sms_dialog_error_desc_100">服务器错误</string> | |
| 136 | + <string name="ssdk_sms_dialog_error_desc_101">没有权限请求</string> | |
| 137 | + <string name="ssdk_sms_dialog_error_desc_102">解密数据失败</string> | |
| 138 | + <string name="ssdk_sms_dialog_error_desc_103">请求参数列表中缺少必要数据</string> | |
| 139 | + <string name="ssdk_sms_dialog_error_desc_104">请求数据非法</string> | |
| 140 | + <string name="ssdk_sms_dialog_error_desc_105">验证码错误</string> | |
| 141 | + <string name="ssdk_sms_dialog_error_desc_106">请求发送验证码失败</string> | |
| 142 | + <string name="ssdk_sms_dialog_error_desc_107">该号码超过接收验证码上\n限次数,请明日再试</string> | |
| 143 | + <string name="ssdk_sms_dialog_error_desc_108">该设备超过请求发送验证\n码上限次数,请明日再试</string> | |
| 144 | + <string name="ssdk_sms_dialog_error_desc_109">发送短信太频繁</string> | |
| 145 | + | |
| 146 | + <string name="ssdk_cmcc_auth">手机认证服务由中国移动提供</string> | |
| 147 | + <string name="ssdk_cmcc_owner_number">本机号码</string> | |
| 148 | + <string name="ssdk_cmcc_exchange_account">切换账号</string> | |
| 149 | + <string name="ssdk_cmcc_login_one_key">本机号码一键登录</string> | |
| 150 | + <string name="ssdk_cmcc_title_logon">登录</string> | |
| 151 | + <string name="ssdk_cmcc_login_argree">登录即同意</string> | |
| 152 | + <string name="ssdk_cmcc_terms_of_service">《中国移动号码服务条款》</string> | |
| 153 | + <string name="ssdk_cmcc_login_grant">并授权统一认证融合版获取本机号码</string> | |
| 154 | + <string name="ssdk_cmcc_login_again">登录失败,请尝试短信验证码登录</string> | |
| 155 | + <string name="ssdk_cmcc_send_sms_bar">自动发送短信登录,请允许通过</string> | |
| 156 | + <string name="ssdk_cmcc_phone_number">手机号</string> | |
| 157 | + <string name="ssdk_cmcc_ver_code">验证码</string> | |
| 158 | + <string name="ssdk_cmcc_get_vercode">获取验证码</string> | |
| 159 | + <string name="ssdk_cmcc_send_again">重新发送</string> | |
| 160 | + <string name="ssdk_cmcc_quick_login">快捷登录</string> | |
| 161 | + <string name="ssdk_cmcc_loading_text">正在校验您的身份,请稍后...</string> | |
| 162 | + | |
| 163 | + <item name="ssdk_sina_web_title_id" type="id" /> | |
| 164 | + <item name="ssdk_sms_id_clCountry" type="id" /> | |
| 165 | + <item name="ssdk_sms_id_ll_back" type="id" /> | |
| 166 | + <item name="ssdk_sms_id_tv_title" type="id" /> | |
| 167 | + <item name="ssdk_sms_id_llTitle" type="id" /> | |
| 168 | + <item name="ssdk_sms_id_ivSearch" type="id" /> | |
| 169 | + <item name="ssdk_sms_id_llSearch" type="id" /> | |
| 170 | + <item name="ssdk_sms_id_et_put_identify" type="id" /> | |
| 171 | + <item name="ssdk_sms_id_iv_clear" type="id" /> | |
| 172 | +</resources> | |
| 0 | 173 | \ No newline at end of file | ... | ... |
cloud/share/src/main/res/values/strings.xml
0 → 100644
cloud/share/src/main/res/values/styles.xml
0 → 100644
| 1 | +<resources> | |
| 2 | + <style name="ShareDialogStyle" > | |
| 3 | + <item name="android:windowFrame">@null</item><!--边框--> | |
| 4 | + <item name="android:windowIsFloating">true</item><!--是否浮现在activity之上--> | |
| 5 | + <item name="android:windowIsTranslucent">false</item><!--半透明--> | |
| 6 | + <item name="android:windowNoTitle">true</item><!--无标题--> | |
| 7 | + <item name="android:windowBackground">@color/transparent</item><!--背景透明--> | |
| 8 | + <item name="android:backgroundDimEnabled">true</item><!--模糊--> | |
| 9 | + <item name="android:backgroundDimAmount">0.6</item> | |
| 10 | + </style> | |
| 11 | + | |
| 12 | + <style name="Animation.Bottom.Rising" parent="@android:style/Animation"> | |
| 13 | + <item name="android:windowEnterAnimation">@anim/share_slide_in_bottom</item> | |
| 14 | + <item name="android:windowExitAnimation">@anim/share_slide_out_bottom</item> | |
| 15 | + </style> | |
| 16 | + | |
| 17 | + | |
| 18 | + <style name="ShareActivityTheme" parent="Theme.AppCompat.Dialog"> | |
| 19 | + <item name="android:windowFrame">@android:color/transparent</item><!--边框--> | |
| 20 | + <item name="android:windowIsFloating">true</item><!--是否浮现在activity之上--> | |
| 21 | + <item name="android:windowIsTranslucent">true</item><!--半透明--> | |
| 22 | + <item name="android:windowNoTitle">true</item><!--无标题--> | |
| 23 | + <item name="android:windowBackground">@android:color/transparent</item><!--背景透明--> | |
| 24 | + <item name="windowNoTitle">true</item> | |
| 25 | + <item name="windowActionBar">true</item> | |
| 26 | + <item name="android:windowActionBar">true</item> | |
| 27 | + </style> | |
| 28 | + | |
| 29 | +</resources> | ... | ... |
cloud/share/src/release/AndroidManifest.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | |
| 3 | + | |
| 4 | + <application> | |
| 5 | + | |
| 6 | + <activity | |
| 7 | + android:name="com.cnlive.strike.wxapi.WXEntryActivity" | |
| 8 | + android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" | |
| 9 | + android:exported="true" | |
| 10 | + android:launchMode="singleTop"> | |
| 11 | + | |
| 12 | + </activity> | |
| 13 | + | |
| 14 | + | |
| 15 | + </application> | |
| 16 | + | |
| 17 | +</manifest> | |
| 0 | 18 | \ No newline at end of file | ... | ... |
cloud/share/src/release/java/com/cnlive/strike/wxapi/WXEntryActivity.java
0 → 100644
| 1 | +package com.cnlive.strike.wxapi; | |
| 2 | + | |
| 3 | +import android.app.Activity; | |
| 4 | +import android.content.Intent; | |
| 5 | +import android.content.SharedPreferences; | |
| 6 | +import android.os.Bundle; | |
| 7 | +import android.text.TextUtils; | |
| 8 | +import android.util.Log; | |
| 9 | +import android.widget.Toast; | |
| 10 | + | |
| 11 | +import com.cnlive.libs.base.application.AppConfig; | |
| 12 | +import com.cnlive.libs.base.util.AlertUtil; | |
| 13 | +import com.cnlive.share.arouter.ARouterUtil; | |
| 14 | +import com.cnlive.share.data.ShareIntegralTypeInfo; | |
| 15 | +import com.cnlive.share.data.WeChatInfo; | |
| 16 | +import com.cnlive.share.observable.WechatLoginObservable; | |
| 17 | +import com.cnlive.share.observable.WechatShareObservable; | |
| 18 | +import com.cnlive.share.util.DateTimeUtil; | |
| 19 | +import com.cnlive.share.util.OkHttpUtils; | |
| 20 | +import com.cnlive.strike.user.auth.UserService; | |
| 21 | +import com.google.gson.Gson; | |
| 22 | +import com.tencent.mm.opensdk.modelbase.BaseReq; | |
| 23 | +import com.tencent.mm.opensdk.modelbase.BaseResp; | |
| 24 | +import com.tencent.mm.opensdk.modelmsg.SendAuth; | |
| 25 | +import com.tencent.mm.opensdk.openapi.IWXAPI; | |
| 26 | +import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler; | |
| 27 | +import com.tencent.mm.opensdk.openapi.WXAPIFactory; | |
| 28 | + | |
| 29 | +import com.cnlive.share.BuildConfig; | |
| 30 | + | |
| 31 | +import org.json.JSONException; | |
| 32 | +import org.json.JSONObject; | |
| 33 | + | |
| 34 | +/** | |
| 35 | + * 作者: 吴奎庆 | |
| 36 | + * <p> | |
| 37 | + * 时间: 2018/8/23 | |
| 38 | + * <p> | |
| 39 | + * 简介: | |
| 40 | + */ | |
| 41 | + | |
| 42 | +public class WXEntryActivity extends Activity implements IWXAPIEventHandler { | |
| 43 | + | |
| 44 | + private IWXAPI api; | |
| 45 | + | |
| 46 | + @Override | |
| 47 | + public void onCreate(Bundle savedInstanceState) { | |
| 48 | + super.onCreate(savedInstanceState); | |
| 49 | + | |
| 50 | + api = WXAPIFactory.createWXAPI(this, BuildConfig.WECHAT_SHARE,false); | |
| 51 | + api.handleIntent(getIntent(), this); | |
| 52 | + } | |
| 53 | + | |
| 54 | + @Override | |
| 55 | + protected void onNewIntent(Intent intent) { | |
| 56 | + super.onNewIntent(intent); | |
| 57 | + setIntent(intent); | |
| 58 | + api.handleIntent(intent, this); | |
| 59 | + } | |
| 60 | + | |
| 61 | + @Override | |
| 62 | + public void onReq(BaseReq baseReq) { | |
| 63 | + } | |
| 64 | + | |
| 65 | + | |
| 66 | + private SendAuth.Resp resp; | |
| 67 | + | |
| 68 | + @Override | |
| 69 | + public void onResp(BaseResp baseResp) { | |
| 70 | + | |
| 71 | + //微信登录为getType为1,分享为0 | |
| 72 | + if (baseResp.getType() == 1) { | |
| 73 | + //登录回调 | |
| 74 | + resp = (SendAuth.Resp) baseResp; | |
| 75 | + switch (resp.errCode) { | |
| 76 | + case BaseResp.ErrCode.ERR_OK: | |
| 77 | + String code = String.valueOf(resp.code); | |
| 78 | + //获取用户信息 | |
| 79 | + getAccessToken(code); | |
| 80 | + break; | |
| 81 | + case BaseResp.ErrCode.ERR_AUTH_DENIED://用户拒绝授权 | |
| 82 | + AlertUtil.showDeftToast(this, "用户拒绝授权"); | |
| 83 | + this.finish(); | |
| 84 | + break; | |
| 85 | + case BaseResp.ErrCode.ERR_USER_CANCEL://用户取消 | |
| 86 | + AlertUtil.showDeftToast(this, "用户取消登录"); | |
| 87 | + this.finish(); | |
| 88 | + break; | |
| 89 | + default: | |
| 90 | + this.finish(); | |
| 91 | + break; | |
| 92 | + } | |
| 93 | + } else { | |
| 94 | + String result = ""; | |
| 95 | + switch (baseResp.errCode) { | |
| 96 | + case BaseResp.ErrCode.ERR_OK: | |
| 97 | + result = "分享成功"; | |
| 98 | + WechatShareObservable.getInstance().update(1); | |
| 99 | + break; | |
| 100 | + case BaseResp.ErrCode.ERR_USER_CANCEL: | |
| 101 | + result = "分享取消"; | |
| 102 | + WechatShareObservable.getInstance().update(2); | |
| 103 | + break; | |
| 104 | + case BaseResp.ErrCode.ERR_AUTH_DENIED: | |
| 105 | + result = "分享失败"; | |
| 106 | + WechatShareObservable.getInstance().update(3); | |
| 107 | + break; | |
| 108 | + default: | |
| 109 | + result = "分享失败"; | |
| 110 | + break; | |
| 111 | + } | |
| 112 | + | |
| 113 | + AlertUtil.showDeftToast(this, result); | |
| 114 | + this.finish(); | |
| 115 | + processShareType(baseResp); | |
| 116 | + } | |
| 117 | + | |
| 118 | + | |
| 119 | + } | |
| 120 | + | |
| 121 | + private void getAccessToken(String code) { | |
| 122 | + String getTokenUrl = String.format("https://api.weixin.qq.com/sns/oauth2/access_token?" + | |
| 123 | + "appid=%s&secret=%s&code=%s&grant_type=authorization_code", AppConfig.getWechatAppid(), | |
| 124 | + BuildConfig.WECHAT_KEY, code); | |
| 125 | + OkHttpUtils.ResultCallback<String> resultCallback = new OkHttpUtils.ResultCallback<String>() { | |
| 126 | + @Override | |
| 127 | + public void onSuccess(String response) { | |
| 128 | + String access = null; | |
| 129 | + String openId = null; | |
| 130 | + try { | |
| 131 | + JSONObject jsonObject = new JSONObject(response); | |
| 132 | + access = jsonObject.getString("access_token"); | |
| 133 | + openId = jsonObject.getString("openid"); | |
| 134 | + } catch (JSONException e) { | |
| 135 | + e.printStackTrace(); | |
| 136 | + } | |
| 137 | + //获取个人信息 | |
| 138 | + String getUserInfo = "https://api.weixin.qq.com/sns/userinfo?access_token=" + access + "&openid=" + openId + ""; | |
| 139 | + OkHttpUtils.ResultCallback<WeChatInfo> resultCallback = new OkHttpUtils.ResultCallback<WeChatInfo>() { | |
| 140 | + @Override | |
| 141 | + public void onSuccess(WeChatInfo response) { | |
| 142 | + response.setErrCode(resp.errCode); | |
| 143 | + if (response != null) WechatLoginObservable.getInstance().update(response); | |
| 144 | + finish(); | |
| 145 | + } | |
| 146 | + | |
| 147 | + @Override | |
| 148 | + public void onFailure(Exception e) { | |
| 149 | + Toast.makeText(WXEntryActivity.this, "登录失败", Toast.LENGTH_SHORT).show(); | |
| 150 | + } | |
| 151 | + }; | |
| 152 | + OkHttpUtils.get(getUserInfo, resultCallback); | |
| 153 | + } | |
| 154 | + | |
| 155 | + @Override | |
| 156 | + public void onFailure(Exception e) { | |
| 157 | + Toast.makeText(WXEntryActivity.this, "登录失败", Toast.LENGTH_SHORT).show(); | |
| 158 | + } | |
| 159 | + }; | |
| 160 | + OkHttpUtils.get(getTokenUrl, resultCallback); | |
| 161 | + | |
| 162 | + } | |
| 163 | + | |
| 164 | + | |
| 165 | + /** | |
| 166 | + * 更具不同的分享类型处理不同的 分享逻辑 | |
| 167 | + * | |
| 168 | + * @param baseResp | |
| 169 | + */ | |
| 170 | + private void processShareType(BaseResp baseResp) { | |
| 171 | + String shareType = baseResp.transaction; | |
| 172 | + if (TextUtils.isEmpty(shareType)) return; | |
| 173 | + try { | |
| 174 | + Gson gson = new Gson(); | |
| 175 | + ShareIntegralTypeInfo integralTypeInfo = gson.fromJson(shareType, ShareIntegralTypeInfo.class); | |
| 176 | + | |
| 177 | + if ("witnessVideo".equals(integralTypeInfo.getShareType())) { | |
| 178 | + SharedPreferences preferences = this.getSharedPreferences("sharevideo", MODE_PRIVATE); | |
| 179 | + boolean status = preferences.getBoolean(UserService.getUid(this), false); | |
| 180 | + String newTime = DateTimeUtil.getCurrentTime(); | |
| 181 | + String oldtime = preferences.getString(UserService.getUid(this) + "time", "2019-04-10"); | |
| 182 | + boolean sameDay = DateTimeUtil.isSameDay(newTime, oldtime); | |
| 183 | + if (!status) { | |
| 184 | + ARouterUtil.addIntegrationPic(this, "share_video", integralTypeInfo.getContentId(), "sharevideo"); | |
| 185 | + } | |
| 186 | + if (status && !sameDay) { | |
| 187 | + ARouterUtil.addIntegrationPic(this, "share_video", integralTypeInfo.getContentId(), "sharevideo"); | |
| 188 | + } | |
| 189 | + | |
| 190 | + } else if (integralTypeInfo.getShareType() != null) { | |
| 191 | + SharedPreferences preferences = this.getSharedPreferences("sharearticle", MODE_PRIVATE); | |
| 192 | + boolean status = preferences.getBoolean(UserService.getUid(this), false); | |
| 193 | + String newTime = DateTimeUtil.getCurrentTime(); | |
| 194 | + String oldtime = preferences.getString(UserService.getUid(this) + "time", "2019-04-10"); | |
| 195 | + boolean sameDay = DateTimeUtil.isSameDay(newTime, oldtime); | |
| 196 | + if (!status) { | |
| 197 | + ARouterUtil.addIntegrationPic(this, "share_article", integralTypeInfo.getContentId(), "sharearticle"); | |
| 198 | + } | |
| 199 | + if (status && !sameDay) { | |
| 200 | + ARouterUtil.addIntegrationPic(this, "share_article", integralTypeInfo.getContentId(), "sharearticle"); | |
| 201 | + } | |
| 202 | + } | |
| 203 | + | |
| 204 | + } catch (Exception e) { | |
| 205 | + return; | |
| 206 | + } | |
| 207 | + } | |
| 208 | +} | |
| 0 | 209 | \ No newline at end of file | ... | ... |
core/imageload/src/main/java/com/cnlive/core/imageload/preview/presenter/PreviewImgPresenter.java
| ... | ... | @@ -39,62 +39,68 @@ public class PreviewImgPresenter extends BasePresenter<PreviewImgView> { |
| 39 | 39 | |
| 40 | 40 | public void showImg(Context context, ImagePreviewShowInfo previewData) { |
| 41 | 41 | |
| 42 | - Observable.create(new ObservableOnSubscribe<File>() { | |
| 43 | - @Override | |
| 44 | - public void subscribe(ObservableEmitter<File> emitter) { | |
| 45 | - FutureTarget<File> file = Glide.with(context).asFile().load(previewData.getImgPath()).listener(new RequestListener<File>() { | |
| 46 | - @Override | |
| 47 | - public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<File> target, boolean isFirstResource) { | |
| 42 | + if(FileUtils.isFileExists(new File(previewData.getImgPath()))){ | |
| 43 | + ifViewAttached(view -> view.showResourceReady()); | |
| 44 | + ifViewAttached(view -> view.showImg(new File(previewData.getImgPath()))); | |
| 45 | + }else { | |
| 46 | + Observable.create(new ObservableOnSubscribe<File>() { | |
| 47 | + @Override | |
| 48 | + public void subscribe(ObservableEmitter<File> emitter) { | |
| 49 | + FutureTarget<File> file = Glide.with(context).asFile().load(previewData.getImgPath()).listener(new RequestListener<File>() { | |
| 50 | + @Override | |
| 51 | + public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<File> target, boolean isFirstResource) { | |
| 48 | 52 | // ifViewAttached(view -> view.showLoadFail()); |
| 49 | - return false; | |
| 50 | - } | |
| 53 | + return false; | |
| 54 | + } | |
| 51 | 55 | |
| 52 | - @Override | |
| 53 | - public boolean onResourceReady(File resource, Object model, Target<File> target, DataSource dataSource, boolean isFirstResource) { | |
| 56 | + @Override | |
| 57 | + public boolean onResourceReady(File resource, Object model, Target<File> target, DataSource dataSource, boolean isFirstResource) { | |
| 54 | 58 | // ifViewAttached(view -> view.showResourceReady()); |
| 55 | - return false; | |
| 56 | - } | |
| 57 | - }).submit(); | |
| 58 | - try { | |
| 59 | - File imgfile = file.get(); | |
| 60 | - if (FileUtils.isFileExists(imgfile)) { | |
| 61 | - emitter.onNext(imgfile); | |
| 62 | - } else { | |
| 59 | + return false; | |
| 60 | + } | |
| 61 | + }).submit(); | |
| 62 | + try { | |
| 63 | + File imgfile = file.get(); | |
| 64 | + if (FileUtils.isFileExists(imgfile)) { | |
| 65 | + emitter.onNext(imgfile); | |
| 66 | + } else { | |
| 67 | + emitter.onError(new Throwable("加载失败")); | |
| 68 | + } | |
| 69 | + } catch (Exception e) { | |
| 63 | 70 | emitter.onError(new Throwable("加载失败")); |
| 64 | 71 | } |
| 65 | - } catch (Exception e) { | |
| 66 | - emitter.onError(new Throwable("加载失败")); | |
| 72 | + | |
| 67 | 73 | } |
| 74 | + }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<File>() { | |
| 68 | 75 | |
| 69 | - } | |
| 70 | - }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<File>() { | |
| 71 | 76 | |
| 77 | + @Override | |
| 78 | + public void onSubscribe(Disposable d) { | |
| 72 | 79 | |
| 73 | - @Override | |
| 74 | - public void onSubscribe(Disposable d) { | |
| 80 | + } | |
| 75 | 81 | |
| 76 | - } | |
| 82 | + @Override | |
| 83 | + public void onNext(File filse) { | |
| 77 | 84 | |
| 78 | - @Override | |
| 79 | - public void onNext(File filse) { | |
| 85 | + ifViewAttached(view -> view.showResourceReady()); | |
| 86 | + ifViewAttached(view -> view.showImg(filse)); | |
| 87 | + } | |
| 80 | 88 | |
| 81 | - ifViewAttached(view -> view.showResourceReady()); | |
| 82 | - ifViewAttached(view -> view.showImg(filse)); | |
| 83 | - } | |
| 89 | + @Override | |
| 90 | + public void onError(Throwable e) { | |
| 91 | + ifViewAttached(view -> view.showLoadFail()); | |
| 92 | + if (e != null) { | |
| 93 | + ifViewAttached(view -> view.showMessage(e.getMessage())); | |
| 94 | + } | |
| 84 | 95 | |
| 85 | - @Override | |
| 86 | - public void onError(Throwable e) { | |
| 87 | - ifViewAttached(view -> view.showLoadFail()); | |
| 88 | - if (e != null) { | |
| 89 | - ifViewAttached(view -> view.showMessage(e.getMessage())); | |
| 90 | 96 | } |
| 91 | 97 | |
| 92 | - } | |
| 98 | + @Override | |
| 99 | + public void onComplete() { | |
| 93 | 100 | |
| 94 | - @Override | |
| 95 | - public void onComplete() { | |
| 101 | + } | |
| 102 | + }); | |
| 103 | + } | |
| 96 | 104 | |
| 97 | - } | |
| 98 | - }); | |
| 99 | 105 | } |
| 100 | 106 | } | ... | ... |
core/imageload/src/main/java/com/cnlive/core/imageload/preview/presenter/ProcessHtmlPresenter.java
| ... | ... | @@ -93,7 +93,7 @@ public class ProcessHtmlPresenter extends BasePresenter<ProcessHtmlView> { |
| 93 | 93 | public void collectionPic(DataProcessingActivity context, String imagePath) { |
| 94 | 94 | if (context == null && TextUtils.isEmpty(imagePath)) return; |
| 95 | 95 | if (FileUtils.isFileExists(imagePath)) { |
| 96 | - if (getView() != null) processLocalImag(context, imagePath); | |
| 96 | + ifViewAttached(view -> processLocalImag(context, imagePath)); | |
| 97 | 97 | } else { |
| 98 | 98 | if (context.previewData != null) collection(context, imagePath, context.previewData); |
| 99 | 99 | } |
| ... | ... | @@ -161,17 +161,17 @@ public class ProcessHtmlPresenter extends BasePresenter<ProcessHtmlView> { |
| 161 | 161 | * @param url |
| 162 | 162 | */ |
| 163 | 163 | public void savePicture(Context context, String url) { |
| 164 | - if (getView() != null) getView().hideLoading(); | |
| 164 | + ifViewAttached(view -> view.hideLoading()); | |
| 165 | 165 | if (TextUtils.isEmpty(url)) { |
| 166 | - if (getView() != null) getView().showMessage("非法图片地址"); | |
| 166 | + ifViewAttached(view -> view.showMessage("非法图片地址")); | |
| 167 | 167 | return; |
| 168 | 168 | } |
| 169 | 169 | if (FileUtils.isFileExists(url)) { |
| 170 | 170 | // 本地图片 做copy操作 |
| 171 | - if (getView() != null) getView().saveLocalImg(url); | |
| 171 | + ifViewAttached(view -> view.saveLocalImg(url)); | |
| 172 | 172 | } else { |
| 173 | 173 | if (!url.contains("http")) { |
| 174 | - if (getView() != null) getView().showMessage("非法图片地址"); | |
| 174 | + ifViewAttached(view -> view.showMessage("非法图片地址")); | |
| 175 | 175 | return; |
| 176 | 176 | } |
| 177 | 177 | Observable.create(new ObservableOnSubscribe<String>() { |
| ... | ... | @@ -197,16 +197,16 @@ public class ProcessHtmlPresenter extends BasePresenter<ProcessHtmlView> { |
| 197 | 197 | |
| 198 | 198 | @Override |
| 199 | 199 | public void onNext(String s) { |
| 200 | - if (!TextUtils.isEmpty(s) && getView() != null) { | |
| 201 | - getView().saveLocalImg(s); | |
| 200 | + if (!TextUtils.isEmpty(s)) { | |
| 201 | + ifViewAttached(view -> view.saveLocalImg(s)); | |
| 202 | 202 | } else { |
| 203 | - if (getView() != null) getView().showMessage("数据异常"); | |
| 203 | + ifViewAttached(view -> view.showMessage("数据异常")); | |
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | @Override |
| 208 | 208 | public void onError(Throwable e) { |
| 209 | - if (getView() != null) getView().showMessage(e.getMessage()); | |
| 209 | + ifViewAttached(view -> view.showMessage(e.getMessage())); | |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | @Override |
| ... | ... | @@ -247,24 +247,26 @@ public class ProcessHtmlPresenter extends BasePresenter<ProcessHtmlView> { |
| 247 | 247 | |
| 248 | 248 | @Override |
| 249 | 249 | public void onNext(String content) { |
| 250 | - if (getView() != null) getView().hideLoading(); | |
| 250 | + ifViewAttached(view -> view.hideLoading()); | |
| 251 | 251 | if (!TextUtils.isEmpty(content)) { |
| 252 | 252 | if (type.equals("friends")) { |
| 253 | - if (getView() != null) getView().forwardFriends(content); | |
| 253 | + ifViewAttached(view -> view.forwardFriends(content)); | |
| 254 | 254 | } else if (type.equals("life")) { |
| 255 | - if (getView() != null) getView().forwardLife(content); | |
| 255 | + ifViewAttached(view -> view.forwardLife(content)); | |
| 256 | 256 | } else { |
| 257 | - if (getView() != null) getView().showMessage("类型异常"); | |
| 257 | + ifViewAttached(view -> view.showMessage("类型异常")); | |
| 258 | 258 | } |
| 259 | 259 | } else { |
| 260 | - if (getView() != null) getView().showMessage("非法图片地址"); | |
| 260 | + ifViewAttached(view -> view.showMessage("非法图片地址")); | |
| 261 | 261 | } |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | @Override |
| 265 | 265 | public void onError(Throwable e) { |
| 266 | - if (getView() != null) getView().hideLoading(); | |
| 267 | - if (getView() != null) getView().showMessage(e.getMessage()); | |
| 266 | + ifViewAttached(view -> { | |
| 267 | + view.hideLoading(); | |
| 268 | + view.showMessage(e.getMessage()); | |
| 269 | + }); | |
| 268 | 270 | } |
| 269 | 271 | |
| 270 | 272 | @Override |
| ... | ... | @@ -278,11 +280,11 @@ public class ProcessHtmlPresenter extends BasePresenter<ProcessHtmlView> { |
| 278 | 280 | |
| 279 | 281 | public void saveVideo(Activity activity, String imgUrl) { |
| 280 | 282 | if (TextUtils.isEmpty(imgUrl)) { |
| 281 | - if (getView() != null) getView().showMessage("数据异常"); | |
| 283 | + ifViewAttached(view -> view.showMessage("数据异常")); | |
| 282 | 284 | return; |
| 283 | 285 | } |
| 284 | 286 | if (imgUrl.contains("http")) { |
| 285 | - if (getView() != null) getView().saveNetVideo(imgUrl); | |
| 287 | + ifViewAttached(view -> view.saveNetVideo(imgUrl)); | |
| 286 | 288 | } else { |
| 287 | 289 | saveVideo(activity, FileUtils.getFileByPath(imgUrl)); |
| 288 | 290 | } |
| ... | ... | @@ -321,7 +323,7 @@ public class ProcessHtmlPresenter extends BasePresenter<ProcessHtmlView> { |
| 321 | 323 | outputStream.close(); |
| 322 | 324 | |
| 323 | 325 | context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.parse("file://" + newFile.getAbsolutePath()))); |
| 324 | - getView().showSucessfulMessage("保存成功"); | |
| 326 | + ifViewAttached(view -> view.showSucessfulMessage("保存成功")); | |
| 325 | 327 | context.finish(); |
| 326 | 328 | } catch (Exception e) { |
| 327 | 329 | Log.e("文件保存异常:", "Exception ", e); |
| ... | ... | @@ -377,16 +379,16 @@ public class ProcessHtmlPresenter extends BasePresenter<ProcessHtmlView> { |
| 377 | 379 | public void onNext(String qrContent) { |
| 378 | 380 | // if (getView()!=null)getView().hideLoading(); |
| 379 | 381 | if (qrContent != null && qrContent.length() > 0) { |
| 380 | - if (getView() != null) getView().processQrContent(qrContent); | |
| 382 | + ifViewAttached(view -> view.processQrContent(qrContent)); | |
| 381 | 383 | } else { |
| 382 | - getView().showMessage("未识别二维码"); | |
| 384 | + ifViewAttached(view -> view.showMessage("未识别二维码")); | |
| 383 | 385 | } |
| 384 | 386 | } |
| 385 | 387 | |
| 386 | 388 | @Override |
| 387 | 389 | public void onError(Throwable e) { |
| 388 | - if (getView() != null) getView().hideLoading(); | |
| 389 | - if (getView() != null) getView().showMessage(e.getMessage()); | |
| 390 | + ifViewAttached(view -> view.hideLoading()); | |
| 391 | + ifViewAttached(view -> view.showMessage(e.getMessage())); | |
| 390 | 392 | } |
| 391 | 393 | |
| 392 | 394 | @Override | ... | ... |
core/network/src/main/java/com/cnlive/core/network/action/CoinRainAction.java
0 → 100644
| 1 | +package com.cnlive.core.network.action; | |
| 2 | + | |
| 3 | +import android.annotation.SuppressLint; | |
| 4 | +import android.content.Context; | |
| 5 | +import android.content.SharedPreferences; | |
| 6 | +import android.text.TextUtils; | |
| 7 | + | |
| 8 | +import com.alibaba.android.arouter.launcher.ARouter; | |
| 9 | +import com.cnlive.core.network.HttpConn; | |
| 10 | +import com.cnlive.core.network.NetCallBack; | |
| 11 | +import com.cnlive.core.network.api.ApiServiceIntegra; | |
| 12 | +import com.cnlive.core.network.model.AddIntegration; | |
| 13 | +import com.cnlive.core.network.model.BaseResult; | |
| 14 | +import com.cnlive.core.network.request.BaseRequest; | |
| 15 | + | |
| 16 | +import java.text.SimpleDateFormat; | |
| 17 | +import java.util.Calendar; | |
| 18 | +import java.util.HashMap; | |
| 19 | +import java.util.Map; | |
| 20 | + | |
| 21 | +public class CoinRainAction { | |
| 22 | + | |
| 23 | + @SuppressLint("SimpleDateFormat") | |
| 24 | + private static SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); | |
| 25 | + public static boolean isGo = true; | |
| 26 | + | |
| 27 | + public static void code(Context context, String uid, String taskId, String contentId, String addtype, Boolean isDouyin) { | |
| 28 | + if (context == null) return; | |
| 29 | + | |
| 30 | + Map<String, String> maps = new HashMap<>(); | |
| 31 | + maps.put("sid", uid); | |
| 32 | + maps.put("taskId", taskId); | |
| 33 | + maps.put("contentId", contentId); | |
| 34 | + if (uid != null && !TextUtils.isEmpty(uid)) { | |
| 35 | + HttpConn.action( | |
| 36 | + BaseRequest.init() | |
| 37 | + .service(ApiServiceIntegra.class) | |
| 38 | + .addIntegration(maps), new NetCallBack<BaseResult<AddIntegration.DataBean>>() { | |
| 39 | + @Override | |
| 40 | + public void onRequestState(int state) { | |
| 41 | + | |
| 42 | + } | |
| 43 | + | |
| 44 | + @Override | |
| 45 | + public void onSuccess(BaseResult<AddIntegration.DataBean> data) { | |
| 46 | + if (!isDouyin) { | |
| 47 | + startCoinRain(context, uid, addtype, data); | |
| 48 | + } | |
| 49 | + } | |
| 50 | + | |
| 51 | + @Override | |
| 52 | + public void onFailure(String errCode, String errMsg) { | |
| 53 | + | |
| 54 | + } | |
| 55 | + } | |
| 56 | + ); | |
| 57 | + } | |
| 58 | + } | |
| 59 | + | |
| 60 | + private static void startCoinRain(Context context, String uid, String addtype, BaseResult<AddIntegration.DataBean> data) { | |
| 61 | + if (data == null) return; | |
| 62 | + if (data.getData() == null) return; | |
| 63 | + if (TextUtils.isEmpty(data.getData().getScore())) return; | |
| 64 | + | |
| 65 | + String score = data.getData().getScore(); | |
| 66 | + String desc = data.getData().getDesc(); | |
| 67 | + String descEnd = data.getData().getDescEnd(); | |
| 68 | + String currentTime = getCurrentTime(); | |
| 69 | + | |
| 70 | + SharedPreferences.Editor editor = context.getSharedPreferences(addtype, Context.MODE_PRIVATE).edit(); | |
| 71 | + | |
| 72 | + editor.putBoolean(uid, data.getData().isStatus()); | |
| 73 | + editor.putString(uid + "time", currentTime); | |
| 74 | + editor.apply(); | |
| 75 | + isGo = false; | |
| 76 | + if (!"first_login".equals(addtype)) { | |
| 77 | + ARouter.getInstance().build("/add/CoinRainActivity") | |
| 78 | + .withString("type", "addintegration") | |
| 79 | + .withString("score", score) | |
| 80 | + .withString("desc", desc) | |
| 81 | + .withString("descend", descEnd) | |
| 82 | + .navigation(context); | |
| 83 | + } | |
| 84 | + } | |
| 85 | + | |
| 86 | + public static String getCurrentTime() { | |
| 87 | + return format.format(Calendar.getInstance().getTime()); | |
| 88 | + } | |
| 89 | +} | ... | ... |
core/network/src/main/java/com/cnlive/core/network/api/ApiServiceIntegra.java
0 → 100644
| 1 | +package com.cnlive.core.network.api; | |
| 2 | + | |
| 3 | +import com.cnlive.core.network.model.AddIntegration; | |
| 4 | +import com.cnlive.core.network.model.BaseResult; | |
| 5 | +import com.cnlive.core.network.model.CheckinData; | |
| 6 | +import com.cnlive.core.network.model.IntegraContentData; | |
| 7 | +import com.cnlive.core.network.model.IntegraData; | |
| 8 | + | |
| 9 | +import java.util.Map; | |
| 10 | + | |
| 11 | +import io.reactivex.Observable; | |
| 12 | +import retrofit2.http.GET; | |
| 13 | +import retrofit2.http.POST; | |
| 14 | +import retrofit2.http.QueryMap; | |
| 15 | + | |
| 16 | +public interface ApiServiceIntegra { | |
| 17 | + /** | |
| 18 | + * 积分任务列表 | |
| 19 | + */ | |
| 20 | + @GET("Daren/integral/getTasks.action") | |
| 21 | + Observable<BaseResult<IntegraData>> getIntegraList(@QueryMap() Map<String, String> map); | |
| 22 | + | |
| 23 | + /** | |
| 24 | + * 积分明细 | |
| 25 | + */ | |
| 26 | + @GET("Daren/integral/integralRecord.action") | |
| 27 | + Observable<BaseResult<IntegraContentData>> getIntegraContentList(@QueryMap() Map<String, String> map); | |
| 28 | + | |
| 29 | + /** | |
| 30 | + * 签到 | |
| 31 | + */ | |
| 32 | + @POST("Daren/integral/checkIn.action") | |
| 33 | + Observable<BaseResult<CheckinData>> getCheckIn(@QueryMap() Map<String, String> map); | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * 增加积分 | |
| 37 | + */ | |
| 38 | + @POST("Daren/integral/addTask.action") | |
| 39 | + Observable<BaseResult<AddIntegration.DataBean>> addIntegration(@QueryMap() Map<String, String> map); | |
| 40 | + | |
| 41 | +} | ... | ... |
core/network/src/main/java/com/cnlive/core/network/model/AddIntegration.java
0 → 100644
| 1 | +package com.cnlive.core.network.model; | |
| 2 | + | |
| 3 | +import java.io.Serializable; | |
| 4 | + | |
| 5 | +public class AddIntegration implements Serializable { | |
| 6 | + | |
| 7 | + | |
| 8 | + public static class DataBean { | |
| 9 | + /** | |
| 10 | + * status : false | |
| 11 | + * score : 100 | |
| 12 | + */ | |
| 13 | + | |
| 14 | + private boolean status; | |
| 15 | + private String score; | |
| 16 | + private String desc; | |
| 17 | + private String descEnd; | |
| 18 | + | |
| 19 | + public String getDescEnd() { | |
| 20 | + return descEnd; | |
| 21 | + } | |
| 22 | + | |
| 23 | + public void setDescEnd(String descEnd) { | |
| 24 | + this.descEnd = descEnd; | |
| 25 | + } | |
| 26 | + | |
| 27 | + public String getDesc() { | |
| 28 | + return desc; | |
| 29 | + } | |
| 30 | + | |
| 31 | + public void setDesc(String desc) { | |
| 32 | + this.desc = desc; | |
| 33 | + } | |
| 34 | + | |
| 35 | + | |
| 36 | + public boolean isStatus() { | |
| 37 | + return status; | |
| 38 | + } | |
| 39 | + | |
| 40 | + public void setStatus(boolean status) { | |
| 41 | + this.status = status; | |
| 42 | + } | |
| 43 | + | |
| 44 | + public String getScore() { | |
| 45 | + return score; | |
| 46 | + } | |
| 47 | + | |
| 48 | + public void setScore(String score) { | |
| 49 | + this.score = score; | |
| 50 | + } | |
| 51 | + } | |
| 52 | +} | ... | ... |
core/network/src/main/java/com/cnlive/core/network/model/CheckinData.java
0 → 100644
| 1 | +package com.cnlive.core.network.model; | |
| 2 | + | |
| 3 | +import java.io.Serializable; | |
| 4 | +import java.util.List; | |
| 5 | + | |
| 6 | +public class CheckinData implements Serializable { | |
| 7 | + | |
| 8 | + /** | |
| 9 | + * data : {"score":3000,"scores":["1000,2000,3000,4000,5000,6000,7000"],"times":3,"url":"http://www.baidu.com"} | |
| 10 | + * errorCode : 0 | |
| 11 | + * errorMessage : 成功 | |
| 12 | + */ | |
| 13 | + | |
| 14 | + /* private DataBean data; | |
| 15 | + | |
| 16 | + public DataBean getData() { | |
| 17 | + return data; | |
| 18 | + } | |
| 19 | + | |
| 20 | + public void setData(DataBean data) { | |
| 21 | + this.data = data; | |
| 22 | + }*/ | |
| 23 | + | |
| 24 | + // public static class DataBean { | |
| 25 | + /** | |
| 26 | + * score : 3000 | |
| 27 | + * scores : ["1000,2000,3000,4000,5000,6000,7000"] | |
| 28 | + * times : 3 | |
| 29 | + * url : http://www.baidu.com | |
| 30 | + */ | |
| 31 | + | |
| 32 | + private int score; | |
| 33 | + private int times; | |
| 34 | + private String url; | |
| 35 | + private boolean status; //是否第一次签到 | |
| 36 | + private List<String> scores; | |
| 37 | + | |
| 38 | + public boolean isStatus() { | |
| 39 | + return status; | |
| 40 | + } | |
| 41 | + | |
| 42 | + public void setStatus(boolean status) { | |
| 43 | + this.status = status; | |
| 44 | + } | |
| 45 | + | |
| 46 | + public int getScore() { | |
| 47 | + return score; | |
| 48 | + } | |
| 49 | + | |
| 50 | + public void setScore(int score) { | |
| 51 | + this.score = score; | |
| 52 | + } | |
| 53 | + | |
| 54 | + public int getTimes() { | |
| 55 | + return times; | |
| 56 | + } | |
| 57 | + | |
| 58 | + public void setTimes(int times) { | |
| 59 | + this.times = times; | |
| 60 | + } | |
| 61 | + | |
| 62 | + public String getUrl() { | |
| 63 | + return url; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public void setUrl(String url) { | |
| 67 | + this.url = url; | |
| 68 | + } | |
| 69 | + | |
| 70 | + public List<String> getScores() { | |
| 71 | + return scores; | |
| 72 | + } | |
| 73 | + | |
| 74 | + public void setScores(List<String> scores) { | |
| 75 | + this.scores = scores; | |
| 76 | + } | |
| 77 | + // } | |
| 78 | +} | ... | ... |
core/network/src/main/java/com/cnlive/core/network/model/IntegraContentData.java
0 → 100644
| 1 | +package com.cnlive.core.network.model; | |
| 2 | + | |
| 3 | +import java.io.Serializable; | |
| 4 | +import java.util.List; | |
| 5 | + | |
| 6 | +public class IntegraContentData implements Serializable { | |
| 7 | + | |
| 8 | + | |
| 9 | + // public static class DataBean { | |
| 10 | + /** | |
| 11 | + * hasNext : false | |
| 12 | + * list : [{"date":"2019-03-13","integral":"100","title":"观看视频"},{"date":"2019-03-13","integral":"100","title":"观看视频"}] | |
| 13 | + */ | |
| 14 | + | |
| 15 | + private boolean hasNext; | |
| 16 | + private List<ListBean> list; | |
| 17 | + | |
| 18 | + public boolean isHasNext() { | |
| 19 | + return hasNext; | |
| 20 | + } | |
| 21 | + | |
| 22 | + public void setHasNext(boolean hasNext) { | |
| 23 | + this.hasNext = hasNext; | |
| 24 | + } | |
| 25 | + | |
| 26 | + public List<ListBean> getList() { | |
| 27 | + return list; | |
| 28 | + } | |
| 29 | + | |
| 30 | + public void setList(List<ListBean> list) { | |
| 31 | + this.list = list; | |
| 32 | + } | |
| 33 | + | |
| 34 | + public static class ListBean { | |
| 35 | + /** | |
| 36 | + * date : 2019-03-13 | |
| 37 | + * integral : 100 | |
| 38 | + * title : 观看视频 | |
| 39 | + */ | |
| 40 | + | |
| 41 | + private String date; | |
| 42 | + private String integral; | |
| 43 | + private String title; | |
| 44 | + private String source; | |
| 45 | + private String taskId; | |
| 46 | + | |
| 47 | + public String getSource() { | |
| 48 | + return source; | |
| 49 | + } | |
| 50 | + | |
| 51 | + public void setSource(String source) { | |
| 52 | + this.source = source; | |
| 53 | + } | |
| 54 | + | |
| 55 | + public String getTaskId() { | |
| 56 | + return taskId; | |
| 57 | + } | |
| 58 | + | |
| 59 | + public void setTaskId(String taskId) { | |
| 60 | + this.taskId = taskId; | |
| 61 | + } | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + public String getDate() { | |
| 66 | + return date; | |
| 67 | + } | |
| 68 | + | |
| 69 | + public void setDate(String date) { | |
| 70 | + this.date = date; | |
| 71 | + } | |
| 72 | + | |
| 73 | + public String getIntegral() { | |
| 74 | + return integral; | |
| 75 | + } | |
| 76 | + | |
| 77 | + public void setIntegral(String integral) { | |
| 78 | + this.integral = integral; | |
| 79 | + } | |
| 80 | + | |
| 81 | + public String getTitle() { | |
| 82 | + return title; | |
| 83 | + } | |
| 84 | + | |
| 85 | + public void setTitle(String title) { | |
| 86 | + this.title = title; | |
| 87 | + } | |
| 88 | + } | |
| 89 | + // } | |
| 90 | +} | ... | ... |
core/network/src/main/java/com/cnlive/core/network/model/IntegraData.java
0 → 100644
| 1 | +package com.cnlive.core.network.model; | |
| 2 | + | |
| 3 | + | |
| 4 | +import java.io.Serializable; | |
| 5 | +import java.util.List; | |
| 6 | + | |
| 7 | +public class IntegraData implements Serializable { | |
| 8 | + | |
| 9 | + /** | |
| 10 | + * data : {"dailyTask":[{"icon":"https://wjj.ys1.cnliveimg.com/769/integral/share_video.png","score":100,"status":true,"taskId":"share_video","taskType":"dailyTask","times":0,"title":"分享目击者视频","totalCount":10,"url":""},{"icon":"https://wjj.ys1.cnliveimg.com/769/integral/publish_comment.png","score":100,"status":true,"taskId":"publish_comment","taskType":"dailyTask","times":0,"title":"发布评论","totalCount":10,"url":""},{"icon":"https://wjj.ys1.cnliveimg.com/769/integral/read_article.png","score":100,"status":true,"taskId":"read_article","taskType":"dailyTask","times":0,"title":"啃篇文档","totalCount":10,"url":""},{"icon":"https://wjj.ys1.cnliveimg.com/769/integral/listen_novel.png","score":200,"status":true,"taskId":"listen_novel","taskType":"dailyTask","times":0,"title":"听本小说","totalCount":10,"url":""},{"icon":"https://wjj.ys1.cnliveimg.com/769/integral/watch_video.png","score":100,"status":true,"taskId":"watch_video","taskType":"dailyTask","times":0,"title":"观看视频","totalCount":10,"url":""},{"icon":"https://wjj.ys1.cnliveimg.com/769/integral/share_article.png","score":100,"status":true,"taskId":"share_article","taskType":"dailyTask","times":0,"title":"分享文章内容","totalCount":10,"url":""},{"icon":"https://wjj.ys1.cnliveimg.com/769/integral/check_in.png","score":1000,"status":true,"taskId":"check_in","taskType":"dailyTask","times":0,"title":"签到","totalCount":7,"url":""}],"firstTask":[{"icon":"https://wjj.ys1.cnliveimg.com/769/integral/common.png","score":200,"status":true,"taskId":"update_face","taskType":"firstTask","times":0,"title":"更新头像","totalCount":1,"url":""},{"icon":"https://wjj.ys1.cnliveimg.com/769/integral/common.png","score":200,"status":true,"taskId":"update_nick","taskType":"firstTask","times":0,"title":"换个昵称","totalCount":1,"url":""},{"icon":"https://wjj.ys1.cnliveimg.com/769/integral/publish_witness.png","score":500,"status":true,"taskId":"publish_witness","taskType":"firstTask","times":0,"title":"发条目击者","totalCount":1,"url":""},{"icon":"https://wjj.ys1.cnliveimg.com/769/integral/add_friend.png","score":300,"status":true,"taskId":"add_friend","taskType":"firstTask","times":0,"title":"添加好友","totalCount":1,"url":""},{"icon":"https://wjj.ys1.cnliveimg.com/769/integral/publish_comment.png","score":500,"status":true,"taskId":"publish_moment","taskType":"firstTask","times":0,"title":"发条生活圈","totalCount":1,"url":""},{"icon":"https://wjj.ys1.cnliveimg.com/769/integral/common.png","score":200,"status":true,"taskId":"customer_feedback","taskType":"firstTask","times":0,"title":"客服留言","totalCount":1,"url":""}],"integral":5000} | |
| 11 | + * errorCode : 0 | |
| 12 | + * errorMessage : 成功 | |
| 13 | + */ | |
| 14 | + | |
| 15 | + // private DataBean data; | |
| 16 | + // private String errorCode; | |
| 17 | + // private String errorMessage; | |
| 18 | + | |
| 19 | + /* public DataBean getData() { | |
| 20 | + return data; | |
| 21 | + } | |
| 22 | + | |
| 23 | + public void setData(DataBean data) { | |
| 24 | + this.data = data; | |
| 25 | + }*/ | |
| 26 | + | |
| 27 | + /* public String getErrorCode() { | |
| 28 | + return errorCode; | |
| 29 | + } | |
| 30 | + | |
| 31 | + public void setErrorCode(String errorCode) { | |
| 32 | + this.errorCode = errorCode; | |
| 33 | + } | |
| 34 | + | |
| 35 | + public String getErrorMessage() { | |
| 36 | + return errorMessage; | |
| 37 | + } | |
| 38 | + | |
| 39 | + public void setErrorMessage(String errorMessage) { | |
| 40 | + this.errorMessage = errorMessage; | |
| 41 | + }*/ | |
| 42 | + | |
| 43 | + // public static class DataBean { | |
| 44 | + /** | |
| 45 | + * dailyTask : [{"icon":"https://wjj.ys1.cnliveimg.com/769/integral/share_video.png","score":100,"status":true,"taskId":"share_video","taskType":"dailyTask","times":0,"title":"分享目击者视频","totalCount":10,"url":""},{"icon":"https://wjj.ys1.cnliveimg.com/769/integral/publish_comment.png","score":100,"status":true,"taskId":"publish_comment","taskType":"dailyTask","times":0,"title":"发布评论","totalCount":10,"url":""},{"icon":"https://wjj.ys1.cnliveimg.com/769/integral/read_article.png","score":100,"status":true,"taskId":"read_article","taskType":"dailyTask","times":0,"title":"啃篇文档","totalCount":10,"url":""},{"icon":"https://wjj.ys1.cnliveimg.com/769/integral/listen_novel.png","score":200,"status":true,"taskId":"listen_novel","taskType":"dailyTask","times":0,"title":"听本小说","totalCount":10,"url":""},{"icon":"https://wjj.ys1.cnliveimg.com/769/integral/watch_video.png","score":100,"status":true,"taskId":"watch_video","taskType":"dailyTask","times":0,"title":"观看视频","totalCount":10,"url":""},{"icon":"https://wjj.ys1.cnliveimg.com/769/integral/share_article.png","score":100,"status":true,"taskId":"share_article","taskType":"dailyTask","times":0,"title":"分享文章内容","totalCount":10,"url":""},{"icon":"https://wjj.ys1.cnliveimg.com/769/integral/check_in.png","score":1000,"status":true,"taskId":"check_in","taskType":"dailyTask","times":0,"title":"签到","totalCount":7,"url":""}] | |
| 46 | + * firstTask : [{"icon":"https://wjj.ys1.cnliveimg.com/769/integral/common.png","score":200,"status":true,"taskId":"update_face","taskType":"firstTask","times":0,"title":"更新头像","totalCount":1,"url":""},{"icon":"https://wjj.ys1.cnliveimg.com/769/integral/common.png","score":200,"status":true,"taskId":"update_nick","taskType":"firstTask","times":0,"title":"换个昵称","totalCount":1,"url":""},{"icon":"https://wjj.ys1.cnliveimg.com/769/integral/publish_witness.png","score":500,"status":true,"taskId":"publish_witness","taskType":"firstTask","times":0,"title":"发条目击者","totalCount":1,"url":""},{"icon":"https://wjj.ys1.cnliveimg.com/769/integral/add_friend.png","score":300,"status":true,"taskId":"add_friend","taskType":"firstTask","times":0,"title":"添加好友","totalCount":1,"url":""},{"icon":"https://wjj.ys1.cnliveimg.com/769/integral/publish_comment.png","score":500,"status":true,"taskId":"publish_moment","taskType":"firstTask","times":0,"title":"发条生活圈","totalCount":1,"url":""},{"icon":"https://wjj.ys1.cnliveimg.com/769/integral/common.png","score":200,"status":true,"taskId":"customer_feedback","taskType":"firstTask","times":0,"title":"客服留言","totalCount":1,"url":""}] | |
| 47 | + * integral : 5000 | |
| 48 | + */ | |
| 49 | + | |
| 50 | + private int integral; | |
| 51 | + private List<DailyTaskBean> dailyTask; | |
| 52 | + private List<FirstTaskBean> firstTask; | |
| 53 | + | |
| 54 | + public int getIntegral() { | |
| 55 | + return integral; | |
| 56 | + } | |
| 57 | + | |
| 58 | + public void setIntegral(int integral) { | |
| 59 | + this.integral = integral; | |
| 60 | + } | |
| 61 | + | |
| 62 | + public List<DailyTaskBean> getDailyTask() { | |
| 63 | + return dailyTask; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public void setDailyTask(List<DailyTaskBean> dailyTask) { | |
| 67 | + this.dailyTask = dailyTask; | |
| 68 | + } | |
| 69 | + | |
| 70 | + public List<FirstTaskBean> getFirstTask() { | |
| 71 | + return firstTask; | |
| 72 | + } | |
| 73 | + | |
| 74 | + public void setFirstTask(List<FirstTaskBean> firstTask) { | |
| 75 | + this.firstTask = firstTask; | |
| 76 | + } | |
| 77 | + | |
| 78 | + public static class DailyTaskBean { | |
| 79 | + /** | |
| 80 | + * icon : https://wjj.ys1.cnliveimg.com/769/integral/share_video.png | |
| 81 | + * score : 100 | |
| 82 | + * status : true | |
| 83 | + * taskId : share_video | |
| 84 | + * taskType : dailyTask | |
| 85 | + * times : 0 | |
| 86 | + * title : 分享目击者视频 | |
| 87 | + * totalCount : 10 | |
| 88 | + * url : | |
| 89 | + */ | |
| 90 | + | |
| 91 | + private String icon; | |
| 92 | + private int score; | |
| 93 | + private boolean status; | |
| 94 | + private String taskId; | |
| 95 | + private String taskType; | |
| 96 | + private int times; | |
| 97 | + private String title; | |
| 98 | + private int totalCount; | |
| 99 | + private String url; | |
| 100 | + | |
| 101 | + public String getIcon() { | |
| 102 | + return icon; | |
| 103 | + } | |
| 104 | + | |
| 105 | + public void setIcon(String icon) { | |
| 106 | + this.icon = icon; | |
| 107 | + } | |
| 108 | + | |
| 109 | + public int getScore() { | |
| 110 | + return score; | |
| 111 | + } | |
| 112 | + | |
| 113 | + public void setScore(int score) { | |
| 114 | + this.score = score; | |
| 115 | + } | |
| 116 | + | |
| 117 | + public boolean isStatus() { | |
| 118 | + return status; | |
| 119 | + } | |
| 120 | + | |
| 121 | + public void setStatus(boolean status) { | |
| 122 | + this.status = status; | |
| 123 | + } | |
| 124 | + | |
| 125 | + public String getTaskId() { | |
| 126 | + return taskId; | |
| 127 | + } | |
| 128 | + | |
| 129 | + public void setTaskId(String taskId) { | |
| 130 | + this.taskId = taskId; | |
| 131 | + } | |
| 132 | + | |
| 133 | + public String getTaskType() { | |
| 134 | + return taskType; | |
| 135 | + } | |
| 136 | + | |
| 137 | + public void setTaskType(String taskType) { | |
| 138 | + this.taskType = taskType; | |
| 139 | + } | |
| 140 | + | |
| 141 | + public int getTimes() { | |
| 142 | + return times; | |
| 143 | + } | |
| 144 | + | |
| 145 | + public void setTimes(int times) { | |
| 146 | + this.times = times; | |
| 147 | + } | |
| 148 | + | |
| 149 | + public String getTitle() { | |
| 150 | + return title; | |
| 151 | + } | |
| 152 | + | |
| 153 | + public void setTitle(String title) { | |
| 154 | + this.title = title; | |
| 155 | + } | |
| 156 | + | |
| 157 | + public int getTotalCount() { | |
| 158 | + return totalCount; | |
| 159 | + } | |
| 160 | + | |
| 161 | + public void setTotalCount(int totalCount) { | |
| 162 | + this.totalCount = totalCount; | |
| 163 | + } | |
| 164 | + | |
| 165 | + public String getUrl() { | |
| 166 | + return url; | |
| 167 | + } | |
| 168 | + | |
| 169 | + public void setUrl(String url) { | |
| 170 | + this.url = url; | |
| 171 | + } | |
| 172 | + } | |
| 173 | + | |
| 174 | + public static class FirstTaskBean { | |
| 175 | + /** | |
| 176 | + * icon : https://wjj.ys1.cnliveimg.com/769/integral/common.png | |
| 177 | + * score : 200 | |
| 178 | + * status : true | |
| 179 | + * taskId : update_face | |
| 180 | + * taskType : firstTask | |
| 181 | + * times : 0 | |
| 182 | + * title : 更新头像 | |
| 183 | + * totalCount : 1 | |
| 184 | + * url : | |
| 185 | + */ | |
| 186 | + | |
| 187 | + private String icon; | |
| 188 | + private int score; | |
| 189 | + private boolean status; | |
| 190 | + private String taskId; | |
| 191 | + private String taskType; | |
| 192 | + private int times; | |
| 193 | + private String title; | |
| 194 | + private int totalCount; | |
| 195 | + private String url; | |
| 196 | + | |
| 197 | + public String getIcon() { | |
| 198 | + return icon; | |
| 199 | + } | |
| 200 | + | |
| 201 | + public void setIcon(String icon) { | |
| 202 | + this.icon = icon; | |
| 203 | + } | |
| 204 | + | |
| 205 | + public int getScore() { | |
| 206 | + return score; | |
| 207 | + } | |
| 208 | + | |
| 209 | + public void setScore(int score) { | |
| 210 | + this.score = score; | |
| 211 | + } | |
| 212 | + | |
| 213 | + public boolean isStatus() { | |
| 214 | + return status; | |
| 215 | + } | |
| 216 | + | |
| 217 | + public void setStatus(boolean status) { | |
| 218 | + this.status = status; | |
| 219 | + } | |
| 220 | + | |
| 221 | + public String getTaskId() { | |
| 222 | + return taskId; | |
| 223 | + } | |
| 224 | + | |
| 225 | + public void setTaskId(String taskId) { | |
| 226 | + this.taskId = taskId; | |
| 227 | + } | |
| 228 | + | |
| 229 | + public String getTaskType() { | |
| 230 | + return taskType; | |
| 231 | + } | |
| 232 | + | |
| 233 | + public void setTaskType(String taskType) { | |
| 234 | + this.taskType = taskType; | |
| 235 | + } | |
| 236 | + | |
| 237 | + public int getTimes() { | |
| 238 | + return times; | |
| 239 | + } | |
| 240 | + | |
| 241 | + public void setTimes(int times) { | |
| 242 | + this.times = times; | |
| 243 | + } | |
| 244 | + | |
| 245 | + public String getTitle() { | |
| 246 | + return title; | |
| 247 | + } | |
| 248 | + | |
| 249 | + public void setTitle(String title) { | |
| 250 | + this.title = title; | |
| 251 | + } | |
| 252 | + | |
| 253 | + public int getTotalCount() { | |
| 254 | + return totalCount; | |
| 255 | + } | |
| 256 | + | |
| 257 | + public void setTotalCount(int totalCount) { | |
| 258 | + this.totalCount = totalCount; | |
| 259 | + } | |
| 260 | + | |
| 261 | + public String getUrl() { | |
| 262 | + return url; | |
| 263 | + } | |
| 264 | + | |
| 265 | + public void setUrl(String url) { | |
| 266 | + this.url = url; | |
| 267 | + } | |
| 268 | + } | |
| 269 | + // } | |
| 270 | +} | ... | ... |
core/network/src/main/java/com/cnlive/core/network/upload/UploadLogic.java
module/pedometer/build.gradle
module/xiaojiasoundbox/src/main/res/layout/dialog_edit_role.xml
| ... | ... | @@ -55,7 +55,7 @@ |
| 55 | 55 | android:textSize="17sp" /> |
| 56 | 56 | </LinearLayout> |
| 57 | 57 | |
| 58 | - <android.support.v7.widget.RecyclerView | |
| 58 | + <androidx.recyclerview.widget.RecyclerView | |
| 59 | 59 | android:id="@+id/rv_role" |
| 60 | 60 | android:layout_width="match_parent" |
| 61 | 61 | android:layout_height="wrap_content" | ... | ... |
module/xiaojiasoundbox/src/main/res/layout/pop_menu.xml
| ... | ... | @@ -11,7 +11,7 @@ |
| 11 | 11 | android:layout_marginLeft="2dp" |
| 12 | 12 | android:background="@drawable/layer_xiaojia_tran" /> |
| 13 | 13 | |
| 14 | - <android.support.v7.widget.RecyclerView | |
| 14 | + <androidx.recyclerview.widget.RecyclerView | |
| 15 | 15 | android:id="@+id/rv_list" |
| 16 | 16 | android:layout_width="wrap_content" |
| 17 | 17 | android:layout_height="wrap_content" | ... | ... |
settings.gradle
| 1 | -include ':app:strike', ':network', ':xiaojiasoundbox', ':lib_combinebitmap', ':TcSdk', ':lib_network', ':lib_base_im', ':app_qr', ':hmsagents', ':app_user', ':pay', ':shanghaishop' | |
| 1 | +include ':app:strike' | |
| 2 | 2 | //基础库 |
| 3 | 3 | include ':core:base',':core:network',':core:imageload' ,':core:app_qr' |
| 4 | -include ':cloud:user',':cloud:pay' | |
| 5 | -include ':module:xiaojiasoundbox',':module:pedometer',':module:shanghaishop' | |
| 4 | +include ':cloud:user',':cloud:pay',':cloud:share' | |
| 5 | +include ':module:xiaojiasoundbox',':module:pedometer' | |
| 6 | 6 | include ':library_baidumap' |
| 7 | 7 | rootProject.name='ModuleStrike' | ... | ... |