fix(输入法): 消除RTOS和Android文字键盘间距

这个提交包含在:
sydxky 于 2026-11-14 17:38:11 +08:00 提交
1 父节点 87aa966a51
当前提交 bce6f8083b
27 个文件已更改
+406 -253

没有与搜索条件相匹配的文件

+2 -2
查看文件
@@ -12,8 +12,8 @@ android {
applicationId 'com.sydxky.crabinput'
minSdk 27
targetSdk 35
versionCode 10200
versionName '1.2.0'
versionCode 10202
versionName '1.2.2'
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
signingConfigs {
@@ -113,4 +113,24 @@ public class ImeDeviceTest {
UiObject2 delete=device.wait(Until.findObject(By.desc("删除")),5000);Rect bounds=delete.getVisibleBounds();device.swipe(bounds.centerX(),bounds.centerY(),bounds.centerX(),bounds.centerY(),160);SystemClock.sleep(150);action("收起键盘");
int count=device.findObject(By.desc("demo_text")).getText().length();assertTrue("Hold repeats deletion",count<14);SystemClock.sleep(300);assertEquals("Release stops repeat",count,device.findObject(By.desc("demo_text")).getText().length());
}
@Test public void directModesHaveNoUnusedCandidateGap() throws Exception {
editor("demo_text");
Context context=InstrumentationRegistry.getInstrumentation().getTargetContext();
String[][] modes={{"abc","英文","q","english"},{"123","数字","1","number"},{"符号","符号 · 1/3 · 再点符号翻页",",","symbols"}};
for(String[] mode:modes){
tap(mode[0]);
UiObject2 caption=device.findObject(By.pkg(PKG).text(mode[1]));
UiObject2 first=device.findObject(By.pkg(PKG).text(mode[2]));
UiObject2 preview=device.findObject(By.pkg(PKG).desc("编辑光标"));
assertNotNull(caption);assertNotNull(first);assertNotNull(preview);
Rect captionBounds=caption.getVisibleBounds(),keyBounds=first.getVisibleBounds();
int gap=keyBounds.top-captionBounds.bottom;
assertTrue("No blank candidate band: "+mode[3]+" gap="+gap,gap>=0&&gap<=Math.ceil(device.getDisplayHeight()*4/410f));
int previewGap=captionBounds.top-preview.getVisibleBounds().bottom;
assertTrue("Preview joins composition",previewGap>=0&&previewGap<=Math.ceil(device.getDisplayHeight()*3/410f));
for(UiObject2 button:device.findObjects(By.pkg(PKG).clazz("android.widget.Button")))assertRoundSafe(button.getVisibleBounds());
assertTrue(device.takeScreenshot(new java.io.File(context.getExternalFilesDir(null),"gap-"+mode[3]+".png")));
}
action("收起键盘");
}
}