From 08760618d11f52b9f9ed92d528a2b6f903367c23 Mon Sep 17 00:00:00 2001 From: Martin Fietz Date: Fri, 22 Apr 2016 14:29:32 +0200 Subject: [PATCH] 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(); + } } }); }