URLs bei Ankündigunen werden jetzt angezeigt
This commit is contained in:
@@ -5,6 +5,8 @@ import android.view.View;
|
|||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.BaseExpandableListAdapter;
|
import android.widget.BaseExpandableListAdapter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import de.sebse.fuplanner.R;
|
import de.sebse.fuplanner.R;
|
||||||
import de.sebse.fuplanner.services.KVV.types.Announcement;
|
import de.sebse.fuplanner.services.KVV.types.Announcement;
|
||||||
import de.sebse.fuplanner.services.KVV.types.Modules;
|
import de.sebse.fuplanner.services.KVV.types.Modules;
|
||||||
@@ -18,7 +20,12 @@ class ModDetailAnnounceAdapter extends BaseExpandableListAdapter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getChild(int groupPosition, int childPosititon) {
|
public String getChild(int groupPosition, int childPosititon) {
|
||||||
return this.getGroup(groupPosition).getBody();
|
String s= this.getGroup(groupPosition).getBody();
|
||||||
|
ArrayList<String> urls = this.getGroup(groupPosition).getUrls();
|
||||||
|
for (int j =0; j<urls.size(); j++){
|
||||||
|
s += urls.get(j);
|
||||||
|
}
|
||||||
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -225,8 +225,19 @@ class KVVModuleList extends HTTPService {
|
|||||||
text = new Source(text).getRenderer().toString();
|
text = new Source(text).getRenderer().toString();
|
||||||
String createdBy = site.getString("createdByDisplayName");
|
String createdBy = site.getString("createdByDisplayName");
|
||||||
long createdOn = site.getLong("createdOn");
|
long createdOn = site.getLong("createdOn");
|
||||||
announcements.add(new Announcement(id, title, text, createdBy, createdOn));
|
|
||||||
|
|
||||||
|
|
||||||
|
//PDFs links rausziehen
|
||||||
|
JSONArray attachments = site.getJSONArray("attachments");
|
||||||
|
ArrayList<String> urls = new ArrayList<>();
|
||||||
|
for (int j =0; j<attachments.length(); j++){
|
||||||
|
urls.add(attachments.getJSONObject(j).optString("url",null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
announcements.add(new Announcement(id, title, text, createdBy, createdOn, urls));
|
||||||
|
}
|
||||||
|
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
errorCallback.onError(new NetworkError(101202, 403, "Cannot parse announcements!"));
|
errorCallback.onError(new NetworkError(101202, 403, "Cannot parse announcements!"));
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package de.sebse.fuplanner.services.KVV.types;
|
package de.sebse.fuplanner.services.KVV.types;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class Announcement implements Serializable {
|
public class Announcement implements Serializable {
|
||||||
private final String id;
|
private final String id;
|
||||||
@@ -8,14 +9,20 @@ public class Announcement implements Serializable {
|
|||||||
private final String body;
|
private final String body;
|
||||||
private final String createdBy;
|
private final String createdBy;
|
||||||
private final long createdOn;
|
private final long createdOn;
|
||||||
|
private final ArrayList<String> urls;
|
||||||
|
|
||||||
public Announcement(String id, String title, String body, String createdBy, long createdOn) {
|
public Announcement(String id, String title, String body, String createdBy, long createdOn, ArrayList<String> urls) {
|
||||||
|
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.body = body;
|
this.body = body;
|
||||||
this.createdBy = createdBy;
|
this.createdBy = createdBy;
|
||||||
this.createdOn = createdOn;
|
this.createdOn = createdOn;
|
||||||
|
this.urls = urls;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<String> getUrls() {
|
||||||
|
return urls;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
@@ -44,6 +51,7 @@ public class Announcement implements Serializable {
|
|||||||
"\nTitle: "+getTitle()+
|
"\nTitle: "+getTitle()+
|
||||||
"\nBody length: "+getBody().length()+
|
"\nBody length: "+getBody().length()+
|
||||||
"\nCreated by: "+getCreatedBy()+
|
"\nCreated by: "+getCreatedBy()+
|
||||||
"\nCreated on: "+getCreatedOn();
|
"\nCreated on: "+getCreatedOn()+
|
||||||
|
"\nURLs: "+getUrls().toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user