Tiny News fix up
This commit is contained in:
@@ -16,6 +16,7 @@ import de.sebse.fuplanner.tools.UtilsDate;
|
||||
import de.sebse.fuplanner.tools.network.NetworkCallback;
|
||||
import de.sebse.fuplanner.tools.network.NetworkError;
|
||||
import de.sebse.fuplanner.tools.network.NetworkErrorCallback;
|
||||
import de.sebse.fuplanner.tools.types.News;
|
||||
import de.sebse.fuplanner.tools.types.NewsList;
|
||||
|
||||
public class NewsManager {
|
||||
@@ -52,21 +53,23 @@ public class NewsManager {
|
||||
|
||||
for (int i = news.length() - 1; i >= 0; i--) {
|
||||
try {
|
||||
String title = news.getJSONObject(i).optString("title_" + language, null);
|
||||
String title = news.getJSONObject(i).getString("title_" + language);
|
||||
//noinspection ConstantConditions
|
||||
if (title == null)
|
||||
title = news.getJSONObject(i).getString("title");
|
||||
String categoryString = news.getJSONObject(i).getString("category");
|
||||
int category;
|
||||
if (categoryString.equals("CATEGORY_TRICKS"))
|
||||
category = de.sebse.fuplanner.tools.types.News.CATEGORY_TRICKS;
|
||||
category = News.CATEGORY_TRICKS;
|
||||
else
|
||||
category = de.sebse.fuplanner.tools.types.News.CATEGORY_UPDATE;
|
||||
category = News.CATEGORY_UPDATE;
|
||||
String dateString = news.getJSONObject(i).getString("date");
|
||||
long date = UtilsDate.stringToMillis(dateString, "dd.MM.yyyy");
|
||||
String text = news.getJSONObject(i).optString("text_" + language, null);
|
||||
String text = news.getJSONObject(i).getString("title_" + language);
|
||||
//noinspection ConstantConditions
|
||||
if (text == null)
|
||||
text = news.getJSONObject(i).getString("text");
|
||||
de.sebse.fuplanner.tools.types.News event = new de.sebse.fuplanner.tools.types.News(title, category, date, text);
|
||||
News event = new News(title, category, date, text);
|
||||
dates.add(event);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
"date": "18.11.2018",
|
||||
"category": "CATEGORY_UPDATE",
|
||||
"text": "Currently, the data is not automatically synchronized with the KVV. You can trigger a manual sync by simply dragging the view down. An exception is the timetable. Here you can update with the three points in the top right.",
|
||||
"text_de": "Derzeit werden die Daten noch nicht automatisch mit dem KVV synchronisiert. Eine manuelle Synchronisierung kannst Du auslösen, indem Du die Ansicht einfach nach unten ziehst. Eine Ausnahme bildet der Stundenplan. Hier kannst Du über die drei Punkte oben rechts aktualisieren."
|
||||
"text_de": "Derzeit werden die Daten nicht automatisch mit dem KVV synchronisiert. Eine manuelle Synchronisierung kannst Du auslösen, indem Du die Ansicht einfach nach unten ziehst. Eine Ausnahme bildet der Stundenplan. Hier kannst Du über die drei Punkte oben rechts aktualisieren."
|
||||
},
|
||||
{
|
||||
"title": "Resources",
|
||||
|
||||
Reference in New Issue
Block a user