| | |
| | | */ |
| | | |
| | | public class CommonApplication extends Application { |
| | | // private final String ROOTURL="http://106.14.187.51:8801/supervision/"; |
| | | public final String ROOT_URL ="http://192.168.0.200:8080/"; |
| | | public final String ROOT_URL_IMAGE ="http://192.168.0.200:8080/images/"; |
| | | // public final String ROOT_URL ="http://192.168.0.200:8080/"; |
| | | // public final String ROOT_URL_IMAGE ="http://192.168.0.200:8080/images/"; |
| | | public final String ROOT_URL ="http://192.168.0.146:8080/"; |
| | | public final String ROOT_URL_IMAGE ="http://192.168.0.146:8080/images/"; |
| | | public final String ROOT_URL_RELEASE = "http://47.100.191.150:9005/"; |
| | | public final String ROOT_URL_RELEASE_IMAGE = "http://47.100.191.150:9005/images/"; |
| | | private Retrofit retrofit; |
| | | private Retrofit retrofitImage; |
| | | private DaoSession daoSession; |
| | | private Userinfo currentUser; |
| | | private boolean debugMode = false; |
| | | private boolean released = true; |
| | | private UserinfoDao userinfoDao; |
| | | private final boolean released = true; |
| | | //在程序打开时联网获取预置数据 |
| | | private boolean loadPreDataWhenOpen = true; |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 2018.11.07 by riku 获取数据传输接口调用的根地址 |
| | | * @return |
| | | * 获取数据传输接口调用的根地址 |
| | | */ |
| | | public Retrofit getRetrofit(){ |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 2018.11.07 by riku 获取图片传输接口调用的根地址 |
| | | * @return |
| | | * 获取图片传输接口调用的根地址 |
| | | */ |
| | | public Retrofit getRetrofitImage(){ |
| | | |
| | |
| | | |
| | | /** |
| | | * 获取数据库Session |
| | | * @return |
| | | */ |
| | | public DaoSession getDaoSession() { |
| | | if (daoSession ==null) { |
| | | File path = new File(Environment.getExternalStorageDirectory(), "FlightFeather/third_new.db"); |
| | | if(!path.exists()) |
| | | path.getParentFile().mkdirs(); |
| | | |
| | | //创建数据库shop.db" |
| | | DaoMaster.DevOpenHelper helper = new DaoMaster.DevOpenHelper(getApplicationContext(), path.getAbsolutePath(), null); |
| | | //获取可写数据库 |
| | |
| | | return daoSession; |
| | | } |
| | | |
| | | public boolean isDebugMode() { |
| | | return debugMode; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 2018.11.07 by riku 获取当前用户对象 |
| | | * @return |
| | | * 获取当前用户对象 |
| | | */ |
| | | public Userinfo getCurrentUser() { |
| | | if (currentUser ==null){ |
| | | userinfoDao = this.getDaoSession().getUserinfoDao(); |
| | | String userId = GlobalConfig.Companion.getInstance().getUserId(); |
| | | if (userId == null) { |
| | | UserinfoDao userinfoDao = this.getDaoSession().getUserinfoDao(); |
| | | String userId = GlobalConfig.getInstance().getUserId(); |
| | | if (userId.equals(GlobalConfig.DEFAULT_USER)) { |
| | | currentUser = userinfoDao.queryBuilder().unique(); |
| | | } else { |
| | | currentUser = userinfoDao.queryBuilder().where(UserinfoDao.Properties.Guid.eq(userId)).unique(); |
| | |
| | | } |
| | | |
| | | public void setCurrentUser(Userinfo currentUser) { |
| | | GlobalConfig.Companion.getInstance().setUserId(currentUser.getGuid()); |
| | | GlobalConfig.getInstance().setUserId(currentUser.getGuid()); |
| | | this.currentUser = currentUser; |
| | | } |
| | | |
| | | /** |
| | | * 2018.11.07 by riku app启动时判断是否加载初始化数据完成 |
| | | * @return |
| | | * app启动时判断是否加载初始化数据完成 |
| | | */ |
| | | public boolean isLoadPreDataWhenOpen() { |
| | | return loadPreDataWhenOpen; |