Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update WheelView.java 修复TV端无法循环切换问题 #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,10 @@ public boolean onKeyDown(int keyCode, KeyEvent event) {
if (!(count == 0 || nextItem >= count)) {
setCurrentItem(nextItem);
handler.sendEmptyMessage(MessageHandler.WHAT_ITEM_SELECTED);
} else if (isLoop) {
nextItem = getLoopMappingIndex(getCurrentItem() + 1);
setCurrentItem(nextItem);
handler.sendEmptyMessage(MessageHandler.WHAT_ITEM_SELECTED);
}
return true;
} else if (keyCode == KeyEvent.KEYCODE_DPAD_UP) {
Expand All @@ -653,6 +657,10 @@ public boolean onKeyDown(int keyCode, KeyEvent event) {
if (!(count == 0 || preItem < 0)) {
setCurrentItem(preItem);
handler.sendEmptyMessage(MessageHandler.WHAT_ITEM_SELECTED);
} else if (isLoop) {
preItem = getLoopMappingIndex(getCurrentItem() - 1);
setCurrentItem(preItem);
handler.sendEmptyMessage(MessageHandler.WHAT_ITEM_SELECTED);
}
return true;
}
Expand All @@ -663,4 +671,4 @@ private float dp2px(Context context, float dipValue) {
final float scale = context.getResources().getDisplayMetrics().density;
return dipValue * scale + 0.5f;
}
}
}