comparison android/DWindows.kt @ 2701:9df2c11f020f

Android: Fix dw_mle_set_word_wrap() and dw_mle_set_cursor(). Calling the wrong method in dw_mle_set_cursor(). Set maxWidth on MLE resize based on Word Wrap setting.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 16 Nov 2021 20:15:18 +0000
parents cee79add3669
children 4f12dc8e8f18
comparison
equal deleted inserted replaced
2700:246f23670e3b 2701:9df2c11f020f
807 } 807 }
808 return rowView 808 return rowView
809 } 809 }
810 } 810 }
811 811
812 private class DWMLE(c: Context): androidx.appcompat.widget.AppCompatEditText(c) {
813 protected override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
814 if(!isHorizontalScrollBarEnabled) {
815 this.maxWidth = w
816 } else {
817 this.maxWidth = -1
818 }
819 super.onSizeChanged(w, h, oldw, oldh)
820 }
821 }
822
812 class DWindows : AppCompatActivity() { 823 class DWindows : AppCompatActivity() {
813 var windowLayout: ViewPager2? = null 824 var windowLayout: ViewPager2? = null
814 var threadLock = ReentrantLock() 825 var threadLock = ReentrantLock()
815 var threadCond = threadLock.newCondition() 826 var threadCond = threadLock.newCondition()
816 var notificationID: Int = 0 827 var notificationID: Int = 0
2130 var mle: EditText? = null 2141 var mle: EditText? = null
2131 2142
2132 waitOnUiThread { 2143 waitOnUiThread {
2133 val dataArrayMap = SimpleArrayMap<String, Long>() 2144 val dataArrayMap = SimpleArrayMap<String, Long>()
2134 2145
2135 mle = EditText(this) 2146 mle = DWMLE(this)
2136 mle!!.tag = dataArrayMap 2147 mle!!.tag = dataArrayMap
2137 mle!!.id = cid 2148 mle!!.id = cid
2138 mle!!.isSingleLine = false 2149 mle!!.isSingleLine = false
2139 mle!!.maxLines = Integer.MAX_VALUE 2150 mle!!.maxLines = Integer.MAX_VALUE
2140 mle!!.imeOptions = EditorInfo.IME_FLAG_NO_ENTER_ACTION 2151 mle!!.imeOptions = EditorInfo.IME_FLAG_NO_ENTER_ACTION