2017-09-28 16:15:09 +02:00
|
|
|
package org.schabi.newpipe.util;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
|
|
|
|
import org.schabi.newpipe.R;
|
|
|
|
|
|
|
|
/**
|
2020-11-22 10:39:00 +01:00
|
|
|
* Created by Christian Schabesberger on 28.09.17.
|
2017-09-28 16:15:09 +02:00
|
|
|
* KioskTranslator.java is part of NewPipe.
|
2020-03-31 19:20:15 +02:00
|
|
|
* <p>
|
2017-09-28 16:15:09 +02:00
|
|
|
* NewPipe is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2020-03-31 19:20:15 +02:00
|
|
|
* </p>
|
|
|
|
* <p>
|
2017-09-28 16:15:09 +02:00
|
|
|
* NewPipe is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2020-03-31 19:20:15 +02:00
|
|
|
* </p>
|
|
|
|
* <p>
|
2017-09-28 16:15:09 +02:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
|
2020-03-31 19:20:15 +02:00
|
|
|
* </p>
|
2017-09-28 16:15:09 +02:00
|
|
|
*/
|
|
|
|
|
2020-03-31 19:20:15 +02:00
|
|
|
public final class KioskTranslator {
|
|
|
|
private KioskTranslator() { }
|
|
|
|
|
|
|
|
public static String getTranslatedKioskName(final String kioskId, final Context c) {
|
2018-06-08 21:07:25 +02:00
|
|
|
switch (kioskId) {
|
2017-09-28 16:15:09 +02:00
|
|
|
case "Trending":
|
|
|
|
return c.getString(R.string.trending);
|
|
|
|
case "Top 50":
|
|
|
|
return c.getString(R.string.top_50);
|
|
|
|
case "New & hot":
|
|
|
|
return c.getString(R.string.new_and_hot);
|
2019-12-02 21:20:23 +01:00
|
|
|
case "Local":
|
|
|
|
return c.getString(R.string.local);
|
|
|
|
case "Recently added":
|
|
|
|
return c.getString(R.string.recently_added);
|
|
|
|
case "Most liked":
|
|
|
|
return c.getString(R.string.most_liked);
|
2019-01-28 13:33:30 +01:00
|
|
|
case "conferences":
|
|
|
|
return c.getString(R.string.conferences);
|
2017-09-28 16:15:09 +02:00
|
|
|
default:
|
|
|
|
return kioskId;
|
|
|
|
}
|
|
|
|
}
|
2018-06-08 21:07:25 +02:00
|
|
|
|
2020-04-06 21:07:16 +02:00
|
|
|
public static int getKioskIcon(final String kioskId, final Context c) {
|
2020-03-31 19:20:15 +02:00
|
|
|
switch (kioskId) {
|
2018-06-08 21:07:25 +02:00
|
|
|
case "Trending":
|
|
|
|
case "Top 50":
|
|
|
|
case "New & hot":
|
2020-03-31 19:20:15 +02:00
|
|
|
case "conferences":
|
2020-03-31 09:36:35 +02:00
|
|
|
return ThemeHelper.resolveResourceIdFromAttr(c, R.attr.ic_kiosk_hot);
|
2018-12-29 18:36:39 +01:00
|
|
|
case "Local":
|
|
|
|
return ThemeHelper.resolveResourceIdFromAttr(c, R.attr.ic_kiosk_local);
|
|
|
|
case "Recently added":
|
|
|
|
return ThemeHelper.resolveResourceIdFromAttr(c, R.attr.ic_kiosk_recent);
|
2019-12-02 21:20:23 +01:00
|
|
|
case "Most liked":
|
2020-03-25 16:23:47 +01:00
|
|
|
return ThemeHelper.resolveResourceIdFromAttr(c, R.attr.ic_thumb_up);
|
2018-06-08 21:07:25 +02:00
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
2017-09-28 16:15:09 +02:00
|
|
|
}
|