@Override public void run() { Looper.prepare(); while (bool_thread) { try { Log.i("check_time", check_time); Thread.sleep(Integer.parseInt(check_time) * 60000); if (Utils.isNetworkAvailable(BaseActivity.this)) { List<ExpressModel> list = finalDb.findAllByWhere(ExpressModel.class, "IsDownLoad=0"); list.size(); for (ExpressModel e : list) { ImageObject[] imgs = new ImageObject[3]; ImageObject imageObject1 = new ImageObject(); imageObject1.setImageId("ConsignIdentityImageId"); if (!VikiccUtils.isEmptyString(e.getConsignIdentityImageId())) { imageObject1.setImageData( Utils.getBitmapFromByte( Base64.decode(e.getConsignIdentityImageId(), Base64.DEFAULT))); } ImageObject imageObject2 = new ImageObject(); imageObject2.setImageId("GoodsImageId"); imageObject2.setImageData( Utils.getBitmapFromByte(Base64.decode(e.getGoodsImageId(), Base64.DEFAULT))); ImageObject imageObject3 = new ImageObject(); imageObject3.setImageId("OrderImageId"); imageObject3.setImageData( Utils.getBitmapFromByte(Base64.decode(e.getOrderImageId(), Base64.DEFAULT))); // if // (!VikiccUtils.isEmptyString(e.getConsignIdentityImageId())) { // // imageObject1.setImageData(Utils.getBitmapFromByte(e.getConsignIdentityImageId().getBytes())); // } // // imageObject2.setImageData(Utils.getBitmapFromByte(e.getGoodsImageId().getBytes())); // // imageObject3.setImageData(Utils.getBitmapFromByte(e.getOrderImageId().getBytes())); imgs[0] = imageObject1; imgs[1] = imageObject2; imgs[2] = imageObject3; e.setImages(imgs); AddExpress(e); } } Message message = new Message(); message.what = 1; handler.sendMessage(message); // 发送消息 } catch (InterruptedException e) { e.printStackTrace(); } } Looper.loop(); }
public HttpModel getHttpModel() { if (finalDb.findAll(TerminalModel.class).size() > 0) { mobileConfigModel = finalDb.findAll(TerminalModel.class).get(0); mIp = mobileConfigModel.getTerminalIP(); mPort = mobileConfigModel.getTerminalCount(); } mSessionId = VikiccUtils.ReadString(this, VikiccUtils.KEY_SESSIONID); mUserId = "Admin"; try { mPassword = Utils.hashPassword("1"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } // mIp = VikiccUtils.ReadString(this, KeyModel.KEY_IP); // mPort = VikiccUtils.ReadString(this, KeyModel.KEY_PORT); if (!VikiccUtils.isEmptyString(mSessionId)) { httpModel.setSessionId(mSessionId); } if (!VikiccUtils.isEmptyString(mUserId)) { httpModel.setUserId(mUserId); } if (!VikiccUtils.isEmptyString(mPassword)) { httpModel.setPassword(mPassword); } if (!VikiccUtils.isEmptyString(mIp)) { if (!VikiccUtils.isEmptyString(mPort)) { httpModel.setURL("http://" + mIp + ":" + mPort + "/Service/Index.aspx"); } else { httpModel.setURL(mIp); } } return httpModel; }
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.i("----------------", "onCreate"); finalDb = FinalDb.create(BaseActivity.this); vUtils = new VikiccUtils(); httpUtil = new HttpUtil(); httpModel = new HttpModel(); cvrManager = new CvrManager(); check_time = VikiccUtils.ReadString(getBaseContext(), VikiccUtils.CHECK_UPLOAD_TIME); if (check_time == "") { check_time = "5"; } else { check_time = check_time.replaceAll("分", ""); } initViews(); StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); initEvents(); }