6.7.0 - Alpha23 - Fine tuning
This commit is contained in:
@@ -39,6 +39,7 @@ import android.view.accessibility.AccessibilityEvent
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import android.view.inputmethod.InputConnection
|
||||
import android.view.inputmethod.InputConnectionWrapper
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.TextViewHelper
|
||||
import androidx.appcompat.widget.AppCompatEditText
|
||||
import androidx.core.graphics.withTranslation
|
||||
@@ -56,6 +57,7 @@ import java.util.concurrent.CopyOnWriteArrayList
|
||||
* Created by Administrator on Feb 11, 2018.
|
||||
* Modified by SuperMonster003 as of May 1, 2023.
|
||||
* Modified by JetBrains AI Assistant (GPT-5.2) as of Feb 8, 2026.
|
||||
* Modified by JetBrains AI Assistant (GPT-5.3-Codex (xhigh)) as of Mar 8, 2026.
|
||||
*/
|
||||
class CodeEditText : AppCompatEditText {
|
||||
|
||||
@@ -717,6 +719,9 @@ class CodeEditText : AppCompatEditText {
|
||||
// zh-CN: 当用户触摸文本区域 (非行号区域) 时尽早通知外层.
|
||||
if (event.action == MotionEvent.ACTION_DOWN && event.x >= paddingLeft) {
|
||||
onUserTouchInTextArea?.invoke()
|
||||
// Best-effort IME wake-up for devices/ROMs where tap-to-show may be missed.
|
||||
// zh-CN: 兜底唤起输入法, 兼容部分设备/ROM 点按后未自动弹出软键盘的情况.
|
||||
requestSoftInputIfEditable()
|
||||
}
|
||||
|
||||
// 如果行号区域被按下
|
||||
@@ -749,6 +754,20 @@ class CodeEditText : AppCompatEditText {
|
||||
return super.onTouchEvent(event)
|
||||
}
|
||||
|
||||
private fun requestSoftInputIfEditable() {
|
||||
if (mReadOnly || !showSoftInputOnFocus) return
|
||||
if (!isFocusable || !isFocusableInTouchMode) return
|
||||
|
||||
post {
|
||||
if (mReadOnly || !showSoftInputOnFocus) return@post
|
||||
if (!hasFocus()) {
|
||||
requestFocus()
|
||||
}
|
||||
val imm = context.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager ?: return@post
|
||||
imm.showSoftInput(this@CodeEditText, InputMethodManager.SHOW_IMPLICIT)
|
||||
}
|
||||
}
|
||||
|
||||
fun removeBreakpoint(line: Int): Boolean {
|
||||
breakpoints.remove(line) ?: return false
|
||||
breakpointChangeListener?.onBreakpointChange(line, false)
|
||||
@@ -793,4 +812,4 @@ class CodeEditText : AppCompatEditText {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import java.lang.ref.WeakReference;
|
||||
* Created by Stardust on Dec 9, 2017.
|
||||
* <a href="https://github.com/dss886/Android-FunctionsInputDetector">Android-FunctionsInputDetector</a>
|
||||
* Modified by JetBrains AI Assistant (GPT-5.2) as of Feb 11, 2026.
|
||||
* Modified by JetBrains AI Assistant (GPT-5.3-Codex (xhigh)) as of Mar 8, 2026.
|
||||
*/
|
||||
public class FunctionsKeyboardHelper implements BackPressedHandler {
|
||||
|
||||
@@ -97,7 +98,7 @@ public class FunctionsKeyboardHelper implements BackPressedHandler {
|
||||
}
|
||||
|
||||
public FunctionsKeyboardHelper build() {
|
||||
mActivityRef.get().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN |
|
||||
mActivityRef.get().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN |
|
||||
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||
hideSoftInput();
|
||||
return this;
|
||||
@@ -229,4 +230,4 @@ public class FunctionsKeyboardHelper implements BackPressedHandler {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user