Update tablet detail layouts
Update the tablet detail layouts to look better.
This commit is contained in:
@@ -63,7 +63,7 @@ class LibraryFragment : Fragment() {
|
||||
binding.libraryRecycler.apply {
|
||||
adapter = libraryAdapter
|
||||
setHasFixedSize(true)
|
||||
val spans = context.getSpans()
|
||||
val spans = getSpans()
|
||||
|
||||
if (spans != 1) {
|
||||
layoutManager = GridLayoutManager(requireContext(), spans)
|
||||
|
||||
@@ -5,7 +5,6 @@ import androidx.annotation.IdRes
|
||||
import org.oxycblt.auxio.R
|
||||
import org.oxycblt.auxio.music.Album
|
||||
import org.oxycblt.auxio.music.Artist
|
||||
import org.oxycblt.auxio.music.BaseModel
|
||||
import org.oxycblt.auxio.music.Genre
|
||||
import org.oxycblt.auxio.music.Song
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ class SearchFragment : Fragment() {
|
||||
|
||||
binding.searchRecycler.apply {
|
||||
adapter = searchAdapter
|
||||
val spans = context.getSpans()
|
||||
val spans = getSpans()
|
||||
|
||||
if (spans != -1) {
|
||||
layoutManager = GridLayoutManager(requireContext(), spans).apply {
|
||||
|
||||
@@ -69,7 +69,7 @@ class SongsFragment : Fragment() {
|
||||
adapter = songAdapter
|
||||
setHasFixedSize(true)
|
||||
|
||||
val spans = context.getSpans()
|
||||
val spans = getSpans()
|
||||
|
||||
if (spans != 1) {
|
||||
layoutManager = GridLayoutManager(requireContext(), spans)
|
||||
|
||||
@@ -21,6 +21,7 @@ import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.text.HtmlCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.google.android.material.button.MaterialButton
|
||||
import org.oxycblt.auxio.R
|
||||
import org.oxycblt.auxio.logE
|
||||
@@ -162,7 +163,7 @@ fun isTablet(resources: Resources): Boolean {
|
||||
/**
|
||||
* Get the span count for most RecyclerViews
|
||||
*/
|
||||
fun Context.getSpans(): Int {
|
||||
fun RecyclerView.getSpans(): Int {
|
||||
return if (isLandscape(resources)) {
|
||||
if (isTablet(resources)) 3 else 2
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user