Mercurial > dwindows
changeset 2503:1c2a79313b04
Android: Implment dw_window_hide/show(). Set the initial visibility to GONE.
The window won't be laid out until dw_window_show() is called on the window.
Put the dwindowsInit() hack back in... keep hoping some of these changes
will fix it, but it persists. HTML mostly works, but getting cache miss?
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 06 May 2021 10:39:55 +0000 |
parents | b6319aed3298 |
children | 25c56d77d016 |
files | android/DWindows.kt android/dw.cpp |
diffstat | 2 files changed, 36 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/android/DWindows.kt Thu May 06 09:55:32 2021 +0000 +++ b/android/DWindows.kt Thu May 06 10:39:55 2021 +0000 @@ -123,6 +123,7 @@ var dataArrayMap = SimpleArrayMap<String, Long>() windowLayout = LinearLayout(this) + windowLayout!!.visibility = View.GONE windowLayout!!.tag = dataArrayMap setContentView(windowLayout) this.title = title @@ -201,6 +202,17 @@ return text } + fun windowHideShow(window: View, state: Int) + { + waitOnUiThread { + if(state == 0) { + window.visibility = View.GONE + } else { + window.visibility = View.VISIBLE + } + } + } + fun clipboardGetText(): String { var cm: ClipboardManager = getSystemService(CLIPBOARD_SERVICE) as ClipboardManager var clipdata = cm.primaryClip
--- a/android/dw.cpp Thu May 06 09:55:32 2021 +0000 +++ b/android/dw.cpp Thu May 06 10:39:55 2021 +0000 @@ -90,7 +90,11 @@ static int runcount = 0; /* Safety check to prevent multiple initializations... */ +#if defined(__arm__) || defined(__aarch64__) if(runcount == 0) +#else + if(runcount == 1) +#endif { char *arg = strdup(env->GetStringUTFChars((jstring) path, NULL)); @@ -3264,6 +3268,24 @@ { } +int _dw_window_hide_show(HWND handle, int state) +{ + 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 windowHideShow = env->GetMethodID(clazz, "windowHideShow", + "(Landroid/view/View;I)V"); + // Call the method on the object + env->CallVoidMethod(_dw_obj, windowHideShow, handle, state); + return DW_ERROR_NONE; + } + return DW_ERROR_GENERAL; +} + /* * Makes the window visible. * Parameters: @@ -3273,7 +3295,7 @@ */ int API dw_window_show(HWND handle) { - return DW_ERROR_GENERAL; + return _dw_window_hide_show(handle, TRUE); } /* @@ -3285,7 +3307,7 @@ */ int API dw_window_hide(HWND handle) { - return DW_ERROR_GENERAL; + return _dw_window_hide_show(handle, FALSE); } /*