Skip to content
Snippets Groups Projects
Commit bb551a2e authored by Nicolas Pomepuy's avatar Nicolas Pomepuy Committed by Geoffrey Métais
Browse files

Fix some overscan issues

parent 866646b1
No related branches found
No related tags found
1 merge request!137Album and playlist screens on TV
......@@ -61,7 +61,7 @@
android:id="@+id/cover"
android:layout_width="0dp"
android:layout_height="90dp"
android:layout_marginStart="24dp"
android:layout_marginStart="@dimen/tv_overscan_horizontal"
android:layout_marginBottom="8dp"
android:background="@{cover}"
app:imageWidth="@{imageWidth}"
......@@ -179,12 +179,13 @@
</LinearLayout>
</HorizontalScrollView>
<androidx.recyclerview.widget.RecyclerView
<org.videolan.vlc.gui.tv.FocusableRecyclerView
android:id="@+id/media_list"
android:layout_width="800dp"
android:layout_height="0dp"
android:clipToPadding="false"
android:paddingTop="40dp"
android:paddingBottom="150dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
......
package org.videolan.vlc.gui.tv
/**
* Callback used when the adapter is used in a [FocusableRecyclerView]
*/
interface TvFocusableAdapter {
fun setOnFocusChangeListener(focusListener: FocusableRecyclerView.FocusListener?)
}
\ No newline at end of file
package org.videolan.vlc.gui.tv
interface TvItemAdapter {
interface TvItemAdapter : TvFocusableAdapter {
fun submitList(pagedList: Any?)
fun setOnFocusChangeListener(focusListener: FocusableRecyclerView.FocusListener?)
var focusNext: Int
}
......@@ -16,11 +16,21 @@ import org.videolan.vlc.BuildConfig
import org.videolan.vlc.databinding.ActivityMediaListTvItemBinding
import org.videolan.vlc.gui.DiffUtilAdapter
import org.videolan.vlc.gui.helpers.SelectorViewHolder
import org.videolan.vlc.gui.tv.FocusableRecyclerView
import org.videolan.vlc.gui.tv.TvFocusableAdapter
import org.videolan.vlc.interfaces.ITVEventsHandler
@ExperimentalCoroutinesApi
@ObsoleteCoroutinesApi
class MediaListAdapter(private val type: Int, private val listener: ITVEventsHandler) : DiffUtilAdapter<MediaWrapper, MediaListAdapter.MediaListViewHolder>() {
class MediaListAdapter(private val type: Int, private val listener: ITVEventsHandler) : DiffUtilAdapter<MediaWrapper, MediaListAdapter.MediaListViewHolder>(), TvFocusableAdapter {
private var focusListener: FocusableRecyclerView.FocusListener? = null
override fun setOnFocusChangeListener(focusListener: FocusableRecyclerView.FocusListener?) {
this.focusListener = focusListener
}
var lastMovedItemFrom = -1
var lastMovedItemTo = -1
......@@ -81,6 +91,9 @@ class MediaListAdapter(private val type: Int, private val listener: ITVEventsHan
if (hasFocus) {
listener.onFocusChanged(getItem(layoutPosition))
}
if (hasFocus) {
focusListener?.onFocusChanged(layoutPosition)
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment