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
8ed6c9fc
authored
Oct 04, 2021
by
olly
Committed by
bachinger
Oct 04, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fix capitalization of language in track selector
Issue: #9452 PiperOrigin-RevId: 400680794
parent
d4b9fe33
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
2 deletions
RELEASENOTES.md
library/common/src/main/java/com/google/android/exoplayer2/util/Util.java
library/ui/src/main/java/com/google/android/exoplayer2/ui/DefaultTrackNameProvider.java
RELEASENOTES.md
View file @
8ed6c9fc
...
...
@@ -35,6 +35,8 @@
`Player.addListener`
.
*
Fix initial timestamp display in
`PlayerControlView`
(
[
#9524
](
https://github.com/google/ExoPlayer/issues/9254
)
).
*
Fix capitalization of languages in the track selector
(
[
#9452
](
https://github.com/google/ExoPlayer/issues/9452
)
).
*
Extractors:
*
MP4: Correctly handle HEVC tracks with pixel aspect ratios other than 1.
*
TS: Correctly handle HEVC tracks with pixel aspect ratios other than 1.
...
...
library/common/src/main/java/com/google/android/exoplayer2/util/Util.java
View file @
8ed6c9fc
...
...
@@ -2243,6 +2243,11 @@ public final class Util {
return
systemLocales
;
}
/** Returns the default {@link Locale.Category#DISPLAY DISPLAY} {@link Locale}. */
public
static
Locale
getDefaultDisplayLocale
()
{
return
Util
.
SDK_INT
>=
24
?
Locale
.
getDefault
(
Locale
.
Category
.
DISPLAY
)
:
Locale
.
getDefault
();
}
/**
* Uncompresses the data in {@code input}.
*
...
...
library/ui/src/main/java/com/google/android/exoplayer2/ui/DefaultTrackNameProvider.java
View file @
8ed6c9fc
...
...
@@ -104,8 +104,14 @@ public class DefaultTrackNameProvider implements TrackNameProvider {
if
(
TextUtils
.
isEmpty
(
language
)
||
C
.
LANGUAGE_UNDETERMINED
.
equals
(
language
))
{
return
""
;
}
Locale
locale
=
Util
.
SDK_INT
>=
21
?
Locale
.
forLanguageTag
(
language
)
:
new
Locale
(
language
);
return
locale
.
getDisplayName
();
Locale
languageLocale
=
Util
.
SDK_INT
>=
21
?
Locale
.
forLanguageTag
(
language
)
:
new
Locale
(
language
);
Locale
displayLocale
=
Util
.
getDefaultDisplayLocale
();
String
languageName
=
languageLocale
.
getDisplayName
(
displayLocale
);
// Capitalize the first letter. See: https://github.com/google/ExoPlayer/issues/9452.
int
firstCodePointLength
=
languageName
.
offsetByCodePoints
(
0
,
1
);
return
languageName
.
substring
(
0
,
firstCodePointLength
).
toUpperCase
(
displayLocale
)
+
languageName
.
substring
(
firstCodePointLength
);
}
private
String
buildRoleString
(
Format
format
)
{
...
...
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