Remove the DataItem wrapper on AppItem

This commit is contained in:
Abandoned Cart 2023-04-19 08:40:10 -04:00 committed by Billy Laws
parent c8e0f71bb7
commit 56fd79ff46
2 changed files with 3 additions and 6 deletions

View File

@ -32,7 +32,6 @@ import emu.skyline.data.AppItemTag
import emu.skyline.databinding.MainActivityBinding import emu.skyline.databinding.MainActivityBinding
import emu.skyline.loader.AppEntry import emu.skyline.loader.AppEntry
import emu.skyline.loader.LoaderResult import emu.skyline.loader.LoaderResult
import emu.skyline.loader.RomFormat
import emu.skyline.provider.DocumentsProvider import emu.skyline.provider.DocumentsProvider
import emu.skyline.settings.AppSettings import emu.skyline.settings.AppSettings
import emu.skyline.settings.EmulationSettings import emu.skyline.settings.EmulationSettings
@ -210,7 +209,7 @@ class MainActivity : AppCompatActivity() {
if (appSettings.searchLocation.isEmpty()) documentPicker.launch(null) if (appSettings.searchLocation.isEmpty()) documentPicker.launch(null)
} }
private fun getDataItems() = mutableListOf<AppViewItem>().apply { private fun getAppItems() = mutableListOf<AppViewItem>().apply {
appEntries?.let { entries -> appEntries?.let { entries ->
sortGameList(entries.toList()).forEach { entry -> sortGameList(entries.toList()).forEach { entry ->
add(AppItem(entry).toViewItem()) add(AppItem(entry).toViewItem())
@ -269,7 +268,7 @@ class MainActivity : AppCompatActivity() {
} }
private fun populateAdapter() { private fun populateAdapter() {
val items = getDataItems() val items = getAppItems()
binding.emptyPlaceholder.isVisible = items.isEmpty() binding.emptyPlaceholder.isVisible = items.isEmpty()
adapter.setItems(items) adapter.setItems(items)
} }

View File

@ -23,12 +23,10 @@ const val AppItemTag = BuildConfig.APPLICATION_ID + ".APP_ITEM"
private val missingIcon by lazy { ContextCompat.getDrawable(SkylineApplication.instance, R.drawable.default_icon)!!.toBitmap(256, 256) } private val missingIcon by lazy { ContextCompat.getDrawable(SkylineApplication.instance, R.drawable.default_icon)!!.toBitmap(256, 256) }
sealed class DataItem : Serializable
/** /**
* This class is a wrapper around [AppEntry], it is used for passing around game metadata * This class is a wrapper around [AppEntry], it is used for passing around game metadata
*/ */
data class AppItem(private val meta : AppEntry) : DataItem() { data class AppItem(private val meta : AppEntry) : Serializable {
/** /**
* The icon of the application * The icon of the application
*/ */