Fix osm live

This commit is contained in:
Victor Shcherb 2016-08-19 18:26:14 +03:00
parent e6d14c7f35
commit 9d4ebbd363
2 changed files with 8 additions and 5 deletions

View file

@ -10,6 +10,7 @@ import android.content.res.Resources;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.DrawableRes; import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull; 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; return view;
} }

View file

@ -105,10 +105,8 @@ public class OsmLiveActivity extends AbstractDownloadActivity implements Downloa
} }
public static class LiveUpdatesFragmentPagerAdapter extends FragmentPagerAdapter { public static class LiveUpdatesFragmentPagerAdapter extends FragmentPagerAdapter {
private final Fragment[] fragments = new Fragment[]{new LiveUpdatesFragment(), private final Fragment[] fragments = new Fragment[] { new LiveUpdatesFragment(), new ReportsFragment() };
new ReportsFragment()}; private static final int[] titleIds = new int[] { LiveUpdatesFragment.TITLE, ReportsFragment.TITLE };
private static final int[] titleIds = new int[]{LiveUpdatesFragment.TITLE,
ReportsFragment.TITLE};
private final String[] titles; private final String[] titles;
public LiveUpdatesFragmentPagerAdapter(FragmentManager fm, Resources res) { public LiveUpdatesFragmentPagerAdapter(FragmentManager fm, Resources res) {