lvNumbers = new HashSet<>();
- String numbers = regex("| .*? (.*?) 0)
- lvNumbers.add(match2.group());
- }
-
- // Title
- //language=RegExp
- String title = regex("(.+?)", match.group());
-
- // Type
- //language=RegExp
- String type = regex(" | .*? (.*?) ", match.group());
-
- // Upgrade URI
- //language=RegExp
- String upgradeURI = regex(".+?", match.group());
-
- modules.addModule(semester, lvNumbers, title, instructs, type, upgradeURI);
- } catch (NoSuchFieldException e) {
- errorCallback.onError(new NetworkError(101102, -1, "Cannot parse module list!"));
- return;
- }
- }
- KVVModuleList.this.moduleList = modules;
- callback.onResponse(modules);
- }
- }, new Response.ErrorListener() {
- @Override
- public void onErrorResponse(VolleyError error) {
- errorCallback.onError(new NetworkError(101101, error.networkResponse.statusCode, "Cannot get module list!"));
- }
- });
- }
- }, new Response.ErrorListener() {
- @Override
- public void onErrorResponse(VolleyError error) {
- errorCallback.onError(new NetworkError(101100, error.networkResponse.statusCode, "Cannot get module list!"));
- }
- });
- }
- }, new Response.ErrorListener() {
- @Override
- public void onErrorResponse(VolleyError error) {
- errorCallback.onError(new NetworkError(101103, error.networkResponse.statusCode, "Cannot get module list!"));
- }
- });
- }
-*/
public void getModuleList(final NetworkCallback callback, final NetworkErrorCallback errorCallback) {
- get("https://kvv.imp.fu-berlin.de/direct/site.json", token.getCookies(), new Response.Listener() {
- @Override
- public void onResponse(Result response) {
- String body = response.getParsed();
- if (body == null) {
- errorCallback.onError(new NetworkError(101101, 403, "No module list retreived!"));
- return;
- }
- Modules modules = new Modules();
- try {
- JSONObject json = new JSONObject(body);
- JSONArray sites = json.getJSONArray("site_collection");
+ get("https://kvv.imp.fu-berlin.de/direct/site.json", token.getCookies(), response -> {
+ String body = response.getParsed();
+ if (body == null) {
+ errorCallback.onError(new NetworkError(101101, 403, "No module list retreived!"));
+ return;
+ }
+ Modules modules = new Modules();
+ try {
+ JSONObject json = new JSONObject(body);
+ JSONArray sites = json.getJSONArray("site_collection");
- for (int i = 0; i < sites.length(); i++) {
- JSONObject site = sites.getJSONObject(i);
- String semester = site.getJSONObject("props").getString("term_eid");
- HashSet lvNumbers = new HashSet<>();
- for (MatchResult matchResult : allMatches(Pattern.compile("[0-9]+"), site.getJSONObject("props").getString("kvv_lvnumbers"))) {
- lvNumbers.add(matchResult.group());
- }
- String title = site.getString("entityTitle");
- HashSet lecturers = new HashSet<>();
- for (String lecturer : site.getJSONObject("props").getString("kvv_lecturers").split("#")) {
- if (lecturer.length() > 2)
- lecturers.add(new Lecturer(lecturer));
- }
- String type = site.getJSONObject("props").getString("kvv_coursetype");
- String id = site.getString("id");
- modules.addModule(semester, lvNumbers, title, lecturers, type, id);
+ for (int i = 0; i < sites.length(); i++) {
+ JSONObject site = sites.getJSONObject(i);
+ String semester = site.getJSONObject("props").getString("term_eid");
+ HashSet lvNumbers = new HashSet<>();
+ for (MatchResult matchResult : Regex.allMatches("[0-9]+", site.getJSONObject("props").getString("kvv_lvnumbers"))) {
+ lvNumbers.add(matchResult.group());
}
- } catch (JSONException e) {
- errorCallback.onError(new NetworkError(101102, 403, "Cannot parse module list!"));
- return;
- } catch (NoSuchFieldException e) {
- errorCallback.onError(new NetworkError(101103, 403, "Cannot parse module list!"));
- return;
+ String title = site.getString("entityTitle");
+ HashSet lecturers = new HashSet<>();
+ for (String lecturer : site.getJSONObject("props").getString("kvv_lecturers").split("#")) {
+ if (lecturer.length() > 2)
+ lecturers.add(new Lecturer(lecturer));
+ }
+ String type = site.getJSONObject("props").getString("kvv_coursetype");
+ String description = site.getString("description");
+ description = new Source(description).getRenderer().toString();
+ String id = site.getString("id");
+ modules.addModule(semester, lvNumbers, title, lecturers, type, description, id);
}
- moduleList = modules;
- callback.onResponse(moduleList);
+ } catch (JSONException e) {
+ errorCallback.onError(new NetworkError(101102, 403, "Cannot parse module list!"));
+ return;
+ } catch (NoSuchFieldException e) {
+ errorCallback.onError(new NetworkError(101103, 403, "Cannot parse module list!"));
+ return;
}
- }, new Response.ErrorListener() {
- @Override
- public void onErrorResponse(VolleyError error) {
- errorCallback.onError(new NetworkError(101103, error.networkResponse.statusCode, "Cannot get module list!"));
+ moduleList = modules;
+ callback.onResponse(moduleList);
+ }, error -> errorCallback.onError(new NetworkError(101104, error.networkResponse.statusCode, "Cannot get module list!")));
+ }
+
+ public void getModule(int index, final NetworkCallback callback, final NetworkErrorCallback errorCallback) {
+ this.getModuleList(success -> {
+ callback.onResponse(success.get(index));
+ }, errorCallback);
+ }
+
+ public void getAnnouncements(Modules.Module module, final NetworkCallback callback, final NetworkErrorCallback errorCallback) {
+ queueModuleDetails.add(module.getID(), () -> {
+ if (module.announcements != null) {
+ callback.onResponse(module);
+ queueModuleDetails.next(module.getID());
+ return;
}
+ getAnnouncementsUpgrade(module.getID(), success -> {
+ module.announcements = success;
+ callback.onResponse(module);
+ queueModuleDetails.next(module.getID());
+ }, errorCallback);
});
}
-
-
- /*public void getModuleDetails(final int index, final NetworkCallback callback, final NetworkErrorCallback errorCallback) {
- queueModuleDetails.add(new AsyncQueue.AsyncQueueCallback() {
- @Override
- public void run() {
- if (moduleList == null) {
- KVVModuleList.this.getModuleList(new NetworkCallback() {
- @Override
- public void onResponse(@NonNull Modules success) {
- getModuleDetails(index, callback, errorCallback);
- queueModuleDetails.next();
- }
- }, queueModuleDetails.check(errorCallback));
- return;
- }
- final Modules.Module m = moduleList.get(index);
- if (m instanceof Modules.UpgradeModule) {
- callback.onResponse((Modules.UpgradeModule) m);
- queueModuleDetails.next();
- return;
- }
- upgradeModule((Modules.SimpleModule) m, new NetworkCallback() {
- @Override
- public void onResponse(@NonNull String success) {
- callback.onResponse(moduleList.upgradeItem(index, success));
- queueModuleDetails.next();
- }
- }, queueModuleDetails.check(errorCallback));
+ private void getAnnouncementsUpgrade(String ID, final NetworkCallback> callback, final NetworkErrorCallback errorCallback) {
+ log.d("SITE GET URL", String.format("https://kvv.imp.fu-berlin.de/direct/announcement/site/%s.json?n=999999&d=999999999", ID));
+ get(String.format("https://kvv.imp.fu-berlin.de/direct/announcement/site/%s.json?n=999999&d=999999999", ID), token.getCookies(), response -> {
+ String body = response.getParsed();
+ if (body == null) {
+ errorCallback.onError(new NetworkError(101201, 403, "No announcements retreived!"));
+ return;
}
- });
- }
+ ArrayList announcements = new ArrayList<>();
+ try {
+ JSONObject json = new JSONObject(body);
+ JSONArray sites = json.getJSONArray("announcement_collection");
- private void upgradeModule(Modules.SimpleModule module, final NetworkCallback callback, final NetworkErrorCallback errorCallback) {
- callback.onResponse("cool ID");
- }*/
-
-
-
-
-
-
-
- private String regex(String regex, String match) throws NoSuchFieldException {
- return regex(regex, match, 1);
- }
-
- private String regex(String regex, String match, int group) throws NoSuchFieldException {
- Pattern pattern = Pattern.compile(regex, Pattern.DOTALL);
- Matcher matcher = pattern.matcher(match);
- if (!matcher.find()) {
- throw new NoSuchFieldException();
- }
- return matcher.group(group);
- }
-
- private static Iterable allMatches(final Pattern p, final CharSequence input) {
- return new Iterable() {
- @NonNull
- public Iterator iterator() {
- return new Iterator() {
- // Use a matcher internally.
- final Matcher matcher = p.matcher(input);
- // Keep a match around that supports any interleaving of hasNext/next calls.
- MatchResult pending;
-
- public boolean hasNext() {
- // Lazily fill pending, and avoid calling find() multiple times if the
- // clients call hasNext() repeatedly before sampling via next().
- if (pending == null && matcher.find()) {
- pending = matcher.toMatchResult();
- }
- return pending != null;
- }
-
- public MatchResult next() {
- // Fill pending if necessary (as when clients call next() without
- // checking hasNext()), throw if not possible.
- if (!hasNext()) { throw new NoSuchElementException(); }
- // Consume pending so next call to hasNext() does a find().
- MatchResult next = pending;
- pending = null;
- return next;
- }
-
- /** Required to satisfy the interface, but unsupported. */
- public void remove() { throw new UnsupportedOperationException(); }
- };
+ for (int i = 0; i < sites.length(); i++) {
+ log.d("ANNOUNCEMENT FOUND!", i);
+ JSONObject site = sites.getJSONObject(i);
+ String id = site.getString("announcementId");
+ String title = site.getString("title");
+ String text = site.getString("body");
+ text = new Source(text).getRenderer().toString();
+ String createdBy = site.getString("createdByDisplayName");
+ long createdOn = site.getLong("createdOn");
+ announcements.add(new Announcement(id, title, text, createdBy, createdOn));
+ }
+ } catch (JSONException e) {
+ errorCallback.onError(new NetworkError(101202, 403, "Cannot parse announcements!"));
+ return;
}
- };
+ callback.onResponse(announcements);
+ }, error -> errorCallback.onError(new NetworkError(101203, error.networkResponse.statusCode, "Cannot get announcements!")));
}
}
diff --git a/app/src/main/java/de/sebse/fuplanner/services/KVV/Lecturer.java b/app/src/main/java/de/sebse/fuplanner/services/KVV/Lecturer.java
index e5da409..47da51a 100644
--- a/app/src/main/java/de/sebse/fuplanner/services/KVV/Lecturer.java
+++ b/app/src/main/java/de/sebse/fuplanner/services/KVV/Lecturer.java
@@ -8,7 +8,7 @@ class Lecturer {
private final String surname;
private final String mail;
- public Lecturer(String parsableString) throws NoSuchFieldException {
+ Lecturer(String parsableString) throws NoSuchFieldException {
Pattern pattern = Pattern.compile("([^|]*)\\|([^|]*)\\|([^|]*)\\|\\|", Pattern.DOTALL);
Matcher matcher = pattern.matcher(parsableString);
if (!matcher.find()) {
diff --git a/app/src/main/java/de/sebse/fuplanner/services/KVV/Modules.java b/app/src/main/java/de/sebse/fuplanner/services/KVV/Modules.java
index c8d6337..e06e95d 100644
--- a/app/src/main/java/de/sebse/fuplanner/services/KVV/Modules.java
+++ b/app/src/main/java/de/sebse/fuplanner/services/KVV/Modules.java
@@ -1,31 +1,105 @@
package de.sebse.fuplanner.services.KVV;
import android.support.annotation.NonNull;
+import android.support.v7.util.SortedList;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
-import de.sebse.fuplanner.tools.EventEmitter;
-import de.sebse.fuplanner.tools.Triplet;
+import de.sebse.fuplanner.tools.Compare;
+import de.sebse.fuplanner.tools.Regex;
+import de.sebse.fuplanner.tools.logging.Logger;
/**
* Created by sebastian on 29.10.17.
*/
public class Modules /*extends EventEmitter>>*/ implements Iterable {
- private final ArrayList list;
+ private final SortedList list;
+ private String latestSemester = null;
+ private Logger log = new Logger(this);
Modules() {
- this.list = new ArrayList<>();
+ this.list = new SortedList<>(Module.class, new SortedList.Callback() {
+ @Override
+ public int compare(Module o1, Module o2) {
+ return o1.semester.compareTo(o2.semester);
+ }
+
+ @Override
+ public void onChanged(int position, int count) {
+
+ }
+
+ @Override
+ public boolean areContentsTheSame(Module oldItem, Module newItem) {
+ return compare(oldItem, newItem) == 0;
+ }
+
+ @Override
+ public boolean areItemsTheSame(Module item1, Module item2) {
+ return item1.ID.equals(item2.ID);
+ }
+
+ @Override
+ public void onInserted(int position, int count) {
+
+ }
+
+ @Override
+ public void onRemoved(int position, int count) {
+
+ }
+
+ @Override
+ public void onMoved(int fromPosition, int toPosition) {
+
+ }
+ });
}
- Module addModule(String semester, HashSet lvNumber, String title, HashSet lecturer, String type, String ID) {
- Module m = new Module(semester, lvNumber, title, lecturer, type, ID);
+ Module addModule(String semester, HashSet lvNumber, String title, HashSet lecturer, String type, String description, String ID) {
+ Module m = new Module(semester, lvNumber, title, lecturer, type, description, ID);
this.list.add(m);
+ try {
+ setLatestSemester(m.semester);
+ } catch (NoSuchFieldException ignored) {
+ }
return m;
}
+ private void setLatestSemester(String semester) throws NoSuchFieldException {
+ if (compareSemester(this.latestSemester, semester) == Compare.LARGER)
+ this.latestSemester = semester;
+ }
+
+ private Compare compareSemester(String a, String b) throws NoSuchFieldException {
+ if (a == null && b == null)
+ return Compare.EQUAL;
+ if (a == null)
+ return Compare.LARGER;
+ if (b == null)
+ return Compare.SMALLER;
+
+ String s1type = Regex.regex("(SS|WS)", a);
+ int s1year = Integer.parseInt(Regex.regex("(SS|WS) ([0-9]{2})", a, 2));
+ String s2type = Regex.regex("(SS|WS)", b);
+ int s2year = Integer.parseInt(Regex.regex("(SS|WS) ([0-9]{2})", b, 2));
+
+ if (s1year == s2year) {
+ if (s1type.equals(s2type))
+ return Compare.EQUAL;
+ if (s1type.equals("SS"))
+ return Compare.SMALLER;
+ return Compare.LARGER;
+ }
+ if (s1year < s2year)
+ return Compare.LARGER;
+ return Compare.SMALLER;
+
+ }
+
@Override
public String toString() {
return this.list.toString();
@@ -35,15 +109,18 @@ public class Modules /*extends EventEmitter iterator() {
return new Iterator() {
- private final Iterator iter = Modules.this.list.iterator();
+ private int pos = -1;
@Override
public boolean hasNext() {
- return iter.hasNext();
+ return pos+1 < list.size();
}
@Override
public Module next() {
- return iter.next();
+ pos++;
+ if (pos < list.size())
+ return list.get(pos);
+ return null;
}
@Override
@@ -53,6 +130,47 @@ public class Modules /*extends EventEmitter latestSemesterIterator() {
+ return new Iterator() {
+ private int index = -1;
+ private int next = -1;
+ @Override
+ public boolean hasNext() {
+ if (index==next)
+ predict();
+ return next != -1;
+ }
+
+ @Override
+ public Module next() {
+ if (index == next)
+ predict();
+ if (next == -1)
+ return null;
+ index = next;
+ return list.get(index);
+ }
+
+ @Override
+ public void remove() {
+ throw new UnsupportedOperationException("no changes allowed");
+ }
+
+ private void predict() {
+ int size = list.size();
+ do {
+ next++;
+ } while (next < size && !accept(list.get(next)));
+ if (next == size)
+ next = -1;
+ }
+
+ private boolean accept(Module ob){
+ return ob.semester.equals(latestSemester);
+ }
+ };
+ }
+
public int size() {
return this.list.size();
}
@@ -67,14 +185,16 @@ public class Modules /*extends EventEmitter lecturer;
public final String type;
+ public final String description;
private final String ID;
+ public ArrayList announcements;
/*private Module() {
this(null, null, null, null, null);
throw new AssertionError("Do not use this constructor!");
}*/
- private Module(String semester, HashSet lvNumber, String title, HashSet lecturer, String type, String ID) {
+ private Module(String semester, HashSet lvNumber, String title, HashSet lecturer, String type, String description, String ID) {
semester = semester.replace("Sommersemester", "SS").replace("Wintersemester", "WS");
semester = semester.replaceAll("[0-9]{2}([0-9]{2})", "$1");
@@ -83,9 +203,14 @@ public class Modules /*extends EventEmitter mQueue = new LinkedList<>();
- private boolean mRunning = false;
+ private HashMap> mQueues = new HashMap<>();
+ private HashMap mRunnings = new HashMap<>();
- public void add(AsyncQueueCallback callback) {
- if (mRunning)
- mQueue.addLast(callback);
+ public void add(String hash, AsyncQueueCallback callback) {
+ if (isRunning(hash))
+ getQueue(hash).addLast(callback);
else {
- mRunning = true;
+ setRunning(hash, true);
callback.run();
}
}
- public void next() {
- AsyncQueueCallback callback = mQueue.pollFirst();
+ public void next(String hash) {
+ AsyncQueueCallback callback = getQueue(hash).pollFirst();
if (callback == null)
- mRunning = false;
+ setRunning(hash, false);
else
callback.run();
}
@@ -33,25 +34,33 @@ public class AsyncQueue {
void run();
}
- public NetworkErrorCallback check(final NetworkErrorCallback value) {
- return new NetworkErrorCallback() {
- @Override
- public void onError(NetworkError error) {
- value.onError(error);
- next();
- }
+ public NetworkErrorCallback check(String hash, NetworkErrorCallback value) {
+ return error -> {
+ value.onError(error);
+ next(hash);
};
}
- public NetworkCallback check(final NetworkCallback value) {
- return new NetworkCallback() {
- @Override
- public void onResponse(@NonNull T success) {
- value.onResponse(success);
- next();
- }
+ public NetworkCallback check(String hash, NetworkCallback value) {
+ return success -> {
+ value.onResponse(success);
+ next(hash);
};
}
+
+ private boolean isRunning(String hash) {
+ return mRunnings.containsKey(hash) && mRunnings.get(hash);
+ }
+
+ private void setRunning(String hash, boolean value) {
+ mRunnings.put(hash, value);
+ }
+
+ private LinkedList getQueue(String hash) {
+ if (mQueues.get(hash) == null)
+ mQueues.put(hash, new LinkedList<>());
+ return mQueues.get(hash);
+ }
}
/*public class AsyncQueue {
diff --git a/app/src/main/java/de/sebse/fuplanner/tools/Compare.java b/app/src/main/java/de/sebse/fuplanner/tools/Compare.java
new file mode 100644
index 0000000..c46e0c0
--- /dev/null
+++ b/app/src/main/java/de/sebse/fuplanner/tools/Compare.java
@@ -0,0 +1,7 @@
+package de.sebse.fuplanner.tools;
+
+public enum Compare {
+ SMALLER,
+ EQUAL,
+ LARGER
+}
diff --git a/app/src/main/java/de/sebse/fuplanner/tools/Conversion.java b/app/src/main/java/de/sebse/fuplanner/tools/Conversion.java
new file mode 100644
index 0000000..c217666
--- /dev/null
+++ b/app/src/main/java/de/sebse/fuplanner/tools/Conversion.java
@@ -0,0 +1,35 @@
+package de.sebse.fuplanner.tools;
+
+import android.annotation.TargetApi;
+import android.os.Build;
+import android.text.format.DateFormat;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+
+public class Conversion {
+
+
+
+ public static String getModifiedDate(long modified) {
+ return getModifiedDate(Locale.getDefault(), modified);
+ }
+
+ public static String getModifiedDate(Locale locale, long modified) {
+ SimpleDateFormat dateFormat = null;
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
+ dateFormat = new SimpleDateFormat(getDateFormat(locale));
+ } else {
+ dateFormat = new SimpleDateFormat("MMM/dd/yyyy hh:mm:ss aa");
+ }
+
+ return dateFormat.format(new Date(modified));
+ }
+
+ @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
+ public static String getDateFormat(Locale locale) {
+ return DateFormat.getBestDateTimePattern(locale, "MM/dd/yyyy hh:mm:ss aa");
+ }
+}
diff --git a/app/src/main/java/de/sebse/fuplanner/tools/Regex.java b/app/src/main/java/de/sebse/fuplanner/tools/Regex.java
new file mode 100644
index 0000000..046da07
--- /dev/null
+++ b/app/src/main/java/de/sebse/fuplanner/tools/Regex.java
@@ -0,0 +1,63 @@
+package de.sebse.fuplanner.tools;
+
+import android.support.annotation.NonNull;
+
+import org.intellij.lang.annotations.Language;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import java.util.regex.MatchResult;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class Regex {
+ public static String regex(@Language("Regexp") String regex, String match) throws NoSuchFieldException {
+ return regex(regex, match, 1);
+ }
+
+ public static String regex(@Language("Regexp") String regex, String match, int group) throws NoSuchFieldException {
+ Pattern pattern = Pattern.compile(regex, Pattern.DOTALL);
+ Matcher matcher = pattern.matcher(match);
+ if (!matcher.find()) {
+ throw new NoSuchFieldException();
+ }
+ return matcher.group(group);
+ }
+
+ public static Iterable allMatches(@Language("Regexp") String regex, final CharSequence input) {
+ final Pattern pattern = Pattern.compile(regex, Pattern.DOTALL);
+ return new Iterable() {
+ @NonNull
+ public Iterator iterator() {
+ return new Iterator() {
+ // Use a matcher internally.
+ final Matcher matcher = pattern.matcher(input);
+ // Keep a match around that supports any interleaving of hasNext/next calls.
+ MatchResult pending;
+
+ public boolean hasNext() {
+ // Lazily fill pending, and avoid calling find() multiple times if the
+ // clients call hasNext() repeatedly before sampling via next().
+ if (pending == null && matcher.find()) {
+ pending = matcher.toMatchResult();
+ }
+ return pending != null;
+ }
+
+ public MatchResult next() {
+ // Fill pending if necessary (as when clients call next() without
+ // checking hasNext()), throw if not possible.
+ if (!hasNext()) { throw new NoSuchElementException(); }
+ // Consume pending so next call to hasNext() does a find().
+ MatchResult next = pending;
+ pending = null;
+ return next;
+ }
+
+ /** Required to satisfy the interface, but unsupported. */
+ public void remove() { throw new UnsupportedOperationException(); }
+ };
+ }
+ };
+ }
+}
diff --git a/app/src/main/java/de/sebse/fuplanner/tools/logging/Logger.java b/app/src/main/java/de/sebse/fuplanner/tools/logging/Logger.java
index cf5f08e..e1361e4 100644
--- a/app/src/main/java/de/sebse/fuplanner/tools/logging/Logger.java
+++ b/app/src/main/java/de/sebse/fuplanner/tools/logging/Logger.java
@@ -26,4 +26,17 @@ public class Logger {
string.append("null ");
return string.toString();
}
+
+
+
+ private void reduce(String content) {
+ if (content==null) {
+ Log.d(tag, "null");
+ } else if (content.length() > 4000) {
+ Log.d(tag, content.substring(0, 4000));
+ reduce(content.substring(4000));
+ } else {
+ Log.d(tag, content);
+ }
+ }
}
diff --git a/app/src/main/java/de/sebse/fuplanner/tools/network/HTTPService.java b/app/src/main/java/de/sebse/fuplanner/tools/network/HTTPService.java
index cf439c1..8f7ffc6 100644
--- a/app/src/main/java/de/sebse/fuplanner/tools/network/HTTPService.java
+++ b/app/src/main/java/de/sebse/fuplanner/tools/network/HTTPService.java
@@ -25,8 +25,7 @@ import de.sebse.fuplanner.tools.logging.Logger;
*/
public class HTTPService {
- protected RequestQueue requestQueue;
- private boolean followRedirects;
+ private RequestQueue requestQueue;
protected Logger log = new Logger(this);
public HTTPService(Context context) {
@@ -34,7 +33,6 @@ public class HTTPService {
}
public HTTPService(Context context, boolean followRedirects) {
- this.followRedirects = followRedirects;
requestQueue = Volley.newRequestQueue(context, new BetterHurlStack(followRedirects));
}
@@ -89,7 +87,7 @@ public class HTTPService {
}
@Override
- public byte[] getBody() throws AuthFailureError {
+ public byte[] getBody() {
if (body==null) {
return null;
}
@@ -152,15 +150,4 @@ public class HTTPService {
};
requestQueue.add(request);
}
-
- private static void largeLog(String tag, String content) {
- if (content==null) {
- Log.d(tag, "null");
- } else if (content.length() > 4000) {
- Log.d(tag, content.substring(0, 4000));
- largeLog(tag, content.substring(4000));
- } else {
- Log.d(tag, content);
- }
- }
}
diff --git a/app/src/main/java/de/sebse/fuplanner/tools/ui/CustomViewHolder.java b/app/src/main/java/de/sebse/fuplanner/tools/ui/CustomViewHolder.java
new file mode 100644
index 0000000..8a7a0fb
--- /dev/null
+++ b/app/src/main/java/de/sebse/fuplanner/tools/ui/CustomViewHolder.java
@@ -0,0 +1,13 @@
+package de.sebse.fuplanner.tools.ui;
+
+import android.support.v7.widget.RecyclerView;
+import android.view.View;
+
+public class CustomViewHolder extends RecyclerView.ViewHolder {
+ public final View mView;
+
+ public CustomViewHolder(View view) {
+ super(view);
+ mView = view;
+ }
+}
diff --git a/app/src/main/res/layout/fragment_mod_detail_overview.xml b/app/src/main/res/layout/fragment_mod_detail_overview.xml
index 6a9e612..8382706 100644
--- a/app/src/main/res/layout/fragment_mod_detail_overview.xml
+++ b/app/src/main/res/layout/fragment_mod_detail_overview.xml
@@ -1,14 +1,13 @@
-
-
-
-
-
-
\ No newline at end of file
+ android:layout_marginLeft="16dp"
+ android:layout_marginRight="16dp"
+ app:layoutManager="android.support.v7.widget.LinearLayoutManager"
+ tools:context=".fragments.moddetails.ModDetailOverviewFragment"
+ tools:listitem="@layout/list_all_caption" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/list_all_caption.xml b/app/src/main/res/layout/list_all_caption.xml
new file mode 100644
index 0000000..54c6200
--- /dev/null
+++ b/app/src/main/res/layout/list_all_caption.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
diff --git a/app/src/main/res/layout/list_moddetails_announcements.xml b/app/src/main/res/layout/list_moddetails_announcements.xml
new file mode 100644
index 0000000..255379d
--- /dev/null
+++ b/app/src/main/res/layout/list_moddetails_announcements.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/list_moddetails_description.xml b/app/src/main/res/layout/list_moddetails_description.xml
new file mode 100644
index 0000000..c740a86
--- /dev/null
+++ b/app/src/main/res/layout/list_moddetails_description.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 604a10c..56cf822 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -10,4 +10,7 @@
Hello blank fragment
Overview
Announcements
+ Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
+ Description
+ Announcements (%1$d)
|