From 9d4ebbd3630f79de914c4efd42c376948a4ac065 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Fri, 19 Aug 2016 18:26:14 +0300 Subject: [PATCH] Fix osm live --- .../net/osmand/plus/liveupdates/LiveUpdatesFragment.java | 7 ++++++- .../src/net/osmand/plus/liveupdates/OsmLiveActivity.java | 6 ++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java index 24d8d2ce38..68f1c3aaff 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java @@ -10,6 +10,7 @@ import android.content.res.Resources; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.AsyncTask; +import android.os.Build; import android.os.Bundle; import android.support.annotation.DrawableRes; import android.support.annotation.NonNull; @@ -152,7 +153,11 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppList }); } - loadLocalIndexesTask = new LoadLocalIndexTask(adapter, this).execute(); + if(Build.VERSION.SDK_INT >= 11) { + loadLocalIndexesTask = new LoadLocalIndexTask(adapter, this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + } else { + loadLocalIndexesTask = new LoadLocalIndexTask(adapter, this).execute(); + } return view; } diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/OsmLiveActivity.java b/OsmAnd/src/net/osmand/plus/liveupdates/OsmLiveActivity.java index 451fb5099d..1339312aa0 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/OsmLiveActivity.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/OsmLiveActivity.java @@ -105,10 +105,8 @@ public class OsmLiveActivity extends AbstractDownloadActivity implements Downloa } public static class LiveUpdatesFragmentPagerAdapter extends FragmentPagerAdapter { - private final Fragment[] fragments = new Fragment[]{new LiveUpdatesFragment(), - new ReportsFragment()}; - private static final int[] titleIds = new int[]{LiveUpdatesFragment.TITLE, - ReportsFragment.TITLE}; + private final Fragment[] fragments = new Fragment[] { new LiveUpdatesFragment(), new ReportsFragment() }; + private static final int[] titleIds = new int[] { LiveUpdatesFragment.TITLE, ReportsFragment.TITLE }; private final String[] titles; public LiveUpdatesFragmentPagerAdapter(FragmentManager fm, Resources res) {