Fix search by name
This commit is contained in:
parent
b5975af3a9
commit
68806ded9e
5 changed files with 80 additions and 2 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,5 +1,6 @@
|
||||||
*.render.xml
|
*.render.xml
|
||||||
*.render_template.xml
|
*.render_template.xml
|
||||||
|
poi_types.xml
|
||||||
*.map_styles_presets.xml
|
*.map_styles_presets.xml
|
||||||
routing*.xml
|
routing*.xml
|
||||||
rendering_types.xml
|
rendering_types.xml
|
||||||
|
|
|
@ -43,6 +43,9 @@
|
||||||
<fileset dir="../../resources/obf_creation/">
|
<fileset dir="../../resources/obf_creation/">
|
||||||
<include name="rendering_types.xml" />
|
<include name="rendering_types.xml" />
|
||||||
</fileset>
|
</fileset>
|
||||||
|
<fileset dir="../../resources/poi/">
|
||||||
|
<include name="poi_types.xml" />
|
||||||
|
</fileset>
|
||||||
</copy>
|
</copy>
|
||||||
<copy todir="${src.absolute.dir}/net/osmand/map/">
|
<copy todir="${src.absolute.dir}/net/osmand/map/">
|
||||||
<fileset dir="../../resources/countries-info/">
|
<fileset dir="../../resources/countries-info/">
|
||||||
|
|
72
OsmAnd-java/src/net/osmand/osm/MapPoiTypes.java
Normal file
72
OsmAnd-java/src/net/osmand/osm/MapPoiTypes.java
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
package net.osmand.osm;
|
||||||
|
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import net.osmand.PlatformUtil;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
|
import org.xmlpull.v1.XmlPullParserException;
|
||||||
|
|
||||||
|
public class MapPoiTypes {
|
||||||
|
private static MapPoiTypes DEFAULT_INSTANCE = null;
|
||||||
|
private static final Log log = PlatformUtil.getLog(MapRenderingTypes.class);
|
||||||
|
private String resourceName;
|
||||||
|
|
||||||
|
public MapPoiTypes(String fileName){
|
||||||
|
this.resourceName = fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MapPoiTypes getDefault() {
|
||||||
|
if(DEFAULT_INSTANCE == null){
|
||||||
|
DEFAULT_INSTANCE = new MapPoiTypes(null);
|
||||||
|
}
|
||||||
|
return DEFAULT_INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void init(){
|
||||||
|
InputStream is;
|
||||||
|
try {
|
||||||
|
if(resourceName == null){
|
||||||
|
is = MapRenderingTypes.class.getResourceAsStream("poi_types.xml"); //$NON-NLS-1$
|
||||||
|
} else {
|
||||||
|
is = new FileInputStream(resourceName);
|
||||||
|
}
|
||||||
|
long time = System.currentTimeMillis();
|
||||||
|
XmlPullParser parser = PlatformUtil.newXMLPullParser();
|
||||||
|
int tok;
|
||||||
|
parser.setInput(is, "UTF-8");
|
||||||
|
String parentCategory = null;
|
||||||
|
String poiParentCategory = null;
|
||||||
|
String poiParentPrefix = null;
|
||||||
|
String order = null;
|
||||||
|
while ((tok = parser.next()) != XmlPullParser.END_DOCUMENT) {
|
||||||
|
if (tok == XmlPullParser.START_TAG) {
|
||||||
|
String name = parser.getName();
|
||||||
|
if (name.equals("category")) { //$NON-NLS-1$
|
||||||
|
parentCategory = parser.getAttributeValue("","name");
|
||||||
|
poiParentCategory = parser.getAttributeValue("","poi_category");
|
||||||
|
poiParentPrefix = parser.getAttributeValue("","poi_prefix");
|
||||||
|
order = parser.getAttributeValue("","order");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.info("Time to init " + (System.currentTimeMillis() - time)); //$NON-NLS-1$
|
||||||
|
is.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("Unexpected error", e); //$NON-NLS-1$
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
log.error("Unexpected error", e); //$NON-NLS-1$
|
||||||
|
e.printStackTrace();
|
||||||
|
throw e;
|
||||||
|
} catch (XmlPullParserException e) {
|
||||||
|
log.error("Unexpected error", e); //$NON-NLS-1$
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -97,6 +97,9 @@
|
||||||
<fileset dir="../../resources/obf_creation/">
|
<fileset dir="../../resources/obf_creation/">
|
||||||
<include name="rendering_types.xml" />
|
<include name="rendering_types.xml" />
|
||||||
</fileset>
|
</fileset>
|
||||||
|
<fileset dir="../../resources/poi/">
|
||||||
|
<include name="poi_types.xml" />
|
||||||
|
</fileset>
|
||||||
</copy>
|
</copy>
|
||||||
<copy todir="${src.absolute.dir}/net/osmand/map/">
|
<copy todir="${src.absolute.dir}/net/osmand/map/">
|
||||||
<fileset dir="../../resources/countries-info/">
|
<fileset dir="../../resources/countries-info/">
|
||||||
|
|
|
@ -27,8 +27,7 @@
|
||||||
android:id="@+id/SearchText"
|
android:id="@+id/SearchText"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"/>
|
||||||
android:inputType="number" />
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/ResetButton"
|
android:id="@+id/ResetButton"
|
||||||
|
|
Loading…
Reference in a new issue