Skip to content

Commit 48ff277

Browse files
author
Yevhen Babiichuk (DustDFG)
committed
Convert newpipe/settings/preferencesearch/PreferenceSearchItem.java to kotlin
1 parent 500c681 commit 48ff277

2 files changed

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

0 commit comments

Comments
 (0)