forked from organicmaps/organicmaps
[bookmarks] helper methods for compilations
This commit is contained in:
parent
0bb99c24d4
commit
aefa9bf26f
4 changed files with 41 additions and 0 deletions
|
@ -1273,6 +1273,24 @@ Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetChildrenCollect
|
|||
return MakeCategories(env, ids);
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeIsBookmarkCompilation(JNIEnv *env,
|
||||
jobject,
|
||||
jlong id)
|
||||
{
|
||||
auto const & bm = frm()->GetBookmarkManager();
|
||||
return static_cast<jboolean>(bm.IsBookmarkCompilation(static_cast<kml::MarkGroupId>(id)));
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeGetCompilationType(JNIEnv *env,
|
||||
jobject,
|
||||
jlong id)
|
||||
{
|
||||
auto const & bm = frm()->GetBookmarkManager();
|
||||
return static_cast<jint>(bm.GetCompilationType(static_cast<kml::MarkGroupId>(id)));
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeHasLastSortingType(
|
||||
JNIEnv *, jobject, jlong catId)
|
||||
|
|
|
@ -893,6 +893,9 @@ public enum BookmarkManager
|
|||
@NonNull
|
||||
native BookmarkCategory[] nativeGetChildrenCollections(long catId);
|
||||
|
||||
native boolean nativeIsBookmarkCompilation(long catId);
|
||||
native int nativeGetCompilationType(long catId);
|
||||
|
||||
@NonNull
|
||||
public String getBookmarkName(@IntRange(from = 0) long bookmarkId)
|
||||
{
|
||||
|
|
|
@ -1368,11 +1368,13 @@ void BookmarkManager::OnTrackDeselected()
|
|||
|
||||
kml::GroupIdCollection BookmarkManager::GetChildrenCategories(kml::MarkGroupId parentId) const
|
||||
{
|
||||
CHECK_THREAD_CHECKER(m_threadChecker, ());
|
||||
return GetCompilationOfType(parentId, kml::CompilationType::Category);
|
||||
}
|
||||
|
||||
kml::GroupIdCollection BookmarkManager::GetChildrenCollections(kml::MarkGroupId parentId) const
|
||||
{
|
||||
CHECK_THREAD_CHECKER(m_threadChecker, ());
|
||||
return GetCompilationOfType(parentId, kml::CompilationType::Collection);
|
||||
}
|
||||
|
||||
|
@ -1391,6 +1393,21 @@ kml::GroupIdCollection BookmarkManager::GetCompilationOfType(kml::MarkGroupId pa
|
|||
return result;
|
||||
}
|
||||
|
||||
bool BookmarkManager::IsBookmarkCompilation(kml::MarkGroupId id) const
|
||||
{
|
||||
CHECK_THREAD_CHECKER(m_threadChecker, ());
|
||||
return m_compilations.find(id) != m_compilations.cend();
|
||||
}
|
||||
|
||||
kml::CompilationType BookmarkManager::GetCompilationType(kml::MarkGroupId id) const
|
||||
{
|
||||
CHECK_THREAD_CHECKER(m_threadChecker, ());
|
||||
|
||||
auto const compilation = m_compilations.find(id);
|
||||
CHECK(compilation != m_compilations.cend(), ());
|
||||
return compilation->second->GetCategoryData().m_type;
|
||||
}
|
||||
|
||||
std::vector<std::string> BookmarkManager::GetAllPaidCategoriesIds() const
|
||||
{
|
||||
return GetCategoriesFromCatalog([](kml::AccessRules accessRules)
|
||||
|
|
|
@ -508,6 +508,9 @@ public:
|
|||
kml::GroupIdCollection GetChildrenCategories(kml::MarkGroupId parentCategoryId) const;
|
||||
kml::GroupIdCollection GetChildrenCollections(kml::MarkGroupId parentCategoryId) const;
|
||||
|
||||
bool IsBookmarkCompilation(kml::MarkGroupId id) const;
|
||||
kml::CompilationType GetCompilationType(kml::MarkGroupId id) const;
|
||||
|
||||
std::vector<std::string> GetAllPaidCategoriesIds() const;
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Reference in a new issue