Mercurial > dwindows
diff android/DWindows.kt @ 2510:f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
Started enabling all notebook tabs in the test program... but a number of
controls still missing, so functionality is still spotty at this point.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 07 May 2021 09:35:14 +0000 |
parents | a149dabf6a1f |
children | 5f711e86a211 |
line wrap: on
line diff
--- a/android/DWindows.kt Thu May 06 23:29:13 2021 +0000 +++ b/android/DWindows.kt Fri May 07 09:35:14 2021 +0000 @@ -3,7 +3,6 @@ import android.content.ClipData import android.content.ClipboardManager import android.content.DialogInterface -import android.content.Intent import android.content.pm.ActivityInfo import android.content.res.Configuration import android.graphics.Bitmap @@ -15,12 +14,14 @@ import android.os.Looper import android.text.InputFilter import android.text.InputFilter.LengthFilter +import android.text.InputType import android.text.method.PasswordTransformationMethod import android.util.Base64 import android.util.Log import android.view.Gravity import android.view.View import android.view.ViewGroup +import android.view.inputmethod.EditorInfo import android.webkit.WebView import android.webkit.WebViewClient import android.widget.* @@ -533,6 +534,101 @@ return textview } + fun mleNew(cid: Int): EditText? + { + var mle: EditText? = null + + waitOnUiThread { + var dataArrayMap = SimpleArrayMap<String, Long>() + + mle = EditText(this) + mle!!.tag = dataArrayMap + mle!!.id = cid + mle!!.isSingleLine = false + mle!!.imeOptions = EditorInfo.IME_FLAG_NO_ENTER_ACTION + mle!!.inputType = (InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_MULTI_LINE) + mle!!.isVerticalScrollBarEnabled = true + mle!!.scrollBarStyle = View.SCROLLBARS_INSIDE_INSET + mle!!.setHorizontallyScrolling(true) + } + return mle + } + + fun mleSetWordWrap(mle: EditText, state: Int) + { + waitOnUiThread { + if (state != 0) { + mle.setHorizontallyScrolling(false) + } else { + mle.setHorizontallyScrolling(true) + } + } + } + + fun mleSetEditable(mle: EditText, state: Int) + { + waitOnUiThread { + if (state != 0) { + mle!!.inputType = (InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_MULTI_LINE) + } else { + mle!!.inputType = InputType.TYPE_NULL + } + } + } + + fun mleSetCursor(mle: EditText, point: Int) + { + waitOnUiThread { + mle.setSelection(point) + } + } + + fun mleClear(mle: EditText) + { + waitOnUiThread { + mle.setText("") + } + } + + fun mleImport(mle: EditText, text: String, startpoint: Int): Int + { + var retval: Int = startpoint + + waitOnUiThread { + val origtext = mle.text + val origlen = origtext.toString().length + + if(startpoint < 1) { + val newtext = text + origtext.toString() + + mle.setText(newtext) + retval = origlen + text.length + } else if(startpoint >= origlen) { + val newtext = origtext.toString() + text + + mle.setText(newtext) + retval = origlen + text.length + } else { + val newtext = origtext.substring(0, startpoint) + text + origtext.substring(startpoint) + + mle.setText(newtext) + retval = startpoint + text.length + } + mle.setSelection(retval) + } + return retval + } + + fun mleDelete(mle: EditText, startpoint: Int, length: Int) + { + waitOnUiThread { + val origtext = mle.text + val newtext = origtext.substring(0, startpoint) + origtext.substring(startpoint + length) + + mle.setText(newtext) + } + } + fun notebookNew(cid: Int, top: Int): RelativeLayout? { var notebook: RelativeLayout? = null @@ -778,7 +874,7 @@ } override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) { - eventHandler(slider, null, 14, null, null, slider!!.progress, 0, 0, 0) + eventHandlerInt(slider as View, 14, slider!!.progress, 0, 0, 0) } }) }