Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨凯
YDL-Component-Medical
Commits
f2ceba2f
Commit
f2ceba2f
authored
Dec 28, 2020
by
YKai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:一键登录类封装
parent
7b9f1c63
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
429 additions
and
126 deletions
+429
-126
AudioHomeActivity.kt
m-audioim/src/main/java/com/ydl/audioim/AudioHomeActivity.kt
+1
-2
build.gradle
m-user/build.gradle
+2
-0
crashshield-release.aar
m-user/libs/crashshield-release.aar
+0
-0
phoneNumber-AuthSDK-2.3.5-20190710.aar
m-user/libs/phoneNumber-AuthSDK-2.3.5-20190710.aar
+0
-0
phoneNumber-L-AuthSDK-2.11.1.1.aar
m-user/libs/phoneNumber-L-AuthSDK-2.11.1.1.aar
+0
-0
proguard-rules.pro
m-user/proguard-rules.pro
+3
-0
AndroidManifest.xml
m-user/src/main/AndroidManifest.xml
+148
-124
OneKeyLoginHelp.kt
m-user/src/main/java/com/yidianling/user/ui/login/OneKeyLoginHelp.kt
+275
-0
one_key_login_dialog_close.png
m-user/src/main/res/drawable-xhdpi/one_key_login_dialog_close.png
+0
-0
No files found.
m-audioim/src/main/java/com/ydl/audioim/AudioHomeActivity.kt
View file @
f2ceba2f
...
@@ -1211,8 +1211,7 @@ class AudioHomeActivity :
...
@@ -1211,8 +1211,7 @@ class AudioHomeActivity :
var
uid
:
String
=
var
uid
:
String
=
ModularServiceManager
.
provide
(
IUserService
::
class
.
java
).
getUserInfo
()
?.
uid
!!
ModularServiceManager
.
provide
(
IUserService
::
class
.
java
).
getUserInfo
()
?.
uid
!!
var
payLoad
=
PayLoad
(
channelId
?:
"0"
,
time
,
uid
,
"1"
,
"999"
,
message
)
var
payLoad
=
PayLoad
(
channelId
?:
"0"
,
time
,
uid
,
"1"
,
"999"
,
message
)
var
connectException
=
var
connectException
=
ConnectExceptionCommand
(
time
+
zhu
,
"2"
,
eventType
,
payLoad
,
callStatus
)
ConnectExceptionCommand
(
time
+
zhu
,
"2"
,
eventType
,
payLoad
,
callStatus
)
YDLavManager
.
instances
.
uploadException
(
connectException
,
callback
)
YDLavManager
.
instances
.
uploadException
(
connectException
,
callback
)
}
}
...
...
m-user/build.gradle
View file @
f2ceba2f
...
@@ -79,6 +79,8 @@ dependencies {
...
@@ -79,6 +79,8 @@ dependencies {
androidTestImplementation
'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation
'com.android.support.test.espresso:espresso-core:3.0.2'
kapt
'com.alibaba:arouter-compiler:1.2.2'
kapt
'com.alibaba:arouter-compiler:1.2.2'
implementation
"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation
"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// crashshield-release.aar依赖了uc的crash收集库,因此还需要集成uc的crash收集库。
implementation
'com.ucweb.wpk:crashsdk-java:3.2.0.1'
api
rootProject
.
ext
.
dependencies
[
"ydl-user-router"
]
api
rootProject
.
ext
.
dependencies
[
"ydl-user-router"
]
if
(
rootProject
.
ext
.
dev_mode
){
if
(
rootProject
.
ext
.
dev_mode
){
...
...
m-user/libs/crashshield-release.aar
0 → 100644
View file @
f2ceba2f
File added
m-user/libs/phoneNumber-AuthSDK-2.3.5-20190710.aar
deleted
100644 → 0
View file @
7b9f1c63
File deleted
m-user/libs/phoneNumber-L-AuthSDK-2.11.1.1.aar
0 → 100644
View file @
f2ceba2f
File added
m-user/proguard-rules.pro
View file @
f2ceba2f
...
@@ -19,3 +19,6 @@
...
@@ -19,3 +19,6 @@
# If you keep the line number information, uncomment this to
# If you keep the line number information, uncomment this to
# hide the original source file name.
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-renamesourcefileattribute SourceFile
-
keep
class
com
.
uc
.
crashsdk
.
**
{
*
;
}
-
keep
interface
com
.
uc
.
crashsdk
.
**
{
*
;
}
m-user/src/main/AndroidManifest.xml
View file @
f2ceba2f
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"com.yidianling.user"
>
package=
"com.yidianling.user"
>
<application>
<application>
<activity
<activity
android:name=
".ui.LoginActivity"
android:name=
".ui.LoginActivity"
android:theme=
"@style/platform_NoTitleTheme
"
android:screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
".ui.CountryListActivity"
android:name=
".ui.CountryListActivity"
android:theme=
"@style/platform_NoTitleTheme
"
android:screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
".ui.InputPhoneActivity"
android:name=
".ui.InputPhoneActivity"
android:theme=
"@style/platform_NoTitleTheme
"
android:screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
".ui.SmsLoginActivity"
android:name=
".ui.SmsLoginActivity"
android:label=
"验证码"
android:label=
"验证码"
android:theme=
"@style/platform_NoTitleTheme
"
android:screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
".ui.GetIdentifyingCodeActivity"
android:name=
".ui.GetIdentifyingCodeActivity"
android:theme=
"@style/platform_NoTitleTheme
"
android:screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
".ui.FillInfoActivity"
android:name=
".ui.FillInfoActivity"
android:theme=
"@style/platform_NoTitleTheme
"
android:screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
".ui.login.testLoginActivity"
android:name=
".ui.login.testLoginActivity"
android:theme=
"@style/platform_NoTitleTheme"
android:theme=
"@style/platform_NoTitleTheme"
android:screenOrientation=
"portrait"
/>
android:screenOrientation=
"portrait"
/>
<activity
<activity
android:name=
".safePrivate.CheckPasswordActivity"
android:name=
".safePrivate.CheckPasswordActivity"
android:theme=
"@style/platform_NoTitleTheme
"
android:screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
".safePrivate.FingerPrintCheckActivity"
android:name=
".safePrivate.FingerPrintCheckActivity"
android:theme=
"@style/platform_NoTitleTheme
"
android:screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
".safePrivate.HandUnlockCheckActivity"
android:name=
".safePrivate.HandUnlockCheckActivity"
android:theme=
"@style/platform_NoTitleTheme
"
android:screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
".safePrivate.PrivacyActivity"
android:name=
".safePrivate.PrivacyActivity"
android:theme=
"@style/platform_NoTitleTheme
"
android:screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
".safePrivate.SetFingerPrintActivity"
android:name=
".safePrivate.SetFingerPrintActivity"
android:theme=
"@style/platform_NoTitleTheme
"
android:screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
".safePrivate.SetHandUnLockActivity"
android:name=
".safePrivate.SetHandUnLockActivity"
android:theme=
"@style/platform_NoTitleTheme
"
android:screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
".ui.login.RegisterAndLoginActivity"
android:name=
".ui.login.RegisterAndLoginActivity"
android:theme=
"@style/platform_NoTitleTheme
"
android:screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
".ui.login.VerificationCodeActivity"
android:name=
".ui.login.VerificationCodeActivity"
android:theme=
"@style/platform_NoTitleTheme
"
android:screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
".ui.login.InputPassWordActivity"
android:name=
".ui.login.InputPassWordActivity"
android:theme=
"@style/platform_NoTitleTheme
"
android:screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
".ui.login.H5Activity"
android:name=
".ui.login.H5Activity"
android:theme=
"@style/platform_NoTitleTheme
"
android:screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
".ui.AliAuthDemoActivity"
android:name=
".ui.AliAuthDemoActivity"
android:theme=
"@style/platform_NoTitleTheme
"
android:screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
"com.mobile.auth.gatewayauth.LoginAuthActivity"
android:name=
"com.mobile.auth.gatewayauth.LoginAuthActivity"
android:configChanges=
"orientation|keyboardHidden|screenSize"
android:configChanges=
"orientation|keyboardHidden|screenSize"
android:exported=
"false"
android:exported=
"false"
android:launchMode=
"singleTask"
android:launchMode=
"singleTask"
android:theme=
"@style/platform_NoTitleTheme
"
android:screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
"com.cmic.sso.sdk.activity.LoginAuthActivity"
android:name=
"com.cmic.sso.sdk.activity.LoginAuthActivity"
android:configChanges=
"orientation|keyboardHidden|screenSize"
android:configChanges=
"orientation|keyboardHidden|screenSize"
android:launchMode=
"singleTask"
android:launchMode=
"singleTask"
android:theme=
"@style/platform_NoTitleTheme
"
android:screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
".wxapi.WXEntryActivity"
android:name=
".wxapi.WXEntryActivity"
android:exported=
"true"
android:exported=
"true"
android:launchMode=
"singleTop"
/>
android:launchMode=
"singleTop"
/>
<activity
<activity
android:name=
".ui.login.SecretActivity"
android:name=
".ui.login.SecretActivity"
android:theme=
"@style/platform_NoTitleTheme"
android:exported=
"true"
android:exported=
"true"
android:launchMode=
"singleTop"
/>
android:launchMode=
"singleTop"
android:theme=
"@style/platform_NoTitleTheme"
/>
<activity
<activity
android:name=
"com.yidianling.user.mine.AboutUsActivity"
android:name=
"com.yidianling.user.mine.AboutUsActivity"
android:
theme=
"@style/platform_NoTitleTheme
"
android:
screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
"com.yidianling.user.mine.AccountHistoryActivity"
android:name=
"com.yidianling.user.mine.AccountHistoryActivity"
android:
theme=
"@style/platform_NoTitleTheme
"
android:
screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
"com.yidianling.user.mine.AccountSettingActivity"
android:name=
"com.yidianling.user.mine.AccountSettingActivity"
android:
theme=
"@style/platform_NoTitleTheme
"
android:
screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
"com.yidianling.user.mine.ContactCustomerServiceActivity"
android:name=
"com.yidianling.user.mine.ContactCustomerServiceActivity"
android:
theme=
"@style/platform_NoTitleTheme
"
android:
screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
"com.yidianling.user.mine.FeedBackActivity"
android:name=
"com.yidianling.user.mine.FeedBackActivity"
android:screenOrientation=
"portrait"
android:screenOrientation=
"portrait"
android:windowSoftInputMode=
"adjustPan|stateUnspecified"
/>
android:windowSoftInputMode=
"adjustPan|stateUnspecified"
/>
<activity
<activity
android:name=
"com.yidianling.user.mine.MyFeedBackActivity"
android:name=
"com.yidianling.user.mine.MyFeedBackActivity"
android:
theme=
"@style/platform_NoTitleTheme
"
android:
screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
"com.yidianling.user.mine.FeedBackSuccessActivity"
android:name=
"com.yidianling.user.mine.FeedBackSuccessActivity"
android:
theme=
"@style/platform_NoTitleTheme
"
android:
screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
"com.yidianling.user.mine.HelpActivity"
android:name=
"com.yidianling.user.mine.HelpActivity"
android:
theme=
"@style/platform_NoTitleTheme
"
android:
screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
"com.yidianling.user.mine.NotificationsSettingActivity"
android:name=
"com.yidianling.user.mine.NotificationsSettingActivity"
android:
theme=
"@style/platform_NoTitleTheme
"
android:
screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
"com.yidianling.user.mine.PersonalDesActivity"
android:name=
"com.yidianling.user.mine.PersonalDesActivity"
android:
theme=
"@style/platform_NoTitleTheme
"
android:
screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
"com.yidianling.user.mine.PersonalInfoActivity"
android:name=
"com.yidianling.user.mine.PersonalInfoActivity"
android:
theme=
"@style/platform_NoTitleTheme
"
android:
screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
"com.yidianling.user.mine.RechargeActivity"
android:name=
"com.yidianling.user.mine.RechargeActivity"
android:
theme=
"@style/platform_NoTitleTheme
"
android:
screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
"com.yidianling.user.mine.SetInfoActivity"
android:name=
"com.yidianling.user.mine.SetInfoActivity"
android:
theme=
"@style/platform_NoTitleTheme
"
android:
screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
"com.yidianling.user.mine.WithDrawActivity"
android:name=
"com.yidianling.user.mine.WithDrawActivity"
android:
theme=
"@style/platform_NoTitleTheme
"
android:
screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
"com.yidianling.user.mine.WithDrawSuccessActivity"
android:name=
"com.yidianling.user.mine.WithDrawSuccessActivity"
android:
theme=
"@style/platform_NoTitleTheme
"
android:
screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
"com.yidianling.user.mine.ChooseAccountActivity"
android:name=
"com.yidianling.user.mine.ChooseAccountActivity"
android:
theme=
"@style/platform_NoTitleTheme
"
android:
screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
"com.yidianling.user.mine.EditAccountActivity"
android:name=
"com.yidianling.user.mine.EditAccountActivity"
android:
theme=
"@style/platform_NoTitleTheme
"
android:
screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
"com.yidianling.user.mine.AddAccountActivity"
android:name=
"com.yidianling.user.mine.AddAccountActivity"
android:
theme=
"@style/platform_NoTitleTheme
"
android:
screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
"com.yidianling.user.mine.RechargeResultActivity"
android:name=
"com.yidianling.user.mine.RechargeResultActivity"
android:
theme=
"@style/platform_NoTitleTheme
"
android:
screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
"com.yidianling.user.mine.PwdCheckActivity"
android:name=
"com.yidianling.user.mine.PwdCheckActivity"
android:
theme=
"@style/platform_NoTitleTheme
"
android:
screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
"com.yidianling.user.mine.PhoneChangeActivity"
android:name=
"com.yidianling.user.mine.PhoneChangeActivity"
android:
theme=
"@style/platform_NoTitleTheme
"
android:
screenOrientation=
"portrait
"
android:screenOrientation=
"portrait
"
/>
android:theme=
"@style/platform_NoTitleTheme
"
/>
<activity
<activity
android:name=
".mine.SendRedPacketActivity"
android:name=
".mine.SendRedPacketActivity"
android:screenOrientation=
"portrait"
android:screenOrientation=
"portrait"
android:windowSoftInputMode=
"adjustResiz
e"
android:theme=
"@style/platform_NoTitleThem
e"
android:theme=
"@style/platform_NoTitleTheme"
/>
android:windowSoftInputMode=
"adjustResize"
/>
<activity
<activity
android:name=
".mine.ReceiveRedPacketActivity"
android:name=
".mine.ReceiveRedPacketActivity"
android:screenOrientation=
"portrait"
android:screenOrientation=
"portrait"
android:windowSoftInputMode=
"adjustResiz
e"
android:theme=
"@style/platform_NoTitleThem
e"
android:theme=
"@style/platform_NoTitleTheme"
/>
android:windowSoftInputMode=
"adjustResize"
/>
<activity
<activity
android:name=
".ui.collect.CollectSexAndBirthActivity"
android:name=
".ui.collect.CollectSexAndBirthActivity"
android:exported=
"true"
android:exported=
"true"
...
@@ -207,6 +207,29 @@
...
@@ -207,6 +207,29 @@
android:exported=
"true"
android:exported=
"true"
android:launchMode=
"singleTop"
/>
android:launchMode=
"singleTop"
/>
<!--联通电信授权页-->
<activity
android:name=
"com.mobile.auth.gatewayauth.LoginAuthActivity"
android:configChanges=
"orientation|keyboardHidden|screenSize"
android:exported=
"false"
android:launchMode=
"singleTop"
android:theme=
"@style/authsdk_activity_dialog"
/>
<!--协议页面webview-->
<activity
android:name=
"com.mobile.auth.gatewayauth.activity.AuthWebVeiwActivity"
android:configChanges=
"orientation|keyboardHidden|screenSize"
android:exported=
"false"
android:launchMode=
"singleTop"
android:screenOrientation=
"behind"
/>
<!--移动授权页-->
<activity
android:name=
"com.cmic.sso.sdk.activity.LoginAuthActivity"
android:configChanges=
"orientation|keyboardHidden|screenSize"
android:exported=
"false"
android:launchMode=
"singleTop"
/>
</application>
</application>
</manifest>
</manifest>
\ No newline at end of file
m-user/src/main/java/com/yidianling/user/ui/login/OneKeyLoginHelp.kt
0 → 100644
View file @
f2ceba2f
package
com.yidianling.user.ui.login
import
android.content.pm.ActivityInfo
import
android.graphics.Color
import
android.util.Log
import
android.util.TypedValue
import
android.view.Gravity
import
android.view.View
import
android.widget.ImageView
import
android.widget.RelativeLayout
import
android.widget.TextView
import
com.mobile.auth.gatewayauth.*
import
com.mobile.auth.gatewayauth.model.TokenRet
import
com.ydl.ydlcommon.base.BaseActivity
import
com.yidianling.common.tools.RxDeviceTool
import
com.yidianling.common.tools.RxImageTool
/**
* Created by Ykai on 2020/12/22.
*
* 一键登录辅助类
*/
class
OneKeyLoginHelp
{
private
var
mPhoneNumberAuthHelper
:
PhoneNumberAuthHelper
?
=
null
private
var
mActivity
:
BaseActivity
?
=
null
companion
object
{
private
const
val
YDL_USER_APP_KEY
=
"cl6yPRBkrpRfZpTPkTKoa1+/J+muUvPMPR2HRb0oll24XnyeLPGRDtla7p54HBd3362GfxhNJLYHaaEPHKwl16lDpvNbJ9mm+VbcYQTSX3NK+apSz2/8ul7lMWrGI/1HRyQ9G7njyI3e5BW3FBVqMh3dssocaraDJgbnQds+5ajWM7kklcSy9c8k49TegzBqmj/6ENqNLG1JNgtfTXmBOPQAs9DZVWh+bUN6SfE/tCRuUEb9zriAkP/TY1ouYvXXQU1Ivjy6S7xMJduTNqHrnuUW93D1r1/v"
private
const
val
YDL_EXPERT_APP_KEY
=
"i4Y/PVRAz4P/aqajQF7SOd3JUIKEsJbRurH04azLyX6N2upi292OrLHECRmtTVAqY24HFjwUjW1QjRwJA9aFbNzl3zl7L5DEDBZ4+QSU28vq34HccmAjAeUCC7qCHbN7QLVZqhVpuYUCMZ5fp2NdhANJl/741wHccdPk/Un5c4larDNuv1KEo2OZOds2J1WFiBx7giWtzli4NwMq9x+9sb0aXPZZQ9C9Kr8T/0+/ccYdotwFm7XWenNs/G3Jy1HHVqqOCDecKPbyXR+cV0jBUisSjv+SEUTfpcc3iUGH5OjZyQ6OfaLkdjATsr5K9oVP"
const
val
YDL_USER_APP
=
1
const
val
YDL_EXPERT_APP
=
2
}
constructor
(
activity
:
BaseActivity
,
Authtype
:
Int
)
{
mActivity
=
activity
mPhoneNumberAuthHelper
=
PhoneNumberAuthHelper
.
getInstance
(
activity
,
mTokenListener
)
mPhoneNumberAuthHelper
?.
let
{
// APP是否处于调试状态,使⽤ getReporter.setLoggerEnable(true) 可以关闭此项检测
it
.
reporter
.
setLoggerEnable
(
true
)
// 设置密钥
if
(
Authtype
==
YDL_USER_APP
){
it
.
setAuthSDKInfo
(
YDL_USER_APP_KEY
)
}
else
if
(
Authtype
==
YDL_EXPERT_APP
){
it
.
setAuthSDKInfo
(
YDL_EXPERT_APP_KEY
)
}
// 检查认证环境
it
.
checkEnvAvailable
(
2
)
// type 1:本机号码校验 2: ⼀键登录
}
}
/**
* 拉起一键登录界面
*
* @param isOpenDialog 是否是弹窗
*/
public
fun
getLoginToken
(
isOpenDialog
:
Boolean
)
{
mPhoneNumberAuthHelper
?.
let
{
// 打开页面
if
(
isOpenDialog
)
{
openDialog
(
it
)
}
else
{
openPage
(
it
)
}
// 拉起一键登录页面
it
.
getLoginToken
(
mActivity
,
5000
)
// 5000表示超时时间 单位ms
}
}
/**
* 设置界面UI,并打开页面
*
*/
private
fun
openPage
(
phoneNumberAuthHelper
:
PhoneNumberAuthHelper
)
{
// 每次打开页面前先清空所有的自定义控件,再重新设置
phoneNumberAuthHelper
.
removeAuthRegisterXmlConfig
()
phoneNumberAuthHelper
.
removeAuthRegisterViewConfig
()
//自定义验证码登录按钮
val
otherLogin
=
TextView
(
mActivity
)
val
layoutParams
=
RelativeLayout
.
LayoutParams
(
RelativeLayout
.
LayoutParams
.
MATCH_PARENT
,
RxImageTool
.
dp2px
(
50f
)
)
layoutParams
.
addRule
(
RelativeLayout
.
CENTER_HORIZONTAL
,
RelativeLayout
.
TRUE
)
layoutParams
.
setMargins
(
RxImageTool
.
dp2px
(
35f
),
RxImageTool
.
dp2px
(
33f
),
RxImageTool
.
dp2px
(
35f
),
0
)
otherLogin
.
text
=
"切换号码"
otherLogin
.
setTextColor
(
Color
.
parseColor
(
"#1DA1F2"
))
otherLogin
.
setTextSize
(
TypedValue
.
COMPLEX_UNIT_SP
,
15f
)
otherLogin
.
gravity
=
Gravity
.
CENTER
otherLogin
.
layoutParams
=
layoutParams
//自定义认证商显示控件
val
tvAuth
=
TextView
(
mActivity
)
val
tvAuthParams
=
RelativeLayout
.
LayoutParams
(
RelativeLayout
.
LayoutParams
.
WRAP_CONTENT
,
RxImageTool
.
dp2px
(
50f
)
)
tvAuthParams
.
addRule
(
RelativeLayout
.
CENTER_HORIZONTAL
,
RelativeLayout
.
TRUE
)
tvAuthParams
.
setMargins
(
0
,
RxImageTool
.
dp2px
(
215f
),
0
,
0
)
when
(
phoneNumberAuthHelper
.
currentCarrierName
)
{
"CUCC"
->
{
tvAuth
.
text
=
"中国联通提供认证服务"
}
"CMCC"
->
{
tvAuth
.
text
=
"中国移动提供认证服务"
}
"CTCC"
->
{
tvAuth
.
text
=
"中国电信提供认证服务"
}
}
tvAuth
.
setTextColor
(
Color
.
parseColor
(
"#999999"
))
tvAuth
.
setTextSize
(
TypedValue
.
COMPLEX_UNIT_SP
,
13f
)
tvAuth
.
gravity
=
Gravity
.
CENTER
tvAuth
.
layoutParams
=
tvAuthParams
//一键登录添加自定义控件
phoneNumberAuthHelper
.
addAuthRegistViewConfig
(
"tv_auth"
,
AuthRegisterViewConfig
.
Builder
()
.
setView
(
tvAuth
)
.
setRootViewId
(
AuthRegisterViewConfig
.
RootViewId
.
ROOT_VIEW_ID_BODY
)
.
build
()
)
phoneNumberAuthHelper
.
addAuthRegistViewConfig
(
"other_login"
,
AuthRegisterViewConfig
.
Builder
()
.
setView
(
otherLogin
)
.
setRootViewId
(
AuthRegisterViewConfig
.
RootViewId
.
ROOT_VIEW_ID_BODY
)
.
setCustomInterface
{
phoneNumberAuthHelper
.
quitLoginPage
()
}
.
build
()
)
phoneNumberAuthHelper
.
setAuthUIConfig
(
AuthUIConfig
.
Builder
()
.
setStatusBarColor
(
Color
.
TRANSPARENT
)
.
setWebViewStatusBarColor
(
Color
.
TRANSPARENT
)
.
setStatusBarUIFlag
(
View
.
SYSTEM_UI_FLAG_LOW_PROFILE
)
.
setNavHidden
(
true
)
// 设置一键登录页面标题栏隐藏
.
setWebNavTextColor
(
Color
.
parseColor
(
"#242424"
))
// 设置协议页面标题字体颜色
.
setWebNavColor
(
Color
.
WHITE
)
.
setLightColor
(
true
)
//设置状态栏文字颜色,true为黑色
.
setWebNavReturnImgPath
(
"common_ic_back"
)
// 设置协议页返回按钮
.
setLogoImgPath
(
"ic_one_key_login_logo"
)
// 设置登录logo
.
setLogoScaleType
(
ImageView
.
ScaleType
.
FIT_CENTER
)
.
setLogoHeight
(
118
)
// 设置登录logo高度
.
setLogoWidth
(
40
)
// 设置登录logo宽度
.
setLogoOffsetY
(
35
)
// 设置登录logo距离顶部距离
.
setSloganHidden
(
true
)
// 设置slogan是否隐藏
.
setNumberColor
(
Color
.
parseColor
(
"#242424"
))
.
setNumberSize
(
24
)
.
setNumFieldOffsetY
(
190
)
.
setLogBtnBackgroundPath
(
"bg_one_click_login"
)
// 设置登录按钮背景图片
.
setLogBtnTextColor
(
Color
.
parseColor
(
"#ffffff"
))
// 设置登录按钮文字颜色
.
setLogBtnTextSize
(
15
)
.
setLogBtnMarginLeftAndRight
(
35
)
// 设置登录按钮距离左右距离
.
setSwitchAccHidden
(
true
)
// 设置自带切换其它登录方式按钮隐藏
.
setAppPrivacyOne
(
"壹点灵专家使用协议"
,
""
)
.
setAppPrivacyTwo
(
"隐私协议"
,
""
)
.
setAppPrivacyColor
(
Color
.
parseColor
(
"#999999"
),
Color
.
parseColor
(
"#1da1f2"
))
.
setCheckboxHidden
(
true
)
// 设置是否同意协议的checkbox隐藏
.
setPrivacyBefore
(
"登录即代表您同意"
)
// .setVendorPrivacyPrefix("《")
// .setVendorPrivacySuffix("》")
.
setScreenOrientation
(
ActivityInfo
.
SCREEN_ORIENTATION_SENSOR_PORTRAIT
)
// 设置竖屏
.
create
()
)
}
/**
* 设置弹窗UI,并打开弹窗
*
*/
private
fun
openDialog
(
phoneNumberAuthHelper
:
PhoneNumberAuthHelper
)
{
// 每次打开页面前先清空所有的自定义控件,再重新设置
phoneNumberAuthHelper
.
removeAuthRegisterXmlConfig
()
phoneNumberAuthHelper
.
removeAuthRegisterViewConfig
()
//自定义其它方式登录按钮
val
otherLogin
=
TextView
(
mActivity
)
val
layoutParams
=
RelativeLayout
.
LayoutParams
(
RelativeLayout
.
LayoutParams
.
MATCH_PARENT
,
RxImageTool
.
dp2px
(
50f
)
)
layoutParams
.
addRule
(
RelativeLayout
.
CENTER_HORIZONTAL
,
RelativeLayout
.
TRUE
)
layoutParams
.
setMargins
(
RxImageTool
.
dp2px
(
35f
),
RxImageTool
.
dp2px
(
33f
),
RxImageTool
.
dp2px
(
35f
),
0
)
otherLogin
.
text
=
"其它方式登录"
otherLogin
.
setTextColor
(
Color
.
parseColor
(
"#666666"
))
otherLogin
.
setTextSize
(
TypedValue
.
COMPLEX_UNIT_SP
,
15f
)
otherLogin
.
gravity
=
Gravity
.
CENTER
otherLogin
.
layoutParams
=
layoutParams
phoneNumberAuthHelper
.
addAuthRegistViewConfig
(
"other_login"
,
AuthRegisterViewConfig
.
Builder
()
.
setView
(
otherLogin
)
.
setRootViewId
(
AuthRegisterViewConfig
.
RootViewId
.
ROOT_VIEW_ID_BODY
)
.
setCustomInterface
{
phoneNumberAuthHelper
.
quitLoginPage
()
}
.
build
()
)
val
dialogHeight
=
(
RxDeviceTool
.
getScreenHeight
(
mActivity
)
*
0.45f
).
toInt
()
phoneNumberAuthHelper
.
setAuthUIConfig
(
AuthUIConfig
.
Builder
()
.
setStatusBarColor
(
Color
.
TRANSPARENT
)
.
setWebViewStatusBarColor
(
Color
.
TRANSPARENT
)
.
setStatusBarUIFlag
(
View
.
SYSTEM_UI_FLAG_LOW_PROFILE
)
.
setNavText
(
"登录解锁更多功能"
)
.
setNavTextColor
(
Color
.
parseColor
(
"#242424"
))
.
setWebNavTextColor
(
Color
.
parseColor
(
"#242424"
))
// 设置协议页面标题字体颜色
.
setNavReturnImgPath
(
"one_key_login_dialog_close"
)
.
setWebNavColor
(
Color
.
WHITE
)
.
setLightColor
(
true
)
//设置状态栏文字颜色,true为黑色
.
setWebNavReturnImgPath
(
"common_ic_back"
)
// 设置协议页返回按钮
.
setSloganHidden
(
true
)
// 设置slogan是否隐藏
.
setNumberColor
(
Color
.
parseColor
(
"#242424"
))
.
setNumberSize
(
24
)
.
setNumFieldOffsetY
(
190
)
.
setLogBtnBackgroundPath
(
"bg_one_click_login"
)
// 设置登录按钮背景图片
.
setLogBtnTextColor
(
Color
.
parseColor
(
"#ffffff"
))
// 设置登录按钮颜色
.
setLogBtnTextSize
(
16
)
.
setLogBtnMarginLeftAndRight
(
35
)
// 设置登录按钮距离左右距离
.
setSwitchAccHidden
(
true
)
// 设置自带切换其它登录方式按钮隐藏
.
setAppPrivacyOne
(
"壹点灵专家使用协议"
,
""
)
.
setAppPrivacyTwo
(
"隐私协议"
,
""
)
.
setAppPrivacyColor
(
Color
.
parseColor
(
"#999999"
),
Color
.
parseColor
(
"#1da1f2"
))
.
setCheckboxHidden
(
true
)
// 设置是否同意协议的checkbox隐藏
.
setPrivacyBefore
(
"登录即代表您同意"
)
// .setVendorPrivacyPrefix("《")
// .setVendorPrivacySuffix("》")
.
setDialogHeight
(
dialogHeight
)
.
setDialogBottom
(
true
)
.
setScreenOrientation
(
ActivityInfo
.
SCREEN_ORIENTATION_SENSOR_PORTRAIT
)
// 设置竖屏
.
create
()
)
}
// 一键登录token监听器
private
var
mTokenListener
:
TokenResultListener
=
object
:
TokenResultListener
{
override
fun
onTokenSuccess
(
s
:
String
)
{
val
tokenRet
=
TokenRet
.
fromJson
(
s
)
when
(
tokenRet
.
code
)
{
ResultCode
.
CODE_START_AUTHPAGE_SUCCESS
->
{
// 唤起一键登录页面成功
Log
.
i
(
"TAG"
,
"唤起授权页成功:$s"
)
}
ResultCode
.
CODE_SUCCESS
->
{
// 点击登录后获取token成功
val
token
=
tokenRet
.
token
mPhoneNumberAuthHelper
?.
setAuthListener
(
null
)
}
}
}
override
fun
onTokenFailed
(
s
:
String
)
{
val
tokenRet
=
TokenRet
.
fromJson
(
s
)
when
(
tokenRet
.
code
)
{
ResultCode
.
CODE_ERROR_USER_CANCEL
->
{
// 用户主动取消一键登录
}
else
->
{
// 其它失败原因
// 跳转到原生登录界面
}
}
mPhoneNumberAuthHelper
?.
setAuthListener
(
null
)
}
}
}
m-user/src/main/res/drawable-xhdpi/one_key_login_dialog_close.png
0 → 100644
View file @
f2ceba2f
579 Bytes
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment