Skip to content

Commit bf8d80b

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

2 files changed

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

0 commit comments

Comments
 (0)