Support zoom mode for AspectRatioFrameLayout
This commit is contained in:
parent
50c485652c
commit
b084821678
@ -32,7 +32,7 @@ public final class AspectRatioFrameLayout extends FrameLayout {
|
|||||||
* Resize modes for {@link AspectRatioFrameLayout}.
|
* Resize modes for {@link AspectRatioFrameLayout}.
|
||||||
*/
|
*/
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
@IntDef({RESIZE_MODE_FIT, RESIZE_MODE_FIXED_WIDTH, RESIZE_MODE_FIXED_HEIGHT, RESIZE_MODE_FILL, RESIZE_MODE_ASPECT_FILL})
|
@IntDef({RESIZE_MODE_FIT, RESIZE_MODE_FIXED_WIDTH, RESIZE_MODE_FIXED_HEIGHT, RESIZE_MODE_FILL, RESIZE_MODE_ZOOM})
|
||||||
public @interface ResizeMode {}
|
public @interface ResizeMode {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -54,7 +54,7 @@ public final class AspectRatioFrameLayout extends FrameLayout {
|
|||||||
/**
|
/**
|
||||||
* Either height or width is increased to obtain the desired aspect ratio.
|
* Either height or width is increased to obtain the desired aspect ratio.
|
||||||
*/
|
*/
|
||||||
public static final int RESIZE_MODE_ASPECT_FILL = 4;
|
public static final int RESIZE_MODE_ZOOM = 4;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@link FrameLayout} will not resize itself if the fractional difference between its natural
|
* The {@link FrameLayout} will not resize itself if the fractional difference between its natural
|
||||||
@ -145,7 +145,7 @@ public final class AspectRatioFrameLayout extends FrameLayout {
|
|||||||
case RESIZE_MODE_FIXED_HEIGHT:
|
case RESIZE_MODE_FIXED_HEIGHT:
|
||||||
width = (int) (height * videoAspectRatio);
|
width = (int) (height * videoAspectRatio);
|
||||||
break;
|
break;
|
||||||
case RESIZE_MODE_ASPECT_FILL:
|
case RESIZE_MODE_ZOOM:
|
||||||
if (videoAspectRatio > viewAspectRatio) {
|
if (videoAspectRatio > viewAspectRatio) {
|
||||||
width = (int) (height * videoAspectRatio);
|
width = (int) (height * videoAspectRatio);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user