同步绘制小地图

This commit is contained in:
wangcongtao
2020-10-29 11:53:55 +08:00
parent 7d61298107
commit 9af06c7fc6
13 changed files with 122 additions and 38 deletions

View File

@@ -57,12 +57,22 @@ public class AbsMogoApplication extends Application {
public void onCreate() {
super.onCreate();
sApp = this;
initARouter();
if ( shouldInit() ) {
init();
}
}
protected boolean shouldInit(){
private void initARouter() {
ARouter.init( sApp );
// 初始化 arouter
if ( DebugConfig.isDebug() ) {
ARouter.openDebug();
ARouter.openLog();
}
}
protected boolean shouldInit() {
return true;
}
@@ -72,31 +82,25 @@ public class AbsMogoApplication extends Application {
}
private void syncInit() {
// 初始化 arouter
if ( DebugConfig.isDebug() ) {
ARouter.openDebug();
ARouter.openLog();
}
ARouter.init( sApp );
TipToast.init( this, ( ( context, message, tipDrawable ) -> {
if ( TextUtils.isEmpty( message ) ) {
return null;
}
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{
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());
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);
txt.setText( message );
}
return contentView;
} ) );
@@ -133,7 +137,7 @@ public class AbsMogoApplication extends Application {
} );
}
protected void asyncInitImpl(){
protected void asyncInitImpl() {
}