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
041cf80e
Commit
041cf80e
authored
1 year ago
by
Robert Stone
Browse files
Options
Downloads
Patches
Plain Diff
Add support for opening VLC settings from Android Auto
parent
cd2ee11b
No related branches found
No related tags found
1 merge request
!1799
Add settings dialog in Android Auto
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
application/resources/src/main/res/values/strings.xml
+3
-0
3 additions, 0 deletions
application/resources/src/main/res/values/strings.xml
application/vlc-android/src/org/videolan/vlc/car/CarScreens.kt
+20
-1
20 additions, 1 deletion
...cation/vlc-android/src/org/videolan/vlc/car/CarScreens.kt
with
23 additions
and
1 deletion
application/resources/src/main/res/values/strings.xml
+
3
−
0
View file @
041cf80e
...
...
@@ -307,6 +307,9 @@
<!-- Preferences -->
<string
name=
"preferences"
>
Settings
</string>
<string
name=
"more_preferences"
>
More settings
</string>
<string
name=
"prefs_opened_on_phone"
>
Settings opened on phone
</string>
<string
name=
"open_on_phone"
>
Open on phone screen
</string>
<string
name=
"directories_summary"
>
Select directories to include in the media library
</string>
<string
name=
"add_custom_path"
>
Add a custom path
</string>
...
...
This diff is collapsed.
Click to expand it.
application/vlc-android/src/org/videolan/vlc/car/CarScreens.kt
+
20
−
1
View file @
041cf80e
...
...
@@ -23,13 +23,16 @@
*/
package
org.videolan.vlc.car
import
android.content.Intent
import
androidx.annotation.StringRes
import
androidx.car.app.CarContext
import
androidx.car.app.CarToast
import
androidx.car.app.Screen
import
androidx.car.app.model.Action
import
androidx.car.app.model.ItemList
import
androidx.car.app.model.ListTemplate
import
androidx.car.app.model.LongMessageTemplate
import
androidx.car.app.model.ParkedOnlyOnClickListener
import
androidx.car.app.model.Row
import
androidx.car.app.model.SectionedItemList
import
androidx.car.app.model.Template
...
...
@@ -41,7 +44,7 @@ import org.videolan.tools.ENABLE_ANDROID_AUTO_SPEED_BUTTONS
import
org.videolan.tools.Settings
import
org.videolan.vlc.PlaybackService
import
org.videolan.vlc.R
import
org.videolan.vlc.gui.preferences.PreferencesActivity
class
CarSettingsScreen
(
carContext
:
CarContext
)
:
Screen
(
carContext
)
{
...
...
@@ -57,11 +60,19 @@ class CarSettingsScreen(carContext: CarContext) : Screen(carContext) {
LongMessageScreen
(
carContext
,
R
.
string
.
voice_control
,
R
.
string
.
voice_control_help
)))
}.
build
()
val
moreItems
=
ItemList
.
Builder
().
apply
{
addItem
(
Row
.
Builder
().
apply
{
setTitle
(
AppContextProvider
.
appContext
.
getString
(
R
.
string
.
open_on_phone
))
setOnClickListener
(
ParkedOnlyOnClickListener
.
create
(
::
openPreferencesOnPhone
))
}.
build
())
}.
build
()
return
ListTemplate
.
Builder
().
apply
{
setHeaderAction
(
Action
.
BACK
)
setTitle
(
AppContextProvider
.
appContext
.
getString
(
R
.
string
.
preferences
))
addSectionedList
(
SectionedItemList
.
create
(
controlItems
,
AppContextProvider
.
appContext
.
getString
(
R
.
string
.
controls_prefs_category
)))
addSectionedList
(
SectionedItemList
.
create
(
helpItems
,
AppContextProvider
.
appContext
.
getString
(
R
.
string
.
help
)))
addSectionedList
(
SectionedItemList
.
create
(
moreItems
,
AppContextProvider
.
appContext
.
getString
(
R
.
string
.
more_preferences
)))
}.
build
()
}
...
...
@@ -72,6 +83,14 @@ class CarSettingsScreen(carContext: CarContext) : Screen(carContext) {
setOnClickListener
{
screenManager
.
push
(
screen
)
}
}.
build
()
}
private
fun
openPreferencesOnPhone
()
{
val
intent
=
Intent
(
carContext
,
PreferencesActivity
::
class
.
java
).
apply
{
addFlags
(
Intent
.
FLAG_ACTIVITY_CLEAR_TOP
or
Intent
.
FLAG_ACTIVITY_NEW_TASK
)
}
carContext
.
startActivity
(
intent
)
CarToast
.
makeText
(
carContext
,
AppContextProvider
.
appContext
.
getText
(
R
.
string
.
prefs_opened_on_phone
),
CarToast
.
LENGTH_SHORT
).
show
()
}
}
class
LongMessageScreen
(
carContext
:
CarContext
,
@StringRes
private
val
titleRes
:
Int
,
@StringRes
private
val
messageRes
:
Int
,
@StringRes
private
val
messageRes2
:
Int
?
=
null
)
:
Screen
(
carContext
)
{
...
...
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