在我正在测试的一部手机上(HTC Incredible,Android 2.2,软件3.21.605.1),我遇到以下行为.
当按下Sense UI键盘上的Enter键时,将立即调用onEditorAction事件处理程序两次(立即).
KeyEvent.getEventTime()对于调用事件的两次都是相同的,这导致我解决这个问题:
protected void onCreate(Bundle savedInstanceState) {
[...]
EditText text = (EditText)findViewById(R.id.txtBox);
text.setOnEditorActionListener(new OnEditorActionListener() {
private long lastCalled = -1;
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if ( event.getEventTime() == lastCalled ) {
return false;
} else {
lastCalled = event.getEventTime();
handleNextButton(v);
return true;
}
}
});
[...]
}
Run Code Online (Sandbox Code Playgroud)
EditText定义为:
<EditText
android:layout_width="150sp"
android:layout_height="wrap_content"
android:id="@+id/txtBox"
android:imeOptions="actionNext"
android:capitalize="characters"
android:singleLine="true"
android:inputType="textVisiblePassword|textCapCharacters|textNoSuggestions"
android:autoText="false"
android:editable="true"
android:maxLength="6"
/>
Run Code Online (Sandbox Code Playgroud)
在我测试过的所有其他设备上,操作按钮被正确标记为"下一步",并且该事件仅在按下该按钮时被调用一次.
这是Sense UI键盘中的错误,还是我做错了什么?
谢谢你的帮助.
更新 - 由于给出的答案,我已经确定以下作为我的检查.这在我可用于测试的两部手机上都能正常工作(Sense UI和Cyanogenmod CM7)
if (event …
Run Code Online (Sandbox Code Playgroud) 这个问题主要是关于旧版本的 PrestoSQL,它已在(现已重命名)Trino 项目中从版本 346 开始解决。但是,亚马逊的 Athena 项目基于 Presto 版本 0.217(Athena Engine 2)和 0.172(Athena Engine 1) ),它确实存在下面描述的问题。这个问题是专门围绕 Athena Engine 1 / PrestoSQL 0.172 版编写的
ROWS BETWEEN
和RANGE BETWEEN
Presto 窗口函数有什么区别?
ROWS BETWEEN
允许比RANGE BETWEEN
?ROWS BETWEEN
和上使用完全相同的参数RANGE BETWEEN
并获得不同结果的查询场景?
unbounded
/ current row
,是否有您会使用RANGE
而不是ROWS
(或反之亦然)的场景?ROWS
有更多选择,为什么文档中根本没有提到它?o_o该急文档是相当安静的约什RANGE
,并没有提及ROWS
。我在 Presto 中没有找到很多关于窗口函数的讨论或示例。我开始通过 Presto 代码库来尝试解决这个问题。希望有人能帮我避免这种情况,我们可以一起改进文档。