Ejemplo n.º 1
0
 @Override
 public void onResponse(int requestCode, String data) {
   dismissDialog();
   try {
     String resultData =
         replaceSpecialtyStr(new String(data.getBytes("ISO-8859-1"), "GBK"), null, "");
     if (requestCode == Constants.GET_CAR_BUSINESS) {
       JsonUtil<List<BusinessInfo>> jsonUtil = new JsonUtil<List<BusinessInfo>>();
       RequestResult<List<BusinessInfo>> requestResult =
           jsonUtil.json2Obj(
               resultData, new TypeReference<RequestResult<List<BusinessInfo>>>() {});
       if (requestResult != null) {
         switch (requestResult.getMsg().getResultCode()) {
           case 200:
             List<BusinessInfo> businessInfoList = requestResult.getData();
             if (mapFragment == null) {
               mapFragment = (MapFragment) getSupportFragmentManager().findFragmentByTag(MAP_TAG);
             }
             mapFragment.addMarkersToMap(businessInfoList);
             mapFragment.addBusinessInfo(businessInfoList);
             break;
           case 400:
             T.showShort(this, new String(requestResult.getMsg().getMessage()));
             break;
         }
       }
     }
     L.d(resultData);
   } catch (UnsupportedEncodingException e) {
     e.printStackTrace();
   }
 }
Ejemplo n.º 2
0
 // 显示或隐藏地图
 private void showOrHiddenMap() {
   if (mapFragment == null) {
     mapFragment = (MapFragment) getSupportFragmentManager().findFragmentByTag(MAP_TAG);
   }
   if (!mapFragment.showOrHiddenMap()) {
     T.showShort(this, "地图尚未加载完成");
   }
 }
Ejemplo n.º 3
0
 @Override
 public void onBackPressed() {
   if (System.currentTimeMillis() - temp > 2000) {
     T.showShort(this, R.string.press_again_exit);
     temp = System.currentTimeMillis();
   } else {
     this.finish();
     System.exit(0);
   }
 }
Ejemplo n.º 4
0
 @Override
 public void onErrorResponse(int requestCode, String error) {
   dismissDialog();
   T.showShort(this, error);
   L.d(error);
 }