| 245 | } |
| 246 | |
| 247 | static void PutItemsToList( |
| 248 | JNIEnv * env, jobject const list, storage::CountriesVec const & children, int category, |
| 249 | std::function<bool(storage::CountryId const & countryId, storage::NodeAttrs const & attrs)> const & predicate) |
| 250 | { |
| 251 | auto const & ciBuilder = CountryItemBuilder::Instance(env); |
| 252 | auto const listAddMethod = jni::ListBuilder::Instance(env).m_add; |
| 253 | |
| 254 | storage::NodeAttrs attrs; |
| 255 | for (storage::CountryId const & child : children) |
| 256 | { |
| 257 | GetStorage().GetNodeAttrs(child, attrs); |
| 258 | |
| 259 | if (predicate && !predicate(child, attrs)) |
| 260 | continue; |
| 261 | |
| 262 | using SLR = jni::TScopedLocalRef; |
| 263 | SLR const item(env, ciBuilder.Create(env, SLR(env, jni::ToJavaString(env, child)))); |
| 264 | env->SetIntField(item.get(), ciBuilder.m_Category, category); |
| 265 | |
| 266 | UpdateItem(env, item.get(), attrs); |
| 267 | |
| 268 | // Put to resulting list |
| 269 | env->CallBooleanMethod(list, listAddMethod, item.get()); |
| 270 | } |
| 271 | } |
| 272 | |
| 273 | // static void nativeListItems(@Nullable String root, double lat, double lon, boolean hasLocation, boolean myMapsMode, |
| 274 | // List<CountryItem> result); |
no test coverage detected