diff --git a/android/jni/com/mapswithme/maps/editor/Editor.cpp b/android/jni/com/mapswithme/maps/editor/Editor.cpp index e5a59d29e6..b466601709 100644 --- a/android/jni/com/mapswithme/maps/editor/Editor.cpp +++ b/android/jni/com/mapswithme/maps/editor/Editor.cpp @@ -261,14 +261,14 @@ Java_com_mapswithme_maps_editor_Editor_nativeShouldShowAddBusiness(JNIEnv *, jcl } JNIEXPORT jintArray JNICALL -Java_com_mapswithme_maps_editor_Editor_nativeGetEditableFields(JNIEnv * env, jclass clazz) +Java_com_mapswithme_maps_editor_Editor_nativeGetEditableProperties(JNIEnv * env, jclass clazz) { - auto const & editable = g_editableMapObject.GetEditableFields(); + auto const & editable = g_editableMapObject.GetEditableProperties(); size_t const size = editable.size(); jintArray jEditableFields = env->NewIntArray(static_cast(size)); jint * arr = env->GetIntArrayElements(jEditableFields, 0); for (size_t i = 0; i < size; ++i) - arr[i] = editable[i]; + arr[i] = base::Underlying(editable[i]); env->ReleaseIntArrayElements(jEditableFields, arr, 0); return jEditableFields; diff --git a/android/res/layout/fragment_editor.xml b/android/res/layout/fragment_editor.xml index a97a0a7d42..fd75a0617f 100644 --- a/android/res/layout/fragment_editor.xml +++ b/android/res/layout/fragment_editor.xml @@ -158,7 +158,7 @@ mMetaBlocks = new SparseArray<>(7); + private final SparseArray mDetailsBlocks = new SparseArray<>(7); private TextView mReset; private EditorHostFragment mParent; @@ -312,27 +312,27 @@ public class EditorFragment extends BaseMwmFragment implements View.OnClickListe UiUtils.showIf(Editor.nativeIsAddressEditable(), mCardAddress); UiUtils.showIf(Editor.nativeIsBuilding() && !Editor.nativeIsPointType(), mBlockLevels); - final int[] editableMeta = Editor.nativeGetEditableFields(); - if (editableMeta.length == 0) + final int[] editableDetails = Editor.nativeGetEditableProperties(); + if (editableDetails.length == 0) { - UiUtils.hide(mCardMetadata); + UiUtils.hide(mCardDetails); return; } - for (int i = 0; i < mMetaBlocks.size(); i++) - UiUtils.hide(mMetaBlocks.valueAt(i)); + for (int i = 0; i < mDetailsBlocks.size(); i++) + UiUtils.hide(mDetailsBlocks.valueAt(i)); - boolean anyEditableMeta = false; - for (int type : editableMeta) + boolean anyEditableDetails = false; + for (int type : editableDetails) { - final View metaBlock = mMetaBlocks.get(type); - if (metaBlock == null) + final View detailsBlock = mDetailsBlocks.get(type); + if (detailsBlock == null) continue; - anyEditableMeta = true; - UiUtils.show(metaBlock); + anyEditableDetails = true; + UiUtils.show(detailsBlock); } - UiUtils.showIf(anyEditableMeta, mCardMetadata); + UiUtils.showIf(anyEditableDetails, mCardDetails); } private void refreshOpeningTime() @@ -412,7 +412,7 @@ public class EditorFragment extends BaseMwmFragment implements View.OnClickListe mCategory = (TextView) categoryBlock.findViewById(R.id.name); mCardName = view.findViewById(R.id.cv__name); mCardAddress = view.findViewById(R.id.cv__address); - mCardMetadata = view.findViewById(R.id.cv__metadata); + mCardDetails = view.findViewById(R.id.cv__details); initNamesView(view); // Address @@ -463,13 +463,13 @@ public class EditorFragment extends BaseMwmFragment implements View.OnClickListe mReset = (TextView) view.findViewById(R.id.reset); mReset.setOnClickListener(this); - mMetaBlocks.append(MetadataType.FMD_OPEN_HOURS.toInt(), blockOpeningHours); - mMetaBlocks.append(MetadataType.FMD_PHONE_NUMBER.toInt(), blockPhone); - mMetaBlocks.append(MetadataType.FMD_WEBSITE.toInt(), blockWeb); - mMetaBlocks.append(MetadataType.FMD_EMAIL.toInt(), blockEmail); - mMetaBlocks.append(MetadataType.FMD_CUISINE.toInt(), blockCuisine); - mMetaBlocks.append(MetadataType.FMD_OPERATOR.toInt(), blockOperator); - mMetaBlocks.append(MetadataType.FMD_INTERNET.toInt(), blockWifi); + mDetailsBlocks.append(OsmProps.OpeningHours.toInt(), blockOpeningHours); + mDetailsBlocks.append(OsmProps.Phone.toInt(), blockPhone); + mDetailsBlocks.append(OsmProps.Website.toInt(), blockWeb); + mDetailsBlocks.append(OsmProps.Email.toInt(), blockEmail); + mDetailsBlocks.append(OsmProps.Cuisine.toInt(), blockCuisine); + mDetailsBlocks.append(OsmProps.Operator.toInt(), blockOperator); + mDetailsBlocks.append(OsmProps.Internet.toInt(), blockWifi); } private static EditText findInput(View blockWithInput) diff --git a/indexer/map_object.hpp b/indexer/map_object.hpp index c029bd1488..123bff8e64 100644 --- a/indexer/map_object.hpp +++ b/indexer/map_object.hpp @@ -31,23 +31,24 @@ enum class Internet }; std::string DebugPrint(Internet internet); -/// Metadata fields in the sorted order, visible to users. -enum class Props +// Metadata fields in the sorted order, visible to users. +// Must correspond MapObject.java +enum class Props : uint8_t { - OpeningHours, - Phone, - Fax, - Website, - Email, - Cuisine, - Stars, - Operator, - Elevation, - Internet, - Wikipedia, - Flats, - BuildingLevels, - Level + OpeningHours = 0, + Phone = 1, + Fax = 2, + Website = 3, + Email = 4, + Cuisine = 5, + Stars = 6, + Operator = 7, + Elevation = 8, + Internet = 9, + Wikipedia = 10, + Flats = 11, + BuildingLevels = 12, + Level = 13 }; std::string DebugPrint(Props props);