Java Code Examples for com.baidu.mapapi.search.poi.PoiResult#getTotalPageNum()

The following examples show how to use com.baidu.mapapi.search.poi.PoiResult#getTotalPageNum() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SetFavoriteMapActivity.java    From AssistantBySDK with Apache License 2.0 5 votes vote down vote up
/**
 * Poi检索结果回调
 **/
@Override
public void onGetPoiResult(PoiResult result) {
    mAmosfPoiListBox.setRefreshing(false);
    if (result == null || result.error != SearchResult.ERRORNO.NO_ERROR) {
        // Toast.makeText(this, "搜索发生错误:" + result.error, Toast.LENGTH_LONG).show();
        Snackbar.make(mAmosfPoiList, SetFavoriteMapActivity.this.getResources().getString(R.string.navi_no_result), Snackbar.LENGTH_SHORT).show();
        mAmosfSearchEdit.setSearchCompletedState();
        return;
    }
    if (result.error == SearchResult.ERRORNO.NO_ERROR) {
        if (poiOverlay != null) {
            poiOverlay.removeFromMap();
        }
        if (poiOverlay == null || !(poiOverlay instanceof ConfirmPoiOverlay)) {
            poiOverlay = new ConfirmPoiOverlay(baiduMap);
            baiduMap.setOnMarkerClickListener(poiOverlay);
        }

        ((ConfirmPoiOverlay) poiOverlay).setData(result);
        poiOverlay.addToMap();

        totalPageNum = result.getTotalPageNum();
        /* 设置检索结果列表高度(手机屏幕的一半) */
        mAmosfPoiBox.getLayoutParams().height = ScreenUtil.getInstance().getHeightPixels() / 2;
        list.clear();
        list.addAll(result.getAllPoi());
        setAlist(list);
        mListAdapter.notifyDataSetChanged();
        mPagerAdapter.notifyDataSetChanged();
        mAmosfPoiDetailBox.setVisibility(View.GONE);
        mAmosfSinglePoiDetailBox.setVisibility(View.GONE);
        mAmosfPoiBox.setVisibility(View.VISIBLE);
        setPoiPosition();
        return;
    }
}
 
Example 2
Source File: NaviConfirmPointActivity.java    From AssistantBySDK with Apache License 2.0 5 votes vote down vote up
/**
 * poi搜索结果回调
 **/
@Override
public void onGetPoiResult(PoiResult result) {
    mAncpPoiListBox.setRefreshing(false);
    if (result == null || result.error != SearchResult.ERRORNO.NO_ERROR) {
        //Toast.makeText(this, "搜索发生错误:" + result.error, Toast.LENGTH_LONG).show();
        Snackbar.make(mAncpPoiDetailBox, NaviConfirmPointActivity.this.getResources().getString(R.string.navi_no_result), Snackbar.LENGTH_SHORT).show();

        return;
    }
    if (result.error == SearchResult.ERRORNO.NO_ERROR) {
        //创建PoiOverlay,添加搜索结果地点图层
        if (poiOverlay == null) {
            poiOverlay = new ConfirmPoiOverlay(baiduMap);
            baiduMap.setOnMarkerClickListener(poiOverlay);
        } else {
            poiOverlay.removeFromMap();
        }
        if (poiOverlay instanceof PoiOverlay) {
            ((PoiOverlay) poiOverlay).setData(result);
        }
        poiOverlay.addToMap();

        totalPageNum = result.getTotalPageNum();
        mAncpPoiBox.getLayoutParams().height = ScreenUtil.getInstance().getHeightPixels() / 2;
        list.clear();
        /* 填充数据 */
        list.addAll(result.getAllPoi());
        setAlist(list);
        /* 刷新视图 */
        mListAdapter.notifyDataSetChanged();
        mPagerAdapter.notifyDataSetChanged();
        if (firstPoiSearch) {
            firstPoiSearch = false;
            mAncpPoiBox.setVisibility(View.VISIBLE);
        }
        setPoiPosition();
    }
}
 
Example 3
Source File: TrafficShowPresenter.java    From AssistantBySDK with Apache License 2.0 4 votes vote down vote up
@Override
public void onGetPoiResult(PoiResult result) {
    Log.e(TAG, "onGetPoiResult>>" + result.error);
    mTrafficShowView.setRefreshLayout(false);
    if (result == null || result.error == SearchResult.ERRORNO.RESULT_NOT_FOUND) {
        //Toast.makeText(mContext, "搜索发生错误:" + result.error, Toast.LENGTH_LONG).show();
        mTrafficShowView.showSnackBar(mContext.getResources().getString(R.string.navi_no_result));
        mTrafficShowView.getedit().setSearchCompletedState();
        return;
    }
    if (result.error == SearchResult.ERRORNO.NO_ERROR) {
        //baiduMap.clear();
        if (poiOverlay != null) {
            /* 在地图上清楚覆盖物 */
            poiOverlay.removeFromMap();
        }
        if (poiOverlay == null || !(poiOverlay instanceof ConfirmPoiOverlay)) {
            poiOverlay = new ConfirmPoiOverlay(baiduMap);
            /* 设置覆盖物被点击事件 */
            baiduMap.setOnMarkerClickListener(poiOverlay);
        }

        ((ConfirmPoiOverlay) poiOverlay).setData(result);
        /* 将覆盖物添加到地图中 */
        poiOverlay.addToMap();
        setPoiPosition();

        totalPageNum = result.getTotalPageNum();
        mTrafficShowView.getPoiListBox().getLayoutParams().height = ScreenUtil.getInstance().getHeightPixels() / 2;
        poiInfoList.clear();
        poiInfoList.addAll(result.getAllPoi());
        setAlist();
        mListAdapter.notifyDataSetChanged();
        pagerAdapter.notifyDataSetChanged();
        mTrafficShowView.getPoiDetialBox().setVisibility(View.GONE);
        mTrafficShowView.getPoiListBox().setVisibility(View.VISIBLE);
        /*MapStatus.Builder builder=new MapStatus.Builder();
        builder.target(list.get(0).location)
                .targetScreen(new Point(ScreenUtil.getInstance().getWidthPixels()/2,ScreenUtil.getInstance().getHeightPixels()/4))
                .zoom(15F);
        baiduMap.setMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));*/
        return;
    }

}