com.amap.api.maps.offlinemap.OfflineMapManager Java Examples

The following examples show how to use com.amap.api.maps.offlinemap.OfflineMapManager. 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: OfflineMapActivity_Old.java    From TraceByAmap with MIT License 6 votes vote down vote up
/**
 * 初始化UI布局文件
 */
private void init() {

	// 顶部
	mDownloadText = (TextView) findViewById(R.id.download_list_text);
	mDownloadedText = (TextView) findViewById(R.id.downloaded_list_text);

	mDownloadText.setOnClickListener(this);
	mDownloadedText.setOnClickListener(this);
	mBackImage = (ImageView) findViewById(R.id.back_image_view);
	mBackImage.setOnClickListener(this);

	// view pager 用到了所有城市list和已下载城市list所有放在最后初始化
	mContentViewPage = (ViewPager) findViewById(R.id.content_viewpage);

	
	//构造离线地图类
	amapManager = new OfflineMapManager(this, this);
	//离线地图初始化完成监听
	amapManager.setOnOfflineLoadedListener(this);
	initDialog();
}
 
Example #2
Source File: OfflineListAdapter.java    From TraceByAmap with MIT License 5 votes vote down vote up
public OfflineListAdapter(List<OfflineMapProvince> provinceList,
			HashMap<Object, List<OfflineMapCity>> cityMap,
			OfflineMapManager amapManager, Context mContext) {
		this.provinceList = provinceList;
//		this.cityMap = cityMap;
		this.amapManager = amapManager;
		this.mContext = mContext;
		
		isOpen = new boolean[provinceList.size()];
	}
 
Example #3
Source File: OfflineListAdapter.java    From TraceByAmap with MIT License 5 votes vote down vote up
public OfflineListAdapter(List<OfflineMapProvince> provinceList,
			OfflineMapManager amapManager, Context mContext) {
		this.provinceList = provinceList;
//		this.cityMap = cityMap;
		this.amapManager = amapManager;
		this.mContext = mContext;
		
		isOpen = new boolean[provinceList.size()];
	}
 
Example #4
Source File: OfflineDownloadedAdapter.java    From TraceByAmap with MIT License 5 votes vote down vote up
public OfflineDownloadedAdapter(Context context,
		OfflineMapManager offlineMapManager) {
	this.mContext = context;
	this.mOfflineMapManager = offlineMapManager;
	initCityList();

}
 
Example #5
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 #6
Source File: AmapDownloadMapFragment.java    From BmapLite with GNU General Public License v3.0 5 votes vote down vote up
private void getData() {
    amapManager = new OfflineMapManager(getActivity(), this);

    TimerTask task = new TimerTask() {
        @Override
        public void run() {
            handler.sendEmptyMessage(TIME_UP);
        }
    };

    timer = new Timer(true);
    timer.schedule(task, 1000, 1000);
}
 
Example #7
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 #8
Source File: AmapDownloadMapFragment.java    From BmapLite with Apache License 2.0 5 votes vote down vote up
private void getData() {
    amapManager = new OfflineMapManager(getActivity(), this);

    TimerTask task = new TimerTask() {
        @Override
        public void run() {
            handler.sendEmptyMessage(TIME_UP);
        }
    };

    timer = new Timer(true);
    timer.schedule(task, 1000, 1000);
}
 
Example #9
Source File: OfflineMapDownloadService.java    From Maps with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onDownload(int status, int completeCode, String name) {
    for (WeakReference<OfflineMapManager.OfflineMapDownloadListener> l : mOfflineMapDownloadListeners) {
        OfflineMapManager.OfflineMapDownloadListener listener = l.get();
        if (listener != null) {
            listener.onDownload(status, completeCode, name);
        }
    }
}
 
Example #10
Source File: OfflineChild.java    From TraceByAmap with MIT License 4 votes vote down vote up
public OfflineChild(Context context, OfflineMapManager offlineMapManager) {
	mContext = context;
	initView();
	amapManager = offlineMapManager;
	// mOfflineMapManager = new OfflineMapManager(mContext, this);
}
 
Example #11
Source File: OfflineMapDownloadService.java    From Maps with GNU General Public License v2.0 4 votes vote down vote up
public OfflineMapManagerWrapper(Context context) {
    mOfflineMapManager = new OfflineMapManager(context, this);
}
 
Example #12
Source File: OfflineMapDownloadService.java    From Maps with GNU General Public License v2.0 4 votes vote down vote up
public static OfflineMapManager getOfflineMapManager(Context context) {
    if (mOfflineMapManagerWrapper == null) {
        mOfflineMapManagerWrapper = new OfflineMapManagerWrapper(context);
    }
    return mOfflineMapManagerWrapper.mOfflineMapManager;
}
 
Example #13
Source File: OfflineMapDownloadService.java    From Maps with GNU General Public License v2.0 4 votes vote down vote up
public static synchronized void addOfflineMapDownloadListener(OfflineMapManager.OfflineMapDownloadListener l) {
    if (mOfflineMapManagerWrapper != null) {
        mOfflineMapManagerWrapper.mOfflineMapDownloadListeners.add(new WeakReference<>(l));
    }
}