Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC-Android
Manage
Activity
Members
Labels
Plan
Issues
529
Issue boards
Milestones
Wiki
Code
Merge requests
15
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC-Android
Commits
1ae09c4c
Commit
1ae09c4c
authored
2 years ago
by
Nicolas Pomepuy
Browse files
Options
Downloads
Patches
Plain Diff
Migrate the subtitles color setting
Fixes #2691
parent
26b2a5aa
No related branches found
No related tags found
1 merge request
!1548
Apply the VersionMigration sooner + subtitle migration
Pipeline
#265149
passed with stage
in 3 minutes and 41 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
application/vlc-android/src/org/videolan/vlc/util/VersionMigration.kt
+25
-1
25 additions, 1 deletion
...vlc-android/src/org/videolan/vlc/util/VersionMigration.kt
with
25 additions
and
1 deletion
application/vlc-android/src/org/videolan/vlc/util/VersionMigration.kt
+
25
−
1
View file @
1ae09c4c
...
...
@@ -26,6 +26,7 @@ package org.videolan.vlc.util
import
android.content.Context
import
android.content.SharedPreferences
import
android.graphics.Color
import
android.util.Log
import
androidx.appcompat.app.AppCompatDelegate
import
androidx.core.content.edit
...
...
@@ -39,7 +40,7 @@ import org.videolan.vlc.gui.onboarding.ONBOARDING_DONE_KEY
import
java.io.File
import
java.io.IOException
private
const
val
CURRENT_VERSION
=
9
private
const
val
CURRENT_VERSION
=
10
object
VersionMigration
{
...
...
@@ -75,6 +76,10 @@ object VersionMigration {
migrateToVersion9
(
settings
)
}
if
(
lastVersion
<
10
)
{
migrateToVersion10
(
settings
)
}
settings
.
putSingle
(
KEY_CURRENT_SETTINGS_VERSION
,
CURRENT_VERSION
)
}
...
...
@@ -216,4 +221,23 @@ object VersionMigration {
remove
(
"enable_screenshot_gesture"
)
}
}
/**
* Migrate the subtitle color setting
*/
private
fun
migrateToVersion10
(
settings
:
SharedPreferences
)
{
Log
.
i
(
this
::
class
.
java
.
simpleName
,
"Migration to Version 10: Migrate the subtitle color setting"
)
if
(
settings
.
contains
(
"subtitles_color"
))
settings
.
edit
(
true
)
{
settings
.
getString
(
"subtitles_color"
,
"16777215"
)
?.
let
{
oldSetting
->
try
{
val
oldColor
=
oldSetting
.
toInt
()
val
newColor
=
Color
.
argb
(
255
,
Color
.
red
(
oldColor
),
Color
.
green
(
oldColor
),
Color
.
blue
(
oldColor
))
putInt
(
"subtitles_color"
,
newColor
)
}
catch
(
e
:
Exception
)
{
remove
(
"subtitles_color"
)
}
}
}
}
}
\ No newline at end of file
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