[Android] Feedback: open the right settings on TV when no email client installed
Nicolas Pomepuy
git at videolan.org
Thu Apr 24 14:06:54 UTC 2025
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Fri Apr 11 09:00:06 2025 +0200| [eba0ba0bae766c4f7963a1630e80d4c928e0a44b] | committer: Nicolas Pomepuy
Feedback: open the right settings on TV when no email client installed
> https://code.videolan.org/videolan/vlc-android/commit/eba0ba0bae766c4f7963a1630e80d4c928e0a44b
---
.../main/java/org/videolan/resources/Constants.kt | 1 +
.../ui/preferences/PreferencesActivity.kt | 7 ++++++
.../ui/preferences/PreferencesFragment.kt | 25 ++++++++++++++++++++--
.../src/org/videolan/vlc/gui/FeedbackActivity.kt | 11 +++++++++-
4 files changed, 41 insertions(+), 3 deletions(-)
diff --git a/application/resources/src/main/java/org/videolan/resources/Constants.kt b/application/resources/src/main/java/org/videolan/resources/Constants.kt
index 35d4e39391..c6b4b15d89 100644
--- a/application/resources/src/main/java/org/videolan/resources/Constants.kt
+++ b/application/resources/src/main/java/org/videolan/resources/Constants.kt
@@ -242,6 +242,7 @@ const val TV_SEARCH_ACTIVITY = "org.videolan.television.ui.SearchActivity"
const val MOBILE_SEARCH_ACTIVITY = "org.videolan.vlc.gui.SearchActivity"
const val TV_MAIN_ACTIVITY = "org.videolan.television.ui.MainTvActivity"
const val TV_CONFIRMATION_ACTIVITY = "org.videolan.television.ui.dialogs.ConfirmationTvActivity"
+const val TV_PREFERENCE_ACTIVITY = "org.videolan.television.ui.preferences.PreferencesActivity"
const val MOBILE_MAIN_ACTIVITY = "org.videolan.vlc.gui.MainActivity"
const val MOVIEPEDIA_ACTIVITY = "org.videolan.moviepedia.ui.MoviepediaActivity"
const val TV_AUDIOPLAYER_ACTIVITY = "org.videolan.television.ui.audioplayer.AudioPlayerActivity"
diff --git a/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesActivity.kt b/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesActivity.kt
index 1298ea53fd..f91dfe6c48 100644
--- a/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesActivity.kt
+++ b/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesActivity.kt
@@ -38,9 +38,11 @@ import org.videolan.tools.Settings
import org.videolan.vlc.PlaybackService
import org.videolan.vlc.gui.PinCodeActivity
import org.videolan.vlc.gui.PinCodeReason
+import org.videolan.vlc.gui.preferences.EXTRA_PREF_END_POINT
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
class PreferencesActivity : BaseTvActivity() {
+ var extraEndPoint: String? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@@ -50,6 +52,11 @@ class PreferencesActivity : BaseTvActivity() {
val intent = PinCodeActivity.getIntent(this, PinCodeReason.CHECK)
startActivityForResult(intent, 0)
}
+ if (savedInstanceState == null) {
+ if (intent.hasExtra(EXTRA_PREF_END_POINT)) {
+ extraEndPoint = intent.getStringExtra(EXTRA_PREF_END_POINT)
+ }
+ }
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
diff --git a/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesFragment.kt b/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesFragment.kt
index adc4e5b423..f01f5f2cb2 100644
--- a/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesFragment.kt
+++ b/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesFragment.kt
@@ -35,9 +35,24 @@ import androidx.preference.CheckBoxPreference
import androidx.preference.Preference
import androidx.preference.PreferenceScreen
import org.videolan.medialibrary.interfaces.Medialibrary
-import org.videolan.resources.*
-import org.videolan.tools.*
+import org.videolan.resources.AndroidDevices
+import org.videolan.resources.KEY_AUDIO_LAST_PLAYLIST
+import org.videolan.resources.KEY_CURRENT_AUDIO
+import org.videolan.resources.KEY_CURRENT_AUDIO_RESUME_ARTIST
+import org.videolan.resources.KEY_CURRENT_AUDIO_RESUME_THUMB
+import org.videolan.resources.KEY_CURRENT_AUDIO_RESUME_TITLE
+import org.videolan.resources.KEY_CURRENT_MEDIA
+import org.videolan.resources.KEY_CURRENT_MEDIA_RESUME
+import org.videolan.resources.KEY_MEDIA_LAST_PLAYLIST
+import org.videolan.resources.KEY_MEDIA_LAST_PLAYLIST_RESUME
+import org.videolan.tools.AUDIO_RESUME_PLAYBACK
+import org.videolan.tools.KEY_VIDEO_APP_SWITCH
+import org.videolan.tools.PLAYBACK_HISTORY
+import org.videolan.tools.RESULT_RESTART
+import org.videolan.tools.SCREEN_ORIENTATION
+import org.videolan.tools.Settings
import org.videolan.tools.Settings.isPinCodeSet
+import org.videolan.tools.VIDEO_RESUME_PLAYBACK
import org.videolan.vlc.R
import org.videolan.vlc.gui.PinCodeActivity
import org.videolan.vlc.gui.PinCodeReason
@@ -60,6 +75,12 @@ class PreferencesFragment : BasePreferenceFragment(), SharedPreferences.OnShared
findPreference<Preference>(KEY_VIDEO_APP_SWITCH)?.isVisible = AndroidDevices.hasPiP
findPreference<Preference>("remote_access_category")?.isVisible = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1
findPreference<Preference>("permissions_title")?.isVisible = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1
+ (activity as? PreferencesActivity)?.extraEndPoint?.let {
+ if (it == "remote_access_category") findPreference<Preference>("remote_access_category")?.let {
+ onPreferenceTreeClick(it)
+ (activity as? PreferencesActivity)?.extraEndPoint = null
+ }
+ }
}
override fun onStart() {
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/FeedbackActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/FeedbackActivity.kt
index 292bf9057d..808b0a9c5f 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/FeedbackActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/FeedbackActivity.kt
@@ -45,7 +45,9 @@ import org.videolan.resources.AppContextProvider
import org.videolan.resources.CRASH_HAPPENED
import org.videolan.resources.CRASH_ML_CTX
import org.videolan.resources.CRASH_ML_MSG
+import org.videolan.resources.TV_PREFERENCE_ACTIVITY
import org.videolan.resources.util.applyOverscanMargin
+import org.videolan.tools.Settings
import org.videolan.tools.isVisible
import org.videolan.tools.setGone
import org.videolan.tools.setVisible
@@ -55,6 +57,7 @@ import org.videolan.vlc.R
import org.videolan.vlc.databinding.AboutFeedbackActivityBinding
import org.videolan.vlc.gui.helpers.FeedbackUtil
import org.videolan.vlc.gui.helpers.UiTools
+import org.videolan.vlc.gui.preferences.EXTRA_PREF_END_POINT
import org.videolan.vlc.gui.preferences.PreferencesActivity
import org.videolan.vlc.util.FileUtils
import org.videolan.vlc.util.Permissions
@@ -182,7 +185,13 @@ class FeedbackActivity : BaseActivity(), DebugLogService.Client.Callback {
}
binding.openSettings.setOnClickListener {
lifecycleScope.launch {
- PreferencesActivity.launchWithPref(this at FeedbackActivity, "enable_remote_access")
+ if (Settings.tvUI) {
+ val intent = Intent(Intent.ACTION_VIEW).setClassName(this at FeedbackActivity, TV_PREFERENCE_ACTIVITY)
+ intent.putExtra(EXTRA_PREF_END_POINT, "remote_access_category")
+ startActivity(intent)
+ }
+ else
+ PreferencesActivity.launchWithPref(this at FeedbackActivity, "enable_remote_access")
}
}
binding.emailSupportCard.setOnClickListener {
More information about the Android
mailing list