mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
More improvements on the pop controller animation
also a slight faster push animation too
This commit is contained in:
parent
473ee9f709
commit
de0f57e86f
3 changed files with 31 additions and 28 deletions
|
@ -533,13 +533,19 @@ open class MainActivity : BaseActivity<MainActivityBinding>() {
|
||||||
from?.view?.let { view ->
|
from?.view?.let { view ->
|
||||||
bA.addUpdateListener {
|
bA.addUpdateListener {
|
||||||
binding.backShadow.x = view.x - binding.backShadow.width
|
binding.backShadow.x = view.x - binding.backShadow.width
|
||||||
|
if (router.backstackSize == 1) {
|
||||||
|
to?.view?.let { toView ->
|
||||||
|
nav.x = toView.x
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bA.doOnEnd {
|
bA.doOnEnd {
|
||||||
binding.backShadow.alpha = 0.25f
|
binding.backShadow.alpha = 0.25f
|
||||||
binding.backShadow.isVisible = false
|
binding.backShadow.isVisible = false
|
||||||
|
nav.x = 0f
|
||||||
}
|
}
|
||||||
bA.duration = 150
|
bA.duration = 175
|
||||||
bA.start()
|
bA.start()
|
||||||
}
|
}
|
||||||
if (!isPush || router.backstackSize == 1) {
|
if (!isPush || router.backstackSize == 1) {
|
||||||
|
@ -1339,8 +1345,7 @@ open class MainActivity : BaseActivity<MainActivityBinding>() {
|
||||||
?: View.GONE
|
?: View.GONE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
alphaAnimation.duration = 200
|
alphaAnimation.duration = 150
|
||||||
alphaAnimation.startDelay = 50
|
|
||||||
animationSet?.playTogether(alphaAnimation)
|
animationSet?.playTogether(alphaAnimation)
|
||||||
animationSet?.start()
|
animationSet?.start()
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,6 @@ import androidx.core.view.updatePaddingRelative
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.bluelinelabs.conductor.ControllerChangeHandler
|
import com.bluelinelabs.conductor.ControllerChangeHandler
|
||||||
import com.bluelinelabs.conductor.ControllerChangeType
|
import com.bluelinelabs.conductor.ControllerChangeType
|
||||||
import com.bluelinelabs.conductor.RouterTransaction
|
|
||||||
import com.bluelinelabs.conductor.changehandler.FadeChangeHandler
|
|
||||||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||||
import com.google.android.material.snackbar.Snackbar
|
import com.google.android.material.snackbar.Snackbar
|
||||||
import eu.davidea.flexibleadapter.FlexibleAdapter
|
import eu.davidea.flexibleadapter.FlexibleAdapter
|
||||||
|
@ -355,12 +353,7 @@ class BrowseController :
|
||||||
when (item.itemId) {
|
when (item.itemId) {
|
||||||
// Initialize option to open catalogue settings.
|
// Initialize option to open catalogue settings.
|
||||||
R.id.action_filter -> {
|
R.id.action_filter -> {
|
||||||
val controller = ExtensionFilterController()
|
router.pushController(ExtensionFilterController().withFadeTransaction())
|
||||||
router.pushController(
|
|
||||||
RouterTransaction.with(controller)
|
|
||||||
.popChangeHandler(FadeChangeHandler())
|
|
||||||
.pushChangeHandler(FadeChangeHandler()),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
R.id.action_migration_guide -> {
|
R.id.action_migration_guide -> {
|
||||||
activity?.openInBrowser(HELP_URL)
|
activity?.openInBrowser(HELP_URL)
|
||||||
|
@ -697,12 +690,7 @@ class BrowseController :
|
||||||
when (item.itemId) {
|
when (item.itemId) {
|
||||||
// Initialize option to open catalogue settings.
|
// Initialize option to open catalogue settings.
|
||||||
R.id.action_filter -> {
|
R.id.action_filter -> {
|
||||||
val controller = SettingsSourcesController()
|
router.pushController(SettingsSourcesController().withFadeTransaction())
|
||||||
router.pushController(
|
|
||||||
RouterTransaction.with(controller)
|
|
||||||
.popChangeHandler(FadeChangeHandler())
|
|
||||||
.pushChangeHandler(FadeChangeHandler()),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
R.id.action_migration_guide -> {
|
R.id.action_migration_guide -> {
|
||||||
activity?.openInBrowser(HELP_URL)
|
activity?.openInBrowser(HELP_URL)
|
||||||
|
|
|
@ -373,6 +373,26 @@ fun Controller.scrollViewWith(
|
||||||
}
|
}
|
||||||
addLifecycleListener(
|
addLifecycleListener(
|
||||||
object : Controller.LifecycleListener() {
|
object : Controller.LifecycleListener() {
|
||||||
|
override fun onChangeEnd(
|
||||||
|
controller: Controller,
|
||||||
|
changeHandler: ControllerChangeHandler,
|
||||||
|
changeType: ControllerChangeType,
|
||||||
|
) {
|
||||||
|
super.onChangeEnd(controller, changeHandler, changeType)
|
||||||
|
if (changeType.isEnter) {
|
||||||
|
if (fakeToolbarView?.parent != null) {
|
||||||
|
val parent = fakeToolbarView?.parent as? ViewGroup ?: return
|
||||||
|
parent.removeView(fakeToolbarView)
|
||||||
|
fakeToolbarView = null
|
||||||
|
}
|
||||||
|
if (fakeBottomNavView?.parent != null) {
|
||||||
|
val parent = fakeBottomNavView?.parent as? ViewGroup ?: return
|
||||||
|
parent.removeView(fakeBottomNavView)
|
||||||
|
fakeBottomNavView = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onChangeStart(
|
override fun onChangeStart(
|
||||||
controller: Controller,
|
controller: Controller,
|
||||||
changeHandler: ControllerChangeHandler,
|
changeHandler: ControllerChangeHandler,
|
||||||
|
@ -388,16 +408,6 @@ fun Controller.scrollViewWith(
|
||||||
activityBinding?.appBar?.setToolbarModeBy(this@scrollViewWith)
|
activityBinding?.appBar?.setToolbarModeBy(this@scrollViewWith)
|
||||||
activityBinding?.appBar?.useTabsInPreLayout = includeTabView
|
activityBinding?.appBar?.useTabsInPreLayout = includeTabView
|
||||||
colorToolbar(isToolbarColor)
|
colorToolbar(isToolbarColor)
|
||||||
if (fakeToolbarView?.parent != null) {
|
|
||||||
val parent = fakeToolbarView?.parent as? ViewGroup ?: return
|
|
||||||
parent.removeView(fakeToolbarView)
|
|
||||||
fakeToolbarView = null
|
|
||||||
}
|
|
||||||
if (fakeBottomNavView?.parent != null) {
|
|
||||||
val parent = fakeBottomNavView?.parent as? ViewGroup ?: return
|
|
||||||
parent.removeView(fakeBottomNavView)
|
|
||||||
fakeBottomNavView = null
|
|
||||||
}
|
|
||||||
lastY = 0f
|
lastY = 0f
|
||||||
activityBinding?.appBar?.updateAppBarAfterY(recycler)
|
activityBinding?.appBar?.updateAppBarAfterY(recycler)
|
||||||
activityBinding?.toolbar?.tag = randomTag
|
activityBinding?.toolbar?.tag = randomTag
|
||||||
|
@ -802,7 +812,7 @@ fun Controller.withFadeTransaction(): RouterTransaction {
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
|
||||||
FadeChangeHandler()
|
FadeChangeHandler()
|
||||||
} else {
|
} else {
|
||||||
CrossFadeChangeHandler(duration = 250, removesFromViewOnPush = isLowRam)
|
CrossFadeChangeHandler(duration = 200, removesFromViewOnPush = isLowRam)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.popChangeHandler(
|
.popChangeHandler(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue