Merge branch 'feature/v1.0.3' of gitlab.zhidaoauto.com:ecos/yycp-service/Launcher into feature/v1.0.3
This commit is contained in:
@@ -3,10 +3,7 @@ apply from: "config.gradle"
|
||||
apply from: "javadoc.gradle"
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.3.41'
|
||||
|
||||
ext.kotlin_version = '1.3.61'
|
||||
ext.kotlin_version = '1.3.61+'
|
||||
repositories {
|
||||
maven {
|
||||
url 'http://maven.aliyun.com/nexus/content/groups/public/'
|
||||
|
||||
@@ -10,41 +10,43 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-23
|
||||
* <p>
|
||||
* mvp fragment
|
||||
*/
|
||||
public abstract class MvpFragment< V extends IView, P extends Presenter< V > > extends Fragment implements IView {
|
||||
public abstract class MvpFragment<V extends IView, P extends Presenter<V>> extends Fragment implements IView {
|
||||
|
||||
private Context mContext;
|
||||
protected P mPresenter;
|
||||
protected View mRootView;
|
||||
|
||||
@Override
|
||||
public void onAttach( Context context ) {
|
||||
super.onAttach( context );
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView( @NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState ) {
|
||||
// if ( mRootView == null ) {
|
||||
// mRootView = inflater.inflate( getLayoutId(), container, false );
|
||||
// } else {
|
||||
// ViewGroup viewGroup = ( ViewGroup ) mRootView.getParent();
|
||||
// if ( viewGroup != null )
|
||||
// viewGroup.removeView( mRootView );
|
||||
// }
|
||||
mRootView = inflater.inflate( getLayoutId(), container, false );
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
if ( mRootView == null ) {
|
||||
mRootView = inflater.inflate( getLayoutId(), container, false );
|
||||
} else {
|
||||
ViewGroup viewGroup = ( ViewGroup ) mRootView.getParent();
|
||||
if ( viewGroup != null )
|
||||
viewGroup.removeView( mRootView );
|
||||
}
|
||||
mRootView = inflater.inflate(getLayoutId(), container, false);
|
||||
return mRootView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated( @NonNull View view, @Nullable Bundle savedInstanceState ) {
|
||||
super.onViewCreated( view, savedInstanceState );
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
initViews(savedInstanceState);
|
||||
}
|
||||
|
||||
@@ -56,11 +58,11 @@ public abstract class MvpFragment< V extends IView, P extends Presenter< V > > e
|
||||
protected abstract int getLayoutId();
|
||||
|
||||
@Override
|
||||
public void onActivityCreated( @Nullable Bundle savedInstanceState ) {
|
||||
super.onActivityCreated( savedInstanceState );
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
initViews();
|
||||
mPresenter = createPresenter();
|
||||
getViewLifecycleOwner().getLifecycle().addObserver( mPresenter );
|
||||
getViewLifecycleOwner().getLifecycle().addObserver(mPresenter);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,7 +70,9 @@ public abstract class MvpFragment< V extends IView, P extends Presenter< V > > e
|
||||
* presenter 生命周期错乱
|
||||
*/
|
||||
protected abstract void initViews();
|
||||
protected void initViews(Bundle savedInstanceState){}
|
||||
|
||||
protected void initViews(Bundle savedInstanceState) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建 presenter 实例
|
||||
@@ -79,9 +83,12 @@ public abstract class MvpFragment< V extends IView, P extends Presenter< V > > e
|
||||
protected abstract P createPresenter();
|
||||
|
||||
@Nullable
|
||||
protected < T extends View > T findViewById( int id ) {
|
||||
if ( mRootView != null ) {
|
||||
return ( T ) mRootView.findViewById( id );
|
||||
protected <T extends View> T findViewById(int id) {
|
||||
if (mRootView == null) {
|
||||
mRootView = getView().findViewById(id);
|
||||
}
|
||||
if (mRootView != null) {
|
||||
return (T) mRootView.findViewById(id);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -89,7 +96,7 @@ public abstract class MvpFragment< V extends IView, P extends Presenter< V > > e
|
||||
@Nullable
|
||||
@Override
|
||||
public Context getContext() {
|
||||
if ( mContext == null ) {
|
||||
if (mContext == null) {
|
||||
mContext = super.getContext();
|
||||
}
|
||||
return mContext;
|
||||
@@ -98,8 +105,8 @@ public abstract class MvpFragment< V extends IView, P extends Presenter< V > > e
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
if ( mPresenter != null ) {
|
||||
getViewLifecycleOwner().getLifecycle().removeObserver( mPresenter );
|
||||
if (mPresenter != null) {
|
||||
getViewLifecycleOwner().getLifecycle().removeObserver(mPresenter);
|
||||
}
|
||||
mPresenter = null;
|
||||
mRootView = null;
|
||||
|
||||
@@ -78,7 +78,6 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
mHasFlush = isVoiceServiceReady( context );
|
||||
}
|
||||
|
||||
@VoiceTrack
|
||||
@Override
|
||||
public void onCmdSelected( String cmd ) {
|
||||
if ( !mCmdMap.containsKey( cmd ) ) {
|
||||
@@ -95,7 +94,6 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
}
|
||||
}
|
||||
|
||||
@VoiceTrack
|
||||
@Override
|
||||
public void onCmdAction( String speakText ) {
|
||||
if ( !TextUtils.isEmpty( mLastQAndASpeakText ) ) {
|
||||
@@ -106,7 +104,6 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
}
|
||||
}
|
||||
|
||||
@VoiceTrack
|
||||
@Override
|
||||
public void onCmdCancel( String speakText ) {
|
||||
if ( !TextUtils.isEmpty( mLastQAndASpeakText ) ) {
|
||||
@@ -117,7 +114,6 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
}
|
||||
}
|
||||
|
||||
@VoiceTrack
|
||||
@Override
|
||||
public void onSpeakEnd( String speakText ) {
|
||||
if ( mQAndAMap.containsKey( speakText ) ) {
|
||||
@@ -134,7 +130,6 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
}
|
||||
}
|
||||
|
||||
@VoiceTrack
|
||||
@Override
|
||||
public void onSpeakSelectTimeOut( String speakText ) {
|
||||
if ( mQAndAMap.containsKey( speakText ) ) {
|
||||
|
||||
@@ -21,6 +21,10 @@ public class GuideShowLauncher extends BaseAppLauncher {
|
||||
Logger.d(TAG, s);
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
}else{
|
||||
if ( getNext() != null ) {
|
||||
getNext().launch( context, appInfo );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
apply plugin: 'com.alibaba.arouter'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
apply plugin: 'android-aspectjx'
|
||||
|
||||
android {
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
GROUP=com.mogo.module
|
||||
POM_ARTIFACT_ID=module-authorize
|
||||
VERSION_CODE=1
|
||||
VERSION_CODE=1
|
||||
@@ -3,6 +3,7 @@ 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.Agreement
|
||||
import com.mogo.module.authorize.model.bean.AgreementData
|
||||
import com.mogo.module.authorize.net.request
|
||||
import com.mogo.module.authorize.util.DateUtil.parseDateToTime
|
||||
@@ -19,6 +20,20 @@ open class IMogoAuthorizeController {
|
||||
|
||||
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)
|
||||
})
|
||||
}
|
||||
|
||||
fun invokeAuthorizeContent(tag: String, agreementType: Int) {
|
||||
realInvokeAuthorizeContent(agreementType, {
|
||||
if (agreementType == -1) {
|
||||
@@ -88,8 +103,8 @@ open class IMogoAuthorizeController {
|
||||
if (hasNewVersion(currentTime)) {
|
||||
updateAuthorizeVersion(currentTime)
|
||||
setAuthorizeStatus(agreementType, false)
|
||||
}else{
|
||||
Logger.d(TAG,"no new version")
|
||||
} else {
|
||||
Logger.d(TAG, "no new version")
|
||||
}
|
||||
}
|
||||
}, { s: String ->
|
||||
|
||||
@@ -92,8 +92,8 @@ class MogoMainAuthorize private constructor() : MogoAuthorizeManagerImpl(), IMog
|
||||
}
|
||||
|
||||
private inline fun pushFragmentToMainView(tag: String, push: (() -> Unit)) {
|
||||
val builderWrapper = FragmentDescriptor.Builder().fragment(AuthorizeFragment(tag))
|
||||
.tag(PATH_AGREEMENT_MODULE_NAME).build()
|
||||
val builderWrapper = FragmentDescriptor.Builder().fragment(AuthorizeFragment.newInstance(tag))
|
||||
.tag(PATH_AGREEMENT_MODULE_NAME).notifyMainModule(false).build()
|
||||
Logger.d(TAG, "pushFragmentToMainView")
|
||||
val mogoService = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation()
|
||||
if (mogoService is IMogoServiceApis) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mogo.module.authorize.fragment
|
||||
|
||||
import android.os.Bundle
|
||||
import android.text.Html
|
||||
import android.view.View
|
||||
import android.widget.Button
|
||||
@@ -15,52 +16,77 @@ import com.mogo.module.authorize.voice.IVoiceIntentListener
|
||||
import com.mogo.module.authorize.voice.VoiceUtil
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
class AuthorizeFragment(private val invokeTag: String) : MvpFragment<AuthorizeContract.View, AuthorizePresenter>(), AuthorizeContract.View, View.OnClickListener, IVoiceCommandListener, IVoiceIntentListener {
|
||||
class AuthorizeFragment : MvpFragment<AuthorizeContract.View, AuthorizePresenter>(), AuthorizeContract.View, View.OnClickListener, IVoiceCommandListener, IVoiceIntentListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "AuthorizeFragment"
|
||||
private const val INVOKE = "INVOKE"
|
||||
|
||||
fun newInstance(invokeTag: String): AuthorizeFragment {
|
||||
val fragment = AuthorizeFragment()
|
||||
val args = Bundle()
|
||||
args.putString(INVOKE, invokeTag)
|
||||
fragment.arguments = args
|
||||
return fragment
|
||||
}
|
||||
}
|
||||
|
||||
private var agreementId: Long = 0L
|
||||
private var invokeTag:String? = null
|
||||
|
||||
private var clErrorContainer:ConstraintLayout? = null
|
||||
private var clLoadAuthorizeContainer:ConstraintLayout? = null
|
||||
private var clContainer: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 clErrorContainer: ConstraintLayout? = null
|
||||
private var clLoadAuthorizeContainer: ConstraintLayout? = null
|
||||
private var clContainer: 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
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
arguments?.let {
|
||||
invokeTag = it.getString(INVOKE)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.module_authorize_fragment
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
Logger.d(TAG,"initView : ${this.hashCode()}")
|
||||
Logger.d(TAG, "initView : ${this.javaClass.hashCode()}")
|
||||
AnalyticsUtil.track(INVOKE_TRACK_AUTHORIZE_SHOW)
|
||||
clErrorContainer = this.findViewById(R.id.clLoadingErrorContainer)
|
||||
clLoadAuthorizeContainer = this.findViewById(R.id.clLoadingAuthorizeContainer)
|
||||
clContainer = this.findViewById(R.id.clAuthorizeContainer)
|
||||
btnAgree = this.findViewById(R.id.btnAuthorizeAgree)
|
||||
btnDisAgree = this.findViewById(R.id.btnAuthorizeDisAgree)
|
||||
btnLoadingError = this.findViewById(R.id.btnAuthorizeLoadingError)
|
||||
tvTitle = this.findViewById(R.id.tvAuthorizeTitle)
|
||||
tvContent = this.findViewById(R.id.tvAuthorizeContent)
|
||||
tvButtonContent = this.findViewById(R.id.tvAuthorizeButtonContent)
|
||||
tvLastContent = this.findViewById(R.id.tvAuthorizeLastContent)
|
||||
btnAgree?.setOnClickListener(this)
|
||||
btnDisAgree?.setOnClickListener(this)
|
||||
btnLoadingError?.setOnClickListener(this)
|
||||
clErrorContainer?.setOnClickListener(this)
|
||||
init()
|
||||
Logger.d(TAG, "invokeTag :$invokeTag")
|
||||
VoiceUtil.registerAll(context!!, this, this)
|
||||
}
|
||||
|
||||
private fun init(){
|
||||
if(mRootView == null){
|
||||
Logger.d(TAG,"joker ?")
|
||||
mRootView = view
|
||||
}
|
||||
clErrorContainer = mRootView.findViewById(R.id.clLoadingErrorContainer)
|
||||
clLoadAuthorizeContainer = mRootView.findViewById(R.id.clLoadingAuthorizeContainer)
|
||||
clContainer = mRootView.findViewById(R.id.clAuthorizeContainer)
|
||||
btnAgree = mRootView.findViewById(R.id.btnAuthorizeAgree)
|
||||
btnDisAgree = mRootView.findViewById(R.id.btnAuthorizeDisAgree)
|
||||
btnLoadingError = mRootView.findViewById(R.id.btnAuthorizeLoadingError)
|
||||
tvTitle = mRootView.findViewById(R.id.tvAuthorizeTitle)
|
||||
tvContent = mRootView.findViewById(R.id.tvAuthorizeContent)
|
||||
tvButtonContent = mRootView.findViewById(R.id.tvAuthorizeButtonContent)
|
||||
tvLastContent = mRootView.findViewById(R.id.tvAuthorizeLastContent)
|
||||
btnAgree?.setOnClickListener(this)
|
||||
btnDisAgree?.setOnClickListener(this)
|
||||
btnLoadingError?.setOnClickListener(this)
|
||||
clErrorContainer?.setOnClickListener(this)
|
||||
}
|
||||
|
||||
override fun createPresenter(): AuthorizePresenter {
|
||||
return AuthorizePresenter(invokeTag, this)
|
||||
return AuthorizePresenter(invokeTag!!, this)
|
||||
}
|
||||
|
||||
override fun readyToAuthorize() {
|
||||
@@ -75,9 +101,10 @@ class AuthorizeFragment(private val invokeTag: String) : MvpFragment<AuthorizeCo
|
||||
agreementBottom: String,
|
||||
agreementLast: String) {
|
||||
VoiceUtil.speak(context!!.resources.getString(R.string.module_authorize_agreement_tip), context!!, this)
|
||||
this.agreementId = agreementId
|
||||
init()
|
||||
clLoadAuthorizeContainer?.visibility = View.GONE
|
||||
clContainer?.visibility = View.VISIBLE
|
||||
this.agreementId = agreementId
|
||||
tvTitle?.text = Html.fromHtml(agreementTitle)
|
||||
tvContent?.text = Html.fromHtml(agreementContent)
|
||||
tvButtonContent?.text = Html.fromHtml(agreementBottom)
|
||||
@@ -93,31 +120,31 @@ class AuthorizeFragment(private val invokeTag: String) : MvpFragment<AuthorizeCo
|
||||
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)
|
||||
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)
|
||||
mPresenter.disAgreeAuthorize(invokeTag!!, agreementId)
|
||||
}
|
||||
R.id.clLoadingErrorContainer, R.id.btnAuthorizeLoadingError -> {
|
||||
mPresenter.invokeAuthorizationContent(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)
|
||||
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)
|
||||
mPresenter.disAgreeAuthorize(invokeTag!!, agreementId)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
Logger.d(TAG,"onDestroy")
|
||||
Logger.d(TAG, "onDestroy")
|
||||
VoiceUtil.unregisterAll(context!!, this)
|
||||
}
|
||||
|
||||
|
||||
@@ -3,14 +3,14 @@ package com.mogo.module.authorize.fragment
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.module.authorize.authprovider.biz.MogoAuthorizeRegisterHandler
|
||||
import com.mogo.module.authorize.authprovider.invoke.IMogoAuthorizeContentListener
|
||||
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 AuthorizePresenter : Presenter<AuthorizeContract.View>, AuthorizeContract.Biz, IMogoAuthorizeContentListener {
|
||||
class AuthorizePresenter : Presenter<AuthorizeContract.View>, AuthorizeContract.Biz {
|
||||
|
||||
companion object {
|
||||
const val TAG = "AuthorizePresenter"
|
||||
@@ -32,13 +32,16 @@ class AuthorizePresenter : Presenter<AuthorizeContract.View>, AuthorizeContract.
|
||||
override fun invokeAuthorizationContent(invokeTag: String) {
|
||||
mView.readyToAuthorize()
|
||||
this.invokeTag = invokeTag
|
||||
if (!mogoAuthShow.hasRegister(invokeTag)) {
|
||||
mogoAuthShow.registerInvokeAuthorizeContentListener(invokeTag, this)
|
||||
}
|
||||
mogoAuthShow.invokeAuthorizeContent(invokeTag)
|
||||
MogoAuthorizeMainController.getAuthorizeContent({
|
||||
Logger.d(TAG, "ready to get Authorize Content")
|
||||
}, {
|
||||
getContentSuccess(it)
|
||||
}, { msg: String ->
|
||||
getContentFailed(msg)
|
||||
})
|
||||
}
|
||||
|
||||
override fun requestContentSuccess(userAgreement: Agreement) {
|
||||
private fun getContentSuccess(userAgreement: Agreement) {
|
||||
Logger.d(TAG, "requestContentSuccess userAgreement:$userAgreement")
|
||||
if (userAgreement?.agreementContent != null && userAgreement?.agreementContent.isNotEmpty()) {
|
||||
val id = userAgreement.tUserAgreementEntity.id
|
||||
@@ -55,7 +58,7 @@ class AuthorizePresenter : Presenter<AuthorizeContract.View>, AuthorizeContract.
|
||||
}
|
||||
}
|
||||
|
||||
override fun requestContentFailed(errorMsg: String) {
|
||||
private fun getContentFailed(errorMsg: String) {
|
||||
Logger.d(TAG, "requestContentFailed errorMsg:$errorMsg")
|
||||
mView.showAuthorizationError()
|
||||
}
|
||||
|
||||
@@ -10,8 +10,7 @@ object SharedPreferenceUtil {
|
||||
private const val AUTHORIZE_UPDATE_TIME = "AUTHORIZE_UPDATE_TIME"
|
||||
|
||||
fun needAuthorization(type: Int): Boolean {
|
||||
// return !hasAuth(type) //todo test
|
||||
return false
|
||||
return !hasAuth(type)
|
||||
}
|
||||
|
||||
fun hasAuth(type: Int): Boolean {
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.mogo.module.authorize.view
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Paint
|
||||
import android.util.AttributeSet
|
||||
import android.widget.TextView
|
||||
|
||||
class AutoSplitTextView : TextView {
|
||||
|
||||
private var textShowWidth: Float = 0f
|
||||
private var paint: Paint? = null
|
||||
|
||||
constructor(context: Context?) : super(context, null)
|
||||
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) {
|
||||
init()
|
||||
}
|
||||
|
||||
constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
|
||||
init()
|
||||
}
|
||||
|
||||
private fun init() {
|
||||
paint = Paint()
|
||||
}
|
||||
|
||||
|
||||
override fun onDraw(canvas: Canvas) {
|
||||
super.onDraw(canvas)
|
||||
textShowWidth = (this.measuredWidth - paddingLeft - paddingRight).toFloat()
|
||||
var lineCount = 0
|
||||
if (text.toString().isNullOrBlank()) return
|
||||
val textCharArray = text.toString().toCharArray()
|
||||
var drawWidth = 0f
|
||||
var charWidth: Float
|
||||
for (i in 0..textCharArray.size) {
|
||||
charWidth = paint!!.measureText(textCharArray, i, 1)
|
||||
if (textCharArray[i] == '\n') {
|
||||
lineCount++
|
||||
drawWidth = 0f
|
||||
continue
|
||||
}
|
||||
if (textShowWidth - drawWidth < charWidth) {
|
||||
lineCount++
|
||||
drawWidth = 0f
|
||||
}
|
||||
canvas.drawText(textCharArray, i, 1, paddingLeft + drawWidth, (lineCount + 1) * textSize, paint)
|
||||
drawWidth += charWidth
|
||||
}
|
||||
height = (lineCount + 1) * textSize as Int
|
||||
}
|
||||
|
||||
}
|
||||
@@ -28,13 +28,13 @@ class VoiceForbiddenWhenGuide {
|
||||
|
||||
@Before("authorizeTrackPoint()")
|
||||
fun trackVoiceWhenAuthorize(joinPoint: ProceedingJoinPoint) {
|
||||
Logger.d(TAG, "trackVoiceWhenAuthorize")
|
||||
val msg = joinPoint.args[0] as String
|
||||
if (SharedPreferenceUtil.hasGuide()) {
|
||||
Logger.d(TAG, "proceed,no interception")
|
||||
joinPoint.proceed()
|
||||
} else {
|
||||
return
|
||||
}
|
||||
// Logger.d(TAG, "trackVoiceWhenAuthorize")
|
||||
// val msg = joinPoint.args[0] as String
|
||||
// if (SharedPreferenceUtil.hasGuide()) {
|
||||
// Logger.d(TAG, "proceed,no interception")
|
||||
// joinPoint.proceed()
|
||||
// } else {
|
||||
// return
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -64,7 +64,6 @@ public class MogoReceiver extends BroadcastReceiver {
|
||||
mMogoIntentManager = (IMogoIntentManager) ARouter.getInstance().build(MogoServicePaths.PATH_INTENT_MANAGER).navigation(context);
|
||||
}
|
||||
|
||||
@VoiceIntentTrack
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
final String action = intent.getAction();
|
||||
|
||||
Reference in New Issue
Block a user