Add an option to filter valid files for library

This commit is contained in:
Abandoned Cart 2023-03-19 10:35:15 -04:00
parent 61c45e02c8
commit 3e147cbc9d
4 changed files with 11 additions and 0 deletions

View File

@ -305,6 +305,7 @@ class MainActivity : AppCompatActivity() {
private fun populateAdapter() {
val items = getDataItems()
if (appSettings.filterValid) items.removeIf { item -> item is AppItem && item.version.isNullOrEmpty() }
adapter.setItems(items.map {
when (it) {
is HeaderItem -> HeaderViewItem(it.title)

View File

@ -25,6 +25,7 @@ class AppSettings @Inject constructor(@ApplicationContext private val context :
var layoutType by sharedPreferences(context, 1)
var sortAppsBy by sharedPreferences(context, 0)
var groupByFormat by sharedPreferences(context, true)
var filterValid by sharedPreferences(context, false)
var selectAction by sharedPreferences(context, false)
// Input

View File

@ -54,6 +54,9 @@
<string name="group_by_format">Group Games By Format</string>
<string name="group_by_format_desc_off">Games will be shown as a single list</string>
<string name="group_by_format_desc_on">Games will be shown grouped by format</string>
<string name="filter_valid">Filter Valid Games</string>
<string name="filter_valid_desc_off">All game files will be displayed</string>
<string name="filter_valid_desc_on">Only valid games will be displayed</string>
<string name="select_action">Always Show Game Information</string>
<string name="select_action_desc_on">Game information will be shown on clicking a game</string>
<string name="select_action_desc_off">Game information will only be shown on long-clicking a game</string>

View File

@ -57,6 +57,12 @@
android:summaryOn="@string/group_by_format_desc_on"
app:key="group_by_format"
app:title="@string/group_by_format" />
<emu.skyline.preference.RefreshSwitchPreferenceCompat
android:defaultValue="false"
android:summaryOff="@string/filter_valid_desc_off"
android:summaryOn="@string/filter_valid_desc_on"
app:key="filter_valid"
app:title="@string/filter_valid" />
<SwitchPreferenceCompat
android:defaultValue="false"
android:summaryOff="@string/select_action_desc_off"