diff --git a/android/jni/Android.mk b/android/jni/Android.mk index d9e44d9039..7a361cc802 100644 --- a/android/jni/Android.mk +++ b/android/jni/Android.mk @@ -95,6 +95,7 @@ LOCAL_SRC_FILES := \ com/mapswithme/platform/HttpThread.cpp \ com/mapswithme/platform/Language.cpp \ com/mapswithme/platform/PThreadImpl.cpp \ + com/mapswithme/utils/StringUtils.cpp \ nv_thread/nv_thread.cpp \ nv_event/nv_event_queue.cpp \ nv_event/nv_event.cpp \ diff --git a/android/jni/com/mapswithme/utils/StringUtils.cpp b/android/jni/com/mapswithme/utils/StringUtils.cpp new file mode 100644 index 0000000000..03701f328a --- /dev/null +++ b/android/jni/com/mapswithme/utils/StringUtils.cpp @@ -0,0 +1,12 @@ +#include "base/string_utils.hpp" +#include "../core/jni_helper.hpp" + +extern "C" +{ + JNIEXPORT jboolean JNICALL + Java_com_mapswithme_util_StringUtils_isHtml(JNIEnv * env, jclass thiz, jstring text) + { + return strings::IsHTML(jni::ToNativeString(env, text)); + } + +} // extern "C" diff --git a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java index 1fde7a7d67..e9033f3db3 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java +++ b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java @@ -51,6 +51,7 @@ import com.mapswithme.maps.widget.ArrowView; import com.mapswithme.util.InputUtils; import com.mapswithme.util.LocationUtils; import com.mapswithme.util.ShareAction; +import com.mapswithme.util.StringUtils; import com.mapswithme.util.UiUtils; import com.mapswithme.util.Utils; import com.mapswithme.util.statistics.AlohaHelper; @@ -331,7 +332,7 @@ public class PlacePageView extends RelativeLayout implements View.OnClickListene final String notes = bookmark.getBookmarkDescription(); if (notes.isEmpty()) UiUtils.hide(mWvDescription, mBtnEditHtmlDescription, mTvDescription); - else if (notes.charAt(0) == '<') // we just check first symbol and try to display html if its tag opening + else if (StringUtils.isHtml(notes)) { mWvDescription.loadData(notes, "text/html; charset=utf-8", null); UiUtils.show(mWvDescription, mBtnEditHtmlDescription); diff --git a/android/src/com/mapswithme/util/StringUtils.java b/android/src/com/mapswithme/util/StringUtils.java index a1f1f9e348..ae026b845e 100644 --- a/android/src/com/mapswithme/util/StringUtils.java +++ b/android/src/com/mapswithme/util/StringUtils.java @@ -53,5 +53,7 @@ public class StringUtils return res; } + public static native boolean isHtml(String text); + private StringUtils() {} }