From 56fd79ff46d0d86021f2628f05d26d8811c2e09e Mon Sep 17 00:00:00 2001 From: Abandoned Cart Date: Wed, 19 Apr 2023 08:40:10 -0400 Subject: [PATCH] Remove the DataItem wrapper on AppItem --- app/src/main/java/emu/skyline/MainActivity.kt | 5 ++--- .../main/java/emu/skyline/data/{DataItem.kt => AppItem.kt} | 4 +--- 2 files changed, 3 insertions(+), 6 deletions(-) rename app/src/main/java/emu/skyline/data/{DataItem.kt => AppItem.kt} (95%) diff --git a/app/src/main/java/emu/skyline/MainActivity.kt b/app/src/main/java/emu/skyline/MainActivity.kt index 69cc2f6e..725845bb 100644 --- a/app/src/main/java/emu/skyline/MainActivity.kt +++ b/app/src/main/java/emu/skyline/MainActivity.kt @@ -32,7 +32,6 @@ import emu.skyline.data.AppItemTag import emu.skyline.databinding.MainActivityBinding import emu.skyline.loader.AppEntry import emu.skyline.loader.LoaderResult -import emu.skyline.loader.RomFormat import emu.skyline.provider.DocumentsProvider import emu.skyline.settings.AppSettings import emu.skyline.settings.EmulationSettings @@ -210,7 +209,7 @@ class MainActivity : AppCompatActivity() { if (appSettings.searchLocation.isEmpty()) documentPicker.launch(null) } - private fun getDataItems() = mutableListOf().apply { + private fun getAppItems() = mutableListOf().apply { appEntries?.let { entries -> sortGameList(entries.toList()).forEach { entry -> add(AppItem(entry).toViewItem()) @@ -269,7 +268,7 @@ class MainActivity : AppCompatActivity() { } private fun populateAdapter() { - val items = getDataItems() + val items = getAppItems() binding.emptyPlaceholder.isVisible = items.isEmpty() adapter.setItems(items) } diff --git a/app/src/main/java/emu/skyline/data/DataItem.kt b/app/src/main/java/emu/skyline/data/AppItem.kt similarity index 95% rename from app/src/main/java/emu/skyline/data/DataItem.kt rename to app/src/main/java/emu/skyline/data/AppItem.kt index bf6ca658..b6101334 100644 --- a/app/src/main/java/emu/skyline/data/DataItem.kt +++ b/app/src/main/java/emu/skyline/data/AppItem.kt @@ -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) } -sealed class DataItem : Serializable - /** * 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 */