Browse Source

Move the auto settings to the mobile app

merge-requests/2314/head
Nicolas Pomepuy 11 months ago
parent
commit
4d01459340
  1. 85
      application/vlc-android/res/layout/dialog_auto_info.xml
  2. 7
      application/vlc-android/res/menu/activity_prefs.xml
  3. 6
      application/vlc-android/res/xml/preferences_android_auto.xml
  4. 74
      application/vlc-android/src/org/videolan/vlc/gui/dialogs/AutoInfoDialog.kt
  5. 23
      application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAndroidAuto.kt

85
application/vlc-android/res/layout/dialog_auto_info.xml

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:id="@+id/title"
style="@style/Theme.VLC.BottomSheetTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:minHeight="0dp"
android:text="@string/android_auto"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/podcast_mode_title"
style="@style/Theme.VLC.HorizontalListTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="16dp"
android:text="@string/podcast_mode"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/title" />
<TextView
android:id="@+id/podcast_mode_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:text="@string/podcast_mode_help"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/podcast_mode_title" />
<TextView
android:id="@+id/voice_control_title"
style="@style/Theme.VLC.HorizontalListTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:text="@string/voice_control"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/podcast_mode_text" />
<TextView
android:id="@+id/voice_control_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="24dp"
android:text="@string/voice_control_help"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/voice_control_title" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
</layout>

7
application/vlc-android/res/menu/activity_prefs.xml

@ -40,4 +40,11 @@
android:title="@string/ra_remote_access"
android:visible="false"
vlc:showAsAction="always|collapseActionView" />
<item
android:id="@+id/menu_android_auto_info"
android:icon="@drawable/ic_information"
android:orderInCategory="2"
android:title="@string/info"
android:visible="false"
vlc:showAsAction="always|collapseActionView" />
</menu>

6
application/vlc-android/res/xml/preferences_android_auto.xml

@ -44,6 +44,12 @@
</PreferenceCategory>
<PreferenceCategory android:title="@string/controls_prefs_category">
<CheckBoxPreference
android:defaultValue="false"
android:key="playback_speed_audio_global"
android:summary="@string/audio_playback_speed_global_summary"
android:title="@string/audio_playback_speed_global"
app:singleLineTitle="false" />
<CheckBoxPreference
android:defaultValue="false"
android:key="enable_android_auto_speed_buttons"

74
application/vlc-android/src/org/videolan/vlc/gui/dialogs/AutoInfoDialog.kt

@ -0,0 +1,74 @@
/**
* **************************************************************************
* AutoInfoDialog.kt
* ****************************************************************************
* Copyright © 2025 VLC authors and VideoLAN
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* ***************************************************************************
*/
package org.videolan.vlc.gui.dialogs
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.google.android.material.bottomsheet.BottomSheetBehavior.STATE_EXPANDED
import org.videolan.vlc.R
import org.videolan.vlc.databinding.DialogAutoInfoBinding
/**
* Dialog showing the info of the current version
*/
class AutoInfoDialog : VLCBottomSheetDialogFragment() {
private lateinit var binding: DialogAutoInfoBinding
companion object {
fun newInstance(): AutoInfoDialog {
return AutoInfoDialog()
}
}
override fun getDefaultState(): Int {
return STATE_EXPANDED
}
override fun needToManageOrientation(): Boolean {
return false
}
override fun initialFocusedView(): View = binding.title
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
binding = DialogAutoInfoBinding.inflate(layoutInflater, container, false)
return binding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
binding.podcastModeText.text = getString(R.string.podcast_mode_help, getString(R.string.podcast_mode_genres))
}
}

23
application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAndroidAuto.kt

@ -21,14 +21,21 @@
*/
package org.videolan.vlc.gui.preferences
import android.content.Intent
import android.content.SharedPreferences
import android.os.Bundle
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import androidx.core.content.edit
import androidx.preference.Preference
import org.videolan.resources.REMOTE_ACCESS_ONBOARDING
import org.videolan.tools.KEY_ANDROID_AUTO_QUEUE_INFO_POS_VAL
import org.videolan.tools.Settings
import org.videolan.vlc.PlaybackService
import org.videolan.vlc.R
import org.videolan.vlc.gui.dialogs.AboutVersionDialog
import org.videolan.vlc.gui.dialogs.AutoInfoDialog
import java.lang.NumberFormatException
class PreferencesAndroidAuto : BasePreferenceFragment(), SharedPreferences.OnSharedPreferenceChangeListener {
@ -57,6 +64,22 @@ class PreferencesAndroidAuto : BasePreferenceFragment(), SharedPreferences.OnSha
settings = Settings.getInstance(requireActivity())
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (item.itemId == R.id.menu_android_auto_info)
AutoInfoDialog.newInstance().show(requireActivity().supportFragmentManager, "AutoInfoDialog")
return super.onOptionsItemSelected(item)
}
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
menu.findItem(R.id.menu_android_auto_info).isVisible = true
super.onCreateOptionsMenu(menu, inflater)
}
override fun onPrepareOptionsMenu(menu: Menu) {
menu.findItem(R.id.menu_android_auto_info).isVisible = true
super.onPrepareOptionsMenu(menu)
}
override fun onPreferenceTreeClick(preference: Preference): Boolean {
return super.onPreferenceTreeClick(preference)
}

Loading…
Cancel
Save