| | |
| | | |
| | | import android.app.Application; |
| | | |
| | | import cn.com.basic.face.discern.common.CommonVariables; |
| | | import cn.com.basic.face.discern.entity.Device; |
| | | import cn.com.basic.face.discern.query.item.DeviceQueryItem; |
| | | import cn.com.basic.face.service.InternetAccessThread; |
| | | import cn.com.basic.face.service.DictionaryMng; |
| | | import cn.com.basic.face.service.DeviceMng; |
| | | |
| | | import com.facebook.drawee.backends.pipeline.Fresco; |
| | | import com.lzy.okhttputils.OkHttpUtils; |
| | |
| | | return application; |
| | | } |
| | | |
| | | private Device device; |
| | | private Device androidDevice; |
| | | private DeviceQueryItem camera1; |
| | | private DeviceQueryItem camera2; |
| | | |
| | | public void setDevice(Device device) { |
| | | this.device = device; |
| | | |
| | | public static boolean deviceAvailable = false; |
| | | |
| | | public void setAndroidDevice(Device device) { |
| | | this.androidDevice = device; |
| | | if (device != null && device.getDeviceId() != null && !"".equals(device.getDeviceId())) { |
| | | deviceAvailable = true; |
| | | DictionaryMng.getInstance().loadAllDictionaryData(); |
| | | } |
| | | } |
| | | |
| | | public Device getDevice() { |
| | | if (device == null) { |
| | | device = new Device(); |
| | | public void setCamera1(DeviceQueryItem camera1) { |
| | | this.camera1 = camera1; |
| | | if (camera1 != null && camera1.getDeviceId() != null && !"".equals(camera1.getDeviceId())) { |
| | | DictionaryMng.getInstance().loadAllDictionaryData(); |
| | | } |
| | | return device; |
| | | } |
| | | |
| | | public void setCamera2(DeviceQueryItem camera2) { |
| | | this.camera2 = camera2; |
| | | if (camera2 != null && camera2.getDeviceId() != null && !"".equals(camera2.getDeviceId())) { |
| | | DictionaryMng.getInstance().loadAllDictionaryData(); |
| | | } |
| | | } |
| | | |
| | | public Device getAndroidDevice() { |
| | | if (androidDevice == null) { |
| | | androidDevice = new Device(); |
| | | } |
| | | return androidDevice; |
| | | } |
| | | |
| | | @Override |
| | |
| | | Fresco.initialize(this); |
| | | initOkHttpUtils(); |
| | | application = this; |
| | | DeviceMng.getInstance().findDevice(); |
| | | DictionaryMng.getInstance().loadAllDictionaryData(); |
| | | } |
| | | |
| | | private void initOkHttpUtils() { |
| | |
| | | OkHttpUtils.init(this); |
| | | } |
| | | |
| | | |
| | | public boolean networkAvailable() { |
| | | // return false; |
| | | return MainActivity.getInstance().getInternetAccessible() == CommonVariables.InternetAccess.INTERNET_ACCESSIBLE; |
| | | } |
| | | } |