private boolean moveFocus(boolean positive) { ensureFocus(); boolean focusChanged = false; if (positive) { if (focusedVirtualView == ExploreByTouchHelper.HOST_ID) { setFocusedVirtualView(CLOSE_ICON_VIRTUAL_ID); focusChanged = true; } } else { if (focusedVirtualView == CLOSE_ICON_VIRTUAL_ID) { setFocusedVirtualView(ExploreByTouchHelper.HOST_ID); focusChanged = true; } } return focusChanged; }
public void clearFocusedVirtualView() { final int focusedVirtualView = getFocusedVirtualView(); if (focusedVirtualView != ExploreByTouchHelper.INVALID_ID) { getAccessibilityNodeProvider(MonthView.this).performAction( focusedVirtualView, AccessibilityNodeInfoCompat.ACTION_CLEAR_ACCESSIBILITY_FOCUS, null); } }
@Override protected int getVirtualViewAt(float x, float y) { final int day = getDayFromLocation(x, y); if (day >= 0) { return day; } return ExploreByTouchHelper.INVALID_ID; }
private int setViewSize(int mode, int size, int drawableWidth) { switch (mode) { case ExploreByTouchHelper.INVALID_ID /*-2147483648*/: return Math.min(drawableWidth, size); case 0 /*0*/: return drawableWidth; case 1073741824: return size; default: return size; } }
@Override protected int getVirtualViewAt(float x, float y) { final int day = getDayAtLocation((int) (x + 0.5f), (int) (y + 0.5f)); if (day != -1) { return day; } return ExploreByTouchHelper.INVALID_ID; }
@Override protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) { if (focused) { // If we've gained focus from another view, always focus the chip first. setFocusedVirtualView(ExploreByTouchHelper.HOST_ID); } else { setFocusedVirtualView(ExploreByTouchHelper.INVALID_ID); } invalidate(); super.onFocusChanged(focused, direction, previouslyFocusedRect); }
public void clearFocusedVirtualView() { final int focusedVirtualView = getFocusedVirtualView(); if (focusedVirtualView != ExploreByTouchHelper.INVALID_ID) { getAccessibilityNodeProvider( MonthView.this).performAction( focusedVirtualView, AccessibilityNodeInfoCompat.ACTION_CLEAR_ACCESSIBILITY_FOCUS, null); } }