From 391e1a7d83ac28efbb79b997fd577eff16cb6d29 Mon Sep 17 00:00:00 2001 From: lado Date: Wed, 26 Oct 2011 13:03:43 +0200 Subject: refactor --- .../bjusystems/vdrmanager/utils/svdrp/SvdrpAsyncTask.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpAsyncTask.java b/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpAsyncTask.java index 7dc0097..fd4c63b 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpAsyncTask.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpAsyncTask.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; import android.os.AsyncTask; +import android.util.Log; public class SvdrpAsyncTask> extends AsyncTask @@ -34,13 +35,13 @@ public class SvdrpAsyncTask> try { client.run(); } catch (final SvdrpException e) { - publishProgress(null, null, e); + publishProgress(e); } return null; } public void svdrpEvent(final SvdrpEvent event, final Result result) { - publishProgress(event, result, null); + publishProgress(event, result); } @SuppressWarnings("unchecked") @@ -48,14 +49,16 @@ public class SvdrpAsyncTask> protected void onProgressUpdate(final Object... values) { super.onProgressUpdate(values); - if (values[2] == null) { + if (values.length == 2) { for(final SvdrpAsyncListener listener : listeners) { listener.svdrpEvent((SvdrpEvent)values[0], (Result)values[1]); } - } else { + } else if(values.length == 1) { for(final SvdrpAsyncListener listener : listeners) { - listener.svdrpException((SvdrpException)values[2]); + listener.svdrpException((SvdrpException)values[0]); } + } else { + Log.w(toString(), "Unknonw count of argument in onProgressUpdate"); } } } -- cgit v1.2.3