[Android] Change the snackbar anchor when hover the audio player
Nicolas Pomepuy
git at videolan.org
Wed May 15 13:56:43 UTC 2024
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Wed May 15 10:30:00 2024 +0200| [820fee98eba81b4ac92b1d1ea120996dc6dc74f8] | committer: Nicolas Pomepuy
Change the snackbar anchor when hover the audio player
> https://code.videolan.org/videolan/vlc-android/commit/820fee98eba81b4ac92b1d1ea120996dc6dc74f8
---
.../vlc-android/src/org/videolan/vlc/PlaybackService.kt | 10 ++++++++--
.../vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.kt | 2 +-
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt b/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
index 1639cb386c..675b308508 100644
--- a/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
+++ b/application/vlc-android/src/org/videolan/vlc/PlaybackService.kt
@@ -64,6 +64,7 @@ import androidx.core.app.ServiceCompat
import androidx.core.content.edit
import androidx.core.content.getSystemService
import androidx.core.os.bundleOf
+import androidx.fragment.app.FragmentActivity
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.MutableLiveData
@@ -157,6 +158,7 @@ import org.videolan.vlc.gui.helpers.AudioUtil
import org.videolan.vlc.gui.helpers.NotificationHelper
import org.videolan.vlc.gui.helpers.UiTools
import org.videolan.vlc.gui.helpers.getBitmapFromDrawable
+import org.videolan.vlc.gui.preferences.PreferencesActivity
import org.videolan.vlc.gui.video.PopupManager
import org.videolan.vlc.gui.video.VideoPlayerActivity
import org.videolan.vlc.media.MediaSessionBrowser
@@ -782,8 +784,12 @@ class PlaybackService : MediaBrowserServiceCompat(), LifecycleOwner, CoroutineSc
stop()
Toast.makeText(this, R.string.metered_connection_stopped, Toast.LENGTH_LONG).show()
} else {
- AppContextProvider.currentActivity?.let {
- UiTools.snacker(it, R.string.metered_connection_warning, it is AudioPlayerContainerActivity && it.isAudioPlayerExpanded)
+ AppContextProvider.currentActivity?.let {activity ->
+ UiTools.snackerConfirm(activity, getString(R.string.metered_connection_warning), overAudioPlayer = activity is AudioPlayerContainerActivity && activity.isAudioPlayerExpanded, confirmMessage = R.string.preferences) {
+ lifecycleScope.launch {
+ PreferencesActivity.launchWithPref(activity as FragmentActivity, "metered_connection")
+ }
+ }
} ?: run {
Toast.makeText(this, R.string.metered_connection_warning, Toast.LENGTH_LONG).show()
}
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.kt b/application/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.kt
index ae0a07badb..f536efad8b 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.kt
@@ -273,7 +273,7 @@ object UiTools {
fun snacker(activity: Activity, stringId: Int, overAudioPlayer: Boolean = false) {
val view = getSnackAnchorView(activity, overAudioPlayer) ?: return
val snack = Snackbar.make(view, stringId, Snackbar.LENGTH_SHORT)
- if (overAudioPlayer) snack.setAnchorView(R.id.time)
+ if (overAudioPlayer) snack.setAnchorView(R.id.audio_play_progress)
snack.show()
}
More information about the Android
mailing list