Search in sources :

Example 11 with MyMap

use of com.junjunguo.pocketmaps.model.MyMap in project PocketMaps by junjunguo.

the class MyMapAdapter method remove.

/**
 * remove item at the given position
 *
 * @param position
 */
public MyMap remove(int position) {
    MyMap mm = null;
    if (position >= 0 && position < getItemCount()) {
        mm = myMaps.remove(position);
        notifyItemRemoved(position);
    }
    return mm;
}
Also used : MyMap(com.junjunguo.pocketmaps.model.MyMap)

Example 12 with MyMap

use of com.junjunguo.pocketmaps.model.MyMap in project PocketMaps by junjunguo.

the class Variable method updateCloudMaps.

public void updateCloudMaps(List<MyMap> cloudMaps) {
    ArrayList<MyMap> newList = new ArrayList<MyMap>();
    for (MyMap oldMap : this.cloudMaps) {
        for (MyMap newMap : cloudMaps) {
            if (newMap.getUrl().equals(oldMap.getUrl())) {
                newMap.setStatus(oldMap.getStatus());
                break;
            }
        }
    }
    // Find same Map from CloudMaps
    for (MyMap newMap : cloudMaps) {
        int myIndex = Variable.getVariable().getCloudMaps().indexOf(newMap);
        if (myIndex < 0) {
            newList.add(newMap);
            continue;
        }
        MyMap sameMap = Variable.getVariable().getCloudMaps().get(myIndex);
        sameMap.set(newMap);
        newList.add(sameMap);
    }
    this.cloudMaps = newList;
}
Also used : MyMap(com.junjunguo.pocketmaps.model.MyMap) ArrayList(java.util.ArrayList) GeoPoint(org.oscim.core.GeoPoint)

Aggregations

MyMap (com.junjunguo.pocketmaps.model.MyMap)12 File (java.io.File)5 ActivityNotFoundException (android.content.ActivityNotFoundException)2 SetStatusBarColor (com.junjunguo.pocketmaps.util.SetStatusBarColor)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 JSONException (org.json.JSONException)2 DownloadManager (android.app.DownloadManager)1 Request (android.app.DownloadManager.Request)1 BroadcastReceiver (android.content.BroadcastReceiver)1 IntentFilter (android.content.IntentFilter)1 ActionBar (android.support.v7.app.ActionBar)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)1 TextView (android.widget.TextView)1 MapUnzip (com.junjunguo.pocketmaps.downloader.MapUnzip)1 FilenameFilter (java.io.FilenameFilter)1 URL (java.net.URL)1