Used strings::IsHTML for html detection.

This commit is contained in:
Dmitry Yunitsky 2015-06-04 19:05:36 +03:00 committed by Alex Zolotarev
parent 24bbb192b6
commit 029ef291f1
4 changed files with 17 additions and 1 deletions

View file

@ -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 \

View file

@ -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"

View file

@ -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);

View file

@ -53,5 +53,7 @@ public class StringUtils
return res;
}
public static native boolean isHtml(String text);
private StringUtils() {}
}