mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-19 01:59:19 +01:00
parent
fe7c7e72f5
commit
e90b0aaf8b
@ -6,7 +6,6 @@ import androidx.core.content.ContextCompat
|
|||||||
import com.bluelinelabs.conductor.Controller
|
import com.bluelinelabs.conductor.Controller
|
||||||
import com.bluelinelabs.conductor.Router
|
import com.bluelinelabs.conductor.Router
|
||||||
import com.bluelinelabs.conductor.RouterTransaction
|
import com.bluelinelabs.conductor.RouterTransaction
|
||||||
import com.bluelinelabs.conductor.changehandler.FadeChangeHandler
|
|
||||||
|
|
||||||
fun Router.popControllerWithTag(tag: String): Boolean {
|
fun Router.popControllerWithTag(tag: String): Boolean {
|
||||||
val controller = getControllerWithTag(tag)
|
val controller = getControllerWithTag(tag)
|
||||||
@ -30,6 +29,6 @@ fun Controller.requestPermissionsSafe(permissions: Array<String>, requestCode: I
|
|||||||
|
|
||||||
fun Controller.withFadeTransaction(): RouterTransaction {
|
fun Controller.withFadeTransaction(): RouterTransaction {
|
||||||
return RouterTransaction.with(this)
|
return RouterTransaction.with(this)
|
||||||
.pushChangeHandler(FadeChangeHandler())
|
.pushChangeHandler(OneWayFadeChangeHandler())
|
||||||
.popChangeHandler(FadeChangeHandler())
|
.popChangeHandler(OneWayFadeChangeHandler())
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,6 @@ import com.bluelinelabs.conductor.changehandler.SimpleSwapChangeHandler
|
|||||||
* A controller that displays a dialog window, floating on top of its activity's window.
|
* A controller that displays a dialog window, floating on top of its activity's window.
|
||||||
* This is a wrapper over [Dialog] object like [android.app.DialogFragment].
|
* This is a wrapper over [Dialog] object like [android.app.DialogFragment].
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* Implementations should override this class and implement [.onCreateDialog] to create a custom dialog, such as an [android.app.AlertDialog]
|
* Implementations should override this class and implement [.onCreateDialog] to create a custom dialog, such as an [android.app.AlertDialog]
|
||||||
*/
|
*/
|
||||||
abstract class DialogController : RestoreViewOnCreateController {
|
abstract class DialogController : RestoreViewOnCreateController {
|
||||||
|
@ -0,0 +1,43 @@
|
|||||||
|
package eu.kanade.tachiyomi.ui.base.controller
|
||||||
|
|
||||||
|
import android.animation.Animator
|
||||||
|
import android.animation.AnimatorSet
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import com.bluelinelabs.conductor.ControllerChangeHandler
|
||||||
|
import com.bluelinelabs.conductor.changehandler.FadeChangeHandler
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A variation of [FadeChangeHandler] that only fades in.
|
||||||
|
*/
|
||||||
|
class OneWayFadeChangeHandler : FadeChangeHandler {
|
||||||
|
constructor()
|
||||||
|
constructor(removesFromViewOnPush: Boolean) : super(removesFromViewOnPush)
|
||||||
|
constructor(duration: Long) : super(duration)
|
||||||
|
constructor(duration: Long, removesFromViewOnPush: Boolean) : super(
|
||||||
|
duration,
|
||||||
|
removesFromViewOnPush
|
||||||
|
)
|
||||||
|
|
||||||
|
override fun getAnimator(
|
||||||
|
container: ViewGroup,
|
||||||
|
from: View?,
|
||||||
|
to: View?,
|
||||||
|
isPush: Boolean,
|
||||||
|
toAddedToContainer: Boolean
|
||||||
|
): Animator {
|
||||||
|
if (to != null) {
|
||||||
|
return super.getAnimator(container, from, to, isPush, toAddedToContainer)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (from != null && (!isPush || removesFromViewOnPush())) {
|
||||||
|
container.removeView(from)
|
||||||
|
}
|
||||||
|
|
||||||
|
return AnimatorSet()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun copy(): ControllerChangeHandler {
|
||||||
|
return OneWayFadeChangeHandler(animationDuration, removesFromViewOnPush())
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user