Mercurial > dwindows
changeset 2707:a3f6ca621453
Android: Implement dw_mle_set_visible(). Also fix various warnings.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 19 Nov 2021 02:49:53 +0000 |
parents | 4e9eba7f7226 |
children | 3a7dcc0ae08b |
files | android/DWindows.kt android/dw.cpp |
diffstat | 2 files changed, 28 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/android/DWindows.kt Fri Nov 19 02:20:11 2021 +0000 +++ b/android/DWindows.kt Fri Nov 19 02:49:53 2021 +0000 @@ -64,9 +64,6 @@ import java.util.zip.ZipFile import android.content.Intent - - - object DWEvent { const val TIMER = 0 const val CONFIGURE = 1 @@ -333,7 +330,7 @@ // filter on file extension private var extension: String? = null fun setExtension(extension: String?) { - this.extension = extension?.toLowerCase(Locale.ROOT) + this.extension = extension?.lowercase(Locale.ROOT) } // file selection event handling @@ -366,7 +363,7 @@ } else if (extension == null) { true } else { - file.name.toLowerCase(Locale.ROOT).endsWith(extension!!) + file.name.lowercase(Locale.ROOT).endsWith(extension!!) } } else { false @@ -989,7 +986,7 @@ menuBar = DWMenu() windowMenuBars[index] = menuBar } - menuBar!!.menu = menu + menuBar.menu = menu return super.onCreateOptionsMenu(menu) } } @@ -1005,10 +1002,10 @@ var menuBar = windowMenuBars[index] if(menuBar != null) { - menuBar!!.createMenu(menu, true) + menuBar.createMenu(menu, true) } else { menuBar = DWMenu() - menuBar!!.createMenu(menu, true) + menuBar.createMenu(menu, true) windowMenuBars[index] = menuBar } return super.onPrepareOptionsMenu(menu) @@ -2189,6 +2186,15 @@ return mle } + fun mleSetVisible(mle: EditText, line: Int) + { + waitOnUiThread { + val y: Int = mle.layout.getLineTop(line) + + mle.scrollTo(0, y) + } + } + fun mleSetWordWrap(mle: EditText, state: Int) { waitOnUiThread { @@ -2658,7 +2664,7 @@ fun splitBarSet(splitbar: ConstraintLayout, position: Float) { waitOnUiThread { val dataArrayMap: SimpleArrayMap<String, Long> = splitbar.tag as SimpleArrayMap<String, Long> - var percent: Float = position * 1000000.0F + val percent: Float = position * 1000000.0F if(percent > 0F) { val topleft: View? = splitbar.getChildAt(0)
--- a/android/dw.cpp Fri Nov 19 02:20:11 2021 +0000 +++ b/android/dw.cpp Fri Nov 19 02:49:53 2021 +0000 @@ -2684,6 +2684,19 @@ */ void API dw_mle_set_visible(HWND handle, int line) { + JNIEnv *env; + + if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) + { + // 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 mleSetVisible = env->GetMethodID(clazz, "mleSetVisible", + "(Landroid/widget/EditText;I)V"); + // Call the method on the object + env->CallVoidMethod(_dw_obj, mleSetVisible, handle, line); + _dw_jni_check_exception(env); + } } /*