2022-10-31 17:44:02 +08:00
|
|
|
|
package com.tengshisoft;
|
|
|
|
|
|
|
|
|
|
import android.app.Application;
|
2022-12-06 18:29:36 +08:00
|
|
|
|
import android.view.Gravity;
|
|
|
|
|
|
|
|
|
|
import androidx.multidex.MultiDex;
|
2022-10-31 17:44:02 +08:00
|
|
|
|
|
|
|
|
|
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;
|
2023-02-20 17:36:14 +08:00
|
|
|
|
import com.sucstepsoft.cm_utils.utils.UserLgUtils;
|
2022-12-06 18:29:36 +08:00
|
|
|
|
import com.sucstepsoft.cm_utils.utils.toast.ToastUtils;
|
2023-02-20 17:36:14 +08:00
|
|
|
|
import com.tengshisoft.cultural.R;
|
2022-10-31 17:44:02 +08:00
|
|
|
|
|
|
|
|
|
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);
|
2022-12-20 17:57:03 +08:00
|
|
|
|
ARouter.openDebug();
|
2022-10-31 17:44:02 +08:00
|
|
|
|
MagicScreenAdapter.initDesignWidthInDp(1024, true);
|
|
|
|
|
ARouter.init(BaseMyApplication.this);
|
|
|
|
|
initShare();
|
|
|
|
|
initBaiduMap();
|
2022-12-06 18:29:36 +08:00
|
|
|
|
|
|
|
|
|
ToastUtils.init(this);
|
|
|
|
|
ToastUtils.setGravity(Gravity.TOP, 0, 80);
|
2023-02-20 17:36:14 +08:00
|
|
|
|
getConfigCityCode();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void getConfigCityCode() {
|
2023-02-23 11:39:03 +08:00
|
|
|
|
UserLgUtils.setCurrentCityCode(this.getResources().getString(R.string.CITY_CODE));
|
|
|
|
|
UserLgUtils.setCurrentCity(this.getResources().getString(R.string.CITY_NAME));
|
|
|
|
|
UserLgUtils.setCurrentCityId(this.getResources().getString(R.string.CITY_ID));
|
2022-10-31 17:44:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|