Skip to content

Commit 84c6467

Browse files
author
Yevhen Babiichuk (DustDFG)
committed
Convert newpipe/settings/preferencesearch/PreferenceSearchItem.java to kotlin
1 parent 873b2be commit 84c6467

2 files changed

Lines changed: 40 additions & 102 deletions

File tree

app/src/main/java/org/schabi/newpipe/settings/preferencesearch/PreferenceSearchItem.java

Lines changed: 0 additions & 102 deletions
This file was deleted.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2022-2025 NewPipe contributors <https://newpipe.net>
3+
* SPDX-License-Identifier: GPL-3.0-or-later
4+
*/
5+
6+
package org.schabi.newpipe.settings.preferencesearch
7+
8+
import androidx.annotation.XmlRes
9+
10+
/**
11+
* Represents a preference-item inside the search.
12+
*
13+
* @param key Key of the setting/preference. E.g. used inside [android.content.SharedPreferences].
14+
* @param title Title of the setting, e.g. 'Default resolution' or 'Show higher resolutions'.
15+
* @param summary Summary of the setting, e.g. '480p' or 'Only some devices can play 2k/4k'.
16+
* @param entries Possible entries of the setting, e.g. 480p,720p,...
17+
* @param breadcrumbs Breadcrumbs - a hint where the setting is located e.g. 'Video and Audio > Player'
18+
* @param searchIndexItemResId The xml-resource where this item was found/built from.
19+
*/
20+
21+
data class PreferenceSearchItem(
22+
val key: String,
23+
val title: String,
24+
val summary: String,
25+
val entries: String,
26+
val breadcrumbs: String,
27+
@XmlRes val searchIndexItemResId: Int
28+
) {
29+
fun hasData(): Boolean {
30+
return !key.isEmpty() && !title.isEmpty()
31+
}
32+
33+
fun getAllRelevantSearchFields(): MutableList<String?> {
34+
return mutableListOf(title, summary, entries, breadcrumbs)
35+
}
36+
37+
override fun toString(): String {
38+
return "PreferenceItem: $title $summary $key"
39+
}
40+
}

0 commit comments

Comments
 (0)