[Android] Fix video quality top margin in InfoActivity

Nicolas Pomepuy git at videolan.org
Mon Mar 21 12:37:24 UTC 2022


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon Mar 21 13:01:45 2022 +0100| [442c24492594dcf218364e54977d4582ec658ab6] | committer: Duncan McNamara

Fix video quality top margin in InfoActivity

> https://code.videolan.org/videolan/vlc-android/commit/442c24492594dcf218364e54977d4582ec658ab6
---

 .../src/org/videolan/vlc/gui/AudioPlayerContainerActivity.kt        | 4 ++++
 application/vlc-android/src/org/videolan/vlc/gui/InfoActivity.kt    | 6 ++++++
 2 files changed, 10 insertions(+)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.kt
index 8ff021bc5..0666d6458 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.kt
@@ -35,6 +35,7 @@ import android.widget.TextView
 import androidx.appcompat.widget.Toolbar
 import androidx.appcompat.widget.ViewStubCompat
 import androidx.coordinatorlayout.widget.CoordinatorLayout
+import androidx.core.graphics.Insets
 import androidx.core.net.toUri
 import androidx.core.view.*
 import androidx.fragment.app.Fragment
@@ -110,6 +111,8 @@ open class AudioPlayerContainerActivity : BaseActivity(), KeycodeListener {
 
     open fun needsTopInset(): Boolean = true
 
+    open val insetListener: (Insets) -> Unit = {}
+
     var bottomInset = 0
 
     @Suppress("LeakingThis")
@@ -157,6 +160,7 @@ open class AudioPlayerContainerActivity : BaseActivity(), KeycodeListener {
                 bottomNavigationView?.setPadding(bottomNavigationView.paddingLeft, bottomNavigationView.paddingTop, bottomNavigationView.paddingRight, insets.bottom)
                 bottomInset = insets.bottom
                 setContentBottomPadding()
+                insetListener.invoke(insets)
             }
 
             WindowInsetsCompat.CONSUMED
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/InfoActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/InfoActivity.kt
index 70b7b3e44..5a53bda6c 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/InfoActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/InfoActivity.kt
@@ -8,8 +8,10 @@ import android.os.Bundle
 import android.os.Parcelable
 import android.view.Gravity
 import android.view.View
+import androidx.constraintlayout.widget.ConstraintLayout
 import androidx.coordinatorlayout.widget.CoordinatorLayout
 import androidx.core.content.ContextCompat
+import androidx.core.graphics.Insets
 import androidx.core.net.toUri
 import androidx.core.view.ViewCompat
 import androidx.databinding.DataBindingUtil
@@ -33,6 +35,7 @@ import org.videolan.medialibrary.interfaces.media.MediaWrapper
 import org.videolan.medialibrary.media.MediaLibraryItem
 import org.videolan.resources.TAG_ITEM
 import org.videolan.resources.VLCInstance
+import org.videolan.tools.dp
 import org.videolan.tools.readableFileSize
 import org.videolan.vlc.R
 import org.videolan.vlc.databinding.InfoActivityBinding
@@ -64,6 +67,9 @@ class InfoActivity : AudioPlayerContainerActivity(), View.OnClickListener, PathA
 
     internal lateinit var binding: InfoActivityBinding
     override fun needsTopInset() = false
+    override val insetListener = {insets:Insets ->
+        (binding.mlItemResolution.layoutParams as ConstraintLayout.LayoutParams).topMargin = insets.top + 16.dp
+    }
 
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)



More information about the Android mailing list