Mercurial > dwindows
diff android/dw.cpp @ 2833:469e5748c8a5
Android: In preparation for the container mode changes... I needed to
implement localized date handling. I had skipped that code previous since I
couldn't use the C locale code I use on other platforms since Android NDK is
always US_EN. Plus since we only previously displayed one column, that code
would never need to be run.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 11 Sep 2022 12:43:08 +0000 |
parents | 723b79981427 |
children | 0cbe8201db3c |
line wrap: on
line diff
--- a/android/dw.cpp Sun Sep 11 08:15:13 2022 +0000 +++ b/android/dw.cpp Sun Sep 11 12:43:08 2022 +0000 @@ -3729,10 +3729,10 @@ // First get the class that contains the method you need to call jclass clazz = _dw_find_class(env, DW_CLASS_NAME); // Get the method that you want to call - jmethodID containerNew = env->GetMethodID(clazz, "containerAddColumn", + jmethodID containerAddColumn = env->GetMethodID(clazz, "containerAddColumn", "(Landroid/widget/ListView;Ljava/lang/String;I)V"); // Call the method on the object - env->CallVoidMethod(_dw_obj, containerNew, handle, jstr, (int)flags[z]); + env->CallVoidMethod(_dw_obj, containerAddColumn, handle, jstr, (int)flags[z]); if(_dw_jni_check_exception(env)) retval = DW_ERROR_GENERAL; env->DeleteLocalRef(jstr); @@ -3864,12 +3864,37 @@ jclass clazz = _dw_find_class(env, DW_CLASS_NAME); // Get the method that you want to call jmethodID containerChangeItem = env->GetMethodID(clazz, "containerChangeItemInt", - "(Landroid/widget/ListView;III)V"); + "(Landroid/widget/ListView;IIJ)V"); // Call the method on the object - env->CallVoidMethod(_dw_obj, containerChangeItem, handle, column, row, (int)num); + env->CallVoidMethod(_dw_obj, containerChangeItem, handle, column, row, (jlong)num); _dw_jni_check_exception(env); } - // TODO: Handle DATE and TIME + else if((columntype & DW_CFA_DATE)) + { + CDATE cdate = *((CDATE *)data); + // First get the class that contains the method you need to call + jclass clazz = _dw_find_class(env, DW_CLASS_NAME); + // Get the method that you want to call + jmethodID containerChangeItem = env->GetMethodID(clazz, "containerChangeItemDate", + "(Landroid/widget/ListView;IIIII)V"); + // Call the method on the object + env->CallVoidMethod(_dw_obj, containerChangeItem, handle, column, row, + (jint)cdate.year, (jint)cdate.month, (jint)cdate.day); + _dw_jni_check_exception(env); + } + else if((columntype & DW_CFA_TIME)) + { + CTIME ctime = *((CTIME *)data); + // First get the class that contains the method you need to call + jclass clazz = _dw_find_class(env, DW_CLASS_NAME); + // Get the method that you want to call + jmethodID containerChangeItem = env->GetMethodID(clazz, "containerChangeItemTime", + "(Landroid/widget/ListView;IIIII)V"); + // Call the method on the object + env->CallVoidMethod(_dw_obj, containerChangeItem, handle, column, row, + (jint)ctime.hours, (jint)ctime.minutes, (jint)ctime.seconds); + _dw_jni_check_exception(env); + } } }