commit
9ef2f74f0c
2 changed files with 44 additions and 3 deletions
|
@ -11,6 +11,9 @@ import net.osmand.util.MapUtils;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class OpenstreetmapLocalUtil implements OpenstreetmapUtil {
|
public class OpenstreetmapLocalUtil implements OpenstreetmapUtil {
|
||||||
|
|
||||||
public final static Log LOG = PlatformUtil.getLog(OpenstreetmapLocalUtil.class);
|
public final static Log LOG = PlatformUtil.getLog(OpenstreetmapLocalUtil.class);
|
||||||
|
@ -21,6 +24,18 @@ public class OpenstreetmapLocalUtil implements OpenstreetmapUtil {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<OnNodeCommittedListener> listeners = new ArrayList<>();
|
||||||
|
|
||||||
|
public void addNodeCommittedListener(OnNodeCommittedListener listener) {
|
||||||
|
if (!listeners.contains(listener)) {
|
||||||
|
listeners.add(listener);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeNodeCommittedListener(OnNodeCommittedListener listener) {
|
||||||
|
listeners.remove(listener);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityInfo getEntityInfo(long id) {
|
public EntityInfo getEntityInfo(long id) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -41,6 +56,9 @@ public class OpenstreetmapLocalUtil implements OpenstreetmapUtil {
|
||||||
} else {
|
} else {
|
||||||
plugin.getDBPOI().addOpenstreetmap(p);
|
plugin.getDBPOI().addOpenstreetmap(p);
|
||||||
}
|
}
|
||||||
|
for (OnNodeCommittedListener listener : listeners) {
|
||||||
|
listener.onNoteCommitted();
|
||||||
|
}
|
||||||
return newNode;
|
return newNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,4 +97,8 @@ public class OpenstreetmapLocalUtil implements OpenstreetmapUtil {
|
||||||
public void closeChangeSet() {
|
public void closeChangeSet() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface OnNodeCommittedListener {
|
||||||
|
void onNoteCommitted();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class OsmEditsFragment extends OsmAndListFragment
|
public class OsmEditsFragment extends OsmAndListFragment
|
||||||
implements SendPoiDialogFragment.ProgressDialogPoiUploader {
|
implements SendPoiDialogFragment.ProgressDialogPoiUploader, OpenstreetmapLocalUtil.OnNodeCommittedListener {
|
||||||
OsmEditingPlugin plugin;
|
OsmEditingPlugin plugin;
|
||||||
|
|
||||||
private OsmEditsAdapter listAdapter;
|
private OsmEditsAdapter listAdapter;
|
||||||
|
@ -98,9 +98,15 @@ public class OsmEditsFragment extends OsmAndListFragment
|
||||||
updateSelectionTitle(actionMode);
|
updateSelectionTitle(actionMode);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
plugin.getPoiModificationLocalUtil().addNodeCommittedListener(this);
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroyView() {
|
||||||
|
plugin.getPoiModificationLocalUtil().removeNodeCommittedListener(this);
|
||||||
|
super.onDestroyView();
|
||||||
|
}
|
||||||
|
|
||||||
public android.widget.ArrayAdapter<?> getAdapter() {
|
public android.widget.ArrayAdapter<?> getAdapter() {
|
||||||
return listAdapter;
|
return listAdapter;
|
||||||
|
@ -323,6 +329,10 @@ public class OsmEditsFragment extends OsmAndListFragment
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
fetchData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fetchData() {
|
||||||
ArrayList<OsmPoint> dataPoints = new ArrayList<>();
|
ArrayList<OsmPoint> dataPoints = new ArrayList<>();
|
||||||
List<OpenstreetmapPoint> l1 = plugin.getDBPOI().getOpenstreetmapPoints();
|
List<OpenstreetmapPoint> l1 = plugin.getDBPOI().getOpenstreetmapPoints();
|
||||||
List<OsmNotesPoint> l2 = plugin.getDBBug().getOsmbugsPoints();
|
List<OsmNotesPoint> l2 = plugin.getDBBug().getOsmbugsPoints();
|
||||||
|
@ -351,7 +361,6 @@ public class OsmEditsFragment extends OsmAndListFragment
|
||||||
} else {
|
} else {
|
||||||
listAdapter.setNewList(dataPoints);
|
listAdapter.setNewList(dataPoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showBugDialog(final OsmNotesPoint point) {
|
private void showBugDialog(final OsmNotesPoint point) {
|
||||||
|
@ -406,6 +415,16 @@ public class OsmEditsFragment extends OsmAndListFragment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNoteCommitted() {
|
||||||
|
getMyApplication().runInUIThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
fetchData();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
protected class OsmEditsAdapter extends ArrayAdapter<OsmPoint> {
|
protected class OsmEditsAdapter extends ArrayAdapter<OsmPoint> {
|
||||||
private List<OsmPoint> dataPoints;
|
private List<OsmPoint> dataPoints;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue