Commit 14ed85cd3b2f26abfed5e79efb454bc8657fa933
Merge branch 'master' of bj.gitlab.cnlive.com:cnlive-team/newModuleStrike
Showing
86 changed files
with
3152 additions
and
106 deletions
app/strike/build.gradle
| @@ -179,6 +179,7 @@ dependencies { | @@ -179,6 +179,7 @@ dependencies { | ||
| 179 | implementation project(path: ':core:imageload') | 179 | implementation project(path: ':core:imageload') |
| 180 | implementation project(path: ':module:xiaojiasoundbox') | 180 | implementation project(path: ':module:xiaojiasoundbox') |
| 181 | implementation project(path: ':module:pedometer') | 181 | implementation project(path: ':module:pedometer') |
| 182 | + implementation project(path: ':module:shopcity') | ||
| 182 | // implementation project(path: ':module:shanghaishop') | 183 | // implementation project(path: ':module:shanghaishop') |
| 183 | implementation project(path: ':library_baidumap') | 184 | implementation project(path: ':library_baidumap') |
| 184 | implementation 'com.jakewharton.rxbinding3:rxbinding:3.1.0' | 185 | implementation 'com.jakewharton.rxbinding3:rxbinding:3.1.0' |
app/strike/src/main/AndroidManifest.xml
| @@ -17,6 +17,8 @@ | @@ -17,6 +17,8 @@ | ||
| 17 | android:roundIcon="@mipmap/ic_launcher_round" | 17 | android:roundIcon="@mipmap/ic_launcher_round" |
| 18 | android:supportsRtl="true" | 18 | android:supportsRtl="true" |
| 19 | android:theme="@style/AppTheme"> | 19 | android:theme="@style/AppTheme"> |
| 20 | + <activity android:name="com.cnlive.strike.demo.activity.HappyChinaActivity"></activity> | ||
| 21 | + | ||
| 20 | <provider | 22 | <provider |
| 21 | android:name="androidx.core.content.FileProvider" | 23 | android:name="androidx.core.content.FileProvider" |
| 22 | android:authorities="${applicationId}.fileprovider" | 24 | android:authorities="${applicationId}.fileprovider" |
| @@ -44,7 +46,6 @@ | @@ -44,7 +46,6 @@ | ||
| 44 | <activity android:name="com.cnlive.strike.demo.activity.DemoActivity" /> | 46 | <activity android:name="com.cnlive.strike.demo.activity.DemoActivity" /> |
| 45 | <activity android:name="com.cnlive.strike.imgutil.ImgActivity" /> | 47 | <activity android:name="com.cnlive.strike.imgutil.ImgActivity" /> |
| 46 | <activity android:name="com.cnlive.strike.MainActivity"> | 48 | <activity android:name="com.cnlive.strike.MainActivity"> |
| 47 | - | ||
| 48 | <intent-filter> | 49 | <intent-filter> |
| 49 | <action android:name="android.intent.action.MAIN" /> | 50 | <action android:name="android.intent.action.MAIN" /> |
| 50 | 51 |
app/strike/src/main/java/com/cnlive/strike/demo/activity/DemoMvpActivity.java
| @@ -8,13 +8,13 @@ import android.text.TextUtils; | @@ -8,13 +8,13 @@ import android.text.TextUtils; | ||
| 8 | import android.view.View; | 8 | import android.view.View; |
| 9 | 9 | ||
| 10 | import androidx.annotation.NonNull; | 10 | import androidx.annotation.NonNull; |
| 11 | -import androidx.annotation.Nullable; | ||
| 12 | import androidx.databinding.ViewDataBinding; | 11 | import androidx.databinding.ViewDataBinding; |
| 13 | 12 | ||
| 14 | import com.alibaba.android.arouter.launcher.ARouter; | 13 | import com.alibaba.android.arouter.launcher.ARouter; |
| 15 | import com.cnlive.cloud.R; | 14 | import com.cnlive.cloud.R; |
| 16 | import com.cnlive.cloud.databinding.ActivityDemoMvpMainBinding; | 15 | import com.cnlive.cloud.databinding.ActivityDemoMvpMainBinding; |
| 17 | import com.cnlive.cloud.user.auth.UserService; | 16 | import com.cnlive.cloud.user.auth.UserService; |
| 17 | +import com.cnlive.cloud.user.ui.activity.BindPhoneMangerActivity; | ||
| 18 | import com.cnlive.cloud.user.ui.activity.FirstLoginActivity; | 18 | import com.cnlive.cloud.user.ui.activity.FirstLoginActivity; |
| 19 | import com.cnlive.cloud.user.ui.activity.LoginActivity; | 19 | import com.cnlive.cloud.user.ui.activity.LoginActivity; |
| 20 | import com.cnlive.cloud.user.ui.activity.LoginDialogActivity; | 20 | import com.cnlive.cloud.user.ui.activity.LoginDialogActivity; |
| @@ -29,15 +29,16 @@ import com.cnlive.core.libs.base.util.AlertUtil; | @@ -29,15 +29,16 @@ import com.cnlive.core.libs.base.util.AlertUtil; | ||
| 29 | import com.cnlive.core.libs.base.util.OpenServiceHelpUtil; | 29 | import com.cnlive.core.libs.base.util.OpenServiceHelpUtil; |
| 30 | import com.cnlive.core.libs.base.util.QMUITipDialogUtil; | 30 | import com.cnlive.core.libs.base.util.QMUITipDialogUtil; |
| 31 | import com.cnlive.core.libs.base.util.StatusBarConfig; | 31 | import com.cnlive.core.libs.base.util.StatusBarConfig; |
| 32 | +import com.cnlive.core.libs.base.util.ToastUtil; | ||
| 32 | import com.cnlive.core.network.HttpConn; | 33 | import com.cnlive.core.network.HttpConn; |
| 33 | import com.cnlive.core.network.NetCallBack; | 34 | import com.cnlive.core.network.NetCallBack; |
| 34 | import com.cnlive.core.network.model.BaseResult; | 35 | import com.cnlive.core.network.model.BaseResult; |
| 35 | import com.cnlive.core.network.request.BaseRequest; | 36 | import com.cnlive.core.network.request.BaseRequest; |
| 37 | +import com.cnlive.module.shop.ui.activity.ShopHomeActivity; | ||
| 36 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | 38 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; |
| 37 | import com.cnlive.moudle.pedometer.ui.activity.RunLineActivity; | 39 | import com.cnlive.moudle.pedometer.ui.activity.RunLineActivity; |
| 38 | import com.cnlive.strike.demo.activity.presenter.DemoActivityPresenter; | 40 | import com.cnlive.strike.demo.activity.presenter.DemoActivityPresenter; |
| 39 | import com.cnlive.strike.demo.activity.view.DemoActivityView; | 41 | import com.cnlive.strike.demo.activity.view.DemoActivityView; |
| 40 | -import com.cnlive.strike.demo.exoplayer.demo.PlayerActivity; | ||
| 41 | import com.cnlive.strike.demo.exoplayer.demo.SampleChooserActivity; | 42 | import com.cnlive.strike.demo.exoplayer.demo.SampleChooserActivity; |
| 42 | import com.cnlive.strike.network.api.ApiService; | 43 | import com.cnlive.strike.network.api.ApiService; |
| 43 | import com.cnlive.strike.network.api.ApiTimeService; | 44 | import com.cnlive.strike.network.api.ApiTimeService; |
| @@ -87,6 +88,10 @@ public class DemoMvpActivity extends BaseActivity<DemoActivityView, DemoActivity | @@ -87,6 +88,10 @@ public class DemoMvpActivity extends BaseActivity<DemoActivityView, DemoActivity | ||
| 87 | overridePendingTransition(R.anim.activity_in, R.anim.activity_out); | 88 | overridePendingTransition(R.anim.activity_in, R.anim.activity_out); |
| 88 | } | 89 | } |
| 89 | }); | 90 | }); |
| 91 | + | ||
| 92 | + //绑定管理 | ||
| 93 | + binding.btnLoginBingding.setOnClickListener(view -> BindPhoneMangerActivity.startActivity(DemoMvpActivity.this)); | ||
| 94 | + | ||
| 90 | //新用户头像设置 | 95 | //新用户头像设置 |
| 91 | binding.btnNewUserFace.setOnClickListener(new View.OnClickListener() { | 96 | binding.btnNewUserFace.setOnClickListener(new View.OnClickListener() { |
| 92 | @Override | 97 | @Override |
| @@ -145,6 +150,13 @@ public class DemoMvpActivity extends BaseActivity<DemoActivityView, DemoActivity | @@ -145,6 +150,13 @@ public class DemoMvpActivity extends BaseActivity<DemoActivityView, DemoActivity | ||
| 145 | // UserService.getInstance(me).getAppAccount().getFaceUrl()); | 150 | // UserService.getInstance(me).getAppAccount().getFaceUrl()); |
| 146 | } | 151 | } |
| 147 | }); | 152 | }); |
| 153 | + | ||
| 154 | + //二部电商首页 | ||
| 155 | + binding.btnShopcity.setOnClickListener(view -> { | ||
| 156 | + AlertUtil.showDeftToast(DemoMvpActivity.this,"商城部分版本待升级适配"); | ||
| 157 | +// startActivity(new Intent(DemoMvpActivity.this, ShopHomeActivity.class)); | ||
| 158 | + }); | ||
| 159 | + | ||
| 148 | //获取Handler,onDestory自动解除 | 160 | //获取Handler,onDestory自动解除 |
| 149 | binding.btnHandler.setOnClickListener(new View.OnClickListener() { | 161 | binding.btnHandler.setOnClickListener(new View.OnClickListener() { |
| 150 | @Override | 162 | @Override |
app/strike/src/main/java/com/cnlive/strike/demo/activity/HappyChinaActivity.java
0 → 100644
| 1 | +package com.cnlive.strike.demo.activity; | ||
| 2 | + | ||
| 3 | +import androidx.appcompat.app.AppCompatActivity; | ||
| 4 | + | ||
| 5 | +import android.graphics.Color; | ||
| 6 | +import android.os.Bundle; | ||
| 7 | + | ||
| 8 | +import com.cnlive.cloud.R; | ||
| 9 | +import com.cnlive.core.libs.base.util.StatusBarUtil; | ||
| 10 | +import com.cnlive.module.common.utils.SystemBarUtils; | ||
| 11 | +import com.cnlive.strike.happychina.event.HappyChinaColorChangeEvent; | ||
| 12 | +import com.cnlive.strike.happychina.ui.fragment.HappyChinaFragment; | ||
| 13 | + | ||
| 14 | +import org.greenrobot.eventbus.EventBus; | ||
| 15 | +import org.greenrobot.eventbus.Subscribe; | ||
| 16 | +import org.greenrobot.eventbus.ThreadMode; | ||
| 17 | + | ||
| 18 | +public class HappyChinaActivity extends AppCompatActivity { | ||
| 19 | + | ||
| 20 | + @Override | ||
| 21 | + protected void onCreate(Bundle savedInstanceState) { | ||
| 22 | + super.onCreate(savedInstanceState); | ||
| 23 | + setContentView(R.layout.activity_happy_china); | ||
| 24 | + SystemBarUtils.setStatusBarColor(this, Color.WHITE); | ||
| 25 | + StatusBarUtil.setStatusBarWrite(this); | ||
| 26 | + EventBus.getDefault().register(this); | ||
| 27 | + | ||
| 28 | + getSupportFragmentManager().beginTransaction().replace(R.id.mFrameLayout, HappyChinaFragment.newInstance(false)).commit(); | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + @Override | ||
| 32 | + protected void onDestroy() { | ||
| 33 | + super.onDestroy(); | ||
| 34 | + EventBus.getDefault().unregister(this); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + @Subscribe(threadMode = ThreadMode.MAIN) | ||
| 38 | + public void onHappyChinaColorChange(HappyChinaColorChangeEvent event) { | ||
| 39 | + // 字段说明: | ||
| 40 | + // backgroundColor:背景颜色,可能为null | ||
| 41 | + // statusBarMode:状态栏文字颜色,可能为null | ||
| 42 | + // selectedTextColor:选中的文字颜色,可能为null | ||
| 43 | + // otherTextColor:未选中的文字颜色,可能为null | ||
| 44 | + } | ||
| 45 | +} |
app/strike/src/main/res/layout/activity_demo_mvp_main.xml
| @@ -30,6 +30,12 @@ | @@ -30,6 +30,12 @@ | ||
| 30 | android:text="登录对话框" /> | 30 | android:text="登录对话框" /> |
| 31 | 31 | ||
| 32 | <Button | 32 | <Button |
| 33 | + android:id="@+id/btn_login_bingding" | ||
| 34 | + android:layout_width="match_parent" | ||
| 35 | + android:layout_height="wrap_content" | ||
| 36 | + android:text="账号三方绑定管理"/> | ||
| 37 | + | ||
| 38 | + <Button | ||
| 33 | android:id="@+id/btn_new_user_face" | 39 | android:id="@+id/btn_new_user_face" |
| 34 | android:layout_width="match_parent" | 40 | android:layout_width="match_parent" |
| 35 | android:layout_height="wrap_content" | 41 | android:layout_height="wrap_content" |
| @@ -65,6 +71,13 @@ | @@ -65,6 +71,13 @@ | ||
| 65 | android:text="路径工具" /> | 71 | android:text="路径工具" /> |
| 66 | 72 | ||
| 67 | <Button | 73 | <Button |
| 74 | + android:id="@+id/btn_shopcity" | ||
| 75 | + android:layout_width="match_parent" | ||
| 76 | + android:layout_height="wrap_content" | ||
| 77 | + android:layout_margin="5dp" | ||
| 78 | + android:text="二部商城首页" /> | ||
| 79 | + | ||
| 80 | + <Button | ||
| 68 | android:id="@+id/btn_handler" | 81 | android:id="@+id/btn_handler" |
| 69 | android:layout_width="match_parent" | 82 | android:layout_width="match_parent" |
| 70 | android:layout_height="wrap_content" | 83 | android:layout_height="wrap_content" |
app/strike/src/main/res/layout/activity_happy_china.xml
0 → 100644
app/strike/src/main/res/values/strings.xml
| 1 | -<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | -<!-- Copyright (C) 2016 The Android Open Source Project | 1 | +<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2016 The Android Open Source Project |
| 3 | 2 | ||
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); | 3 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | you may not use this file except in compliance with the License. | 4 | you may not use this file except in compliance with the License. |
| @@ -15,62 +14,62 @@ | @@ -15,62 +14,62 @@ | ||
| 15 | --> | 14 | --> |
| 16 | <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> | 15 | <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> |
| 17 | 16 | ||
| 18 | - <string name="application_name">ExoPlayer</string> | 17 | + <string name="application_name">ExoPlayer</string> |
| 19 | 18 | ||
| 20 | - <string name="track_selection_title">Select tracks</string> | 19 | + <string name="track_selection_title">Select tracks</string> |
| 21 | 20 | ||
| 22 | - <string name="unexpected_intent_action">Unexpected intent action: <xliff:g id="action">%1$s</xliff:g></string> | 21 | + <string name="unexpected_intent_action">Unexpected intent action: <xliff:g id="action">%1$s</xliff:g></string> |
| 23 | 22 | ||
| 24 | - <string name="error_cleartext_not_permitted">Cleartext traffic not permitted</string> | 23 | + <string name="error_cleartext_not_permitted">Cleartext traffic not permitted</string> |
| 25 | 24 | ||
| 26 | - <string name="error_generic">Playback failed</string> | 25 | + <string name="error_generic">Playback failed</string> |
| 27 | 26 | ||
| 28 | - <string name="error_unrecognized_abr_algorithm">Unrecognized ABR algorithm</string> | 27 | + <string name="error_unrecognized_abr_algorithm">Unrecognized ABR algorithm</string> |
| 29 | 28 | ||
| 30 | - <string name="error_unrecognized_stereo_mode">Unrecognized stereo mode</string> | 29 | + <string name="error_unrecognized_stereo_mode">Unrecognized stereo mode</string> |
| 31 | 30 | ||
| 32 | - <string name="error_drm_unsupported_before_api_18">Protected content not supported on API levels below 18</string> | 31 | + <string name="error_drm_unsupported_before_api_18">Protected content not supported on API levels below 18</string> |
| 33 | 32 | ||
| 34 | - <string name="error_drm_unsupported_scheme">This device does not support the required DRM scheme</string> | 33 | + <string name="error_drm_unsupported_scheme">This device does not support the required DRM scheme</string> |
| 35 | 34 | ||
| 36 | - <string name="error_drm_unknown">An unknown DRM error occurred</string> | 35 | + <string name="error_drm_unknown">An unknown DRM error occurred</string> |
| 37 | 36 | ||
| 38 | - <string name="error_no_decoder">This device does not provide a decoder for <xliff:g id="mime_type">%1$s</xliff:g></string> | 37 | + <string name="error_no_decoder">This device does not provide a decoder for <xliff:g id="mime_type">%1$s</xliff:g></string> |
| 39 | 38 | ||
| 40 | - <string name="error_no_secure_decoder">This device does not provide a secure decoder for <xliff:g id="mime_type">%1$s</xliff:g></string> | 39 | + <string name="error_no_secure_decoder">This device does not provide a secure decoder for <xliff:g id="mime_type">%1$s</xliff:g></string> |
| 41 | 40 | ||
| 42 | - <string name="error_querying_decoders">Unable to query device decoders</string> | 41 | + <string name="error_querying_decoders">Unable to query device decoders</string> |
| 43 | 42 | ||
| 44 | - <string name="error_instantiating_decoder">Unable to instantiate decoder <xliff:g id="decoder_name">%1$s</xliff:g></string> | 43 | + <string name="error_instantiating_decoder">Unable to instantiate decoder <xliff:g id="decoder_name">%1$s</xliff:g></string> |
| 45 | 44 | ||
| 46 | - <string name="error_unsupported_video">Media includes video tracks, but none are playable by this device</string> | 45 | + <string name="error_unsupported_video">Media includes video tracks, but none are playable by this device</string> |
| 47 | 46 | ||
| 48 | - <string name="error_unsupported_audio">Media includes audio tracks, but none are playable by this device</string> | 47 | + <string name="error_unsupported_audio">Media includes audio tracks, but none are playable by this device</string> |
| 49 | 48 | ||
| 50 | - <string name="storage_permission_denied">Permission to access storage was denied</string> | 49 | + <string name="storage_permission_denied">Permission to access storage was denied</string> |
| 51 | 50 | ||
| 52 | - <string name="sample_list_load_error">One or more sample lists failed to load</string> | 51 | + <string name="sample_list_load_error">One or more sample lists failed to load</string> |
| 53 | 52 | ||
| 54 | - <string name="ima_not_loaded">Playing sample without ads, as the IMA extension was not loaded</string> | 53 | + <string name="ima_not_loaded">Playing sample without ads, as the IMA extension was not loaded</string> |
| 55 | 54 | ||
| 56 | - <string name="unsupported_ads_in_concatenation">Playing sample without ads, as ads are not supported in concatenations</string> | 55 | + <string name="unsupported_ads_in_concatenation">Playing sample without ads, as ads are not supported in concatenations</string> |
| 57 | 56 | ||
| 58 | - <string name="download_start_error">Failed to start download</string> | 57 | + <string name="download_start_error">Failed to start download</string> |
| 59 | 58 | ||
| 60 | - <string name="download_playlist_unsupported">This demo app does not support downloading playlists</string> | 59 | + <string name="download_playlist_unsupported">This demo app does not support downloading playlists</string> |
| 61 | 60 | ||
| 62 | - <string name="download_drm_unsupported">This demo app does not support downloading protected content</string> | 61 | + <string name="download_drm_unsupported">This demo app does not support downloading protected content</string> |
| 63 | 62 | ||
| 64 | - <string name="download_scheme_unsupported">This demo app only supports downloading http streams</string> | 63 | + <string name="download_scheme_unsupported">This demo app only supports downloading http streams</string> |
| 65 | 64 | ||
| 66 | - <string name="download_live_unsupported">This demo app does not support downloading live content</string> | 65 | + <string name="download_live_unsupported">This demo app does not support downloading live content</string> |
| 67 | 66 | ||
| 68 | - <string name="download_ads_unsupported">IMA does not support offline ads</string> | 67 | + <string name="download_ads_unsupported">IMA does not support offline ads</string> |
| 69 | 68 | ||
| 70 | - <string name="prefer_extension_decoders">Prefer extension decoders</string> | 69 | + <string name="prefer_extension_decoders">Prefer extension decoders</string> |
| 71 | 70 | ||
| 72 | - <string name="random_abr">Enable random ABR</string> | 71 | + <string name="random_abr">Enable random ABR</string> |
| 73 | 72 | ||
| 74 | - <string name="tunneling">Request multimedia tunneling</string> | 73 | + <string name="tunneling">Request multimedia tunneling</string> |
| 75 | 74 | ||
| 76 | </resources> | 75 | </resources> |
build.gradle
| @@ -139,7 +139,15 @@ allprojects { | @@ -139,7 +139,15 @@ allprojects { | ||
| 139 | url 'http://android.nexus.cnlive.com/repository/cnlive-shop/' | 139 | url 'http://android.nexus.cnlive.com/repository/cnlive-shop/' |
| 140 | credentials { username = 'shop'; password = 'ShangHa1' } | 140 | credentials { username = 'shop'; password = 'ShangHa1' } |
| 141 | } | 141 | } |
| 142 | - //------------------ 资源库配置 END------------------ | 142 | + |
| 143 | + // 技术2部仓库地址 | ||
| 144 | + maven { | ||
| 145 | + url 'http://wjjshop.cnlive.com:9188/repository/cnlive-modules/' | ||
| 146 | + credentials { username = "cnlive-android"; password = "cnlive123" } | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + maven { url 'https://dl.bintray.com/granzon/cnliveLibs' }// 技术2部幸福中国依赖 | ||
| 150 | + //------------------ 资源库配置 recyclerviewAnimatorsEND------------------ | ||
| 143 | maven { url 'https://dl.bintray.com/umsdk/release' } | 151 | maven { url 'https://dl.bintray.com/umsdk/release' } |
| 144 | //关联微博 | 152 | //关联微博 |
| 145 | maven { url "https://dl.bintray.com/thelasterstar/maven/" } | 153 | maven { url "https://dl.bintray.com/thelasterstar/maven/" } |
| @@ -183,4 +191,14 @@ ext { | @@ -183,4 +191,14 @@ ext { | ||
| 183 | //七牛 | 191 | //七牛 |
| 184 | qiniuAndroidSdk = '7.3.11' | 192 | qiniuAndroidSdk = '7.3.11' |
| 185 | libUpload = '2.0.6' | 193 | libUpload = '2.0.6' |
| 194 | + circleimageview = '3.0.1' | ||
| 195 | + libMenu = '1.0.8' | ||
| 196 | + appArch = '1.2.8' | ||
| 197 | + imsdk = '3.3.2.14394.14395' | ||
| 198 | + recyclerviewAnimators = '2.2.6' | ||
| 199 | + | ||
| 200 | + //视讯云相关 | ||
| 201 | + libCnUtil = '3.1.5' | ||
| 186 | } | 202 | } |
| 203 | + | ||
| 204 | + |
cloud/app_pay/.gitignore
0 → 100644
| 1 | +/build |
cloud/app_pay/build.gradle
0 → 100644
| 1 | +apply plugin: 'com.android.library' | ||
| 2 | + | ||
| 3 | +android { | ||
| 4 | + compileSdkVersion 29 | ||
| 5 | + buildToolsVersion "29.0.2" | ||
| 6 | + | ||
| 7 | + | ||
| 8 | + defaultConfig { | ||
| 9 | + minSdkVersion 16 | ||
| 10 | + targetSdkVersion 29 | ||
| 11 | + versionCode 1 | ||
| 12 | + versionName "1.0" | ||
| 13 | + | ||
| 14 | + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
| 15 | + consumerProguardFiles 'consumer-rules.pro' | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + buildTypes { | ||
| 19 | + release { | ||
| 20 | + minifyEnabled false | ||
| 21 | + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
| 22 | + } | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | +dependencies { | ||
| 28 | + implementation fileTree(include: ['*.jar'], dir: 'libs') | ||
| 29 | + implementation 'androidx.appcompat:appcompat:1.0.2' | ||
| 30 | + testImplementation 'junit:junit:4.12' | ||
| 31 | + androidTestImplementation 'androidx.test:runner:1.1.1' | ||
| 32 | + androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' | ||
| 33 | + //视讯云SDK | ||
| 34 | + implementation "com.cnlive:lib_cnutil:$rootProject.libCnUtil" | ||
| 35 | + implementation 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:5.3.1' | ||
| 36 | + implementation files('libs/alipaySdk-20180601.jar') | ||
| 37 | + implementation files('libs/UPPayAssistEx.jar') | ||
| 38 | +} |
cloud/app_pay/consumer-rules.pro
0 → 100644
cloud/app_pay/libs/UPPayAssistEx.jar
0 → 100644
No preview for this file type
cloud/app_pay/libs/UPPayPluginExPro.jar
0 → 100644
No preview for this file type
cloud/app_pay/libs/alipaySdk-20180601.jar
0 → 100644
No preview for this file type
cloud/app_pay/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/app_pay/src/androidTest/java/com/cnlive/strike/pay/ExampleInstrumentedTest.java
0 → 100644
| 1 | +package com.cnlive.strike.pay; | ||
| 2 | + | ||
| 3 | +import android.content.Context; | ||
| 4 | + | ||
| 5 | +import androidx.test.platform.app.InstrumentationRegistry; | ||
| 6 | +import androidx.test.ext.junit.runners.AndroidJUnit4; | ||
| 7 | + | ||
| 8 | +import org.junit.Test; | ||
| 9 | +import org.junit.runner.RunWith; | ||
| 10 | + | ||
| 11 | +import static org.junit.Assert.*; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * Instrumented test, which will execute on an Android device. | ||
| 15 | + * | ||
| 16 | + * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
| 17 | + */ | ||
| 18 | +@RunWith(AndroidJUnit4.class) | ||
| 19 | +public class ExampleInstrumentedTest { | ||
| 20 | + @Test | ||
| 21 | + public void useAppContext() { | ||
| 22 | + // Context of the app under test. | ||
| 23 | + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); | ||
| 24 | + | ||
| 25 | + assertEquals("com.cnlive.strike.pay.test", appContext.getPackageName()); | ||
| 26 | + } | ||
| 27 | +} |
cloud/app_pay/src/main/AndroidManifest.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 3 | + package="com.cnlive.strike.pay"> | ||
| 4 | + | ||
| 5 | + <uses-permission android:name="android.permission.INTERNET" /> | ||
| 6 | + <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
| 7 | + <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | ||
| 8 | + <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | ||
| 9 | + <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | ||
| 10 | + | ||
| 11 | + <!--union pay permission start--> | ||
| 12 | + <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> | ||
| 13 | + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | ||
| 14 | + <uses-permission android:name="android.permission.READ_PHONE_STATE" /> | ||
| 15 | + <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | ||
| 16 | + <uses-permission android:name="android.permission.NFC" /> | ||
| 17 | + | ||
| 18 | + <uses-feature android:name="android.hardware.nfc.hce" /> | ||
| 19 | + <uses-permission android:name="org.simalliance.openmobileapi.SMARTCARD" /> | ||
| 20 | + <!--union pay permission end--> | ||
| 21 | + | ||
| 22 | + <application> | ||
| 23 | + | ||
| 24 | + <!--支付宝支付 --> | ||
| 25 | + <activity | ||
| 26 | + android:name="com.alipay.sdk.app.H5PayActivity" | ||
| 27 | + android:screenOrientation="portrait" /> | ||
| 28 | + | ||
| 29 | + | ||
| 30 | + <!--union pay start--> | ||
| 31 | + <uses-library | ||
| 32 | + android:name="org.simalliance.openmobileapi" | ||
| 33 | + android:required="false" /> | ||
| 34 | + | ||
| 35 | + <activity | ||
| 36 | + android:name="com.unionpay.uppay.PayActivity" | ||
| 37 | + android:configChanges="orientation|keyboardHidden" | ||
| 38 | + android:excludeFromRecents="true" | ||
| 39 | + android:label="@string/app_name" | ||
| 40 | + android:screenOrientation="portrait" | ||
| 41 | + android:windowSoftInputMode="adjustResize" /> | ||
| 42 | + | ||
| 43 | + <activity | ||
| 44 | + android:name="com.unionpay.UPPayWapActivity" | ||
| 45 | + android:configChanges="orientation|keyboardHidden" | ||
| 46 | + android:screenOrientation="portrait" | ||
| 47 | + android:windowSoftInputMode="adjustResize" /> | ||
| 48 | + <!--union pay end--> | ||
| 49 | + | ||
| 50 | + </application> | ||
| 51 | + | ||
| 52 | +</manifest> | ||
| 0 | \ No newline at end of file | 53 | \ No newline at end of file |
cloud/app_pay/src/main/assets/data.bin
0 → 100644
No preview for this file type
cloud/app_pay/src/main/java/com/cnlive/strike/pay/IPay.java
0 → 100644
| 1 | +package com.cnlive.strike.pay; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * Created by gujun on 2017/5/2. | ||
| 5 | + */ | ||
| 6 | + | ||
| 7 | +public interface IPay { | ||
| 8 | + int PAY_TYPE_ALI = 3; | ||
| 9 | + int PAY_TYPE_WX = 1; | ||
| 10 | + int PAY_TYPE_UNION = 9; | ||
| 11 | + | ||
| 12 | + int ERR_WX_UNKNOWN = 0; | ||
| 13 | + int ERR_WX_COMM = -1; | ||
| 14 | + int ERR_WX_USER_CANCEL = -2; | ||
| 15 | + int ERR_WX_SENT_FAILED = -3; | ||
| 16 | + int ERR_WX_AUTH_DENIED = -4; | ||
| 17 | + int ERR_WX_UNSUPPORT = -5; | ||
| 18 | + int ERR_WX_NOT_INSTALLED = -6; | ||
| 19 | + | ||
| 20 | + String ERR_MSG_WX_UNKNOWN = "未知错误"; | ||
| 21 | + String ERR_MSG_WX_COMM = "支付失败,可能的原因:签名错误、未注册APPID、项目设置APPID不正确、注册的APPID与设置的不匹配、其他异常等。"; | ||
| 22 | + String ERR_MSG_WX_USER_CANCEL = "用户取消,无需处理。发生场景:用户不支付了,点击取消,返回APP。"; | ||
| 23 | + String ERR_MSG_WX_SENT_FAILED = "发送失败"; | ||
| 24 | + String ERR_MSG_WX_AUTH_DENIED = "鉴权失败"; | ||
| 25 | + String ERR_MSG_WX_UNSUPPORT = "不支持错误"; | ||
| 26 | + String ERR_MSG_WX_NOT_INSTALLED = "未发现微信客户端"; | ||
| 27 | + | ||
| 28 | + int ERR_ALI_RESULT_DOING = -10; | ||
| 29 | + int ERR_ALI_FAIL = -11; | ||
| 30 | + int ERR_ALI_CANCEL = -12; | ||
| 31 | + int ERR_ALI_NET = -13; | ||
| 32 | + int ERR_ALI_UNKNOWN = -14; | ||
| 33 | + int ERR_ALI_OTHER = -15; | ||
| 34 | + | ||
| 35 | + String ERR_MSG_ALI_RESULT_DOING = "正在处理中,支付结果未知(有可能已经支付成功),请查询商户订单列表中订单的支付状态"; | ||
| 36 | + String ERR_MSG_ALI_FAIL = "订单支付失败"; | ||
| 37 | + String ERR_MSG_ALI_CANCEL = "用户中途取消"; | ||
| 38 | + String ERR_MSG_ALI_NET = "网络连接出错"; | ||
| 39 | + String ERR_MSG_ALI_UNKNOWN = "支付结果未知(有可能已经支付成功),请查询商户订单列表中订单的支付状态"; | ||
| 40 | + String ERR_MSG_ALI_OTHER = " 其它支付错误"; | ||
| 41 | + | ||
| 42 | + int ERR_UNION_FAIL = -31; | ||
| 43 | + int ERR_UNION_CANCEL = -32; | ||
| 44 | + String ERR_MSG_UNION_FAIL = "订单支付失败"; | ||
| 45 | + String ERR_MSG_UNION_CANCEL = "用户中途取消"; | ||
| 46 | + String ERR_MSG_UNION_PAY_DATA_NULL = "银联支付回调的data异常"; | ||
| 47 | + | ||
| 48 | + int ERR_UNSUPPORT = -20; | ||
| 49 | + int ERR_PREPAY = -21; | ||
| 50 | + int ERR_PREPAY_RESULT = -22; | ||
| 51 | + int ERR_PREPAY_NET = -23; | ||
| 52 | + | ||
| 53 | + String ERR_MSG_UNSUPPORT = "暂不支持此支付方式"; | ||
| 54 | + String ERR_MSG_PREPAY = "预支付接口请求失败"; | ||
| 55 | + String ERR_MSG_PREPAY_RESULT = "预支付接口返回错误信息"; | ||
| 56 | + String ERR_MSG_PREPAY_NET = "网络连接出错"; | ||
| 57 | + | ||
| 58 | + String PROBE_WX = "weixin"; | ||
| 59 | + String PROBE_ALI = "ali"; | ||
| 60 | + String PROBE_UNION = "union"; | ||
| 61 | + String PROBE_PAY_STATE_SUCCESS = "success"; | ||
| 62 | + String PROBE_PAY_STATE_FAIL = "fail"; | ||
| 63 | + String PROBE_PAY_STATE_CANCEL = "cancel"; | ||
| 64 | + | ||
| 65 | +} |
cloud/app_pay/src/main/java/com/cnlive/strike/pay/PayStatusCallback.java
0 → 100644
| 1 | +package com.cnlive.strike.pay; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * Created by gujun on 2017/5/2. | ||
| 5 | + * 支付sdk回调 | ||
| 6 | + */ | ||
| 7 | + | ||
| 8 | +public interface PayStatusCallback { | ||
| 9 | + void onStartCallPayPage(int payType); | ||
| 10 | + | ||
| 11 | + void onSuccess(int payType); | ||
| 12 | + | ||
| 13 | + void onFail(int payType, int errorCode, String errorMsg); | ||
| 14 | +} |
cloud/app_pay/src/main/java/com/cnlive/strike/pay/PayToALi.java
0 → 100644
| 1 | +package com.cnlive.strike.pay; | ||
| 2 | + | ||
| 3 | +import android.annotation.SuppressLint; | ||
| 4 | +import android.app.Activity; | ||
| 5 | +import android.os.Handler; | ||
| 6 | +import android.os.Message; | ||
| 7 | +import android.text.TextUtils; | ||
| 8 | +import android.util.Log; | ||
| 9 | + | ||
| 10 | +import com.alipay.sdk.app.PayTask; | ||
| 11 | +import com.cnlive.strike.pay.model.AliPayResult; | ||
| 12 | +import com.cnlive.strike.pay.model.PayCloudResponse; | ||
| 13 | +import com.cnlive.strike.pay.model.Result; | ||
| 14 | + | ||
| 15 | +/** | ||
| 16 | + * Created by gujun on 2017/5/2. | ||
| 17 | + */ | ||
| 18 | +public class PayToALi { | ||
| 19 | + private static final String TAG = "PayToALi"; | ||
| 20 | + | ||
| 21 | + private static final int SDK_PAY_FLAG = 1; | ||
| 22 | + | ||
| 23 | + public static void startPay(final Activity activity, final PayCloudResponse payCloudResponse, final String appOrderId) { | ||
| 24 | + | ||
| 25 | + PayStatusCallback payStatusCallback = PayUtil.getPayCallback(appOrderId); | ||
| 26 | + | ||
| 27 | + if (payCloudResponse == null || payCloudResponse.getData() == null || TextUtils.isEmpty(payCloudResponse.getData().getAlipay_app())) { | ||
| 28 | + if (payStatusCallback != null) | ||
| 29 | + payStatusCallback.onFail(IPay.PAY_TYPE_ALI, IPay.ERR_PREPAY_RESULT, IPay.ERR_MSG_PREPAY_RESULT + payCloudResponse.toString()); | ||
| 30 | + | ||
| 31 | + PayUtil.probeApp(appOrderId, IPay.PAY_TYPE_ALI, IPay.PROBE_PAY_STATE_FAIL); | ||
| 32 | + return; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + if (payStatusCallback != null) | ||
| 36 | + payStatusCallback.onStartCallPayPage(IPay.PAY_TYPE_ALI); | ||
| 37 | + | ||
| 38 | + try { | ||
| 39 | + //签名拼接支付信息操作交由后台 | ||
| 40 | + Log.d(TAG, "ExternalPartner start pay "); | ||
| 41 | + | ||
| 42 | + // start the pay. | ||
| 43 | + Runnable payRunnable = new Runnable() { | ||
| 44 | + @Override | ||
| 45 | + public void run() { | ||
| 46 | + PayTask alipay = new PayTask(activity); | ||
| 47 | + String result = alipay.pay(payCloudResponse.getData().getAlipay_app(), true); | ||
| 48 | + | ||
| 49 | + Message msg = new Message(); | ||
| 50 | + msg.what = SDK_PAY_FLAG; | ||
| 51 | + msg.obj = new AliPayResult(appOrderId, result); | ||
| 52 | + alipayHandler.sendMessage(msg); | ||
| 53 | + } | ||
| 54 | + }; | ||
| 55 | + | ||
| 56 | + Thread payThread = new Thread(payRunnable); | ||
| 57 | + payThread.start(); | ||
| 58 | + | ||
| 59 | + } catch (Exception ex) { | ||
| 60 | + | ||
| 61 | + if (payStatusCallback != null) | ||
| 62 | + payStatusCallback.onFail(IPay.PAY_TYPE_ALI, IPay.ERR_ALI_OTHER, IPay.ERR_MSG_ALI_OTHER + (ex != null ? ex.getMessage() : "调用支付宝支付方法异常")); | ||
| 63 | + PayUtil.probeApp(appOrderId, IPay.PAY_TYPE_ALI, IPay.PROBE_PAY_STATE_FAIL); | ||
| 64 | + if (ex!=null) | ||
| 65 | + Log.e(TAG, "alipay error".concat(ex.getMessage()), ex); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + // ============================================================================================ | ||
| 71 | + // 支付宝不用动的 | ||
| 72 | + // ============================================================================================ | ||
| 73 | + @SuppressLint("HandlerLeak") | ||
| 74 | + private static Handler alipayHandler = new Handler() { | ||
| 75 | + @Override | ||
| 76 | + public void handleMessage(Message msg) { | ||
| 77 | + switch (msg.what) { | ||
| 78 | + case SDK_PAY_FLAG: | ||
| 79 | + AliPayResult aliPayResult = (AliPayResult) msg.obj; | ||
| 80 | + String orderId = aliPayResult.getOrderId(); | ||
| 81 | + | ||
| 82 | + Result resultObj = new Result(aliPayResult.getResult()); | ||
| 83 | + String resultStatus = resultObj.resultStatus; | ||
| 84 | + | ||
| 85 | + PayStatusCallback payStatusCallback = PayUtil.getPayCallback(orderId); | ||
| 86 | + | ||
| 87 | + // 判断resultStatus 为“9000”则代表支付成功,具体状态码代表含义可参考接口文档 | ||
| 88 | + if (resultStatus.equals("9000")) { | ||
| 89 | + if (payStatusCallback != null) | ||
| 90 | + payStatusCallback.onSuccess(IPay.PAY_TYPE_ALI); | ||
| 91 | + PayUtil.probeApp(orderId, IPay.PAY_TYPE_ALI, IPay.PROBE_PAY_STATE_SUCCESS); | ||
| 92 | + } else { | ||
| 93 | + if (resultStatus.equals("8000")) { | ||
| 94 | + //正在处理中,支付结果未知(有可能已经支付成功),请查询商户订单列表中订单的支付状态 | ||
| 95 | + if (payStatusCallback != null) | ||
| 96 | + payStatusCallback.onFail(IPay.PAY_TYPE_ALI, IPay.ERR_ALI_RESULT_DOING, IPay.ERR_MSG_ALI_RESULT_DOING); | ||
| 97 | + PayUtil.probeApp(orderId, IPay.PAY_TYPE_ALI, IPay.PROBE_PAY_STATE_FAIL); | ||
| 98 | + } else if (resultStatus.equals("4000")) { | ||
| 99 | + //订单支付失败 | ||
| 100 | + if (payStatusCallback != null) | ||
| 101 | + payStatusCallback.onFail(IPay.PAY_TYPE_ALI, IPay.ERR_ALI_FAIL, IPay.ERR_MSG_ALI_FAIL); | ||
| 102 | + PayUtil.probeApp(orderId, IPay.PAY_TYPE_ALI, IPay.PROBE_PAY_STATE_FAIL); | ||
| 103 | + } else if (resultStatus.equals("6001")) { | ||
| 104 | + //用户中途取消 | ||
| 105 | + if (payStatusCallback != null) | ||
| 106 | + payStatusCallback.onFail(IPay.PAY_TYPE_ALI, IPay.ERR_ALI_CANCEL, IPay.ERR_MSG_ALI_CANCEL); | ||
| 107 | + PayUtil.probeApp(orderId, IPay.PAY_TYPE_ALI, IPay.PROBE_PAY_STATE_CANCEL); | ||
| 108 | + } else if (resultStatus.equals("6002")) { | ||
| 109 | + //网络连接出错 | ||
| 110 | + if (payStatusCallback != null) | ||
| 111 | + payStatusCallback.onFail(IPay.PAY_TYPE_ALI, IPay.ERR_ALI_NET, IPay.ERR_MSG_ALI_NET); | ||
| 112 | + PayUtil.probeApp(orderId, IPay.PAY_TYPE_ALI, IPay.PROBE_PAY_STATE_FAIL); | ||
| 113 | + } else if (resultStatus.equals("6004")) { | ||
| 114 | + //支付结果未知(有可能已经支付成功),请查询商户订单列表中订单的支付状态 | ||
| 115 | + if (payStatusCallback != null) | ||
| 116 | + payStatusCallback.onFail(IPay.PAY_TYPE_ALI, IPay.ERR_ALI_UNKNOWN, IPay.ERR_MSG_ALI_UNKNOWN); | ||
| 117 | + PayUtil.probeApp(orderId, IPay.PAY_TYPE_ALI, IPay.PROBE_PAY_STATE_FAIL); | ||
| 118 | + } else { | ||
| 119 | + //其它支付错误 | ||
| 120 | + if (payStatusCallback != null) | ||
| 121 | + payStatusCallback.onFail(IPay.PAY_TYPE_ALI, IPay.ERR_ALI_OTHER, IPay.ERR_MSG_ALI_OTHER); | ||
| 122 | + PayUtil.probeApp(orderId, IPay.PAY_TYPE_ALI, IPay.PROBE_PAY_STATE_FAIL); | ||
| 123 | + } | ||
| 124 | + } | ||
| 125 | + PayUtil.removePayCallback(orderId); | ||
| 126 | + break; | ||
| 127 | + default: | ||
| 128 | + break; | ||
| 129 | + } | ||
| 130 | + } | ||
| 131 | + }; | ||
| 132 | + | ||
| 133 | + | ||
| 134 | +} |
cloud/app_pay/src/main/java/com/cnlive/strike/pay/PayToUnion.java
0 → 100644
| 1 | +package com.cnlive.strike.pay; | ||
| 2 | + | ||
| 3 | +import android.content.Context; | ||
| 4 | +import android.content.Intent; | ||
| 5 | + | ||
| 6 | +import com.cnlive.strike.pay.model.PayCloudResponse; | ||
| 7 | +import com.unionpay.UPPayAssistEx; | ||
| 8 | + | ||
| 9 | + | ||
| 10 | +public class PayToUnion { | ||
| 11 | + | ||
| 12 | + public static void startPay(Context context, PayCloudResponse payCloudResponse, final String appOrderId) { | ||
| 13 | + startPay(context, payCloudResponse, appOrderId, false); | ||
| 14 | + } | ||
| 15 | + | ||
| 16 | + public static void startPay(Context context, PayCloudResponse payCloudResponse, final String appOrderId, boolean isDebug) { | ||
| 17 | + PayStatusCallback payStatusCallback = PayUtil.getPayCallback(appOrderId); | ||
| 18 | + | ||
| 19 | + if (payCloudResponse == null || payCloudResponse.getData() == null || payCloudResponse.getData().getUnion_app() == null) { | ||
| 20 | + if (payStatusCallback != null) | ||
| 21 | + payStatusCallback.onFail(IPay.PAY_TYPE_UNION, IPay.ERR_PREPAY_RESULT, IPay.ERR_MSG_PREPAY_RESULT + payCloudResponse.toString()); | ||
| 22 | + | ||
| 23 | + PayUtil.probeApp(appOrderId, IPay.PAY_TYPE_UNION, IPay.PROBE_PAY_STATE_FAIL); | ||
| 24 | + return; | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + if (payStatusCallback != null) | ||
| 28 | + payStatusCallback.onStartCallPayPage(IPay.PAY_TYPE_UNION); | ||
| 29 | + | ||
| 30 | + | ||
| 31 | + UPPayAssistEx.startPay(context, null, null, payCloudResponse.getData().getUnion_app(), getPayMode(isDebug)); | ||
| 32 | + | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + public static void unionPayOnActivityResult(String appOrderId, Intent data) { | ||
| 36 | + PayStatusCallback payStatusCallback = PayUtil.getPayCallback(appOrderId); | ||
| 37 | + if (payStatusCallback == null) return; | ||
| 38 | + | ||
| 39 | + if (data == null || data.getExtras() == null) { | ||
| 40 | + payStatusCallback.onFail(IPay.PAY_TYPE_UNION, IPay.ERR_UNION_CANCEL, IPay.ERR_MSG_UNION_CANCEL); | ||
| 41 | + PayUtil.probeApp(appOrderId, IPay.PAY_TYPE_UNION, IPay.PROBE_PAY_STATE_CANCEL); | ||
| 42 | + return; | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + String str = data.getExtras().getString("pay_result"); | ||
| 46 | + | ||
| 47 | + if ("success".equalsIgnoreCase(str)) { | ||
| 48 | + payStatusCallback.onSuccess(IPay.PAY_TYPE_UNION); | ||
| 49 | + PayUtil.probeApp(appOrderId, IPay.PAY_TYPE_UNION, IPay.PROBE_PAY_STATE_SUCCESS); | ||
| 50 | + } else if ("fail".equalsIgnoreCase(str)) { | ||
| 51 | + payStatusCallback.onFail(IPay.PAY_TYPE_UNION, IPay.ERR_UNION_FAIL, IPay.ERR_MSG_UNION_FAIL); | ||
| 52 | + PayUtil.probeApp(appOrderId, IPay.PAY_TYPE_UNION, IPay.PROBE_PAY_STATE_FAIL); | ||
| 53 | + } else if ("cancel".equalsIgnoreCase(str)) { | ||
| 54 | + payStatusCallback.onFail(IPay.PAY_TYPE_UNION, IPay.ERR_UNION_CANCEL, IPay.ERR_MSG_UNION_CANCEL); | ||
| 55 | + PayUtil.probeApp(appOrderId, IPay.PAY_TYPE_UNION, IPay.PROBE_PAY_STATE_CANCEL); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + PayUtil.removePayCallback(appOrderId); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + /***************************************************************** | ||
| 62 | + * mMode参数解释: "00" - 启动银联正式环境 "01" - 连接银联测试环境 | ||
| 63 | + *****************************************************************/ | ||
| 64 | + private static String getPayMode(boolean isDebug) { | ||
| 65 | + return isDebug ? "01" : "00"; | ||
| 66 | + } | ||
| 67 | +} |
cloud/app_pay/src/main/java/com/cnlive/strike/pay/PayToWX.java
0 → 100644
| 1 | +package com.cnlive.strike.pay; | ||
| 2 | + | ||
| 3 | +import android.content.Context; | ||
| 4 | + | ||
| 5 | +import com.cnlive.strike.pay.model.PayCloudResponse; | ||
| 6 | +import com.tencent.mm.opensdk.modelpay.PayReq; | ||
| 7 | +import com.tencent.mm.opensdk.openapi.IWXAPI; | ||
| 8 | +import com.tencent.mm.opensdk.openapi.WXAPIFactory; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * Created by gujun on 2017/5/2. | ||
| 12 | + */ | ||
| 13 | +public class PayToWX { | ||
| 14 | + | ||
| 15 | + private static IWXAPI api; | ||
| 16 | + | ||
| 17 | + /** | ||
| 18 | + * 判断是否安装了微信客户端 | ||
| 19 | + */ | ||
| 20 | + public static boolean isWXAppInstalledAndSupported(Context context) { | ||
| 21 | + if (api == null) | ||
| 22 | + api = WXAPIFactory.createWXAPI(context, PayUtil.getWxAppId()); | ||
| 23 | + | ||
| 24 | + return api.isWXAppInstalled(); | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + public static void startPay(Context context, PayCloudResponse payCloudResponse, final String appOrderId) { | ||
| 28 | + | ||
| 29 | + PayStatusCallback payStatusCallback = PayUtil.getPayCallback(appOrderId); | ||
| 30 | + | ||
| 31 | + if (payCloudResponse == null || payCloudResponse.getData() == null || payCloudResponse.getData().getWx_app() == null) { | ||
| 32 | + if (payStatusCallback != null) | ||
| 33 | + payStatusCallback.onFail(IPay.PAY_TYPE_WX, IPay.ERR_PREPAY_RESULT, IPay.ERR_MSG_PREPAY_RESULT + payCloudResponse.toString()); | ||
| 34 | + | ||
| 35 | + PayUtil.probeApp(appOrderId, IPay.PAY_TYPE_WX, IPay.PROBE_PAY_STATE_FAIL); | ||
| 36 | + return; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + if (isWXAppInstalledAndSupported(context)) { | ||
| 40 | + if (payStatusCallback != null) | ||
| 41 | + payStatusCallback.onStartCallPayPage(IPay.PAY_TYPE_WX); | ||
| 42 | + | ||
| 43 | + genPayReq(api, payCloudResponse, appOrderId); | ||
| 44 | + | ||
| 45 | + } else { | ||
| 46 | + if (payStatusCallback != null) | ||
| 47 | + payStatusCallback.onFail(IPay.PAY_TYPE_WX, IPay.ERR_WX_NOT_INSTALLED, IPay.ERR_MSG_WX_NOT_INSTALLED); | ||
| 48 | + | ||
| 49 | + PayUtil.probeApp(appOrderId, IPay.PAY_TYPE_WX, IPay.PROBE_PAY_STATE_FAIL); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * 生成签名参数 | ||
| 56 | + * | ||
| 57 | + * @param payCloudResponse | ||
| 58 | + */ | ||
| 59 | + private static void genPayReq(IWXAPI msgApi, PayCloudResponse payCloudResponse, String appOrderId) { | ||
| 60 | + PayReq req = new PayReq(); | ||
| 61 | + req.appId = payCloudResponse.getData().getWx_app().getAppid(); | ||
| 62 | + req.partnerId = payCloudResponse.getData().getWx_app().getPartnerid(); | ||
| 63 | + req.prepayId = payCloudResponse.getData().getWx_app().getPrepayid(); | ||
| 64 | + req.packageValue = "Sign=WXPay"; | ||
| 65 | + req.nonceStr = payCloudResponse.getData().getWx_app().getNoncestr(); | ||
| 66 | + req.timeStamp = payCloudResponse.getData().getWx_app().getTimestamp(); | ||
| 67 | + req.sign = payCloudResponse.getData().getWx_app().getSign(); | ||
| 68 | + req.extData = appOrderId; | ||
| 69 | + | ||
| 70 | + // 发起支付请求 | ||
| 71 | + msgApi.registerApp(PayUtil.getWxAppId()); | ||
| 72 | + msgApi.sendReq(req); | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | +} |
cloud/app_pay/src/main/java/com/cnlive/strike/pay/PayUtil.java
0 → 100644
| 1 | +package com.cnlive.strike.pay; | ||
| 2 | + | ||
| 3 | +import android.app.Activity; | ||
| 4 | +import android.content.Context; | ||
| 5 | +import android.content.Intent; | ||
| 6 | +import android.text.TextUtils; | ||
| 7 | +import android.util.Log; | ||
| 8 | + | ||
| 9 | + | ||
| 10 | +import com.cnlive.libs.util.Config; | ||
| 11 | +import com.cnlive.libs.util.NetUtil; | ||
| 12 | +import com.cnlive.libs.util.ProbeUtil; | ||
| 13 | +import com.cnlive.libs.util.b; | ||
| 14 | +import com.cnlive.libs.util.data.okhttp3.Call; | ||
| 15 | +import com.cnlive.libs.util.data.okhttp3.Response; | ||
| 16 | +import com.cnlive.libs.util.data.okhttpUtil.callback.GenericsCallback; | ||
| 17 | +import com.cnlive.strike.pay.model.PayCloudResponse; | ||
| 18 | +import com.cnlive.strike.pay.network.HttpRequest; | ||
| 19 | + | ||
| 20 | +import java.lang.reflect.ParameterizedType; | ||
| 21 | +import java.util.HashMap; | ||
| 22 | +import java.util.Map; | ||
| 23 | + | ||
| 24 | +/** | ||
| 25 | + * Created by gujun on 2017/5/2. | ||
| 26 | + */ | ||
| 27 | + | ||
| 28 | +public class PayUtil { | ||
| 29 | + | ||
| 30 | + private static String wxAppId; | ||
| 31 | + //标记对应的订单回调 | ||
| 32 | + public static Map<String, PayStatusCallback> callbackMap = new HashMap<>(); | ||
| 33 | + | ||
| 34 | + public static void init(String weixinAppId) { | ||
| 35 | + wxAppId = weixinAppId; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + public static String getWxAppId() { | ||
| 39 | + return wxAppId; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + public static void startPay(final Context context, | ||
| 43 | + final int payType, | ||
| 44 | + final String orderId, | ||
| 45 | + String body, | ||
| 46 | + int totalMoney, | ||
| 47 | + String notify_url, | ||
| 48 | + String account, | ||
| 49 | + String user_id, | ||
| 50 | + String frmId, | ||
| 51 | + Map<String, String> extraParams, | ||
| 52 | + final PayStatusCallback callback) { | ||
| 53 | + //初始化统计 | ||
| 54 | + ProbeUtil.probeApp(Config.SDK_PAY, Config.SDK_PAY_VERSION, Config.EVENT_PAY, "", "", ""); | ||
| 55 | + | ||
| 56 | + HttpRequest.prePay(payType, orderId, body, totalMoney, notify_url, account, user_id,frmId,extraParams, new TestCallback<PayCloudResponse>() { | ||
| 57 | + @Override | ||
| 58 | + public void onError(Call call, Exception e) { | ||
| 59 | + Log.e("PayUtil", "异常 : ", e); | ||
| 60 | + if (callback != null) { | ||
| 61 | + if (!NetUtil.checkNetwork(context)) { | ||
| 62 | + callback.onFail(getCallbackPayType(payType), IPay.ERR_PREPAY_NET, IPay.ERR_MSG_PREPAY_NET); | ||
| 63 | + } else { | ||
| 64 | + callback.onFail(getCallbackPayType(payType), IPay.ERR_PREPAY, IPay.ERR_MSG_PREPAY + ":" + e.getMessage()); | ||
| 65 | + } | ||
| 66 | + } | ||
| 67 | + probeApp(orderId, payType, IPay.PROBE_PAY_STATE_FAIL); | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + @Override | ||
| 71 | + public void onResponse(PayCloudResponse response, Exception e) { | ||
| 72 | + if (response != null) { | ||
| 73 | + if ("0".equals(response.getErrorCode())) { | ||
| 74 | + | ||
| 75 | + if (!TextUtils.isEmpty(orderId) && callback != null) | ||
| 76 | + callbackMap.put(orderId, callback); | ||
| 77 | + | ||
| 78 | + if (payType == IPay.PAY_TYPE_WX) { | ||
| 79 | + PayToWX.startPay(context, response, orderId); | ||
| 80 | + } else if (payType == IPay.PAY_TYPE_ALI) { | ||
| 81 | + PayToALi.startPay((Activity) context, response, orderId); | ||
| 82 | + } else if (payType == IPay.PAY_TYPE_UNION) { | ||
| 83 | + PayToUnion.startPay(context, response, orderId); | ||
| 84 | + } else { | ||
| 85 | + if (callback != null) | ||
| 86 | + callback.onFail(getCallbackPayType(payType), IPay.ERR_UNSUPPORT, IPay.ERR_MSG_UNSUPPORT); | ||
| 87 | + probeApp(orderId, payType, IPay.PROBE_PAY_STATE_FAIL); | ||
| 88 | + } | ||
| 89 | + } else { | ||
| 90 | + int errorCodeOpen; | ||
| 91 | + try { | ||
| 92 | + errorCodeOpen = Integer.valueOf(response.getErrorCode()); | ||
| 93 | + } catch (Exception e1) { | ||
| 94 | + errorCodeOpen = IPay.ERR_PREPAY_RESULT; | ||
| 95 | + } | ||
| 96 | + if (callback != null) | ||
| 97 | + callback.onFail(getCallbackPayType(payType), errorCodeOpen, response.getErrorMessage()); | ||
| 98 | + probeApp(orderId, payType, IPay.PROBE_PAY_STATE_FAIL); | ||
| 99 | + } | ||
| 100 | + } else { | ||
| 101 | + if (callback != null) | ||
| 102 | + callback.onFail(getCallbackPayType(payType), IPay.ERR_PREPAY, IPay.ERR_MSG_PREPAY + ":" + e.getMessage()); | ||
| 103 | + probeApp(orderId, payType, IPay.PROBE_PAY_STATE_FAIL); | ||
| 104 | + } | ||
| 105 | + } | ||
| 106 | + }); | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + //电商调用 | ||
| 110 | + public static void startPay(final Context context, | ||
| 111 | + final int payType, | ||
| 112 | + final String orderId, | ||
| 113 | + String body, | ||
| 114 | + int totalMoney, | ||
| 115 | + String notify_url, | ||
| 116 | + String account, | ||
| 117 | + String user_id, | ||
| 118 | + Map<String, String> extraParams, | ||
| 119 | + final PayStatusCallback callback) { | ||
| 120 | + startPay(context,payType,orderId,body,totalMoney,notify_url,account,user_id,null,extraParams,callback); | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + /** | ||
| 124 | + * 银联的callback走的是OnActivityResult,所以使用银联的话再Activity的OnActivityResult()方法中调用一下此方法,通过PayStatusCallback进行回调 | ||
| 125 | + * | ||
| 126 | + * @param appOrderId | ||
| 127 | + * @param data | ||
| 128 | + */ | ||
| 129 | + public static void unionPayOnActivityResult(String appOrderId, Intent data) { | ||
| 130 | + PayToUnion.unionPayOnActivityResult(appOrderId, data); | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + public abstract static class TestCallback<T> extends GenericsCallback<T> { | ||
| 134 | + b mGenericsSerializator = new b(); | ||
| 135 | + | ||
| 136 | + public TestCallback() { | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + public T parseNetworkResponse(Response var1, Exception var2) throws Exception { | ||
| 140 | + String var3 = var1.body().string(); | ||
| 141 | + Class var4 = (Class) ((ParameterizedType) this.getClass().getGenericSuperclass()).getActualTypeArguments()[0]; | ||
| 142 | + if (var4 == String.class) { | ||
| 143 | + return (T) var3; | ||
| 144 | + } else { | ||
| 145 | + T var5 = (T) this.mGenericsSerializator.transform(var3, var4); | ||
| 146 | + return var5; | ||
| 147 | + } | ||
| 148 | + } | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + private static int getCallbackPayType(int payType) { | ||
| 152 | + return payType; | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + private static String getProbePayType(int payType) { | ||
| 156 | + return payType == IPay.PAY_TYPE_WX ? IPay.PROBE_WX : (payType == IPay.PAY_TYPE_ALI ? IPay.PROBE_ALI : (payType == IPay.PAY_TYPE_UNION ? IPay.PROBE_UNION : "")); | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + public static void probeApp(String orderId, int payType, String payState) { | ||
| 160 | + ProbeUtil.probeApp(Config.SDK_PAY, Config.SDK_PAY_VERSION, Config.EVENT_PAY_STATE, orderId, getProbePayType(payType), payState); | ||
| 161 | + } | ||
| 162 | + | ||
| 163 | + public static PayStatusCallback getPayCallback(String orderId) { | ||
| 164 | + if (TextUtils.isEmpty(orderId)) return null; | ||
| 165 | + if (callbackMap != null && callbackMap.containsKey(orderId)) { | ||
| 166 | + return callbackMap.get(orderId); | ||
| 167 | + } | ||
| 168 | + return null; | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + public static void removePayCallback(String orderId) { | ||
| 172 | + if (TextUtils.isEmpty(orderId)) return; | ||
| 173 | + if (callbackMap != null && callbackMap.containsKey(orderId)) { | ||
| 174 | + callbackMap.remove(orderId); | ||
| 175 | + } | ||
| 176 | + } | ||
| 177 | + | ||
| 178 | +} |
cloud/app_pay/src/main/java/com/cnlive/strike/pay/model/AliPayResult.java
0 → 100644
| 1 | +package com.cnlive.strike.pay.model; /** * Created by gujun on 2017/5/2. * 支付handler传递的数据封装对象 */ public class AliPayResult { private String orderId; private String result; public String getOrderId() { return orderId; } public void setOrderId(String orderId) { this.orderId = orderId; } public String getResult() { return result; } public void setResult(String result) { this.result = result; } public AliPayResult(String orderId, String result) { this.orderId = orderId; this.result = result; } } | ||
| 0 | \ No newline at end of file | 2 | \ No newline at end of file |
cloud/app_pay/src/main/java/com/cnlive/strike/pay/model/PayCloudResponse.java
0 → 100644
| 1 | +package com.cnlive.strike.pay.model; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import com.cnlive.libs.util.comment.model.ErrorMessage; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * Created by gujun on 2017/4/10. | ||
| 8 | + * 支付云返回的数据 | ||
| 9 | + */ | ||
| 10 | + | ||
| 11 | +public class PayCloudResponse extends ErrorMessage { | ||
| 12 | + | ||
| 13 | + private PayCloudResponseData data; | ||
| 14 | + | ||
| 15 | + public PayCloudResponseData getData() { | ||
| 16 | + return data; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + public void setData(PayCloudResponseData data) { | ||
| 20 | + this.data = data; | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + @Override | ||
| 24 | + public String toString() { | ||
| 25 | + return "PayCloudResponse{" + | ||
| 26 | + "data=" + data + | ||
| 27 | + '}'; | ||
| 28 | + } | ||
| 29 | +} |
cloud/app_pay/src/main/java/com/cnlive/strike/pay/model/PayCloudResponseData.java
0 → 100644
| 1 | +package com.cnlive.strike.pay.model; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import com.cnlive.libs.util.model.BaseData; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * Created by gujun on 2017/4/10. | ||
| 8 | + * 支付云返回的数据 | ||
| 9 | + */ | ||
| 10 | + | ||
| 11 | +public class PayCloudResponseData extends BaseData { | ||
| 12 | + | ||
| 13 | + private String notify_url; | ||
| 14 | + private String order_id; | ||
| 15 | + private String alipay_app; | ||
| 16 | + private WxApp wx_app; | ||
| 17 | + private String union_app; | ||
| 18 | + | ||
| 19 | + public String getNotify_url() { | ||
| 20 | + return notify_url; | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + public void setNotify_url(String notify_url) { | ||
| 24 | + this.notify_url = notify_url; | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + public String getOrder_id() { | ||
| 28 | + return order_id; | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + public void setOrder_id(String order_id) { | ||
| 32 | + this.order_id = order_id; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + public String getAlipay_app() { | ||
| 36 | + return alipay_app; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + public void setAlipay_app(String alipay_app) { | ||
| 40 | + this.alipay_app = alipay_app; | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + public WxApp getWx_app() { | ||
| 44 | + return wx_app; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + public void setWx_app(WxApp wx_app) { | ||
| 48 | + this.wx_app = wx_app; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + public String getUnion_app() { | ||
| 52 | + return union_app; | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + public void setUnion_app(String union_app) { | ||
| 56 | + this.union_app = union_app; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + @Override | ||
| 60 | + public String toString() { | ||
| 61 | + return "PayCloudResponseData{" + | ||
| 62 | + "notify_url='" + notify_url + '\'' + | ||
| 63 | + ", order_id='" + order_id + '\'' + | ||
| 64 | + ", alipay_app='" + alipay_app + '\'' + | ||
| 65 | + ", wx_app=" + wx_app + | ||
| 66 | + ", union_app='" + union_app + '\'' + | ||
| 67 | + '}'; | ||
| 68 | + } | ||
| 69 | +} |
cloud/app_pay/src/main/java/com/cnlive/strike/pay/model/Result.java
0 → 100644
| 1 | +package com.cnlive.strike.pay.model; /** * Created by gujun on 2017/5/2. * 支付宝返回的支付result对象转换 */ public class Result { public String resultStatus; public String result; public String memo; public Result(String rawResult) { try { String[] resultParams = rawResult.split(";"); for (String resultParam : resultParams) { if (resultParam.startsWith("resultStatus")) { resultStatus = gatValue(resultParam, "resultStatus"); } if (resultParam.startsWith("result")) { result = gatValue(resultParam, "result"); } if (resultParam.startsWith("memo")) { memo = gatValue(resultParam, "memo"); } } } catch (Exception e) { if (e!=null) e.printStackTrace(); } } @Override public String toString() { return "resultStatus={" + resultStatus + "};memo={" + memo + "};result={" + result + "}"; } private String gatValue(String content, String key) { String prefix = key + "={"; return content.substring(content.indexOf(prefix) + prefix.length(), content.lastIndexOf("}")); } } | ||
| 0 | \ No newline at end of file | 2 | \ No newline at end of file |
cloud/app_pay/src/main/java/com/cnlive/strike/pay/model/WxApp.java
0 → 100644
| 1 | +package com.cnlive.strike.pay.model; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import com.cnlive.libs.util.model.BaseData; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * Created by gujun on 2017/5/2. | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +public class WxApp extends BaseData { | ||
| 11 | + private String appid; | ||
| 12 | + private String partnerid; | ||
| 13 | + private String prepayid; | ||
| 14 | + private String noncestr; | ||
| 15 | + private String timestamp; | ||
| 16 | + private String sign; | ||
| 17 | + | ||
| 18 | + public String getAppid() { | ||
| 19 | + return appid; | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + public void setAppid(String appid) { | ||
| 23 | + this.appid = appid; | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + public String getPartnerid() { | ||
| 27 | + return partnerid; | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + public void setPartnerid(String partnerid) { | ||
| 31 | + this.partnerid = partnerid; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + public String getPrepayid() { | ||
| 35 | + return prepayid; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + public void setPrepayid(String prepayid) { | ||
| 39 | + this.prepayid = prepayid; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + public String getNoncestr() { | ||
| 43 | + return noncestr; | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + public void setNoncestr(String noncestr) { | ||
| 47 | + this.noncestr = noncestr; | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + public String getTimestamp() { | ||
| 51 | + return timestamp; | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + public void setTimestamp(String timestamp) { | ||
| 55 | + this.timestamp = timestamp; | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + public String getSign() { | ||
| 59 | + return sign; | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + public void setSign(String sign) { | ||
| 63 | + this.sign = sign; | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + @Override | ||
| 67 | + public String toString() { | ||
| 68 | + return "WxApp{" + | ||
| 69 | + "appid='" + appid + '\'' + | ||
| 70 | + ", partnerid='" + partnerid + '\'' + | ||
| 71 | + ", prepayid='" + prepayid + '\'' + | ||
| 72 | + ", noncestr='" + noncestr + '\'' + | ||
| 73 | + ", timestamp='" + timestamp + '\'' + | ||
| 74 | + ", sign='" + sign + '\'' + | ||
| 75 | + '}'; | ||
| 76 | + } | ||
| 77 | +} |
cloud/app_pay/src/main/java/com/cnlive/strike/pay/network/HttpRequest.java
0 → 100644
| 1 | +package com.cnlive.strike.pay.network; | ||
| 2 | + | ||
| 3 | +import android.text.TextUtils; | ||
| 4 | + | ||
| 5 | +import com.cnlive.libs.util.Config; | ||
| 6 | +import com.cnlive.libs.util.HttpUtils; | ||
| 7 | +import com.cnlive.libs.util.data.okhttpUtil.callback.GenericsCallback; | ||
| 8 | + | ||
| 9 | +import java.util.HashMap; | ||
| 10 | +import java.util.Iterator; | ||
| 11 | +import java.util.Map; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * Created by gujun on 2017/5/2. | ||
| 15 | + */ | ||
| 16 | + | ||
| 17 | +public class HttpRequest { | ||
| 18 | + | ||
| 19 | + private static final String PREPAY_URL_RELEASE = "https://api.cnlive.com/open/api2/unifypay/prepay"; | ||
| 20 | + | ||
| 21 | + private static final String PREPAY_URL = PREPAY_URL_RELEASE; | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * 调支付云预支付接口 | ||
| 25 | + * | ||
| 26 | + * @param payType 微信 1 支付宝 3 | ||
| 27 | + * @param orderId 订单号 | ||
| 28 | + * @param body 订单简介 | ||
| 29 | + * @param totalMoney 订单总额 (分)单位 | ||
| 30 | + * @param notify_url 支付成功的回调地址 | ||
| 31 | + * @param account 微信支付需要的 | ||
| 32 | + * @param user_id 业务系统用户ID | ||
| 33 | + * @param extraParams 业务回传参数可以使用多个参数,由业务系统自行使用。但有长度限制, | ||
| 34 | + * 所有attach 的总字符长度不能超过300。 例如: attach.phone=13523455432 | ||
| 35 | + */ | ||
| 36 | + public static void prePay(final int payType, | ||
| 37 | + String orderId, | ||
| 38 | + String body, | ||
| 39 | + int totalMoney, | ||
| 40 | + String notify_url, | ||
| 41 | + String account, | ||
| 42 | + String user_id, | ||
| 43 | + String frmId, | ||
| 44 | + Map<String, String> extraParams, | ||
| 45 | + GenericsCallback callback) { | ||
| 46 | + | ||
| 47 | + Map<String, String> params = new HashMap<>(); | ||
| 48 | + | ||
| 49 | + if (!TextUtils.isEmpty(account)) | ||
| 50 | + params.put("account", account); | ||
| 51 | + | ||
| 52 | + if (!TextUtils.isEmpty(user_id)) | ||
| 53 | + params.put("user_id", user_id); | ||
| 54 | + | ||
| 55 | + if (extraParams != null && extraParams.size() > 0) { | ||
| 56 | + Iterator<Map.Entry<String, String>> it = extraParams.entrySet().iterator(); | ||
| 57 | + while (it.hasNext()) { | ||
| 58 | + Map.Entry<String, String> entry = it.next(); | ||
| 59 | + params.put("attach.".concat(entry.getKey()), entry.getValue()); | ||
| 60 | + } | ||
| 61 | + } | ||
| 62 | +// params.put("timestamp",time);lib_util里面添加了 | ||
| 63 | + params.put("appId", Config.getAppId()); | ||
| 64 | + params.put("out_trade_no", orderId); | ||
| 65 | + params.put("body", body); | ||
| 66 | + params.put("total_fee", totalMoney + ""); | ||
| 67 | + params.put("notify_url", notify_url); | ||
| 68 | + params.put("type", payType + ""); | ||
| 69 | + if(frmId != null)params.put("frmId", frmId); | ||
| 70 | + | ||
| 71 | + HttpUtils.doPostAsyn(PREPAY_URL, params, callback); | ||
| 72 | + | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + | ||
| 76 | +} |
cloud/app_pay/src/main/java/com/cnlive/strike/pay/ui/WXPayActivity.java
0 → 100644
| 1 | +package com.cnlive.strike.pay.ui; | ||
| 2 | + | ||
| 3 | +import android.app.Activity; | ||
| 4 | + | ||
| 5 | +import com.cnlive.strike.pay.IPay; | ||
| 6 | +import com.cnlive.strike.pay.PayStatusCallback; | ||
| 7 | +import com.cnlive.strike.pay.PayUtil; | ||
| 8 | +import com.tencent.mm.opensdk.constants.ConstantsAPI; | ||
| 9 | +import com.tencent.mm.opensdk.modelbase.BaseReq; | ||
| 10 | +import com.tencent.mm.opensdk.modelbase.BaseResp; | ||
| 11 | +import com.tencent.mm.opensdk.modelpay.PayResp; | ||
| 12 | +import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * Created by gujun on 2017/5/4. | ||
| 16 | + */ | ||
| 17 | + | ||
| 18 | +public class WXPayActivity extends Activity implements IWXAPIEventHandler { | ||
| 19 | + | ||
| 20 | + @Override | ||
| 21 | + public void onReq(BaseReq baseReq) { | ||
| 22 | + | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + @Override | ||
| 26 | + public void onResp(BaseResp baseResp) { | ||
| 27 | + PayResp payResp = (PayResp) baseResp; | ||
| 28 | + | ||
| 29 | + String orderId = payResp.extData; | ||
| 30 | + PayStatusCallback payStatusCallback = PayUtil.getPayCallback(orderId); | ||
| 31 | + if (payStatusCallback == null) { | ||
| 32 | + this.finish(); | ||
| 33 | + return; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + if (baseResp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX) { | ||
| 37 | + if (baseResp.errCode == BaseResp.ErrCode.ERR_OK) { | ||
| 38 | + payStatusCallback.onSuccess(IPay.PAY_TYPE_WX); | ||
| 39 | + PayUtil.probeApp(orderId, IPay.PAY_TYPE_WX, IPay.PROBE_PAY_STATE_SUCCESS); | ||
| 40 | + } else { | ||
| 41 | + if (baseResp.errCode == BaseResp.ErrCode.ERR_COMM) { | ||
| 42 | + payStatusCallback.onFail(IPay.PAY_TYPE_WX, IPay.ERR_WX_COMM, IPay.ERR_MSG_WX_COMM); | ||
| 43 | + PayUtil.probeApp(orderId, IPay.PAY_TYPE_WX, IPay.PROBE_PAY_STATE_FAIL); | ||
| 44 | + } else if (baseResp.errCode == BaseResp.ErrCode.ERR_USER_CANCEL) { | ||
| 45 | + payStatusCallback.onFail(IPay.PAY_TYPE_WX, IPay.ERR_WX_USER_CANCEL, IPay.ERR_MSG_WX_USER_CANCEL); | ||
| 46 | + PayUtil.probeApp(orderId, IPay.PAY_TYPE_WX, IPay.PROBE_PAY_STATE_CANCEL); | ||
| 47 | + } else if (baseResp.errCode == BaseResp.ErrCode.ERR_SENT_FAILED) { | ||
| 48 | + payStatusCallback.onFail(IPay.PAY_TYPE_WX, IPay.ERR_WX_SENT_FAILED, IPay.ERR_MSG_WX_SENT_FAILED); | ||
| 49 | + PayUtil.probeApp(orderId, IPay.PAY_TYPE_WX, IPay.PROBE_PAY_STATE_FAIL); | ||
| 50 | + } else if (baseResp.errCode == BaseResp.ErrCode.ERR_AUTH_DENIED) { | ||
| 51 | + payStatusCallback.onFail(IPay.PAY_TYPE_WX, IPay.ERR_WX_AUTH_DENIED, IPay.ERR_MSG_WX_AUTH_DENIED); | ||
| 52 | + PayUtil.probeApp(orderId, IPay.PAY_TYPE_WX, IPay.PROBE_PAY_STATE_FAIL); | ||
| 53 | + } else if (baseResp.errCode == BaseResp.ErrCode.ERR_UNSUPPORT) { | ||
| 54 | + payStatusCallback.onFail(IPay.PAY_TYPE_WX, IPay.ERR_WX_UNSUPPORT, IPay.ERR_MSG_WX_UNSUPPORT); | ||
| 55 | + PayUtil.probeApp(orderId, IPay.PAY_TYPE_WX, IPay.PROBE_PAY_STATE_FAIL); | ||
| 56 | + } else { | ||
| 57 | + payStatusCallback.onFail(IPay.PAY_TYPE_WX, IPay.ERR_WX_UNKNOWN, IPay.ERR_MSG_WX_UNKNOWN); | ||
| 58 | + PayUtil.probeApp(orderId, IPay.PAY_TYPE_WX, IPay.PROBE_PAY_STATE_FAIL); | ||
| 59 | + } | ||
| 60 | + } | ||
| 61 | + } | ||
| 62 | + this.finish(); | ||
| 63 | + } | ||
| 64 | +} |
cloud/app_pay/src/main/jniLibs/armeabi-v7a/libentryexpro.so
0 → 100644
No preview for this file type
cloud/app_pay/src/main/jniLibs/armeabi-v7a/libuptsmaddon.so
0 → 100644
No preview for this file type
cloud/app_pay/src/main/jniLibs/armeabi-v7a/libuptsmaddonmi.so
0 → 100644
No preview for this file type
cloud/app_pay/src/main/jniLibs/armeabi/libentryexpro.so
0 → 100644
No preview for this file type
cloud/app_pay/src/main/jniLibs/armeabi/libuptsmaddon.so
0 → 100644
No preview for this file type
cloud/app_pay/src/main/jniLibs/armeabi/libuptsmaddonmi.so
0 → 100644
No preview for this file type
cloud/app_pay/src/main/res/layout/pay_result.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | + | ||
| 3 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 4 | + style="@style/NavPage"> | ||
| 5 | + | ||
| 6 | + <TextView | ||
| 7 | + android:layout_width="fill_parent" | ||
| 8 | + android:layout_height="fill_parent" | ||
| 9 | + android:gravity="center" | ||
| 10 | + android:textColor="#ff000000" | ||
| 11 | + android:textSize="20sp" | ||
| 12 | + android:text="@string/pay_result_tip"/> | ||
| 13 | + | ||
| 14 | +</LinearLayout> | ||
| 0 | \ No newline at end of file | 15 | \ No newline at end of file |
cloud/app_pay/src/main/res/values/pay_strings.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<resources> | ||
| 3 | + <!-- WXPayEntryActivity --> | ||
| 4 | + <string name="pay_result_tip">这个界面用于显示第三方app通过微信支付的结果</string> | ||
| 5 | + <string name="pay_result_callback_msg" formatted="false">微信支付结果:%s</string> | ||
| 6 | +</resources> | ||
| 0 | \ No newline at end of file | 7 | \ No newline at end of file |
cloud/app_pay/src/main/res/values/pay_styles.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<resources> | ||
| 3 | + <!-- 微信支付布局用到的 --> | ||
| 4 | + <style name="NavPage"> | ||
| 5 | + <item name="android:layout_width">fill_parent</item> | ||
| 6 | + <item name="android:layout_height">fill_parent</item> | ||
| 7 | + <item name="android:orientation">vertical</item> | ||
| 8 | + <item name="android:gravity">center_horizontal</item> | ||
| 9 | + <item name="android:background">#FFE1E8EB</item> | ||
| 10 | + </style> | ||
| 11 | +</resources> | ||
| 0 | \ No newline at end of file | 12 | \ No newline at end of file |
cloud/app_pay/src/main/res/values/strings.xml
0 → 100644
cloud/app_pay/src/test/java/com/cnlive/strike/pay/ExampleUnitTest.java
0 → 100644
| 1 | +package com.cnlive.strike.pay; | ||
| 2 | + | ||
| 3 | +import org.junit.Test; | ||
| 4 | + | ||
| 5 | +import static org.junit.Assert.*; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * Example local unit test, which will execute on the development machine (host). | ||
| 9 | + * | ||
| 10 | + * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
| 11 | + */ | ||
| 12 | +public class ExampleUnitTest { | ||
| 13 | + @Test | ||
| 14 | + public void addition_isCorrect() { | ||
| 15 | + assertEquals(4, 2 + 2); | ||
| 16 | + } | ||
| 17 | +} | ||
| 0 | \ No newline at end of file | 18 | \ No newline at end of file |
cloud/third_tool/src/debug/AndroidManifest.xml
| @@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | <activity | 7 | <activity |
| 8 | - android:name="com.cnlive.cloud.debug.wxapi.WXEntryActivity" | 8 | + android:name="com.cnlive.strike.debug.wxapi.WXEntryActivity" |
| 9 | android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" | 9 | android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" |
| 10 | android:label="@string/app_name" | 10 | android:label="@string/app_name" |
| 11 | android:exported="true" | 11 | android:exported="true" |
cloud/third_tool/src/main/java/com/cnlive/login/utils/ThirdLoginUtil.java
| @@ -12,6 +12,7 @@ import com.cnlive.login.model.OtherUserInfo; | @@ -12,6 +12,7 @@ import com.cnlive.login.model.OtherUserInfo; | ||
| 12 | import com.cnlive.login.model.ThirdLoginInfo; | 12 | import com.cnlive.login.model.ThirdLoginInfo; |
| 13 | import com.cnlive.login.observer.ThirdLoginObservable; | 13 | import com.cnlive.login.observer.ThirdLoginObservable; |
| 14 | import com.cnlive.share.BuildConfig; | 14 | import com.cnlive.share.BuildConfig; |
| 15 | +import com.cnlive.share.util.Util; | ||
| 15 | import com.sina.weibo.sdk.auth.Oauth2AccessToken; | 16 | import com.sina.weibo.sdk.auth.Oauth2AccessToken; |
| 16 | import com.sina.weibo.sdk.auth.WbAuthListener; | 17 | import com.sina.weibo.sdk.auth.WbAuthListener; |
| 17 | import com.sina.weibo.sdk.auth.WbConnectErrorMessage; | 18 | import com.sina.weibo.sdk.auth.WbConnectErrorMessage; |
| @@ -71,11 +72,30 @@ public class ThirdLoginUtil { | @@ -71,11 +72,30 @@ public class ThirdLoginUtil { | ||
| 71 | * @param context | 72 | * @param context |
| 72 | * @return | 73 | * @return |
| 73 | */ | 74 | */ |
| 74 | - public static boolean isQQInstalled(Activity context){ | 75 | + public static boolean isQQInstalled(Activity context,boolean isLogin){ |
| 75 | boolean isInstall = false; | 76 | boolean isInstall = false; |
| 76 | mContext = context; | 77 | mContext = context; |
| 77 | - isInstall = mTencent.isQQInstalled(context); | ||
| 78 | - if(isInstall) mTencent.login(context, ACOPE_ALL, listener); | 78 | + isInstall = (Util.checkQQ(context) || Util.isQQClientAvailable(context) || mTencent.isQQInstalled(context)); |
| 79 | + if(isInstall) mTencent.login(context, ACOPE_ALL, new IUiListener() { | ||
| 80 | + @Override | ||
| 81 | + public void onComplete(Object o) { | ||
| 82 | + getQQInfo(mContext, mTencent, o); | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + @Override | ||
| 86 | + public void onError(UiError uiError) { | ||
| 87 | + String msg = "登录失败"; | ||
| 88 | + if(!isLogin) msg = "绑定失败"; | ||
| 89 | + AlertUtil.showDeftToast(mContext, msg); | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + @Override | ||
| 93 | + public void onCancel() { | ||
| 94 | + String msg = "取消登录"; | ||
| 95 | + if(!isLogin) msg = "取消绑定"; | ||
| 96 | + AlertUtil.showDeftToast(mContext, msg); | ||
| 97 | + } | ||
| 98 | + }); | ||
| 79 | return isInstall; | 99 | return isInstall; |
| 80 | } | 100 | } |
| 81 | 101 | ||
| @@ -85,8 +105,27 @@ public class ThirdLoginUtil { | @@ -85,8 +105,27 @@ public class ThirdLoginUtil { | ||
| 85 | * @param resultCode | 105 | * @param resultCode |
| 86 | * @param data | 106 | * @param data |
| 87 | */ | 107 | */ |
| 88 | - public static void getQQResult(int requestCode, int resultCode, Intent data){ | ||
| 89 | - Tencent.onActivityResultData(requestCode, resultCode, data, listener); | 108 | + public static void getQQResult(int requestCode, int resultCode, Intent data,boolean isLogin){ |
| 109 | + Tencent.onActivityResultData(requestCode, resultCode, data, new IUiListener() { | ||
| 110 | + @Override | ||
| 111 | + public void onComplete(Object o) { | ||
| 112 | + getQQInfo(mContext, mTencent, o); | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + @Override | ||
| 116 | + public void onError(UiError uiError) { | ||
| 117 | + String msg = "登录失败"; | ||
| 118 | + if(!isLogin) msg = "绑定失败"; | ||
| 119 | + AlertUtil.showDeftToast(mContext, msg); | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + @Override | ||
| 123 | + public void onCancel() { | ||
| 124 | + String msg = "取消登录"; | ||
| 125 | + if(!isLogin) msg = "取消绑定"; | ||
| 126 | + AlertUtil.showDeftToast(mContext, msg); | ||
| 127 | + } | ||
| 128 | + }); | ||
| 90 | } | 129 | } |
| 91 | 130 | ||
| 92 | 131 | ||
| @@ -94,7 +133,7 @@ public class ThirdLoginUtil { | @@ -94,7 +133,7 @@ public class ThirdLoginUtil { | ||
| 94 | * 微博登录 | 133 | * 微博登录 |
| 95 | * @param activity | 134 | * @param activity |
| 96 | */ | 135 | */ |
| 97 | - public static void loginWeibo(Activity activity){ | 136 | + public static void loginWeibo(Activity activity,boolean isLogin){ |
| 98 | if(mSsoHandler == null)mSsoHandler = new SsoHandler(activity); | 137 | if(mSsoHandler == null)mSsoHandler = new SsoHandler(activity); |
| 99 | mSsoHandler.authorize(new WbAuthListener() { | 138 | mSsoHandler.authorize(new WbAuthListener() { |
| 100 | @Override | 139 | @Override |
| @@ -104,12 +143,16 @@ public class ThirdLoginUtil { | @@ -104,12 +143,16 @@ public class ThirdLoginUtil { | ||
| 104 | 143 | ||
| 105 | @Override | 144 | @Override |
| 106 | public void cancel() { | 145 | public void cancel() { |
| 107 | - AlertUtil.showDeftToast(activity, "取消登录"); | 146 | + String msg = "取消登录"; |
| 147 | + if(!isLogin) msg = "取消绑定"; | ||
| 148 | + AlertUtil.showDeftToast(activity, msg); | ||
| 108 | } | 149 | } |
| 109 | 150 | ||
| 110 | @Override | 151 | @Override |
| 111 | public void onFailure(WbConnectErrorMessage wbConnectErrorMessage) { | 152 | public void onFailure(WbConnectErrorMessage wbConnectErrorMessage) { |
| 112 | - AlertUtil.showDeftToast(activity, "登录失败"); | 153 | + String msg = "登录失败"; |
| 154 | + if(!isLogin) msg = "绑定失败"; | ||
| 155 | + AlertUtil.showDeftToast(activity, msg); | ||
| 113 | } | 156 | } |
| 114 | }); | 157 | }); |
| 115 | } | 158 | } |
cloud/third_tool/src/release/AndroidManifest.xml
| @@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
| 4 | <application> | 4 | <application> |
| 5 | 5 | ||
| 6 | <activity | 6 | <activity |
| 7 | - android:name="com.cnlive.cloud.wxapi.WXEntryActivity" | 7 | + android:name="com.cnlive.strike.debug.wxapi.WXEntryActivity" |
| 8 | android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" | 8 | android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" |
| 9 | android:exported="true" | 9 | android:exported="true" |
| 10 | android:launchMode="singleTop"> | 10 | android:launchMode="singleTop"> |
cloud/user/src/main/AndroidManifest.xml
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 1 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" | 2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
| 2 | xmlns:tools="http://schemas.android.com/tools" | 3 | xmlns:tools="http://schemas.android.com/tools" |
| 3 | package="com.cnlive.cloud.user"> | 4 | package="com.cnlive.cloud.user"> |
| 4 | 5 | ||
| 5 | - <uses-permission android:name="android.permission.INTERNET" /> | ||
| 6 | - | ||
| 7 | - <!-- for mta statistics, not necessary--> | 6 | + <uses-permission android:name="android.permission.INTERNET" /> <!-- for mta statistics, not necessary --> |
| 8 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | 7 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> |
| 9 | <uses-permission android:name="android.permission.READ_PHONE_STATE" /> | 8 | <uses-permission android:name="android.permission.READ_PHONE_STATE" /> |
| 10 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | 9 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> |
| @@ -32,44 +31,44 @@ | @@ -32,44 +31,44 @@ | ||
| 32 | <uses-permission android:name="android.permission.INTERNET" /> | 31 | <uses-permission android:name="android.permission.INTERNET" /> |
| 33 | 32 | ||
| 34 | <application android:largeHeap="true"> | 33 | <application android:largeHeap="true"> |
| 34 | + <activity android:name=".ui.activity.UnBindThreeLoginCheckActivity"></activity> | ||
| 35 | + <activity android:name=".ui.activity.BindPhoneMangerActivity" /> | ||
| 36 | + <activity android:name=".ui.activity.BindPhoneNumberActivity" /> | ||
| 37 | + | ||
| 35 | <meta-data | 38 | <meta-data |
| 36 | android:name="WEIBO_APPKEY" | 39 | android:name="WEIBO_APPKEY" |
| 37 | android:value="3884700821" /> | 40 | android:value="3884700821" /> |
| 38 | <meta-data | 41 | <meta-data |
| 39 | android:name="WEIBO_CHANNEL" | 42 | android:name="WEIBO_CHANNEL" |
| 40 | - android:value="weibo" /> | ||
| 41 | - <!-- 个人签名--> | 43 | + android:value="weibo" /> <!-- 个人签名 --> |
| 42 | <activity | 44 | <activity |
| 43 | - android:name="com.cnlive.cloud.user.ui.activity.SignatureActivity" | 45 | + android:name=".ui.activity.SignatureActivity" |
| 44 | android:configChanges="keyboardHidden|screenSize|smallestScreenSize|screenLayout|orientation" | 46 | android:configChanges="keyboardHidden|screenSize|smallestScreenSize|screenLayout|orientation" |
| 45 | android:launchMode="singleTop" | 47 | android:launchMode="singleTop" |
| 46 | android:screenOrientation="portrait" | 48 | android:screenOrientation="portrait" |
| 47 | - android:windowSoftInputMode="stateVisible|adjustPan" /> | ||
| 48 | - <!-- 个人资料姓名--> | 49 | + android:windowSoftInputMode="stateVisible|adjustPan" /> <!-- 个人资料姓名 --> |
| 49 | <activity | 50 | <activity |
| 50 | - android:name="com.cnlive.cloud.user.ui.activity.UpdateContentActivity" | 51 | + android:name=".ui.activity.UpdateContentActivity" |
| 51 | android:configChanges="keyboardHidden|screenSize|smallestScreenSize|screenLayout|orientation" | 52 | android:configChanges="keyboardHidden|screenSize|smallestScreenSize|screenLayout|orientation" |
| 52 | android:launchMode="singleTop" | 53 | android:launchMode="singleTop" |
| 53 | - android:screenOrientation="portrait" /> | ||
| 54 | - <!--预览头像--> | 54 | + android:screenOrientation="portrait" /> <!-- 预览头像 --> |
| 55 | <activity | 55 | <activity |
| 56 | - android:name="com.cnlive.cloud.user.ui.activity.PersonalImageActivity" | 56 | + android:name=".ui.activity.PersonalImageActivity" |
| 57 | android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" | 57 | android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" |
| 58 | android:launchMode="singleTop" | 58 | android:launchMode="singleTop" |
| 59 | - android:screenOrientation="portrait" /> | ||
| 60 | - <!-- 个人资料页--> | 59 | + android:screenOrientation="portrait" /> <!-- 个人资料页 --> |
| 61 | <activity | 60 | <activity |
| 62 | - android:name="com.cnlive.cloud.user.ui.activity.PersonalDataActivity" | 61 | + android:name=".ui.activity.PersonalDataActivity" |
| 63 | android:configChanges="keyboardHidden|screenSize|smallestScreenSize|screenLayout|orientation" | 62 | android:configChanges="keyboardHidden|screenSize|smallestScreenSize|screenLayout|orientation" |
| 64 | android:launchMode="singleTop" | 63 | android:launchMode="singleTop" |
| 65 | android:screenOrientation="portrait" /> | 64 | android:screenOrientation="portrait" /> |
| 66 | <activity | 65 | <activity |
| 67 | - android:name="com.cnlive.cloud.user.ui.activity.LoginDialogActivity" | 66 | + android:name=".ui.activity.LoginDialogActivity" |
| 68 | android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" | 67 | android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" |
| 69 | android:launchMode="singleTop" | 68 | android:launchMode="singleTop" |
| 70 | android:theme="@style/ProcessHtmlDialogActivityTheme" /> | 69 | android:theme="@style/ProcessHtmlDialogActivityTheme" /> |
| 71 | <activity | 70 | <activity |
| 72 | - android:name="com.cnlive.cloud.user.ui.activity.LoginActivity" | 71 | + android:name=".ui.activity.LoginActivity" |
| 73 | android:configChanges="keyboardHidden|screenSize|orientation|smallestScreenSize|screenLayout" | 72 | android:configChanges="keyboardHidden|screenSize|orientation|smallestScreenSize|screenLayout" |
| 74 | android:launchMode="singleTop" | 73 | android:launchMode="singleTop" |
| 75 | android:screenOrientation="portrait" | 74 | android:screenOrientation="portrait" |
| @@ -79,19 +78,19 @@ | @@ -79,19 +78,19 @@ | ||
| 79 | </intent-filter> | 78 | </intent-filter> |
| 80 | </activity> | 79 | </activity> |
| 81 | <activity | 80 | <activity |
| 82 | - android:name="com.cnlive.cloud.user.ui.activity.FirstLoginActivity" | 81 | + android:name=".ui.activity.FirstLoginActivity" |
| 83 | android:configChanges="keyboardHidden|screenSize|smallestScreenSize|screenLayout|orientation" | 82 | android:configChanges="keyboardHidden|screenSize|smallestScreenSize|screenLayout|orientation" |
| 84 | android:launchMode="singleTop" | 83 | android:launchMode="singleTop" |
| 85 | android:screenOrientation="portrait" /> | 84 | android:screenOrientation="portrait" /> |
| 86 | <activity | 85 | <activity |
| 87 | - android:name="com.cnlive.cloud.user.ui.activity.SelectCountryActivity" | 86 | + android:name=".ui.activity.SelectCountryActivity" |
| 88 | android:configChanges="keyboardHidden|screenSize|smallestScreenSize|screenLayout|orientation" | 87 | android:configChanges="keyboardHidden|screenSize|smallestScreenSize|screenLayout|orientation" |
| 89 | android:launchMode="singleTask" | 88 | android:launchMode="singleTask" |
| 90 | android:screenOrientation="portrait" | 89 | android:screenOrientation="portrait" |
| 91 | android:windowSoftInputMode="adjustResize" /> | 90 | android:windowSoftInputMode="adjustResize" /> |
| 92 | 91 | ||
| 93 | <service | 92 | <service |
| 94 | - android:name="com.cnlive.cloud.user.auth.UserAccountService" | 93 | + android:name=".auth.UserAccountService" |
| 95 | tools:ignore="ExportedService"> | 94 | tools:ignore="ExportedService"> |
| 96 | <intent-filter> | 95 | <intent-filter> |
| 97 | <action android:name="android.accounts.AccountAuthenticator" /> | 96 | <action android:name="android.accounts.AccountAuthenticator" /> |
| @@ -101,9 +100,8 @@ | @@ -101,9 +100,8 @@ | ||
| 101 | android:name="android.accounts.AccountAuthenticator" | 100 | android:name="android.accounts.AccountAuthenticator" |
| 102 | android:resource="@xml/authenticator" /> | 101 | android:resource="@xml/authenticator" /> |
| 103 | </service> | 102 | </service> |
| 104 | - | ||
| 105 | <service | 103 | <service |
| 106 | - android:name="com.cnlive.cloud.user.auth.UserSyncService" | 104 | + android:name=".auth.UserSyncService" |
| 107 | android:exported="true"> | 105 | android:exported="true"> |
| 108 | <intent-filter> | 106 | <intent-filter> |
| 109 | <action android:name="android.content.SyncAdapter" /> | 107 | <action android:name="android.content.SyncAdapter" /> |
| @@ -115,9 +113,10 @@ | @@ -115,9 +113,10 @@ | ||
| 115 | </service> | 113 | </service> |
| 116 | 114 | ||
| 117 | <provider | 115 | <provider |
| 118 | - android:name="com.cnlive.cloud.user.auth.UserAccountProvider" | 116 | + android:name=".auth.UserAccountProvider" |
| 119 | android:authorities="@string/ACCOUNT_PROVIDE" | 117 | android:authorities="@string/ACCOUNT_PROVIDE" |
| 120 | android:exported="false" | 118 | android:exported="false" |
| 121 | android:syncable="true" /> | 119 | android:syncable="true" /> |
| 122 | </application> | 120 | </application> |
| 123 | -</manifest> | 121 | + |
| 122 | +</manifest> | ||
| 124 | \ No newline at end of file | 123 | \ No newline at end of file |
cloud/user/src/main/java/com/cnlive/cloud/user/frame/presenter/BindPhoneMangerPresenter.java
0 → 100644
| 1 | +package com.cnlive.cloud.user.frame.presenter; | ||
| 2 | + | ||
| 3 | +import com.cnlive.cloud.user.auth.UserService; | ||
| 4 | +import com.cnlive.cloud.user.frame.view.BindPhoneMangerView; | ||
| 5 | +import com.cnlive.cloud.user.model.BindPhoneNumberInfo; | ||
| 6 | +import com.cnlive.cloud.user.ui.activity.BindPhoneMangerActivity; | ||
| 7 | +import com.cnlive.core.libs.base.application.AppConfig; | ||
| 8 | +import com.cnlive.core.libs.base.frame.presenter.BasePresenter; | ||
| 9 | +import com.cnlive.core.network.HttpConn; | ||
| 10 | +import com.cnlive.core.network.NetCallBack; | ||
| 11 | +import com.cnlive.core.network.api.ApiBaseServiceOpen; | ||
| 12 | +import com.cnlive.core.network.model.BaseResult; | ||
| 13 | +import com.cnlive.core.network.request.BaseRequest; | ||
| 14 | +import com.cnlive.login.model.OtherUserInfo; | ||
| 15 | + | ||
| 16 | +import java.util.HashMap; | ||
| 17 | + | ||
| 18 | + | ||
| 19 | +/** | ||
| 20 | + * 作者: 吴奎庆 | ||
| 21 | + * <p> | ||
| 22 | + * 时间: 2019/9/9 | ||
| 23 | + * <p> | ||
| 24 | + * 简介: | ||
| 25 | + */ | ||
| 26 | +public class BindPhoneMangerPresenter extends BasePresenter<BindPhoneMangerView> { | ||
| 27 | + | ||
| 28 | + public void unBindLogin(BindPhoneMangerActivity mangerActivity, BindPhoneNumberInfo info) { | ||
| 29 | + if (mangerActivity == null) return; | ||
| 30 | + UserService userService = UserService.getInstance(mangerActivity); | ||
| 31 | + if (userService == null) return; | ||
| 32 | + HashMap<String, String> requestMap = new HashMap<>(); | ||
| 33 | + requestMap.put("appId", AppConfig.getAppId()); | ||
| 34 | + | ||
| 35 | + requestMap.put("uid", userService.getAppAccount().getUid()); | ||
| 36 | + | ||
| 37 | + switch (info.getType()) { | ||
| 38 | + case 1: | ||
| 39 | + requestMap.put("thirdPartyId", userService.getAppAccount().getSinaUid()); | ||
| 40 | + break; | ||
| 41 | + case 2: | ||
| 42 | + | ||
| 43 | + requestMap.put("thirdPartyId", userService.getAppAccount().getQqUid()); | ||
| 44 | + break; | ||
| 45 | + case 3: | ||
| 46 | + requestMap.put("thirdPartyId", userService.getAppAccount().getWxUid()); | ||
| 47 | + break; | ||
| 48 | + } | ||
| 49 | + requestMap.put("thirdPartyPlat", info.getType() + ""); | ||
| 50 | + requestMap.put("token", userService.getAppAccount().getToken()); | ||
| 51 | + requestMap.put("clientPlat", "a"); | ||
| 52 | + | ||
| 53 | + HttpConn.action(BaseRequest.init().service(ApiBaseServiceOpen.class).unBind3rd(requestMap), new NetCallBack<BaseResult>() { | ||
| 54 | + @Override | ||
| 55 | + public void onRequestState(int state) { | ||
| 56 | + | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + @Override | ||
| 60 | + public void onSuccess(BaseResult data) { | ||
| 61 | + if ("0".equals(data.getCode())) { | ||
| 62 | + //接触绑定成功 | ||
| 63 | + ifViewAttached(view -> view.unBindSuccess()); | ||
| 64 | + | ||
| 65 | + } | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + @Override | ||
| 69 | + public void onFailure(String errCode, String errMsg, Exception e) { | ||
| 70 | + ifViewAttached(view -> view.showMessage(errMsg)); | ||
| 71 | + } | ||
| 72 | + }); | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + public void bindLogin(BindPhoneMangerActivity mangerActivity, OtherUserInfo info) { | ||
| 76 | + if (mangerActivity == null) return; | ||
| 77 | + UserService userService = UserService.getInstance(mangerActivity); | ||
| 78 | + if (userService == null) return; | ||
| 79 | + HashMap<String, String> requestMap = new HashMap<>(); | ||
| 80 | + requestMap.put("appId", AppConfig.getAppId()); | ||
| 81 | + | ||
| 82 | + requestMap.put("uid", userService.getAppAccount().getUid()); | ||
| 83 | + requestMap.put("thirdPartyId", info.getThirdPartyId()); | ||
| 84 | + requestMap.put("thirdPartyPlat", info.getLoginType() + ""); | ||
| 85 | + requestMap.put("token", userService.getAppAccount().getToken()); | ||
| 86 | + requestMap.put("clientPlat", "a"); | ||
| 87 | + | ||
| 88 | + HttpConn.action(BaseRequest.init().service(ApiBaseServiceOpen.class).bind3rd(requestMap), new NetCallBack<BaseResult>() { | ||
| 89 | + @Override | ||
| 90 | + public void onRequestState(int state) { | ||
| 91 | + | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + @Override | ||
| 95 | + public void onSuccess(BaseResult data) { | ||
| 96 | + if ("0".equals(data.getCode())) { | ||
| 97 | + //接触绑定成功 | ||
| 98 | + ifViewAttached(view -> view.bindSuccess(info)); | ||
| 99 | + } | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + @Override | ||
| 103 | + public void onFailure(String errCode, String errMsg, Exception e) { | ||
| 104 | + ifViewAttached(view -> view.showMessage(errMsg)); | ||
| 105 | + } | ||
| 106 | + }); | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + //绑定 | ||
| 110 | + public void otherLogin(BindPhoneMangerActivity mangerActivity, OtherUserInfo otherUserInfo) { | ||
| 111 | + | ||
| 112 | + } | ||
| 113 | +} |
cloud/user/src/main/java/com/cnlive/cloud/user/frame/presenter/BindPhoneNumberPresenter.java
0 → 100644
| 1 | +package com.cnlive.cloud.user.frame.presenter; | ||
| 2 | + | ||
| 3 | +import android.content.Context; | ||
| 4 | +import android.text.TextUtils; | ||
| 5 | + | ||
| 6 | +import com.cnlive.cloud.user.R; | ||
| 7 | +import com.cnlive.cloud.user.UserUtilAction; | ||
| 8 | +import com.cnlive.cloud.user.auth.UserService; | ||
| 9 | +import com.cnlive.cloud.user.frame.view.BindPhoneNumberView; | ||
| 10 | +import com.cnlive.cloud.user.model.CNLiveUserInfo; | ||
| 11 | +import com.cnlive.cloud.user.router.user.UserAction; | ||
| 12 | +import com.cnlive.cloud.user.ui.activity.BindPhoneNumberActivity; | ||
| 13 | +import com.cnlive.cloud.user.util.RegexUtils; | ||
| 14 | +import com.cnlive.cloud.user.util.TimeEvent; | ||
| 15 | +import com.cnlive.core.libs.base.application.AppConfig; | ||
| 16 | +import com.cnlive.core.libs.base.frame.presenter.BasePresenter; | ||
| 17 | +import com.cnlive.core.libs.base.util.TimerWaitUtil; | ||
| 18 | +import com.cnlive.core.network.HttpConn; | ||
| 19 | +import com.cnlive.core.network.NetCallBack; | ||
| 20 | +import com.cnlive.core.network.model.BaseResult; | ||
| 21 | +import com.cnlive.login.model.OtherUserInfo; | ||
| 22 | + | ||
| 23 | +import java.util.HashMap; | ||
| 24 | + | ||
| 25 | + | ||
| 26 | +/** | ||
| 27 | + * 作者: 吴奎庆 | ||
| 28 | + * <p> | ||
| 29 | + * 时间: 2019/9/9 | ||
| 30 | + * <p> | ||
| 31 | + * 简介: | ||
| 32 | + */ | ||
| 33 | +public class BindPhoneNumberPresenter extends BasePresenter<BindPhoneNumberView> { | ||
| 34 | + | ||
| 35 | + private TimerWaitUtil timerUtil; | ||
| 36 | + private long currentTime = 0; | ||
| 37 | + | ||
| 38 | + private void startTimer() { | ||
| 39 | + if (timerUtil != null) timerUtil.cancel(); | ||
| 40 | + | ||
| 41 | + timerUtil = new TimerWaitUtil(); | ||
| 42 | + timerUtil.setTotalTime(60_000);//设置毫秒数 | ||
| 43 | + timerUtil.setIntervalTime(500);//设置间隔数 | ||
| 44 | + timerUtil.start(); | ||
| 45 | + timerUtil.setTimerLiener(new TimerWaitUtil.TimeListener() { | ||
| 46 | + @Override | ||
| 47 | + public void onFinish() { | ||
| 48 | + currentTime = 0; | ||
| 49 | + ifViewAttached(view -> view.onTimerFinish()); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + @Override | ||
| 53 | + public void onInterval(long remainTime) { | ||
| 54 | + currentTime = remainTime; | ||
| 55 | + ifViewAttached(view -> view.onTimerInterval(remainTime / 1000)); | ||
| 56 | + } | ||
| 57 | + }); | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + public void sendCode(Context context, String phone, String countryCode) { | ||
| 61 | + if (getView() == null) return; | ||
| 62 | + if (TimeEvent.debounce(2_000)) return; | ||
| 63 | + if (TextUtils.isEmpty(phone)) { | ||
| 64 | + getView().showMessage(context.getString(R.string.user_toast_quick_login_empty_phone)); | ||
| 65 | + return; | ||
| 66 | + } | ||
| 67 | + if ("86".equals(countryCode) && !RegexUtils.isMobileSimple(phone)) { | ||
| 68 | + getView().showMessage(context.getString(R.string.user_toast_quick_login_error_phone)); | ||
| 69 | + return; | ||
| 70 | + } | ||
| 71 | + if (currentTime != 0) { | ||
| 72 | + ifViewAttached(view -> view.showMessage("处理中请稍后...")); | ||
| 73 | + return; | ||
| 74 | + } | ||
| 75 | + HttpConn.action(UserUtilAction.sendMsgBefQuickLoginAction(context, phone, countryCode), new NetCallBack<BaseResult>() { | ||
| 76 | + @Override | ||
| 77 | + public void onRequestState(int state) { | ||
| 78 | + | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + @Override | ||
| 82 | + public void onSuccess(BaseResult data) { | ||
| 83 | + startTimer(); | ||
| 84 | + ifViewAttached(view -> view.showMessage("验证码已发送")); | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + @Override | ||
| 88 | + public void onFailure(String errCode, String errMsg, Exception e) { | ||
| 89 | + ifViewAttached(view -> { | ||
| 90 | + view.cancelLoading(); | ||
| 91 | + view.showMessage(errMsg); | ||
| 92 | + } | ||
| 93 | + ); | ||
| 94 | + } | ||
| 95 | + }); | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + public void cancle() { | ||
| 99 | + if (timerUtil != null) { | ||
| 100 | + timerUtil.cancel(); | ||
| 101 | + } | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + public void bindOther(BindPhoneNumberActivity activity, OtherUserInfo otherUserInfo, String phone, String ems) { | ||
| 105 | + HashMap<String, String> requestMap = new HashMap<>(); | ||
| 106 | + requestMap.put("appId", AppConfig.getAppId()); | ||
| 107 | + requestMap.put("mobile", phone); | ||
| 108 | + requestMap.put("countryCode", activity.countryCode); | ||
| 109 | + requestMap.put("frmId", AppConfig.getAppChannel()); | ||
| 110 | + requestMap.put("verificationCode", ems); | ||
| 111 | + | ||
| 112 | + requestMap.put("thirdPartyPlat", otherUserInfo.getLoginType()); | ||
| 113 | + requestMap.put("thirdPartyId", otherUserInfo.getThirdPartyId()); | ||
| 114 | + requestMap.put("uuid", AppConfig.getAppUUID()); | ||
| 115 | + requestMap.put("clientPlat", "a"); | ||
| 116 | + requestMap.put("nickName", otherUserInfo.getNickName()); | ||
| 117 | + requestMap.put("gender", otherUserInfo.getGender()); | ||
| 118 | + requestMap.put("location", otherUserInfo.getLocation()); | ||
| 119 | + requestMap.put("faceUrl", otherUserInfo.getFaceUrl()); | ||
| 120 | + UserAction.otherLoginBindMobile(activity, phone, activity.countryCode, ems, | ||
| 121 | + otherUserInfo.getLoginType(), otherUserInfo.getThirdPartyId(), | ||
| 122 | + otherUserInfo.getNickName(), otherUserInfo.getGender(), otherUserInfo.getLocation(), | ||
| 123 | + otherUserInfo.getFaceUrl(), new UserAction.CallBack() { | ||
| 124 | + @Override | ||
| 125 | + public void callback(int state, String msg, Object object) { | ||
| 126 | + initLoginEvent(activity, state, msg, false, otherUserInfo); | ||
| 127 | + } | ||
| 128 | + }); | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + public void initLoginEvent(BindPhoneNumberActivity context, int state, String message, Boolean retry, OtherUserInfo otherUserInfo) { | ||
| 132 | + switch (state) { | ||
| 133 | + case 0: | ||
| 134 | + CNLiveUserInfo user = UserService.getInstance(context).getAppAccount(); | ||
| 135 | + if (user == null || (user != null && TextUtils.isEmpty(user.getToken()))) { | ||
| 136 | + ifViewAttached(view -> view.showMessage("用户登陆失败,再试一次吧.")); | ||
| 137 | + } else if (user.isNewUser()) { | ||
| 138 | + //TODO 必须设置用户头像 | ||
| 139 | + //OpenInstall用户注册统计 | ||
| 140 | +// OpenInstall.reportRegister(); | ||
| 141 | + //友盟账号登录统计,暂时只有平台登录,后续对接三方登录 | ||
| 142 | +// MobclickAgent.onProfileSignIn("CNLive", user.getUid()); | ||
| 143 | + if (otherUserInfo != null) { | ||
| 144 | + ifViewAttached(view -> view.showMainView()); | ||
| 145 | + } else { | ||
| 146 | + ifViewAttached(view -> view.showEditView()); | ||
| 147 | + } | ||
| 148 | + } else { | ||
| 149 | + //友盟账号登录统计,暂时只有平台登录,后续对接三方登录 | ||
| 150 | +// MobclickAgent.onProfileSignIn("CNLive", user.getUid()); | ||
| 151 | + ifViewAttached(view -> view.showMainView()); | ||
| 152 | + } | ||
| 153 | + AppConfig.setCountryCode(""); | ||
| 154 | + AppConfig.setCountryName(""); | ||
| 155 | + AppConfig.setVerificationCode(""); | ||
| 156 | + AppConfig.setUserPhone(""); | ||
| 157 | + break; | ||
| 158 | + case HttpConn.ON_START: | ||
| 159 | + ifViewAttached(view -> view.showLoading()); | ||
| 160 | + break; | ||
| 161 | + case HttpConn.ON_END: | ||
| 162 | + ifViewAttached(view -> view.cancelLoading()); | ||
| 163 | + break; | ||
| 164 | + case 41010: //手机号无效 | ||
| 165 | + ifViewAttached(view -> view.showMessage(message)); | ||
| 166 | + break; | ||
| 167 | + case 41002: //验证码为6位数字 | ||
| 168 | + ifViewAttached(view -> view.showMessage(message)); | ||
| 169 | + break; | ||
| 170 | + case 41009: //验证码错误 | ||
| 171 | + ifViewAttached(view -> view.showMessage(message)); | ||
| 172 | + break; | ||
| 173 | + case 41006: //手机号已存在 | ||
| 174 | + ifViewAttached(view -> view.showMessage(message)); | ||
| 175 | + break; | ||
| 176 | + case 6208: //当前用户在其他地点登陆 | ||
| 177 | + if (retry) { | ||
| 178 | + UserAction.otherLoginBindMobile(context, context.phoneNum, context.countryCode, context.phoneEms, | ||
| 179 | + otherUserInfo.getLoginType(), otherUserInfo.getThirdPartyId(), | ||
| 180 | + otherUserInfo.getNickName(), otherUserInfo.getGender(), otherUserInfo.getLocation(), | ||
| 181 | + otherUserInfo.getFaceUrl(), new UserAction.CallBack() { | ||
| 182 | + @Override | ||
| 183 | + public void callback(int state, String msg, Object object) { | ||
| 184 | + initLoginEvent(context, state, msg, false, otherUserInfo); | ||
| 185 | + } | ||
| 186 | + } | ||
| 187 | + ); | ||
| 188 | + return; | ||
| 189 | + } else { | ||
| 190 | + ifViewAttached(view -> view.showMessage("用户登录失败,再试一次吧.")); | ||
| 191 | + } | ||
| 192 | + break; | ||
| 193 | + default: //其他错误 | ||
| 194 | + ifViewAttached(view -> view.showMessage(message)); | ||
| 195 | + break; | ||
| 196 | + } | ||
| 197 | + } | ||
| 198 | + | ||
| 199 | +} |
cloud/user/src/main/java/com/cnlive/cloud/user/frame/view/BindPhoneMangerView.java
0 → 100644
| 1 | +package com.cnlive.cloud.user.frame.view; | ||
| 2 | + | ||
| 3 | +import android.text.TextUtils; | ||
| 4 | +import android.view.View; | ||
| 5 | + | ||
| 6 | +import com.cnlive.cloud.user.R; | ||
| 7 | +import com.cnlive.cloud.user.auth.UserService; | ||
| 8 | +import com.cnlive.cloud.user.model.BindPhoneNumberInfo; | ||
| 9 | +import com.cnlive.cloud.user.model.CNLiveUserInfo; | ||
| 10 | +import com.cnlive.cloud.user.ui.activity.BindPhoneMangerActivity; | ||
| 11 | +import com.cnlive.cloud.user.ui.activity.LoginDialogActivity; | ||
| 12 | +import com.cnlive.cloud.user.ui.activity.UnBindThreeLoginCheckActivity; | ||
| 13 | +import com.cnlive.cloud.user.ui.adapter.BindPhoneNumberAdapter; | ||
| 14 | +import com.cnlive.core.libs.base.application.AppConfig; | ||
| 15 | +import com.cnlive.core.libs.base.frame.view.BaseView; | ||
| 16 | +import com.cnlive.core.libs.base.util.AlertUtil; | ||
| 17 | +import com.cnlive.core.libs.base.util.DoublePressed; | ||
| 18 | +import com.cnlive.login.model.OtherUserInfo; | ||
| 19 | +import com.cnlive.login.utils.ThirdLoginUtil; | ||
| 20 | +import com.cnlive.share.util.Util; | ||
| 21 | +import com.qmuiteam.qmui.widget.QMUITopBar; | ||
| 22 | + | ||
| 23 | +import java.util.ArrayList; | ||
| 24 | +import java.util.List; | ||
| 25 | + | ||
| 26 | +import androidx.recyclerview.widget.LinearLayoutManager; | ||
| 27 | + | ||
| 28 | +/** | ||
| 29 | + * 作者: 吴奎庆 | ||
| 30 | + * <p> | ||
| 31 | + * 时间: 2019/9/9 | ||
| 32 | + * <p> | ||
| 33 | + * 简介: | ||
| 34 | + */ | ||
| 35 | +public class BindPhoneMangerView extends BaseView { | ||
| 36 | + | ||
| 37 | + BindPhoneMangerActivity mangerActivity; | ||
| 38 | + private BindPhoneNumberAdapter mAdapter; | ||
| 39 | + int curPosition = -1; | ||
| 40 | + | ||
| 41 | + public BindPhoneMangerView(BindPhoneMangerActivity activity) { | ||
| 42 | + mangerActivity = activity; | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + public void initView() { | ||
| 46 | + QMUITopBar toolbar = (QMUITopBar) mangerActivity.binding.includeToolbar; | ||
| 47 | + toolbar.setTitle("绑定管理"); | ||
| 48 | + toolbar.setBackgroundColor(mangerActivity.getResources().getColor(R.color.white)); | ||
| 49 | + toolbar.addLeftImageButton(R.drawable.back_black, R.id.qmui_topbar_item_left_back).setOnClickListener(new View.OnClickListener() { | ||
| 50 | + @Override | ||
| 51 | + public void onClick(View v) { | ||
| 52 | + mangerActivity.finish(); | ||
| 53 | + } | ||
| 54 | + }); | ||
| 55 | + LinearLayoutManager linearLayoutManager = new LinearLayoutManager(mangerActivity); | ||
| 56 | + | ||
| 57 | + mAdapter = new BindPhoneNumberAdapter(mangerActivity); | ||
| 58 | + mangerActivity.binding.rvContent.setLayoutManager(linearLayoutManager); | ||
| 59 | + mangerActivity.binding.rvContent.setAdapter(mAdapter); | ||
| 60 | + CNLiveUserInfo userInfo = UserService.getInstance(mangerActivity).getAppAccount(); | ||
| 61 | + | ||
| 62 | + List<BindPhoneNumberInfo> list = new ArrayList<>(); | ||
| 63 | + | ||
| 64 | + BindPhoneNumberInfo infoTitle = new BindPhoneNumberInfo(); | ||
| 65 | + infoTitle.setItemType(BindPhoneNumberInfo.TYPE_TITLE); | ||
| 66 | + infoTitle.setItemName("您已绑定网家家手机号账号"); | ||
| 67 | + list.add(infoTitle); | ||
| 68 | + | ||
| 69 | + BindPhoneNumberInfo infophone = new BindPhoneNumberInfo(); | ||
| 70 | + infophone.setTypeName("手机号"); | ||
| 71 | + String outMobile = userInfo.getMobile().replaceAll("(?<=\\d{3})\\d(?=\\d{4})", "*"); | ||
| 72 | + infophone.setType(0); | ||
| 73 | + infophone.setUserName(outMobile); | ||
| 74 | + infophone.setItemType(BindPhoneNumberInfo.TYPE_LOGIN); | ||
| 75 | + infophone.setBind(true); | ||
| 76 | + infophone.setTypeIcon(mangerActivity.getResources().getDrawable(R.drawable.bind_phone)); | ||
| 77 | + list.add(infophone); | ||
| 78 | + | ||
| 79 | + BindPhoneNumberInfo infoTitle2 = new BindPhoneNumberInfo(); | ||
| 80 | + infoTitle2.setItemType(BindPhoneNumberInfo.TYPE_TITLE); | ||
| 81 | + infoTitle2.setItemName("其他绑定方式"); | ||
| 82 | + list.add(infoTitle2); | ||
| 83 | + | ||
| 84 | + BindPhoneNumberInfo infoWc = new BindPhoneNumberInfo(); | ||
| 85 | + infoWc.setTypeName("微信"); | ||
| 86 | + infoWc.setType(3); | ||
| 87 | + if (userInfo != null && !TextUtils.isEmpty(userInfo.getWxUid())) { | ||
| 88 | + infoWc.setBind(true); | ||
| 89 | + infoWc.setUserName(userInfo.getNickName()); | ||
| 90 | + } else { | ||
| 91 | + infoWc.setBind(false); | ||
| 92 | + infoWc.setUserName("未绑定微信"); | ||
| 93 | + } | ||
| 94 | + infoWc.setItemType(BindPhoneNumberInfo.TYPE_LOGIN); | ||
| 95 | + infoWc.setTypeIcon(mangerActivity.getResources().getDrawable(R.drawable.wechat)); | ||
| 96 | + list.add(infoWc); | ||
| 97 | + | ||
| 98 | + BindPhoneNumberInfo infoQq = new BindPhoneNumberInfo(); | ||
| 99 | + infoQq.setTypeName("QQ"); | ||
| 100 | + infoQq.setType(2); | ||
| 101 | + if (userInfo != null && !TextUtils.isEmpty(userInfo.getQqUid())) { | ||
| 102 | + infoQq.setBind(true); | ||
| 103 | + infoQq.setUserName(userInfo.getNickName()); | ||
| 104 | + } else { | ||
| 105 | + infoQq.setBind(false); | ||
| 106 | + infoQq.setUserName("未绑定QQ"); | ||
| 107 | + } | ||
| 108 | + infoQq.setItemType(BindPhoneNumberInfo.TYPE_LOGIN); | ||
| 109 | + infoQq.setTypeIcon(mangerActivity.getResources().getDrawable(R.drawable.qq)); | ||
| 110 | + list.add(infoQq); | ||
| 111 | + | ||
| 112 | + BindPhoneNumberInfo infoWb = new BindPhoneNumberInfo(); | ||
| 113 | + infoWb.setTypeName("微博"); | ||
| 114 | + if (userInfo != null && !TextUtils.isEmpty(userInfo.getSinaUid())) { | ||
| 115 | + infoWb.setBind(true); | ||
| 116 | + infoWb.setUserName(userInfo.getNickName()); | ||
| 117 | + } else { | ||
| 118 | + infoWb.setBind(false); | ||
| 119 | + infoWb.setUserName("未绑定微博"); | ||
| 120 | + } | ||
| 121 | + infoWb.setItemType(BindPhoneNumberInfo.TYPE_LOGIN); | ||
| 122 | + infoWb.setTypeIcon(mangerActivity.getResources().getDrawable(R.drawable.weibo)); | ||
| 123 | + infoWb.setType(1); | ||
| 124 | + list.add(infoWb); | ||
| 125 | + mAdapter.addItems(list); | ||
| 126 | + mAdapter.setItemClickListener(new BindPhoneNumberAdapter.OnItemClickListener() { | ||
| 127 | + @Override | ||
| 128 | + public void onItemClick(BindPhoneNumberInfo info, View view, int position) { | ||
| 129 | + | ||
| 130 | + if (info.getType()==0|| DoublePressed.onDoublePressed()) return; | ||
| 131 | + curPosition = position; | ||
| 132 | + processClick(info, view); | ||
| 133 | + } | ||
| 134 | + }); | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + private void processClick(BindPhoneNumberInfo info, View view) { | ||
| 138 | + //类型 0手机号 3 微信 2 qq 1 微博 | ||
| 139 | + if (view.getId() == R.id.tv_bind) { | ||
| 140 | + switch (info.getType()) { | ||
| 141 | + case 0: | ||
| 142 | +// showMessage("解绑手机号"); | ||
| 143 | + break; | ||
| 144 | + case 1: | ||
| 145 | + if (info.isBind()) { | ||
| 146 | + processUnBind(info); | ||
| 147 | + } else { | ||
| 148 | + if (Util.isWeiboInstallAndInit(mangerActivity)) { | ||
| 149 | + ThirdLoginUtil.loginWeibo(mangerActivity,false); | ||
| 150 | + } else { | ||
| 151 | + showMessage("您未安装该第三方应用,无法获取用户信息!"); | ||
| 152 | + } | ||
| 153 | + | ||
| 154 | + } | ||
| 155 | + break; | ||
| 156 | + case 2: | ||
| 157 | + if (info.isBind()) { | ||
| 158 | + processUnBind(info); | ||
| 159 | + } else { | ||
| 160 | + if (!ThirdLoginUtil.isQQInstalled(mangerActivity,false)) | ||
| 161 | + showMessage("您未安装该第三方应用,无法获取用户信息!"); | ||
| 162 | + } | ||
| 163 | + break; | ||
| 164 | + case 3: | ||
| 165 | + if (info.isBind()) { | ||
| 166 | + processUnBind(info); | ||
| 167 | + } else { | ||
| 168 | + | ||
| 169 | + if (Util.isWXAppInstalledAndSupported(mangerActivity)) { | ||
| 170 | + new Thread(() -> { | ||
| 171 | + ThirdLoginUtil.loginWechat(mangerActivity, AppConfig.getWechatAppid()); | ||
| 172 | + }).start(); | ||
| 173 | + } else { | ||
| 174 | + showMessage("您未安装该第三方应用,无法获取用户信息!"); | ||
| 175 | + } | ||
| 176 | + } | ||
| 177 | + break; | ||
| 178 | + } | ||
| 179 | + } | ||
| 180 | + } | ||
| 181 | + | ||
| 182 | + private void processUnBind(BindPhoneNumberInfo info) { | ||
| 183 | + if (mangerActivity == null || info == null) return; | ||
| 184 | + mangerActivity.checkInfo = info; | ||
| 185 | + UnBindThreeLoginCheckActivity.startUnBindThreeLoginCheckActivity(mangerActivity, mangerActivity.openCode); | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + public void showMessage(String message) { | ||
| 189 | + if (mangerActivity == null) return; | ||
| 190 | + AlertUtil.showDeftToast(mangerActivity, message); | ||
| 191 | + } | ||
| 192 | + | ||
| 193 | + //类型 0手机号 3 微信 2 qq 1 微博 | ||
| 194 | + public void bindSuccess(OtherUserInfo info) { | ||
| 195 | + if (curPosition == -1 || mAdapter == null) return; | ||
| 196 | + BindPhoneNumberInfo infos = mAdapter.getItem(curPosition); | ||
| 197 | + switch (infos.getType()) { | ||
| 198 | + case 1: | ||
| 199 | + UserService.getInstance(mangerActivity).setUserWBUID(info.getThirdPartyId()); | ||
| 200 | + break; | ||
| 201 | + case 2: | ||
| 202 | + UserService.getInstance(mangerActivity).setUserQQUID(info.getThirdPartyId()); | ||
| 203 | + break; | ||
| 204 | + case 3: | ||
| 205 | + UserService.getInstance(mangerActivity).setUserWXUID(info.getThirdPartyId()); | ||
| 206 | + break; | ||
| 207 | + } | ||
| 208 | + infos.setUserName(info.getNickName()); | ||
| 209 | + infos.setBind(!infos.isBind()); | ||
| 210 | + mAdapter.notifyItemChanged(curPosition, info); | ||
| 211 | + } | ||
| 212 | + | ||
| 213 | + //类型 0手机号 3 微信 2 qq 1 微博 | ||
| 214 | + public void unBindSuccess() { | ||
| 215 | + if (curPosition == -1 || mAdapter == null) return; | ||
| 216 | + BindPhoneNumberInfo info = mAdapter.getItem(curPosition); | ||
| 217 | + switch (info.getType()) { | ||
| 218 | + case 1: | ||
| 219 | + info.setUserName("未绑定微博"); | ||
| 220 | + UserService.getInstance(mangerActivity).setUserWBUID(""); | ||
| 221 | + break; | ||
| 222 | + case 2: | ||
| 223 | + info.setUserName("未绑定QQ"); | ||
| 224 | + UserService.getInstance(mangerActivity).setUserQQUID(""); | ||
| 225 | + break; | ||
| 226 | + case 3: | ||
| 227 | + info.setUserName("未绑定微信"); | ||
| 228 | + UserService.getInstance(mangerActivity).setUserWXUID(""); | ||
| 229 | + break; | ||
| 230 | + } | ||
| 231 | + | ||
| 232 | + info.setBind(!info.isBind()); | ||
| 233 | + mAdapter.notifyItemChanged(curPosition, info); | ||
| 234 | + showMessage("解绑成功"); | ||
| 235 | + } | ||
| 236 | + | ||
| 237 | +} |
cloud/user/src/main/java/com/cnlive/cloud/user/frame/view/BindPhoneNumberView.java
0 → 100644
| 1 | +package com.cnlive.cloud.user.frame.view; | ||
| 2 | + | ||
| 3 | +import android.app.Dialog; | ||
| 4 | +import android.content.Intent; | ||
| 5 | +import android.net.Uri; | ||
| 6 | +import android.text.Spannable; | ||
| 7 | +import android.text.SpannableStringBuilder; | ||
| 8 | +import android.text.TextPaint; | ||
| 9 | +import android.text.TextUtils; | ||
| 10 | +import android.text.method.LinkMovementMethod; | ||
| 11 | +import android.text.style.ClickableSpan; | ||
| 12 | +import android.text.style.ForegroundColorSpan; | ||
| 13 | +import android.view.View; | ||
| 14 | + | ||
| 15 | +import com.cnlive.cloud.user.R; | ||
| 16 | +import com.cnlive.cloud.user.router.user.UserAction; | ||
| 17 | +import com.cnlive.cloud.user.ui.activity.BindPhoneNumberActivity; | ||
| 18 | +import com.cnlive.cloud.user.ui.activity.FirstLoginActivity; | ||
| 19 | +import com.cnlive.cloud.user.ui.activity.LoginActivity; | ||
| 20 | +import com.cnlive.core.libs.base.frame.view.BaseView; | ||
| 21 | +import com.cnlive.core.libs.base.util.AlertUtil; | ||
| 22 | +import com.cnlive.core.libs.base.util.DoublePressed; | ||
| 23 | +import com.qmuiteam.qmui.widget.QMUITopBar; | ||
| 24 | +import com.qmuiteam.qmui.widget.dialog.QMUITipDialog; | ||
| 25 | + | ||
| 26 | +/** | ||
| 27 | + * 作者: 吴奎庆 | ||
| 28 | + * <p> | ||
| 29 | + * 时间: 2019/9/9 | ||
| 30 | + * <p> | ||
| 31 | + * 简介: | ||
| 32 | + */ | ||
| 33 | +public class BindPhoneNumberView extends BaseView { | ||
| 34 | + BindPhoneNumberActivity mActivity; | ||
| 35 | + private Dialog loadingDiaog; | ||
| 36 | + | ||
| 37 | + public BindPhoneNumberView(BindPhoneNumberActivity activity) { | ||
| 38 | + mActivity = activity; | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + String al = "确定后,此%s将与网家家账号绑定"; | ||
| 42 | + | ||
| 43 | + public void initViews() { | ||
| 44 | + QMUITopBar toolbar = (QMUITopBar) mActivity.binding.includeToolbar; | ||
| 45 | + toolbar.setTitle("绑定手机号"); | ||
| 46 | + toolbar.setBackgroundColor(mActivity.getResources().getColor(R.color.white)); | ||
| 47 | + toolbar.addLeftImageButton(R.drawable.back_black, R.id.qmui_topbar_item_left_back).setOnClickListener(new View.OnClickListener() { | ||
| 48 | + @Override | ||
| 49 | + public void onClick(View v) { | ||
| 50 | + mActivity.finish(); | ||
| 51 | + } | ||
| 52 | + }); | ||
| 53 | + switch (mActivity.otherUserInfo.getLoginType()) { | ||
| 54 | + | ||
| 55 | + case "1": | ||
| 56 | + //sina | ||
| 57 | + mActivity.binding.ivThree.setBackgroundResource(R.drawable.iv_bind_wb); | ||
| 58 | + mActivity.binding.tvThree.setText("微博"); | ||
| 59 | + | ||
| 60 | + String weibos = String.format(al, "微博账号"); | ||
| 61 | + mActivity.binding.tvBind.setText(weibos); | ||
| 62 | + | ||
| 63 | +// 微博账号 | ||
| 64 | + break; | ||
| 65 | + case "2": | ||
| 66 | |||
| 67 | + mActivity.binding.ivThree.setBackgroundResource(R.drawable.iv_bind_qq); | ||
| 68 | + mActivity.binding.tvThree.setText("QQ"); | ||
| 69 | + String qqs = String.format(al, "QQ账号"); | ||
| 70 | + mActivity.binding.tvBind.setText(qqs); | ||
| 71 | + break; | ||
| 72 | + case "3": | ||
| 73 | |||
| 74 | + mActivity.binding.ivThree.setBackgroundResource(R.drawable.iv_bind_wechat); | ||
| 75 | + mActivity.binding.tvThree.setText("微信"); | ||
| 76 | + | ||
| 77 | + String wechats = String.format(al, "微信账号"); | ||
| 78 | + mActivity.binding.tvBind.setText(wechats); | ||
| 79 | + break; | ||
| 80 | + | ||
| 81 | + } | ||
| 82 | + String textContent = "已阅读并同意《账户绑定确认书(网家家)》"; | ||
| 83 | + SpannableStringBuilder ssb = new SpannableStringBuilder(textContent); | ||
| 84 | + ssb.setSpan(new ClickableSpan() { | ||
| 85 | + @Override | ||
| 86 | + public void onClick(View widget) { | ||
| 87 | + if (DoublePressed.onDoublePressed())return; | ||
| 88 | + if (mActivity != null ) { | ||
| 89 | + startWebView("sfdlxy"); | ||
| 90 | + } | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + @Override | ||
| 94 | + public void updateDrawState(TextPaint ds) { | ||
| 95 | + ds.setUnderlineText(false); | ||
| 96 | + } | ||
| 97 | + }, 7, 19, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); | ||
| 98 | + | ||
| 99 | + ssb.setSpan(new ForegroundColorSpan(mActivity.getResources().getColor(R.color.color_23d41e)), 7, 19, Spannable.SPAN_EXCLUSIVE_INCLUSIVE); | ||
| 100 | + mActivity.binding.tvAgreement.setMovementMethod(LinkMovementMethod.getInstance()); | ||
| 101 | + mActivity.binding.tvAgreement.setText(ssb); | ||
| 102 | + mActivity.binding.tvVc.setOnClickListener(mActivity); | ||
| 103 | + mActivity.binding.llCountry.setOnClickListener(mActivity); | ||
| 104 | + mActivity.binding.login.setOnClickListener(mActivity); | ||
| 105 | + mActivity.binding.tvCountry.setText("+ " + mActivity.countryCode); | ||
| 106 | + mActivity.binding.tvCountryName.setText(mActivity.countryName); | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + private void startWebView(String type) { | ||
| 110 | +// WWebView wWebView = new WWebView.Builder() | ||
| 111 | +// .urlType(type) | ||
| 112 | +// .isOther(false) | ||
| 113 | +// .enableTitle(false) | ||
| 114 | +// .enableJump(true) | ||
| 115 | +// .enableRefresh(false) | ||
| 116 | +// .enableImageLongClick(false) | ||
| 117 | +// .builder(); | ||
| 118 | +// wWebView.startWebViewActivity(mActivity); | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + | ||
| 122 | + public void showMessage(String message) { | ||
| 123 | + if (mActivity == null || TextUtils.isEmpty(message)) return; | ||
| 124 | + AlertUtil.showDeftToast(mActivity, message); | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + public void onTimerFinish() { | ||
| 128 | + mActivity.binding.tvVc.setText("获取验证码"); | ||
| 129 | + mActivity.binding.tvVc.setTextColor(mActivity.getResources().getColor(R.color.color_23d41e)); | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + private static final String time_format = "已发送 | %ss"; | ||
| 133 | + | ||
| 134 | + public void onTimerInterval(long l) { | ||
| 135 | + String text = String.format(time_format, (int) l); | ||
| 136 | + mActivity.binding.tvVc.setText(text); | ||
| 137 | + mActivity.binding.tvVc.setTextColor(mActivity.getResources().getColor(R.color.color_999)); | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + public void showEditView() { | ||
| 141 | + if (mActivity == null) return; | ||
| 142 | + Intent intent = new Intent(mActivity, FirstLoginActivity.class); | ||
| 143 | + intent.putExtra(mActivity.TAG_CLICK_AD, mActivity.clickAd); | ||
| 144 | + intent.putExtra(LoginActivity.TAG_MSG, TextUtils.isEmpty(mActivity.tagMsg) ? "" : mActivity.tagMsg); | ||
| 145 | + mActivity.startActivity(intent); | ||
| 146 | + mActivity.finish(); | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + public void showMainView() { | ||
| 150 | + //TODO 记得放开首页 | ||
| 151 | +// if (mActivity == null) return; | ||
| 152 | +// //判断如果是因为token为空跳转到的登录页面则不需要跳转到MainActivity,直接关闭登录页面即可 | ||
| 153 | +// if (mActivity.fromTokenError) { | ||
| 154 | +// mActivity.finish(); | ||
| 155 | +// return; | ||
| 156 | +// } | ||
| 157 | +// Uri uri = UserAction.getUri(mActivity); | ||
| 158 | +// Intent intent = new Intent(mActivity, MainActivity.class); | ||
| 159 | +// intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); | ||
| 160 | +// intent.putExtra("type", "login"); | ||
| 161 | +// intent.putExtra("uri", uri); | ||
| 162 | +// intent.putExtra("sharetype", mActivity.tagShare); | ||
| 163 | +// intent.putExtra(mActivity.TAG_CLICK_AD, mActivity.clickAd); | ||
| 164 | +// if (!TextUtils.isEmpty(mActivity.tagMsg)) | ||
| 165 | +// intent.putExtra("classifyTagMsg", mActivity.tagMsg); | ||
| 166 | +// mActivity.startActivity(intent); | ||
| 167 | + } | ||
| 168 | + | ||
| 169 | + public void showLoading() { | ||
| 170 | + if (mActivity == null) return; | ||
| 171 | + if (loadingDiaog == null) { | ||
| 172 | + loadingDiaog = new QMUITipDialog.Builder(mActivity) | ||
| 173 | + .setIconType(QMUITipDialog.Builder.ICON_TYPE_LOADING) | ||
| 174 | + .setTipWord("请稍后") | ||
| 175 | + .create(); | ||
| 176 | + } | ||
| 177 | + loadingDiaog.show(); | ||
| 178 | + } | ||
| 179 | + | ||
| 180 | + public void cancelLoading() { | ||
| 181 | + if (mActivity == null) return; | ||
| 182 | + if (loadingDiaog != null) { | ||
| 183 | + loadingDiaog.dismiss(); | ||
| 184 | + } | ||
| 185 | + } | ||
| 186 | +} |
cloud/user/src/main/java/com/cnlive/cloud/user/frame/view/LoginDialogView.java
| @@ -14,6 +14,7 @@ import android.text.style.ClickableSpan; | @@ -14,6 +14,7 @@ import android.text.style.ClickableSpan; | ||
| 14 | import android.text.style.ForegroundColorSpan; | 14 | import android.text.style.ForegroundColorSpan; |
| 15 | import android.view.View; | 15 | import android.view.View; |
| 16 | 16 | ||
| 17 | +import com.cnlive.cloud.user.ui.activity.BindPhoneNumberActivity; | ||
| 17 | import com.cnlive.core.libs.base.application.AppConfig; | 18 | import com.cnlive.core.libs.base.application.AppConfig; |
| 18 | import com.cnlive.core.libs.base.frame.view.BaseView; | 19 | import com.cnlive.core.libs.base.frame.view.BaseView; |
| 19 | import com.cnlive.core.libs.base.util.AlertUtil; | 20 | import com.cnlive.core.libs.base.util.AlertUtil; |
| @@ -307,7 +308,7 @@ public class LoginDialogView extends BaseView { | @@ -307,7 +308,7 @@ public class LoginDialogView extends BaseView { | ||
| 307 | 308 | ||
| 308 | public void bindPhone(OtherUserInfo otherUserInfo) { | 309 | public void bindPhone(OtherUserInfo otherUserInfo) { |
| 309 | if (mActivity == null) return; | 310 | if (mActivity == null) return; |
| 310 | -// BindPhoneNumberActivity.startActivity(mActivity, | ||
| 311 | -// otherUserInfo, mActivity.fromTokenError, mActivity.tagMsg, mActivity.tagShare, mActivity.clickAd); | 311 | + BindPhoneNumberActivity.startActivity(mActivity, |
| 312 | + otherUserInfo, mActivity.fromTokenError, mActivity.tagMsg, mActivity.tagShare, mActivity.clickAd); | ||
| 312 | } | 313 | } |
| 313 | } | 314 | } |
cloud/user/src/main/java/com/cnlive/cloud/user/frame/view/QuickLoginView.java
| @@ -20,6 +20,7 @@ import com.cnlive.cloud.user.R; | @@ -20,6 +20,7 @@ import com.cnlive.cloud.user.R; | ||
| 20 | import com.cnlive.cloud.user.model.LoginSuccessInfo; | 20 | import com.cnlive.cloud.user.model.LoginSuccessInfo; |
| 21 | import com.cnlive.cloud.user.sms.OnSmsCatchListener; | 21 | import com.cnlive.cloud.user.sms.OnSmsCatchListener; |
| 22 | import com.cnlive.cloud.user.sms.SmsVerifyCatcher; | 22 | import com.cnlive.cloud.user.sms.SmsVerifyCatcher; |
| 23 | +import com.cnlive.cloud.user.ui.activity.BindPhoneNumberActivity; | ||
| 23 | import com.cnlive.cloud.user.ui.activity.FirstLoginActivity; | 24 | import com.cnlive.cloud.user.ui.activity.FirstLoginActivity; |
| 24 | import com.cnlive.cloud.user.ui.activity.LoginActivity; | 25 | import com.cnlive.cloud.user.ui.activity.LoginActivity; |
| 25 | import com.cnlive.cloud.user.ui.fragment.QuickLoginFragment; | 26 | import com.cnlive.cloud.user.ui.fragment.QuickLoginFragment; |
| @@ -351,8 +352,8 @@ public class QuickLoginView extends BaseView { | @@ -351,8 +352,8 @@ public class QuickLoginView extends BaseView { | ||
| 351 | 352 | ||
| 352 | public void bindPhone(OtherUserInfo otherUserInfo) { | 353 | public void bindPhone(OtherUserInfo otherUserInfo) { |
| 353 | if (fragment == null) return; | 354 | if (fragment == null) return; |
| 354 | -// BindPhoneNumberActivity.startActivity(fragment.getActivity(), | ||
| 355 | -// otherUserInfo, fragment.fromTokenError, fragment.tagMsg, fragment.tagShare, fragment.clickAd); | 355 | + BindPhoneNumberActivity.startActivity(fragment.getActivity(), |
| 356 | + otherUserInfo, fragment.fromTokenError, fragment.tagMsg, fragment.tagShare, fragment.clickAd); | ||
| 356 | } | 357 | } |
| 357 | 358 | ||
| 358 | } | 359 | } |
cloud/user/src/main/java/com/cnlive/cloud/user/ui/activity/BindPhoneMangerActivity.java
0 → 100644
| 1 | +package com.cnlive.cloud.user.ui.activity; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import android.app.Activity; | ||
| 5 | +import android.content.Intent; | ||
| 6 | +import android.text.TextUtils; | ||
| 7 | + | ||
| 8 | +import com.cnlive.cloud.user.R; | ||
| 9 | +import com.cnlive.cloud.user.databinding.ActivityBindPhoneMangerBinding; | ||
| 10 | +import com.cnlive.cloud.user.databinding.ActivityBindPhoneNumberBinding; | ||
| 11 | +import com.cnlive.cloud.user.frame.presenter.BindPhoneMangerPresenter; | ||
| 12 | +import com.cnlive.cloud.user.frame.view.BindPhoneMangerView; | ||
| 13 | +import com.cnlive.cloud.user.model.BindPhoneNumberInfo; | ||
| 14 | +import com.cnlive.core.libs.base.frame.activity.BaseActivity; | ||
| 15 | +import com.cnlive.login.model.OtherUserInfo; | ||
| 16 | +import com.cnlive.login.model.ThirdLoginInfo; | ||
| 17 | +import com.cnlive.login.observer.ThirdLoginObservable; | ||
| 18 | +import com.cnlive.login.observer.WechatLoginObservable; | ||
| 19 | +import com.cnlive.login.utils.ThirdLoginUtil; | ||
| 20 | +import com.cnlive.share.data.WeChatInfo; | ||
| 21 | + | ||
| 22 | +import java.util.Observable; | ||
| 23 | +import java.util.Observer; | ||
| 24 | + | ||
| 25 | +import androidx.annotation.Nullable; | ||
| 26 | +import androidx.databinding.ViewDataBinding; | ||
| 27 | + | ||
| 28 | +public class BindPhoneMangerActivity extends BaseActivity<BindPhoneMangerView, BindPhoneMangerPresenter> implements Observer { | ||
| 29 | + //三方登陆的信息 | ||
| 30 | + public OtherUserInfo otherUserInfo; | ||
| 31 | + //qq的权限 | ||
| 32 | + public final String ACOPE_ALL = "all"; | ||
| 33 | + public BindPhoneNumberInfo checkInfo; | ||
| 34 | + public int openCode = 10010; | ||
| 35 | + public ActivityBindPhoneMangerBinding binding; | ||
| 36 | + | ||
| 37 | + public static void startActivity(Activity context) { | ||
| 38 | + Intent intent = new Intent(); | ||
| 39 | + intent.setClass(context, BindPhoneMangerActivity.class); | ||
| 40 | + context.startActivity(intent); | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + @Override | ||
| 44 | + protected int getBindLayoutId() { | ||
| 45 | + return R.layout.activity_bind_phone_manger; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + @Override | ||
| 49 | + protected void initBindingLayoutData(ViewDataBinding baseBinding) { | ||
| 50 | + binding = (ActivityBindPhoneMangerBinding) baseBinding; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + @Override | ||
| 54 | + protected void initView() { | ||
| 55 | + showDefaultWhiteStatusBar(); | ||
| 56 | + if (getMvpView() != null) getMvpView().initView(); | ||
| 57 | + initThreeLogin(); | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + /** | ||
| 61 | + * 初始化第三方 | ||
| 62 | + */ | ||
| 63 | + private void initThreeLogin() { | ||
| 64 | + ThirdLoginUtil.init(this); | ||
| 65 | + WechatLoginObservable.getInstance().addObserver(this); | ||
| 66 | + ThirdLoginObservable.getInstance().addObserver(this); | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + @Override | ||
| 70 | + protected void onResume() { | ||
| 71 | + super.onResume(); | ||
| 72 | + showDefaultWhiteStatusBar(); | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + @Override | ||
| 76 | + protected void onDestroy() { | ||
| 77 | + super.onDestroy(); | ||
| 78 | + WechatLoginObservable.getInstance().deleteObserver(this); | ||
| 79 | + ThirdLoginObservable.getInstance().deleteObserver(this); | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + @Override | ||
| 83 | + protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { | ||
| 84 | + super.onActivityResult(requestCode, resultCode, data); | ||
| 85 | + if (resultCode == 10086 && requestCode == openCode && checkInfo != null) { | ||
| 86 | + getPresenter().unBindLogin(this, checkInfo); | ||
| 87 | + return; | ||
| 88 | + } else if (resultCode == 10010 && requestCode == openCode) { | ||
| 89 | + return; | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + ThirdLoginUtil.getQQResult(requestCode, resultCode, data,false); | ||
| 93 | + ThirdLoginUtil.getWeiboResult(requestCode, resultCode, data); | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + | ||
| 97 | + //微信登录回调接口 | ||
| 98 | + @Override | ||
| 99 | + public void update(Observable observable, Object o) { | ||
| 100 | + if (observable instanceof WechatLoginObservable && null != o) { | ||
| 101 | + WeChatInfo weChatInfo = (WeChatInfo) o; | ||
| 102 | + if (weChatInfo != null) { | ||
| 103 | + otherUserInfo = new OtherUserInfo(); | ||
| 104 | + otherUserInfo.setFaceUrl(weChatInfo.getHeadimgurl()); | ||
| 105 | + if ("1".equals(weChatInfo.getSex())) { | ||
| 106 | + otherUserInfo.setGender("m"); | ||
| 107 | + } else if ("2".equals(weChatInfo.getSex())) { | ||
| 108 | + otherUserInfo.setGender("f"); | ||
| 109 | + } else { | ||
| 110 | + otherUserInfo.setGender("n"); | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + otherUserInfo.setNickName(weChatInfo.getNickname()); | ||
| 114 | + if (!TextUtils.isEmpty(weChatInfo.getProvince())) { | ||
| 115 | + otherUserInfo.setLocation(weChatInfo.getProvince()); | ||
| 116 | + } else { | ||
| 117 | + otherUserInfo.setLocation(weChatInfo.getCountry()); | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + otherUserInfo.setThirdPartyId(weChatInfo.getUnionid()); | ||
| 121 | + otherUserInfo.setLoginType("3"); | ||
| 122 | + } | ||
| 123 | + if (otherUserInfo != null && getPresenter() != null) | ||
| 124 | + getPresenter().bindLogin(this, otherUserInfo); | ||
| 125 | + } else if (observable instanceof ThirdLoginObservable) { | ||
| 126 | + ThirdLoginInfo info = (ThirdLoginInfo) o; | ||
| 127 | + if (info != null) { | ||
| 128 | + if (info.getType() == 1) { | ||
| 129 | + if (info.getOtherUserInfo() != null) otherUserInfo = info.getOtherUserInfo(); | ||
| 130 | + getPresenter().bindLogin(this, otherUserInfo); | ||
| 131 | + } else if (info.getType() == 2) { | ||
| 132 | + if (getMvpView() != null) getMvpView().showMessage(info.getMessage()); | ||
| 133 | + } | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + } | ||
| 137 | + } | ||
| 138 | +} |
cloud/user/src/main/java/com/cnlive/cloud/user/ui/activity/BindPhoneNumberActivity.java
0 → 100644
| 1 | +package com.cnlive.cloud.user.ui.activity; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import android.app.Activity; | ||
| 5 | +import android.content.Intent; | ||
| 6 | +import android.text.TextUtils; | ||
| 7 | +import android.view.View; | ||
| 8 | + | ||
| 9 | +import com.cnlive.cloud.user.R; | ||
| 10 | +import com.cnlive.cloud.user.databinding.ActivityBindPhoneNumberBinding; | ||
| 11 | +import com.cnlive.cloud.user.frame.presenter.BindPhoneNumberPresenter; | ||
| 12 | +import com.cnlive.cloud.user.frame.view.BindPhoneNumberView; | ||
| 13 | +import com.cnlive.core.libs.base.application.AppConfig; | ||
| 14 | +import com.cnlive.core.libs.base.frame.activity.BaseActivity; | ||
| 15 | +import com.cnlive.core.libs.base.util.DoublePressed; | ||
| 16 | +import com.cnlive.login.model.OtherUserInfo; | ||
| 17 | + | ||
| 18 | +import androidx.databinding.ViewDataBinding; | ||
| 19 | + | ||
| 20 | +public class BindPhoneNumberActivity extends BaseActivity<BindPhoneNumberView, BindPhoneNumberPresenter> implements View.OnClickListener { | ||
| 21 | + public OtherUserInfo otherUserInfo; | ||
| 22 | + public String countryCode = "86"; | ||
| 23 | + public String countryName = "中国"; | ||
| 24 | + public String phoneNum; | ||
| 25 | + public String phoneEms; | ||
| 26 | + public static String FROM_TOKEN_ERROR = "from_token_error"; | ||
| 27 | + public static String TAG_MSG = "tagMsg"; | ||
| 28 | + public static String TAG_SHARE = ""; | ||
| 29 | + public static String TAG_CLICK_AD = "clickAd"; | ||
| 30 | + | ||
| 31 | + public String tagMsg; | ||
| 32 | + public String tagShare; | ||
| 33 | + public boolean fromTokenError; | ||
| 34 | + public boolean clickAd; | ||
| 35 | + public ActivityBindPhoneNumberBinding binding; | ||
| 36 | + | ||
| 37 | + public static void startActivity(Activity context, OtherUserInfo info, boolean fromTokenError, String tagMsg, String shareType, boolean clickAd) { | ||
| 38 | + Intent intent = new Intent(); | ||
| 39 | + intent.putExtra(FROM_TOKEN_ERROR, fromTokenError); | ||
| 40 | + intent.putExtra(TAG_MSG, tagMsg); | ||
| 41 | + intent.putExtra(TAG_SHARE, shareType); | ||
| 42 | + intent.putExtra(TAG_CLICK_AD, clickAd); | ||
| 43 | + intent.setClass(context, BindPhoneNumberActivity.class); | ||
| 44 | + intent.putExtra("info", info); | ||
| 45 | + context.startActivity(intent); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + @Override | ||
| 49 | + protected int getBindLayoutId() { | ||
| 50 | + return R.layout.activity_bind_phone_number; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + @Override | ||
| 54 | + protected void initBindingLayoutData(ViewDataBinding baseBinding) { | ||
| 55 | + super.initBindingLayoutData(baseBinding); | ||
| 56 | + binding = (ActivityBindPhoneNumberBinding) baseBinding; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + @Override | ||
| 60 | + protected void initView() { | ||
| 61 | + showDefaultWhiteStatusBar(); | ||
| 62 | + otherUserInfo = (OtherUserInfo) getIntent().getSerializableExtra("info"); | ||
| 63 | + fromTokenError = (boolean) getIntent().getBooleanExtra(FROM_TOKEN_ERROR, false); | ||
| 64 | + tagMsg = (String) getIntent().getStringExtra(TAG_MSG); | ||
| 65 | + tagShare = (String) getIntent().getStringExtra(TAG_SHARE); | ||
| 66 | + clickAd = getIntent().getBooleanExtra(TAG_CLICK_AD, false); | ||
| 67 | + if (!TextUtils.isEmpty(AppConfig.getCountryCode())) { | ||
| 68 | + countryCode = AppConfig.getCountryCode(); | ||
| 69 | + } | ||
| 70 | + if (!TextUtils.isEmpty(AppConfig.getCountryName())) { | ||
| 71 | + countryName = AppConfig.getCountryName(); | ||
| 72 | + } | ||
| 73 | + if (otherUserInfo == null) { | ||
| 74 | + getMvpView().showMessage("数据异常"); | ||
| 75 | + finish(); | ||
| 76 | + } | ||
| 77 | + if (getMvpView() != null) getMvpView().initViews(); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + @Override | ||
| 81 | + public void onClick(View view) { | ||
| 82 | + if (view.getId() == R.id.tv_vc) { | ||
| 83 | + if (DoublePressed.onDoublePressed()) return; | ||
| 84 | + if (!TextUtils.isEmpty(binding.etPhone.getText())) { | ||
| 85 | + phoneNum = binding.etPhone.getText().toString(); | ||
| 86 | + if (getPresenter() != null) | ||
| 87 | + getPresenter().sendCode(this, phoneNum, countryCode); | ||
| 88 | + } else { | ||
| 89 | + if (getMvpView() != null) getMvpView().showMessage("请输入手机号"); | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + } else if (view.getId() == R.id.login) { | ||
| 93 | + if (DoublePressed.onDoublePressed()) return; | ||
| 94 | + if (!TextUtils.isEmpty(binding.etPhone.getText()) && !TextUtils.isEmpty(binding.etEms.getText()) && getPresenter() != null) { | ||
| 95 | + phoneNum = binding.etPhone.getText().toString(); | ||
| 96 | + phoneEms = binding.etEms.getText().toString(); | ||
| 97 | + getPresenter().bindOther(this, otherUserInfo, phoneNum, phoneEms); | ||
| 98 | + } else { | ||
| 99 | + if (getMvpView() != null) getMvpView().showMessage("请输入手机号和验证码"); | ||
| 100 | + } | ||
| 101 | + } else if (view.getId() == R.id.ll_country) { | ||
| 102 | + if (DoublePressed.onDoublePressed()) return; | ||
| 103 | + if (AppConfig.getCountryCode() != null) { | ||
| 104 | + SelectCountryActivity.startSelectCountryActivity(this, SelectCountryActivity.ACTIVITY_RESULT_CODE, AppConfig.getCountryCode()); | ||
| 105 | + } else { | ||
| 106 | + SelectCountryActivity.startSelectCountryActivity(this, SelectCountryActivity.ACTIVITY_RESULT_CODE, countryCode); | ||
| 107 | + } | ||
| 108 | + } | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + @Override | ||
| 112 | + protected void onResume() { | ||
| 113 | + super.onResume(); | ||
| 114 | + showDefaultWhiteStatusBar(); | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + @Override | ||
| 118 | + public void onActivityResult(int requestCode, int resultCode, Intent data) { | ||
| 119 | + super.onActivityResult(requestCode, resultCode, data); | ||
| 120 | + if (resultCode == SelectCountryActivity.ACTIVITY_RESULT_CODE) { | ||
| 121 | + countryCode = data.getStringExtra("countryCode"); | ||
| 122 | + countryName = data.getStringExtra("country"); | ||
| 123 | + if (!TextUtils.isEmpty(countryCode)) { | ||
| 124 | + AppConfig.setCountryCode(countryCode); | ||
| 125 | + binding.tvCountry.setText("+ " + countryCode); | ||
| 126 | + } | ||
| 127 | + if (!TextUtils.isEmpty(countryName)) { | ||
| 128 | + AppConfig.setCountryName(countryName); | ||
| 129 | + binding.tvCountryName.setText(countryName); | ||
| 130 | + } | ||
| 131 | + } | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + @Override | ||
| 135 | + protected void onDestroy() { | ||
| 136 | + super.onDestroy(); | ||
| 137 | + if (getMvpView() != null) getMvpView().cancelLoading(); | ||
| 138 | + } | ||
| 139 | +} |
cloud/user/src/main/java/com/cnlive/cloud/user/ui/activity/LoginDialogActivity.java
| @@ -171,12 +171,12 @@ public class LoginDialogActivity extends BaseActivity<LoginDialogView, LoginDial | @@ -171,12 +171,12 @@ public class LoginDialogActivity extends BaseActivity<LoginDialogView, LoginDial | ||
| 171 | // } | 171 | // } |
| 172 | else if (id == R.id.iv_qq) { | 172 | else if (id == R.id.iv_qq) { |
| 173 | if (DoublePressed.onDoublePressed()) return; | 173 | if (DoublePressed.onDoublePressed()) return; |
| 174 | - if (!ThirdLoginUtil.isQQInstalled(LoginDialogActivity.this) && getMvpView() != null) | 174 | + if (!ThirdLoginUtil.isQQInstalled(LoginDialogActivity.this,true) && getMvpView() != null) |
| 175 | getMvpView().showToast("您未安装该第三方应用,无法获取用户信息!"); | 175 | getMvpView().showToast("您未安装该第三方应用,无法获取用户信息!"); |
| 176 | } else if (id == R.id.iv_wb) { | 176 | } else if (id == R.id.iv_wb) { |
| 177 | if (DoublePressed.onDoublePressed()) return; | 177 | if (DoublePressed.onDoublePressed()) return; |
| 178 | if (Util.isWeiboInstallAndInit(this)) { | 178 | if (Util.isWeiboInstallAndInit(this)) { |
| 179 | - ThirdLoginUtil.loginWeibo(LoginDialogActivity.this); | 179 | + ThirdLoginUtil.loginWeibo(LoginDialogActivity.this,true); |
| 180 | } else { | 180 | } else { |
| 181 | if (getMvpView() != null) getMvpView().showToast("您未安装该第三方应用,无法获取用户信息!"); | 181 | if (getMvpView() != null) getMvpView().showToast("您未安装该第三方应用,无法获取用户信息!"); |
| 182 | } | 182 | } |
| @@ -251,7 +251,7 @@ public class LoginDialogActivity extends BaseActivity<LoginDialogView, LoginDial | @@ -251,7 +251,7 @@ public class LoginDialogActivity extends BaseActivity<LoginDialogView, LoginDial | ||
| 251 | } | 251 | } |
| 252 | } | 252 | } |
| 253 | 253 | ||
| 254 | - ThirdLoginUtil.getQQResult(requestCode, resultCode, data); | 254 | + ThirdLoginUtil.getQQResult(requestCode, resultCode, data,true); |
| 255 | ThirdLoginUtil.getWeiboResult(requestCode, resultCode, data); | 255 | ThirdLoginUtil.getWeiboResult(requestCode, resultCode, data); |
| 256 | 256 | ||
| 257 | } | 257 | } |
cloud/user/src/main/java/com/cnlive/cloud/user/ui/activity/UnBindThreeLoginCheckActivity.java
0 → 100644
| 1 | +package com.cnlive.cloud.user.ui.activity; | ||
| 2 | + | ||
| 3 | +import androidx.annotation.Nullable; | ||
| 4 | +import androidx.appcompat.app.AppCompatActivity; | ||
| 5 | +import androidx.databinding.DataBindingUtil; | ||
| 6 | + | ||
| 7 | +import android.app.Activity; | ||
| 8 | +import android.content.Context; | ||
| 9 | +import android.content.Intent; | ||
| 10 | +import android.os.Bundle; | ||
| 11 | +import android.view.View; | ||
| 12 | + | ||
| 13 | +import com.cnlive.cloud.user.R; | ||
| 14 | +import com.cnlive.cloud.user.databinding.ActivityUnBindThreeLoginCheckBinding; | ||
| 15 | + | ||
| 16 | +public class UnBindThreeLoginCheckActivity extends AppCompatActivity implements View.OnClickListener { | ||
| 17 | + | ||
| 18 | + private ActivityUnBindThreeLoginCheckBinding binding; | ||
| 19 | + | ||
| 20 | + public static void startUnBindThreeLoginCheckActivity(Context context, int openCode) { | ||
| 21 | + Intent intent = new Intent(context, UnBindThreeLoginCheckActivity.class); | ||
| 22 | + Activity activity = (Activity) context; | ||
| 23 | + activity.startActivityForResult(intent,openCode); | ||
| 24 | + activity.overridePendingTransition(R.anim.activity_trans, R.anim.activity_out); | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + | ||
| 28 | + @Override | ||
| 29 | + protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
| 30 | + super.onCreate(savedInstanceState); | ||
| 31 | + binding = DataBindingUtil.setContentView(this, R.layout.activity_un_bind_three_login_check); | ||
| 32 | + binding.tvOk.setOnClickListener(this); | ||
| 33 | + binding.tvCancle.setOnClickListener(this); | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + | ||
| 37 | + @Override | ||
| 38 | + public void finish() { | ||
| 39 | + super.finish(); | ||
| 40 | + overridePendingTransition(R.anim.activity_trans, R.anim.fade_out); | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + | ||
| 44 | + @Override | ||
| 45 | + public void onClick(View view) { | ||
| 46 | + Intent intent=new Intent(); | ||
| 47 | + if (view.getId() == R.id.tv_ok) { | ||
| 48 | + setResult(10086, intent); | ||
| 49 | + finish(); | ||
| 50 | + } else if (view.getId() == R.id.tv_cancle) { | ||
| 51 | + setResult(10010, intent); | ||
| 52 | + finish(); | ||
| 53 | + finish(); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + } | ||
| 57 | +} |
cloud/user/src/main/java/com/cnlive/cloud/user/ui/adapter/BindPhoneNumberAdapter.java
0 → 100644
| 1 | +package com.cnlive.cloud.user.ui.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.cloud.user.R; | ||
| 9 | +import com.cnlive.cloud.user.databinding.ItemBindTitleBinding; | ||
| 10 | +import com.cnlive.cloud.user.databinding.ItemBindUserBinding; | ||
| 11 | +import com.cnlive.cloud.user.model.BindPhoneNumberInfo; | ||
| 12 | +import com.cnlive.core.libs.base.frame.adapter.DataBindingAdapter; | ||
| 13 | +import com.cnlive.core.libs.base.frame.adapter.holder.DataBindingViewHolder; | ||
| 14 | + | ||
| 15 | +import androidx.databinding.DataBindingUtil; | ||
| 16 | +import androidx.databinding.ViewDataBinding; | ||
| 17 | +import androidx.recyclerview.widget.RecyclerView; | ||
| 18 | + | ||
| 19 | +/** | ||
| 20 | + * 作者: 吴奎庆 | ||
| 21 | + * <p> | ||
| 22 | + * 时间: 2019/9/9 | ||
| 23 | + * <p> | ||
| 24 | + * 简介: | ||
| 25 | + */ | ||
| 26 | +public class BindPhoneNumberAdapter extends DataBindingAdapter<BindPhoneNumberInfo> { | ||
| 27 | + Context mContext; | ||
| 28 | + OnItemClickListener listener; | ||
| 29 | + | ||
| 30 | + public BindPhoneNumberAdapter(Context context) { | ||
| 31 | + super(context); | ||
| 32 | + mContext = context; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + public void setItemClickListener(OnItemClickListener listener) { | ||
| 36 | + this.listener = listener; | ||
| 37 | + | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + @Override | ||
| 41 | + public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { | ||
| 42 | + | ||
| 43 | + switch (viewType) { | ||
| 44 | + case BindPhoneNumberInfo.TYPE_TITLE: | ||
| 45 | + ViewDataBinding titleDataBinding = DataBindingUtil.inflate(LayoutInflater.from(mContext), R.layout.item_bind_title, parent, false); | ||
| 46 | + DataBindingViewHolder titleViewHolder = new DataBindingViewHolder(titleDataBinding.getRoot()); | ||
| 47 | + titleViewHolder.setBinding(titleDataBinding); | ||
| 48 | + return titleViewHolder; | ||
| 49 | + | ||
| 50 | + case BindPhoneNumberInfo.TYPE_LOGIN: | ||
| 51 | + ViewDataBinding titlelogin = DataBindingUtil.inflate(LayoutInflater.from(mContext), R.layout.item_bind_user, parent, false); | ||
| 52 | + DataBindingViewHolder loginHolder = new DataBindingViewHolder(titlelogin.getRoot()); | ||
| 53 | + loginHolder.setBinding(titlelogin); | ||
| 54 | + return loginHolder; | ||
| 55 | + | ||
| 56 | + } | ||
| 57 | + return null; | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + @Override | ||
| 61 | + public int getItemViewType(int position) { | ||
| 62 | + return mItems.get(position).getItemType(); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + @Override | ||
| 66 | + public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { | ||
| 67 | + super.onBindViewHolder(holder, position); | ||
| 68 | + int itemType = getItem(position).getItemType(); | ||
| 69 | + DataBindingViewHolder bindingViewHolder = (DataBindingViewHolder) holder; | ||
| 70 | + switch (itemType) { | ||
| 71 | + case BindPhoneNumberInfo.TYPE_TITLE: | ||
| 72 | + ItemBindTitleBinding bindTitleBinding = (ItemBindTitleBinding) bindingViewHolder.getBinding(); | ||
| 73 | + bindTitleBinding.setData(getItem(position)); | ||
| 74 | + break; | ||
| 75 | + case BindPhoneNumberInfo.TYPE_LOGIN: | ||
| 76 | + ItemBindUserBinding bindUserBinding = (ItemBindUserBinding) bindingViewHolder.getBinding(); | ||
| 77 | + bindUserBinding.setData(getItem(position)); | ||
| 78 | + bindUserBinding.tvBind.setOnClickListener(view -> { | ||
| 79 | + listener.onItemClick(getItem(position), bindUserBinding.tvBind,position); | ||
| 80 | + }); | ||
| 81 | + break; | ||
| 82 | + } | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + | ||
| 86 | + public interface OnItemClickListener { | ||
| 87 | + void onItemClick(BindPhoneNumberInfo info, View view, int position); | ||
| 88 | + } | ||
| 89 | +} |
cloud/user/src/main/java/com/cnlive/cloud/user/ui/fragment/QuickLoginFragment.java
| @@ -186,12 +186,12 @@ public class QuickLoginFragment extends BaseFragment<QuickLoginView, QuickLoginP | @@ -186,12 +186,12 @@ public class QuickLoginFragment extends BaseFragment<QuickLoginView, QuickLoginP | ||
| 186 | 186 | ||
| 187 | }else if (id == R.id.iv_qq) { | 187 | }else if (id == R.id.iv_qq) { |
| 188 | if (DoublePressed.onDoublePressed()) return; | 188 | if (DoublePressed.onDoublePressed()) return; |
| 189 | - if (!ThirdLoginUtil.isQQInstalled(getActivity()) && getMvpView() != null) | 189 | + if (!ThirdLoginUtil.isQQInstalled(getActivity(),true) && getMvpView() != null) |
| 190 | getMvpView().showToast("您未安装该第三方应用,无法获取用户信息!"); | 190 | getMvpView().showToast("您未安装该第三方应用,无法获取用户信息!"); |
| 191 | } else if (id == R.id.iv_wb) { | 191 | } else if (id == R.id.iv_wb) { |
| 192 | if (DoublePressed.onDoublePressed()) return; | 192 | if (DoublePressed.onDoublePressed()) return; |
| 193 | if (Util.isWeiboInstallAndInit(getActivity())) { | 193 | if (Util.isWeiboInstallAndInit(getActivity())) { |
| 194 | - ThirdLoginUtil.loginWeibo(getActivity()); | 194 | + ThirdLoginUtil.loginWeibo(getActivity(),true); |
| 195 | } else { | 195 | } else { |
| 196 | if (getMvpView() != null) getMvpView().showToast("您未安装该第三方应用,无法获取用户信息!"); | 196 | if (getMvpView() != null) getMvpView().showToast("您未安装该第三方应用,无法获取用户信息!"); |
| 197 | } | 197 | } |
| @@ -265,7 +265,7 @@ public class QuickLoginFragment extends BaseFragment<QuickLoginView, QuickLoginP | @@ -265,7 +265,7 @@ public class QuickLoginFragment extends BaseFragment<QuickLoginView, QuickLoginP | ||
| 265 | } | 265 | } |
| 266 | } | 266 | } |
| 267 | 267 | ||
| 268 | - ThirdLoginUtil.getQQResult(requestCode, resultCode, data); | 268 | + ThirdLoginUtil.getQQResult(requestCode, resultCode, data,true); |
| 269 | ThirdLoginUtil.getWeiboResult(requestCode, resultCode, data); | 269 | ThirdLoginUtil.getWeiboResult(requestCode, resultCode, data); |
| 270 | } | 270 | } |
| 271 | 271 |
cloud/user/src/main/res/drawable-hdpi/bind_phone.webp
0 → 100644
No preview for this file type
cloud/user/src/main/res/drawable-xhdpi/bind_phone.webp
0 → 100644
No preview for this file type
cloud/user/src/main/res/drawable-xxhdpi/bind_phone.webp
0 → 100644
No preview for this file type
cloud/user/src/main/res/drawable/shape_bind_black_bg.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<shape android:shape="rectangle" | ||
| 3 | + xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| 4 | + <solid android:color="#D9D9D9" /> | ||
| 5 | + <corners android:topLeftRadius="15dp" android:topRightRadius="15dp" android:bottomLeftRadius="15dp" android:bottomRightRadius="15dp" /> | ||
| 6 | +</shape> | ||
| 0 | \ No newline at end of file | 7 | \ No newline at end of file |
cloud/user/src/main/res/drawable/shape_bind_green_bg.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<shape android:shape="rectangle" | ||
| 3 | + xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| 4 | + <solid android:color="#ff23d41e" /> | ||
| 5 | + <corners android:topLeftRadius="15dp" android:topRightRadius="15dp" android:bottomLeftRadius="15dp" android:bottomRightRadius="15dp" /> | ||
| 6 | +</shape> | ||
| 0 | \ No newline at end of file | 7 | \ No newline at end of file |
cloud/user/src/main/res/drawable/shape_update.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| 3 | + <solid android:color="@color/white" /> | ||
| 4 | + <corners android:topLeftRadius="10dp" | ||
| 5 | + android:topRightRadius="10dp" | ||
| 6 | + android:bottomRightRadius="10dp" | ||
| 7 | + android:bottomLeftRadius="10dp"/> | ||
| 8 | + | ||
| 9 | + <!-- 间隔 --> | ||
| 10 | + <!--<padding--> | ||
| 11 | + <!--android:left="10dp"--> | ||
| 12 | + <!--android:top="3dp"--> | ||
| 13 | + <!--android:right="10dp"--> | ||
| 14 | + <!--android:bottom="3dp"/><!– 各方向的间隔 –>--> | ||
| 15 | + <stroke android:width="1dp" android:color="@color/white" /> | ||
| 16 | +</shape> | ||
| 0 | \ No newline at end of file | 17 | \ No newline at end of file |
cloud/user/src/main/res/layout/activity_bind_phone_manger.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<layout> | ||
| 3 | + | ||
| 4 | + | ||
| 5 | + <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 6 | + android:layout_width="match_parent" | ||
| 7 | + android:layout_height="match_parent" | ||
| 8 | + android:background="@color/white" | ||
| 9 | + android:orientation="vertical"> | ||
| 10 | + | ||
| 11 | + <include | ||
| 12 | + android:id="@+id/includeToolbar" | ||
| 13 | + layout="@layout/layout_title_toolbar" /> | ||
| 14 | + | ||
| 15 | + <View | ||
| 16 | + android:id="@+id/line" | ||
| 17 | + android:layout_width="match_parent" | ||
| 18 | + android:layout_height="1dp" | ||
| 19 | + android:layout_below="@+id/includeToolbar" | ||
| 20 | + android:background="@color/whiteGary" /> | ||
| 21 | + | ||
| 22 | + <androidx.recyclerview.widget.RecyclerView | ||
| 23 | + android:background="#F4F4F4" | ||
| 24 | + android:id="@+id/rv_content" | ||
| 25 | + android:layout_width="match_parent" | ||
| 26 | + android:layout_height="match_parent" /> | ||
| 27 | + | ||
| 28 | + | ||
| 29 | + </LinearLayout> | ||
| 30 | + | ||
| 31 | +</layout> |
cloud/user/src/main/res/layout/activity_bind_phone_number.xml
| @@ -118,38 +118,38 @@ | @@ -118,38 +118,38 @@ | ||
| 118 | android:layout_height="wrap_content"> | 118 | android:layout_height="wrap_content"> |
| 119 | 119 | ||
| 120 | 120 | ||
| 121 | - <TextView | ||
| 122 | - android:layout_marginLeft="15dp" | ||
| 123 | - android:id="@+id/tv_country_name" | ||
| 124 | - android:layout_width="wrap_content" | ||
| 125 | - android:layout_height="wrap_content" | ||
| 126 | - android:layout_centerVertical="true" | ||
| 127 | - android:text="手机号归属地" | ||
| 128 | - android:textColor="@color/color_333" | ||
| 129 | - android:textSize="14sp" /> | ||
| 130 | - | ||
| 131 | - <LinearLayout | ||
| 132 | - android:layout_marginRight="12dp" | ||
| 133 | - android:id="@+id/ll_country" | ||
| 134 | - android:layout_width="wrap_content" | ||
| 135 | - android:layout_height="wrap_content" | ||
| 136 | - android:layout_alignParentRight="true" | ||
| 137 | - android:padding="13dp"> | ||
| 138 | - | ||
| 139 | <TextView | 121 | <TextView |
| 140 | - android:id="@+id/tv_country" | 122 | + android:layout_marginLeft="15dp" |
| 123 | + android:id="@+id/tv_country_name" | ||
| 141 | android:layout_width="wrap_content" | 124 | android:layout_width="wrap_content" |
| 142 | android:layout_height="wrap_content" | 125 | android:layout_height="wrap_content" |
| 126 | + android:layout_centerVertical="true" | ||
| 127 | + android:text="手机号归属地" | ||
| 143 | android:textColor="@color/color_333" | 128 | android:textColor="@color/color_333" |
| 144 | android:textSize="14sp" /> | 129 | android:textSize="14sp" /> |
| 145 | 130 | ||
| 146 | - <ImageView | 131 | + <LinearLayout |
| 132 | + android:layout_marginRight="12dp" | ||
| 133 | + android:id="@+id/ll_country" | ||
| 147 | android:layout_width="wrap_content" | 134 | android:layout_width="wrap_content" |
| 148 | android:layout_height="wrap_content" | 135 | android:layout_height="wrap_content" |
| 149 | - android:layout_gravity="center_vertical" | ||
| 150 | - android:layout_marginLeft="9dp" | ||
| 151 | - android:background="@drawable/dl_xl" /> | ||
| 152 | - </LinearLayout> | 136 | + android:layout_alignParentRight="true" |
| 137 | + android:padding="13dp"> | ||
| 138 | + | ||
| 139 | + <TextView | ||
| 140 | + android:id="@+id/tv_country" | ||
| 141 | + android:layout_width="wrap_content" | ||
| 142 | + android:layout_height="wrap_content" | ||
| 143 | + android:textColor="@color/color_333" | ||
| 144 | + android:textSize="14sp" /> | ||
| 145 | + | ||
| 146 | + <ImageView | ||
| 147 | + android:layout_width="wrap_content" | ||
| 148 | + android:layout_height="wrap_content" | ||
| 149 | + android:layout_gravity="center_vertical" | ||
| 150 | + android:layout_marginLeft="9dp" | ||
| 151 | + android:background="@drawable/dl_xl" /> | ||
| 152 | + </LinearLayout> | ||
| 153 | </RelativeLayout> | 153 | </RelativeLayout> |
| 154 | <LinearLayout | 154 | <LinearLayout |
| 155 | android:layout_width="match_parent" | 155 | android:layout_width="match_parent" |
cloud/user/src/main/res/layout/activity_un_bind_three_login_check.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<layout xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| 3 | + | ||
| 4 | + <RelativeLayout | ||
| 5 | + android:id="@+id/root" | ||
| 6 | + android:layout_width="match_parent" | ||
| 7 | + android:layout_height="match_parent" | ||
| 8 | + android:layout_gravity="center" | ||
| 9 | + android:background="@color/transparent"> | ||
| 10 | + | ||
| 11 | + | ||
| 12 | + <LinearLayout | ||
| 13 | + android:layout_width="match_parent" | ||
| 14 | + android:layout_height="wrap_content" | ||
| 15 | + android:layout_centerInParent="true" | ||
| 16 | + android:layout_margin="20dp" | ||
| 17 | + android:layout_marginLeft="2dp" | ||
| 18 | + android:layout_marginRight="2dp" | ||
| 19 | + android:background="@drawable/shape_update" | ||
| 20 | + android:orientation="vertical"> | ||
| 21 | + | ||
| 22 | + <TextView | ||
| 23 | + android:id="@+id/tv_title" | ||
| 24 | + android:layout_width="wrap_content" | ||
| 25 | + android:layout_height="wrap_content" | ||
| 26 | + android:layout_gravity="center_horizontal" | ||
| 27 | + android:layout_marginLeft="10dp" | ||
| 28 | + android:layout_marginTop="48dp" | ||
| 29 | + android:layout_marginRight="10dp" | ||
| 30 | + android:background="@null" | ||
| 31 | + android:text="确定解除绑定? " | ||
| 32 | + android:textColor="@color/black" | ||
| 33 | + android:textSize="18sp" /> | ||
| 34 | + | ||
| 35 | + | ||
| 36 | + <View | ||
| 37 | + android:layout_marginTop="30dp" | ||
| 38 | + android:layout_width="match_parent" | ||
| 39 | + android:layout_height="1dp" | ||
| 40 | + android:background="@color/driver_list" /> | ||
| 41 | + | ||
| 42 | + <LinearLayout | ||
| 43 | + android:layout_width="match_parent" | ||
| 44 | + android:layout_height="wrap_content" | ||
| 45 | + android:layout_gravity="center_horizontal" | ||
| 46 | + android:gravity="center" | ||
| 47 | + android:orientation="vertical"> | ||
| 48 | + | ||
| 49 | + <LinearLayout | ||
| 50 | + android:layout_width="match_parent" | ||
| 51 | + android:layout_height="44dp" | ||
| 52 | + android:orientation="horizontal"> | ||
| 53 | + | ||
| 54 | + <TextView | ||
| 55 | + android:id="@+id/tv_cancle" | ||
| 56 | + android:layout_width="0dp" | ||
| 57 | + android:layout_height="wrap_content" | ||
| 58 | + android:layout_weight="1" | ||
| 59 | + android:gravity="center" | ||
| 60 | + android:padding="10dp" | ||
| 61 | + android:singleLine="true" | ||
| 62 | + android:text="取消" | ||
| 63 | + android:textColor="@color/color_23d41e" | ||
| 64 | + android:textSize="17sp" /> | ||
| 65 | + | ||
| 66 | + <View | ||
| 67 | + android:layout_width="1dp" | ||
| 68 | + android:layout_height="match_parent" | ||
| 69 | + android:background="@color/driver_list" /> | ||
| 70 | + | ||
| 71 | + <TextView | ||
| 72 | + android:id="@+id/tv_ok" | ||
| 73 | + android:layout_width="0dp" | ||
| 74 | + android:layout_height="wrap_content" | ||
| 75 | + android:layout_weight="1" | ||
| 76 | + android:gravity="center" | ||
| 77 | + android:padding="10dp" | ||
| 78 | + android:singleLine="true" | ||
| 79 | + android:text="确定" | ||
| 80 | + android:textColor="@color/color_23d41e" | ||
| 81 | + android:textSize="17sp" /> | ||
| 82 | + | ||
| 83 | + | ||
| 84 | + </LinearLayout> | ||
| 85 | + | ||
| 86 | + | ||
| 87 | + </LinearLayout> | ||
| 88 | + | ||
| 89 | + | ||
| 90 | + </LinearLayout> | ||
| 91 | + | ||
| 92 | + | ||
| 93 | + </RelativeLayout> | ||
| 94 | + | ||
| 95 | + | ||
| 96 | +</layout> | ||
| 0 | \ No newline at end of file | 97 | \ No newline at end of file |
cloud/user/src/main/res/layout/item_bind_title.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<layout> | ||
| 3 | + | ||
| 4 | + <data> | ||
| 5 | + | ||
| 6 | + <variable | ||
| 7 | + name="data" | ||
| 8 | + type="com.cnlive.cloud.user.model.BindPhoneNumberInfo" /> | ||
| 9 | + | ||
| 10 | + </data> | ||
| 11 | + | ||
| 12 | + <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 13 | + android:layout_width="match_parent" | ||
| 14 | + android:background="#F4F4F4" | ||
| 15 | + android:layout_height="38dp"> | ||
| 16 | + <TextView | ||
| 17 | + android:id="@+id/tv_title" | ||
| 18 | + android:layout_marginLeft="15.5dp" | ||
| 19 | + android:layout_gravity="center_vertical" | ||
| 20 | + android:layout_width="wrap_content" | ||
| 21 | + android:layout_height="wrap_content" | ||
| 22 | + android:text="@{data.itemName}" | ||
| 23 | + android:textColor="#ff999999" | ||
| 24 | + android:textSize="14sp" | ||
| 25 | + /> | ||
| 26 | + </LinearLayout> | ||
| 27 | +</layout> |
cloud/user/src/main/res/layout/item_bind_user.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<layout> | ||
| 3 | + | ||
| 4 | + <data> | ||
| 5 | + <variable | ||
| 6 | + name="data" | ||
| 7 | + type="com.cnlive.cloud.user.model.BindPhoneNumberInfo" /> | ||
| 8 | + | ||
| 9 | + </data> | ||
| 10 | + | ||
| 11 | + <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 12 | + android:layout_width="match_parent" | ||
| 13 | + android:layout_height="77dp" | ||
| 14 | + android:background="@color/white"> | ||
| 15 | + | ||
| 16 | + <ImageView | ||
| 17 | + android:id="@+id/iv_login" | ||
| 18 | + android:layout_width="47dp" | ||
| 19 | + android:layout_height="47dp" | ||
| 20 | + android:layout_centerVertical="true" | ||
| 21 | + android:layout_marginLeft="15dp" | ||
| 22 | + android:src="@{data.typeIcon}" /> | ||
| 23 | + | ||
| 24 | + | ||
| 25 | + <LinearLayout | ||
| 26 | + android:layout_width="wrap_content" | ||
| 27 | + android:layout_height="wrap_content" | ||
| 28 | + android:layout_centerVertical="true" | ||
| 29 | + android:layout_marginLeft="11.5dp" | ||
| 30 | + android:layout_toRightOf="@+id/iv_login" | ||
| 31 | + android:orientation="vertical"> | ||
| 32 | + | ||
| 33 | + <TextView | ||
| 34 | + android:layout_width="wrap_content" | ||
| 35 | + android:layout_height="wrap_content" | ||
| 36 | + android:text="@{data.typeName}" | ||
| 37 | + android:textColor="#ff333333" | ||
| 38 | + android:textSize="16sp" /> | ||
| 39 | + | ||
| 40 | + <TextView | ||
| 41 | + android:layout_width="wrap_content" | ||
| 42 | + android:layout_height="wrap_content" | ||
| 43 | + android:text="@{data.userName}" | ||
| 44 | + android:textColor="#ff999999" | ||
| 45 | + android:textSize="12sp" /> | ||
| 46 | + </LinearLayout> | ||
| 47 | + | ||
| 48 | + | ||
| 49 | + <TextView | ||
| 50 | + android:id="@+id/tv_bind" | ||
| 51 | + android:layout_width="68dp" | ||
| 52 | + android:layout_height="30dp" | ||
| 53 | + android:layout_alignParentRight="true" | ||
| 54 | + android:layout_centerVertical="true" | ||
| 55 | + android:layout_marginRight="15dp" | ||
| 56 | + android:background="@{data.bind?@drawable/shape_bind_black_bg:@drawable/shape_bind_green_bg}" | ||
| 57 | + android:gravity="center" | ||
| 58 | + android:text="@{data.bind?@string/three_login_bind:@string/three_login_bind_un}" | ||
| 59 | + android:textColor="@color/white" /> | ||
| 60 | + | ||
| 61 | + </RelativeLayout> | ||
| 62 | +</layout> |
cloud/user/src/main/res/values/strings.xml
| @@ -20,4 +20,6 @@ | @@ -20,4 +20,6 @@ | ||
| 20 | 20 | ||
| 21 | <string name="msg_exit">再次点击退出网家家</string> | 21 | <string name="msg_exit">再次点击退出网家家</string> |
| 22 | <string name="msg_exit_login">再次点击返回登录</string> | 22 | <string name="msg_exit_login">再次点击返回登录</string> |
| 23 | + <string name="three_login_bind">已绑定</string> | ||
| 24 | + <string name="three_login_bind_un">未绑定</string> | ||
| 23 | </resources> | 25 | </resources> |
core/network/src/main/java/com/cnlive/core/network/api/ApiBaseServiceOpen.java
| @@ -14,6 +14,7 @@ import java.util.Map; | @@ -14,6 +14,7 @@ import java.util.Map; | ||
| 14 | import io.reactivex.Observable; | 14 | import io.reactivex.Observable; |
| 15 | import okhttp3.MultipartBody; | 15 | import okhttp3.MultipartBody; |
| 16 | import okhttp3.RequestBody; | 16 | import okhttp3.RequestBody; |
| 17 | +import retrofit2.adapter.rxjava2.Result; | ||
| 17 | import retrofit2.http.Multipart; | 18 | import retrofit2.http.Multipart; |
| 18 | import retrofit2.http.POST; | 19 | import retrofit2.http.POST; |
| 19 | import retrofit2.http.Part; | 20 | import retrofit2.http.Part; |
| @@ -177,4 +178,20 @@ public interface ApiBaseServiceOpen { | @@ -177,4 +178,20 @@ public interface ApiBaseServiceOpen { | ||
| 177 | @POST("open/api2/user/loginIn3rdAndMobileForWJJ") | 178 | @POST("open/api2/user/loginIn3rdAndMobileForWJJ") |
| 178 | Observable<BaseResult<UserData>> loginIn3rdAndMobileForWJJ(@QueryMap Map<String, String> map); | 179 | Observable<BaseResult<UserData>> loginIn3rdAndMobileForWJJ(@QueryMap Map<String, String> map); |
| 179 | 180 | ||
| 181 | + | ||
| 182 | + /** | ||
| 183 | + * 解除绑定 | ||
| 184 | + * @param map | ||
| 185 | + * @return | ||
| 186 | + */ | ||
| 187 | + @POST("open/api2/user/unBind3rd") | ||
| 188 | + Observable<BaseResult> unBind3rd(@QueryMap Map<String, String> map); | ||
| 189 | + | ||
| 190 | + /** | ||
| 191 | + * 绑定 | ||
| 192 | + * @param map | ||
| 193 | + * @return | ||
| 194 | + */ | ||
| 195 | + @POST("open/api2/user/bind3rd") | ||
| 196 | + Observable<BaseResult> bind3rd(@QueryMap Map<String, String> map); | ||
| 180 | } | 197 | } |
module/shanghaishop/build.gradle
| @@ -27,7 +27,7 @@ dependencies { | @@ -27,7 +27,7 @@ dependencies { | ||
| 27 | 27 | ||
| 28 | 28 | ||
| 29 | /** 圆形图片处理 androidx **/ | 29 | /** 圆形图片处理 androidx **/ |
| 30 | - implementation 'de.hdodenhof:circleimageview:3.0.1' | 30 | + implementation "de.hdodenhof:circleimageview:$rootProject.circleimageview" |
| 31 | 31 | ||
| 32 | /*下拉刷新 上拉加载更多*/ | 32 | /*下拉刷新 上拉加载更多*/ |
| 33 | implementation 'com.github.Aspsine:SwipeToLoadLayout:1.0.4' | 33 | implementation 'com.github.Aspsine:SwipeToLoadLayout:1.0.4' |
module/shopcity/.gitignore
0 → 100644
| 1 | +/build |
module/shopcity/build.gradle
0 → 100644
| 1 | +apply plugin: 'com.android.library' | ||
| 2 | + | ||
| 3 | +android { | ||
| 4 | +// compileSdkVersion 29 | ||
| 5 | +// buildToolsVersion "29.0.2" | ||
| 6 | +// | ||
| 7 | +// | ||
| 8 | +// defaultConfig { | ||
| 9 | +// minSdkVersion 16 | ||
| 10 | +// targetSdkVersion 29 | ||
| 11 | +// versionCode 1 | ||
| 12 | +// versionName "1.0" | ||
| 13 | +// | ||
| 14 | +// testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
| 15 | +// consumerProguardFiles 'consumer-rules.pro' | ||
| 16 | +// } | ||
| 17 | + | ||
| 18 | + buildTypes { | ||
| 19 | + release { | ||
| 20 | + minifyEnabled false | ||
| 21 | + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
| 22 | + } | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | +dependencies { | ||
| 28 | + implementation fileTree(dir: 'libs', include: ['*.jar']) | ||
| 29 | + | ||
| 30 | + implementation 'androidx.appcompat:appcompat:1.0.2' | ||
| 31 | + testImplementation 'junit:junit:4.12' | ||
| 32 | + androidTestImplementation 'androidx.test:runner:1.1.1' | ||
| 33 | + androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' | ||
| 34 | + | ||
| 35 | + | ||
| 36 | + def moduleVersion = "0.3.7-alpha01" | ||
| 37 | + | ||
| 38 | + | ||
| 39 | + annotationProcessor "com.google.dagger:dagger-android-processor:2.16" | ||
| 40 | + // 刷新控件 | ||
| 41 | + implementation "com.scwang.smartrefresh:SmartRefreshLayout:$rootProject.SmartRefreshLayout" | ||
| 42 | + implementation "com.scwang.smartrefresh:SmartRefreshHeader:$rootProject.SmartRefreshHeader" | ||
| 43 | + // 圆形图片 | ||
| 44 | + implementation "de.hdodenhof:circleimageview:$rootProject.circleimageview" | ||
| 45 | + // MagicIndicator | ||
| 46 | + implementation("com.github.SherlockGougou:MagicIndicator:1.6.0") { | ||
| 47 | + exclude group: 'com.android.support' | ||
| 48 | + } | ||
| 49 | + // recyclerview-animators | ||
| 50 | + implementation("jp.wasabeef:recyclerview-animators:$rootProject.recyclerviewAnimators") { | ||
| 51 | + exclude group: 'com.android.support'// 内部引入了27.1.1的appcompat-v7包和support-annotations | ||
| 52 | + } | ||
| 53 | + // 视讯云支付sdk | ||
| 54 | +// implementation 'com.cnlive:lib_cnpay:1.0.9' | ||
| 55 | + // span | ||
| 56 | + api 'com.zrq:spanbuilder:1.0.5' | ||
| 57 | + // 选择的dialog(版本升级了) | ||
| 58 | + api 'com.contrarywind:Android-PickerView:4.1.6' | ||
| 59 | + // shape button | ||
| 60 | + api 'com.github.medyo:fancybuttons:1.9.0' | ||
| 61 | + // 高德定位 | ||
| 62 | + implementation "com.amap.api:location:latest.integration" | ||
| 63 | + // 高德地图3D | ||
| 64 | + api 'com.amap.api:3dmap:6.6.0' | ||
| 65 | + // 搜索功能 | ||
| 66 | + api 'com.amap.api:search:6.5.0.1' | ||
| 67 | + // 轮播图 | ||
| 68 | + api 'com.youth.banner:banner:1.4.10' | ||
| 69 | + // 圆角图片 | ||
| 70 | + implementation 'com.makeramen:roundedimageview:2.3.0' | ||
| 71 | + // 图片选择 | ||
| 72 | + api 'com.cnlive.module:matisse:0.0.1' | ||
| 73 | + // divider | ||
| 74 | + api('com.zrq:divider:1.0.1') { | ||
| 75 | + exclude group: 'com.android.support' | ||
| 76 | + } | ||
| 77 | + // PhotoView | ||
| 78 | + api('com.github.chrisbanes:PhotoView:2.1.4') { | ||
| 79 | + exclude group: 'com.android.support' | ||
| 80 | + } | ||
| 81 | + // DiscreteScrollView | ||
| 82 | + api('com.yarolegovich:discrete-scrollview:1.4.9') { | ||
| 83 | + exclude group: 'com.android.support' | ||
| 84 | + } | ||
| 85 | + // baseAdapter | ||
| 86 | + api "com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.42" | ||
| 87 | + // 状态栏 | ||
| 88 | + api "com.jaeger.statusbarutil:library:1.5.1" | ||
| 89 | + // EventBus | ||
| 90 | + api "org.greenrobot:eventbus:3.1.1" | ||
| 91 | + // RxLifecycle | ||
| 92 | + api("com.trello.rxlifecycle2:rxlifecycle:2.2.2") { | ||
| 93 | + exclude module: 'rxjava'// rxJava | ||
| 94 | + } | ||
| 95 | + //没有 | ||
| 96 | + api("com.trello.rxlifecycle2:rxlifecycle-components:2.2.2") { | ||
| 97 | + exclude group: 'com.android.support'// 内部引入了27.1.1的appcompat-v7包和support-annotations | ||
| 98 | + exclude module: 'rxjava'// rxJava | ||
| 99 | + } | ||
| 100 | + // Anko Commons | ||
| 101 | + api "org.jetbrains.anko:anko-commons:0.10.5" | ||
| 102 | + api "org.jetbrains.anko:anko-support-v4-commons:0.10.5"// Support-v4 (only Anko Commons) | ||
| 103 | + // Dagger2 | ||
| 104 | + api "com.google.dagger:dagger:2.16" | ||
| 105 | + annotationProcessor "com.google.dagger:dagger-compiler:2.16" | ||
| 106 | + // dagger-android | ||
| 107 | + api "com.google.dagger:dagger-android:2.16" | ||
| 108 | + api "com.google.dagger:dagger-android-support:2.16" | ||
| 109 | + api("com.cnlive.module:shop:$moduleVersion") { | ||
| 110 | + transitive = false | ||
| 111 | + } | ||
| 112 | + api("com.cnlive.module:base:$moduleVersion") { | ||
| 113 | + transitive = false | ||
| 114 | + } | ||
| 115 | + api("com.cnlive.module:common:$moduleVersion") { | ||
| 116 | + transitive = false | ||
| 117 | + } | ||
| 118 | + api("com.cnlive.module:repast:$moduleVersion") { | ||
| 119 | + transitive = false | ||
| 120 | + } | ||
| 121 | + api("com.cnlive.module:ar:$moduleVersion") { | ||
| 122 | + transitive = false | ||
| 123 | + } | ||
| 124 | + // happy-china | ||
| 125 | + api("com.cnlive.module:happy-china:$moduleVersion") { | ||
| 126 | + transitive = false | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + api("com.cnlive.module:local-life:$moduleVersion") { | ||
| 130 | + transitive = false | ||
| 131 | + } | ||
| 132 | + // ******** 工具 ******** | ||
| 133 | + // kotlin环境 | ||
| 134 | + api "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.21" | ||
| 135 | + // systembartint | ||
| 136 | + api 'com.readystatesoftware.systembartint:systembartint:1.0.4' | ||
| 137 | + | ||
| 138 | + // 文字垂直滚动 | ||
| 139 | + api 'com.sunfusheng:marqueeview:1.2.0' | ||
| 140 | + // 流式布局 | ||
| 141 | + api 'com.hyman:flowlayout-lib:1.1.2' | ||
| 142 | + // gif //没有 | ||
| 143 | + api 'pl.droidsonroids.gif:android-gif-drawable:1.2.8' | ||
| 144 | + // 网家家支付 | ||
| 145 | + api "com.cnlive.libs:wjjpay:1.0.5" | ||
| 146 | + | ||
| 147 | + api "com.oushangfeng:PinnedSectionItemDecoration:1.3.2" | ||
| 148 | + | ||
| 149 | + // snap | ||
| 150 | + implementation 'com.github.rubensousa:gravitysnaphelper-compat:2.0' | ||
| 151 | + // 模糊 | ||
| 152 | + implementation "com.wonderkiln:blurkit:1.0.0" | ||
| 153 | + // LayoutManager | ||
| 154 | + implementation "com.beloo.widget:ChipsLayoutManager:0.3.7@aar" | ||
| 155 | + | ||
| 156 | + //CNLiveLibs | ||
| 157 | + implementation "com.cnlive.libs:base:1.7.6.18" | ||
| 158 | + implementation "com.cnlive.libs:emoj:$rootProject.libEmoj" | ||
| 159 | + implementation "com.cnlive.libs:noober_menu:$rootProject.libMenu" | ||
| 160 | +// implementation "com.cnlive.libs:arch:$rootProject.appArch" | ||
| 161 | + //七牛上传 | ||
| 162 | + implementation "com.qiniu:qiniu-android-sdk:$rootProject.qiniuAndroidSdk" | ||
| 163 | + // 阴影布局 | ||
| 164 | + api 'com.github.lihangleo2:ShadowLayout:2.0.1' | ||
| 165 | + | ||
| 166 | + api 'com.github.lihangleo2:ShadowLayout:2.0.1' | ||
| 167 | + | ||
| 168 | + api "com.tencent.imsdk:imsdk:$rootProject.imsdk" | ||
| 169 | + | ||
| 170 | + implementation project(path: ':cloud:user') | ||
| 171 | + implementation project(path: ':cloud:app_pay') | ||
| 172 | + implementation project(path: ':module:shanghaishop') | ||
| 173 | + implementation project(path: ':core:base') | ||
| 174 | +} |
module/shopcity/consumer-rules.pro
0 → 100644
module/shopcity/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 |
module/shopcity/src/androidTest/java/com/clive/happychina/shopcity/ExampleInstrumentedTest.java
0 → 100644
| 1 | +package com.clive.happychina.shopcity; | ||
| 2 | + | ||
| 3 | +import android.content.Context; | ||
| 4 | + | ||
| 5 | +import androidx.test.platform.app.InstrumentationRegistry; | ||
| 6 | +import androidx.test.ext.junit.runners.AndroidJUnit4; | ||
| 7 | + | ||
| 8 | +import org.junit.Test; | ||
| 9 | +import org.junit.runner.RunWith; | ||
| 10 | + | ||
| 11 | +import static org.junit.Assert.*; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * Instrumented test, which will execute on an Android device. | ||
| 15 | + * | ||
| 16 | + * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
| 17 | + */ | ||
| 18 | +@RunWith(AndroidJUnit4.class) | ||
| 19 | +public class ExampleInstrumentedTest { | ||
| 20 | + @Test | ||
| 21 | + public void useAppContext() { | ||
| 22 | + // Context of the app under test. | ||
| 23 | + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); | ||
| 24 | + | ||
| 25 | + assertEquals("com.clive.happychina.shopcity.test", appContext.getPackageName()); | ||
| 26 | + } | ||
| 27 | +} |
module/shopcity/src/main/AndroidManifest.xml
0 → 100644
| 1 | +<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 2 | + package="com.clive.happychina.shopcity" > | ||
| 3 | + | ||
| 4 | + <uses-permission android:name="android.permission.INTERNET" /> | ||
| 5 | + <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
| 6 | + <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | ||
| 7 | + <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | ||
| 8 | + <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | ||
| 9 | + | ||
| 10 | + <application | ||
| 11 | + android:allowBackup="true" | ||
| 12 | + android:label="@string/app_name" | ||
| 13 | + android:supportsRtl="true" | ||
| 14 | + android:vmSafeMode="true"> | ||
| 15 | + <activity | ||
| 16 | + android:name=".OrderListShopActivity" | ||
| 17 | + android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" | ||
| 18 | + android:screenOrientation="portrait" /> | ||
| 19 | + <activity android:name=".ShopWebActivity"></activity> | ||
| 20 | + </application> | ||
| 21 | + | ||
| 22 | +</manifest> |
module/shopcity/src/main/java/com/clive/happychina/shopcity/OrderListShopActivity.java
0 → 100644
| 1 | +package com.clive.happychina.shopcity; | ||
| 2 | + | ||
| 3 | +import android.graphics.Color; | ||
| 4 | +import android.os.Bundle; | ||
| 5 | + | ||
| 6 | +import com.cnlive.libs.base.util.StatusBarUtil; | ||
| 7 | +import com.cnlive.module.common.utils.SystemBarUtils; | ||
| 8 | +import com.cnlive.module.shop.ui.fragment.OrderListFragment; | ||
| 9 | + | ||
| 10 | +import androidx.appcompat.app.AppCompatActivity; | ||
| 11 | + | ||
| 12 | +public class OrderListShopActivity extends AppCompatActivity { | ||
| 13 | + | ||
| 14 | + @Override | ||
| 15 | + protected void onCreate(Bundle savedInstanceState) { | ||
| 16 | + super.onCreate(savedInstanceState); | ||
| 17 | + setContentView(R.layout.activity_order_list_shop); | ||
| 18 | + SystemBarUtils.setStatusBarColor(this, Color.WHITE); | ||
| 19 | + StatusBarUtil.setStatusBarWrite(this); | ||
| 20 | + getSupportFragmentManager().beginTransaction().add(R.id.containers, new OrderListFragment()).commit(); | ||
| 21 | + } | ||
| 22 | +} |
module/shopcity/src/main/java/com/clive/happychina/shopcity/ShopServiceImpl.java
0 → 100644
| 1 | +package com.clive.happychina.shopcity; | ||
| 2 | + | ||
| 3 | +import android.app.Activity; | ||
| 4 | +import android.content.Context; | ||
| 5 | +import android.content.Intent; | ||
| 6 | +import android.net.Uri; | ||
| 7 | +import android.text.TextUtils; | ||
| 8 | + | ||
| 9 | +import com.alibaba.android.arouter.facade.annotation.Route; | ||
| 10 | +import com.alibaba.android.arouter.launcher.ARouter; | ||
| 11 | +import com.cnlive.cloud.user.auth.UserService; | ||
| 12 | +import com.cnlive.libs.base.application.AppConfig; | ||
| 13 | +import com.cnlive.libs.base.arouter.user.OpenUserService; | ||
| 14 | +import com.cnlive.module.common.router.ShopService; | ||
| 15 | +import com.cnlive.strike.pay.IPay; | ||
| 16 | + | ||
| 17 | +import org.jetbrains.annotations.NotNull; | ||
| 18 | + | ||
| 19 | +import androidx.annotation.Nullable; | ||
| 20 | + | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * 描述: | ||
| 24 | + * | ||
| 25 | + * @author zhangrq | ||
| 26 | + * 2018/10/23 11:27 | ||
| 27 | + */ | ||
| 28 | +@Route(path = "/service/shop") | ||
| 29 | +public class ShopServiceImpl implements ShopService { | ||
| 30 | + private Context context; | ||
| 31 | + | ||
| 32 | + @Override | ||
| 33 | + public void init(Context context) { | ||
| 34 | + this.context = context; | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + @Nullable | ||
| 38 | + @Override | ||
| 39 | + public String getUid() { | ||
| 40 | + // TODO 传入你们的用户id,可以传null | ||
| 41 | + if(context == null || UserService.getUid(context) == null) return null; | ||
| 42 | + return UserService.getUid(context); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + @Nullable | ||
| 46 | + @Override | ||
| 47 | + public String getAccount(int payType) { | ||
| 48 | + // TODO 传入你们支付时用的Account | ||
| 49 | + if (payType == IPay.PAY_TYPE_ALI) { | ||
| 50 | + // 支付宝 | ||
| 51 | + return ""; | ||
| 52 | + } else if (payType == IPay.PAY_TYPE_WX) { | ||
| 53 | + // 微信 | ||
| 54 | + // TODO 改成正式Account | ||
| 55 | + return AppConfig.getPayAccount(); | ||
| 56 | + } else if (payType == IPay.PAY_TYPE_UNION) { | ||
| 57 | + // 银联 | ||
| 58 | + return "ztyl"; | ||
| 59 | + } | ||
| 60 | + return ""; | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + @Override | ||
| 64 | + public void jumpToScanActivity(Activity activity, int i) { | ||
| 65 | + // TODO 跳到扫码页面,这个目前没对接不用处理 | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + @Override | ||
| 69 | + public boolean checkUserLogin(@NotNull Context context) { | ||
| 70 | + OpenUserService service = (OpenUserService) ARouter.getInstance().build("/cnCheckUser/cnCheckUserService").navigation(context); | ||
| 71 | + if (service != null) { | ||
| 72 | + return service.userHasLogin(UserService.getUid(context)); | ||
| 73 | + } | ||
| 74 | + return !TextUtils.isEmpty(UserService.getUid(context)); | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + @Override | ||
| 78 | + public void jumpToActivityByUri(@NotNull Activity activity, @NotNull Uri uri) { | ||
| 79 | + //web页面直接跳转点播视频等 | ||
| 80 | +// UriJump.jumpToView(activity, uri); | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + @Override | ||
| 84 | + public void jumpToHQYWShopHomeActivity(@NotNull Activity activity) { | ||
| 85 | + //跳转环球优物 ---商城首页 | ||
| 86 | + Intent intent = new Intent(activity, cn.cnlive.b2c.MainActivity.class); | ||
| 87 | + activity.startActivity(intent); | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + @Override | ||
| 91 | + public void jumpWJJLoginProcess(@NotNull Activity activity, @NotNull String s) { | ||
| 92 | + //检测是否登录并跳转 | ||
| 93 | + OpenUserService service = (OpenUserService) ARouter.getInstance().build("/cnCheckUser/cnCheckUserService").navigation(context); | ||
| 94 | + if (service != null) { | ||
| 95 | + service.userHasLogin(UserService.getUid(context), s, false); | ||
| 96 | + } | ||
| 97 | + } | ||
| 98 | +} |
module/shopcity/src/main/java/com/clive/happychina/shopcity/ShopWebActivity.java
0 → 100644
| 1 | +package com.clive.happychina.shopcity; | ||
| 2 | + | ||
| 3 | +import android.content.Context; | ||
| 4 | +import android.content.Intent; | ||
| 5 | +import android.os.Bundle; | ||
| 6 | + | ||
| 7 | +import com.alibaba.android.arouter.facade.annotation.Route; | ||
| 8 | +import com.cnlive.module.common.utils.JumpToActivityUtils; | ||
| 9 | + | ||
| 10 | +import androidx.appcompat.app.AppCompatActivity; | ||
| 11 | + | ||
| 12 | +@Route(path = "/cnshopCity/ShopWebActivity") | ||
| 13 | +public class ShopWebActivity extends AppCompatActivity { | ||
| 14 | + | ||
| 15 | + public static void startActivity(Context context,String type,String to,String shop_type) { | ||
| 16 | + Intent intent = new Intent(context, ShopWebActivity.class); | ||
| 17 | + intent.putExtra("type",type); | ||
| 18 | + intent.putExtra("to",to); | ||
| 19 | + intent.putExtra("shop_type",shop_type); | ||
| 20 | + context.startActivity(intent); | ||
| 21 | + } | ||
| 22 | + @Override | ||
| 23 | + protected void onCreate(Bundle savedInstanceState) { | ||
| 24 | + super.onCreate(savedInstanceState); | ||
| 25 | + setContentView(R.layout.activity_shop_web); | ||
| 26 | + Intent intent = getIntent(); | ||
| 27 | + JumpToActivityUtils.jumpToActivityByType(this, | ||
| 28 | + intent.getStringExtra("type"), intent.getStringExtra("to"), intent.getStringExtra("shop_type")); | ||
| 29 | + finish(); | ||
| 30 | + } | ||
| 31 | +} |
module/shopcity/src/main/res/layout/activity_order_list_shop.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 3 | + xmlns:app="http://schemas.android.com/apk/res-auto" | ||
| 4 | + xmlns:tools="http://schemas.android.com/tools" | ||
| 5 | + android:layout_width="match_parent" | ||
| 6 | + android:layout_height="match_parent" | ||
| 7 | + android:orientation="vertical" | ||
| 8 | + tools:context="com.clive.happychina.shopcity.OrderListShopActivity"> | ||
| 9 | + | ||
| 10 | + <com.cnlive.module.base.widgets.HeaderBar | ||
| 11 | + android:layout_width="match_parent" | ||
| 12 | + android:layout_height="48dp" | ||
| 13 | + app:titleText="我的订单" /> | ||
| 14 | + | ||
| 15 | + <View style="@style/horizontallLine" /> | ||
| 16 | + | ||
| 17 | + <FrameLayout | ||
| 18 | + android:id="@+id/containers" | ||
| 19 | + android:layout_width="match_parent" | ||
| 20 | + android:layout_height="match_parent" | ||
| 21 | + android:background="@color/white" /> | ||
| 22 | +</LinearLayout> |
module/shopcity/src/main/res/layout/activity_shop_web.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 3 | + xmlns:app="http://schemas.android.com/apk/res-auto" | ||
| 4 | + xmlns:tools="http://schemas.android.com/tools" | ||
| 5 | + android:layout_width="match_parent" | ||
| 6 | + android:layout_height="match_parent" | ||
| 7 | + tools:context="com.clive.happychina.shopcity.ShopWebActivity"> | ||
| 8 | + | ||
| 9 | +</android.support.constraint.ConstraintLayout> |
module/shopcity/src/main/res/values/strings.xml
0 → 100644
module/shopcity/src/test/java/com/clive/happychina/shopcity/ExampleUnitTest.java
0 → 100644
| 1 | +package com.clive.happychina.shopcity; | ||
| 2 | + | ||
| 3 | +import org.junit.Test; | ||
| 4 | + | ||
| 5 | +import static org.junit.Assert.*; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * Example local unit test, which will execute on the development machine (host). | ||
| 9 | + * | ||
| 10 | + * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
| 11 | + */ | ||
| 12 | +public class ExampleUnitTest { | ||
| 13 | + @Test | ||
| 14 | + public void addition_isCorrect() { | ||
| 15 | + assertEquals(4, 2 + 2); | ||
| 16 | + } | ||
| 17 | +} | ||
| 0 | \ No newline at end of file | 18 | \ No newline at end of file |
settings.gradle
| 1 | include ':app:strike' | 1 | include ':app:strike' |
| 2 | //基础库 | 2 | //基础库 |
| 3 | include ':core:base',':core:network',':core:imageload' ,':core:app_qr',':core:database' | 3 | include ':core:base',':core:network',':core:imageload' ,':core:app_qr',':core:database' |
| 4 | -include ':cloud:user',':cloud:pay',':cloud:third_tool',':cloud:video' | ||
| 5 | -include ':module:xiaojiasoundbox',':module:pedometer',':module:shanghaishop' | 4 | +include ':cloud:user',':cloud:pay',':cloud:third_tool',':cloud:video',':cloud:app_pay' |
| 5 | +include ':module:xiaojiasoundbox',':module:pedometer',':module:shanghaishop',':module:shopcity' | ||
| 6 | include ':library_baidumap' | 6 | include ':library_baidumap' |
| 7 | rootProject.name='ModuleStrike' | 7 | rootProject.name='ModuleStrike' |