Skip to content

Commit 2dde0fe

Browse files
Yevhen Babiichuk (DustDFG)TobiGr
authored andcommitted
Convert newpipe/util/KioskTranslator.java to kotlin
Cherry picked from #12947 / 4649e46
1 parent c2f526d commit 2dde0fe

2 files changed

Lines changed: 69 additions & 100 deletions

File tree

app/src/main/java/org/schabi/newpipe/util/KioskTranslator.java

Lines changed: 0 additions & 100 deletions
This file was deleted.
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
package org.schabi.newpipe.util
2+
3+
import android.content.Context
4+
import org.schabi.newpipe.R
5+
6+
/**
7+
* Created by Christian Schabesberger on 28.09.17.
8+
* KioskTranslator.java is part of NewPipe.
9+
*
10+
*
11+
* NewPipe is free software: you can redistribute it and/or modify
12+
* it under the terms of the GNU General Public License as published by
13+
* the Free Software Foundation, either version 3 of the License, or
14+
* (at your option) any later version.
15+
*
16+
*
17+
*
18+
* NewPipe is distributed in the hope that it will be useful,
19+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
20+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+
* GNU General Public License for more details.
22+
*
23+
*
24+
*
25+
* You should have received a copy of the GNU General Public License
26+
* along with NewPipe. If not, see <http:></http:>//www.gnu.org/licenses/>.
27+
*
28+
*/
29+
object KioskTranslator {
30+
@JvmStatic
31+
fun getTranslatedKioskName(kioskId: String, c: Context): String {
32+
return when (kioskId) {
33+
"Trending" -> c.getString(R.string.trending)
34+
"Top 50" -> c.getString(R.string.top_50)
35+
"New & hot" -> c.getString(R.string.new_and_hot)
36+
"Local" -> c.getString(R.string.local)
37+
"Recently added" -> c.getString(R.string.recently_added)
38+
"Most liked" -> c.getString(R.string.most_liked)
39+
"conferences" -> c.getString(R.string.conferences)
40+
"recent" -> c.getString(R.string.recent)
41+
"live" -> c.getString(R.string.duration_live)
42+
"Featured" -> c.getString(R.string.featured)
43+
"Radio" -> c.getString(R.string.radio)
44+
"trending_gaming" -> c.getString(R.string.trending_gaming)
45+
"trending_music" -> c.getString(R.string.trending_music)
46+
"trending_movies_and_shows" -> c.getString(R.string.trending_movies)
47+
"trending_podcasts_episodes" -> c.getString(R.string.trending_podcasts)
48+
else -> kioskId
49+
}
50+
}
51+
52+
@JvmStatic
53+
fun getKioskIcon(kioskId: String): Int {
54+
return when (kioskId) {
55+
"Trending", "Top 50", "New & hot", "conferences" -> R.drawable.ic_whatshot
56+
"Local" -> R.drawable.ic_home
57+
"Recently added", "recent" -> R.drawable.ic_add_circle_outline
58+
"Most liked" -> R.drawable.ic_thumb_up
59+
"live" -> R.drawable.ic_live_tv
60+
"Featured" -> R.drawable.ic_stars
61+
"Radio" -> R.drawable.ic_radio
62+
"trending_gaming" -> R.drawable.ic_videogame_asset
63+
"trending_music" -> R.drawable.ic_music_note
64+
"trending_movies_and_shows" -> R.drawable.ic_movie
65+
"trending_podcasts_episodes" -> R.drawable.ic_podcasts
66+
else -> 0
67+
}
68+
}
69+
}

0 commit comments

Comments
 (0)