Browse Source

override constructors

pull/54/head
Thodoris1999 6 years ago
parent
commit
e31227f62e
  1. 13
      app/src/main/java/gr/thmmy/mthmmy/utils/parsing/NetworkTask.java
  2. 21
      app/src/main/java/gr/thmmy/mthmmy/utils/parsing/NewParseTask.java

13
app/src/main/java/gr/thmmy/mthmmy/utils/parsing/NetworkTask.java

@ -15,6 +15,19 @@ public abstract class NetworkTask<T> extends ExternalAsyncTask<String, Parcel<T>
private OnParseTaskFinishedListener<T> onParseTaskFinishedListener;
public NetworkTask(OnParseTaskStartedListener onParseTaskStartedListener, OnParseTaskCancelledListener onParseTaskCancelledListener,
OnParseTaskFinishedListener<T> onParseTaskFinishedListener) {
super(onParseTaskStartedListener, onParseTaskCancelledListener, null);
this.onParseTaskFinishedListener = onParseTaskFinishedListener;
}
public NetworkTask(OnParseTaskStartedListener onParseTaskStartedListener, OnParseTaskFinishedListener<T> onParseTaskFinishedListener) {
super(onParseTaskStartedListener, null);
this.onParseTaskFinishedListener = onParseTaskFinishedListener;
}
public NetworkTask() {}
@Override
protected final Parcel<T> doInBackground(String... input) {
Request request = createRequest(input);

21
app/src/main/java/gr/thmmy/mthmmy/utils/parsing/NewParseTask.java

@ -2,12 +2,19 @@ package gr.thmmy.mthmmy.utils.parsing;
import org.jsoup.nodes.Document;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
public abstract class NewParseTask<T> extends NetworkTask<T> {
public NewParseTask(OnParseTaskStartedListener onParseTaskStartedListener, OnParseTaskCancelledListener onParseTaskCancelledListener,
OnParseTaskFinishedListener<T> onParseTaskFinishedListener) {
super(onParseTaskStartedListener, onParseTaskCancelledListener, onParseTaskFinishedListener);
}
public NewParseTask(OnParseTaskStartedListener onParseTaskStartedListener, OnParseTaskFinishedListener<T> onParseTaskFinishedListener) {
super(onParseTaskStartedListener, onParseTaskFinishedListener);
}
public NewParseTask() {}
@Override
final T performTask(Document document) throws ParseException {
try {
@ -17,11 +24,5 @@ public abstract class NewParseTask<T> extends NetworkTask<T> {
}
}
abstract Request createRequest(String... input);
abstract Response getResponse(Request request, OkHttpClient client);
abstract T parse (Document document);
abstract int getResultCode(Response response, T data);
}

Loading…
Cancel
Save