Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit a9166c7

Browse files
TunousSaket Narayan
authored andcommitted
MediaViewer: Always limit video height to vertical space
1 parent 36f3108 commit a9166c7

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

app/src/main/java/me/saket/dank/ui/media/MediaVideoFragment.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,17 +175,13 @@ public void onViewCreated(View fragmentLayout, @Nullable Bundle savedInstanceSta
175175
int parentHeight = parent.getHeight();
176176

177177
int videoControlsHeight = videoControlsView.heightOfControlButtons();
178-
boolean isPortraitVideo = (videoHeight + videoControlsHeight) > videoWidth;
179178

180179
float resizeFactorToFillHorizontalSpace = (float) parentWidth / videoWidth;
181180
int resizedHeight = (int) (videoHeight * resizeFactorToFillHorizontalSpace) + videoControlsHeight;
182181

183-
if (isPortraitVideo) {
184-
int verticalSpaceAvailable = parentHeight - Views.getPaddingVertical(parent);
185-
Views.setDimensions(videoView, parentWidth, Math.min(resizedHeight, verticalSpaceAvailable));
186-
} else {
187-
Views.setDimensions(videoView, parentWidth, resizedHeight);
188-
}
182+
int verticalSpaceAvailable = parentHeight - Views.getPaddingVertical(parent);
183+
Views.setDimensions(videoView, parentWidth, Math.min(resizedHeight, verticalSpaceAvailable));
184+
189185
}, error -> {
190186
ResolvedError resolvedError = errorResolver.get().resolve(error);
191187
resolvedError.ifUnknown(() -> Timber.e(error, "Error while trying to get option buttons' height"));

0 commit comments

Comments
 (0)