mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-21 02:33:50 +00:00
[core] Switch to ankerl::unordered_dense
Signed-off-by: x7z4w <x7z4w@noreply.codeberg.org>
This commit is contained in:
@@ -182,8 +182,7 @@ JNIEXPORT void JNICALL Java_app_organicmaps_sdk_DownloadResourcesLegacyActivity_
|
||||
g_currentRequest.reset();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_app_organicmaps_sdk_DownloadResourcesLegacyActivity_nativeResetMetaConfig(JNIEnv *,
|
||||
jclass)
|
||||
JNIEXPORT void JNICALL Java_app_organicmaps_sdk_DownloadResourcesLegacyActivity_nativeResetMetaConfig(JNIEnv *, jclass)
|
||||
{
|
||||
auto & downloader = LegacyDownloader();
|
||||
if (downloader)
|
||||
|
||||
@@ -1505,20 +1505,16 @@ JNIEXPORT void JNICALL Java_app_organicmaps_sdk_Framework_nativeGet3dMode(JNIEnv
|
||||
env->SetBooleanField(result, buildingsField, buildings);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_app_organicmaps_sdk_Framework_nativeSetCustomMapDownloadUrl(JNIEnv * env, jclass,
|
||||
JNIEXPORT void JNICALL Java_app_organicmaps_sdk_Framework_nativeSetCustomMapDownloadUrl(JNIEnv * env, jclass,
|
||||
jstring url)
|
||||
{
|
||||
std::string nativeUrl = jni::ToNativeString(env, url);
|
||||
GetPlatform().SetCustomMapServerUrl(nativeUrl);
|
||||
|
||||
if (g_framework)
|
||||
{
|
||||
frm()->GetStorage().ResetMapDownloadMetaConfig();
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(LINFO, ("nativeSetCustomMapDownloadUrl: framework not created yet, skipping ResetMapDownloadMetaConfig"));
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_app_organicmaps_sdk_Framework_nativeSetAutoZoomEnabled(JNIEnv * env, jclass,
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace
|
||||
@@ -53,7 +52,7 @@ struct TBatchedData
|
||||
jobject g_countryChangedListener = nullptr;
|
||||
|
||||
DECLARE_THREAD_CHECKER(g_batchingThreadChecker);
|
||||
std::unordered_map<jobject, std::vector<TBatchedData>> g_batchedCallbackData;
|
||||
ankerl::unordered_dense::map<jobject, std::vector<TBatchedData>> g_batchedCallbackData;
|
||||
bool g_isBatched;
|
||||
|
||||
storage::Storage & GetStorage()
|
||||
@@ -589,8 +588,9 @@ JNIEXPORT jstring JNICALL Java_app_organicmaps_sdk_downloader_MapManager_nativeG
|
||||
}
|
||||
|
||||
// static native boolean nativeIsMapTooOldToEdit(String countryId);
|
||||
JNIEXPORT jboolean JNICALL Java_app_organicmaps_sdk_downloader_MapManager_nativeIsMapTooOldToEdit(JNIEnv *env, jclass clazz,
|
||||
jstring country_id)
|
||||
JNIEXPORT jboolean JNICALL Java_app_organicmaps_sdk_downloader_MapManager_nativeIsMapTooOldToEdit(JNIEnv * env,
|
||||
jclass clazz,
|
||||
jstring country_id)
|
||||
{
|
||||
return GetStorage().IsMapTooOldToEdit(jni::ToNativeString(env, country_id));
|
||||
}
|
||||
|
||||
@@ -580,7 +580,8 @@ JNIEXPORT jint JNICALL Java_app_organicmaps_sdk_editor_Editor_nativeGetMapObject
|
||||
return static_cast<jint>(osm::Editor::Instance().GetFeatureStatus(g_editableMapObject.GetID()));
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_app_organicmaps_sdk_editor_Editor_nativeAreSomeFeatureChangesUploaded(JNIEnv * env, jclass clazz)
|
||||
JNIEXPORT jboolean JNICALL Java_app_organicmaps_sdk_editor_Editor_nativeAreSomeFeatureChangesUploaded(JNIEnv * env,
|
||||
jclass clazz)
|
||||
{
|
||||
return osm::Editor::Instance().AreSomeFeatureChangesUploaded(g_editableMapObject.GetID().m_mwmId,
|
||||
g_editableMapObject.GetID().m_index);
|
||||
|
||||
@@ -320,7 +320,7 @@ JNIEXPORT jobject JNICALL Java_app_organicmaps_sdk_editor_OpeningHours_nativeCur
|
||||
jclass ohStateClass = jni::GetGlobalClassRef(env, "app/organicmaps/sdk/editor/OhState");
|
||||
jclass ruleStateClass = jni::GetGlobalClassRef(env, "app/organicmaps/sdk/editor/OhState$State");
|
||||
|
||||
static std::unordered_map<RuleState, char const *> const ruleState = {
|
||||
static ankerl::unordered_dense::map<RuleState, char const *> const ruleState = {
|
||||
{RuleState::Open, "Open"}, {RuleState::Closed, "Closed"}, {RuleState::Unknown, "Unknown"}};
|
||||
|
||||
jfieldID stateField =
|
||||
|
||||
@@ -35,7 +35,8 @@ SOFTWARE.
|
||||
|
||||
#include <iterator>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "3party/ankerl/unordered_dense.h"
|
||||
|
||||
DECLARE_EXCEPTION(JniException, RootException);
|
||||
|
||||
@@ -151,7 +152,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
std::unordered_map<std::string, jfieldID> m_fieldIds;
|
||||
ankerl::unordered_dense::map<std::string, jfieldID> m_fieldIds;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
|
||||
@@ -2,12 +2,10 @@ package app.organicmaps.sdk;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.Size;
|
||||
|
||||
import app.organicmaps.sdk.api.ParsedRoutingData;
|
||||
import app.organicmaps.sdk.api.ParsedSearchRequest;
|
||||
import app.organicmaps.sdk.api.RequestType;
|
||||
@@ -26,7 +24,6 @@ import app.organicmaps.sdk.routing.RoutingRecommendationListener;
|
||||
import app.organicmaps.sdk.routing.TransitRouteInfo;
|
||||
import app.organicmaps.sdk.settings.SpeedCameraMode;
|
||||
import app.organicmaps.sdk.util.Constants;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
@@ -2,13 +2,11 @@ package app.organicmaps.sdk;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.DefaultLifecycleObserver;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
import androidx.lifecycle.ProcessLifecycleOwner;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import app.organicmaps.sdk.bookmarks.data.BookmarkManager;
|
||||
import app.organicmaps.sdk.bookmarks.data.Icon;
|
||||
import app.organicmaps.sdk.downloader.Android7RootCertificateWorkaround;
|
||||
@@ -28,7 +26,6 @@ import app.organicmaps.sdk.util.SharedPropertiesUtils;
|
||||
import app.organicmaps.sdk.util.StorageUtils;
|
||||
import app.organicmaps.sdk.util.log.Logger;
|
||||
import app.organicmaps.sdk.util.log.LogsManager;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class OrganicMaps implements DefaultLifecycleObserver
|
||||
|
||||
@@ -4,28 +4,30 @@ package app.organicmaps.sdk.bookmarks.data;
|
||||
* represents the details of the socket available on a particular charging station
|
||||
*
|
||||
*/
|
||||
public record ChargeSocketDescriptor(String type, int count, double power) {
|
||||
|
||||
/**
|
||||
* Some charge sockets have the same visuals as other sockets, even though they are different and are tagged
|
||||
* differently in OSM. This method returns the 'visual' type that should be used for the socket.
|
||||
*
|
||||
* @return the 'equivalent' visual style that should be used for this socket
|
||||
*/
|
||||
public String visualType() {
|
||||
if (type.equals("typee")) {
|
||||
return "schuko";
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* For some sockets (eg, domestic sockets), the power is usually not provided, as it is 'implicit'
|
||||
*
|
||||
* @return true if this socket type does not require displaying the power
|
||||
*/
|
||||
public Boolean ignorePower() {
|
||||
return type.equals("typee") || type.equals("schuko");
|
||||
public record ChargeSocketDescriptor(String type, int count, double power)
|
||||
{
|
||||
/**
|
||||
* Some charge sockets have the same visuals as other sockets, even though they are different and are tagged
|
||||
* differently in OSM. This method returns the 'visual' type that should be used for the socket.
|
||||
*
|
||||
* @return the 'equivalent' visual style that should be used for this socket
|
||||
*/
|
||||
public String visualType()
|
||||
{
|
||||
if (type.equals("typee"))
|
||||
{
|
||||
return "schuko";
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* For some sockets (eg, domestic sockets), the power is usually not provided, as it is 'implicit'
|
||||
*
|
||||
* @return true if this socket type does not require displaying the power
|
||||
*/
|
||||
public Boolean ignorePower()
|
||||
{
|
||||
return type.equals("typee") || type.equals("schuko");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package app.organicmaps.sdk.editor;
|
||||
import androidx.annotation.IntRange;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import app.organicmaps.sdk.editor.data.Timespan;
|
||||
import app.organicmaps.sdk.editor.data.Timetable;
|
||||
|
||||
|
||||
@@ -2,16 +2,14 @@ package app.organicmaps.sdk.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
import androidx.annotation.NonNull;
|
||||
import app.organicmaps.sdk.R;
|
||||
import java.text.DateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Locale;
|
||||
|
||||
import app.organicmaps.sdk.R;
|
||||
|
||||
public final class DateUtils
|
||||
{
|
||||
private DateUtils() {}
|
||||
@@ -44,7 +42,7 @@ public final class DateUtils
|
||||
if (days == 1)
|
||||
return resources.getString(R.string.yesterday).toLowerCase();
|
||||
if (days < 7)
|
||||
return resources.getString(R.string.days_ago, Integer.toString(days));
|
||||
return resources.getString(R.string.days_ago, Integer.toString(days));
|
||||
if (days < 30)
|
||||
return resources.getString(days < 14 ? R.string.week_ago : R.string.weeks_ago, Integer.toString(days / 7));
|
||||
if (days < 365)
|
||||
|
||||
Reference in New Issue
Block a user