Skip to content

Commit

Permalink
fix(RC): adjust transition animations according to the design documen…
Browse files Browse the repository at this point in the history
…tation [WPB-1817] (#2169)
  • Loading branch information
saleniuk committed Sep 5, 2023
1 parent 7bba4df commit a3378c1
Show file tree
Hide file tree
Showing 24 changed files with 358 additions and 225 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import com.ramcosta.composedestinations.DestinationsNavHost
import com.ramcosta.composedestinations.animations.rememberAnimatedNavHostEngine
import com.ramcosta.composedestinations.navigation.dependency
import com.ramcosta.composedestinations.spec.Route
import com.wire.android.navigation.style.DefaultNestedNavGraphAnimations
import com.wire.android.navigation.style.DefaultRootNavGraphAnimations
import com.wire.android.ui.NavGraphs
import com.wire.android.ui.home.newconversation.NewConversationViewModel

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Wire
* Copyright (C) 2023 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*/
package com.wire.android.navigation.style

import androidx.compose.animation.ExperimentalAnimationApi
import com.ramcosta.composedestinations.animations.defaults.NestedNavGraphDefaultAnimations
import com.ramcosta.composedestinations.animations.defaults.RootNavGraphDefaultAnimations

@OptIn(ExperimentalAnimationApi::class)
val DefaultRootNavGraphAnimations = RootNavGraphDefaultAnimations(
enterTransition = { with(DefaultNavigationAnimation) { enterTransition() } },
exitTransition = { with(DefaultNavigationAnimation) { exitTransition() } },
popEnterTransition = { with(DefaultNavigationAnimation) { popEnterTransition() } },
popExitTransition = { with(DefaultNavigationAnimation) { popExitTransition() } },
)

@OptIn(ExperimentalAnimationApi::class)
val DefaultNestedNavGraphAnimations = NestedNavGraphDefaultAnimations(
enterTransition = { with(DefaultNavigationAnimation) { enterTransition() } },
exitTransition = { with(DefaultNavigationAnimation) { exitTransition() } },
popEnterTransition = { with(DefaultNavigationAnimation) { popEnterTransition() } },
popExitTransition = { with(DefaultNavigationAnimation) { popExitTransition() } },
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Wire
* Copyright (C) 2023 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*/

package com.wire.android.navigation.style

typealias DefaultNavigationAnimation = SlideNavigationAnimation

object SlideNavigationAnimation : WireDestinationStyleAnimated {
override fun animationType(): TransitionAnimationType = TransitionAnimationType.SLIDE
}

object PopUpNavigationAnimation : WireDestinationStyleAnimated {
override fun animationType(): TransitionAnimationType = TransitionAnimationType.POP_UP
}

object WakeUpScreenPopUpNavigationAnimation : WireDestinationStyleAnimated, ScreenModeStyle {
override fun animationType(): TransitionAnimationType = TransitionAnimationType.POP_UP
override fun screenMode(): ScreenMode = ScreenMode.WAKE_UP
}

object KeepOnScreenPopUpNavigationAnimation : WireDestinationStyleAnimated, ScreenModeStyle {
override fun animationType(): TransitionAnimationType = TransitionAnimationType.POP_UP
override fun screenMode(): ScreenMode = ScreenMode.KEEP_ON
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Wire
* Copyright (C) 2023 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*/
package com.wire.android.navigation.style

interface ScreenModeStyle {
fun screenMode(): ScreenMode
}

enum class ScreenMode {
KEEP_ON, // keep screen on while that NavigationItem is visible (i.e CallScreen)
WAKE_UP, // wake up the device on navigating to that NavigationItem (i.e IncomingCall)
NONE // do not wake up and allow device to sleep
}

0 comments on commit a3378c1

Please sign in to comment.