80 lines
2.3 KiB
Java
80 lines
2.3 KiB
Java
|
package com.tengshisoft;
|
|||
|
|
|||
|
import android.app.Application;
|
|||
|
|
|||
|
import com.alibaba.android.arouter.launcher.ARouter;
|
|||
|
import com.baidu.location.BDLocation;
|
|||
|
import com.baidu.mapapi.CoordType;
|
|||
|
import com.baidu.mapapi.SDKInitializer;
|
|||
|
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
|
|||
|
import com.scwang.smartrefresh.layout.footer.ClassicsFooter;
|
|||
|
import com.sucstepsoft.cm_utils.core.widget.refresh.CustomRefreshHeader;
|
|||
|
|
|||
|
import androidx.multidex.MultiDex;
|
|||
|
import cn.jiguang.share.android.api.JShareInterface;
|
|||
|
import cn.leo.magic.screen.MagicScreenAdapter;
|
|||
|
|
|||
|
/**
|
|||
|
* 作者: adam
|
|||
|
* 日期: 2020/4/13 - 4:02 PM
|
|||
|
* 邮箱: itgaojian@163.com
|
|||
|
* 描述: Application--基类
|
|||
|
*/
|
|||
|
public class BaseMyApplication extends Application {
|
|||
|
private static boolean isLogin = false;
|
|||
|
|
|||
|
//static 代码段可以防止内存泄露
|
|||
|
static {
|
|||
|
//设置全局的Header构建器
|
|||
|
SmartRefreshLayout.setDefaultRefreshHeaderCreator((context, layout) -> new CustomRefreshHeader(context));
|
|||
|
//设置全局的Footer构建器
|
|||
|
SmartRefreshLayout.setDefaultRefreshFooterCreator((context, layout) -> new ClassicsFooter(context));
|
|||
|
}
|
|||
|
|
|||
|
@Override
|
|||
|
public void onCreate() {
|
|||
|
super.onCreate();
|
|||
|
MultiDex.install(this);
|
|||
|
// ARouter.openDebug();
|
|||
|
MagicScreenAdapter.initDesignWidthInDp(1024, true);
|
|||
|
ARouter.init(BaseMyApplication.this);
|
|||
|
initShare();
|
|||
|
initBaiduMap();
|
|||
|
}
|
|||
|
|
|||
|
private void initShare() {
|
|||
|
JShareInterface.init(this);
|
|||
|
JShareInterface.setDebugMode(false);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/**
|
|||
|
* 百度地图初始化
|
|||
|
*/
|
|||
|
private void initBaiduMap() {
|
|||
|
//自4.3.0起,百度地图SDK所有接口均支持百度坐标和国测局坐标,用此方法设置您使用的坐标类型.
|
|||
|
//包括BD09LL和GCJ02两种坐标,默认是BD09LL坐标。
|
|||
|
SDKInitializer.initialize(BaseMyApplication.this);
|
|||
|
SDKInitializer.setCoordType(CoordType.BD09LL);
|
|||
|
}
|
|||
|
|
|||
|
public static BDLocation mCurrentLocation;
|
|||
|
|
|||
|
|
|||
|
public static void setLocation(BDLocation location) {
|
|||
|
mCurrentLocation = location;
|
|||
|
}
|
|||
|
|
|||
|
public static BDLocation getCurrentLocation() {
|
|||
|
return mCurrentLocation;
|
|||
|
}
|
|||
|
|
|||
|
public static boolean getIsLoging() {
|
|||
|
return isLogin;
|
|||
|
}
|
|||
|
|
|||
|
public static void setLogin(boolean login) {
|
|||
|
isLogin = login;
|
|||
|
}
|
|||
|
}
|