Merge pull request #4524 from VladiMihaylenko/vm-master

[android] Fixed android.
This commit is contained in:
alexzatsepin 2016-10-19 14:47:23 +03:00 committed by GitHub
commit 29273a1105
5 changed files with 15 additions and 14 deletions

View file

@ -355,12 +355,12 @@ void Framework::RemoveLocalMaps()
void Framework::ReplaceBookmark(BookmarkAndCategory const & ind, BookmarkData & bm)
{
m_work.ReplaceBookmark(ind.first, ind.second, bm);
m_work.ReplaceBookmark(ind.m_categoryIndex, ind.m_bookmarkIndex, bm);
}
size_t Framework::ChangeBookmarkCategory(BookmarkAndCategory const & ind, size_t newCat)
{
return m_work.MoveBookmark(ind.second, ind.first, newCat);
return m_work.MoveBookmark(ind.m_bookmarkIndex, ind.m_categoryIndex, newCat);
}
bool Framework::ShowMapForURL(string const & url)
@ -1144,8 +1144,8 @@ JNIEXPORT jobject JNICALL
Java_com_mapswithme_maps_Framework_nativeDeleteBookmarkFromMapObject(JNIEnv * env, jclass)
{
place_page::Info & info = g_framework->GetPlacePageInfo();
bookmarks_helper::RemoveBookmark(info.m_bac.first, info.m_bac.second);
info.m_bac = MakeEmptyBookmarkAndCategory();
bookmarks_helper::RemoveBookmark(info.m_bac.m_categoryIndex, info.m_bac.m_bookmarkIndex);
info.m_bac = {};
return usermark_helper::CreateMapObject(env, info);
}
@ -1153,8 +1153,8 @@ JNIEXPORT void JNICALL
Java_com_mapswithme_maps_Framework_nativeOnBookmarkCategoryChanged(JNIEnv * env, jclass, jint cat, jint bmk)
{
place_page::Info & info = g_framework->GetPlacePageInfo();
info.m_bac.first = cat;
info.m_bac.second = bmk;
info.m_bac.m_categoryIndex = cat;
info.m_bac.m_bookmarkIndex = bmk;
}
JNIEXPORT void JNICALL

View file

@ -49,13 +49,13 @@ jobject CreateMapObject(JNIEnv * env, place_page::Info const & info)
static jmethodID const ctorId = jni::GetConstructorID(env, g_bookmarkClazz, "(IILjava/lang/String;)V");
auto const & bac = info.GetBookmarkAndCategory();
BookmarkCategory * cat = g_framework->NativeFramework()->GetBmCategory(bac.first);
BookmarkData const & data = static_cast<Bookmark const *>(cat->GetUserMark(bac.second))->GetData();
BookmarkCategory * cat = g_framework->NativeFramework()->GetBmCategory(bac.m_categoryIndex);
BookmarkData const & data = static_cast<Bookmark const *>(cat->GetUserMark(bac.m_bookmarkIndex))->GetData();
jni::TScopedLocalRef jName(env, jni::ToJavaString(env, data.GetName()));
jobject mapObject = env->NewObject(g_bookmarkClazz, ctorId,
static_cast<jint>(info.m_bac.first),
static_cast<jint>(info.m_bac.second),
static_cast<jint>(info.m_bac.m_categoryIndex),
static_cast<jint>(info.m_bac.m_bookmarkIndex),
jName.get());
if (info.IsFeature())
InjectMetadata(env, g_mapObjectClazz, mapObject, info.GetMetadata());

View file

@ -51,14 +51,14 @@ Java_com_mapswithme_maps_bookmarks_data_Bookmark_nativeSetBookmarkParams(
bm.SetDescription(descr ? jni::ToNativeString(env, descr)
: p->GetDescription());
g_framework->ReplaceBookmark(BookmarkAndCategory(cat, bmk), bm);
g_framework->ReplaceBookmark(BookmarkAndCategory(bmk, cat), bm);
}
JNIEXPORT jint JNICALL
Java_com_mapswithme_maps_bookmarks_data_Bookmark_nativeChangeCategory(
JNIEnv * env, jobject thiz, jint oldCat, jint newCat, jlong bmk)
{
return g_framework->ChangeBookmarkCategory(BookmarkAndCategory(oldCat, bmk), newCat);
return g_framework->ChangeBookmarkCategory(BookmarkAndCategory(bmk, oldCat), newCat);
}
JNIEXPORT jobject JNICALL

View file

@ -86,7 +86,8 @@ Java_com_mapswithme_maps_bookmarks_data_BookmarkCategory_nativeGetBookmark(
{
BookmarkCategory * category = getBmCategory(catId);
place_page::Info info;
frm()->FillBookmarkInfo(*static_cast<Bookmark const *>(category->GetUserMark(bmkId)), {catId, bmkId}, info);
frm()->FillBookmarkInfo(*static_cast<Bookmark const *>(category->GetUserMark(bmkId)),
{static_cast<size_t>(bmkId), static_cast<size_t>(catId)}, info);
return usermark_helper::CreateMapObject(env, info);
}

View file

@ -36,7 +36,7 @@ JNIEXPORT void JNICALL
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeShowBookmarkOnMap(
JNIEnv * env, jobject thiz, jint c, jint b)
{
BookmarkAndCategory bnc = BookmarkAndCategory(c,b);
BookmarkAndCategory bnc = BookmarkAndCategory(b,c);
frm()->ShowBookmark(bnc);
}