[Android] Remove haptic feedback on brightness/volume sliders

Nicolas Pomepuy git at videolan.org
Mon Sep 28 13:40:06 CEST 2020


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Fri Sep 25 08:10:52 2020 +0200| [56b39c73288a31f8402a3091661875d49414b428] | committer: Nicolas Pomepuy

Remove haptic feedback on brightness/volume sliders

> https://code.videolan.org/videolan/vlc-android/commit/56b39c73288a31f8402a3091661875d49414b428
---

 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt     |  1 -
 .../org/videolan/vlc/gui/video/VideoPlayerOverlayDelegate.kt  | 11 -----------
 2 files changed, 12 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
index 0770e6005..e1fff74f0 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
@@ -471,7 +471,6 @@ open class VideoPlayerActivity : AppCompatActivity(), PlaybackService.Callback,
 
         overlayDelegate.playToPause = AnimatedVectorDrawableCompat.create(this, R.drawable.anim_play_pause_video)!!
         overlayDelegate.pauseToPlay = AnimatedVectorDrawableCompat.create(this, R.drawable.anim_pause_play_video)!!
-        overlayDelegate.vibrator = getSystemService<Vibrator>()!!
     }
 
     override fun afterTextChanged(s: Editable?) {
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerOverlayDelegate.kt b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerOverlayDelegate.kt
index 659da5dbc..051d7783c 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerOverlayDelegate.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerOverlayDelegate.kt
@@ -31,8 +31,6 @@ import android.content.Intent
 import android.content.pm.ActivityInfo
 import android.content.res.Configuration
 import android.os.Build
-import android.os.VibrationEffect
-import android.os.Vibrator
 import android.view.View
 import android.view.WindowManager
 import android.view.animation.AnimationUtils
@@ -94,7 +92,6 @@ class VideoPlayerOverlayDelegate (private val player: VideoPlayerActivity) {
     var info: TextView? = null
     var overlayInfo: View? = null
     lateinit var playerUiContainer:RelativeLayout
-    lateinit var vibrator: Vibrator
 
     lateinit var hudBinding: PlayerHudBinding
     lateinit var hudRightBinding: PlayerHudRightBinding
@@ -210,7 +207,6 @@ class VideoPlayerOverlayDelegate (private val player: VideoPlayerActivity) {
         playerOverlayBrightness = player.findViewById(R.id.player_overlay_brightness)
         brightnessValueText = player.findViewById(R.id.brightness_value_text)
         playerBrightnessProgress = player.findViewById(R.id.playerBrightnessProgress)
-        if (playerOverlayBrightness.visibility != View.VISIBLE) hapticFeedback()
         playerOverlayBrightness.setVisible()
         brightnessValueText.text = "$brightness%"
         playerBrightnessProgress.setValue(brightness)
@@ -230,7 +226,6 @@ class VideoPlayerOverlayDelegate (private val player: VideoPlayerActivity) {
         playerOverlayVolume = player.findViewById(R.id.player_overlay_volume)
         volumeValueText = player.findViewById(R.id.volume_value_text)
         playerVolumeProgress = player.findViewById(R.id.playerVolumeProgress)
-        if (playerOverlayVolume.visibility != View.VISIBLE && fromTouch)  hapticFeedback()
         volumeValueText.text = "$volume%"
         playerVolumeProgress.isDouble = player.isAudioBoostEnabled
         playerVolumeProgress.setValue(volume)
@@ -268,12 +263,6 @@ class VideoPlayerOverlayDelegate (private val player: VideoPlayerActivity) {
         player.window.decorView.systemUiVisibility = visibility
     }
 
-    @Suppress("DEPRECATION")
-    private fun hapticFeedback() {
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)  vibrator.vibrate(VibrationEffect.createOneShot(50, 80))
-        else vibrator.vibrate(50)
-    }
-
     /**
      * show overlay
      * @param forceCheck: adjust the timeout in function of playing state



More information about the Android mailing list