Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
50c48565
authored
Aug 24, 2017
by
Bei Yi
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Support aspect ratio fill mode for AspectRatioFrameLayout
parent
f764fe70
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
library/ui/src/main/java/com/google/android/exoplayer2/ui/AspectRatioFrameLayout.java
library/ui/src/main/java/com/google/android/exoplayer2/ui/AspectRatioFrameLayout.java
View file @
50c48565
...
@@ -32,7 +32,7 @@ public final class AspectRatioFrameLayout extends FrameLayout {
...
@@ -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_
CROP
})
@IntDef
({
RESIZE_MODE_FIT
,
RESIZE_MODE_FIXED_WIDTH
,
RESIZE_MODE_FIXED_HEIGHT
,
RESIZE_MODE_FILL
,
RESIZE_MODE_
ASPECT_FILL
})
public
@interface
ResizeMode
{}
public
@interface
ResizeMode
{}
/**
/**
...
@@ -52,9 +52,9 @@ public final class AspectRatioFrameLayout extends FrameLayout {
...
@@ -52,9 +52,9 @@ public final class AspectRatioFrameLayout extends FrameLayout {
*/
*/
public
static
final
int
RESIZE_MODE_FILL
=
3
;
public
static
final
int
RESIZE_MODE_FILL
=
3
;
/**
/**
*
The height or width is increased or decreased to crop an
d to obtain the desired aspect ratio.
*
Either height or width is increase
d to obtain the desired aspect ratio.
*/
*/
public
static
final
int
RESIZE_MODE_
CROP
=
4
;
public
static
final
int
RESIZE_MODE_
ASPECT_FILL
=
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 {
...
@@ -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_
CROP
:
case
RESIZE_MODE_
ASPECT_FILL
:
if
(
videoAspectRatio
>
viewAspectRatio
)
{
if
(
videoAspectRatio
>
viewAspectRatio
)
{
width
=
(
int
)
(
height
*
videoAspectRatio
);
width
=
(
int
)
(
height
*
videoAspectRatio
);
}
else
{
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment