This commit is contained in:
wangcongtao
2020-10-22 14:17:12 +08:00
1425 changed files with 31249 additions and 12020 deletions

View File

@@ -4,6 +4,8 @@ import android.app.Application;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.alibaba.android.arouter.launcher.ARouter;
@@ -17,6 +19,7 @@ import com.mogo.commons.network.ParamsUtil;
import com.mogo.commons.network.X509TrustManagerImpl;
import com.mogo.commons.storage.SpStorage;
import com.mogo.utils.ThreadPoolService;
import com.mogo.utils.TipDrawable;
import com.mogo.utils.TipToast;
import com.mogo.utils.network.NetConfig;
import com.mogo.utils.storage.SharedPrefsMgr;
@@ -54,7 +57,13 @@ public class AbsMogoApplication extends Application {
public void onCreate() {
super.onCreate();
sApp = this;
init();
if ( shouldInit() ) {
init();
}
}
protected boolean shouldInit(){
return true;
}
protected void init() {
@@ -69,13 +78,26 @@ public class AbsMogoApplication extends Application {
ARouter.openLog();
}
ARouter.init( sApp );
TipToast.init( this, ( ( context, message ) -> {
TipToast.init( this, ( ( context, message, tipDrawable ) -> {
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 );
View contentView;
if(tipDrawable==null) {
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);
}else{
// 有图片,使用带图片的布局,当前只实现了左侧图片
contentView = LayoutInflater.from(context).inflate(R.layout.module_commons_layout_toast_with_left_drawable, null);
TextView txt = contentView.findViewById(R.id.module_commons_toast_msg);
ImageView img = contentView.findViewById(R.id.module_commons_toast_left_drawable);
img.setImageDrawable(tipDrawable.getDrawable());
ViewGroup.LayoutParams params = img.getLayoutParams();
params.width = tipDrawable.getWidth();
params.height = tipDrawable.getHeight();
txt.setText(message);
}
return contentView;
} ) );
DebugConfig.setUseCustomMap( SharedPrefsMgr.getInstance( this ).getBoolean( "useCustomMap", false ) );