Merge remote-tracking branch 'origin/feature/v1.0.3' into feature/v1.0.3
This commit is contained in:
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -1,11 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.mogo.launcher">
|
||||
<!-- android:sharedUserId="android.uid.system">-->
|
||||
|
||||
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
package="com.mogo.launcher"
|
||||
android:sharedUserId="android.uid.system">
|
||||
|
||||
<application
|
||||
android:name=".MogoApplication"
|
||||
@@ -22,4 +19,6 @@
|
||||
android:value="a36b9f7b086fa3951bb35338a5a06dd3" />
|
||||
</application>
|
||||
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
|
||||
</manifest>
|
||||
@@ -1,6 +1,7 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
apply from: "config.gradle"
|
||||
apply from: "javadoc.gradle"
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.3.41'
|
||||
|
||||
@@ -23,6 +24,7 @@ buildscript {
|
||||
classpath 'com.android.tools.build:gradle:3.5.2'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath "com.alibaba:arouter-register:1.0.2"
|
||||
classpath 'com.hujiang.aspectjx:gradle-android-plugin-aspectjx:2.0.4'
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
|
||||
@@ -133,5 +133,6 @@ ext {
|
||||
coroutinescore : "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.1.1",
|
||||
coroutinesandroid : "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.1",
|
||||
|
||||
aspectj : "org.aspectj:aspectjrt:1.8.9",
|
||||
]
|
||||
}
|
||||
@@ -85,6 +85,8 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
private LocationSource.OnLocationChangedListener mOnLocationChangedListener;
|
||||
private boolean mIsCarLockced = false;
|
||||
|
||||
private float mDefaultZoomLevel = 16.0f;
|
||||
|
||||
public AMapNaviViewWrapper( AMapNaviView mapView ) {
|
||||
this.mMapView = mapView;
|
||||
this.mIMap = new AMapWrapper( mMapView.getMap(), mMapView, this );
|
||||
@@ -382,12 +384,20 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
@Override
|
||||
public void changeZoom( boolean zoom ) {
|
||||
if ( checkAMapView() ) {
|
||||
mDefaultZoomLevel = getMap().getZoomLevel();
|
||||
if ( zoom ) {
|
||||
mMapView.zoomIn();
|
||||
mDefaultZoomLevel += 1.5f;
|
||||
if ( mDefaultZoomLevel > 20 ) {
|
||||
mDefaultZoomLevel = 20;
|
||||
}
|
||||
} else {
|
||||
mMapView.zoomOut();
|
||||
mDefaultZoomLevel -= 1.5f;
|
||||
if ( mDefaultZoomLevel < 1 ) {
|
||||
mDefaultZoomLevel = 1;
|
||||
}
|
||||
}
|
||||
Logger.i( TAG, "mapview zoom = " + mMapView.getMap().getCameraPosition().zoom );
|
||||
changeZoom( mDefaultZoomLevel );
|
||||
Logger.i( TAG, "mapview zoom = " + mDefaultZoomLevel );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.mogo.module.authorize.aspectj
|
||||
|
||||
class VoiceForbiddenTrackPoint {
|
||||
}
|
||||
@@ -3,14 +3,14 @@ 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.UserAgreement
|
||||
import com.mogo.module.authorize.model.bean.AgreementData
|
||||
import com.mogo.module.authorize.net.request
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
open class IMogoAuthorizeController {
|
||||
|
||||
companion object {
|
||||
const val TAG = "IMogoAuthorizeController"
|
||||
const val TAG = "AuthorizeController"
|
||||
}
|
||||
|
||||
private val authorizeModel: IMogoAuthorizeModel by lazy { IMogoAuthorizeModel() }
|
||||
@@ -24,15 +24,14 @@ open class IMogoAuthorizeController {
|
||||
})
|
||||
}
|
||||
try {
|
||||
request<BaseResponse<UserAgreement>> {
|
||||
request<BaseResponse<AgreementData>> {
|
||||
loader {
|
||||
authorizeModel.invokeAuthorizeContent(1)
|
||||
authorizeModel.invokeAuthorizeContent(agreementType)
|
||||
}
|
||||
onSuccess {
|
||||
Logger.d(TAG, "invokeAuthorizeContent onSuccess data: ${it.result}")
|
||||
getAuthorizeContentListener(tag, { listener ->
|
||||
if (it.result != null) {
|
||||
listener.requestContentSuccess(it.result)
|
||||
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}")
|
||||
}
|
||||
@@ -49,7 +48,7 @@ open class IMogoAuthorizeController {
|
||||
})
|
||||
}
|
||||
}
|
||||
}catch (e:Exception){
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ open abstract class MogoAuthorizeManagerImpl : IMogoAuthorizeInvoke {
|
||||
private val baseController: IMogoAuthorizeController by lazy { IMogoAuthorizeController() }
|
||||
|
||||
override fun needAuthorize(): Boolean {
|
||||
|
||||
return needAuthorization()
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ class AuthorizeInvokerConstant {
|
||||
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" //新鲜事
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package com.mogo.module.authorize.authprovider.invoke
|
||||
|
||||
import com.mogo.module.authorize.model.bean.UserAgreement
|
||||
import com.mogo.module.authorize.model.bean.Agreement
|
||||
|
||||
/**
|
||||
* 获取授权信息回调
|
||||
*/
|
||||
interface IMogoAuthorizeContentListener {
|
||||
|
||||
fun requestContentSuccess(userAgreement: UserAgreement)
|
||||
fun requestContentSuccess(userAgreement: Agreement)
|
||||
|
||||
fun requestContentFailed(errorMsg: String)
|
||||
}
|
||||
@@ -9,11 +9,16 @@ interface IAuthorizeMainInvoke : IMogoAuthorizeInvoke {
|
||||
* 同意授权
|
||||
* tag:透传模块ID
|
||||
*/
|
||||
fun agreeAuthorize(tag: String, agrId: Long)
|
||||
fun agreeAuthorize(tag: String, agrId: Long, onSuccess: (() -> Unit), onError: ((String) -> Unit))
|
||||
|
||||
/**
|
||||
* 不同意授权
|
||||
* tag:透传模块ID
|
||||
*/
|
||||
fun disAgreeAuthorize(tag: String, agrId: Long)
|
||||
fun disAgreeAuthorize(tag: String, agrId: Long, onSuccess: (() -> Unit), onError: ((String) -> Unit))
|
||||
|
||||
/**
|
||||
* 是否已经注册回调
|
||||
*/
|
||||
fun hasRegister(tag: String): Boolean
|
||||
}
|
||||
@@ -9,6 +9,10 @@ import com.mogo.module.authorize.authprovider.module.IMogoAcquireAuthorizeListen
|
||||
@Route(path = AuthorizeConstant.PROVIDER_LAUNCHER)
|
||||
class IMogoAuthorizeMainManager : IMogoAuthorizeMainProvider {
|
||||
|
||||
override fun hasRegister(tag: String): Boolean {
|
||||
return mogoAuthShow.hasRegister(tag)
|
||||
}
|
||||
|
||||
override fun needAuthorize(): Boolean {
|
||||
return mogoAuthShow.needAuthorize()
|
||||
}
|
||||
@@ -17,12 +21,12 @@ class IMogoAuthorizeMainManager : IMogoAuthorizeMainProvider {
|
||||
mogoAuthShow.invokeAuthorizeContent(tag)
|
||||
}
|
||||
|
||||
override fun agreeAuthorize(tag: String, agrId: Long) {
|
||||
mogoAuthShow.agreeAuthorize(tag, agrId)
|
||||
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) {
|
||||
mogoAuthShow.disAgreeAuthorize(tag, agrId)
|
||||
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) {
|
||||
|
||||
@@ -13,25 +13,31 @@ object MogoAuthorizeMainController : IMogoAuthorizeController() {
|
||||
private val authorizeShowModel: MogoAuthorizeMainModel by lazy { MogoAuthorizeMainModel() }
|
||||
|
||||
@Synchronized
|
||||
fun agreeAuthorize(tag: String, agrId: Long) {
|
||||
fun agreeAuthorize(tag: String, agrId: Long, onSuccess: (() -> Unit), onError: ((String) -> Unit)) {
|
||||
val acquireAuthListener = MogoAuthorizeRegisterHandler.getAuthorizeListener(tag)
|
||||
updateAuthorize(agrId, AGREEMENT_EFFECT, {
|
||||
if (acquireAuthListener != null) {
|
||||
onSuccess.invoke()
|
||||
acquireAuthListener.authorizeSuccess()
|
||||
} else {
|
||||
Logger.d(TAG, "agreeAuthorize --- can not find listener by this tag :$tag ")
|
||||
}
|
||||
}, {
|
||||
authorizeFailed(tag, it ?: "agreeAuthorize failed,please check network")
|
||||
val errorMsg = it ?: "agreeAuthorize failed,please check network"
|
||||
onError.invoke(errorMsg)
|
||||
authorizeFailed(tag, errorMsg)
|
||||
})
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun disAgreeAuthorize(tag: String, agrId: Long) {
|
||||
fun disAgreeAuthorize(tag: String, agrId: Long, onSuccess: (() -> Unit), onError: ((String) -> Unit)) {
|
||||
updateAuthorize(agrId, AGREEMENT_NOT_EFFECT, {
|
||||
onSuccess.invoke()
|
||||
authorizeFailed(tag, "UserDisAgree authorize")
|
||||
}, {
|
||||
authorizeFailed(tag, it ?: "disAgreeAuthorize failed,please check network")
|
||||
val errorMsg = it ?: "disAgreeAuthorize failed,please check network"
|
||||
onError.invoke(errorMsg)
|
||||
authorizeFailed(tag, errorMsg)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -26,12 +26,18 @@ class MogoMainAuthorize private constructor() : MogoAuthorizeManagerImpl(), IMog
|
||||
@Volatile
|
||||
private var showAuthorizeView: Boolean = false
|
||||
|
||||
override fun agreeAuthorize(tag: String, agrId: Long) {
|
||||
MogoAuthorizeMainController.agreeAuthorize(tag, agrId)
|
||||
override fun hasRegister(tag: String): Boolean {
|
||||
if (tag.isNullOrBlank()) return false
|
||||
val listener = MogoAuthorizeRegisterHandler.getAuthorizeContentListener(tag)
|
||||
return listener != null
|
||||
}
|
||||
|
||||
override fun disAgreeAuthorize(tag: String, agrId: Long) {
|
||||
MogoAuthorizeMainController.disAgreeAuthorize(tag, agrId)
|
||||
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 invokeAuthorizeForShow() {
|
||||
@@ -94,20 +100,4 @@ class MogoMainAuthorize private constructor() : MogoAuthorizeManagerImpl(), IMog
|
||||
pop.invoke()
|
||||
}
|
||||
|
||||
fun authorizeSuccess(tag: String) {
|
||||
val listener = MogoAuthorizeRegisterHandler.getAuthorizeListener(tag)
|
||||
if (listener == null) {
|
||||
Logger.d(TAG, "authorizeSuccess,but listener is null ")
|
||||
}
|
||||
listener!!.authorizeSuccess()
|
||||
}
|
||||
|
||||
fun authorizeFailed(tag: String, errorMsg: String) {
|
||||
val listener = MogoAuthorizeRegisterHandler.getAuthorizeListener(tag)
|
||||
if (listener == null) {
|
||||
Logger.d(TAG, "authorizeFailed,but listener is null ")
|
||||
}
|
||||
listener!!.authorizeFailed(errorMsg)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,6 +19,7 @@ class MogoModuleAuthorize private constructor() : MogoAuthorizeManagerImpl(), IM
|
||||
override fun invokeAuthorization(tag: String) {
|
||||
mogoAuthShow.showAuthorizeView(tag, {
|
||||
//todo SP存储状态
|
||||
|
||||
}, { errorMsg ->
|
||||
val listener = MogoAuthorizeRegisterHandler.getAuthorizeListener(tag)
|
||||
listener?.authorizeFailed(errorMsg)
|
||||
|
||||
@@ -13,10 +13,11 @@ class AuthorizeContract {
|
||||
}
|
||||
|
||||
interface Biz {
|
||||
fun invokeAuthorize(invokeTag: String)
|
||||
fun invokeAuthorizationContent(invokeTag: String)
|
||||
|
||||
fun agreeAuthorize(tag: String, agreementId: Long)
|
||||
|
||||
fun disAgreeAuthorize(tag: String, agreementId: Long)
|
||||
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,16 @@ import android.text.Html
|
||||
import android.view.View
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.module.authorize.R
|
||||
import com.mogo.module.authorize.util.AnalyticsUtil
|
||||
import com.mogo.module.authorize.util.AnalyticsUtil.INVOKE_TRACK_AUTHORIZE_CLICK
|
||||
import com.mogo.module.authorize.util.AnalyticsUtil.INVOKE_TRACK_AUTHORIZE_SHOW
|
||||
import com.mogo.module.authorize.voice.IVoiceCommandListener
|
||||
import com.mogo.module.authorize.voice.IVoiceIntentListener
|
||||
import com.mogo.module.authorize.voice.VoiceUtil
|
||||
import com.mogo.utils.logger.Logger
|
||||
import kotlinx.android.synthetic.main.module_authorize_fragment.*
|
||||
|
||||
class AuthorizeFragment(private val invokeTag: String) : MvpFragment<AuthorizeContract.View, AuthorizePresenter>(), AuthorizeContract.View, View.OnClickListener {
|
||||
class AuthorizeFragment(private val invokeTag: String) : MvpFragment<AuthorizeContract.View, AuthorizePresenter>(), AuthorizeContract.View, View.OnClickListener, IVoiceCommandListener, IVoiceIntentListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "AuthorizeFragment"
|
||||
@@ -20,11 +26,13 @@ class AuthorizeFragment(private val invokeTag: String) : MvpFragment<AuthorizeCo
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
AnalyticsUtil.track(INVOKE_TRACK_AUTHORIZE_SHOW)
|
||||
btnAuthorizeAgree.setOnClickListener(this)
|
||||
btnAuthorizeDisAgree.setOnClickListener(this)
|
||||
btnAuthorizeLoadingError.setOnClickListener(this)
|
||||
clLoadingErrorContainer.setOnClickListener(this)
|
||||
Logger.d(TAG, "invokeTag :$invokeTag")
|
||||
VoiceUtil.registerAll(context!!, this, this)
|
||||
}
|
||||
|
||||
override fun createPresenter(): AuthorizePresenter {
|
||||
@@ -42,6 +50,7 @@ class AuthorizeFragment(private val invokeTag: String) : MvpFragment<AuthorizeCo
|
||||
agreementTitle: String,
|
||||
agreementBottom: String,
|
||||
agreementLast: String) {
|
||||
VoiceUtil.speak(context!!.resources.getString(R.string.module_authorize_agreement_tip), context!!, this)
|
||||
clLoadingContainer.visibility = View.GONE
|
||||
clAuthorizeContainer.visibility = View.VISIBLE
|
||||
this.agreementId = agreementId
|
||||
@@ -59,16 +68,32 @@ class AuthorizeFragment(private val invokeTag: String) : MvpFragment<AuthorizeCo
|
||||
override fun onClick(v: View) {
|
||||
when (v.id) {
|
||||
R.id.btnAuthorizeAgree -> {
|
||||
AnalyticsUtil.track(INVOKE_TRACK_AUTHORIZE_CLICK, hashMapOf("operation_type" to 1, "operation_result" to 1))
|
||||
mPresenter.agreeAuthorize(invokeTag, agreementId)
|
||||
}
|
||||
R.id.btnAuthorizeDisAgree -> {
|
||||
AnalyticsUtil.track(INVOKE_TRACK_AUTHORIZE_CLICK, hashMapOf("operation_type" to 1, "operation_result" to 2))
|
||||
mPresenter.disAgreeAuthorize(invokeTag, agreementId)
|
||||
}
|
||||
R.id.clLoadingErrorContainer, R.id.btnAuthorizeLoadingError -> {
|
||||
mPresenter.invokeAuthorize(invokeTag)
|
||||
mPresenter.invokeAuthorizationContent(invokeTag)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onVoiceCmdAgree() {
|
||||
AnalyticsUtil.track(INVOKE_TRACK_AUTHORIZE_CLICK, hashMapOf("operation_type" to 2, "operation_result" to 1))
|
||||
mPresenter.agreeAuthorize(invokeTag, agreementId)
|
||||
}
|
||||
|
||||
override fun onVoiceCmdDisAgree() {
|
||||
AnalyticsUtil.track(INVOKE_TRACK_AUTHORIZE_CLICK, hashMapOf("operation_type" to 2, "operation_result" to 2))
|
||||
mPresenter.disAgreeAuthorize(invokeTag, agreementId)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
VoiceUtil.unregisterAll(context!!, this)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,12 +4,10 @@ import androidx.lifecycle.LifecycleOwner
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
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
|
||||
import com.mogo.module.authorize.model.bean.UserAgreement
|
||||
import com.mogo.module.authorize.model.proxy.AuthorizeProxy
|
||||
import com.mogo.module.authorize.model.bean.Agreement
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
class AuthorizePresenter : Presenter<AuthorizeContract.View>, AuthorizeContract.Biz, IMogoAuthorizeContentListener, IMogoAcquireAuthorizeListener {
|
||||
class AuthorizePresenter : Presenter<AuthorizeContract.View>, AuthorizeContract.Biz, IMogoAuthorizeContentListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "AuthorizePresenter"
|
||||
@@ -24,51 +22,54 @@ class AuthorizePresenter : Presenter<AuthorizeContract.View>, AuthorizeContract.
|
||||
override fun onCreate(owner: LifecycleOwner) {
|
||||
super.onCreate(owner)
|
||||
Logger.d(TAG, "onCreate invokeTag:$invokeTag")
|
||||
invokeAuthorize(invokeTag!!)
|
||||
invokeAuthorizationContent(invokeTag!!)
|
||||
}
|
||||
|
||||
override fun invokeAuthorize(invokeTag: String) {
|
||||
override fun invokeAuthorizationContent(invokeTag: String) {
|
||||
mView.readyToAuthorize()
|
||||
this.invokeTag = invokeTag
|
||||
mogoAuthShow.registerInvokeAuthorizeContentListener(invokeTag, this)
|
||||
mogoAuthShow.registerAuthorizeListener(invokeTag, this)
|
||||
if (!mogoAuthShow.hasRegister(invokeTag)) {
|
||||
mogoAuthShow.registerInvokeAuthorizeContentListener(invokeTag, this)
|
||||
}
|
||||
mogoAuthShow.invokeAuthorizeContent(invokeTag)
|
||||
}
|
||||
|
||||
override fun requestContentSuccess(userAgreement: UserAgreement) {
|
||||
val id = userAgreement.agreementEntity.id
|
||||
val content = userAgreement.agreementContent[0]
|
||||
val title = userAgreement.agreementEntity.title
|
||||
val bottomContent = userAgreement.agreementEntity.agreementButtonFirst
|
||||
val lastContent = userAgreement.agreementEntity.agreementButtonSecond
|
||||
mView.showAuthorizationAgreementContent(id, content, title, bottomContent, lastContent)
|
||||
override fun requestContentSuccess(userAgreement: Agreement) {
|
||||
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
|
||||
mView.showAuthorizationAgreementContent(id, content, title, bottomContent, lastContent)
|
||||
} else {
|
||||
mView.showAuthorizationError()
|
||||
}
|
||||
}
|
||||
|
||||
override fun requestContentFailed(errorMsg: String) {
|
||||
Logger.d(TAG, "requestContentFailed errorMsg:$errorMsg")
|
||||
// mView.showAuthorizationAgreementContent(0, "123", "123456", "34234", "3543535")
|
||||
mView.showAuthorizationError()
|
||||
}
|
||||
|
||||
override fun agreeAuthorize(tag: String, agreementId: Long) {
|
||||
mogoAuthShow.agreeAuthorize(tag, agreementId)
|
||||
mogoAuthShow.agreeAuthorize(tag, agreementId, {
|
||||
Logger.d(TAG, "agreeAuthorize success")
|
||||
closeAuthorizeView()
|
||||
}, { s: String ->
|
||||
Logger.d(TAG, "agreeAuthorize failed")
|
||||
closeAuthorizeView()
|
||||
})
|
||||
}
|
||||
|
||||
override fun disAgreeAuthorize(tag: String, agreementId: Long) {
|
||||
mogoAuthShow.disAgreeAuthorize(tag, agreementId)
|
||||
}
|
||||
|
||||
override fun authorizeSuccess() {
|
||||
mogoAuthShow.authorizeSuccess(invokeTag!!)
|
||||
closeAuthorizeView()
|
||||
}
|
||||
|
||||
override fun authorizeFailed(errorMsg: String) {
|
||||
mogoAuthShow.authorizeFailed(invokeTag!!, errorMsg)
|
||||
closeAuthorizeView()
|
||||
}
|
||||
|
||||
override fun forbiddenVoiceWhenAuthorize(cmd: String) {
|
||||
//do nothing
|
||||
mogoAuthShow.disAgreeAuthorize(tag, agreementId, {
|
||||
closeAuthorizeView()
|
||||
}, { s: String ->
|
||||
closeAuthorizeView()
|
||||
})
|
||||
}
|
||||
|
||||
private fun closeAuthorizeView() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mogo.module.authorize.model
|
||||
|
||||
|
||||
class BaseResponse<out T>(val code: Int, val msg: String, val result: T) {
|
||||
class BaseResponse<out T>(val code: Int, val msg: String, val detailMsg: String, val result: T) {
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,8 @@ package com.mogo.module.authorize.model
|
||||
import com.google.gson.Gson
|
||||
import com.mogo.commons.network.Utils.getSn
|
||||
import com.mogo.module.authorize.model.bean.RequestUserAgreement
|
||||
import com.mogo.module.authorize.model.bean.UserAgreement
|
||||
import com.mogo.module.authorize.model.bean.Agreement
|
||||
import com.mogo.module.authorize.model.bean.AgreementData
|
||||
|
||||
open class IMogoAuthorizeModel : BaseRepository() {
|
||||
|
||||
@@ -11,7 +12,7 @@ open class IMogoAuthorizeModel : BaseRepository() {
|
||||
const val TAG = "IMogoAuthorizeModel"
|
||||
}
|
||||
|
||||
suspend fun invokeAuthorizeContent(agreementType: Int): BaseResponse<UserAgreement> {
|
||||
suspend fun invokeAuthorizeContent(agreementType: Int): BaseResponse<AgreementData> {
|
||||
val requestUserAgreement = Gson().toJson(RequestUserAgreement(agreementType))
|
||||
val map = mapOf("sn" to getSn(), "data" to requestUserAgreement)
|
||||
return apiCall { getNetWorkApi().getAuthorizeContent(map) }
|
||||
|
||||
@@ -3,9 +3,11 @@ package com.mogo.module.authorize.model.bean
|
||||
const val AGREEMENT_EFFECT = 1 //用户协议生效
|
||||
const val AGREEMENT_NOT_EFFECT = 2 //用户协议不生效
|
||||
|
||||
class RequestUserAgreement(val agreementType:Int)
|
||||
class RequestUserAgreement(val agreementType: Int)
|
||||
|
||||
data class UserAgreement(var agreementEntity: TUserAgreementEntity, var agreementContent: List<String>)
|
||||
data class AgreementData(val agreement: Agreement)
|
||||
|
||||
data class Agreement(var tUserAgreementEntity: TUserAgreementEntity, var agreementContent: List<String>)
|
||||
|
||||
data class TUserAgreementEntity(
|
||||
val id: Long, //协议ID
|
||||
@@ -18,4 +20,4 @@ data class TUserAgreementEntity(
|
||||
val agreementUserType: String, //协议适用用户
|
||||
val agreementStatus: Int, //协议状态 1:生效 2:未生效
|
||||
val createTime: String, //协议创建时间
|
||||
val updateTime: String) //协议更新时间
|
||||
val updateTime: String) //协议更新时间
|
||||
@@ -3,6 +3,7 @@ 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
|
||||
@@ -21,7 +22,8 @@ class AuthorizeProxy {
|
||||
return when (authorizeName) {
|
||||
AUTHORIZE_TYPE_LAUNCHER_MAIN,
|
||||
AUTHORIZE_TYPE_LAUNCHER_SHARE_NOVELTY,
|
||||
AUTHORIZE_TYPE_LAUNCHER_SHARE_MUSIC -> 0
|
||||
AUTHORIZE_TYPE_LAUNCHER_SHARE_MUSIC,
|
||||
AUTHORIZE_TYPE_LAUNCHER_SHARE -> 0
|
||||
AUTHORIZE_TYPE_TAN_LU -> 1
|
||||
AUTHORIZE_TYPE_CALL_CHAT -> 2
|
||||
AUTHORIZE_TYPE_NOVELTY -> 3
|
||||
@@ -35,6 +37,7 @@ class AuthorizeProxy {
|
||||
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),
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
package com.mogo.module.authorize.net
|
||||
|
||||
import com.mogo.module.authorize.model.BaseResponse
|
||||
import com.mogo.module.authorize.model.bean.UserAgreement
|
||||
import com.mogo.module.authorize.model.bean.Agreement
|
||||
import com.mogo.module.authorize.model.bean.AgreementData
|
||||
import retrofit2.http.FieldMap
|
||||
import retrofit2.http.FormUrlEncoded
|
||||
import retrofit2.http.POST
|
||||
@@ -10,12 +11,12 @@ interface AuthorizeApi {
|
||||
|
||||
//获取授权内容·
|
||||
@FormUrlEncoded
|
||||
@POST("yycp-channelManager/user/agreement/findUserAgreement")
|
||||
suspend fun getAuthorizeContent(@FieldMap authorizeContent: Map<String, String>): BaseResponse<UserAgreement>
|
||||
@POST("yycp-channelManager/agreement/findUserAgreement")
|
||||
suspend fun getAuthorizeContent(@FieldMap authorizeContent: Map<String, String>): BaseResponse<AgreementData>
|
||||
|
||||
//更新授权状态
|
||||
@FormUrlEncoded
|
||||
@POST("yycp-channelManager/user/agreement/updateStatus")
|
||||
@POST("yycp-channelManager/agreement/updateStatus")
|
||||
suspend fun updateAuthorize(@FieldMap updateStatus: Map<String, String>): BaseResponse<Any>
|
||||
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import com.mogo.module.authorize.exception.ApiException.Companion.NULL_REQUEST_D
|
||||
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 com.mogo.utils.logger.Logger
|
||||
import kotlinx.coroutines.*
|
||||
import java.net.SocketTimeoutException
|
||||
import java.net.UnknownHostException
|
||||
@@ -63,7 +62,7 @@ class Request<T> {
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
if(e == null){
|
||||
if (e == null) {
|
||||
onError?.invoke(NULL_EXCEPTION)
|
||||
return@launch
|
||||
}
|
||||
@@ -71,7 +70,7 @@ class Request<T> {
|
||||
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?:""))
|
||||
else -> onError?.invoke(java.lang.Exception(e.message ?: ""))
|
||||
}
|
||||
} finally {
|
||||
onComplete?.invoke()
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.mogo.module.authorize.util
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
import com.mogo.service.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(MogoServicePaths.PATH_SERVICE_APIS).navigation()
|
||||
if (arouter is IMogoServiceApis) {
|
||||
trackRouter = arouter.analyticsApi
|
||||
}
|
||||
}
|
||||
trackRouter!!.track(eventType, data)
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ object SharedPreferenceUtil {
|
||||
|
||||
private const val HAS_AUTH = "HAS_AUTH"
|
||||
|
||||
fun needAuthorization():Boolean{
|
||||
fun needAuthorization(): Boolean {
|
||||
return !hasAuth()
|
||||
}
|
||||
|
||||
@@ -15,4 +15,7 @@ object SharedPreferenceUtil {
|
||||
return SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).getBoolean(HAS_AUTH, false)
|
||||
}
|
||||
|
||||
fun setAuthorizeStatus() {
|
||||
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).putBoolean(HAS_AUTH, true)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.mogo.module.authorize.voice
|
||||
|
||||
interface IVoiceBusinessListener {
|
||||
|
||||
fun onVoiceCmdAgree()
|
||||
|
||||
fun onVoiceCmdDisAgree()
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
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")
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
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 = "IVoiceIntentListener"
|
||||
|
||||
interface IVoiceIntentListener : IMogoIntentListener, IVoiceBusinessListener {
|
||||
|
||||
override fun onIntentReceived(cmd: String?, intent: Intent?) {
|
||||
Logger.i(IVoiceIntentTAG, "cmd -> $cmd")
|
||||
if (intent != null && cmd != null) {
|
||||
VoiceManager.handleOnIntentCmd(cmd, intent, this)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.mogo.module.authorize.voice
|
||||
|
||||
import android.content.Intent
|
||||
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, intent: Intent, listener: IVoiceIntentListener) {
|
||||
Logger.i(TAG, "handleOnIntentCmd: cmd -> $cmd")
|
||||
when (cmd) {
|
||||
VOICE_REGISTER_AUTHORIZE_AGREE -> {
|
||||
Logger.i(TAG, "语音唤醒 同意")
|
||||
listener.onVoiceCmdAgree()
|
||||
}
|
||||
VOICE_REGISTER_AUTHORIZE_DISAGREE -> {
|
||||
Logger.i(TAG, "语音免唤醒 不同意")
|
||||
listener.onVoiceCmdDisAgree()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.mogo.module.authorize.voice
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
import com.mogo.service.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(MogoServicePaths.PATH_SERVICE_APIS).navigation()
|
||||
if (register is IMogoServiceApis) {
|
||||
intentRegister = register.intentManagerApi
|
||||
}
|
||||
}
|
||||
|
||||
//WakeUp Command (Intent)
|
||||
const val VOICE_INTENT_AGREE = "system.application.operation" //同意
|
||||
const val VOICE_INTENT_DISAGREE = "system.application.operation" //不同意
|
||||
|
||||
//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(
|
||||
context: Context,
|
||||
voiceCommand: IVoiceCommandListener,
|
||||
intentCommand: IVoiceIntentListener
|
||||
) {
|
||||
if (!hasRegister) {
|
||||
hasRegister = true
|
||||
registerAgree(context, voiceCommand, intentCommand)
|
||||
registerDisAgree(context, voiceCommand, intentCommand)
|
||||
}
|
||||
}
|
||||
|
||||
private fun registerAgree(
|
||||
context: Context,
|
||||
voiceCommand: IVoiceCommandListener,
|
||||
intentCommand: IVoiceIntentListener
|
||||
) {
|
||||
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: IVoiceIntentListener
|
||||
) {
|
||||
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: IVoiceIntentListener) {
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,11 +50,25 @@
|
||||
android:layout_marginRight="@dimen/dp_330"
|
||||
android:layout_marginBottom="@dimen/dp_90"
|
||||
android:background="@drawable/module_authorize_selector_dark_corner"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnAuthorizeLoadingError"
|
||||
android:layout_width="@dimen/dp_461"
|
||||
android:layout_height="@dimen/dp_97"
|
||||
android:layout_marginTop="@dimen/dp_33"
|
||||
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_44"
|
||||
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_147"
|
||||
@@ -76,20 +90,6 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ivAuthorizeLoadingError" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnAuthorizeLoadingError"
|
||||
android:layout_width="@dimen/dp_461"
|
||||
android:layout_height="@dimen/dp_97"
|
||||
android:layout_marginTop="@dimen/dp_33"
|
||||
android:text="@string/module_authorize_agreement_retry"
|
||||
android:textColor="@android:color/white"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/module_authorize_selector_blue_corner"
|
||||
android:textSize="@dimen/dp_44"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvAuthorizeLoadingError" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
@@ -134,7 +134,7 @@
|
||||
android:layout_width="0px"
|
||||
android:layout_height="0px"
|
||||
android:layout_marginBottom="@dimen/dp_160"
|
||||
android:scrollbarSize="@dimen/dp_11"
|
||||
android:scrollbarSize="@dimen/dp_207"
|
||||
android:scrollbarThumbVertical="@drawable/module_authorize_scrollbar"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
@@ -144,6 +144,8 @@
|
||||
<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
|
||||
|
||||
@@ -5,4 +5,5 @@
|
||||
<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>
|
||||
</resources>
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.module.extensions.entrance;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
@@ -54,6 +55,7 @@ import com.mogo.service.module.IMogoAddressManager;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -61,6 +63,8 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import retrofit2.http.HEAD;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-07
|
||||
@@ -127,9 +131,9 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
protected void initViews() {
|
||||
mApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation( getContext() );
|
||||
mIMogoAuthorizeModuleManager = (IMogoAuthorizeModuleManager) ARouter.getInstance().build(AuthorizeConstant.PROVIDER_MODULE).navigation(getContext());
|
||||
mIMogoAuthorizeModuleManager.registerAuthorizeListener(AuthorizeInvokerConstant.AUTHORIZE_TYPE_LAUNCHER_SHARE_NOVELTY, this);
|
||||
mIMogoAuthorizeModuleManager.registerAuthorizeListener(AuthorizeInvokerConstant.AUTHORIZE_TYPE_LAUNCHER_SHARE, this);
|
||||
|
||||
mEntrancePresenter = new EntrancePresenter(getContext(), this, mIMogoAuthorizeModuleManager);
|
||||
mEntrancePresenter = new EntrancePresenter( getContext(), this, mIMogoAuthorizeModuleManager );
|
||||
mMogoFragmentManager = mApis.getFragmentManagerApi();
|
||||
mMogoAddressManager = mApis.getAddressManagerApi();
|
||||
|
||||
@@ -138,7 +142,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
mSearch = findViewById( R.id.module_entrance_id_search );
|
||||
|
||||
mSearch.setOnClickListener( view -> {
|
||||
setMarkerStatus(true);
|
||||
setMarkerStatus( true );
|
||||
mSearchProvider = ( IMogoModuleProvider ) ARouter.getInstance()
|
||||
.build( MogoModulePaths.PATH_MODULE_SEARCH )
|
||||
.navigation();
|
||||
@@ -153,7 +157,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
|
||||
mHome = findViewById( R.id.module_entrance_id_home );
|
||||
mHome.setOnClickListener( view -> {
|
||||
setMarkerStatus(true);
|
||||
setMarkerStatus( true );
|
||||
mMogoAddressManager.goHome();
|
||||
mApis.getAdasControllerApi().closeADAS();
|
||||
|
||||
@@ -161,7 +165,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
|
||||
mCompany = findViewById( R.id.module_entrance_id_company );
|
||||
mCompany.setOnClickListener( view -> {
|
||||
setMarkerStatus(true);
|
||||
setMarkerStatus( true );
|
||||
mMogoAddressManager.goCompany();
|
||||
mApis.getAdasControllerApi().closeADAS();
|
||||
|
||||
@@ -174,6 +178,26 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
} );
|
||||
mVRMode = findViewById( R.id.module_entrance_id_vr_mode );
|
||||
mVRMode.setOnClickListener( view -> {
|
||||
|
||||
mMogoStatusManager.setUserInteractionStatus( TAG, true, false );
|
||||
Rect mBoundRect = new Rect();
|
||||
final int paddingTop = WindowUtils.dip2px( getContext(), 250 );
|
||||
final int paddingBottom = WindowUtils.dip2px( getContext(), 150 );
|
||||
final int paddingRight = WindowUtils.dip2px( getContext(), 150 );
|
||||
final int paddingLeft = WindowUtils.dip2px( getContext(), 650 );
|
||||
|
||||
mBoundRect.bottom = paddingBottom;
|
||||
mBoundRect.top = paddingTop;
|
||||
mBoundRect.left = paddingLeft;
|
||||
mBoundRect.right = paddingRight;
|
||||
mMApUIController.showBounds( TAG,
|
||||
new MogoLatLng(
|
||||
mService.getSingletonLocationClient( getContext() ).getLastKnowLocation().getLatitude(),
|
||||
mService.getSingletonLocationClient( getContext() ).getLastKnowLocation().getLongitude()
|
||||
),
|
||||
Arrays.asList( new MogoLatLng( 39.9736012000, 116.4220762300 ) ),
|
||||
mBoundRect,
|
||||
false );
|
||||
} );
|
||||
|
||||
mMove2CurrentLocation = findViewById( R.id.module_entrance_id_move2_current_location );
|
||||
@@ -223,36 +247,38 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
mSpeedLimitUnit = findViewById( R.id.module_entrance_id_speed_limit_unit );
|
||||
|
||||
|
||||
mApis.getIntentManagerApi().registerIntentListener(AUTONAVI_STANDARD_BROADCAST_RECV, new IMogoIntentListener() {
|
||||
@Override public void onIntentReceived(String intentStr, Intent intent) {
|
||||
int key_type = intent.getIntExtra("KEY_TYPE", 0);
|
||||
mApis.getIntentManagerApi().registerIntentListener( AUTONAVI_STANDARD_BROADCAST_RECV, new IMogoIntentListener() {
|
||||
@Override
|
||||
public void onIntentReceived( String intentStr, Intent intent ) {
|
||||
int key_type = intent.getIntExtra( "KEY_TYPE", 0 );
|
||||
|
||||
int type = intent.getIntExtra("EXTRA_TYPE", -1);
|
||||
int opera_type = intent.getIntExtra("EXTRA_OPERA", -1);
|
||||
if (key_type == 10027) {
|
||||
if (opera_type == 0) {
|
||||
ivMode.setSelected(false);
|
||||
} else if (opera_type == 1) {
|
||||
ivMode.setSelected(true);
|
||||
int type = intent.getIntExtra( "EXTRA_TYPE", -1 );
|
||||
int opera_type = intent.getIntExtra( "EXTRA_OPERA", -1 );
|
||||
if ( key_type == 10027 ) {
|
||||
if ( opera_type == 0 ) {
|
||||
ivMode.setSelected( false );
|
||||
} else if ( opera_type == 1 ) {
|
||||
ivMode.setSelected( true );
|
||||
}
|
||||
ivMode.setText(
|
||||
getString( ivMode.isSelected() ? R.string.mode_car_up : R.string.mode_north_up ) );
|
||||
getString( ivMode.isSelected() ? R.string.mode_car_up : R.string.mode_north_up ) );
|
||||
}
|
||||
}
|
||||
});
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void setMarkerStatus(boolean show){
|
||||
protected void setMarkerStatus( boolean show ) {
|
||||
mMogoStatusManager.setSearchUIShow(
|
||||
MogoModulePaths.PATH_FRAGMENT_SEARCH_CATEGORY, show
|
||||
MogoModulePaths.PATH_FRAGMENT_SEARCH_CATEGORY, show
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
private static final String AUTONAVI_STANDARD_BROADCAST_RECV =
|
||||
"AUTONAVI_STANDARD_BROADCAST_RECV";
|
||||
"AUTONAVI_STANDARD_BROADCAST_RECV";
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected EntrancePresenter createPresenter() {
|
||||
@@ -280,28 +306,28 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
if (mEntrancePresenter != null) {
|
||||
if ( mEntrancePresenter != null ) {
|
||||
mEntrancePresenter.unregisterUnWake();
|
||||
}
|
||||
|
||||
mIMogoAuthorizeModuleManager.unregisterAuthorizeListener(AuthorizeInvokerConstant.AUTHORIZE_TYPE_LAUNCHER_SHARE_NOVELTY);
|
||||
mIMogoAuthorizeModuleManager.unregisterAuthorizeListener(AuthorizeInvokerConstant.AUTHORIZE_TYPE_LAUNCHER_SHARE);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void authorizeSuccess() {
|
||||
Log.d(TAG, "authorizeSuccess --------> ");
|
||||
Log.d( TAG, "authorizeSuccess --------> " );
|
||||
mEntrancePresenter.handleNeedAuthorizeCmd();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void authorizeFailed(String errorMsg) {
|
||||
Log.e(TAG, "authorizeFailed --------> ");
|
||||
public void authorizeFailed( String errorMsg ) {
|
||||
Log.e( TAG, "authorizeFailed --------> " );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forbiddenVoiceWhenAuthorize(String cmd) {
|
||||
Log.d(TAG, "forbiddenVoiceWhenAuthorize --------> ");
|
||||
public void forbiddenVoiceWhenAuthorize( String cmd ) {
|
||||
Log.d( TAG, "forbiddenVoiceWhenAuthorize --------> " );
|
||||
|
||||
}
|
||||
|
||||
@@ -328,7 +354,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
ivMode.setVisibility( View.VISIBLE );
|
||||
mExitNavi.setVisibility( View.VISIBLE );
|
||||
mMApUIController.setPointToCenter( 0.675926, 0.77552 );
|
||||
mMApUIController.changeMapMode(ivMode.isSelected()?EnumMapUI.NorthUP_2D :EnumMapUI.CarUp_2D );
|
||||
mMApUIController.changeMapMode( ivMode.isSelected() ? EnumMapUI.NorthUP_2D : EnumMapUI.CarUp_2D );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -339,7 +365,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
mExitNavi.setVisibility( View.GONE );
|
||||
mSpeedLimit.setVisibility( View.GONE );
|
||||
mMApUIController.setPointToCenter( 0.66145, 0.590688 );
|
||||
mMApUIController.changeMapMode(EnumMapUI.NorthUP_2D);
|
||||
mMApUIController.changeMapMode( EnumMapUI.NorthUP_2D );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -209,7 +209,11 @@ public class EntrancePresenter extends Presenter<EntranceView> {
|
||||
Logger.d(TAG, "mogoIntentListener 两次未回复关闭对话框");
|
||||
}
|
||||
} else if (intentStr.equals(ExtensionsModuleConst.UPLOAD_ROAD_CONDITION)) { //上报路况 免唤醒 --ok
|
||||
if (mIMogoAuthorizeModuleManager.needAuthorize()) {
|
||||
mIMogoAuthorizeModuleManager.invokeAuthorization(AuthorizeInvokerConstant.AUTHORIZE_TYPE_LAUNCHER_SHARE_NOVELTY);
|
||||
} else {
|
||||
uploadRoadCondition();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 272 B |
Binary file not shown.
|
After Width: | Height: | Size: 451 B |
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="90px" />
|
||||
<solid android:color="#4C6873A5" />
|
||||
</shape>
|
||||
@@ -146,7 +146,7 @@
|
||||
android:layout_height="@dimen/module_ext_operation_panel_vr_height"
|
||||
android:background="@drawable/module_ext_dw_top_corner_bkg"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
android:visibility="visible">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -10,26 +10,42 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/module_ext_id_voice"
|
||||
android:layout_width="@dimen/module_ext_voice_icon_width"
|
||||
android:layout_height="@dimen/module_ext_voice_icon_height"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_width="@dimen/module_ext_voice_icon_width"
|
||||
android:layout_height="@dimen/module_ext_voice_icon_height"/>
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<!-- <com.mogo.module.extensions.anim.JSurfaceView-->
|
||||
<!-- />-->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_ext_id_voice_msg"
|
||||
<LinearLayout
|
||||
android:id="@+id/module_ext_id_voice_msg_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/module_ext_str_voice_msg"
|
||||
android:textColor="@color/module_ext_color_voice_text"
|
||||
android:textSize="@dimen/module_ext_voice_textSize"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@+id/module_ext_id_voice"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:src="@drawable/module_ext_ic_right_arrow" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_ext_id_voice_msg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/module_ext_id_voice_msg_icon_margin_left"
|
||||
android:background="@drawable/module_ext_dw_grey_bottom_bkg"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="@dimen/module_ext_id_voice_msg_padding_left"
|
||||
android:paddingTop="@dimen/module_ext_id_voice_msg_padding_top"
|
||||
android:paddingRight="@dimen/module_ext_id_voice_msg_padding_right"
|
||||
android:paddingBottom="@dimen/module_ext_id_voice_msg_padding_bottom"
|
||||
android:text="@string/module_ext_str_voice_msg"
|
||||
android:textColor="@color/module_ext_color_voice_text"
|
||||
android:textSize="@dimen/module_ext_voice_textSize" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_ext_id_time"
|
||||
@@ -95,8 +111,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="/"
|
||||
android:textSize="@dimen/module_ext_weather_temp_desc_textSize"
|
||||
android:textColor="#FFFFFF" />
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/module_ext_weather_temp_desc_textSize" />
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
|
||||
@@ -90,4 +90,10 @@
|
||||
<dimen name="module_ext_navi_info_panel__arrive_destination_estimate_info_marginTop">24px
|
||||
</dimen>
|
||||
<dimen name="module_ext_navi_info_panel__arrive_destination_estimate_info_textSize">15px</dimen>
|
||||
|
||||
<dimen name="module_ext_id_voice_msg_padding_top">9px</dimen>
|
||||
<dimen name="module_ext_id_voice_msg_padding_bottom">9px</dimen>
|
||||
<dimen name="module_ext_id_voice_msg_padding_left">18px</dimen>
|
||||
<dimen name="module_ext_id_voice_msg_padding_right">18px</dimen>
|
||||
<dimen name="module_ext_id_voice_msg_icon_margin_left">-1px</dimen>
|
||||
</resources>
|
||||
@@ -88,4 +88,10 @@
|
||||
<dimen name="module_ext_navi_info_panel__arrive_destination_estimate_info_marginTop">24px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel__arrive_destination_estimate_info_textSize">28px</dimen>
|
||||
|
||||
<dimen name="module_ext_id_voice_msg_padding_top">17px</dimen>
|
||||
<dimen name="module_ext_id_voice_msg_padding_bottom">17px</dimen>
|
||||
<dimen name="module_ext_id_voice_msg_padding_left">36px</dimen>
|
||||
<dimen name="module_ext_id_voice_msg_padding_right">36px</dimen>
|
||||
<dimen name="module_ext_id_voice_msg_icon_margin_left">-2px</dimen>
|
||||
|
||||
</resources>
|
||||
@@ -88,4 +88,10 @@
|
||||
<dimen name="module_ext_navi_info_panel__arrive_destination_estimate_info_marginTop">24px</dimen>
|
||||
<dimen name="module_ext_navi_info_panel__arrive_destination_estimate_info_textSize">28px</dimen>
|
||||
|
||||
<dimen name="module_ext_id_voice_msg_padding_top">17px</dimen>
|
||||
<dimen name="module_ext_id_voice_msg_padding_bottom">17px</dimen>
|
||||
<dimen name="module_ext_id_voice_msg_padding_left">36px</dimen>
|
||||
<dimen name="module_ext_id_voice_msg_padding_right">36px</dimen>
|
||||
<dimen name="module_ext_id_voice_msg_icon_margin_left">-2px</dimen>
|
||||
|
||||
</resources>
|
||||
@@ -20,28 +20,31 @@
|
||||
<string name="module_ext_str_exit_navi">退出导航</string>
|
||||
<string name="module_ext_str_continue_navi">继续导航</string>
|
||||
<string name="module_ext_str_exit_path">退出全览</string>
|
||||
<string name="mode_car_up">车头</string>
|
||||
<string name="mode_north_up">正北</string>
|
||||
<string name="mode_car_up">车头</string>
|
||||
<string name="mode_north_up">正北</string>
|
||||
|
||||
<string-array name="module_ext_str_arr_ai_tips">
|
||||
<string-array name="module_ext_str_arr_ai_tips">
|
||||
<item>你好小智,播放音乐</item>
|
||||
<item>你好小智,我要听音乐</item>
|
||||
<item>你好小智,播放赵磊的歌</item>
|
||||
<item>你好小智,我想听成都</item>
|
||||
<item>你好小智,打开导航</item>
|
||||
<item>你好小智,我要去拉萨</item>
|
||||
<item>你好小智,我要回家</item>
|
||||
<item>你好小智,我要去加油站</item>
|
||||
<item>你好小智,导航去西单商场</item>
|
||||
<item>你好小智,打开行车记录仪</item>
|
||||
<item>你好小智,打开收音机</item>
|
||||
<item>你好小智,调频到97.4</item>
|
||||
<item>你好小智,调频到103.9</item>
|
||||
<item>你好小智,今天天气怎么样</item>
|
||||
<item>你好小智,北京明天天气怎么样</item>
|
||||
<item>你好小智,打开车聊聊</item>
|
||||
<item>你好小智,我想聊天</item>
|
||||
<item>你好小智,中关村堵不堵</item>
|
||||
<item>你好小智,打开探路</item>
|
||||
<item>你好小智,附近路况</item>
|
||||
<item>你好小智,前方路况怎么样</item>
|
||||
<item>你好小智,上报路况</item>
|
||||
<item>你好小智,分享这首歌</item>
|
||||
<item>你好小智,打开辅助驾驶</item>
|
||||
<item>你好小智,查询附近的人</item>
|
||||
<item>你好小智,音量开到百分之三十</item>
|
||||
<item>你好小智,打开全部应用</item>
|
||||
<item>你好小智,返回桌面</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
|
||||
@@ -1,24 +1,2 @@
|
||||
package com.mogo.module.guide.agreement
|
||||
|
||||
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.mogo.module.guide.agreement.test", appContext.packageName)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.mogo.module.guide
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.module.authorize.authprovider.invoke.AuthorizeConstant
|
||||
import com.mogo.module.authorize.authprovider.module.IMogoAuthorizeModuleManager
|
||||
import com.mogo.module.guide.fragment.GuideFragment
|
||||
import com.mogo.module.guide.util.SharedPreferenceUtil.hasGuide
|
||||
import com.mogo.module.guide.util.SharedPreferenceUtil.setGuideFinish
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
import com.mogo.service.MogoServicePaths
|
||||
import com.mogo.service.fragmentmanager.FragmentDescriptor
|
||||
@@ -15,7 +18,7 @@ object GuideBizManager {
|
||||
fun init() {
|
||||
Logger.d("GuideBizManager", "init===================================")
|
||||
initService()
|
||||
// addGuideFragmentToStack()
|
||||
addGuideFragmentToStack()
|
||||
}
|
||||
|
||||
private fun initService() {
|
||||
@@ -35,8 +38,19 @@ object GuideBizManager {
|
||||
}
|
||||
|
||||
fun removeGuideFragmentToStack() {
|
||||
Logger.d("GuideBizManager", "removeGuideFragmentToStack")
|
||||
setGuideFinish()
|
||||
serviceApi?.let {
|
||||
it.fragmentManagerApi.pop()
|
||||
}
|
||||
}
|
||||
|
||||
fun invokeAuthorize() {
|
||||
val authorizeInvoke = ARouter.getInstance().build(AuthorizeConstant.PROVIDER_MODULE).navigation()
|
||||
if (authorizeInvoke is IMogoAuthorizeModuleManager) {
|
||||
if (authorizeInvoke.needAuthorize()) {
|
||||
authorizeInvoke.invokeAuthorizeForShow()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,6 @@
|
||||
package com.mogo.module.guide.fragment
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.module.authorize.authprovider.invoke.AuthorizeConstant
|
||||
import com.mogo.module.authorize.authprovider.module.IMogoAuthorizeModuleManager
|
||||
import com.mogo.module.guide.GuideBizManager
|
||||
import com.mogo.module.guide.R
|
||||
import com.mogo.utils.logger.Logger
|
||||
@@ -44,17 +41,15 @@ class GuideFragment : MvpFragment<GuideConstract.View, GuidePresenter>(), GuideC
|
||||
|
||||
fun closeGuideFragment() {
|
||||
Logger.d(TAG, "closeGuideFragment")
|
||||
val authorizeInvoke = ARouter.getInstance().build(AuthorizeConstant.PROVIDER_MODULE).navigation()
|
||||
if (authorizeInvoke is IMogoAuthorizeModuleManager) {
|
||||
if (authorizeInvoke.needAuthorize()) {
|
||||
authorizeInvoke.invokeAuthorizeForShow()
|
||||
} else {
|
||||
destroy()
|
||||
}
|
||||
}
|
||||
destroy()
|
||||
invokeAuthorize()
|
||||
}
|
||||
|
||||
private fun destroy() {
|
||||
GuideBizManager.removeGuideFragmentToStack()
|
||||
}
|
||||
|
||||
private fun invokeAuthorize() {
|
||||
GuideBizManager.invokeAuthorize()
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.module.guide.R
|
||||
import com.mogo.module.guide.fragment.GuideFragment
|
||||
import com.mogo.module.guide.util.AnalyticsUtil
|
||||
import kotlinx.android.synthetic.main.module_guide_item_app_list.*
|
||||
|
||||
class GuideAppListFragment : MvpFragment<IView, Presenter<IView>>, View.OnClickListener {
|
||||
@@ -25,6 +26,7 @@ class GuideAppListFragment : MvpFragment<IView, Presenter<IView>>, View.OnClickL
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
AnalyticsUtil.track(AnalyticsUtil.INVOKE_TRACK_SHOW, hashMapOf("pages_num" to 6))
|
||||
moduleGuideAppListNext.setOnClickListener(this)
|
||||
moduleGuideAppListSkip.setOnClickListener(this)
|
||||
}
|
||||
@@ -32,9 +34,11 @@ class GuideAppListFragment : MvpFragment<IView, Presenter<IView>>, View.OnClickL
|
||||
override fun onClick(v: View) {
|
||||
when (v.id) {
|
||||
R.id.moduleGuideAppListNext -> {
|
||||
AnalyticsUtil.track(AnalyticsUtil.INVOKE_TRACK_CLICK, hashMapOf("pages_num" to 6, "button_type" to 1))
|
||||
containerFragment?.moveToNext()
|
||||
}
|
||||
R.id.moduleGuideAppListSkip -> {
|
||||
AnalyticsUtil.track(AnalyticsUtil.INVOKE_TRACK_CLICK, hashMapOf("pages_num" to 6, "button_type" to 2))
|
||||
containerFragment?.moveToLast()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,13 +6,16 @@ import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.module.guide.R
|
||||
import com.mogo.module.guide.fragment.GuideFragment
|
||||
import com.mogo.module.guide.util.AnalyticsUtil
|
||||
import com.mogo.module.guide.util.AnalyticsUtil.INVOKE_TRACK_CLICK
|
||||
import com.mogo.module.guide.util.AnalyticsUtil.INVOKE_TRACK_SHOW
|
||||
import kotlinx.android.synthetic.main.module_guide_item_card.*
|
||||
|
||||
class GuideCardFragment : MvpFragment<IView, Presenter<IView>>, View.OnClickListener {
|
||||
|
||||
private var containerFragment:GuideFragment? = null
|
||||
private var containerFragment: GuideFragment? = null
|
||||
|
||||
constructor(containerFragment:GuideFragment){
|
||||
constructor(containerFragment: GuideFragment) {
|
||||
this.containerFragment = containerFragment
|
||||
}
|
||||
|
||||
@@ -25,6 +28,7 @@ class GuideCardFragment : MvpFragment<IView, Presenter<IView>>, View.OnClickList
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
AnalyticsUtil.track(INVOKE_TRACK_SHOW, hashMapOf("pages_num" to 2))
|
||||
moduleGuideCardNext.setOnClickListener(this)
|
||||
moduleGuideCardSkip.setOnClickListener(this)
|
||||
}
|
||||
@@ -32,9 +36,11 @@ class GuideCardFragment : MvpFragment<IView, Presenter<IView>>, View.OnClickList
|
||||
override fun onClick(v: View) {
|
||||
when (v.id) {
|
||||
R.id.moduleGuideCardNext -> {
|
||||
AnalyticsUtil.track(INVOKE_TRACK_CLICK, hashMapOf("pages_num" to 2, "button_type" to 1))
|
||||
containerFragment?.moveToNext()
|
||||
}
|
||||
R.id.moduleGuideCardSkip -> {
|
||||
AnalyticsUtil.track(INVOKE_TRACK_CLICK, hashMapOf("pages_num" to 2, "button_type" to 2))
|
||||
containerFragment?.moveToLast()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,10 @@ import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.module.guide.R
|
||||
import com.mogo.module.guide.fragment.GuideFragment
|
||||
import com.mogo.module.guide.util.AnalyticsUtil
|
||||
import kotlinx.android.synthetic.main.module_guide_item_entry_main.*
|
||||
|
||||
class GuideEntryMainFragment : MvpFragment<IView, Presenter<IView>>,View.OnClickListener {
|
||||
class GuideEntryMainFragment : MvpFragment<IView, Presenter<IView>>, View.OnClickListener {
|
||||
|
||||
private var containerFragment: GuideFragment? = null
|
||||
|
||||
@@ -25,12 +26,14 @@ class GuideEntryMainFragment : MvpFragment<IView, Presenter<IView>>,View.OnClick
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
AnalyticsUtil.track(AnalyticsUtil.INVOKE_TRACK_SHOW, hashMapOf("pages_num" to 7))
|
||||
moduleGuideEntryMain.setOnClickListener(this)
|
||||
}
|
||||
|
||||
override fun onClick(v: View) {
|
||||
when(v.id){
|
||||
when (v.id) {
|
||||
R.id.moduleGuideEntryMain -> {
|
||||
AnalyticsUtil.track(AnalyticsUtil.INVOKE_TRACK_CLICK, hashMapOf("pages_num" to 7, "button_type" to 3))
|
||||
containerFragment?.closeGuideFragment()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.module.guide.R
|
||||
import com.mogo.module.guide.fragment.GuideFragment
|
||||
import com.mogo.module.guide.util.AnalyticsUtil
|
||||
import kotlinx.android.synthetic.main.module_guide_item_location.*
|
||||
|
||||
class GuideLocationFragment : MvpFragment<IView, Presenter<IView>>, View.OnClickListener {
|
||||
@@ -25,6 +26,7 @@ class GuideLocationFragment : MvpFragment<IView, Presenter<IView>>, View.OnClick
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
AnalyticsUtil.track(AnalyticsUtil.INVOKE_TRACK_SHOW, hashMapOf("pages_num" to 5))
|
||||
moduleGuideLocationNext.setOnClickListener(this)
|
||||
moduleGuideLocationSkip.setOnClickListener(this)
|
||||
}
|
||||
@@ -32,9 +34,11 @@ class GuideLocationFragment : MvpFragment<IView, Presenter<IView>>, View.OnClick
|
||||
override fun onClick(v: View) {
|
||||
when (v.id) {
|
||||
R.id.moduleGuideLocationNext -> {
|
||||
AnalyticsUtil.track(AnalyticsUtil.INVOKE_TRACK_CLICK, hashMapOf("pages_num" to 5, "button_type" to 1))
|
||||
containerFragment?.moveToNext()
|
||||
}
|
||||
R.id.moduleGuideLocationSkip -> {
|
||||
AnalyticsUtil.track(AnalyticsUtil.INVOKE_TRACK_CLICK, hashMapOf("pages_num" to 5, "button_type" to 2))
|
||||
containerFragment?.moveToLast()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.module.guide.R
|
||||
import com.mogo.module.guide.fragment.GuideFragment
|
||||
import com.mogo.module.guide.util.AnalyticsUtil
|
||||
import kotlinx.android.synthetic.main.module_guide_item_navigation.*
|
||||
|
||||
class GuideNavigationFragment : MvpFragment<IView, Presenter<IView>>, View.OnClickListener {
|
||||
@@ -25,6 +26,7 @@ class GuideNavigationFragment : MvpFragment<IView, Presenter<IView>>, View.OnCli
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
AnalyticsUtil.track(AnalyticsUtil.INVOKE_TRACK_SHOW, hashMapOf("pages_num" to 4))
|
||||
moduleGuideNavigationNext.setOnClickListener(this)
|
||||
moduleGuideNavigationSkip.setOnClickListener(this)
|
||||
}
|
||||
@@ -32,9 +34,11 @@ class GuideNavigationFragment : MvpFragment<IView, Presenter<IView>>, View.OnCli
|
||||
override fun onClick(v: View) {
|
||||
when (v.id) {
|
||||
R.id.moduleGuideNavigationNext -> {
|
||||
AnalyticsUtil.track(AnalyticsUtil.INVOKE_TRACK_CLICK, hashMapOf("pages_num" to 4, "button_type" to 1))
|
||||
containerFragment?.moveToNext()
|
||||
}
|
||||
R.id.moduleGuideNavigationSkip -> {
|
||||
AnalyticsUtil.track(AnalyticsUtil.INVOKE_TRACK_CLICK, hashMapOf("pages_num" to 4, "button_type" to 2))
|
||||
containerFragment?.moveToLast()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.module.guide.R
|
||||
import com.mogo.module.guide.fragment.GuideFragment
|
||||
import com.mogo.module.guide.util.AnalyticsUtil
|
||||
import kotlinx.android.synthetic.main.module_guide_item_online_car.*
|
||||
|
||||
class GuideOnLineCarFragment : MvpFragment<IView, Presenter<IView>>, View.OnClickListener {
|
||||
@@ -25,6 +26,7 @@ class GuideOnLineCarFragment : MvpFragment<IView, Presenter<IView>>, View.OnClic
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
AnalyticsUtil.track(AnalyticsUtil.INVOKE_TRACK_SHOW, hashMapOf("pages_num" to 3))
|
||||
moduleGuideOnLineCarNext.setOnClickListener(this)
|
||||
moduleGuideOnLineCarSkip.setOnClickListener(this)
|
||||
}
|
||||
@@ -32,9 +34,11 @@ class GuideOnLineCarFragment : MvpFragment<IView, Presenter<IView>>, View.OnClic
|
||||
override fun onClick(v: View) {
|
||||
when (v.id) {
|
||||
R.id.moduleGuideOnLineCarNext -> {
|
||||
AnalyticsUtil.track(AnalyticsUtil.INVOKE_TRACK_CLICK, hashMapOf("pages_num" to 3, "button_type" to 1))
|
||||
containerFragment?.moveToNext()
|
||||
}
|
||||
R.id.moduleGuideOnLineCarSkip -> {
|
||||
AnalyticsUtil.track(AnalyticsUtil.INVOKE_TRACK_CLICK, hashMapOf("pages_num" to 3, "button_type" to 2))
|
||||
containerFragment?.moveToLast()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import com.mogo.commons.mvp.IView
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.module.guide.R
|
||||
import com.mogo.module.guide.util.AnalyticsUtil
|
||||
import com.mogo.module.guide.util.AnalyticsUtil.INVOKE_TRACK_SHOW
|
||||
|
||||
class GuideStartFragment : MvpFragment<IView, Presenter<IView>>() {
|
||||
|
||||
@@ -16,7 +18,7 @@ class GuideStartFragment : MvpFragment<IView, Presenter<IView>>() {
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
|
||||
AnalyticsUtil.track(INVOKE_TRACK_SHOW, hashMapOf("pages_num" to 1))
|
||||
}
|
||||
|
||||
class GuideStartPresenter : Presenter<IView> {
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.mogo.module.guide.util
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
import com.mogo.service.MogoServicePaths
|
||||
import com.mogo.service.analytics.IMogoAnalytics
|
||||
|
||||
object AnalyticsUtil {
|
||||
|
||||
const val INVOKE_TRACK_SHOW = "newhand_show"
|
||||
const val INVOKE_TRACK_CLICK = "newhand_click"
|
||||
|
||||
private var trackRouter: IMogoAnalytics? = null
|
||||
|
||||
fun track(eventType: String, data: MutableMap<String, Any>? = hashMapOf()) {
|
||||
if (trackRouter == null) {
|
||||
val arouter = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation()
|
||||
if (arouter is IMogoServiceApis) {
|
||||
trackRouter = arouter.analyticsApi
|
||||
}
|
||||
}
|
||||
trackRouter!!.track(eventType, data)
|
||||
}
|
||||
}
|
||||
@@ -11,4 +11,8 @@ object SharedPreferenceUtil {
|
||||
return SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).getBoolean(HAS_GUIDE, false)
|
||||
}
|
||||
|
||||
fun setGuideFinish() {
|
||||
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).putBoolean(HAS_GUIDE, true)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,6 +25,8 @@ import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.MogoModule;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.main.assist.MapBroadCastHelper;
|
||||
import com.mogo.module.main.cards.CardIntroduceConfig;
|
||||
import com.mogo.module.main.cards.CardIntroduceConfigs;
|
||||
import com.mogo.module.main.cards.CardModulesAdapter;
|
||||
import com.mogo.module.main.cards.HorizentalStackTransformer;
|
||||
import com.mogo.module.main.cards.MogoModulesHandler;
|
||||
@@ -198,7 +200,8 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
mCardCoverUpBottomLayout = findViewById( R.id.module_main_id_card_cover_up_bottom );
|
||||
|
||||
// 避免事件穿透导致地图被滑动
|
||||
mLeftShadowFrame.setOnClickListener( view -> {} );
|
||||
mLeftShadowFrame.setOnClickListener( view -> {
|
||||
} );
|
||||
WindowViewHandler.init( mFloatingLayout );
|
||||
}
|
||||
|
||||
@@ -378,6 +381,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
MapBroadCastHelper.getInstance( this ).mapBackground();
|
||||
super.onPause();
|
||||
mMogoStatusManager.setMainPageResumeStatus( TAG, false );
|
||||
CardIntroduceConfigs.flush( getApplicationContext() );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.mogo.module.main.cards;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-03-27
|
||||
* <p>
|
||||
* 卡片播报配置
|
||||
*/
|
||||
public class CardIntroduceConfig {
|
||||
|
||||
public String cardType;
|
||||
public String broadcastWords;
|
||||
public int broadcastAmount;
|
||||
|
||||
public CardIntroduceConfig( String cardType, String broadcastWords, int broadcastAmount ) {
|
||||
this.cardType = cardType;
|
||||
this.broadcastWords = broadcastWords;
|
||||
this.broadcastAmount = broadcastAmount;
|
||||
}
|
||||
|
||||
public CardIntroduceConfig() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.mogo.module.main.cards;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.commons.voice.VoicePreemptType;
|
||||
import com.mogo.module.common.ModuleNames;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.utils.CommonUtils;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
import com.mogo.utils.storage.SharedPrefsMgr;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-03-27
|
||||
* <p>
|
||||
* 卡片播报配置
|
||||
*/
|
||||
public class CardIntroduceConfigs {
|
||||
|
||||
private static final String TAG = "CardIntroduceConfigs";
|
||||
|
||||
public static final String KEY_VOICE_BROADCAST_CONFIG = "voice_broadcast_";
|
||||
public static String sBroadcastConfigKey;
|
||||
|
||||
public static Map< String, CardIntroduceConfig > sConfigs = new HashMap<>();
|
||||
private static IMogoStatusManager sStatusManager;
|
||||
|
||||
static {
|
||||
sConfigs.put( ModuleNames.CARD_TYPE_BUSINESS_OPERATION, new CardIntroduceConfig( ModuleNames.CARD_TYPE_BUSINESS_OPERATION, "", 3 ) );
|
||||
sConfigs.put( ModuleNames.CARD_TYPE_SHARE_MUSIC, new CardIntroduceConfig( ModuleNames.CARD_TYPE_SHARE_MUSIC, "音乐新闻听书,海量资源随你选", 0 ) );
|
||||
sConfigs.put( ModuleNames.CARD_TYPE_CARS_CHATTING, new CardIntroduceConfig( ModuleNames.CARD_TYPE_CARS_CHATTING, "开车无聊,就用车聊聊", 0 ) );
|
||||
sConfigs.put( ModuleNames.CARD_TYPE_ROAD_CONDITION, new CardIntroduceConfig( ModuleNames.CARD_TYPE_ROAD_CONDITION, "随时查看路况,可以对我说某某地点堵不堵", 0 ) );
|
||||
sConfigs.put( ModuleNames.CARD_TYPE_USER_DATA, new CardIntroduceConfig( ModuleNames.CARD_TYPE_USER_DATA, "在线车辆,邀你在地图上发现万千有趣的车友", 0 ) );
|
||||
sConfigs.put( ModuleNames.CARD_TYPE_NOVELTY, new CardIntroduceConfig( ModuleNames.CARD_TYPE_NOVELTY, "新鲜事,邀你给同城车友分享沿途封路、拥堵消息", 0 ) );
|
||||
}
|
||||
|
||||
public static void init( Context context, IMogoStatusManager manager ) {
|
||||
sStatusManager = manager;
|
||||
WorkThreadHandler.getInstance().post( () -> {
|
||||
sBroadcastConfigKey = KEY_VOICE_BROADCAST_CONFIG + CommonUtils.getVersionCode( context );
|
||||
String configsStr = SharedPrefsMgr.getInstance( context ).getString( sBroadcastConfigKey );
|
||||
List< CardIntroduceConfig > configs = GsonUtil.arrayFromJson( configsStr, CardIntroduceConfig.class );
|
||||
if ( configs == null ) {
|
||||
return;
|
||||
}
|
||||
for ( CardIntroduceConfig config : configs ) {
|
||||
if ( config == null ) {
|
||||
return;
|
||||
}
|
||||
sConfigs.put( config.cardType, config );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
public static void broadcastCardIntroduce( Context context, String type ) {
|
||||
if ( sConfigs.get( type ) == null ) {
|
||||
Logger.d( TAG, "un support %s", type );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( sConfigs.get( type ).broadcastAmount >= 3 ) {
|
||||
Logger.d( TAG, "do not broadcastCardIntroduce %s cast amount = %s", type, type );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( sStatusManager != null ) {
|
||||
if ( !sStatusManager.isAIAssistReady() ) {
|
||||
Logger.w( TAG, "ai assist not ready: %s", type );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
CardIntroduceConfig config = sConfigs.get( type );
|
||||
config.broadcastAmount++;
|
||||
|
||||
Logger.d( TAG, "speak card introduce: %s", config.broadcastWords );
|
||||
AIAssist.getInstance( context ).speakTTSVoice( config.broadcastWords, VoicePreemptType.PREEMPT_TYPE_IMMEADIATELY, null );
|
||||
}
|
||||
|
||||
public static void flush( Context context ) {
|
||||
if ( sBroadcastConfigKey == null || sConfigs.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
WorkThreadHandler.getInstance().post( () -> {
|
||||
synchronized ( sConfigs ) {
|
||||
ArrayList configs = new ArrayList( sConfigs.entrySet() );
|
||||
SharedPrefsMgr.getInstance( context ).putString( sBroadcastConfigKey, GsonUtil.jsonFromObject( configs ) );
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,7 @@ import com.mogo.module.main.MainActivity;
|
||||
import com.mogo.module.main.assist.MapBroadCastHelper;
|
||||
import com.mogo.module.main.registercenter.MogoRegisterCenterHandler;
|
||||
import com.mogo.module.service.receiver.MogoReceiver;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
@@ -66,6 +67,9 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
|
||||
private static final String TAG = "MogoModulesManager";
|
||||
|
||||
|
||||
private String mBroadcastConfigKey;
|
||||
|
||||
private MainActivity mActivity;
|
||||
|
||||
private Map< MogoModule, IMogoModuleProvider > mModuleProviders = new HashMap<>();
|
||||
@@ -86,15 +90,12 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
throw new NullPointerException( "activity can't be null." );
|
||||
}
|
||||
this.mActivity = activity;
|
||||
mTrackManager = ( IMogoAnalytics ) ARouter.getInstance()
|
||||
.build( MogoServicePaths.PATH_UTILS_ANALYTICS )
|
||||
.navigation();
|
||||
|
||||
mMogoIntentManager = ( IMogoIntentManager ) ARouter.getInstance()
|
||||
.build( MogoServicePaths.PATH_INTENT_MANAGER )
|
||||
.navigation();
|
||||
IMogoServiceApis apis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation();
|
||||
mTrackManager = apis.getAnalyticsApi();
|
||||
mMogoIntentManager = apis.getIntentManagerApi();
|
||||
|
||||
registerReceiver();
|
||||
CardIntroduceConfigs.init( getContext(), apis.getStatusManagerApi() );
|
||||
}
|
||||
|
||||
private Context getContext() {
|
||||
@@ -279,6 +280,8 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
mSortedCards.add( 0, mEnableModuleName );
|
||||
SharedPrefsMgr.getInstance( getContext() ).putString( KEY_SORTED_CARD_MODULES, GsonUtil.jsonFromObject( mSortedCards ) );
|
||||
Log.i( TAG, "enable & disable card cost " + ( System.currentTimeMillis() - start1 ) + "ms" );
|
||||
|
||||
CardIntroduceConfigs.broadcastCardIntroduce( mActivity, mEnableModuleName );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape>
|
||||
<gradient android:angle="270" android:endColor="#00222222" android:startColor="#79000000" />
|
||||
<gradient android:angle="270" android:endColor="#00222222" android:startColor="#000000" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -85,7 +85,7 @@ public class MapPresenter extends Presenter<MapView> implements
|
||||
}, 1_000 );
|
||||
} else {
|
||||
// 30s后锁车刷新
|
||||
mRefreshStrategyController.restartAutoRefreshAtTime( 30 );
|
||||
mRefreshStrategyController.restartAutoRefreshAtTime( 30_000 );
|
||||
}
|
||||
} else if (type == 2) {
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -344,6 +344,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
}
|
||||
|
||||
// 解析不同的Marker类型,然后对应的进行绘制
|
||||
Logger.d( TAG, "draw marker" );
|
||||
|
||||
mLastDataResult = response.getResult();
|
||||
UiThreadHandler.post( () -> {
|
||||
|
||||
@@ -77,6 +77,13 @@ public interface IMogoStatusManager extends IProvider {
|
||||
*/
|
||||
boolean isMainPageOnResume();
|
||||
|
||||
/**
|
||||
* 小智语音是否准备完毕
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isAIAssistReady();
|
||||
|
||||
/**
|
||||
* 设置小智语音UI状态
|
||||
*
|
||||
@@ -151,6 +158,14 @@ public interface IMogoStatusManager extends IProvider {
|
||||
*/
|
||||
void setMainPageResumeStatus( String tag, boolean resume );
|
||||
|
||||
/**
|
||||
* 设置小智语音状态
|
||||
*
|
||||
* @param tag
|
||||
* @param ready
|
||||
*/
|
||||
void setAIAssistReady( String tag, boolean ready );
|
||||
|
||||
/**
|
||||
* 注册监听
|
||||
*
|
||||
|
||||
@@ -54,5 +54,10 @@ public enum StatusDescriptor {
|
||||
/**
|
||||
* 主页 resume 状态
|
||||
*/
|
||||
MAIN_PAGE_RESUME;
|
||||
MAIN_PAGE_RESUME,
|
||||
|
||||
/**
|
||||
* 小智语音状态
|
||||
*/
|
||||
AI_ASSIST_READY;
|
||||
}
|
||||
|
||||
@@ -47,6 +47,8 @@ public class MogoADASController implements IMogoADASController {
|
||||
return;
|
||||
}
|
||||
|
||||
Logger.d( TAG, "open adas" );
|
||||
|
||||
Intent intent = new Intent( ACTION );
|
||||
intent.putExtra( PARAM_COMMAND, VAL_COMMAND );
|
||||
JSONObject object = new JSONObject();
|
||||
@@ -67,6 +69,8 @@ public class MogoADASController implements IMogoADASController {
|
||||
return;
|
||||
}
|
||||
|
||||
Logger.d( TAG, "close adas" );
|
||||
|
||||
Intent intent = new Intent( ACTION );
|
||||
intent.putExtra( PARAM_COMMAND, VAL_COMMAND );
|
||||
JSONObject object = new JSONObject();
|
||||
|
||||
@@ -94,6 +94,11 @@ public class MogoStatusManager implements IMogoStatusManager {
|
||||
return get_bool_val( StatusDescriptor.MAIN_PAGE_RESUME );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAIAssistReady() {
|
||||
return get_bool_val( StatusDescriptor.AI_ASSIST_READY );
|
||||
}
|
||||
|
||||
private boolean get_bool_val( StatusDescriptor descriptor ) {
|
||||
Boolean val = mStatus.get( descriptor );
|
||||
return val == null ? false : val;
|
||||
@@ -165,6 +170,13 @@ public class MogoStatusManager implements IMogoStatusManager {
|
||||
recordStatusModifier( tag, StatusDescriptor.MAIN_PAGE_RESUME );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAIAssistReady( String tag, boolean ready ) {
|
||||
mStatus.put( StatusDescriptor.AI_ASSIST_READY, ready );
|
||||
invokeStatusChangedListener( StatusDescriptor.AI_ASSIST_READY, ready );
|
||||
recordStatusModifier( tag, StatusDescriptor.AI_ASSIST_READY );
|
||||
}
|
||||
|
||||
private void invokeStatusChangedListener( StatusDescriptor descriptor, boolean status ) {
|
||||
if ( mListeners.containsKey( descriptor ) ) {
|
||||
Iterator< IMogoStatusChangedListener > iterator = mListeners.get( descriptor ).iterator();
|
||||
|
||||
Reference in New Issue
Block a user