mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-27 15:30:31 +05:30
fix: download fragment buttons overlap miniplayer
This commit is contained in:
parent
a96367139a
commit
763f90f226
@ -272,6 +272,8 @@ class AudioPlayerFragment : Fragment(R.layout.fragment_audio_player), AudioPlaye
|
||||
}
|
||||
|
||||
private fun killFragment(stopPlayer: Boolean) {
|
||||
viewModel.isMiniPlayerVisible.value = false
|
||||
|
||||
if (stopPlayer) playerController?.sendCustomCommand(AbstractPlayerService.stopServiceCommand, Bundle.EMPTY)
|
||||
playerController?.release()
|
||||
playerController = null
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.github.libretube.ui.fragments
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.ComponentName
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
@ -8,11 +9,15 @@ import android.content.ServiceConnection
|
||||
import android.os.Bundle
|
||||
import android.os.IBinder
|
||||
import android.view.View
|
||||
import android.view.ViewGroup.MarginLayoutParams
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.core.view.isGone
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.core.view.marginBottom
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
@ -26,6 +31,7 @@ import com.github.libretube.db.DatabaseHolder.Database
|
||||
import com.github.libretube.db.obj.DownloadWithItems
|
||||
import com.github.libretube.db.obj.filterByTab
|
||||
import com.github.libretube.extensions.ceilHalf
|
||||
import com.github.libretube.extensions.dpToPx
|
||||
import com.github.libretube.extensions.formatAsFileSize
|
||||
import com.github.libretube.extensions.serializable
|
||||
import com.github.libretube.extensions.setOnDismissListener
|
||||
@ -40,6 +46,8 @@ import com.github.libretube.services.DownloadService
|
||||
import com.github.libretube.ui.adapters.DownloadsAdapter
|
||||
import com.github.libretube.ui.base.DynamicLayoutManagerFragment
|
||||
import com.github.libretube.ui.extensions.setupFragmentAnimation
|
||||
import com.github.libretube.ui.models.CommonPlayerViewModel
|
||||
import com.github.libretube.ui.models.PlayerViewModel
|
||||
import com.github.libretube.ui.sheets.BaseBottomSheet
|
||||
import com.github.libretube.ui.viewholders.DownloadsViewHolder
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
@ -101,11 +109,14 @@ class DownloadsFragmentAdapter(fragment: Fragment) : FragmentStateAdapter(fragme
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("UnsafeOptInUsageError")
|
||||
class DownloadsFragmentPage : DynamicLayoutManagerFragment(R.layout.fragment_download_content) {
|
||||
private lateinit var adapter: DownloadsAdapter
|
||||
private var _binding: FragmentDownloadContentBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
private val playerViewModel: CommonPlayerViewModel by activityViewModels()
|
||||
|
||||
private var binder: DownloadService.LocalBinder? = null
|
||||
private val downloadReceiver = DownloadReceiver()
|
||||
private lateinit var downloadTab: DownloadTab
|
||||
@ -227,6 +238,12 @@ class DownloadsFragmentPage : DynamicLayoutManagerFragment(R.layout.fragment_dow
|
||||
|
||||
NavigationHelper.openAudioPlayerFragment(requireContext(), offlinePlayer = true)
|
||||
}
|
||||
|
||||
playerViewModel.isMiniPlayerVisible.observe(viewLifecycleOwner) { isMiniPlayerVisible ->
|
||||
binding.fabContainer.updateLayoutParams<MarginLayoutParams> {
|
||||
bottomMargin = (if (isMiniPlayerVisible) 64f else 16f).dpToPx()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun submitDownloadList(items: List<DownloadWithItems>) {
|
||||
|
@ -61,6 +61,7 @@
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/fab_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
Loading…
x
Reference in New Issue
Block a user