Loading packages/SystemUI/res/values/dimens.xml +3 −0 Original line number Diff line number Diff line Loading @@ -1977,6 +1977,9 @@ slowing down. Also for tutorial it should be fine to lean to the side of being more strict rather than not strict enough and not teaching user the proper gesture as a result.--> <dimen name="touchpad_recent_apps_gesture_velocity_threshold">0.05dp</dimen> <!-- Normal gesture threshold is system_gestures_distance_threshold but for tutorial we can exaggerate gesture, which also works much better with live tracking --> <dimen name="touchpad_tutorial_gestures_distance_threshold">48dp</dimen> <!-- Broadcast dialog --> <dimen name="broadcast_dialog_title_img_margin_top">18dp</dimen> Loading packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/composable/BackGestureTutorialScreen.kt +3 −5 Original line number Diff line number Diff line Loading @@ -51,8 +51,8 @@ fun BackGestureTutorialScreen(onDoneButtonClicked: () -> Unit, onBack: () -> Uni remember(recognizer) { GestureFlowAdapter(recognizer).gestureStateAsFlow.map { it.toGestureUiState( progressStartMark = "", progressEndMark = "", progressStartMarker = "", progressEndMarker = "", successAnimation = R.raw.trackpad_back_success, ) } Loading @@ -63,9 +63,7 @@ fun BackGestureTutorialScreen(onDoneButtonClicked: () -> Unit, onBack: () -> Uni @Composable private fun rememberBackGestureRecognizer(resources: Resources): GestureRecognizer { val distance = resources.getDimensionPixelSize( com.android.internal.R.dimen.system_gestures_distance_threshold ) resources.getDimensionPixelSize(R.dimen.touchpad_tutorial_gestures_distance_threshold) return remember(distance) { BackGestureRecognizer(distance) } } Loading packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/composable/GestureTutorialScreen.kt +11 −7 Original line number Diff line number Diff line Loading @@ -51,20 +51,20 @@ sealed interface GestureUiState { data class InProgress( val progress: Float = 0f, val progressStartMark: String = "", val progressEndMark: String = "", val progressStartMarker: String, val progressEndMarker: String, ) : GestureUiState } fun GestureState.toGestureUiState( progressStartMark: String, progressEndMark: String, progressStartMarker: String, progressEndMarker: String, successAnimation: Int, ): GestureUiState { return when (this) { GestureState.NotStarted -> NotStarted is GestureState.InProgress -> GestureUiState.InProgress(this.progress, progressStartMark, progressEndMark) GestureUiState.InProgress(this.progress, progressStartMarker, progressEndMarker) is GestureState.Finished -> GestureUiState.Finished(successAnimation) } } Loading @@ -72,8 +72,12 @@ fun GestureState.toGestureUiState( fun GestureUiState.toTutorialActionState(): TutorialActionState { return when (this) { NotStarted -> TutorialActionState.NotStarted // progress is disabled for now as views are not ready to handle varying progress is GestureUiState.InProgress -> TutorialActionState.InProgress(progress = 0f) is GestureUiState.InProgress -> TutorialActionState.InProgress( progress = progress, startMarker = progressStartMarker, endMarker = progressEndMarker, ) is Finished -> TutorialActionState.Finished(successAnimation) } } Loading packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/composable/HomeGestureTutorialScreen.kt +3 −5 Original line number Diff line number Diff line Loading @@ -50,8 +50,8 @@ fun HomeGestureTutorialScreen(onDoneButtonClicked: () -> Unit, onBack: () -> Uni remember(recognizer) { GestureFlowAdapter(recognizer).gestureStateAsFlow.map { it.toGestureUiState( progressStartMark = "", progressEndMark = "", progressStartMarker = "", progressEndMarker = "", successAnimation = R.raw.trackpad_home_success, ) } Loading @@ -62,9 +62,7 @@ fun HomeGestureTutorialScreen(onDoneButtonClicked: () -> Unit, onBack: () -> Uni @Composable private fun rememberHomeGestureRecognizer(resources: Resources): GestureRecognizer { val distance = resources.getDimensionPixelSize( com.android.internal.R.dimen.system_gestures_distance_threshold ) resources.getDimensionPixelSize(R.dimen.touchpad_tutorial_gestures_distance_threshold) return remember(distance) { HomeGestureRecognizer(distance) } } Loading packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/composable/RecentAppsGestureTutorialScreen.kt +3 −5 Original line number Diff line number Diff line Loading @@ -51,8 +51,8 @@ fun RecentAppsGestureTutorialScreen(onDoneButtonClicked: () -> Unit, onBack: () remember(recognizer) { GestureFlowAdapter(recognizer).gestureStateAsFlow.map { it.toGestureUiState( progressStartMark = "", progressEndMark = "", progressStartMarker = "", progressEndMarker = "", successAnimation = R.raw.trackpad_recent_apps_success, ) } Loading @@ -63,9 +63,7 @@ fun RecentAppsGestureTutorialScreen(onDoneButtonClicked: () -> Unit, onBack: () @Composable private fun rememberRecentAppsGestureRecognizer(resources: Resources): GestureRecognizer { val distance = resources.getDimensionPixelSize( com.android.internal.R.dimen.system_gestures_distance_threshold ) resources.getDimensionPixelSize(R.dimen.touchpad_tutorial_gestures_distance_threshold) val velocity = resources.getDimension(R.dimen.touchpad_recent_apps_gesture_velocity_threshold) return remember(distance, velocity) { RecentAppsGestureRecognizer(distance, velocity) } } Loading Loading
packages/SystemUI/res/values/dimens.xml +3 −0 Original line number Diff line number Diff line Loading @@ -1977,6 +1977,9 @@ slowing down. Also for tutorial it should be fine to lean to the side of being more strict rather than not strict enough and not teaching user the proper gesture as a result.--> <dimen name="touchpad_recent_apps_gesture_velocity_threshold">0.05dp</dimen> <!-- Normal gesture threshold is system_gestures_distance_threshold but for tutorial we can exaggerate gesture, which also works much better with live tracking --> <dimen name="touchpad_tutorial_gestures_distance_threshold">48dp</dimen> <!-- Broadcast dialog --> <dimen name="broadcast_dialog_title_img_margin_top">18dp</dimen> Loading
packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/composable/BackGestureTutorialScreen.kt +3 −5 Original line number Diff line number Diff line Loading @@ -51,8 +51,8 @@ fun BackGestureTutorialScreen(onDoneButtonClicked: () -> Unit, onBack: () -> Uni remember(recognizer) { GestureFlowAdapter(recognizer).gestureStateAsFlow.map { it.toGestureUiState( progressStartMark = "", progressEndMark = "", progressStartMarker = "", progressEndMarker = "", successAnimation = R.raw.trackpad_back_success, ) } Loading @@ -63,9 +63,7 @@ fun BackGestureTutorialScreen(onDoneButtonClicked: () -> Unit, onBack: () -> Uni @Composable private fun rememberBackGestureRecognizer(resources: Resources): GestureRecognizer { val distance = resources.getDimensionPixelSize( com.android.internal.R.dimen.system_gestures_distance_threshold ) resources.getDimensionPixelSize(R.dimen.touchpad_tutorial_gestures_distance_threshold) return remember(distance) { BackGestureRecognizer(distance) } } Loading
packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/composable/GestureTutorialScreen.kt +11 −7 Original line number Diff line number Diff line Loading @@ -51,20 +51,20 @@ sealed interface GestureUiState { data class InProgress( val progress: Float = 0f, val progressStartMark: String = "", val progressEndMark: String = "", val progressStartMarker: String, val progressEndMarker: String, ) : GestureUiState } fun GestureState.toGestureUiState( progressStartMark: String, progressEndMark: String, progressStartMarker: String, progressEndMarker: String, successAnimation: Int, ): GestureUiState { return when (this) { GestureState.NotStarted -> NotStarted is GestureState.InProgress -> GestureUiState.InProgress(this.progress, progressStartMark, progressEndMark) GestureUiState.InProgress(this.progress, progressStartMarker, progressEndMarker) is GestureState.Finished -> GestureUiState.Finished(successAnimation) } } Loading @@ -72,8 +72,12 @@ fun GestureState.toGestureUiState( fun GestureUiState.toTutorialActionState(): TutorialActionState { return when (this) { NotStarted -> TutorialActionState.NotStarted // progress is disabled for now as views are not ready to handle varying progress is GestureUiState.InProgress -> TutorialActionState.InProgress(progress = 0f) is GestureUiState.InProgress -> TutorialActionState.InProgress( progress = progress, startMarker = progressStartMarker, endMarker = progressEndMarker, ) is Finished -> TutorialActionState.Finished(successAnimation) } } Loading
packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/composable/HomeGestureTutorialScreen.kt +3 −5 Original line number Diff line number Diff line Loading @@ -50,8 +50,8 @@ fun HomeGestureTutorialScreen(onDoneButtonClicked: () -> Unit, onBack: () -> Uni remember(recognizer) { GestureFlowAdapter(recognizer).gestureStateAsFlow.map { it.toGestureUiState( progressStartMark = "", progressEndMark = "", progressStartMarker = "", progressEndMarker = "", successAnimation = R.raw.trackpad_home_success, ) } Loading @@ -62,9 +62,7 @@ fun HomeGestureTutorialScreen(onDoneButtonClicked: () -> Unit, onBack: () -> Uni @Composable private fun rememberHomeGestureRecognizer(resources: Resources): GestureRecognizer { val distance = resources.getDimensionPixelSize( com.android.internal.R.dimen.system_gestures_distance_threshold ) resources.getDimensionPixelSize(R.dimen.touchpad_tutorial_gestures_distance_threshold) return remember(distance) { HomeGestureRecognizer(distance) } } Loading
packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/composable/RecentAppsGestureTutorialScreen.kt +3 −5 Original line number Diff line number Diff line Loading @@ -51,8 +51,8 @@ fun RecentAppsGestureTutorialScreen(onDoneButtonClicked: () -> Unit, onBack: () remember(recognizer) { GestureFlowAdapter(recognizer).gestureStateAsFlow.map { it.toGestureUiState( progressStartMark = "", progressEndMark = "", progressStartMarker = "", progressEndMarker = "", successAnimation = R.raw.trackpad_recent_apps_success, ) } Loading @@ -63,9 +63,7 @@ fun RecentAppsGestureTutorialScreen(onDoneButtonClicked: () -> Unit, onBack: () @Composable private fun rememberRecentAppsGestureRecognizer(resources: Resources): GestureRecognizer { val distance = resources.getDimensionPixelSize( com.android.internal.R.dimen.system_gestures_distance_threshold ) resources.getDimensionPixelSize(R.dimen.touchpad_tutorial_gestures_distance_threshold) val velocity = resources.getDimension(R.dimen.touchpad_recent_apps_gesture_velocity_threshold) return remember(distance, velocity) { RecentAppsGestureRecognizer(distance, velocity) } } Loading