优化了键盘操作

This commit is contained in:
zxj
2025-07-25 15:58:11 +08:00
parent c2bae2f3e8
commit c0a628c51f
5 changed files with 11 additions and 6 deletions
@@ -87,6 +87,10 @@ class LoginByFaceActivity : BaseActivity<ActivityLoginFaceBinding>(),
permissionHelper.checkAndRequest() permissionHelper.checkAndRequest()
} }
override fun onLeftDoubleClick() {
finish()
}
private var isRecognition = false private var isRecognition = false
private var rgbCameraHelper: DualCameraHelper? = null private var rgbCameraHelper: DualCameraHelper? = null
private var rgbFaceRectTransformer: FaceRectTransformer? = null private var rgbFaceRectTransformer: FaceRectTransformer? = null
@@ -17,9 +17,6 @@ class LoginByPwdActivity : BaseActivity<ActivityLoginByPwdBinding>() {
} }
override fun initialize() { override fun initialize() {
binding.etPhone.setOnFocusChangeListener { v, hasFocus ->
if (hasFocus) KeyboardUtils.showKeyboard(v)
}
binding.btnLogin.setOnClickListener { binding.btnLogin.setOnClickListener {
val phone = binding.etPhone.text.toString() val phone = binding.etPhone.text.toString()
val pwd = binding.etPwd.text.toString() val pwd = binding.etPwd.text.toString()
@@ -46,6 +46,7 @@
android:layout_marginEnd="20dp" android:layout_marginEnd="20dp"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:hint="输入手机后四位" android:hint="输入手机后四位"
android:imeOptions="actionNext"
android:inputType="number" android:inputType="number"
android:maxLength="4" android:maxLength="4"
android:maxLines="1" android:maxLines="1"
@@ -90,6 +91,7 @@
android:maxLines="1" android:maxLines="1"
android:textColor="#F3D2BD" android:textColor="#F3D2BD"
android:textColorHint="#7B6D6A" android:textColorHint="#7B6D6A"
android:imeOptions="actionDone"
android:textSize="26sp" android:textSize="26sp"
android:textStyle="bold" /> android:textStyle="bold" />
@@ -122,7 +122,7 @@
android:background="@color/transparent" android:background="@color/transparent"
android:gravity="center" android:gravity="center"
android:hint="请输入会员姓名或手机号" android:hint="请输入会员姓名或手机号"
android:imeOptions="actionSearch" android:imeOptions="actionDone"
android:inputType="text" android:inputType="text"
android:maxLines="1" android:maxLines="1"
android:textColor="#F0C8B4" android:textColor="#F0C8B4"
@@ -22,6 +22,7 @@ public class ScanGunKeyEventHelper {
// private String mDeviceName = "TMC HIDKeyBoard"; // private String mDeviceName = "TMC HIDKeyBoard";
private String mDeviceName = "Linux 3.4.35 with ak-hsudc Composite Gadget (ACM + HID)"; private String mDeviceName = "Linux 3.4.35 with ak-hsudc Composite Gadget (ACM + HID)";
private String mDeviceName1 = "USBKey Chip USBKey Module";
public ScanGunKeyEventHelper(Context context, OnScanSuccessListener onScanSuccessListener) { public ScanGunKeyEventHelper(Context context, OnScanSuccessListener onScanSuccessListener) {
@@ -156,9 +157,10 @@ public class ScanGunKeyEventHelper {
*/ */
public boolean isScanGunEvent(KeyEvent event) { public boolean isScanGunEvent(KeyEvent event) {
if (event == null || event.getDevice() == null) return false; if (event == null || event.getDevice() == null) return false;
L.e("event===" + event.getDevice().getName() + String deviceName = event.getDevice().getName();
L.e("event===" + deviceName +
"===Char===" + event.getCharacters() + "===Char===" + event.getCharacters() +
"===Action===" + event.getAction()); "===Action===" + event.getAction());
return event.getDevice().getName().equals(mDeviceName); return deviceName.equals(mDeviceName) || deviceName.equals(mDeviceName1);
} }
} }