chore(android): migrate AspectRatioFrameLayout to Kotlin (#3985)
* Rename .java to .kt * chore(android): migrate AspectRatioFrameLayout to Kotlin * chore: refactor setter and getter of class * fix: use field
This commit is contained in:
committed by
GitHub
parent
66dcf32b56
commit
452e42f1dd
@@ -236,7 +236,7 @@ public final class ExoPlayerView extends FrameLayout implements AdViewProvider {
|
||||
Format format = group.getTrackFormat(0);
|
||||
|
||||
// update aspect ratio !
|
||||
layout.setAspectRatio(format.height == 0 ? 1 : (format.width * format.pixelWidthHeightRatio) / format.height);
|
||||
layout.setVideoAspectRatio(format.height == 0 ? 1 : (format.width * format.pixelWidthHeightRatio) / format.height);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -258,13 +258,13 @@ public final class ExoPlayerView extends FrameLayout implements AdViewProvider {
|
||||
|
||||
@Override
|
||||
public void onVideoSizeChanged(VideoSize videoSize) {
|
||||
boolean isInitialRatio = layout.getAspectRatio() == 0;
|
||||
boolean isInitialRatio = layout.getVideoAspectRatio() == 0;
|
||||
if (videoSize.height == 0 || videoSize.width == 0) {
|
||||
// When changing video track we receive an ghost state with height / width = 0
|
||||
// No need to resize the view in that case
|
||||
return;
|
||||
}
|
||||
layout.setAspectRatio((videoSize.width * videoSize.pixelWidthHeightRatio) / videoSize.height);
|
||||
layout.setVideoAspectRatio((videoSize.width * videoSize.pixelWidthHeightRatio) / videoSize.height);
|
||||
|
||||
// React native workaround for measuring and layout on initial load.
|
||||
if (isInitialRatio) {
|
||||
|
||||
Reference in New Issue
Block a user