Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5dde51f0 authored by Michal Brzezinski's avatar Michal Brzezinski
Browse files

Passing animation markers between model layers

Also renaming progressStartMark to progressStartMarker, same for end*.

Bug: 369817369
Test: manual, everything works as before
Flag: com.android.systemui.shared.new_touchpad_gestures_tutorial
Change-Id: I5c530e47def6a8089792900b37c762fc8049511f
parent 2c5c7d9b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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,
                )
            }
+11 −7
Original line number Diff line number Diff line
@@ -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)
    }
}
@@ -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)
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -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,
                )
            }
+2 −2
Original line number Diff line number Diff line
@@ -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,
                )
            }