This commit is contained in:
LagradOst 2022-03-20 23:31:56 +01:00
parent eb1aaa5329
commit 092fad148b
2 changed files with 5 additions and 6 deletions

View file

@ -7,7 +7,7 @@ import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import kotlin.math.abs import kotlin.math.abs
class GrdLayoutManager(val context: Context, private val spanCoun: Int) : GridLayoutManager(context, spanCoun) { class GrdLayoutManager(val context: Context, _spanCount: Int) : GridLayoutManager(context, _spanCount) {
override fun onFocusSearchFailed( override fun onFocusSearchFailed(
focused: View, focused: View,
focusDirection: Int, focusDirection: Int,
@ -16,7 +16,6 @@ class GrdLayoutManager(val context: Context, private val spanCoun: Int) : GridLa
): View? { ): View? {
return try { return try {
val fromPos = getPosition(focused) val fromPos = getPosition(focused)
println("Search failed $fromPos")
val nextPos = getNextViewPos(fromPos, focusDirection) val nextPos = getNextViewPos(fromPos, focusDirection)
findViewByPosition(nextPos) findViewByPosition(nextPos)
} catch (e: Exception) { } catch (e: Exception) {
@ -62,7 +61,7 @@ class GrdLayoutManager(val context: Context, private val spanCoun: Int) : GridLa
} }
private fun calcOffsetToNextView(direction: Int): Int { private fun calcOffsetToNextView(direction: Int): Int {
val spanCount = this.spanCoun val spanCount = this.spanCount
val orientation = this.orientation val orientation = this.orientation
if (orientation == VERTICAL) { if (orientation == VERTICAL) {
@ -79,7 +78,6 @@ class GrdLayoutManager(val context: Context, private val spanCoun: Int) : GridLa
View.FOCUS_LEFT -> { View.FOCUS_LEFT -> {
return -1 return -1
} }
} }
} else if (orientation == HORIZONTAL) { } else if (orientation == HORIZONTAL) {
when (direction) { when (direction) {
@ -95,7 +93,6 @@ class GrdLayoutManager(val context: Context, private val spanCoun: Int) : GridLa
View.FOCUS_LEFT -> { View.FOCUS_LEFT -> {
return -spanCount return -spanCount
} }
} }
} }
return 0 return 0

View file

@ -185,7 +185,9 @@ object BackupUtils {
"text/plain", "text/plain",
"text/str", "text/str",
"text/x-unknown", "text/x-unknown",
"application/json" "application/json",
"unknown/unknown",
"content/unknown",
) )
) )
} }