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 FocusArea 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 /** The key to store the offset of the FocusArea's left bound in the node's extras. */ 68 public static final String FOCUS_AREA_LEFT_BOUND_OFFSET = 69 "com.android.car.ui.utils.FOCUS_AREA_LEFT_BOUND_OFFSET"; 70 71 /** The key to store the offset of the FocusArea's right bound in the node's extras. */ 72 public static final String FOCUS_AREA_RIGHT_BOUND_OFFSET = 73 "com.android.car.ui.utils.FOCUS_AREA_RIGHT_BOUND_OFFSET"; 74 75 /** The key to store the offset of the FocusArea's top bound in the node's extras. */ 76 public static final String FOCUS_AREA_TOP_BOUND_OFFSET = 77 "com.android.car.ui.utils.FOCUS_AREA_TOP_BOUND_OFFSET"; 78 79 /** The key to store the offset of the FocusArea's bottom bound in the node's extras. */ 80 public static final String FOCUS_AREA_BOTTOM_BOUND_OFFSET = 81 "com.android.car.ui.utils.FOCUS_AREA_BOTTOM_BOUND_OFFSET"; 82 83 /** The key to store nudge direction in the Bundle. */ 84 public static final String NUDGE_DIRECTION = 85 "com.android.car.ui.utils.NUDGE_DIRECTION"; 86 87 /** 88 * Action performed on a FocusArea to move focus to the nudge shortcut within the same 89 * FocusArea. 90 * <p> 91 * This action and the actions below only use the most significant 8 bits to avoid 92 * conflicting with legacy standard actions (which don't use the most significant 8 bits), 93 * e.g. ACTION_FOCUS. The actions only use one bit to avoid conflicting with IDs defined in 94 * framework (which start with 0x0102), e.g. R.id.accessibilityActionScrollUp. 95 */ 96 public static final int ACTION_NUDGE_SHORTCUT = 0x01000000; 97 98 /** Action performed on a FocusArea to move focus to another FocusArea. */ 99 public static final int ACTION_NUDGE_TO_ANOTHER_FOCUS_AREA = 0x02000000; 100 101 /** Action performed on a FocusParkingView to restore the focus in the window. */ 102 public static final int ACTION_RESTORE_DEFAULT_FOCUS = 0x04000000; 103 104 /** Action performed on a FocusParkingView to hide the IME. */ 105 public static final int ACTION_HIDE_IME = 0x08000000; 106 107 /** Prevent instantiation. */ RotaryConstants()108 private RotaryConstants() { 109 } 110 } 111