diff android/dw.cpp @ 2720:9ce1649b0fbd

Android: Fix vertical sliders/scrollbars by creating a DWSlider class to encapsulate the SeekBar... then override the measurements and adjust the width. The width on the SeekBar needs to be set to the height after rotation... Since that is not the actually correct width, we need to wrap it in a frame.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 09 Dec 2021 01:57:52 +0000
parents 6754e8f70142
children cacde852e2db
line wrap: on
line diff
--- a/android/dw.cpp	Wed Dec 08 12:54:25 2021 +0000
+++ b/android/dw.cpp	Thu Dec 09 01:57:52 2021 +0000
@@ -1929,7 +1929,8 @@
         // 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 sliderNew = env->GetMethodID(clazz, "sliderNew", "(III)Landroid/widget/SeekBar;");
+        jmethodID sliderNew = env->GetMethodID(clazz, "sliderNew",
+                                               "(III)Lorg/dbsoft/dwindows/DWSlider;");
         // Call the method on the object
         jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, sliderNew, vertical, increments, (jint)cid), _DW_REFERENCE_WEAK);
         return result;
@@ -1955,7 +1956,7 @@
         jclass clazz = _dw_find_class(env, DW_CLASS_NAME);
         // Get the method that you want to call
         jmethodID percentGetPos = env->GetMethodID(clazz, "percentGetPos",
-                                                   "(Landroid/widget/ProgressBar;)I");
+                                                   "(Landroid/view/View;)I");
         // Call the method on the object
         retval = env->CallIntMethod(_dw_obj, percentGetPos, handle);
         if(_dw_jni_check_exception(env))
@@ -1992,7 +1993,8 @@
         // 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 scrollBarNew = env->GetMethodID(clazz, "scrollBarNew", "(II)Landroid/widget/SeekBar;");
+        jmethodID scrollBarNew = env->GetMethodID(clazz, "scrollBarNew",
+                                                  "(II)Lorg/dbsoft/dwindows/DWSlider;");
         // Call the method on the object
         jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, scrollBarNew, vertical, (jint)cid), _DW_REFERENCE_WEAK);
         return result;
@@ -2040,7 +2042,7 @@
         jclass clazz = _dw_find_class(env, DW_CLASS_NAME);
         // Get the method that you want to call
         jmethodID percentSetRange = env->GetMethodID(clazz, "percentSetRange",
-                                                     "(Landroid/widget/ProgressBar;I)V");
+                                                     "(Landroid/view/View;I)V");
         // Call the method on the object
         env->CallVoidMethod(_dw_obj, percentSetRange, handle, (jint)range);
         _dw_jni_check_exception(env);
@@ -2088,7 +2090,7 @@
         jclass clazz = _dw_find_class(env, DW_CLASS_NAME);
         // Get the method that you want to call
         jmethodID percentSetPos = env->GetMethodID(clazz, "percentSetPos",
-                                                   "(Landroid/widget/ProgressBar;I)V");
+                                                   "(Landroid/view/View;I)V");
         // Call the method on the object
         env->CallVoidMethod(_dw_obj, percentSetPos, handle, (jint)position);
         _dw_jni_check_exception(env);