[android][sdk] Move OhState to SDK

Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
Konstantin Pastbin
2025-08-23 20:49:49 +07:00
parent d609876c2d
commit c9a261dee5
4 changed files with 7 additions and 7 deletions

View File

@@ -317,16 +317,16 @@ JNIEXPORT jobject JNICALL Java_app_organicmaps_sdk_editor_OpeningHours_nativeCur
/// @todo We should check closed/open time for specific feature's timezone.
OpeningHours::InfoT ohInfo = MakeOpeningHours(tts).GetInfo(now);
jclass ohStateClass = jni::GetGlobalClassRef(env, "app/organicmaps/editor/OhState");
jclass ruleStateClass = jni::GetGlobalClassRef(env, "app/organicmaps/editor/OhState$State");
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 = {
{RuleState::Open, "Open"}, {RuleState::Closed, "Closed"}, {RuleState::Unknown, "Unknown"}};
jfieldID stateField =
env->GetStaticFieldID(ruleStateClass, ruleState.at(ohInfo.state), "Lapp/organicmaps/editor/OhState$State;");
env->GetStaticFieldID(ruleStateClass, ruleState.at(ohInfo.state), "Lapp/organicmaps/sdk/editor/OhState$State;");
jobject stateObj = env->GetStaticObjectField(ruleStateClass, stateField);
jmethodID constructor = env->GetMethodID(ohStateClass, "<init>", "(Lapp/organicmaps/editor/OhState$State;JJ)V");
jmethodID constructor = env->GetMethodID(ohStateClass, "<init>", "(Lapp/organicmaps/sdk/editor/OhState$State;JJ)V");
jobject javaOhState =
env->NewObject(ohStateClass, constructor, stateObj, (jlong)ohInfo.nextTimeOpen, (jlong)ohInfo.nextTimeClosed);

View File

@@ -0,0 +1,30 @@
package app.organicmaps.sdk.editor;
import androidx.annotation.Keep;
// Used by JNI.
@Keep
public class OhState
{
public enum State
{
Open,
Closed,
Unknown
}
public State state;
/** Unix timestamp in seconds**/
public long nextTimeOpen;
/** Unix timestamp in seconds **/
public long nextTimeClosed;
// Used by JNI.
@Keep
public OhState(State state, long nextTimeOpen, long nextTimeClosed)
{
this.state = state;
this.nextTimeOpen = nextTimeOpen;
this.nextTimeClosed = nextTimeClosed;
}
}

View File

@@ -3,7 +3,7 @@ package app.organicmaps.sdk.editor;
import androidx.annotation.IntRange;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import app.organicmaps.editor.OhState;
import app.organicmaps.sdk.editor.OhState;
import app.organicmaps.sdk.editor.data.Timespan;
import app.organicmaps.sdk.editor.data.Timetable;