mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2026-05-16 04:52:39 +02:00
more reliable motion event triggesr
This commit is contained in:
@@ -423,14 +423,19 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
|
||||
updateSegmentPaddings();
|
||||
};
|
||||
_fragVideoDetail.onTransitioning.subscribe {
|
||||
if (it || _fragVideoDetail.state != VideoDetailFragment.State.MINIMIZED)
|
||||
if (it || _fragVideoDetail.state != VideoDetailFragment.State.MINIMIZED) {
|
||||
Logger.i(TAG, "onTransition Setting elevation higher");
|
||||
_fragContainerOverlay.elevation =
|
||||
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 15f, resources.displayMetrics);
|
||||
else
|
||||
}
|
||||
else {
|
||||
Logger.i(TAG, "onTransition Setting elevation lower");
|
||||
_fragContainerOverlay.elevation =
|
||||
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5f, resources.displayMetrics);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
_fragVideoDetail.onCloseEvent.subscribe {
|
||||
_fragMainHome.setPreviewsEnabled(true);
|
||||
_fragMainVideoSearchResults.setPreviewsEnabled(true);
|
||||
|
||||
+19
-2
@@ -352,10 +352,14 @@ class VideoDetailFragment() : MainFragment() {
|
||||
}
|
||||
};
|
||||
}
|
||||
var lastTransitionProgress = -1f;
|
||||
_view!!.setTransitionListener(object : MotionLayout.TransitionListener {
|
||||
override fun onTransitionChange(motionLayout: MotionLayout?, startId: Int, endId: Int, progress: Float) {
|
||||
_viewDetail?.stopAllGestures()
|
||||
|
||||
//Logger.i(TAG, "onTransitionChange: ${progress}")
|
||||
lastTransitionProgress = progress;
|
||||
|
||||
if (state != State.MINIMIZED && progress < 0.1) {
|
||||
state = State.MINIMIZED;
|
||||
isMinimizingFromFullScreen = false
|
||||
@@ -385,9 +389,22 @@ class VideoDetailFragment() : MainFragment() {
|
||||
if(isInPictureInPicture) leavePictureInPictureMode(false); //Workaround to prevent getting stuck in p2p
|
||||
}
|
||||
}
|
||||
override fun onTransitionCompleted(motionLayout: MotionLayout?, currentId: Int) { }
|
||||
override fun onTransitionCompleted(motionLayout: MotionLayout?, currentId: Int) {
|
||||
val progress = motionLayout?.progress//lastTransitionProgress;
|
||||
if(progress != null && progress >= 0) {
|
||||
Logger.i(TAG, "onTransitionCompleted: ${progress}")
|
||||
if(state != State.MINIMIZED && progress < 0.5) {
|
||||
state = State.MINIMIZED;
|
||||
isMinimizingFromFullScreen = false
|
||||
onMinimize.emit();
|
||||
}
|
||||
isTransitioning = false;
|
||||
onTransitioning.emit(false);
|
||||
}
|
||||
}
|
||||
override fun onTransitionStarted(p0: MotionLayout?, p1: Int, p2: Int) { }
|
||||
override fun onTransitionTrigger(p0: MotionLayout?, p1: Int, p2: Boolean, p3: Float) { }
|
||||
override fun onTransitionTrigger(p0: MotionLayout?, p1: Int, p2: Boolean, p3: Float) {
|
||||
}
|
||||
});
|
||||
|
||||
_view?.let {
|
||||
|
||||
Reference in New Issue
Block a user