Exemplo n.º 1
0
 @Override
 protected void onPostExecute(PoiPagedResult result) {
   // TODO Auto-generated method stub
   super.onPostExecute(result);
   View parent = null;
   switch (type) {
     case HANDLER_SEARCH_START:
       if (!param.equals(startText.getText().toString())) {
         return;
       }
       mHandler.sendEmptyMessage(HANDLER_SEARCH_START_HIDE_PROGRESSBAR);
       parent = startText;
       break;
     case HANDLER_SEARCH_END:
       if (!param.equals(endText.getText().toString())) {
         return;
       }
       mHandler.sendEmptyMessage(HANDLER_SEARCH_END_HIDE_PROGRESSBAR);
       parent = endText;
       break;
     default:
       break;
   }
   if (result == null) {
     mHandler.sendEmptyMessage(HANDLER_SEARCH_ROUTE_ERROR);
   } else {
     // TODO
     if (result.getPageCount() > 0) {
       if (resulePopupWindow == null) initPopuWindow();
       try {
         List<PoiItem> poiItems = result.getPage(1);
         List<PointBean> datas = new ArrayList<PointBean>();
         for (int i = 0; i < poiItems.size(); i++) {
           if (i == 10) break;
           PoiItem item = poiItems.get(i);
           PointBean bean = new PointBean();
           bean.setName(item.getTitle());
           bean.setAddress(item.getSnippet());
           bean.setPoint(item.getPoint());
           datas.add(bean);
         }
         resultAdapter.setDataAndType(datas, type);
         resultAdapter.notifyDataSetChanged();
         if (!resulePopupWindow.isShowing()) {
           popupWindwShowing(parent);
         }
       } catch (MapAbcException e) {
         // #debug debug
         e.printStackTrace();
       }
     }
   }
 }
Exemplo n.º 2
0
 @Override
 protected List<Route> doInBackground(GeoPoint... params) {
   // mHandler.sendEmptyMessage(HANDLER_SEARCH_ROUTE_SHOW_PROGRESSBAR);
   Route.FromAndTo fromAndTo = new Route.FromAndTo(params[0], params[1]);
   List<Route> result = null;
   try {
     result =
         Route.calculateRoute(
             RouteActivity.this, getString(R.string.maps_api_key), fromAndTo, mode);
   } catch (MapAbcException e) {
     // #debug debug
     e.printStackTrace();
   }
   return result;
 }
Exemplo n.º 3
0
 @Override
 protected PoiPagedResult doInBackground(String... params) {
   switch (type) {
     case HANDLER_SEARCH_START:
       mHandler.sendEmptyMessage(HANDLER_SEARCH_START_SHOW_PROGRESSBAR);
       break;
     case HANDLER_SEARCH_END:
       mHandler.sendEmptyMessage(HANDLER_SEARCH_END_SHOW_PROGRESSBAR);
       break;
     default:
       break;
   }
   Query startQuery = new Query(param = params[0], PoiTypeDef.All, Const.citycode);
   PoiSearch poiSearch = new PoiSearch(RouteActivity.this, Const.MAP_API_KEY, startQuery);
   poiSearch.setPoiNumber(10);
   PoiPagedResult result = null;
   try {
     result = poiSearch.searchPOI();
   } catch (MapAbcException e) {
     // #debug debug
     e.printStackTrace();
   }
   return result;
 }