com.baidu.mapapi.map.offline.MKOLSearchRecord Java Examples

The following examples show how to use com.baidu.mapapi.map.offline.MKOLSearchRecord. 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: OfflineMapFragment.java    From BmapLite with GNU General Public License v3.0 5 votes vote down vote up
private void getData() {
        mOffline = new MKOfflineMap();
        mOffline.init(this);

        amapManager = new OfflineMapManager(getActivity(), this);

//        try {
//            MapsInitializer.initialize(getActivity());
//            File dir = getActivity().getExternalFilesDir("amap");
//            if (!dir.exists()){
//                dir.mkdir();
//            }
//            MapsInitializer.sdcardDir = dir.getPath();
//        } catch (RemoteException e) {
//            e.printStackTrace();
//        }

        offlineCityList = mOffline.getOfflineCityList();

        if (null != offlineCityList && !offlineCityList.isEmpty()) {

            for (MKOLSearchRecord record : offlineCityList) {
                if (null == record.childCities || record.childCities.isEmpty()) {
                    ArrayList<MKOLSearchRecord> child = new ArrayList<>();
                    child.add(record);
                    record.childCities = child;
                }
                if (1 == record.cityType) {
                    record.childCities.add(0, record);
                }

            }


            mOfflineCityExpandAdapter = new OfflineCityExpandAdapter(getActivity(), offlineCityList);
            mExpandListCity.setAdapter(mOfflineCityExpandAdapter);
        }

    }
 
Example #2
Source File: OfflineMapFragment.java    From BmapLite with Apache License 2.0 5 votes vote down vote up
private void getData() {
        mOffline = new MKOfflineMap();
        mOffline.init(this);

        amapManager = new OfflineMapManager(getActivity(), this);

//        try {
//            MapsInitializer.initialize(getActivity());
//            File dir = getActivity().getExternalFilesDir("amap");
//            if (!dir.exists()){
//                dir.mkdir();
//            }
//            MapsInitializer.sdcardDir = dir.getPath();
//        } catch (RemoteException e) {
//            e.printStackTrace();
//        }

        offlineCityList = mOffline.getOfflineCityList();

        if (null != offlineCityList && !offlineCityList.isEmpty()) {

            for (MKOLSearchRecord record : offlineCityList) {
                if (null == record.childCities || record.childCities.isEmpty()) {
                    ArrayList<MKOLSearchRecord> child = new ArrayList<>();
                    child.add(record);
                    record.childCities = child;
                }
                if (1 == record.cityType) {
                    record.childCities.add(0, record);
                }

            }


            mOfflineCityExpandAdapter = new OfflineCityExpandAdapter(getActivity(), offlineCityList);
            mExpandListCity.setAdapter(mOfflineCityExpandAdapter);
        }

    }
 
Example #3
Source File: DownloadActivity.java    From BaiduMap-TrafficAssistant with MIT License 5 votes vote down vote up
/**
 * 搜索离线城市
 * 
 * @param view
 */
public void search(View view) {
	ArrayList<MKOLSearchRecord> records = mOffline.searchCity(selectedCity);
	if (records == null || records.size() != 1)
		return;
	mOffline.start(records.get(0).cityID);
	Toast.makeText(context, "开始下载离线地图. 城市名称: " + records.get(0).cityName,
			Toast.LENGTH_SHORT).show();
	updateView();
}
 
Example #4
Source File: OfflineCityExpandAdapter.java    From BmapLite with GNU General Public License v3.0 4 votes vote down vote up
public OfflineCityExpandAdapter(Context context, List<MKOLSearchRecord> list) {
    super(context, list);
}
 
Example #5
Source File: OfflineCityExpandAdapter.java    From BmapLite with Apache License 2.0 4 votes vote down vote up
public OfflineCityExpandAdapter(Context context, List<MKOLSearchRecord> list) {
    super(context, list);
}