Browse Source

fixes

pull/54/head
Thodoris1999 6 years ago
parent
commit
bb7537f65a
  1. 24
      app/src/main/java/gr/thmmy/mthmmy/utils/parsing/NewParseTask.java

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

@ -6,7 +6,7 @@ public abstract class NewParseTask<U, V> extends AsyncTask<U, Void, V> {
private OnParseTaskStartedListener onParseTaskStartedListener; private OnParseTaskStartedListener onParseTaskStartedListener;
private OnParseTaskCancelledListener onParseTaskCancelledListener; private OnParseTaskCancelledListener onParseTaskCancelledListener;
private OnParseTaskFinishedListener onParseTaskFinishedListener; private OnParseTaskFinishedListener<V> onParseTaskFinishedListener;
@Override @Override
protected void onPreExecute() { protected void onPreExecute() {
@ -35,37 +35,25 @@ public abstract class NewParseTask<U, V> extends AsyncTask<U, Void, V> {
@Override @Override
protected void onPostExecute(V v) { protected void onPostExecute(V v) {
if (onParseTaskFinishedListener != null) if (onParseTaskFinishedListener != null)
onParseTaskFinishedListener.onParseFinish(); onParseTaskFinishedListener.onParseFinish(v);
else else
super.onPostExecute(v); super.onPostExecute(v);
} }
public NewParseTask(OnParseTaskStartedListener onParseTaskStartedListener, OnParseTaskCancelledListener onParseTaskCancelledListener, public NewParseTask(OnParseTaskStartedListener onParseTaskStartedListener, OnParseTaskCancelledListener onParseTaskCancelledListener,
OnParseTaskFinishedListener onParseTaskFinishedListener) { OnParseTaskFinishedListener<V> onParseTaskFinishedListener) {
this.onParseTaskStartedListener = onParseTaskStartedListener; this.onParseTaskStartedListener = onParseTaskStartedListener;
this.onParseTaskCancelledListener = onParseTaskCancelledListener; this.onParseTaskCancelledListener = onParseTaskCancelledListener;
this.onParseTaskFinishedListener = onParseTaskFinishedListener; this.onParseTaskFinishedListener = onParseTaskFinishedListener;
} }
public NewParseTask(OnParseTaskStartedListener onParseTaskStartedListener, OnParseTaskFinishedListener onParseTaskFinishedListener) { public NewParseTask(OnParseTaskStartedListener onParseTaskStartedListener, OnParseTaskFinishedListener<V> onParseTaskFinishedListener) {
this.onParseTaskStartedListener = onParseTaskStartedListener; this.onParseTaskStartedListener = onParseTaskStartedListener;
this.onParseTaskFinishedListener = onParseTaskFinishedListener; this.onParseTaskFinishedListener = onParseTaskFinishedListener;
} }
public NewParseTask() { } public NewParseTask() { }
public void setOnParseTaskStartedListener(OnParseTaskStartedListener onParseTaskStartedListener) {
this.onParseTaskStartedListener = onParseTaskStartedListener;
}
public void setOnParseTaskCancelledListener(OnParseTaskCancelledListener onParseTaskCancelledListener) {
this.onParseTaskCancelledListener = onParseTaskCancelledListener;
}
public void setOnParseTaskFinishedListener(OnParseTaskFinishedListener onParseTaskFinishedListener) {
this.onParseTaskFinishedListener = onParseTaskFinishedListener;
}
public interface OnParseTaskStartedListener { public interface OnParseTaskStartedListener {
void onParseStart(); void onParseStart();
} }
@ -74,7 +62,7 @@ public abstract class NewParseTask<U, V> extends AsyncTask<U, Void, V> {
void onParseCancel(); void onParseCancel();
} }
public interface OnParseTaskFinishedListener { public interface OnParseTaskFinishedListener<V> {
void onParseFinish(); void onParseFinish(V result);
} }
} }

Loading…
Cancel
Save