forked from organicmaps/organicmaps
[android] Skip description metadata processing.
Signed-off-by: Viktor Govako <viktor.govako@gmail.com>
This commit is contained in:
parent
71de1db197
commit
5e2771f457
3 changed files with 20 additions and 8 deletions
|
@ -9,7 +9,7 @@ namespace usermark_helper
|
|||
{
|
||||
using feature::Metadata;
|
||||
|
||||
void InjectMetadata(JNIEnv * env, jclass const clazz, jobject const mapObject, feature::Metadata const & metadata)
|
||||
void InjectMetadata(JNIEnv * env, jclass const clazz, jobject const mapObject, Metadata const & metadata)
|
||||
{
|
||||
static jmethodID const addId = env->GetMethodID(clazz, "addMetadata", "(ILjava/lang/String;)V");
|
||||
ASSERT(addId, ());
|
||||
|
@ -17,10 +17,20 @@ void InjectMetadata(JNIEnv * env, jclass const clazz, jobject const mapObject, f
|
|||
for (auto const t : metadata.GetPresentTypes())
|
||||
{
|
||||
// TODO: It is not a good idea to pass raw strings to UI. Calling separate getters should be a better way.
|
||||
jni::TScopedLocalRef metaString(env, t == feature::Metadata::FMD_WIKIPEDIA ?
|
||||
jni::ToJavaString(env, metadata.GetWikiURL()) :
|
||||
jni::ToJavaString(env, metadata.Get(t)));
|
||||
env->CallVoidMethod(mapObject, addId, t, metaString.get());
|
||||
|
||||
std::string meta;
|
||||
switch (t)
|
||||
{
|
||||
case Metadata::FMD_WIKIPEDIA: meta = metadata.GetWikiURL(); break;
|
||||
case Metadata::FMD_DESCRIPTION: break;
|
||||
default: meta = metadata.Get(t); break;
|
||||
}
|
||||
|
||||
if (!meta.empty())
|
||||
{
|
||||
jni::TScopedLocalRef metaString(env, jni::ToJavaString(env, meta));
|
||||
env->CallVoidMethod(mapObject, addId, t, metaString.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,8 @@ public class Metadata implements Parcelable
|
|||
// Values must correspond to definitions from feature_meta.hpp.
|
||||
public enum MetadataType
|
||||
{
|
||||
FMD_CUISINE(1),
|
||||
// Defined by classifier types now.
|
||||
//FMD_CUISINE = 1,
|
||||
FMD_OPEN_HOURS(2),
|
||||
FMD_PHONE_NUMBER(3),
|
||||
FMD_FAX_NUMBER(4),
|
||||
|
@ -32,7 +33,8 @@ public class Metadata implements Parcelable
|
|||
FMD_POSTCODE(15),
|
||||
// TODO: It is hacked in jni and returns full Wikipedia url. Should use separate getter instead.
|
||||
FMD_WIKIPEDIA(16),
|
||||
// FMD_MAXSPEED(17),
|
||||
// TODO: Skipped now.
|
||||
FMD_DESCRIPTION(17),
|
||||
FMD_FLATS(18),
|
||||
FMD_HEIGHT(19),
|
||||
FMD_MIN_HEIGHT(20),
|
||||
|
|
|
@ -106,7 +106,7 @@ class Metadata : public MetadataBase
|
|||
public:
|
||||
/// @note! Do not change values here.
|
||||
/// Add new types to the end of list, before FMD_COUNT.
|
||||
/// Add new types to the corresponding list in Java.
|
||||
/// Add new types to the corresponding list in android/.../Metadata.java.
|
||||
/// Add new types to the corresponding list in generator/pygen/pygen.cpp.
|
||||
/// For types parsed from OSM get corresponding OSM tag to MetadataTagProcessor::TypeFromString().
|
||||
enum EType : int8_t
|
||||
|
|
Loading…
Add table
Reference in a new issue