Sha256: b285e6924580a9c5965353296b6f4404ff4d52bc71c8ac905f37039ac61ad9ac

Contents?: true

Size: 1.49 KB

Versions: 32

Compression:

Stored size: 1.49 KB

Contents

#include "rhodes/JNIRhodes.h"

#include "rhodes/jni/com_rhomobile_rhodes_datetime_DateTimePicker.h"

#include <common/RhodesApp.h>

#undef DEFAULT_LOGCATEGORY
#define DEFAULT_LOGCATEGORY "DateTimePicker"

RHO_GLOBAL void JNICALL Java_com_rhomobile_rhodes_datetime_DateTimePicker_callback
  (JNIEnv *env, jclass, jstring callback, jlong result, jbyteArray opaqueObj, jboolean cancelled)
{
    jbyte *opaqueStr = env->GetByteArrayElements(opaqueObj, JNI_FALSE);
    rho_rhodesapp_callDateTimeCallback(rho_cast<std::string>(callback).c_str(), result, (const char *)opaqueStr, cancelled);
    env->ReleaseByteArrayElements(opaqueObj, opaqueStr, 0);
}

RHO_GLOBAL void choose_datetime(char* callback, char* title, long initial_time, int format, char* data)
{
    JNIEnv *env = jnienv();
    jclass cls = getJNIClass(RHODES_JAVA_CLASS_DATE_TIME_PICKER);
    if (!cls) return;
    jmethodID mid = getJNIClassStaticMethod(env, cls, "choose", "(Ljava/lang/String;Ljava/lang/String;JI[B)V");
    if (!mid) return;

    jsize data_size = strlen(data);
    jbyteArray opaqueObj = env->NewByteArray(data_size);
    if (!opaqueObj) return;
    env->SetByteArrayRegion(opaqueObj, 0, data_size, (const jbyte *)data);
    jstring objCallback = rho_cast<jstring>(callback);
    jstring objTitle = rho_cast<jstring>(title);
    env->CallStaticVoidMethod(cls, mid, objCallback, objTitle,
        (jlong)initial_time, format, opaqueObj);
    env->DeleteLocalRef(objCallback);
    env->DeleteLocalRef(objTitle);
    env->DeleteLocalRef(opaqueObj);
}

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
rhodes-2.2.6 platform/android/Rhodes/jni/src/datetimepicker.cpp
rhodes-2.2.6.beta.1 platform/android/Rhodes/jni/src/datetimepicker.cpp
rhodes-2.2.5 platform/android/Rhodes/jni/src/datetimepicker.cpp
rhodes-2.2.5.beta.3 platform/android/Rhodes/jni/src/datetimepicker.cpp
rhodes-2.2.5.beta.2 platform/android/Rhodes/jni/src/datetimepicker.cpp
rhodes-2.2.5.beta.1 platform/android/Rhodes/jni/src/datetimepicker.cpp
rhodes-2.2.4.beta.1 platform/android/Rhodes/jni/src/datetimepicker.cpp
rhodes-2.2.3 platform/android/Rhodes/jni/src/datetimepicker.cpp
rhodes-2.2.3.beta.1 platform/android/Rhodes/jni/src/datetimepicker.cpp
rhodes-2.2.2 platform/android/Rhodes/jni/src/datetimepicker.cpp
rhodes-2.2.2.beta.1 platform/android/Rhodes/jni/src/datetimepicker.cpp
rhodes-2.2.1 platform/android/Rhodes/jni/src/datetimepicker.cpp
rhodes-2.2.1.beta.2 platform/android/Rhodes/jni/src/datetimepicker.cpp
rhodes-2.2.1.beta.1 platform/android/Rhodes/jni/src/datetimepicker.cpp
rhodes-2.2.0 platform/android/Rhodes/jni/src/datetimepicker.cpp
rhodes-2.2.0.beta.3 platform/android/Rhodes/jni/src/datetimepicker.cpp
rhodes-2.2.0.beta.2 platform/android/Rhodes/jni/src/datetimepicker.cpp
rhodes-2.2.0.beta.1 platform/android/Rhodes/jni/src/datetimepicker.cpp
rhodes-2.1.0 platform/android/Rhodes/jni/src/datetimepicker.cpp
rhodes-2.0.3 platform/android/Rhodes/jni/src/datetimepicker.cpp