opt
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
package com.mogo.commons;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.elegant.analytics.Analytics;
|
||||
@@ -57,13 +63,40 @@ public class AbsMogoApplication extends Application {
|
||||
asyncInit();
|
||||
}
|
||||
|
||||
private void syncInit(){
|
||||
private void syncInit() {
|
||||
// 初始化 arouter
|
||||
if ( DebugConfig.isDebug() ) {
|
||||
ARouter.openDebug();
|
||||
ARouter.openLog();
|
||||
}
|
||||
ARouter.init( sApp );
|
||||
TipToast.init( this, new TipToast.ToastViewGenerator() {
|
||||
@Override
|
||||
public View make( Context context, String message ) {
|
||||
if ( TextUtils.isEmpty( message ) ) {
|
||||
return null;
|
||||
}
|
||||
View contentView = LayoutInflater.from( context ).inflate( R.layout.module_commons_layout_toast, null );
|
||||
TextView txt = contentView.findViewById( R.id.module_commons_toast_msg );
|
||||
txt.setText( message );
|
||||
return contentView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int gravity() {
|
||||
return Gravity.TOP | Gravity.CENTER_HORIZONTAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int yOffset() {
|
||||
return sApp.getResources().getDimensionPixelSize( R.dimen.module_commons_toast_y_offset );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int xOffset() {
|
||||
return 0;
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,12 +112,11 @@ public class AbsMogoApplication extends Application {
|
||||
return sc;
|
||||
}
|
||||
|
||||
private void asyncInit(){
|
||||
ThreadPoolService.execute( ()->{
|
||||
private void asyncInit() {
|
||||
ThreadPoolService.execute( () -> {
|
||||
initNetConfig();
|
||||
initAccountSdk();
|
||||
// 初始化toast
|
||||
TipToast.init( sApp, null );
|
||||
// 初始化埋点
|
||||
Analytics.getInstance().start( sApp );
|
||||
Analytics.getInstance().setAppKey( "6bbe7e0e1ecd8e2f8dc336e1678a2791" );
|
||||
|
||||
Reference in New Issue
Block a user