diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 16bbd3bae..0dd19c4c4 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -103,7 +103,6 @@
mediaActivity.onPhotoTap()
false
}
videoView.setOnPreparedListener { mp ->
+ val containerWidth = videoContainer.measuredWidth.toFloat()
+ val containerHeight = videoContainer.measuredHeight.toFloat()
+ val videoWidth = mp.videoWidth.toFloat()
+ val videoHeight = mp.videoHeight.toFloat()
+
+ if(containerWidth/containerHeight > videoWidth/videoHeight) {
+ videoView.layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT
+ videoView.layoutParams.width = ViewGroup.LayoutParams.WRAP_CONTENT
+ } else {
+ videoView.layoutParams.height = ViewGroup.LayoutParams.WRAP_CONTENT
+ videoView.layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT
+ }
+
progressBar.hide()
mp.isLooping = true
if (arguments!!.getBoolean(ARG_START_POSTPONED_TRANSITION)) {
@@ -117,7 +130,7 @@ class ViewVideoFragment : ViewMediaFragment() {
}
override fun onToolbarVisibilityChange(visible: Boolean) {
- if (videoPlayer == null || !userVisibleHint) {
+ if (videoView == null || !userVisibleHint) {
return
}
diff --git a/app/src/main/res/layout/fragment_view_video.xml b/app/src/main/res/layout/fragment_view_video.xml
index 3c8afbce4..0247a9cb3 100644
--- a/app/src/main/res/layout/fragment_view_video.xml
+++ b/app/src/main/res/layout/fragment_view_video.xml
@@ -1,46 +1,43 @@
-
-
+
+
+ app:layout_constraintTop_toTopOf="parent" />
\ No newline at end of file