Mercurial > dwindows
comparison 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 |
comparison
equal
deleted
inserted
replaced
2832:df16bb0a11b2 | 2833:469e5748c8a5 |
---|---|
3727 // Generate a string | 3727 // Generate a string |
3728 jstring jstr = env->NewStringUTF(titles[z]); | 3728 jstring jstr = env->NewStringUTF(titles[z]); |
3729 // First get the class that contains the method you need to call | 3729 // First get the class that contains the method you need to call |
3730 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); | 3730 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
3731 // Get the method that you want to call | 3731 // Get the method that you want to call |
3732 jmethodID containerNew = env->GetMethodID(clazz, "containerAddColumn", | 3732 jmethodID containerAddColumn = env->GetMethodID(clazz, "containerAddColumn", |
3733 "(Landroid/widget/ListView;Ljava/lang/String;I)V"); | 3733 "(Landroid/widget/ListView;Ljava/lang/String;I)V"); |
3734 // Call the method on the object | 3734 // Call the method on the object |
3735 env->CallVoidMethod(_dw_obj, containerNew, handle, jstr, (int)flags[z]); | 3735 env->CallVoidMethod(_dw_obj, containerAddColumn, handle, jstr, (int)flags[z]); |
3736 if(_dw_jni_check_exception(env)) | 3736 if(_dw_jni_check_exception(env)) |
3737 retval = DW_ERROR_GENERAL; | 3737 retval = DW_ERROR_GENERAL; |
3738 env->DeleteLocalRef(jstr); | 3738 env->DeleteLocalRef(jstr); |
3739 } | 3739 } |
3740 } | 3740 } |
3862 ULONG num = *((ULONG *)data); | 3862 ULONG num = *((ULONG *)data); |
3863 // First get the class that contains the method you need to call | 3863 // First get the class that contains the method you need to call |
3864 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); | 3864 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
3865 // Get the method that you want to call | 3865 // Get the method that you want to call |
3866 jmethodID containerChangeItem = env->GetMethodID(clazz, "containerChangeItemInt", | 3866 jmethodID containerChangeItem = env->GetMethodID(clazz, "containerChangeItemInt", |
3867 "(Landroid/widget/ListView;III)V"); | 3867 "(Landroid/widget/ListView;IIJ)V"); |
3868 // Call the method on the object | 3868 // Call the method on the object |
3869 env->CallVoidMethod(_dw_obj, containerChangeItem, handle, column, row, (int)num); | 3869 env->CallVoidMethod(_dw_obj, containerChangeItem, handle, column, row, (jlong)num); |
3870 _dw_jni_check_exception(env); | 3870 _dw_jni_check_exception(env); |
3871 } | 3871 } |
3872 // TODO: Handle DATE and TIME | 3872 else if((columntype & DW_CFA_DATE)) |
3873 { | |
3874 CDATE cdate = *((CDATE *)data); | |
3875 // First get the class that contains the method you need to call | |
3876 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); | |
3877 // Get the method that you want to call | |
3878 jmethodID containerChangeItem = env->GetMethodID(clazz, "containerChangeItemDate", | |
3879 "(Landroid/widget/ListView;IIIII)V"); | |
3880 // Call the method on the object | |
3881 env->CallVoidMethod(_dw_obj, containerChangeItem, handle, column, row, | |
3882 (jint)cdate.year, (jint)cdate.month, (jint)cdate.day); | |
3883 _dw_jni_check_exception(env); | |
3884 } | |
3885 else if((columntype & DW_CFA_TIME)) | |
3886 { | |
3887 CTIME ctime = *((CTIME *)data); | |
3888 // First get the class that contains the method you need to call | |
3889 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); | |
3890 // Get the method that you want to call | |
3891 jmethodID containerChangeItem = env->GetMethodID(clazz, "containerChangeItemTime", | |
3892 "(Landroid/widget/ListView;IIIII)V"); | |
3893 // Call the method on the object | |
3894 env->CallVoidMethod(_dw_obj, containerChangeItem, handle, column, row, | |
3895 (jint)ctime.hours, (jint)ctime.minutes, (jint)ctime.seconds); | |
3896 _dw_jni_check_exception(env); | |
3897 } | |
3873 } | 3898 } |
3874 } | 3899 } |
3875 | 3900 |
3876 /* Notify that the data changed, causing the container to refresh */ | 3901 /* Notify that the data changed, causing the container to refresh */ |
3877 void _dw_container_refresh(HWND handle) | 3902 void _dw_container_refresh(HWND handle) |