Make queue a fragment instead of a dialog
Make QueueFragment an actual fragment instead of a BottomSheetDialogFragment. Really dont want to deal with the garbage BottomSheetDialogFragment does.
This commit is contained in:
parent
4fb4120342
commit
a192fb52c3
6 changed files with 42 additions and 23 deletions
|
@ -6,13 +6,13 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.activityViewModels
|
import androidx.fragment.app.activityViewModels
|
||||||
|
import androidx.navigation.fragment.findNavController
|
||||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
|
||||||
import org.oxycblt.auxio.databinding.FragmentQueueBinding
|
import org.oxycblt.auxio.databinding.FragmentQueueBinding
|
||||||
import org.oxycblt.auxio.playback.PlaybackViewModel
|
import org.oxycblt.auxio.playback.PlaybackViewModel
|
||||||
|
|
||||||
// TODO: Make this better
|
// TODO: Make this better
|
||||||
class QueueFragment : BottomSheetDialogFragment() {
|
class QueueFragment : Fragment() {
|
||||||
private val playbackModel: PlaybackViewModel by activityViewModels()
|
private val playbackModel: PlaybackViewModel by activityViewModels()
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
|
@ -22,13 +22,17 @@ class QueueFragment : BottomSheetDialogFragment() {
|
||||||
): View? {
|
): View? {
|
||||||
val binding = FragmentQueueBinding.inflate(inflater)
|
val binding = FragmentQueueBinding.inflate(inflater)
|
||||||
|
|
||||||
|
binding.queueToolbar.setNavigationOnClickListener {
|
||||||
|
findNavController().navigateUp()
|
||||||
|
}
|
||||||
|
|
||||||
binding.queueViewpager.adapter = PagerAdapter()
|
binding.queueViewpager.adapter = PagerAdapter()
|
||||||
|
|
||||||
// TODO: Add option for default queue screen
|
// TODO: Add option for default queue screen
|
||||||
if (playbackModel.userQueue.value!!.isEmpty()) {
|
if (playbackModel.userQueue.value!!.isNotEmpty()) {
|
||||||
binding.queueViewpager.setCurrentItem(1, false)
|
|
||||||
} else {
|
|
||||||
binding.queueViewpager.setCurrentItem(0, false)
|
binding.queueViewpager.setCurrentItem(0, false)
|
||||||
|
} else {
|
||||||
|
binding.queueViewpager.setCurrentItem(1, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
return binding.root
|
return binding.root
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.oxycblt.auxio.playback.PlaybackViewModel
|
||||||
import org.oxycblt.auxio.playback.state.PlaybackMode
|
import org.oxycblt.auxio.playback.state.PlaybackMode
|
||||||
import org.oxycblt.auxio.ui.applyDivider
|
import org.oxycblt.auxio.ui.applyDivider
|
||||||
|
|
||||||
|
// TODO: Unify the user/next queues into a single fragment
|
||||||
class QueueListFragment(private val type: Int) : Fragment() {
|
class QueueListFragment(private val type: Int) : Fragment() {
|
||||||
private val playbackModel: PlaybackViewModel by activityViewModels()
|
private val playbackModel: PlaybackViewModel by activityViewModels()
|
||||||
|
|
||||||
|
|
|
@ -3,14 +3,29 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
<FrameLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.Toolbar
|
||||||
|
android:id="@+id/queue_toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="?android:attr/actionBarSize"
|
||||||
|
android:background="?android:attr/windowBackground"
|
||||||
|
android:theme="@style/Toolbar.Style"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true"
|
||||||
|
app:navigationIcon="@drawable/ic_down"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:title="@string/label_queue"
|
||||||
|
app:titleTextAppearance="@style/TextAppearance.Toolbar.Header" />
|
||||||
|
|
||||||
<androidx.viewpager2.widget.ViewPager2
|
<androidx.viewpager2.widget.ViewPager2
|
||||||
android:id="@+id/queue_viewpager"
|
android:id="@+id/queue_viewpager"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
</FrameLayout>
|
</LinearLayout>
|
||||||
</layout>
|
</layout>
|
|
@ -7,23 +7,23 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:background="@color/background">
|
android:background="@color/background"
|
||||||
|
android:animateLayoutChanges="true">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/queue_header"
|
android:id="@+id/queue_header"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ellipsize="marquee"
|
android:background="@drawable/ui_header_dividers"
|
||||||
android:fontFamily="@font/inter_black"
|
android:fontFamily="@font/inter_bold"
|
||||||
android:marqueeRepeatLimit="marquee_forever"
|
android:paddingStart="@dimen/padding_medium"
|
||||||
android:padding="@dimen/padding_medium"
|
android:paddingTop="@dimen/padding_small"
|
||||||
android:singleLine="true"
|
android:paddingEnd="@dimen/padding_small"
|
||||||
android:text="@string/label_queue"
|
android:paddingBottom="@dimen/padding_small"
|
||||||
android:textColor="?android:attr/colorPrimary"
|
android:textAppearance="@style/TextAppearance.MaterialComponents.Overline"
|
||||||
android:textAppearance="@style/TextAppearance.Toolbar.Header"
|
android:textSize="16sp"
|
||||||
app:layout_constraintEnd_toStartOf="parent"
|
tools:text="Next in Queue"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintTop_toBottomOf="@+id/album_details" />
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/queue_recycler"
|
android:id="@+id/queue_recycler"
|
||||||
|
@ -44,6 +44,5 @@
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</layout>
|
</layout>
|
|
@ -124,7 +124,7 @@
|
||||||
app:popEnterAnim="@anim/anim_stationary"
|
app:popEnterAnim="@anim/anim_stationary"
|
||||||
app:popExitAnim="@anim/anim_nav_slide_down" />
|
app:popExitAnim="@anim/anim_nav_slide_down" />
|
||||||
</fragment>
|
</fragment>
|
||||||
<dialog
|
<fragment
|
||||||
android:id="@+id/queue_fragment"
|
android:id="@+id/queue_fragment"
|
||||||
android:name="org.oxycblt.auxio.playback.queue.QueueFragment"
|
android:name="org.oxycblt.auxio.playback.queue.QueueFragment"
|
||||||
android:label="QueueFragment"
|
android:label="QueueFragment"
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
<string name="label_queue_add">Add to queue</string>
|
<string name="label_queue_add">Add to queue</string>
|
||||||
<string name="label_queue_added">Added to queue</string>
|
<string name="label_queue_added">Added to queue</string>
|
||||||
<string name="label_next_user_queue">Next in Queue</string>
|
<string name="label_next_user_queue">Next in Queue</string>
|
||||||
<string name="label_empty_queue">Nothing here.</string>
|
<string name="label_empty_queue">Nothing here</string>
|
||||||
<string name="label_notification_playback">Music Playback</string>
|
<string name="label_notification_playback">Music Playback</string>
|
||||||
<string name="label_service_playback">The music playback service for Auxio.</string>
|
<string name="label_service_playback">The music playback service for Auxio.</string>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue