Browse Source

fix variable and method scopes

pull/54/head
Thodoris1999 6 years ago
parent
commit
4b79360ad1
  1. 6
      app/src/main/java/gr/thmmy/mthmmy/utils/parsing/ExternalAsyncTask.java
  2. 10
      app/src/main/java/gr/thmmy/mthmmy/utils/parsing/NetworkTask.java
  3. 4
      app/src/main/java/gr/thmmy/mthmmy/utils/parsing/NewParseTask.java

6
app/src/main/java/gr/thmmy/mthmmy/utils/parsing/ExternalAsyncTask.java

@ -4,9 +4,9 @@ import android.os.AsyncTask;
public abstract class ExternalAsyncTask<U, V> extends AsyncTask<U, Void, V> {
private OnParseTaskStartedListener onParseTaskStartedListener;
private OnParseTaskCancelledListener onParseTaskCancelledListener;
private OnParseTaskFinishedListener<V> onParseTaskFinishedListener;
protected OnParseTaskStartedListener onParseTaskStartedListener;
protected OnParseTaskCancelledListener onParseTaskCancelledListener;
protected OnParseTaskFinishedListener<V> onParseTaskFinishedListener;
@Override
protected void onPreExecute() {

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

@ -13,7 +13,7 @@ import timber.log.Timber;
public abstract class NetworkTask<T> extends ExternalAsyncTask<String, Parcel<T>> {
private OnParseTaskFinishedListener<T> onParseTaskFinishedListener;
protected OnParseTaskFinishedListener<T> onParseTaskFinishedListener;
public NetworkTask(OnParseTaskStartedListener onParseTaskStartedListener, OnParseTaskCancelledListener onParseTaskCancelledListener,
OnParseTaskFinishedListener<T> onParseTaskFinishedListener) {
@ -60,13 +60,13 @@ public abstract class NetworkTask<T> extends ExternalAsyncTask<String, Parcel<T>
super.onPostExecute(tParcel);
}
abstract Request createRequest(String... input);
protected abstract Request createRequest(String... input);
abstract Response getResponse(Request request, OkHttpClient client);
protected abstract Response getResponse(Request request, OkHttpClient client);
abstract T performTask(Document document) throws ParseException;
protected abstract T performTask(Document document) throws ParseException;
abstract int getResultCode(Response response, T data);
protected abstract int getResultCode(Response response, T data);
public void setOnParseTaskFinishedListener(OnParseTaskFinishedListener<T> onParseTaskFinishedListener) {
this.onParseTaskFinishedListener = onParseTaskFinishedListener;

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

@ -16,7 +16,7 @@ public abstract class NewParseTask<T> extends NetworkTask<T> {
public NewParseTask() {}
@Override
final T performTask(Document document) throws ParseException {
protected final T performTask(Document document) throws ParseException {
try {
return parse(document);
} catch (Exception e) {
@ -24,5 +24,5 @@ public abstract class NewParseTask<T> extends NetworkTask<T> {
}
}
abstract T parse (Document document);
protected abstract T parse (Document document);
}

Loading…
Cancel
Save