1 /* 2 * Copyright (C) 2020 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.car.ui.utils; 18 19 /** 20 * Constants for the rotary controller. 21 * 22 * @hide 23 */ 24 public final class RotaryConstants { 25 /** 26 * Content description indicating that the view is a rotary container. 27 * <p> 28 * A rotary container contains focusable elements. When initializing focus, the first element 29 * in the rotary container is prioritized to take focus. When searching for nudge target, the 30 * bounds of the rotary container is the minimum bounds containing its descendants. 31 * <p> 32 * A rotary container shouldn't be focusable unless it's a scrollable container. Though it 33 * can't be focused, it can be scrolled as a side-effect of moving the focus within it. 34 */ 35 public static final String ROTARY_CONTAINER = 36 "com.android.car.ui.utils.ROTARY_CONTAINER"; 37 38 /** 39 * Content description indicating that the view is a scrollable container and can be scrolled 40 * horizontally by the rotary controller. 41 * <p> 42 * A scrollable container is a focusable rotary container. When it's focused, it can be scrolled 43 * when the rotary controller rotates. A scrollable container is often used to show long text. 44 */ 45 public static final String ROTARY_HORIZONTALLY_SCROLLABLE = 46 "com.android.car.ui.utils.HORIZONTALLY_SCROLLABLE"; 47 48 /** 49 * Content description indicating that the view is a scrollable container and can be scrolled 50 * vertically by the rotary controller. 51 * <p> 52 * A scrollable container is a focusable rotary container. When it's focused, it can be scrolled 53 * when the rotary controller rotates. A scrollable container is often used to show long text. 54 */ 55 public static final String ROTARY_VERTICALLY_SCROLLABLE = 56 "com.android.car.ui.utils.VERTICALLY_SCROLLABLE"; 57 58 /** 59 * Content description indicating that the view is a focus delegating container. When 60 * restoring focus, FocusParkingView and focus area will skip non-focusable views unless it's 61 * a focus delegating container. The focus delegating container can delegate focus to one of 62 * its descendants. 63 */ 64 public static final String ROTARY_FOCUS_DELEGATING_CONTAINER = 65 "com.android.car.ui.utils.FOCUS_DELEGATING_CONTAINER"; 66 67 /** 68 * The key to store the offset of the view's left bound for nudge in the node's extras. 69 * <p> 70 * Usually this value is positive in order to shrink the bounds. But a negative value can also 71 * be used to extend the bounds if needed. 72 */ 73 public static final String LEFT_BOUND_OFFSET_FOR_NUDGE = 74 "com.android.car.ui.utils.LEFT_BOUND_OFFSET_FOR_NUDGE"; 75 76 /** 77 * The key to store the offset of the view's right bound for nudge in the node's extras. 78 * <p> 79 * Usually this value is positive in order to shrink the bounds. But a negative value can also 80 * be used to extend the bounds if needed. 81 */ 82 public static final String RIGHT_BOUND_OFFSET_FOR_NUDGE = 83 "com.android.car.ui.utils.RIGHT_BOUND_OFFSET_FOR_NUDGE"; 84 85 /** 86 * The key to store the offset of the view's top bound for nudge in the node's extras. 87 * <p> 88 * Usually this value is positive in order to shrink the bounds. But a negative value can also 89 * be used to extend the bounds if needed. 90 */ 91 public static final String TOP_BOUND_OFFSET_FOR_NUDGE = 92 "com.android.car.ui.utils.TOP_BOUND_OFFSET_FOR_NUDGE"; 93 94 /** 95 * The key to store the offset of the view's bottom bound for nudge in the node's extras. 96 * <p> 97 * Usually this value is positive in order to shrink the bounds. But a negative value can also 98 * be used to extend the bounds if needed. 99 */ 100 public static final String BOTTOM_BOUND_OFFSET_FOR_NUDGE = 101 "com.android.car.ui.utils.BOTTOM_BOUND_OFFSET_FOR_NUDGE"; 102 103 /** The key to store the offset of the focus area's left bound in the node's extras. */ 104 public static final String FOCUS_AREA_LEFT_BOUND_OFFSET = 105 "com.android.car.ui.utils.FOCUS_AREA_LEFT_BOUND_OFFSET"; 106 107 /** The key to store the offset of the focus area's right bound in the node's extras. */ 108 public static final String FOCUS_AREA_RIGHT_BOUND_OFFSET = 109 "com.android.car.ui.utils.FOCUS_AREA_RIGHT_BOUND_OFFSET"; 110 111 /** The key to store the offset of the focus area's top bound in the node's extras. */ 112 public static final String FOCUS_AREA_TOP_BOUND_OFFSET = 113 "com.android.car.ui.utils.FOCUS_AREA_TOP_BOUND_OFFSET"; 114 115 /** The key to store the offset of the focus area's bottom bound in the node's extras. */ 116 public static final String FOCUS_AREA_BOTTOM_BOUND_OFFSET = 117 "com.android.car.ui.utils.FOCUS_AREA_BOTTOM_BOUND_OFFSET"; 118 119 /** The key to store nudge direction in the Bundle. */ 120 public static final String NUDGE_DIRECTION = 121 "com.android.car.ui.utils.NUDGE_DIRECTION"; 122 123 /** The accessibility class name of {@link com.android.car.ui.IFocusArea} implementations. */ 124 public static final String I_FOCUS_AREA_CLASS_NAME = "com.android.car.ui.FocusArea"; 125 126 /** 127 * Action performed on a focus area to move focus to the nudge shortcut within the same 128 * focus area. 129 * <p> 130 * This action and the actions below only use the most significant 8 bits to avoid 131 * conflicting with legacy standard actions (which don't use the most significant 8 bits), 132 * e.g. ACTION_FOCUS. The actions only use one bit to avoid conflicting with IDs defined in 133 * framework (which start with 0x0102), e.g. R.id.accessibilityActionScrollUp. 134 */ 135 public static final int ACTION_NUDGE_SHORTCUT = 0x01000000; 136 137 /** Action performed on a focus area to move focus to another focus area. */ 138 public static final int ACTION_NUDGE_TO_ANOTHER_FOCUS_AREA = 0x02000000; 139 140 /** Action performed on a FocusParkingView to restore the focus in the window. */ 141 public static final int ACTION_RESTORE_DEFAULT_FOCUS = 0x04000000; 142 143 /** Action performed on a FocusParkingView to hide the IME. */ 144 public static final int ACTION_HIDE_IME = 0x08000000; 145 146 /** Action performed on a FocusParkingView to dismiss a popup window. */ 147 public static final int ACTION_DISMISS_POPUP_WINDOW = 0x10000000; 148 149 /** Prevent instantiation. */ RotaryConstants()150 private RotaryConstants() { 151 } 152 } 153