Skip to content

Commit 50633c7

Browse files
author
Yevhen Babiichuk (DustDFG)
committed
Convert newpipe/settings/preferencesearch/PreferenceSearchItem.java to kotlin
1 parent 8ae5a55 commit 50633c7

2 files changed

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

0 commit comments

Comments
 (0)