From 08760618d11f52b9f9ed92d528a2b6f903367c23 Mon Sep 17 00:00:00 2001 From: Martin Fietz Date: Fri, 22 Apr 2016 14:29:32 +0200 Subject: [PATCH 1/2] Address potential performance issue --- .../de/danoeh/antennapod/activity/FeedInfoActivity.java | 6 +++++- .../gpoddernet/GpodnetAuthenticationActivity.java | 9 +++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java index 805d82cf9..d4356719e 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java @@ -239,7 +239,11 @@ public class FeedInfoActivity extends ActionBarActivity { } } }; - loadTask.execute(feedId); + if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.GINGERBREAD_MR1) { + loadTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, feedId); + } else { + loadTask.execute(feedId); + } } diff --git a/app/src/main/java/de/danoeh/antennapod/activity/gpoddernet/GpodnetAuthenticationActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/gpoddernet/GpodnetAuthenticationActivity.java index 738fefb24..cdc31adb4 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/gpoddernet/GpodnetAuthenticationActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/gpoddernet/GpodnetAuthenticationActivity.java @@ -121,7 +121,7 @@ public class GpodnetAuthenticationActivity extends ActionBarActivity { final String passwordStr = password.getText().toString(); if (BuildConfig.DEBUG) Log.d(TAG, "Checking login credentials"); - new AsyncTask() { + AsyncTask authTask = new AsyncTask() { volatile Exception exception; @@ -160,7 +160,12 @@ public class GpodnetAuthenticationActivity extends ActionBarActivity { } return null; } - }.execute(service); + }; + if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.GINGERBREAD_MR1) { + authTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, service); + } else { + authTask.execute(); + } } }); } From 8e1a3474980c76ba280c1ecd288285b02797decc Mon Sep 17 00:00:00 2001 From: Martin Fietz Date: Fri, 22 Apr 2016 14:29:45 +0200 Subject: [PATCH 2/2] Display error more nicely --- .../activity/gpoddernet/GpodnetAuthenticationActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/de/danoeh/antennapod/activity/gpoddernet/GpodnetAuthenticationActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/gpoddernet/GpodnetAuthenticationActivity.java index cdc31adb4..d46a3d6c2 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/gpoddernet/GpodnetAuthenticationActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/gpoddernet/GpodnetAuthenticationActivity.java @@ -143,7 +143,7 @@ public class GpodnetAuthenticationActivity extends ActionBarActivity { if (exception == null) { advance(); } else { - txtvError.setText(exception.getMessage()); + txtvError.setText(exception.getCause().getMessage()); txtvError.setVisibility(View.VISIBLE); } }