1
modules/mogo-module-authorize/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
/build
|
||||
@@ -1,76 +0,0 @@
|
||||
plugins {
|
||||
id 'com.android.library'
|
||||
id 'kotlin-android'
|
||||
id 'kotlin-android-extensions'
|
||||
id 'kotlin-kapt'
|
||||
id 'com.alibaba.arouter'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode Integer.valueOf(VERSION_CODE)
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
|
||||
//ARouter apt 参数
|
||||
kapt {
|
||||
useBuildCache = false
|
||||
arguments {
|
||||
arg("AROUTER_MODULE_NAME", project.getName())
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
|
||||
implementation rootProject.ext.dependencies.androidxccorektx
|
||||
implementation rootProject.ext.dependencies.coroutinescore
|
||||
implementation rootProject.ext.dependencies.coroutinesandroid
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
implementation rootProject.ext.dependencies.mogoutils
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
implementation rootProject.ext.dependencies.mogoserviceapi
|
||||
implementation rootProject.ext.dependencies.modulecommon
|
||||
|
||||
implementation rootProject.ext.dependencies.mogo_core_utils
|
||||
implementation rootProject.ext.dependencies.mogo_core_data
|
||||
} else {
|
||||
implementation project(":foudations:mogo-utils")
|
||||
implementation project(":foudations:mogo-commons")
|
||||
implementation project(':services:mogo-service-api')
|
||||
implementation project(":modules:mogo-module-common")
|
||||
|
||||
implementation project(':core:mogo-core-utils')
|
||||
implementation project(':core:mogo-core-data')
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
@@ -1,2 +0,0 @@
|
||||
#-----AuthorizeModule-----
|
||||
-keep class com.mogo.module.authorize.module.bean.*{*;}
|
||||
@@ -1,3 +0,0 @@
|
||||
GROUP=com.mogo.module
|
||||
POM_ARTIFACT_ID=module-authorize
|
||||
VERSION_CODE=1
|
||||
24
modules/mogo-module-authorize/proguard-rules.pro
vendored
@@ -1,24 +0,0 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
|
||||
#-----AuthorizeModule-----
|
||||
-keep class com.mogo.module.authorize.module.bean.**{*;}
|
||||
@@ -1,2 +0,0 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.module.authorize" />
|
||||
@@ -1,139 +0,0 @@
|
||||
package com.mogo.module.authorize.authprovider.biz
|
||||
|
||||
import com.mogo.module.authorize.authprovider.invoke.IMogoAuthorizeContentListener
|
||||
import com.mogo.module.authorize.model.BaseResponse
|
||||
import com.mogo.module.authorize.model.IMogoAuthorizeModel
|
||||
import com.mogo.module.authorize.model.bean.*
|
||||
import com.mogo.module.authorize.net.request
|
||||
import com.mogo.module.authorize.util.DateUtil.parseDateToTime
|
||||
import com.mogo.module.authorize.util.SharedPreferenceUtil.getAuthorizeVersion
|
||||
import com.mogo.module.authorize.util.SharedPreferenceUtil.setAuthorizeStatus
|
||||
import com.mogo.module.authorize.util.SharedPreferenceUtil.updateAuthorizeVersion
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
open class IMogoAuthorizeController {
|
||||
|
||||
companion object {
|
||||
const val TAG = "AuthorizeController"
|
||||
}
|
||||
|
||||
private val authorizeModel: IMogoAuthorizeModel by lazy { IMogoAuthorizeModel() }
|
||||
|
||||
fun getAuthorizeContent(onStart: () -> Unit, onSuccess: (Agreement) -> Unit, onError: (String) -> Unit) {
|
||||
realInvokeAuthorizeContent(0, {
|
||||
onStart.invoke()
|
||||
}, {
|
||||
if (it.result != null && it.result.agreement.agreementContent != null) {
|
||||
onSuccess.invoke(it.result.agreement)
|
||||
} else {
|
||||
onError.invoke("data is null")
|
||||
}
|
||||
}, { msg: String ->
|
||||
onError.invoke(msg)
|
||||
}, true)
|
||||
}
|
||||
|
||||
fun invokeAuthorizeContent(tag: String, agreementType: Int) {
|
||||
realInvokeAuthorizeContent(agreementType, {
|
||||
if (agreementType == -1) {
|
||||
getAuthorizeContentListener(tag, { listener ->
|
||||
listener.requestContentFailed("invokeAuthorizeContent param tag is not right")
|
||||
}, {
|
||||
Logger.d(TAG, "invokeAuthorizeContent ---checkAgreementType can not find tag :$tag")
|
||||
})
|
||||
}
|
||||
}, {
|
||||
getAuthorizeContentListener(tag, { listener ->
|
||||
if (it.result != null && it.result.agreement.agreementContent != null) {
|
||||
listener.requestContentSuccess(it.result.agreement)
|
||||
} else {
|
||||
listener.requestContentFailed("request authorize content success ,but result data is :${it.result}")
|
||||
}
|
||||
}, {
|
||||
Logger.d(TAG, "invokeAuthorizeContent --- can not find listener by this tag :$tag")
|
||||
})
|
||||
}, { msg: String ->
|
||||
getAuthorizeContentListener(tag, { listener ->
|
||||
listener.requestContentFailed(msg)
|
||||
}, {
|
||||
Logger.d(TAG, "invokeAuthorizeContent --- can not find listener by this tag :$tag")
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
private fun realInvokeAuthorizeContent(agreementType: Int, onStart: (() -> Unit), onSuccess: ((BaseResponse<AgreementData?>) -> Unit), onError: ((String) -> Unit), needContent: Boolean = false) {
|
||||
onStart.invoke()
|
||||
try {
|
||||
request<BaseResponse<AgreementData>> {
|
||||
loader {
|
||||
authorizeModel.invokeAuthorizeContent(agreementType, needContent)
|
||||
}
|
||||
onSuccess {
|
||||
onSuccess.invoke(it)
|
||||
}
|
||||
onError {
|
||||
onError.invoke(it.message
|
||||
?: "realInvokeAuthorizeContent onError, message is null")
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
onError.invoke(e.message ?: "realInvokeAuthorizeContent has exception, message is null")
|
||||
}
|
||||
}
|
||||
|
||||
private inline fun getAuthorizeContentListener(tag: String, blockSuccess: ((IMogoAuthorizeContentListener) -> Unit), blockNull: (() -> Unit)) {
|
||||
val authorizeContentListener = MogoAuthorizeRegisterHandler.getAuthorizeContentListener(tag)
|
||||
if (authorizeContentListener != null) {
|
||||
blockSuccess(authorizeContentListener)
|
||||
} else {
|
||||
blockNull()
|
||||
}
|
||||
}
|
||||
|
||||
fun updateAgreementVersion(agreementType: Int) {
|
||||
realInvokeAuthorizeContent(agreementType, {
|
||||
Logger.d(TAG, "ready to update agreement")
|
||||
}, {
|
||||
if (it.result != null) {
|
||||
val agreement = it.result.agreement
|
||||
val updateTime = agreement.tUserAgreementEntity.updateTime
|
||||
val currentTime = parseDateToTime(updateTime)
|
||||
if (hasNewVersion(currentTime)) {
|
||||
updateAuthorizeVersion(currentTime)
|
||||
setAuthorizeStatus(agreementType, false)
|
||||
} else {
|
||||
Logger.d(TAG, "no new version")
|
||||
}
|
||||
}
|
||||
}, { s: String ->
|
||||
Logger.d(TAG, "updateAgreementAndAuthorization reason:$s")
|
||||
})
|
||||
}
|
||||
|
||||
private fun hasNewVersion(currentTime: Long): Boolean {
|
||||
val oldVersion = getAuthorizeVersion()
|
||||
return currentTime > oldVersion
|
||||
}
|
||||
|
||||
fun checkIfNeedAuthorize(agreementType: Int) {
|
||||
request<BaseResponse<AgreementStatus>> {
|
||||
loader {
|
||||
authorizeModel.invokeIfNeedAuthorize(agreementType)
|
||||
}
|
||||
onSuccess {
|
||||
Logger.d(TAG,"result : ${it.result}")
|
||||
val result = it.result
|
||||
when (result.agreementStatus) {
|
||||
AGREEMENT_EFFECT -> setAuthorizeStatus(agreementType, true)
|
||||
AGREEMENT_NOT_EFFECT -> setAuthorizeStatus(agreementType, false)
|
||||
else -> Logger.d(TAG, "agreementStatus is not match any case")
|
||||
}
|
||||
}
|
||||
onError {
|
||||
Logger.d(TAG, it.message ?: "checkIfNeedAuthorize onError, message is null")
|
||||
setAuthorizeStatus(agreementType, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package com.mogo.module.authorize.authprovider.biz
|
||||
|
||||
import com.mogo.module.authorize.authprovider.invoke.IMogoAuthorizeContentListener
|
||||
import com.mogo.module.authorize.authprovider.invoke.IMogoAuthorizeInvoke
|
||||
import com.mogo.module.authorize.authprovider.module.IMogoAcquireAuthorizeListener
|
||||
import com.mogo.module.authorize.model.proxy.AuthorizeProxy
|
||||
import com.mogo.module.authorize.model.proxy.toAuthorizeType
|
||||
import com.mogo.module.authorize.util.SharedPreferenceUtil.needAuthorization
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
abstract class MogoAuthorizeManagerImpl : IMogoAuthorizeInvoke {
|
||||
|
||||
companion object {
|
||||
const val TAG = "AuthorizeManagerImpl"
|
||||
}
|
||||
|
||||
private val baseController: IMogoAuthorizeController by lazy { IMogoAuthorizeController() }
|
||||
|
||||
override fun needAuthorize(tag: String): Boolean {
|
||||
Logger.d(TAG, "===== needAuthorize update agreement in background")
|
||||
baseController.checkIfNeedAuthorize(tag.toAuthorizeType())
|
||||
return needAuthorization(tag.toAuthorizeType())
|
||||
}
|
||||
|
||||
override fun updateAuthorizeStatus(tag: String) {
|
||||
baseController.checkIfNeedAuthorize(tag.toAuthorizeType())
|
||||
}
|
||||
|
||||
override fun invokeAuthorizeContent(tag: String) {
|
||||
Logger.d(TAG, "tag:$tag")
|
||||
val agreementType = AuthorizeProxy.getAuthorizeType(tag)
|
||||
Logger.d(TAG, "agreementType:$agreementType")
|
||||
baseController.invokeAuthorizeContent(tag, agreementType)
|
||||
}
|
||||
|
||||
override fun registerInvokeAuthorizeContentListener(tag: String, listener: IMogoAuthorizeContentListener) {
|
||||
MogoAuthorizeRegisterHandler.registerInvokeAuthorizeContentListener(tag, listener)
|
||||
}
|
||||
|
||||
override fun unregisterInvokeAuthorizeContentListener(tag: String) {
|
||||
MogoAuthorizeRegisterHandler.unregisterInvokeAuthorizeContentListener(tag)
|
||||
}
|
||||
|
||||
override fun registerAuthorizeListener(tag: String, listener: IMogoAcquireAuthorizeListener) {
|
||||
Logger.d(TAG, "registerAuthorize tag : $tag listener:$listener")
|
||||
MogoAuthorizeRegisterHandler.registerAuthorizeListener(tag, listener)
|
||||
}
|
||||
|
||||
override fun unregisterAuthorizeListener(tag: String) {
|
||||
MogoAuthorizeRegisterHandler.unregisterAuthorizeListener(tag)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package com.mogo.module.authorize.authprovider.biz
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.map.listener.IMogoMapListener
|
||||
import com.mogo.map.location.IMogoLocationListener
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener
|
||||
import com.mogo.map.navi.IMogoNaviListener
|
||||
import com.mogo.module.authorize.authprovider.invoke.AuthorizeConstant.Companion.PATH_AGREEMENT_MODULE_NAME
|
||||
import com.mogo.module.authorize.authprovider.invoke.AuthorizeInvokerConstant.Companion.AUTHORIZE_TYPE_LAUNCHER_MAIN
|
||||
import com.mogo.module.authorize.authprovider.launcher.MogoMainAuthorize.Companion.mogoAuthShow
|
||||
import com.mogo.module.authorize.util.SharedPreferenceUtil.hasGuide
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.service.auth.IMogoAuthManager
|
||||
import com.mogo.service.module.IMogoModuleLifecycle
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
@Route(path = MogoServicePaths.PATH_AGREEMENT)
|
||||
class MogoAuthorizeProvider : IMogoAuthManager {
|
||||
|
||||
companion object {
|
||||
const val TAG = "MogoAuthorizeProvider"
|
||||
}
|
||||
|
||||
private var mContext: Context? = null
|
||||
|
||||
override fun createFragment(context: Context?, data: Bundle?): Fragment? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun createView(context: Context?): View? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getModuleName(): String {
|
||||
return PATH_AGREEMENT_MODULE_NAME
|
||||
}
|
||||
|
||||
override fun getCardLifecycle(): IMogoModuleLifecycle? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getMapListener(): IMogoMapListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getType(): Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
override fun getNaviListener(): IMogoNaviListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getLocationListener(): IMogoLocationListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getMarkerClickListener(): IMogoMarkerClickListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun showAuth(context: Context) {
|
||||
mContext = context
|
||||
mogoAuthShow.initContext(context)
|
||||
if (hasGuide() && mogoAuthShow.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_MAIN)) {
|
||||
mogoAuthShow.invokeAuthorizeForShow()
|
||||
} else {
|
||||
//首次进入Launcher同步一下授权状态,防止由于用户清除数据造成首次加载还会出现授权状态不同步问题
|
||||
mogoAuthShow.updateAuthorizeStatus(AUTHORIZE_TYPE_LAUNCHER_MAIN)
|
||||
Logger.d(TAG, "not do match self startUp condition ,wait for someone invoke")
|
||||
}
|
||||
}
|
||||
|
||||
override fun dismiss() {
|
||||
mogoAuthShow.hideAuthorizeView()
|
||||
}
|
||||
|
||||
override fun init(context: Context) {
|
||||
|
||||
}
|
||||
|
||||
override fun getAppPackage(): String? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getAppName(): String? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
mContext = null
|
||||
mogoAuthShow.release()
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package com.mogo.module.authorize.authprovider.biz
|
||||
|
||||
import com.mogo.module.authorize.authprovider.invoke.IMogoAuthorizeContentListener
|
||||
import com.mogo.module.authorize.authprovider.invoke.IMogoAuthorizeRegister
|
||||
import com.mogo.module.authorize.authprovider.module.IMogoAcquireAuthorizeListener
|
||||
import com.mogo.utils.logger.Logger
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
object MogoAuthorizeRegisterHandler : IMogoAuthorizeRegister {
|
||||
|
||||
private val authMap: ConcurrentHashMap<String, IMogoAcquireAuthorizeListener> = ConcurrentHashMap()
|
||||
private val authContentMap: ConcurrentHashMap<String, IMogoAuthorizeContentListener> = ConcurrentHashMap()
|
||||
|
||||
override fun registerAuthorizeListener(tag: String, listener: IMogoAcquireAuthorizeListener) {
|
||||
Logger.d("RegisterHandler", "tag : $tag listener:$listener")
|
||||
authMap[tag] = listener
|
||||
}
|
||||
|
||||
override fun unregisterAuthorizeListener(tag: String) {
|
||||
authMap.remove(tag)
|
||||
}
|
||||
|
||||
fun getAuthorizeListener(tag: String): IMogoAcquireAuthorizeListener? {
|
||||
return authMap[tag]
|
||||
}
|
||||
|
||||
fun getAllAuthorizeListener(): ConcurrentHashMap<String, IMogoAcquireAuthorizeListener> {
|
||||
return authMap
|
||||
}
|
||||
|
||||
override fun registerInvokeAuthorizeContentListener(tag: String, listener: IMogoAuthorizeContentListener) {
|
||||
authContentMap[tag] = listener
|
||||
}
|
||||
|
||||
override fun unregisterInvokeAuthorizeContentListener(tag: String) {
|
||||
authContentMap.remove(tag)
|
||||
}
|
||||
|
||||
fun getAuthorizeContentListener(tag: String): IMogoAuthorizeContentListener? {
|
||||
return authContentMap[tag]
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.mogo.module.authorize.authprovider.invoke
|
||||
|
||||
class AuthorizeConstant {
|
||||
|
||||
companion object{
|
||||
const val PROVIDER_MODULE = "/authorize/biz"
|
||||
const val PROVIDER_LAUNCHER = "/authorize/showbiz"
|
||||
|
||||
/**
|
||||
* provider模块实例名称(暂时仅有卡片用到)
|
||||
*/
|
||||
const val PATH_AGREEMENT_MODULE_NAME = "AGREEMENT_MODULE_NAME"
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.mogo.module.authorize.authprovider.invoke
|
||||
|
||||
class AuthorizeInvokerConstant {
|
||||
|
||||
companion object {
|
||||
const val AUTHORIZE_TYPE_LAUNCHER_MAIN = "AUTHORIZE_TYPE_LAUNCHER_MAIN" //launcher
|
||||
const val AUTHORIZE_TYPE_LAUNCHER_SHARE_NOVELTY = "AUTHORIZE_TYPE_LAUNCHER_SHARE_NOVELTY" //launcher 新鲜事分享
|
||||
const val AUTHORIZE_TYPE_LAUNCHER_SHARE_MUSIC = "AUTHORIZE_TYPE_LAUNCHER_SHARE_MUSIC" //launcher 音乐分享
|
||||
const val AUTHORIZE_TYPE_LAUNCHER_SHARE = "AUTHORIZE_TYPE_LAUNCHER_SHARE" //launcher 我要分享
|
||||
const val AUTHORIZE_TYPE_TAN_LU = "AUTHORIZE_TYPE_TAN_LU" //探路
|
||||
const val AUTHORIZE_TYPE_CALL_CHAT = "AUTHORIZE_TYPE_CALL_CHAT" //车聊聊
|
||||
const val AUTHORIZE_TYPE_NOVELTY = "AUTHORIZE_TYPE_NOVELTY" //新鲜事
|
||||
const val AUTHORIZE_TYPE_AUXILIARY_DRIVING = "AUTHORIZE_TYPE_AUXILIARY_DRIVING" //辅助驾驶
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.mogo.module.authorize.authprovider.invoke
|
||||
|
||||
import com.mogo.module.authorize.model.bean.Agreement
|
||||
|
||||
/**
|
||||
* 获取授权信息回调
|
||||
*/
|
||||
interface IMogoAuthorizeContentListener {
|
||||
|
||||
fun requestContentSuccess(userAgreement: Agreement)
|
||||
|
||||
fun requestContentFailed(errorMsg: String)
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.mogo.module.authorize.authprovider.invoke
|
||||
|
||||
interface IMogoAuthorizeForbiddenVoice {
|
||||
|
||||
/**
|
||||
* 当授权页面展示时,语音回调不生效(唤醒、免唤醒)
|
||||
*/
|
||||
fun forbiddenVoiceWhenAuthorize(cmd: String)
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.mogo.module.authorize.authprovider.invoke
|
||||
|
||||
/**
|
||||
* 公共Business业务
|
||||
*/
|
||||
interface IMogoAuthorizeInvoke : IMogoAuthorizeRegister {
|
||||
|
||||
/**
|
||||
* 是否需要授权
|
||||
*/
|
||||
fun needAuthorize(tag: String): Boolean
|
||||
|
||||
/**
|
||||
* 获取授权内容
|
||||
* tag:模块ID
|
||||
*/
|
||||
fun invokeAuthorizeContent(tag: String)
|
||||
|
||||
/**
|
||||
* 更新授权状态
|
||||
* tag:模块ID
|
||||
*/
|
||||
fun updateAuthorizeStatus(tag:String){
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.mogo.module.authorize.authprovider.invoke
|
||||
|
||||
import com.mogo.module.authorize.authprovider.module.IMogoAcquireAuthorizeListener
|
||||
|
||||
interface IMogoAuthorizeRegister {
|
||||
|
||||
/**
|
||||
* 注冊授权回调
|
||||
* tag:module tag
|
||||
* @see IMogoAcquireAuthorizeListener
|
||||
*/
|
||||
fun registerAuthorizeListener(tag: String, listener: IMogoAcquireAuthorizeListener)
|
||||
|
||||
/**
|
||||
* 反注册授权回调
|
||||
* tag:module tag
|
||||
*/
|
||||
fun unregisterAuthorizeListener(tag: String)
|
||||
|
||||
/**
|
||||
* 注册授权信息内容回调
|
||||
* tag:module tag
|
||||
* @see IMogoAuthorizeContentListener
|
||||
*/
|
||||
fun registerInvokeAuthorizeContentListener(tag: String, listener: IMogoAuthorizeContentListener)
|
||||
|
||||
/**
|
||||
* 反注册授权信息内容回调
|
||||
* tag:module tag
|
||||
*/
|
||||
fun unregisterInvokeAuthorizeContentListener(tag: String)
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.mogo.module.authorize.authprovider.launcher
|
||||
|
||||
import com.mogo.module.authorize.authprovider.invoke.IMogoAuthorizeInvoke
|
||||
|
||||
//与Biz业务相同接口实现
|
||||
interface IAuthorizeMainInvoke : IMogoAuthorizeInvoke {
|
||||
|
||||
/**
|
||||
* 同意授权
|
||||
* tag:透传模块ID
|
||||
*/
|
||||
fun agreeAuthorize(tag: String, agrId: Long, onSuccess: (() -> Unit), onError: ((String) -> Unit))
|
||||
|
||||
/**
|
||||
* 不同意授权
|
||||
* tag:透传模块ID
|
||||
*/
|
||||
fun disAgreeAuthorize(tag: String, agrId: Long, onSuccess: (() -> Unit), onError: ((String) -> Unit))
|
||||
|
||||
/**
|
||||
* 是否已经注册回调
|
||||
*/
|
||||
fun hasRegister(tag: String): Boolean
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package com.mogo.module.authorize.authprovider.launcher
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.module.authorize.authprovider.invoke.AuthorizeConstant
|
||||
import com.mogo.module.authorize.authprovider.invoke.IMogoAuthorizeContentListener
|
||||
import com.mogo.module.authorize.authprovider.launcher.MogoMainAuthorize.Companion.mogoAuthShow
|
||||
import com.mogo.module.authorize.authprovider.module.IMogoAcquireAuthorizeListener
|
||||
|
||||
@Route(path = AuthorizeConstant.PROVIDER_LAUNCHER)
|
||||
class IMogoAuthorizeMainManager : IMogoAuthorizeMainProvider {
|
||||
|
||||
override fun hasRegister(tag: String): Boolean {
|
||||
return mogoAuthShow.hasRegister(tag)
|
||||
}
|
||||
|
||||
override fun needAuthorize(tag: String): Boolean {
|
||||
return mogoAuthShow.needAuthorize(tag)
|
||||
}
|
||||
|
||||
override fun invokeAuthorizeContent(tag: String) {
|
||||
mogoAuthShow.invokeAuthorizeContent(tag)
|
||||
}
|
||||
|
||||
override fun agreeAuthorize(tag: String, agrId: Long, onSuccess: (() -> Unit), onError: ((String) -> Unit)) {
|
||||
mogoAuthShow.agreeAuthorize(tag, agrId, onSuccess, onError)
|
||||
}
|
||||
|
||||
override fun disAgreeAuthorize(tag: String, agrId: Long, onSuccess: (() -> Unit), onError: ((String) -> Unit)) {
|
||||
mogoAuthShow.disAgreeAuthorize(tag, agrId, onSuccess, onError)
|
||||
}
|
||||
|
||||
override fun registerAuthorizeListener(tag: String, listener: IMogoAcquireAuthorizeListener) {
|
||||
mogoAuthShow.registerAuthorizeListener(tag, listener)
|
||||
}
|
||||
|
||||
override fun unregisterAuthorizeListener(tag: String) {
|
||||
mogoAuthShow.unregisterAuthorizeListener(tag)
|
||||
}
|
||||
|
||||
override fun registerInvokeAuthorizeContentListener(tag: String, listener: IMogoAuthorizeContentListener) {
|
||||
mogoAuthShow.registerInvokeAuthorizeContentListener(tag, listener)
|
||||
}
|
||||
|
||||
override fun unregisterInvokeAuthorizeContentListener(tag: String) {
|
||||
mogoAuthShow.unregisterInvokeAuthorizeContentListener(tag)
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.mogo.module.authorize.authprovider.launcher
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.template.IProvider
|
||||
import com.mogo.module.authorize.authprovider.invoke.IMogoAuthorizeInvoke
|
||||
|
||||
//仅提供给调用业务端(主launcher)使用
|
||||
interface IMogoAuthorizeMainProvider : IProvider, IAuthorizeMainInvoke {
|
||||
|
||||
override fun init(context: Context?) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.mogo.module.authorize.authprovider.launcher
|
||||
|
||||
import com.mogo.module.authorize.authprovider.invoke.IMogoAuthorizeForbiddenVoice
|
||||
|
||||
interface IMogoAuthorizeShow : IMogoAuthorizeForbiddenVoice {
|
||||
|
||||
fun showAuthorizeView()
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
package com.mogo.module.authorize.authprovider.launcher
|
||||
|
||||
import com.mogo.module.authorize.authprovider.biz.IMogoAuthorizeController
|
||||
import com.mogo.module.authorize.authprovider.biz.MogoAuthorizeRegisterHandler
|
||||
import com.mogo.module.authorize.model.BaseResponse
|
||||
import com.mogo.module.authorize.model.bean.AGREEMENT_EFFECT
|
||||
import com.mogo.module.authorize.model.bean.AGREEMENT_NOT_EFFECT
|
||||
import com.mogo.module.authorize.model.proxy.toAuthorizeType
|
||||
import com.mogo.module.authorize.net.request
|
||||
import com.mogo.module.authorize.util.SharedPreferenceUtil.setAuthorizeStatus
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
object MogoAuthorizeMainController : IMogoAuthorizeController() {
|
||||
|
||||
private val authorizeShowModel: MogoAuthorizeMainModel by lazy { MogoAuthorizeMainModel() }
|
||||
|
||||
@Synchronized
|
||||
fun agreeAuthorize(tag: String, agrId: Long, onSuccess: (() -> Unit), onError: ((String) -> Unit)) {
|
||||
|
||||
updateAuthorize(agrId, AGREEMENT_EFFECT, {
|
||||
authorizeSuccess(tag)
|
||||
setAuthorizeStatus(tag.toAuthorizeType(), true)
|
||||
onSuccess.invoke()
|
||||
}, {
|
||||
val errorMsg = it ?: "agreeAuthorize failed,please check network"
|
||||
authorizeFailed(tag, errorMsg)
|
||||
onError.invoke(errorMsg)
|
||||
})
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun disAgreeAuthorize(tag: String, agrId: Long, onSuccess: (() -> Unit), onError: ((String) -> Unit)) {
|
||||
updateAuthorize(agrId, AGREEMENT_NOT_EFFECT, {
|
||||
authorizeFailed(tag, "UserDisAgree authorize")
|
||||
onSuccess.invoke()
|
||||
}, {
|
||||
val errorMsg = it ?: "disAgreeAuthorize failed,please check network"
|
||||
authorizeFailed(tag, errorMsg)
|
||||
onError.invoke(errorMsg)
|
||||
})
|
||||
}
|
||||
|
||||
private fun updateAuthorize(agrId: Long, agreementStatus: Int, onSuccess: (() -> Unit), onError: ((String?) -> Unit)) {
|
||||
request<BaseResponse<Any>> {
|
||||
loader {
|
||||
authorizeShowModel.updateAuthorize(agrId, agreementStatus)
|
||||
}
|
||||
onSuccess {
|
||||
onSuccess.invoke()
|
||||
}
|
||||
onError {
|
||||
onError.invoke(it.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun authorizeFailed(tag: String, errorMsg: String) {
|
||||
val acquireAuthorizeListener = MogoAuthorizeRegisterHandler.getAuthorizeListener(tag)
|
||||
if (acquireAuthorizeListener != null) {
|
||||
acquireAuthorizeListener.authorizeFailed(errorMsg)
|
||||
} else {
|
||||
Logger.d(TAG, "disAgreeAuthorize --- can not find listener by this tag :$tag ")
|
||||
}
|
||||
}
|
||||
|
||||
private fun authorizeSuccess(tag: String) {
|
||||
val acquireAuthListener = MogoAuthorizeRegisterHandler.getAuthorizeListener(tag)
|
||||
if (acquireAuthListener != null) {
|
||||
acquireAuthListener.authorizeSuccess()
|
||||
} else {
|
||||
Logger.d(TAG, "agreeAuthorize --- can not find listener by this tag :$tag ")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.mogo.module.authorize.authprovider.launcher
|
||||
|
||||
import com.google.gson.Gson
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.module.authorize.model.BaseResponse
|
||||
import com.mogo.module.authorize.model.IMogoAuthorizeModel
|
||||
import com.mogo.module.authorize.model.bean.UpdateAuthorize
|
||||
|
||||
class MogoAuthorizeMainModel : IMogoAuthorizeModel() {
|
||||
|
||||
suspend fun updateAuthorize(agrId: Long, agreementStatus: Int): BaseResponse<Any> {
|
||||
val updateAuthorize = Gson().toJson(UpdateAuthorize(agrId, agreementStatus))
|
||||
val map = mapOf("sn" to MoGoAiCloudClientConfig.getInstance().sn, "data" to updateAuthorize)
|
||||
return apiCall { getNetWorkApi().updateAuthorize(map) }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
package com.mogo.module.authorize.authprovider.launcher
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Looper
|
||||
import com.mogo.commons.context.ContextHolderUtil
|
||||
import com.mogo.module.authorize.authprovider.biz.MogoAuthorizeManagerImpl
|
||||
import com.mogo.module.authorize.authprovider.biz.MogoAuthorizeRegisterHandler
|
||||
import com.mogo.module.authorize.authprovider.invoke.AuthorizeInvokerConstant.Companion.AUTHORIZE_TYPE_LAUNCHER_MAIN
|
||||
import com.mogo.module.authorize.layout.AuthorizeDialog
|
||||
import com.mogo.module.authorize.model.proxy.toAuthorizeType
|
||||
import com.mogo.module.authorize.util.SharedPreferenceUtil.hasAuth
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
class MogoMainAuthorize private constructor() : MogoAuthorizeManagerImpl(), IMogoAuthorizeMainProvider {
|
||||
|
||||
companion object {
|
||||
|
||||
const val TAG = "MogoMainAuthorize"
|
||||
|
||||
val mogoAuthShow by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
MogoMainAuthorize()
|
||||
}
|
||||
}
|
||||
|
||||
private var mContext: Context? = null
|
||||
|
||||
private var authorizeDialog: AuthorizeDialog? = null
|
||||
|
||||
override fun hasRegister(tag: String): Boolean {
|
||||
if (tag.isNullOrBlank()) return false
|
||||
val listener = MogoAuthorizeRegisterHandler.getAuthorizeContentListener(tag)
|
||||
return listener != null
|
||||
}
|
||||
|
||||
override fun agreeAuthorize(tag: String, agrId: Long, onSuccess: (() -> Unit), onError: ((String) -> Unit)) {
|
||||
MogoAuthorizeMainController.agreeAuthorize(tag, agrId, onSuccess, onError)
|
||||
}
|
||||
|
||||
override fun disAgreeAuthorize(tag: String, agrId: Long, onSuccess: (() -> Unit), onError: ((String) -> Unit)) {
|
||||
MogoAuthorizeMainController.disAgreeAuthorize(tag, agrId, onSuccess, onError)
|
||||
}
|
||||
|
||||
fun initContext(mContext: Context) {
|
||||
this.mContext = mContext
|
||||
}
|
||||
|
||||
fun invokeAuthorizeForShow() {
|
||||
pushLayoutToMainWindow(AUTHORIZE_TYPE_LAUNCHER_MAIN)
|
||||
}
|
||||
|
||||
fun showAuthorizeView(tag: String, forbiddenVoice: (() -> Unit), onError: ((String) -> Unit)) {
|
||||
val listener = MogoAuthorizeRegisterHandler.getAuthorizeListener(tag)
|
||||
if (listener == null) {
|
||||
onError.invoke("launcher authorizeShowListener is null,must register in MainActivity")
|
||||
return
|
||||
}
|
||||
if (tag.isNullOrBlank()) {
|
||||
onError.invoke("tag is null,please invoke with tag")
|
||||
}
|
||||
if (Thread.currentThread() != Looper.getMainLooper().thread) {
|
||||
onError.invoke("invoke should be in main thread")
|
||||
return
|
||||
}
|
||||
if (hasAuth(tag.toAuthorizeType())) {
|
||||
onError.invoke("already authorize,do not repeat operation")
|
||||
return
|
||||
}
|
||||
Logger.d(TAG, "ready to forbidden voice")
|
||||
forbiddenVoice.invoke()
|
||||
Logger.d(TAG, "ready to push fragment")
|
||||
pushLayoutToMainWindow(tag)
|
||||
}
|
||||
|
||||
fun hideAuthorizeView() {
|
||||
if (authorizeDialog != null && authorizeDialog!!.isShowing) {
|
||||
authorizeDialog?.dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
private fun pushLayoutToMainWindow(tag: String) {
|
||||
if (mContext == null) {
|
||||
Logger.d(TAG, "Because of mContext has no init, the application has in background now")
|
||||
return
|
||||
}
|
||||
if (authorizeDialog == null) {
|
||||
authorizeDialog = AuthorizeDialog(tag, ContextHolderUtil.getContext() ?: mContext!!)
|
||||
authorizeDialog!!.setOnDismissListener {
|
||||
authorizeDialog = null
|
||||
}
|
||||
}
|
||||
if (authorizeDialog!!.isShowing) {
|
||||
Logger.d(TAG, "User is operation authorization, do not repeat invoke")
|
||||
return
|
||||
} else {
|
||||
Logger.d(TAG, "pushLayoutToMainWindow")
|
||||
authorizeDialog!!.show()
|
||||
}
|
||||
}
|
||||
|
||||
fun release() {
|
||||
if (authorizeDialog != null && authorizeDialog!!.isShowing) {
|
||||
authorizeDialog!!.dismiss()
|
||||
authorizeDialog = null
|
||||
}
|
||||
mContext = null
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.mogo.module.authorize.authprovider.module
|
||||
|
||||
import com.mogo.module.authorize.authprovider.invoke.IMogoAuthorizeInvoke
|
||||
|
||||
//与Biz业务相同接口实现
|
||||
interface IAuthorizeModuleInvoke : IMogoAuthorizeInvoke {
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.mogo.module.authorize.authprovider.module
|
||||
|
||||
import com.mogo.module.authorize.authprovider.invoke.IMogoAuthorizeForbiddenVoice
|
||||
|
||||
interface IMogoAcquireAuthorizeListener : IMogoAuthorizeForbiddenVoice {
|
||||
|
||||
fun authorizeSuccess()
|
||||
|
||||
fun authorizeFailed(errorMsg: String)
|
||||
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package com.mogo.module.authorize.authprovider.module
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.module.authorize.authprovider.invoke.AuthorizeConstant
|
||||
import com.mogo.module.authorize.authprovider.invoke.IMogoAuthorizeContentListener
|
||||
import com.mogo.module.authorize.authprovider.module.MogoModuleAuthorize.Companion.mogoAuth
|
||||
|
||||
@Route(path = AuthorizeConstant.PROVIDER_MODULE)
|
||||
class IMogoAuthorizeModuleManager : IMogoAuthorizeModuleProvider {
|
||||
|
||||
override fun needAuthorize(tag: String): Boolean {
|
||||
return mogoAuth.needAuthorize(tag)
|
||||
}
|
||||
|
||||
override fun invokeAuthorizeForShow() {
|
||||
mogoAuth.invokeAuthorizeForShow()
|
||||
}
|
||||
|
||||
override fun invokeAuthorization(tag: String) {
|
||||
mogoAuth.invokeAuthorization(tag)
|
||||
}
|
||||
|
||||
override fun invokeAuthorizeContent(tag: String) {
|
||||
mogoAuth.invokeAuthorizeContent(tag)
|
||||
}
|
||||
|
||||
override fun registerAuthorizeListener(tag: String, listener: IMogoAcquireAuthorizeListener) {
|
||||
mogoAuth.registerAuthorizeListener(tag, listener)
|
||||
}
|
||||
|
||||
override fun unregisterAuthorizeListener(tag: String) {
|
||||
mogoAuth.unregisterAuthorizeListener(tag)
|
||||
}
|
||||
|
||||
override fun registerInvokeAuthorizeContentListener(tag: String, listener: IMogoAuthorizeContentListener) {
|
||||
mogoAuth.registerInvokeAuthorizeContentListener(tag, listener)
|
||||
}
|
||||
|
||||
override fun unregisterInvokeAuthorizeContentListener(tag: String) {
|
||||
mogoAuth.unregisterInvokeAuthorizeContentListener(tag)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.mogo.module.authorize.authprovider.module
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.template.IProvider
|
||||
import com.mogo.module.authorize.authprovider.invoke.IMogoAuthorizeInvoke
|
||||
|
||||
////仅提供给调用业务端(module)使用
|
||||
interface IMogoAuthorizeModuleProvider : IProvider, IMogoAuthorizeInvoke {
|
||||
|
||||
override fun init(context: Context) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于没有回调且直接调用授权页面展示 仅Launcher主界面业务使用
|
||||
*/
|
||||
fun invokeAuthorizeForShow()
|
||||
|
||||
/**
|
||||
* 调用授权页面
|
||||
*/
|
||||
fun invokeAuthorization(tag: String)
|
||||
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.mogo.module.authorize.authprovider.module
|
||||
|
||||
import com.mogo.module.authorize.authprovider.biz.IMogoAuthorizeController
|
||||
|
||||
object MogoAuthorizeModuleController : IMogoAuthorizeController() {
|
||||
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package com.mogo.module.authorize.authprovider.module
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.module.authorize.authprovider.biz.MogoAuthorizeManagerImpl
|
||||
import com.mogo.module.authorize.authprovider.biz.MogoAuthorizeRegisterHandler
|
||||
import com.mogo.module.authorize.authprovider.launcher.MogoMainAuthorize.Companion.mogoAuthShow
|
||||
import com.mogo.module.authorize.util.SharedPreferenceUtil
|
||||
import com.mogo.service.module.IMogoModuleProvider
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
class MogoModuleAuthorize private constructor() : MogoAuthorizeManagerImpl(), IMogoAuthorizeModuleProvider {
|
||||
|
||||
companion object {
|
||||
val mogoAuth by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
MogoModuleAuthorize()
|
||||
}
|
||||
}
|
||||
|
||||
override fun invokeAuthorizeForShow() {
|
||||
mogoAuthShow.invokeAuthorizeForShow()
|
||||
}
|
||||
|
||||
override fun invokeAuthorization(tag: String) {
|
||||
if (DebugConfig.isNeedLoadGuideModule()) {
|
||||
if(!SharedPreferenceUtil.hasGuide()){
|
||||
val guideService = ARouter.getInstance().build("/guide/showFragment").navigation()
|
||||
if(guideService is IMogoModuleProvider){
|
||||
guideService.init(AbsMogoApplication.getApp().applicationContext)
|
||||
}
|
||||
val listener = MogoAuthorizeRegisterHandler.getAuthorizeListener(tag)
|
||||
listener?.authorizeFailed("需要先执行用户引导")
|
||||
return
|
||||
}
|
||||
}else{
|
||||
Logger.i(TAG,"没有添加Guide模块,无需判断是否引导,准备展示授权")
|
||||
}
|
||||
mogoAuthShow.showAuthorizeView(tag, {
|
||||
//todo SP存储状态
|
||||
}, { errorMsg ->
|
||||
val listener = MogoAuthorizeRegisterHandler.getAuthorizeListener(tag)
|
||||
listener?.authorizeFailed(errorMsg)
|
||||
})
|
||||
}
|
||||
|
||||
fun forbiddenVoiceWhenAuthorize(cmd: String) {
|
||||
val tmpMap = MogoAuthorizeRegisterHandler.getAllAuthorizeListener()
|
||||
if (tmpMap.isEmpty()) {
|
||||
return
|
||||
}
|
||||
tmpMap.forEach {
|
||||
val acquireListener = it.value
|
||||
acquireListener.forbiddenVoiceWhenAuthorize(cmd)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package com.mogo.module.authorize.constant
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
|
||||
class HttpConstant {
|
||||
|
||||
companion object {
|
||||
const val HOST_DEV = "http://dzt-test.zhidaozhixing.com"
|
||||
const val HOST_TEST = "http://dzt-test.zhidaozhixing.com"
|
||||
const val HOST_DEMO = "http://dzt-show.zhidaozhixing.com"
|
||||
const val HOST_PRODUCT = "http://dzt.zhidaozhixing.com"
|
||||
|
||||
fun getNetHost(): String {
|
||||
return when (DebugConfig.getNetMode()) {
|
||||
DebugConfig.NET_MODE_DEV -> HOST_DEV
|
||||
DebugConfig.NET_MODE_QA -> HOST_TEST
|
||||
DebugConfig.NET_MODE_DEMO -> HOST_DEMO
|
||||
else -> HOST_PRODUCT
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.mogo.module.authorize.exception
|
||||
|
||||
|
||||
class ApiException : CommonException {
|
||||
|
||||
companion object {
|
||||
val NULL_REQUEST_DATA_API_EXCEPTION = ApiException(2, "request data is null")
|
||||
}
|
||||
|
||||
constructor(code: Int, msg: String) : super(code, msg)
|
||||
|
||||
fun getErrorMsg():String{
|
||||
return msg
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.mogo.module.authorize.exception
|
||||
|
||||
open class CommonException : Exception {
|
||||
|
||||
companion object {
|
||||
val NETWORK_EXCEPTION = CommonException(1, "network is error")
|
||||
val NULL_EXCEPTION = CommonException(1, "error msg is null")
|
||||
}
|
||||
|
||||
protected var code: Int = 0
|
||||
protected var msg: String = ""
|
||||
|
||||
constructor(code: Int, msg: String) : super(msg) {
|
||||
this.code = code
|
||||
this.msg = msg
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
package com.mogo.module.authorize.layout
|
||||
|
||||
import com.mogo.module.authorize.authprovider.biz.MogoAuthorizeRegisterHandler
|
||||
import com.mogo.module.authorize.authprovider.launcher.MogoAuthorizeMainController
|
||||
import com.mogo.module.authorize.authprovider.launcher.MogoMainAuthorize.Companion.mogoAuthShow
|
||||
import com.mogo.module.authorize.model.bean.Agreement
|
||||
import com.mogo.module.authorize.util.DateUtil.parseDateToTime
|
||||
import com.mogo.module.authorize.util.SharedPreferenceUtil.updateAuthorizeVersion
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
class AuthorizeController {
|
||||
|
||||
companion object {
|
||||
const val TAG = "AuthorizeController"
|
||||
}
|
||||
|
||||
private var invokeTag: String? = null
|
||||
private var updateTime: Long = 0L
|
||||
|
||||
private constructor()
|
||||
|
||||
constructor(invokeTag: String) {
|
||||
this.invokeTag = invokeTag
|
||||
Logger.d(TAG, "onCreate invokeTag:$invokeTag")
|
||||
}
|
||||
|
||||
fun invokeAuthorizationContent(invokeTag: String, before: () -> Unit,
|
||||
agreementContent: (id: Long, content: String, title: String, bottomContent: String, lastContent: String) -> Unit,
|
||||
agreementError: () -> Unit) {
|
||||
before.invoke()
|
||||
this.invokeTag = invokeTag
|
||||
MogoAuthorizeMainController.getAuthorizeContent({
|
||||
Logger.d(TAG, "ready to get Authorize Content")
|
||||
}, {
|
||||
getContentSuccess(it, agreementContent, agreementError)
|
||||
}, { msg: String ->
|
||||
getContentFailed(msg, agreementError)
|
||||
})
|
||||
}
|
||||
|
||||
private fun getContentSuccess(userAgreement: Agreement,
|
||||
agreementContent: (id: Long, content: String, title: String, bottomContent: String, lastContent: String) -> Unit,
|
||||
agreementError: () -> Unit) {
|
||||
Logger.d(TAG, "requestContentSuccess userAgreement:$userAgreement")
|
||||
if (userAgreement.agreementContent!= null && userAgreement.agreementContent!!.isNotEmpty()) {
|
||||
val id = userAgreement.tUserAgreementEntity.id
|
||||
val content = userAgreement.agreementContent!![0]
|
||||
val title = userAgreement.tUserAgreementEntity.title
|
||||
val bottomContent = userAgreement.tUserAgreementEntity.agreementButtonFirst
|
||||
val lastContent = userAgreement.tUserAgreementEntity.agreementButtonSecond
|
||||
val tmpUpdate = userAgreement.tUserAgreementEntity.updateTime
|
||||
updateTime = parseDateToTime(tmpUpdate)
|
||||
Logger.d(TAG, "updateTime ===== $updateTime")
|
||||
agreementContent.invoke(id, content, title, bottomContent, lastContent)
|
||||
} else {
|
||||
agreementError.invoke()
|
||||
}
|
||||
}
|
||||
|
||||
private fun getContentFailed(errorMsg: String, agreementError: () -> Unit) {
|
||||
Logger.d(TAG, "requestContentFailed errorMsg:$errorMsg")
|
||||
agreementError.invoke()
|
||||
}
|
||||
|
||||
fun agreeAuthorize(tag: String, agreementId: Long, voiceAuthorizeError: () -> Unit) {
|
||||
mogoAuthShow.agreeAuthorize(tag, agreementId, {
|
||||
Logger.d(TAG, "agreeAuthorize success")
|
||||
updateAuthorizeVersion(updateTime)
|
||||
closeAuthorizeView()
|
||||
}, {
|
||||
Logger.d(TAG, "agreeAuthorize failed")
|
||||
authorizeFailed(voiceAuthorizeError)
|
||||
})
|
||||
}
|
||||
|
||||
fun disAgreeAuthorize(tag: String, agreementId: Long, voiceAuthorizeError: () -> Unit) {
|
||||
mogoAuthShow.disAgreeAuthorize(tag, agreementId, {
|
||||
authorizeFailed(voiceAuthorizeError)
|
||||
}, {
|
||||
authorizeFailed(voiceAuthorizeError)
|
||||
})
|
||||
}
|
||||
|
||||
private inline fun authorizeFailed(voiceAuthorizeError: () -> Unit) {
|
||||
voiceAuthorizeError.invoke()
|
||||
closeAuthorizeView()
|
||||
}
|
||||
|
||||
private fun closeAuthorizeView() {
|
||||
invokeTag = null
|
||||
mogoAuthShow.hideAuthorizeView()
|
||||
}
|
||||
|
||||
fun onDestroy() {
|
||||
Logger.d(TAG, "onDestroy invokeTag : $invokeTag")
|
||||
invokeTag?.let {
|
||||
MogoAuthorizeRegisterHandler.getAuthorizeContentListener(it)?.requestContentFailed("user exit authorize --- onDestroy")
|
||||
MogoAuthorizeRegisterHandler.getAuthorizeListener(it)?.authorizeFailed("user exit authorize --- onDestroy")
|
||||
}
|
||||
mogoAuthShow.hideAuthorizeView()
|
||||
}
|
||||
}
|
||||
@@ -1,214 +0,0 @@
|
||||
package com.mogo.module.authorize.layout
|
||||
|
||||
import android.content.Context
|
||||
import android.text.Html
|
||||
import android.view.View
|
||||
import android.widget.Button
|
||||
import android.widget.TextView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.module.authorize.R
|
||||
import com.mogo.module.authorize.util.AnalyticsUtil
|
||||
import com.mogo.module.authorize.util.HtmlUtil
|
||||
import com.mogo.module.authorize.voice.IVoiceAuthorizeIntentListener
|
||||
import com.mogo.module.authorize.voice.IVoiceCommandListener
|
||||
import com.mogo.module.authorize.voice.VoiceUtil
|
||||
import com.mogo.module.common.dialog.BaseFloatDialog
|
||||
import com.mogo.module.common.utils.CarSeries
|
||||
import com.mogo.utils.TipToast
|
||||
import com.mogo.utils.logger.Logger
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
class AuthorizeDialog(invokeTag: String, context: Context) : BaseFloatDialog(context),
|
||||
View.OnClickListener, IVoiceCommandListener, IVoiceAuthorizeIntentListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "AuthorizeDialog"
|
||||
}
|
||||
|
||||
private var mContext: Context? = context
|
||||
private var invokeTag: String? = invokeTag
|
||||
|
||||
private var agreementId: Long = 0L
|
||||
|
||||
private var clTopParent: ConstraintLayout? = null
|
||||
private var clErrorContainer: ConstraintLayout? = null
|
||||
private var clLoadAuthorizeContainer: ConstraintLayout? = null
|
||||
private var clContainer: ConstraintLayout? = null
|
||||
private var clAuthorizeLoading: ConstraintLayout? = null
|
||||
private var btnAgree: Button? = null
|
||||
private var btnDisAgree: Button? = null
|
||||
private var btnLoadingError: Button? = null
|
||||
private var tvTitle: TextView? = null
|
||||
private var tvContent: TextView? = null
|
||||
private var tvButtonContent: TextView? = null
|
||||
private var tvLastContent: TextView? = null
|
||||
|
||||
private var authorizeController: AuthorizeController? = null
|
||||
|
||||
init {
|
||||
initView()
|
||||
}
|
||||
|
||||
private fun initView() {
|
||||
setContentView(R.layout.module_authorize_fragment)
|
||||
setWrapContent()
|
||||
initViews()
|
||||
}
|
||||
|
||||
private fun setWrapContent() {
|
||||
val mWindow = window
|
||||
mWindow?.let {
|
||||
if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_BYD) {
|
||||
if (CarSeries.isF8xxSeries()) {
|
||||
val lp = it.attributes
|
||||
lp.width = 1920
|
||||
lp.height = 1080
|
||||
it.attributes = lp
|
||||
} else {
|
||||
val lp = it.attributes
|
||||
lp.width = 1024
|
||||
lp.height = 600
|
||||
it.attributes = lp
|
||||
}
|
||||
} else {
|
||||
val lp = it.attributes
|
||||
lp.width = 1920
|
||||
lp.height = 1000
|
||||
it.attributes = lp
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun initViews() {
|
||||
Logger.d(TAG, "initView ")
|
||||
AnalyticsUtil.track(AnalyticsUtil.INVOKE_TRACK_AUTHORIZE_SHOW)
|
||||
init()
|
||||
Logger.d(TAG, "invokeTag :$invokeTag")
|
||||
authorizeController = AuthorizeController(invokeTag!!)
|
||||
invokeAuthorizationContent()
|
||||
VoiceUtil.registerAll(this, this)
|
||||
}
|
||||
|
||||
private fun init() {
|
||||
clTopParent = findViewById(R.id.clAuthorizeTopParent)
|
||||
clErrorContainer = findViewById(R.id.clLoadingErrorContainer)
|
||||
clLoadAuthorizeContainer = findViewById(R.id.clLoadingAuthorizeContainer)
|
||||
clContainer = findViewById(R.id.clAuthorizeContainer)
|
||||
clAuthorizeLoading = findViewById(R.id.clAuthorizeLoading)
|
||||
btnAgree = findViewById(R.id.btnAuthorizeAgree)
|
||||
btnDisAgree = findViewById(R.id.btnAuthorizeDisAgree)
|
||||
btnLoadingError = findViewById(R.id.btnAuthorizeLoadingError)
|
||||
tvTitle = findViewById(R.id.tvAuthorizeTitle)
|
||||
tvContent = findViewById(R.id.tvAuthorizeContent)
|
||||
tvButtonContent = findViewById(R.id.tvAuthorizeButtonContent)
|
||||
tvLastContent = findViewById(R.id.tvAuthorizeLastContent)
|
||||
btnAgree?.setOnClickListener(this)
|
||||
btnDisAgree?.setOnClickListener(this)
|
||||
btnLoadingError?.setOnClickListener(this)
|
||||
clTopParent?.setOnClickListener(this)
|
||||
clContainer?.setOnClickListener(this)
|
||||
clErrorContainer?.setOnClickListener(this)
|
||||
clLoadAuthorizeContainer?.setOnClickListener(this)
|
||||
clAuthorizeLoading?.setOnClickListener(this)
|
||||
}
|
||||
|
||||
private fun readyToAuthorize() {
|
||||
clErrorContainer?.visibility = View.GONE
|
||||
clLoadAuthorizeContainer?.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
private fun showAuthorizationAgreementContent(
|
||||
agreementId: Long,
|
||||
agreementContent: String,
|
||||
agreementTitle: String,
|
||||
agreementBottom: String,
|
||||
agreementLast: String) {
|
||||
VoiceUtil.speak(AbsMogoApplication.getApp().applicationContext.resources.getString(R.string.module_authorize_agreement_tip), AbsMogoApplication.getApp().applicationContext, this)
|
||||
this.agreementId = agreementId
|
||||
clLoadAuthorizeContainer?.visibility = View.GONE
|
||||
clContainer?.visibility = View.VISIBLE
|
||||
tvTitle?.text = HtmlUtil.getSpanned(agreementTitle)
|
||||
GlobalScope.async(Dispatchers.IO) {
|
||||
val spannable = HtmlUtil.getSpanned(agreementContent)
|
||||
withContext(Dispatchers.Main) {
|
||||
tvContent?.text = spannable
|
||||
}
|
||||
}
|
||||
tvButtonContent?.text = HtmlUtil.getSpanned(agreementBottom)
|
||||
tvLastContent?.text = HtmlUtil.getSpanned(agreementLast)
|
||||
}
|
||||
|
||||
private fun showAuthorizationError() {
|
||||
clLoadAuthorizeContainer?.visibility = View.GONE
|
||||
clErrorContainer?.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
private fun voiceAuthorizeError() {
|
||||
TipToast.shortTip("授权失败,请稍后重试")
|
||||
VoiceUtil.speak(AbsMogoApplication.getApp().applicationContext.getString(R.string.module_authorize_failed), AbsMogoApplication.getApp().applicationContext, this)
|
||||
Logger.d(TAG, "onDestroy")
|
||||
VoiceUtil.unregisterAll(AbsMogoApplication.getApp().applicationContext, this)
|
||||
}
|
||||
|
||||
override fun onClick(v: View) {
|
||||
when (v.id) {
|
||||
R.id.btnAuthorizeAgree -> {
|
||||
AnalyticsUtil.track(AnalyticsUtil.INVOKE_TRACK_AUTHORIZE_CLICK, hashMapOf("operation_type" to 1, "operation_result" to 1))
|
||||
agreeAuthorize()
|
||||
}
|
||||
R.id.btnAuthorizeDisAgree -> {
|
||||
AnalyticsUtil.track(AnalyticsUtil.INVOKE_TRACK_AUTHORIZE_CLICK, hashMapOf("operation_type" to 1, "operation_result" to 2))
|
||||
disAgreeAuthorize()
|
||||
}
|
||||
R.id.clLoadingErrorContainer, R.id.btnAuthorizeLoadingError -> {
|
||||
invokeAuthorizationContent()
|
||||
}
|
||||
R.id.clAuthorizeTopParent -> {
|
||||
Logger.i(TAG, "dismiss authorizeView")
|
||||
authorizeController?.onDestroy()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onVoiceCmdAgree() {
|
||||
AnalyticsUtil.track(AnalyticsUtil.INVOKE_TRACK_AUTHORIZE_CLICK, hashMapOf("operation_type" to 2, "operation_result" to 1))
|
||||
agreeAuthorize()
|
||||
}
|
||||
|
||||
override fun onVoiceCmdDisAgree() {
|
||||
AnalyticsUtil.track(AnalyticsUtil.INVOKE_TRACK_AUTHORIZE_CLICK, hashMapOf("operation_type" to 2, "operation_result" to 2))
|
||||
disAgreeAuthorize()
|
||||
}
|
||||
|
||||
private fun agreeAuthorize() {
|
||||
authorizeController?.agreeAuthorize(invokeTag!!, agreementId) {
|
||||
voiceAuthorizeError()
|
||||
}
|
||||
}
|
||||
|
||||
private fun disAgreeAuthorize() {
|
||||
authorizeController?.disAgreeAuthorize(invokeTag!!, agreementId) {
|
||||
voiceAuthorizeError()
|
||||
}
|
||||
}
|
||||
|
||||
private fun invokeAuthorizationContent() {
|
||||
authorizeController?.invokeAuthorizationContent(invokeTag!!, {
|
||||
readyToAuthorize()
|
||||
}, { id: Long, content: String, title: String, bottomContent: String, lastContent: String ->
|
||||
showAuthorizationAgreementContent(id, content, title, bottomContent, lastContent)
|
||||
}, {
|
||||
showAuthorizationError()
|
||||
})
|
||||
}
|
||||
|
||||
override fun dismiss() {
|
||||
super.dismiss()
|
||||
mContext = null
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package com.mogo.module.authorize.model
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.module.authorize.net.AuthorizeApi
|
||||
import com.mogo.module.common.constants.HostConst
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
|
||||
open class BaseRepository {
|
||||
|
||||
suspend fun <T : Any> apiCall(call: suspend () -> BaseResponse<T>): BaseResponse<T> {
|
||||
return call.invoke()
|
||||
}
|
||||
|
||||
fun getNetWorkApi(): AuthorizeApi {
|
||||
var serviceApi: IMogoServiceApis? = null
|
||||
val mogoService = ARouter.getInstance().build(com.mogo.eagle.core.data.constants.MogoServicePaths.PATH_SERVICE_APIS).navigation()
|
||||
if (mogoService is IMogoServiceApis) {
|
||||
serviceApi = mogoService
|
||||
}
|
||||
return serviceApi!!.networkApi.createNoCallAdapter(AuthorizeApi::class.java, HostConst.CHANNEL_MANAGER_HOST)
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
package com.mogo.module.authorize.model
|
||||
|
||||
|
||||
class BaseResponse<out T>(val code: Int, val msg: String, val detailMsg: String, val result: T) {
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.mogo.module.authorize.model
|
||||
|
||||
import com.google.gson.Gson
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.module.authorize.model.bean.AgreementData
|
||||
import com.mogo.module.authorize.model.bean.AgreementStatus
|
||||
import com.mogo.module.authorize.model.bean.RequestUserAgreement
|
||||
|
||||
open class IMogoAuthorizeModel : BaseRepository() {
|
||||
|
||||
companion object {
|
||||
const val TAG = "IMogoAuthorizeModel"
|
||||
}
|
||||
|
||||
suspend fun invokeAuthorizeContent(agreementType: Int, needContent: Boolean = false): BaseResponse<AgreementData> {
|
||||
val requestUserAgreement = Gson().toJson(RequestUserAgreement(agreementType, needContent))
|
||||
val map = mapOf("sn" to MoGoAiCloudClientConfig.getInstance().sn, "data" to requestUserAgreement)
|
||||
return apiCall { getNetWorkApi().getAuthorizeContent(map) }
|
||||
}
|
||||
|
||||
suspend fun invokeIfNeedAuthorize(agreementType: Int): BaseResponse<AgreementStatus> {
|
||||
val requestUserAgreement = Gson().toJson(RequestUserAgreement(agreementType))
|
||||
val map = mapOf("sn" to MoGoAiCloudClientConfig.getInstance().sn, "data" to requestUserAgreement)
|
||||
return apiCall { getNetWorkApi().checkIfNeedAuthorize(map) }
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.mogo.module.authorize.model.bean
|
||||
|
||||
const val AGREEMENT_EFFECT = 1 //用户协议生效
|
||||
const val AGREEMENT_NOT_EFFECT = 2 //用户协议不生效
|
||||
|
||||
class RequestUserAgreement{
|
||||
var agreementType:Int
|
||||
var want:Boolean = false
|
||||
|
||||
constructor(agreementType:Int){
|
||||
this.agreementType = agreementType
|
||||
}
|
||||
|
||||
constructor(agreementType: Int, want: Boolean) {
|
||||
this.agreementType = agreementType
|
||||
this.want = want
|
||||
}
|
||||
}
|
||||
|
||||
data class AgreementStatus(val agreementStatus:Int)
|
||||
|
||||
data class AgreementData(val agreement: Agreement)
|
||||
|
||||
data class Agreement(var tUserAgreementEntity: TUserAgreementEntity, var agreementContent: List<String>?)
|
||||
|
||||
data class TUserAgreementEntity(
|
||||
val id: Long, //协议ID
|
||||
val title: String, //标题
|
||||
val subhead: String, //副标题
|
||||
val agreementButtonFirst: String, //底部标题1
|
||||
val agreementButtonSecond: String, //底部标题2
|
||||
val agreementType: Int, //协议类型
|
||||
val agreementVersion: String, //协议版本
|
||||
val agreementUserType: String, //协议适用用户
|
||||
val agreementStatus: Int, //协议状态 1:生效 2:未生效
|
||||
val createTime: String, //协议创建时间
|
||||
val updateTime: String) //协议更新时间
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.mogo.module.authorize.model.bean
|
||||
|
||||
class UpdateAuthorize {
|
||||
var agrId: Long
|
||||
var status: Int
|
||||
|
||||
constructor(agrId: Long, status: Int) {
|
||||
this.agrId = agrId
|
||||
this.status = status
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "UpdateAuthorize(agrId=$agrId, status=$status)"
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
package com.mogo.module.authorize.model.proxy
|
||||
|
||||
import com.mogo.module.authorize.authprovider.invoke.AuthorizeInvokerConstant.Companion.AUTHORIZE_TYPE_AUXILIARY_DRIVING
|
||||
import com.mogo.module.authorize.authprovider.invoke.AuthorizeInvokerConstant.Companion.AUTHORIZE_TYPE_CALL_CHAT
|
||||
import com.mogo.module.authorize.authprovider.invoke.AuthorizeInvokerConstant.Companion.AUTHORIZE_TYPE_LAUNCHER_MAIN
|
||||
import com.mogo.module.authorize.authprovider.invoke.AuthorizeInvokerConstant.Companion.AUTHORIZE_TYPE_LAUNCHER_SHARE
|
||||
import com.mogo.module.authorize.authprovider.invoke.AuthorizeInvokerConstant.Companion.AUTHORIZE_TYPE_LAUNCHER_SHARE_MUSIC
|
||||
import com.mogo.module.authorize.authprovider.invoke.AuthorizeInvokerConstant.Companion.AUTHORIZE_TYPE_LAUNCHER_SHARE_NOVELTY
|
||||
import com.mogo.module.authorize.authprovider.invoke.AuthorizeInvokerConstant.Companion.AUTHORIZE_TYPE_NOVELTY
|
||||
import com.mogo.module.authorize.authprovider.invoke.AuthorizeInvokerConstant.Companion.AUTHORIZE_TYPE_TAN_LU
|
||||
|
||||
|
||||
fun String.toAuthorizeType(): Int {
|
||||
return AuthorizeProxy.getAuthorizeType(this)
|
||||
}
|
||||
|
||||
class AuthorizeProxy {
|
||||
|
||||
companion object {
|
||||
|
||||
const val TAG = "AuthorizeProxy"
|
||||
|
||||
fun getAuthorizeType(authorizeName: String): Int {
|
||||
if (authorizeName.isNullOrBlank()) {
|
||||
return -1
|
||||
}
|
||||
return when (authorizeName) {
|
||||
AUTHORIZE_TYPE_LAUNCHER_MAIN,
|
||||
AUTHORIZE_TYPE_LAUNCHER_SHARE_NOVELTY,
|
||||
AUTHORIZE_TYPE_LAUNCHER_SHARE_MUSIC,
|
||||
AUTHORIZE_TYPE_LAUNCHER_SHARE -> 0
|
||||
AUTHORIZE_TYPE_TAN_LU -> 1
|
||||
AUTHORIZE_TYPE_CALL_CHAT -> 2
|
||||
AUTHORIZE_TYPE_NOVELTY -> 3
|
||||
AUTHORIZE_TYPE_AUXILIARY_DRIVING -> 4
|
||||
else -> -1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum class AuthorizeEnum : IAuthorizeOperation {
|
||||
LAUNCHER_MAIN(0, AUTHORIZE_TYPE_LAUNCHER_MAIN),
|
||||
LAUNCHER_SHARE_NOVELTY(0, AUTHORIZE_TYPE_LAUNCHER_SHARE_NOVELTY),
|
||||
LAUNCHER_SHARE_MUSIC(0, AUTHORIZE_TYPE_LAUNCHER_SHARE_MUSIC),
|
||||
LAUNCHER_SHARE(0, AUTHORIZE_TYPE_LAUNCHER_SHARE),
|
||||
CALL_CHAT(1, AUTHORIZE_TYPE_TAN_LU),
|
||||
TANLU(2, AUTHORIZE_TYPE_CALL_CHAT),
|
||||
NOVELTY(3, AUTHORIZE_TYPE_NOVELTY),
|
||||
AUXILIARY_DRIVING(4, AUTHORIZE_TYPE_AUXILIARY_DRIVING);
|
||||
|
||||
private var authorizeType = 0
|
||||
private var authorizeName: String? = null
|
||||
|
||||
constructor(authorizeType: Int, authorizeName: String?) {
|
||||
this.authorizeType = authorizeType
|
||||
this.authorizeName = authorizeName
|
||||
}
|
||||
|
||||
override fun getOperationName(): String? {
|
||||
return authorizeName
|
||||
}
|
||||
|
||||
override fun getAcquireId(): Int {
|
||||
return authorizeType
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.mogo.module.authorize.model.proxy
|
||||
|
||||
interface IAuthorizeOperation {
|
||||
|
||||
fun getOperationName(): String?
|
||||
|
||||
fun getAcquireId(): Int
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.mogo.module.authorize.net
|
||||
|
||||
import com.mogo.module.authorize.model.BaseResponse
|
||||
import com.mogo.module.authorize.model.bean.AgreementData
|
||||
import com.mogo.module.authorize.model.bean.AgreementStatus
|
||||
import retrofit2.http.FieldMap
|
||||
import retrofit2.http.FormUrlEncoded
|
||||
import retrofit2.http.POST
|
||||
|
||||
interface AuthorizeApi {
|
||||
|
||||
//获取授权内容·
|
||||
@FormUrlEncoded
|
||||
@POST("yycp-channelManager/agreement/findUserAgreement")
|
||||
suspend fun getAuthorizeContent(@FieldMap authorizeContent: Map<String, String>): BaseResponse<AgreementData>
|
||||
|
||||
//更新授权状态
|
||||
@FormUrlEncoded
|
||||
@POST("yycp-channelManager/agreement/updateStatus")
|
||||
suspend fun updateAuthorize(@FieldMap updateStatus: Map<String, String>): BaseResponse<Any>
|
||||
|
||||
//查询是否要授权
|
||||
@FormUrlEncoded
|
||||
@POST("yycp-channelManager/agreement/queryUserAuthorizeStatusByType")
|
||||
suspend fun checkIfNeedAuthorize(@FieldMap needAuthorize: Map<String, String>): BaseResponse<AgreementStatus>
|
||||
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
package com.mogo.module.authorize.net
|
||||
|
||||
import com.mogo.module.authorize.exception.ApiException
|
||||
import com.mogo.module.authorize.exception.ApiException.Companion.NULL_REQUEST_DATA_API_EXCEPTION
|
||||
import com.mogo.module.authorize.exception.CommonException.Companion.NETWORK_EXCEPTION
|
||||
import com.mogo.module.authorize.exception.CommonException.Companion.NULL_EXCEPTION
|
||||
import com.mogo.module.authorize.model.BaseResponse
|
||||
import kotlinx.coroutines.*
|
||||
import java.net.SocketTimeoutException
|
||||
import java.net.UnknownHostException
|
||||
import java.util.concurrent.TimeoutException
|
||||
|
||||
class Request<T> {
|
||||
private lateinit var loader: suspend () -> T
|
||||
|
||||
private var start: (() -> Unit)? = null
|
||||
|
||||
private var onSuccess: ((T) -> Unit)? = null
|
||||
|
||||
private var onError: ((java.lang.Exception) -> Unit)? = null
|
||||
|
||||
private var onComplete: (() -> Unit)? = null
|
||||
|
||||
infix fun loader(loader: suspend () -> T) {
|
||||
this.loader = loader
|
||||
}
|
||||
|
||||
infix fun start(start: (() -> Unit)?) {
|
||||
this.start = start
|
||||
}
|
||||
|
||||
infix fun onSuccess(onSuccess: ((T) -> Unit)?) {
|
||||
this.onSuccess = onSuccess
|
||||
}
|
||||
|
||||
infix fun onError(onError: ((java.lang.Exception) -> Unit)?) {
|
||||
this.onError = onError
|
||||
}
|
||||
|
||||
infix fun onComplete(onComplete: (() -> Unit)?) {
|
||||
this.onComplete = onComplete
|
||||
}
|
||||
|
||||
fun request() {
|
||||
|
||||
GlobalScope.launch(context = Dispatchers.Main) {
|
||||
|
||||
start?.invoke()
|
||||
try {
|
||||
val deferred = GlobalScope.async(Dispatchers.IO, start = CoroutineStart.LAZY) {
|
||||
loader()
|
||||
}
|
||||
val result = deferred.await()
|
||||
if (result != null && result is BaseResponse<*>) {
|
||||
if (result.code == 0) {
|
||||
onSuccess?.invoke(result)
|
||||
} else {
|
||||
throw ApiException(result.code, result.msg)
|
||||
}
|
||||
} else {
|
||||
throw NULL_REQUEST_DATA_API_EXCEPTION
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
if (e.message == null) {
|
||||
onError?.invoke(NULL_EXCEPTION)
|
||||
return@launch
|
||||
}
|
||||
when (e) {
|
||||
is UnknownHostException -> onError?.invoke(NETWORK_EXCEPTION)
|
||||
is TimeoutException -> onError?.invoke(NETWORK_EXCEPTION)
|
||||
is SocketTimeoutException -> onError?.invoke(NETWORK_EXCEPTION)
|
||||
else -> onError?.invoke(java.lang.Exception(e.message ?: ""))
|
||||
}
|
||||
} finally {
|
||||
onComplete?.invoke()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline fun <T> request(buildRequest: Request<T>.() -> Unit) {
|
||||
Request<T>().apply(buildRequest).request()
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.mogo.module.authorize.util
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.service.analytics.IMogoAnalytics
|
||||
|
||||
object AnalyticsUtil {
|
||||
|
||||
const val INVOKE_TRACK_AUTHORIZE_SHOW = "Launcher_Privacy_protocol_Show"
|
||||
const val INVOKE_TRACK_AUTHORIZE_CLICK = "Launcher_Privacy_protocol_click"
|
||||
|
||||
private var trackRouter: IMogoAnalytics? = null
|
||||
|
||||
fun track(eventType: String, data: MutableMap<String, Any>? = hashMapOf()) {
|
||||
if (trackRouter == null) {
|
||||
val arouter = ARouter.getInstance().build(com.mogo.eagle.core.data.constants.MogoServicePaths.PATH_SERVICE_APIS).navigation()
|
||||
if (arouter is IMogoServiceApis) {
|
||||
trackRouter = arouter.analyticsApi
|
||||
}
|
||||
}
|
||||
trackRouter!!.track(eventType, data)
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package com.mogo.module.authorize.util
|
||||
|
||||
import java.util.*
|
||||
|
||||
object DateUtil {
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
fun parseDateToTime(tmpDate: String): Long {
|
||||
val time = Date(tmpDate)
|
||||
return time.time
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.mogo.module.authorize.util
|
||||
|
||||
import android.os.Build
|
||||
import android.text.Html
|
||||
import android.text.Spanned
|
||||
|
||||
class HtmlUtil {
|
||||
|
||||
companion object{
|
||||
fun getSpanned(content: String): Spanned {
|
||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
Html.fromHtml(content, Html.FROM_HTML_MODE_LEGACY)
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
Html.fromHtml(content)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package com.mogo.module.authorize.util
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.module.common.utils.SPConst.getSpGuide
|
||||
import com.mogo.utils.storage.SharedPrefsMgr
|
||||
|
||||
object SharedPreferenceUtil {
|
||||
|
||||
private const val HAS_AUTH = "HAS_AUTH"
|
||||
private const val AUTHORIZE_UPDATE_TIME = "AUTHORIZE_UPDATE_TIME"
|
||||
|
||||
fun needAuthorization(type: Int): Boolean {
|
||||
return !hasAuth(type)
|
||||
}
|
||||
|
||||
fun hasAuth(type: Int): Boolean {
|
||||
return SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).getBoolean(HAS_AUTH + type, false)
|
||||
}
|
||||
|
||||
fun setAuthorizeStatus(type: Int, authorize: Boolean) {
|
||||
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).putBoolean(HAS_AUTH + type, authorize)
|
||||
}
|
||||
|
||||
fun updateAuthorizeVersion(updateTime: Long) {
|
||||
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).putLong(AUTHORIZE_UPDATE_TIME, updateTime)
|
||||
}
|
||||
|
||||
fun getAuthorizeVersion(): Long {
|
||||
return SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).getLong(AUTHORIZE_UPDATE_TIME, 0L)
|
||||
}
|
||||
|
||||
fun hasGuide(): Boolean {
|
||||
return SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).getBoolean(getSpGuide(), false)
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.mogo.module.authorize.voice
|
||||
|
||||
import android.content.Intent
|
||||
import com.mogo.service.intent.IMogoIntentListener
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
private const val IVoiceIntentTAG = "IVoiceAuthorizeIntentListener"
|
||||
|
||||
interface IVoiceAuthorizeIntentListener : IMogoIntentListener, IVoiceBusinessListener {
|
||||
|
||||
override fun onIntentReceived(cmd: String?, intent: Intent?) {
|
||||
Logger.i(IVoiceIntentTAG, "cmd -> $cmd")
|
||||
if (intent != null && cmd != null) {
|
||||
VoiceManager.handleOnIntentCmd(cmd,this)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.mogo.module.authorize.voice
|
||||
|
||||
interface IVoiceBusinessListener {
|
||||
|
||||
fun onVoiceCmdAgree()
|
||||
|
||||
fun onVoiceCmdDisAgree()
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package com.mogo.module.authorize.voice
|
||||
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
private const val IVoiceCommandTAG = "IVoiceCommandTAG"
|
||||
|
||||
interface IVoiceCommandListener : IMogoVoiceCmdCallBack, IVoiceBusinessListener {
|
||||
|
||||
override fun onCmdSelected(cmd: String?) {
|
||||
Logger.i(
|
||||
IVoiceCommandTAG, "onCmdSelected cmd:${cmd ?: "cmd is null"}"
|
||||
)
|
||||
cmd?.let {
|
||||
VoiceManager.handleOnCmdSelected(cmd, this)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCmdAction(speakText: String?) {
|
||||
|
||||
}
|
||||
|
||||
override fun onCmdCancel(speakText: String?) {
|
||||
|
||||
}
|
||||
|
||||
override fun onSpeakSelectTimeOut(speakText: String?) {
|
||||
|
||||
}
|
||||
|
||||
override fun onSpeakEnd(speakText: String?) {
|
||||
Logger.i(IVoiceCommandTAG, "onSpeakEnd --- speakText : $speakText")
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
package com.mogo.module.authorize.voice
|
||||
|
||||
import android.content.Intent
|
||||
import com.mogo.module.authorize.voice.VoiceUtil.VOICE_INTENT_AGREE
|
||||
import com.mogo.module.authorize.voice.VoiceUtil.VOICE_INTENT_DISAGREE
|
||||
import com.mogo.module.authorize.voice.VoiceUtil.VOICE_REGISTER_AUTHORIZE_AGREE
|
||||
import com.mogo.module.authorize.voice.VoiceUtil.VOICE_REGISTER_AUTHORIZE_DISAGREE
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
object VoiceManager {
|
||||
|
||||
private const val TAG = "VoiceManager"
|
||||
|
||||
fun handleOnCmdSelected(cmd: String, listener: IVoiceCommandListener) {
|
||||
Logger.i(TAG, "handleOnCmdSelected: cmd ---> $cmd")
|
||||
when (cmd) {
|
||||
VOICE_REGISTER_AUTHORIZE_AGREE -> {
|
||||
Logger.i(TAG, "语音免唤醒 同意")
|
||||
listener.onVoiceCmdAgree()
|
||||
}
|
||||
VOICE_REGISTER_AUTHORIZE_DISAGREE -> {
|
||||
Logger.i(TAG, "语音免唤醒 不同意")
|
||||
listener.onVoiceCmdDisAgree()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun handleOnIntentCmd(cmd: String, listener: IVoiceAuthorizeIntentListener) {
|
||||
Logger.i(TAG, "handleOnIntentCmd: cmd -> $cmd")
|
||||
when (cmd) {
|
||||
VOICE_INTENT_AGREE -> {
|
||||
Logger.i(TAG, "语音唤醒 同意")
|
||||
listener.onVoiceCmdAgree()
|
||||
}
|
||||
VOICE_INTENT_DISAGREE -> {
|
||||
Logger.i(TAG, "语音唤醒 不同意")
|
||||
listener.onVoiceCmdDisAgree()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
package com.mogo.module.authorize.voice
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.service.intent.IMogoIntentManager
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
object VoiceUtil {
|
||||
|
||||
private const val TAG = "VoiceUtil"
|
||||
private var intentRegister: IMogoIntentManager? = null
|
||||
|
||||
init {
|
||||
Logger.i(TAG, "init")
|
||||
val register =
|
||||
ARouter.getInstance().build(com.mogo.eagle.core.data.constants.MogoServicePaths.PATH_SERVICE_APIS).navigation()
|
||||
if (register is IMogoServiceApis) {
|
||||
intentRegister = register.intentManagerApi
|
||||
}
|
||||
}
|
||||
|
||||
//WakeUp Command (Intent)
|
||||
const val VOICE_INTENT_AGREE = "com.zhidao.agree" //同意
|
||||
const val VOICE_INTENT_DISAGREE = "com.zhiao.disagree" //不同意
|
||||
|
||||
//unWakeUp Command
|
||||
const val VOICE_REGISTER_AUTHORIZE_AGREE = "CMD_AUTHORIZATION_AGREE"
|
||||
private val agreeArray: Array<String> = arrayOf("同意", "调整", "好的")
|
||||
const val VOICE_REGISTER_AUTHORIZE_DISAGREE = "CMD_AUTHORIZATION_DISAGREE"
|
||||
private val disAgreeArray: Array<String> = arrayOf("不同意", "不调整")
|
||||
|
||||
private var hasRegister = false
|
||||
|
||||
fun speak(content: String, context: Context, listener: IVoiceCommandListener) {
|
||||
AIAssist.getInstance(context).speakTTSVoice(content, listener)
|
||||
}
|
||||
|
||||
fun registerAll(
|
||||
voiceCommand: IVoiceCommandListener,
|
||||
intentCommand: IVoiceAuthorizeIntentListener, context: Context = AbsMogoApplication.getApp().applicationContext
|
||||
) {
|
||||
if (!hasRegister) {
|
||||
hasRegister = true
|
||||
registerAgree(context, voiceCommand, intentCommand)
|
||||
registerDisAgree(context, voiceCommand, intentCommand)
|
||||
}
|
||||
}
|
||||
|
||||
private fun registerAgree(
|
||||
context: Context,
|
||||
voiceCommand: IVoiceCommandListener,
|
||||
intentCommand: IVoiceAuthorizeIntentListener
|
||||
) {
|
||||
Logger.i(TAG, "registerAgree")
|
||||
AIAssist.getInstance(context)
|
||||
.registerUnWakeupCommand(
|
||||
VOICE_REGISTER_AUTHORIZE_AGREE,
|
||||
agreeArray, voiceCommand
|
||||
)
|
||||
intentRegister?.registerIntentListener(VOICE_INTENT_AGREE, intentCommand)
|
||||
}
|
||||
|
||||
private fun registerDisAgree(
|
||||
context: Context,
|
||||
voiceCommand: IVoiceCommandListener,
|
||||
intentCommand: IVoiceAuthorizeIntentListener
|
||||
) {
|
||||
Logger.i(TAG, "registerDisAgree")
|
||||
AIAssist.getInstance(context)
|
||||
.registerUnWakeupCommand(
|
||||
VOICE_REGISTER_AUTHORIZE_DISAGREE,
|
||||
disAgreeArray, voiceCommand
|
||||
)
|
||||
intentRegister?.registerIntentListener(VOICE_INTENT_DISAGREE, intentCommand)
|
||||
}
|
||||
|
||||
fun unregisterAll(context: Context, listener: IVoiceAuthorizeIntentListener) {
|
||||
Logger.i(TAG, "unregister All")
|
||||
AIAssist.getInstance(context).unregisterUnWakeupCommand(VOICE_REGISTER_AUTHORIZE_AGREE)
|
||||
AIAssist.getInstance(context).unregisterUnWakeupCommand(VOICE_REGISTER_AUTHORIZE_DISAGREE)
|
||||
hasRegister = false
|
||||
|
||||
Logger.i(TAG, "unregister IntentVoiceCommand --- intentRegister:$intentRegister")
|
||||
intentRegister?.let {
|
||||
it.unregisterIntentListener(VOICE_INTENT_AGREE, listener)
|
||||
it.unregisterIntentListener(VOICE_INTENT_DISAGREE, listener)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true">
|
||||
<shape>
|
||||
<corners android:radius="@dimen/dp_59" />
|
||||
<gradient android:angle="0" android:endColor="#805CC1FF" android:startColor="#80256BFF" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape>
|
||||
<corners android:radius="@dimen/dp_59" />
|
||||
<gradient android:angle="0" android:endColor="#5CC1FF" android:startColor="#256BFF" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true">
|
||||
<shape>
|
||||
<corners android:bottomLeftRadius="@dimen/dp_30" />
|
||||
<gradient android:endColor="#805CC1FF" android:startColor="#80256BFF" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape>
|
||||
<corners android:bottomLeftRadius="@dimen/dp_30" />
|
||||
<gradient android:endColor="#5CC1FF" android:startColor="#256BFF" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="@dimen/dp_30" />
|
||||
<gradient
|
||||
android:angle="135"
|
||||
android:endColor="#3F4057"
|
||||
android:startColor="#2A2B38 " />
|
||||
</shape>
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true">
|
||||
<shape>
|
||||
<corners android:bottomRightRadius="@dimen/dp_30" />
|
||||
<gradient android:endColor="#803F4057" android:startColor="#8050526E" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape>
|
||||
<corners android:bottomRightRadius="@dimen/dp_30" />
|
||||
<gradient android:endColor="#3F4057" android:startColor="#50526E " />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true">
|
||||
<shape>
|
||||
<corners android:radius="@dimen/dp_45" />
|
||||
<gradient android:angle="0" android:endColor="#805CC1FF" android:startColor="#80256BFF" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape>
|
||||
<corners android:radius="@dimen/dp_45" />
|
||||
<gradient android:angle="0" android:endColor="#5CC1FF" android:startColor="#256BFF" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true">
|
||||
<shape>
|
||||
<corners android:bottomLeftRadius="@dimen/dp_30" />
|
||||
<gradient android:endColor="#805CC1FF" android:startColor="#80256BFF" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape>
|
||||
<corners android:bottomLeftRadius="@dimen/dp_30" />
|
||||
<gradient android:endColor="#5CC1FF" android:startColor="#256BFF" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="@dimen/dp_30" />
|
||||
<gradient
|
||||
android:angle="135"
|
||||
android:endColor="#3F4057"
|
||||
android:startColor="#2A2B38 " />
|
||||
</shape>
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true">
|
||||
<shape>
|
||||
<corners android:bottomRightRadius="@dimen/dp_30" />
|
||||
<gradient android:endColor="#803F4057" android:startColor="#8050526E" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape>
|
||||
<corners android:bottomRightRadius="@dimen/dp_30" />
|
||||
<gradient android:endColor="#3F4057" android:startColor="#50526E " />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners
|
||||
android:topLeftRadius="@dimen/dp_30"
|
||||
android:topRightRadius="@dimen/dp_30" />
|
||||
<gradient
|
||||
android:angle="135"
|
||||
android:endColor="#19757DB9"
|
||||
android:startColor="#19525681" />
|
||||
</shape>
|
||||
|
Before Width: | Height: | Size: 194 B |
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true">
|
||||
<shape>
|
||||
<corners android:radius="@dimen/dp_45" />
|
||||
<gradient android:angle="0" android:endColor="#805CC1FF" android:startColor="#80256BFF" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape>
|
||||
<corners android:radius="@dimen/dp_45" />
|
||||
<gradient android:angle="0" android:endColor="#5CC1FF" android:startColor="#256BFF" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true">
|
||||
<shape>
|
||||
<corners android:bottomLeftRadius="@dimen/dp_22" />
|
||||
<gradient android:endColor="#805CC1FF" android:startColor="#80256BFF" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape>
|
||||
<corners android:bottomLeftRadius="@dimen/dp_22" />
|
||||
<gradient android:endColor="#5CC1FF" android:startColor="#256BFF" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="@dimen/dp_22" />
|
||||
<gradient
|
||||
android:angle="135"
|
||||
android:endColor="#3F4057"
|
||||
android:startColor="#2A2B38" />
|
||||
</shape>
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true">
|
||||
<shape>
|
||||
<corners android:bottomRightRadius="@dimen/dp_22" />
|
||||
<gradient android:endColor="#803F4057" android:startColor="#8050526E" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape>
|
||||
<corners android:bottomRightRadius="@dimen/dp_22" />
|
||||
<gradient android:endColor="#3F4057" android:startColor="#50526E " />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners
|
||||
android:topLeftRadius="@dimen/dp_22"
|
||||
android:topRightRadius="@dimen/dp_22" />
|
||||
<gradient
|
||||
android:angle="135"
|
||||
android:endColor="#19757DB9"
|
||||
android:startColor="#19525681" />
|
||||
</shape>
|
||||
@@ -1,210 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/clAuthorizeTopParent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#CC000000">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/clLoadingAuthorizeContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/dp_301"
|
||||
android:layout_marginTop="@dimen/dp_100"
|
||||
android:layout_marginRight="@dimen/dp_301"
|
||||
android:layout_marginBottom="@dimen/dp_100"
|
||||
android:background="@drawable/module_authorize_selector_dark_corner"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/clAuthorizeLoading"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivAuthorizeLoading"
|
||||
android:layout_width="@dimen/dp_154"
|
||||
android:layout_height="@dimen/dp_154"
|
||||
android:src="@mipmap/module_authorize_loading"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAuthorizeLoading"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_40"
|
||||
android:text="@string/module_authorize_agreement_loading"
|
||||
android:textColor="#99FFFFFF"
|
||||
android:textSize="@dimen/dp_40"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ivAuthorizeLoading" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/clLoadingErrorContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/dp_301"
|
||||
android:layout_marginTop="@dimen/dp_100"
|
||||
android:layout_marginRight="@dimen/dp_301"
|
||||
android:layout_marginBottom="@dimen/dp_100"
|
||||
android:background="@drawable/module_authorize_selector_dark_corner"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnAuthorizeLoadingError"
|
||||
android:layout_width="@dimen/dp_400"
|
||||
android:layout_height="@dimen/dp_110"
|
||||
android:layout_marginTop="@dimen/dp_71"
|
||||
android:background="@drawable/module_authorize_selector_blue_corner"
|
||||
android:gravity="center"
|
||||
android:text="@string/module_authorize_agreement_retry"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_40"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvAuthorizeLoadingError" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivAuthorizeLoadingError"
|
||||
android:layout_width="@dimen/dp_125"
|
||||
android:layout_height="@dimen/dp_125"
|
||||
android:layout_marginTop="@dimen/dp_155"
|
||||
android:src="@mipmap/module_authorize_loading_error"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAuthorizeLoadingError"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_29"
|
||||
android:text="@string/module_authorize_agreement_error"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_40"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ivAuthorizeLoadingError" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/clAuthorizeContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/dp_301"
|
||||
android:layout_marginTop="@dimen/dp_100"
|
||||
android:layout_marginRight="@dimen/dp_301"
|
||||
android:layout_marginBottom="@dimen/dp_100"
|
||||
android:background="@drawable/module_authorize_selector_dark_corner"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnAuthorizeAgree"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="@dimen/dp_123"
|
||||
android:background="@drawable/module_authorize_selector_blue_left_corner"
|
||||
android:gravity="center"
|
||||
android:text="@string/module_authorize_agreement_agree"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_40"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_weight="1"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@+id/btnAuthorizeDisAgree" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnAuthorizeDisAgree"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="@dimen/dp_123"
|
||||
android:background="@drawable/module_authorize_selector_dark_right_corner"
|
||||
android:gravity="center"
|
||||
android:text="@string/module_authorize_agreement_disagree"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_40"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_weight="1"
|
||||
app:layout_constraintLeft_toRightOf="@+id/btnAuthorizeAgree"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="0px"
|
||||
android:layout_height="0px"
|
||||
android:layout_marginBottom="@dimen/dp_123"
|
||||
android:scrollbarSize="@dimen/dp_442"
|
||||
android:layout_marginTop="@dimen/dp_35"
|
||||
android:scrollbarTrackHorizontal="@drawable/module_authorize_scrollbar"
|
||||
android:scrollbarThumbVertical="@drawable/module_authorize_scrollbar"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvAuthorizeTitle">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/dp_55"
|
||||
android:layout_marginRight="@dimen/dp_55"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAuthorizeContent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:lineSpacingExtra="@dimen/dp_15"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_36" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAuthorizeButtonContent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_36" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAuthorizeLastContent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="@dimen/dp_15"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_36" />
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAuthorizeTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_62"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_42"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,236 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/clAuthorizeTopParent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/module_authorize_color">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/clLoadingAuthorizeContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/dp_275"
|
||||
android:layout_marginTop="@dimen/dp_125"
|
||||
android:layout_marginRight="@dimen/dp_275"
|
||||
android:layout_marginBottom="@dimen/dp_125"
|
||||
android:background="@drawable/module_authorize_selector_dark_corner"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/clAuthorizeLoading"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivAuthorizeLoading"
|
||||
android:layout_width="@dimen/dp_147"
|
||||
android:layout_height="@dimen/dp_147"
|
||||
android:src="@mipmap/module_authorize_loading"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAuthorizeLoading"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_44"
|
||||
android:text="@string/module_authorize_agreement_loading"
|
||||
android:textColor="@color/module_authorize_loading_text"
|
||||
android:textSize="@dimen/dp_31"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ivAuthorizeLoading" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/clLoadingErrorContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/dp_275"
|
||||
android:layout_marginTop="@dimen/dp_125"
|
||||
android:layout_marginRight="@dimen/dp_275"
|
||||
android:layout_marginBottom="@dimen/dp_125"
|
||||
android:background="@drawable/module_authorize_selector_dark_corner"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnAuthorizeLoadingError"
|
||||
android:layout_width="@dimen/dp_282"
|
||||
android:layout_height="@dimen/dp_90"
|
||||
android:layout_marginTop="@dimen/dp_71"
|
||||
android:background="@drawable/module_authorize_selector_blue_corner"
|
||||
android:gravity="center"
|
||||
android:text="@string/module_authorize_agreement_retry"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_34"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvAuthorizeLoadingError" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivAuthorizeLoadingError"
|
||||
android:layout_width="@dimen/dp_94"
|
||||
android:layout_height="@dimen/dp_94"
|
||||
android:layout_marginTop="@dimen/dp_254"
|
||||
android:src="@mipmap/module_authorize_loading_error"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAuthorizeLoadingError"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:text="@string/module_authorize_agreement_error"
|
||||
android:textColor="@color/module_authorize_text"
|
||||
android:textSize="@dimen/dp_32"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ivAuthorizeLoadingError" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/clAuthorizeContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/dp_275"
|
||||
android:layout_marginTop="@dimen/dp_125"
|
||||
android:layout_marginRight="@dimen/dp_275"
|
||||
android:layout_marginBottom="@dimen/dp_125"
|
||||
android:background="@drawable/module_authorize_selector_dark_corner"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnAuthorizeAgree"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="@dimen/dp_156"
|
||||
android:background="@drawable/module_authorize_selector_blue_left_corner"
|
||||
android:gravity="center"
|
||||
android:text="@string/module_authorize_agreement_agree"
|
||||
android:textColor="@color/module_authorize_affirm_text"
|
||||
android:textSize="@dimen/dp_55"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_weight="1"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@+id/btnAuthorizeDisAgree" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnAuthorizeDisAgree"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="@dimen/dp_156"
|
||||
android:background="@drawable/module_authorize_selector_dark_right_corner"
|
||||
android:gravity="center"
|
||||
android:text="@string/module_authorize_agreement_disagree"
|
||||
android:textColor="@color/module_authorize_text"
|
||||
android:textSize="@dimen/dp_55"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_weight="1"
|
||||
app:layout_constraintLeft_toRightOf="@+id/btnAuthorizeAgree"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="0px"
|
||||
android:layout_height="0px"
|
||||
android:scrollbarSize="@dimen/dp_207"
|
||||
android:scrollbarThumbVertical="@drawable/module_authorize_scrollbar"
|
||||
android:scrollbarTrackHorizontal="@drawable/module_authorize_scrollbar"
|
||||
app:layout_constraintBottom_toTopOf="@+id/btnAuthorizeDisAgree"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/clAuthorizeTitle">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="@dimen/dp_38"
|
||||
android:layout_marginLeft="@dimen/dp_55"
|
||||
android:layout_marginRight="@dimen/dp_55"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAuthorizeContent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:lineSpacingExtra="@dimen/dp_15"
|
||||
android:textColor="@color/module_authorize_text"
|
||||
android:textSize="@dimen/dp_44" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAuthorizeButtonContent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:textColor="@color/module_authorize_text"
|
||||
android:textSize="@dimen/dp_44" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAuthorizeLastContent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="@dimen/dp_15"
|
||||
android:textColor="@color/module_authorize_text"
|
||||
android:textSize="@dimen/dp_44" />
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/clAuthorizeTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_130"
|
||||
android:background="@drawable/module_authorize_shape_top_corner"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_32"
|
||||
android:layout_height="@dimen/dp_32"
|
||||
android:layout_marginLeft="@dimen/dp_438"
|
||||
android:layout_marginTop="@dimen/dp_49"
|
||||
android:src="@mipmap/module_authorize_title_left_symbol"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_32"
|
||||
android:layout_height="@dimen/dp_32"
|
||||
android:layout_marginTop="@dimen/dp_49"
|
||||
android:layout_marginRight="@dimen/dp_438"
|
||||
android:src="@mipmap/module_authorize_title_right_symbol"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAuthorizeTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_34"
|
||||
android:textColor="@color/module_authorize_text"
|
||||
android:textSize="@dimen/dp_44"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,236 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/clAuthorizeTopParent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/module_authorize_color">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/clLoadingAuthorizeContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/dp_275"
|
||||
android:layout_marginTop="@dimen/dp_125"
|
||||
android:layout_marginRight="@dimen/dp_275"
|
||||
android:layout_marginBottom="@dimen/dp_125"
|
||||
android:background="@drawable/module_authorize_selector_dark_corner"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/clAuthorizeLoading"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivAuthorizeLoading"
|
||||
android:layout_width="@dimen/dp_147"
|
||||
android:layout_height="@dimen/dp_147"
|
||||
android:src="@mipmap/module_authorize_loading"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAuthorizeLoading"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_44"
|
||||
android:text="@string/module_authorize_agreement_loading"
|
||||
android:textColor="@color/module_authorize_loading_text"
|
||||
android:textSize="@dimen/dp_31"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ivAuthorizeLoading" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/clLoadingErrorContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/dp_275"
|
||||
android:layout_marginTop="@dimen/dp_125"
|
||||
android:layout_marginRight="@dimen/dp_275"
|
||||
android:layout_marginBottom="@dimen/dp_125"
|
||||
android:background="@drawable/module_authorize_selector_dark_corner"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnAuthorizeLoadingError"
|
||||
android:layout_width="@dimen/dp_282"
|
||||
android:layout_height="@dimen/dp_90"
|
||||
android:layout_marginTop="@dimen/dp_71"
|
||||
android:background="@drawable/module_authorize_selector_blue_corner"
|
||||
android:gravity="center"
|
||||
android:text="@string/module_authorize_agreement_retry"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/dp_34"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvAuthorizeLoadingError" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivAuthorizeLoadingError"
|
||||
android:layout_width="@dimen/dp_94"
|
||||
android:layout_height="@dimen/dp_94"
|
||||
android:layout_marginTop="@dimen/dp_254"
|
||||
android:src="@mipmap/module_authorize_loading_error"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAuthorizeLoadingError"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:text="@string/module_authorize_agreement_error"
|
||||
android:textColor="@color/module_authorize_text"
|
||||
android:textSize="@dimen/dp_32"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ivAuthorizeLoadingError" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/clAuthorizeContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/dp_275"
|
||||
android:layout_marginTop="@dimen/dp_125"
|
||||
android:layout_marginRight="@dimen/dp_275"
|
||||
android:layout_marginBottom="@dimen/dp_125"
|
||||
android:background="@drawable/module_authorize_selector_dark_corner"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnAuthorizeAgree"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="@dimen/dp_156"
|
||||
android:background="@drawable/module_authorize_selector_blue_left_corner"
|
||||
android:gravity="center"
|
||||
android:text="@string/module_authorize_agreement_agree"
|
||||
android:textColor="@color/module_authorize_affirm_text"
|
||||
android:textSize="@dimen/dp_55"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_weight="1"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@+id/btnAuthorizeDisAgree" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnAuthorizeDisAgree"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="@dimen/dp_156"
|
||||
android:background="@drawable/module_authorize_selector_dark_right_corner"
|
||||
android:gravity="center"
|
||||
android:text="@string/module_authorize_agreement_disagree"
|
||||
android:textColor="@color/module_authorize_text"
|
||||
android:textSize="@dimen/dp_55"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_weight="1"
|
||||
app:layout_constraintLeft_toRightOf="@+id/btnAuthorizeAgree"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="0px"
|
||||
android:layout_height="0px"
|
||||
android:scrollbarSize="@dimen/dp_207"
|
||||
android:scrollbarThumbVertical="@drawable/module_authorize_scrollbar"
|
||||
android:scrollbarTrackHorizontal="@drawable/module_authorize_scrollbar"
|
||||
app:layout_constraintBottom_toTopOf="@+id/btnAuthorizeDisAgree"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/clAuthorizeTitle">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="@dimen/dp_38"
|
||||
android:layout_marginLeft="@dimen/dp_55"
|
||||
android:layout_marginRight="@dimen/dp_55"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAuthorizeContent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:lineSpacingExtra="@dimen/dp_15"
|
||||
android:textColor="@color/module_authorize_text"
|
||||
android:textSize="@dimen/dp_44" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAuthorizeButtonContent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:textColor="@color/module_authorize_text"
|
||||
android:textSize="@dimen/dp_44" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAuthorizeLastContent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="@dimen/dp_15"
|
||||
android:textColor="@color/module_authorize_text"
|
||||
android:textSize="@dimen/dp_44" />
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/clAuthorizeTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_130"
|
||||
android:background="@drawable/module_authorize_shape_top_corner"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_32"
|
||||
android:layout_height="@dimen/dp_32"
|
||||
android:layout_marginLeft="@dimen/dp_438"
|
||||
android:layout_marginTop="@dimen/dp_49"
|
||||
android:src="@mipmap/module_authorize_title_left_symbol"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_32"
|
||||
android:layout_height="@dimen/dp_32"
|
||||
android:layout_marginTop="@dimen/dp_49"
|
||||
android:layout_marginRight="@dimen/dp_438"
|
||||
android:src="@mipmap/module_authorize_title_right_symbol"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAuthorizeTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_34"
|
||||
android:textColor="@color/module_authorize_text"
|
||||
android:textSize="@dimen/dp_44"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 9.9 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 623 B |
|
Before Width: | Height: | Size: 627 B |
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="module_authorize_loading_text">#99FFFFFF</color>
|
||||
<color name="module_authorize_text">#FFFFFF</color>
|
||||
<color name="module_authorize_affirm_text">#FFFFFF</color>
|
||||
<color name="module_authorize_color">#99000000</color>
|
||||
</resources>
|
||||
@@ -1,10 +0,0 @@
|
||||
<resources>
|
||||
<string name="app_name">mogo-module-authorize</string>
|
||||
<string name="module_authorize_agreement_agree">同意</string>
|
||||
<string name="module_authorize_agreement_disagree">不同意</string>
|
||||
<string name="module_authorize_agreement_loading">正在加载,请稍等...</string>
|
||||
<string name="module_authorize_agreement_error">加载失败</string>
|
||||
<string name="module_authorize_agreement_retry">点击重试</string>
|
||||
<string name="module_authorize_agreement_tip">请阅读用户协议并做出选择。未授权部分功能的使用会受到限制。您可以说“同意”进行授权。</string>
|
||||
<string name="module_authorize_failed">授权失败</string>
|
||||
</resources>
|
||||
@@ -1 +0,0 @@
|
||||
/build
|
||||
@@ -1,60 +0,0 @@
|
||||
plugins {
|
||||
id 'com.android.library'
|
||||
id 'kotlin-android'
|
||||
id 'kotlin-android-extensions'
|
||||
id 'kotlin-kapt'
|
||||
id 'com.alibaba.arouter'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode Integer.valueOf(VERSION_CODE)
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
//ARouter apt 参数
|
||||
kapt {
|
||||
useBuildCache = false
|
||||
arguments {
|
||||
arg("AROUTER_MODULE_NAME", project.getName())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation rootProject.ext.dependencies.androidxccorektx
|
||||
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
implementation rootProject.ext.dependencies.modulecommon
|
||||
} else {
|
||||
implementation project(':modules:mogo-module-common')
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
@@ -1,2 +0,0 @@
|
||||
#-----ModuleLeftPanel-----
|
||||
-keep class com.zhidao.mogo.module.left.panel.LeftPanelConst
|
||||
@@ -1,3 +0,0 @@
|
||||
GROUP=com.mogo.module
|
||||
POM_ARTIFACT_ID=module-left-panel-noop
|
||||
VERSION_CODE=1
|
||||
@@ -1,24 +0,0 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
|
||||
#-----ModuleLeftPanel-----
|
||||
-keep class com.zhidao.mogo.module.left.panel.LeftPanelConst
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.zhidao.mogo.module.left.panel
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class ExampleInstrumentedTest {
|
||||
@Test
|
||||
fun useAppContext() {
|
||||
// Context of the app under test.
|
||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
assertEquals("com.zhidao.mogo.module.left.panel.test", appContext.packageName)
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.zhidao.mogo.module.left.panel">
|
||||
|
||||
/
|
||||
</manifest>
|
||||
@@ -1,6 +0,0 @@
|
||||
package com.zhidao.mogo.module.left.panel
|
||||
|
||||
object LeftPanelConst {
|
||||
const val MODULE_NAME = "MODULE_LEFT_PANEL"
|
||||
const val PATH_NAME = "/left/panel"
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package com.zhidao.mogo.module.left.panel
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.map.listener.IMogoMapListener
|
||||
import com.mogo.map.location.IMogoLocationListener
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener
|
||||
import com.mogo.map.navi.IMogoNaviListener
|
||||
import com.mogo.service.module.IMogoModuleLifecycle
|
||||
import com.mogo.service.module.IMogoModuleProvider
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.zhidao.mogo.module.left.panel.LeftPanelConst.MODULE_NAME
|
||||
import com.zhidao.mogo.module.left.panel.LeftPanelConst.PATH_NAME
|
||||
|
||||
|
||||
/**
|
||||
* 适配1+16增加的位于左侧的面板页provider的空实现
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
@Route(path = PATH_NAME)
|
||||
class LeftPanelProvider:IMogoModuleProvider {
|
||||
override fun getNaviListener(): IMogoNaviListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getLocationListener(): IMogoLocationListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getType(): Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
override fun getMarkerClickListener(): IMogoMarkerClickListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
Logger.d(MODULE_NAME, "左侧面板noop模块初始化===")
|
||||
}
|
||||
|
||||
override fun getMapListener(): IMogoMapListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getAppPackage(): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
override fun createView(context: Context?): View? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun createFragment(context: Context?, data: Bundle?): Fragment? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getModuleName(): String {
|
||||
return MODULE_NAME
|
||||
}
|
||||
|
||||
override fun getAppName(): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
override fun getCardLifecycle(): IMogoModuleLifecycle? {
|
||||
return null
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.zhidao.mogo.module.left.panel
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
class ExampleUnitTest {
|
||||
@Test
|
||||
fun addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2)
|
||||
}
|
||||
}
|
||||
1
modules/mogo-module-left-panel/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
/build
|
||||
@@ -1,66 +0,0 @@
|
||||
plugins {
|
||||
id 'com.android.library'
|
||||
id 'kotlin-android'
|
||||
id 'kotlin-android-extensions'
|
||||
id 'kotlin-kapt'
|
||||
id 'com.alibaba.arouter'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode Integer.valueOf(VERSION_CODE)
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
//ARouter apt 参数
|
||||
kapt {
|
||||
useBuildCache = false
|
||||
arguments {
|
||||
arg("AROUTER_MODULE_NAME", project.getName())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation rootProject.ext.dependencies.androidxccorektx
|
||||
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
|
||||
implementation rootProject.ext.dependencies.rxjava
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
implementation rootProject.ext.dependencies.modulecommon
|
||||
} else {
|
||||
implementation project(':modules:mogo-module-common')
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
@@ -1,2 +0,0 @@
|
||||
#-----ModuleLeftPanel-----
|
||||
-keep class com.zhidao.mogo.module.left.panel.LeftPanelConst{*;}
|
||||
@@ -1,3 +0,0 @@
|
||||
GROUP=com.mogo.module
|
||||
POM_ARTIFACT_ID=module-left-panel
|
||||
VERSION_CODE=1
|
||||
@@ -1,24 +0,0 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
|
||||
#-----ModuleLeftPanel-----
|
||||
-keep class com.zhidao.mogo.module.left.panel.LeftPanelConst
|
||||
@@ -1,5 +0,0 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.zhidao.mogo.module.left.panel">
|
||||
|
||||
/
|
||||
</manifest>
|
||||