Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC-Android
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Matthias Kett
VLC-Android
Commits
89aae99c
Commit
89aae99c
authored
4 years ago
by
Diego Fernando Nieto
Browse files
Options
Downloads
Patches
Plain Diff
Android TV: Fix the license fragment UI
parent
adadbfd9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
application/television/src/main/java/org/videolan/television/ui/LicenceActivity.kt
+34
-1
34 additions, 1 deletion
...c/main/java/org/videolan/television/ui/LicenceActivity.kt
with
34 additions
and
1 deletion
application/television/src/main/java/org/videolan/television/ui/LicenceActivity.kt
+
34
−
1
View file @
89aae99c
package
org.videolan.television.ui
import
android.annotation.SuppressLint
import
android.content.res.Configuration
import
android.graphics.Color
import
android.os.Bundle
import
android.view.View
import
android.webkit.WebView
import
android.webkit.WebViewClient
import
androidx.fragment.app.FragmentActivity
import
org.videolan.resources.util.applyOverscanMargin
import
org.videolan.vlc.R
...
...
@@ -15,9 +18,39 @@ class LicenceActivity : FragmentActivity() {
super
.
onCreate
(
savedInstanceState
)
val
revision
=
getString
(
R
.
string
.
build_revision
)
val
licence
=
WebView
(
this
)
licence
.
loadData
(
Util
.
readAsset
(
"licence.htm"
,
""
).
replace
(
"!COMMITID!"
,
revision
),
"text/html"
,
"UTF8"
)
licence
.
loadUrl
(
"file:///android_asset/licence.htm"
)
licence
.
webViewClient
=
object
:
WebViewClient
()
{
override
fun
onPageFinished
(
view
:
WebView
,
url
:
String
)
{
if
(
url
.
startsWith
(
"file:///android_asset"
))
{
injectCommitRevision
(
view
,
revision
)
}
super
.
onPageFinished
(
view
,
url
)
}
}
setContentView
(
licence
)
(
licence
.
parent
as
View
).
setBackgroundColor
(
Color
.
LTGRAY
)
applyOverscanMargin
(
this
)
}
@SuppressLint
(
"SetJavaScriptEnabled"
)
private
fun
injectCommitRevision
(
webView
:
WebView
,
revision
:
String
)
{
try
{
webView
.
settings
.
javaScriptEnabled
=
true
webView
.
loadUrl
(
"javascript:(function() {"
+
"var link = document.getElementById('revision_link');"
+
"var newLink = link.href.replace('!COMMITID!', '$revision');"
+
"link.setAttribute('href', newLink);"
+
"link.innerText = newLink;"
+
"})()"
)
webView
.
settings
.
javaScriptEnabled
=
false
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment