Mercurial > dwindows
comparison android/dw.cpp @ 2715:e9ad53d2271b
Android: Fix Intent based file chooser and switch to using it by default.
The old dialog based file chooser is still included as a fallback for now.
Only run the color chooser if called on the main thread, this should not be
a problem since almost nothing except expose callbacks run on the main
thread. The intent based file chooser can't choose directories, so for now
operate like normal, but return the path to the chosen file instead of the
file itself.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 05 Dec 2021 15:08:13 +0000 |
parents | 26bb1e4a97d0 |
children | 6754e8f70142 |
comparison
equal
deleted
inserted
replaced
2714:26bb1e4a97d0 | 2715:e9ad53d2271b |
---|---|
1205 if(ext) | 1205 if(ext) |
1206 jext = env->NewStringUTF(defpath); | 1206 jext = env->NewStringUTF(defpath); |
1207 // First get the class that contains the method you need to call | 1207 // First get the class that contains the method you need to call |
1208 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); | 1208 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
1209 // Get the method that you want to call | 1209 // Get the method that you want to call |
1210 jmethodID fileBrowse = env->GetMethodID(clazz, "fileBrowse", | 1210 jmethodID fileBrowse = env->GetMethodID(clazz, "fileBrowseNew", |
1211 "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)Ljava/lang/String;"); | 1211 "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)Ljava/lang/String;"); |
1212 // Call the method on the object | 1212 // Call the method on the object |
1213 jstring jresult = (jstring)_dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, fileBrowse, jstr, path, jext, flags), _DW_REFERENCE_NONE); | 1213 jstring jresult = (jstring)_dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, fileBrowse, jstr, path, jext, flags), _DW_REFERENCE_NONE); |
1214 if(jresult) | 1214 if(jresult) |
1215 retval = strdup(env->GetStringUTFChars(jresult, nullptr)); | 1215 retval = strdup(env->GetStringUTFChars(jresult, nullptr)); |