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> { public abstract class ExternalAsyncTask<U, V> extends AsyncTask<U, Void, V> {
private OnParseTaskStartedListener onParseTaskStartedListener; protected OnParseTaskStartedListener onParseTaskStartedListener;
private OnParseTaskCancelledListener onParseTaskCancelledListener; protected OnParseTaskCancelledListener onParseTaskCancelledListener;
private OnParseTaskFinishedListener<V> onParseTaskFinishedListener; protected OnParseTaskFinishedListener<V> onParseTaskFinishedListener;
@Override @Override
protected void onPreExecute() { 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>> { public abstract class NetworkTask<T> extends ExternalAsyncTask<String, Parcel<T>> {
private OnParseTaskFinishedListener<T> onParseTaskFinishedListener; protected OnParseTaskFinishedListener<T> onParseTaskFinishedListener;
public NetworkTask(OnParseTaskStartedListener onParseTaskStartedListener, OnParseTaskCancelledListener onParseTaskCancelledListener, public NetworkTask(OnParseTaskStartedListener onParseTaskStartedListener, OnParseTaskCancelledListener onParseTaskCancelledListener,
OnParseTaskFinishedListener<T> onParseTaskFinishedListener) { OnParseTaskFinishedListener<T> onParseTaskFinishedListener) {
@ -60,13 +60,13 @@ public abstract class NetworkTask<T> extends ExternalAsyncTask<String, Parcel<T>
super.onPostExecute(tParcel); 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) { public void setOnParseTaskFinishedListener(OnParseTaskFinishedListener<T> onParseTaskFinishedListener) {
this.onParseTaskFinishedListener = 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() {} public NewParseTask() {}
@Override @Override
final T performTask(Document document) throws ParseException { protected final T performTask(Document document) throws ParseException {
try { try {
return parse(document); return parse(document);
} catch (Exception e) { } 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