diff --git a/OsmAnd/src/net/osmand/AndroidNetworkUtils.java b/OsmAnd/src/net/osmand/AndroidNetworkUtils.java index b14e8c56a8..85feae4ca8 100644 --- a/OsmAnd/src/net/osmand/AndroidNetworkUtils.java +++ b/OsmAnd/src/net/osmand/AndroidNetworkUtils.java @@ -66,7 +66,7 @@ public class AndroidNetworkUtils { } } - }.execute((Void) null); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void) null); } diff --git a/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java b/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java index 96674888da..5736d71f13 100644 --- a/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java +++ b/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java @@ -970,7 +970,7 @@ public class OsmandAidlApi { } } - }.execute(destination); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, destination); } else { helper.selectGpxFile(selectedGpx.getGpxFile(), false, false); refreshMap(); @@ -991,7 +991,7 @@ public class OsmandAidlApi { } } - }.execute(destination); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, destination); } } @@ -1098,7 +1098,7 @@ public class OsmandAidlApi { } } - }.execute(f); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, f); return true; } diff --git a/OsmAnd/src/net/osmand/plus/CurrentPositionHelper.java b/OsmAnd/src/net/osmand/plus/CurrentPositionHelper.java index a811f068ec..2a4c25b645 100644 --- a/OsmAnd/src/net/osmand/plus/CurrentPositionHelper.java +++ b/OsmAnd/src/net/osmand/plus/CurrentPositionHelper.java @@ -99,7 +99,7 @@ public class CurrentPositionHelper { } return null; } - }.execute((Void) null); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void) null); res = true; } return res; diff --git a/OsmAnd/src/net/osmand/plus/GeocodingLookupService.java b/OsmAnd/src/net/osmand/plus/GeocodingLookupService.java index 66ea3c28b7..203d2c6e34 100644 --- a/OsmAnd/src/net/osmand/plus/GeocodingLookupService.java +++ b/OsmAnd/src/net/osmand/plus/GeocodingLookupService.java @@ -117,11 +117,7 @@ public class GeocodingLookupService { @SuppressWarnings("unchecked") private

void execute(AsyncTask task, P... requests) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { - task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, requests); - } else { - task.execute(requests); - } + task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, requests); } private boolean geocode(final LatLon latLon) { diff --git a/OsmAnd/src/net/osmand/plus/OsmAndTaskManager.java b/OsmAnd/src/net/osmand/plus/OsmAndTaskManager.java index 16e8b78ce6..31a5d889e6 100644 --- a/OsmAnd/src/net/osmand/plus/OsmAndTaskManager.java +++ b/OsmAnd/src/net/osmand/plus/OsmAndTaskManager.java @@ -16,7 +16,7 @@ public class OsmAndTaskManager { OsmAndTaskRunnable r, Params... params) { InternalTaskExecutor exec = new InternalTaskExecutor(r); r.exec = exec; - exec.execute(params); + exec.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params); return exec; } diff --git a/OsmAnd/src/net/osmand/plus/OsmandApplication.java b/OsmAnd/src/net/osmand/plus/OsmandApplication.java index e78ad9ab4d..47330d8464 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandApplication.java +++ b/OsmAnd/src/net/osmand/plus/OsmandApplication.java @@ -201,7 +201,7 @@ public class OsmandApplication extends MultiDexApplication { protected void onPostExecute(Void result) { } - }.execute(); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } public IconsCache getIconsCache() { diff --git a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java index 27538c97d0..461f6ff0e6 100644 --- a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java @@ -135,7 +135,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment { return null; } - }.execute(); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } @@ -599,7 +599,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment { } }; - exportTask.execute(); + exportTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } protected void export() { @@ -639,14 +639,14 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment { bld.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - exportTask.execute(); + exportTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } }); bld.setNegativeButton(R.string.shared_string_no, null); bld.setMessage(R.string.fav_export_confirmation); bld.show(); } else { - exportTask.execute(); + exportTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } } } diff --git a/OsmAnd/src/net/osmand/plus/activities/IntermediatePointsDialog.java b/OsmAnd/src/net/osmand/plus/activities/IntermediatePointsDialog.java index 2c4fecbd10..9b95a3e3a5 100644 --- a/OsmAnd/src/net/osmand/plus/activities/IntermediatePointsDialog.java +++ b/OsmAnd/src/net/osmand/plus/activities/IntermediatePointsDialog.java @@ -182,7 +182,7 @@ public class IntermediatePointsDialog { originalPositions.addAll(newOriginalPositions); listadapter.notifyDataSetChanged(); }; - }.execute(new Void[0]); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Void[0]); } }); diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index 59c85b86a2..7bc3921d6e 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -1234,7 +1234,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven protected void onPostExecute(Void result) { } - }.execute((Void) null); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void) null); } diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index 0df03f40e1..d64b109c55 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -222,7 +222,7 @@ public class MapActivityActions implements DialogProvider { dlg.findViewById(R.id.DuplicateFileName).setVisibility(View.VISIBLE); } else { dlg.dismiss(); - new SaveDirectionsAsyncTask(app).execute(toSave); + new SaveDirectionsAsyncTask(app).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, toSave); } } }); diff --git a/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java b/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java index 43e5f25d1d..3ccdba5893 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java @@ -588,7 +588,7 @@ public class SettingsGeneralActivity extends SettingsBaseActivity implements OnR updateSettingsToNewDir(path.getParentFile().getAbsolutePath()); } }); - task.execute(); + task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } }); builder.setNeutralButton(R.string.shared_string_no, new OnClickListener() { @@ -630,7 +630,7 @@ public class SettingsGeneralActivity extends SettingsBaseActivity implements OnR setProgressVisibility(false); } - }.execute(); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } public void loadNativeLibrary() { @@ -656,7 +656,7 @@ public class SettingsGeneralActivity extends SettingsBaseActivity implements OnR Toast.makeText(SettingsGeneralActivity.this, R.string.native_library_not_supported, Toast.LENGTH_LONG).show(); } } - }.execute(); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } } diff --git a/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java b/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java index 0cd778acb5..b4309e66e7 100644 --- a/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java @@ -309,7 +309,7 @@ public class TrackActivity extends TabActivity { } } } - }.execute((Void) null); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void) null); } } diff --git a/OsmAnd/src/net/osmand/plus/activities/search/GeoIntentActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/GeoIntentActivity.java index 7ffeae8397..71dc479bc8 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/GeoIntentActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/GeoIntentActivity.java @@ -63,7 +63,7 @@ public class GeoIntentActivity extends OsmandListActivity { }); progress.setCancelable(true); - task.execute(); + task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); setIntent(null); } } diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressOnlineFragment.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressOnlineFragment.java index b07fe9b5bb..dba413e100 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressOnlineFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressOnlineFragment.java @@ -223,7 +223,7 @@ public class SearchAddressOnlineFragment extends Fragment implements SearchActiv adapter.setPlaces(places); } }; - }.execute((Void) null); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void) null); } diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchByNameAbstractActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchByNameAbstractActivity.java index 64a36d42f2..f359311486 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchByNameAbstractActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchByNameAbstractActivity.java @@ -177,7 +177,7 @@ public abstract class SearchByNameAbstractActivity extends OsmandListActivity selectAddress = getIntent() != null && getIntent().hasExtra(SELECT_ADDRESS); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); if (initializeTask != null){ - initializeTask.execute(); + initializeTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } } diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java index a1c1964563..ad106c37e8 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java @@ -475,7 +475,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa private synchronized void runNewSearchQuery(net.osmand.Location location, int requestType) { if (currentSearchTask == null || currentSearchTask.getStatus() == Status.FINISHED) { currentSearchTask = new SearchAmenityTask(location, requestType); - currentSearchTask.execute(); + currentSearchTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } } diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchPoiFilterFragment.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchPoiFilterFragment.java index f80cf45db3..cc55f1a2f5 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchPoiFilterFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchPoiFilterFragment.java @@ -107,7 +107,7 @@ public class SearchPoiFilterFragment extends OsmAndListFragment implements Searc currentTask.cancel(true); } currentTask = new SearchPoiByNameTask(); - currentTask.execute(s.toString().trim()); + currentTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, s.toString().trim()); } }); searchEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() { diff --git a/OsmAnd/src/net/osmand/plus/base/FailSafeFuntions.java b/OsmAnd/src/net/osmand/plus/base/FailSafeFuntions.java index 02c2c3ddec..6d0c671422 100644 --- a/OsmAnd/src/net/osmand/plus/base/FailSafeFuntions.java +++ b/OsmAnd/src/net/osmand/plus/base/FailSafeFuntions.java @@ -149,7 +149,7 @@ public class FailSafeFuntions { }; - task.execute(gpxPath); + task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, gpxPath); } }; diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashChooseAppDirFragment.java b/OsmAnd/src/net/osmand/plus/dashboard/DashChooseAppDirFragment.java index 173f4701c4..faed84088e 100644 --- a/OsmAnd/src/net/osmand/plus/dashboard/DashChooseAppDirFragment.java +++ b/OsmAnd/src/net/osmand/plus/dashboard/DashChooseAppDirFragment.java @@ -336,7 +336,7 @@ public class DashChooseAppDirFragment { updateView(); } }; - task.execute(); + task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } }); confirmBtn.setOnClickListener(getConfirmListener()); @@ -375,7 +375,7 @@ public class DashChooseAppDirFragment { protected void successCallback() {} protected void reloadData() { - new ReloadData(activity, getMyApplication()).execute((Void) null); + new ReloadData(activity, getMyApplication()).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void) null); } public OsmandApplication getMyApplication() { diff --git a/OsmAnd/src/net/osmand/plus/distancecalculator/DistanceCalculatorPlugin.java b/OsmAnd/src/net/osmand/plus/distancecalculator/DistanceCalculatorPlugin.java index 75720cc882..487e2a22ac 100644 --- a/OsmAnd/src/net/osmand/plus/distancecalculator/DistanceCalculatorPlugin.java +++ b/OsmAnd/src/net/osmand/plus/distancecalculator/DistanceCalculatorPlugin.java @@ -384,7 +384,7 @@ public class DistanceCalculatorPlugin extends OsmandPlugin { } }; }; - exportTask.execute(); + exportTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } private void startEditingHelp(MapActivity ctx) { final CommonPreference pref = app.getSettings().registerBooleanPreference("show_measurement_help_first_time", true); diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java b/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java index 55ff51d757..c11773f884 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java @@ -784,7 +784,7 @@ public class DownloadActivity extends AbstractDownloadActivity implements Downlo newDownloadIndexes(); } }; - task.execute(); + task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java index ebed865817..ab8ddadf54 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java @@ -322,11 +322,7 @@ public class DownloadIndexesThread { @SuppressWarnings("unchecked") private

void execute(BasicProgressAsyncTask task, P... indexItems) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { - task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, indexItems); - } else { - task.execute(indexItems); - } + task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, indexItems); } diff --git a/OsmAnd/src/net/osmand/plus/download/ui/DataStoragePlaceDialogFragment.java b/OsmAnd/src/net/osmand/plus/download/ui/DataStoragePlaceDialogFragment.java index a159d4bb6f..7a8ea7531d 100644 --- a/OsmAnd/src/net/osmand/plus/download/ui/DataStoragePlaceDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/ui/DataStoragePlaceDialogFragment.java @@ -2,6 +2,7 @@ package net.osmand.plus.download.ui; import android.app.Activity; import android.content.DialogInterface; +import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; import android.os.StatFs; @@ -259,7 +260,7 @@ public class DataStoragePlaceDialogFragment extends BottomSheetDialogFragment { } private void reloadData() { - new DashChooseAppDirFragment.ReloadData(getActivity(), getMyApplication()).execute((Void) null); + new DashChooseAppDirFragment.ReloadData(getActivity(), getMyApplication()).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void) null); } public static void showInstance(FragmentManager fragmentManager, boolean storageReadOnly) { diff --git a/OsmAnd/src/net/osmand/plus/download/ui/DownloadResourceGroupFragment.java b/OsmAnd/src/net/osmand/plus/download/ui/DownloadResourceGroupFragment.java index 6ae4e7b33c..acafce29f7 100644 --- a/OsmAnd/src/net/osmand/plus/download/ui/DownloadResourceGroupFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/ui/DownloadResourceGroupFragment.java @@ -325,7 +325,7 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow } } } - }.execute((Void) null); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void) null); } @Override diff --git a/OsmAnd/src/net/osmand/plus/download/ui/ItemViewHolder.java b/OsmAnd/src/net/osmand/plus/download/ui/ItemViewHolder.java index c8853a782d..ab9dc902d1 100644 --- a/OsmAnd/src/net/osmand/plus/download/ui/ItemViewHolder.java +++ b/OsmAnd/src/net/osmand/plus/download/ui/ItemViewHolder.java @@ -6,6 +6,7 @@ import android.content.Intent; import android.content.res.Resources; import android.graphics.drawable.Drawable; import android.net.Uri; +import android.os.AsyncTask; import android.support.v4.view.ViewCompat; import android.support.v7.app.AlertDialog; import android.support.v7.widget.PopupMenu; @@ -416,7 +417,7 @@ public class ItemViewHolder { @Override public void onClick(DialogInterface dialog, int which) { new LocalIndexOperationTask(context, null, LocalIndexOperationTask.DELETE_OPERATION) - .execute(info); + .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, info); } }); confirm.setNegativeButton(R.string.shared_string_no, null); diff --git a/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java b/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java index 076e6a4c7e..577fa38c67 100644 --- a/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java @@ -149,7 +149,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement if (current == null || current.getStatus() == AsyncTask.Status.FINISHED || current.isCancelled() || current.getResult() != null) { asyncLoader = new LoadLocalIndexTask(); - asyncLoader.execute(); + asyncLoader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } } @@ -224,7 +224,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement confirm.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - new LocalIndexOperationTask(getDownloadActivity(), listAdapter, LocalIndexOperationTask.CLEAR_TILES_OPERATION).execute(info); + new LocalIndexOperationTask(getDownloadActivity(), listAdapter, LocalIndexOperationTask.CLEAR_TILES_OPERATION).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, info); } }); confirm.setNegativeButton(R.string.shared_string_no, null); @@ -234,13 +234,13 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement confirm.setMessage(getString(R.string.delete_confirmation_msg, fn)); confirm.show(); } else if (resId == R.string.local_index_mi_restore) { - new LocalIndexOperationTask(getDownloadActivity(), listAdapter, LocalIndexOperationTask.RESTORE_OPERATION).execute(info); + new LocalIndexOperationTask(getDownloadActivity(), listAdapter, LocalIndexOperationTask.RESTORE_OPERATION).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, info); } else if (resId == R.string.shared_string_delete) { AlertDialog.Builder confirm = new AlertDialog.Builder(getActivity()); confirm.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - new LocalIndexOperationTask(getDownloadActivity(), listAdapter, LocalIndexOperationTask.DELETE_OPERATION).execute(info); + new LocalIndexOperationTask(getDownloadActivity(), listAdapter, LocalIndexOperationTask.DELETE_OPERATION).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, info); } }); confirm.setNegativeButton(R.string.shared_string_no, null); @@ -250,7 +250,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement confirm.setMessage(getString(R.string.delete_confirmation_msg, fn)); confirm.show(); } else if (resId == R.string.local_index_mi_backup) { - new LocalIndexOperationTask(getDownloadActivity(), listAdapter, LocalIndexOperationTask.BACKUP_OPERATION).execute(info); + new LocalIndexOperationTask(getDownloadActivity(), listAdapter, LocalIndexOperationTask.BACKUP_OPERATION).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, info); } return true; } @@ -699,7 +699,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement operationTask = null; } if (operationTask != null) { - operationTask.execute(selectedItems.toArray(new LocalIndexInfo[selectedItems.size()])); + operationTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, selectedItems.toArray(new LocalIndexInfo[selectedItems.size()])); } if (actionMode != null) { actionMode.finish(); diff --git a/OsmAnd/src/net/osmand/plus/download/ui/SearchDialogFragment.java b/OsmAnd/src/net/osmand/plus/download/ui/SearchDialogFragment.java index ba8eaa4f7d..44254053bb 100644 --- a/OsmAnd/src/net/osmand/plus/download/ui/SearchDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/ui/SearchDialogFragment.java @@ -349,7 +349,7 @@ public class SearchDialogFragment extends DialogFragment implements DownloadEven CityItem item = (CityItem) obj; viewHolder.bindIndexItem(item); if (item.getIndexItem() == null) { - new IndexItemResolverTask(viewHolder, item).execute(); + new IndexItemResolverTask(viewHolder, item).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } } } else { diff --git a/OsmAnd/src/net/osmand/plus/firstusage/FirstUsageWizardFragment.java b/OsmAnd/src/net/osmand/plus/firstusage/FirstUsageWizardFragment.java index b33f33311c..b7f5f59f63 100644 --- a/OsmAnd/src/net/osmand/plus/firstusage/FirstUsageWizardFragment.java +++ b/OsmAnd/src/net/osmand/plus/firstusage/FirstUsageWizardFragment.java @@ -376,7 +376,7 @@ public class FirstUsageWizardFragment extends Fragment implements OsmAndLocation showNoLocationFragment(getActivity()); } } - }.execute(); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else { FragmentActivity activity = getActivity(); diff --git a/OsmAnd/src/net/osmand/plus/helpers/DiscountHelper.java b/OsmAnd/src/net/osmand/plus/helpers/DiscountHelper.java index c8abbd7808..f8037fa806 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/DiscountHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/DiscountHelper.java @@ -86,7 +86,7 @@ public class DiscountHelper { processDiscountResponse(response, mapActivity); } } - }.execute(); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } @SuppressLint("SimpleDateFormat") diff --git a/OsmAnd/src/net/osmand/plus/helpers/GpxImportHelper.java b/OsmAnd/src/net/osmand/plus/helpers/GpxImportHelper.java index f74a874db7..4e2dace70c 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/GpxImportHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/GpxImportHelper.java @@ -173,7 +173,7 @@ public class GpxImportHelper { progress.dismiss(); handleResult(result, fileName, save, useImportDir, false); } - }.execute(); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } private void handleFavouritesImport(final Uri gpxFile, final String fileName, final boolean save, final boolean useImportDir, final boolean forceImportFavourites) { @@ -211,7 +211,7 @@ public class GpxImportHelper { progress.dismiss(); importFavourites(result, fileName, save, useImportDir, forceImportFavourites); } - }.execute(); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } private void importFavoritesImpl(final GPXFile gpxFile, final String fileName, final boolean forceImportFavourites) { @@ -245,7 +245,7 @@ public class GpxImportHelper { newIntent.putExtra(FavoritesActivity.OPEN_FAVOURITES_TAB, true); activity.startActivity(newIntent); } - }.execute(); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } private void handleKmzImport(final Uri kmzFile, final String name, final boolean save, final boolean useImportDir) { @@ -298,7 +298,7 @@ public class GpxImportHelper { handleResult(result, name, save, useImportDir, false); } - }.execute(); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } private void handleKmlImport(final Uri kmlFile, final String name, final boolean save, final boolean useImportDir) { @@ -342,7 +342,7 @@ public class GpxImportHelper { progress.dismiss(); handleResult(result, name, save, useImportDir, false); } - }.execute(); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } private void handleResult(final GPXFile result, final String name, final boolean save, @@ -355,7 +355,7 @@ public class GpxImportHelper { } } else { if (save) { - new SaveAsyncTask(result, name, useImportDir).execute(); + new SaveAsyncTask(result, name, useImportDir).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else { showGpxOnMap(result); } diff --git a/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java b/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java index b336819d22..59e29dc5dc 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java @@ -794,7 +794,7 @@ public class WaypointDialogHelper { reloadListAdapter(listAdapter); } } - }.execute((Void) null); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void) null); } public AdapterView.OnItemClickListener getDrawerItemClickListener(final FragmentActivity ctx, final int[] running, @@ -861,7 +861,7 @@ public class WaypointDialogHelper { reloadListAdapter(listAdapter); } } - }.execute((Void) null); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void) null); } public void reloadListAdapter(ArrayAdapter listAdapter) { @@ -1049,6 +1049,6 @@ public class WaypointDialogHelper { updateRouteInfoMenu(activity); } - }.execute(); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } } \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/inapp/InAppHelper.java b/OsmAnd/src/net/osmand/plus/inapp/InAppHelper.java index 40f7db1c2e..51ab4e5539 100644 --- a/OsmAnd/src/net/osmand/plus/inapp/InAppHelper.java +++ b/OsmAnd/src/net/osmand/plus/inapp/InAppHelper.java @@ -559,7 +559,7 @@ public class InAppHelper { } } } - }.execute((Void) null); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void) null); } public boolean onActivityResultHandled(int requestCode, int resultCode, Intent data) { diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesAlarmReceiver.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesAlarmReceiver.java index 01e4c95796..4cefc941c2 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesAlarmReceiver.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesAlarmReceiver.java @@ -4,6 +4,7 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.net.wifi.WifiManager; +import android.os.AsyncTask; import net.osmand.PlatformUtil; import net.osmand.plus.OsmandApplication; @@ -31,7 +32,7 @@ public class LiveUpdatesAlarmReceiver extends BroadcastReceiver { final OsmandSettings settings = application.getSettings(); if (!preferenceDownloadViaWiFi(localIndexInfoFile, settings).get() || wifi.isWifiEnabled()) { - new PerformLiveUpdateAsyncTask(context, localIndexInfoFile, false).execute(fileName); + new PerformLiveUpdateAsyncTask(context, localIndexInfoFile, false).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, fileName); } else { PerformLiveUpdateAsyncTask.tryRescheduleDownload(context, settings, localIndexInfoFile); } diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java index 95f5fef2e1..4e2525630e 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java @@ -153,11 +153,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppList } listView.setAdapter(adapter); - if(Build.VERSION.SDK_INT >= 11) { - loadLocalIndexesTask = new LoadLocalIndexTask(adapter, this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); - } else { - loadLocalIndexesTask = new LoadLocalIndexTask(adapter, this).execute(); - } + loadLocalIndexesTask = new LoadLocalIndexTask(adapter, this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); return view; } diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesHelper.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesHelper.java index a5f1f49894..b48edb7930 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesHelper.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesHelper.java @@ -4,6 +4,7 @@ import android.app.AlarmManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; +import android.os.AsyncTask; import android.support.annotation.NonNull; import net.osmand.plus.OsmandSettings; @@ -160,6 +161,6 @@ public class LiveUpdatesHelper { public static void runLiveUpdate(Context context, final String fileName, boolean forceUpdate) { final String fnExt = Algorithms.getFileNameWithoutExtension(new File(fileName)); - new PerformLiveUpdateAsyncTask(context, fileName, forceUpdate).execute(fnExt); + new PerformLiveUpdateAsyncTask(context, fileName, forceUpdate).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, fnExt); } } diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/ReportsFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/ReportsFragment.java index c44d31cd67..049fccb5c0 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/ReportsFragment.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/ReportsFragment.java @@ -238,7 +238,7 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect totalChangesByMontAsyncTask.setOnResponseListener(onResponseListener); totalChangesByMontAsyncTask.setOnErrorListener(onErrorListener); String finalUrl = String.format(TOTAL_CHANGES_BY_MONTH_URL_PATTERN, monthUrlString, regionUrlString); - totalChangesByMontAsyncTask.execute(finalUrl); + totalChangesByMontAsyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, finalUrl); GetJsonAsyncTask recChangesByMontAsyncTask = new GetJsonAsyncTask<>(Protocol.RecipientsByMonth.class); @@ -266,7 +266,7 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect donationsTextView.setText("-"); } String recfinalUrl = String.format(RECIPIENTS_BY_MONTH, monthUrlString, regionUrlString); - recChangesByMontAsyncTask.execute(recfinalUrl); + recChangesByMontAsyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, recfinalUrl); } @Override diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/UsersReportFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/UsersReportFragment.java index 40f98f0a9d..b9c19676f1 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/UsersReportFragment.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/UsersReportFragment.java @@ -10,6 +10,7 @@ import net.osmand.plus.liveupdates.ReportsFragment.GetJsonAsyncTask; import net.osmand.plus.liveupdates.ReportsFragment.GetJsonAsyncTask.OnResponseListener; import android.content.res.Resources; import android.graphics.drawable.Drawable; +import android.os.AsyncTask; import android.os.Bundle; import android.support.annotation.ColorInt; import android.support.annotation.DrawableRes; @@ -49,7 +50,7 @@ public class UsersReportFragment extends BaseOsmAndDialogFragment { view.findViewById(R.id.progress).setVisibility(View.GONE); } }); - task.execute(url); + task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, url); listView.setAdapter(adapter); ImageButton clearButton = (ImageButton) view.findViewById(R.id.closeButton); diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java index 022f9fdb98..99145667c0 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java @@ -758,10 +758,6 @@ public class MenuBuilder { @SuppressWarnings("unchecked") public static

void execute(AsyncTask task, P... requests) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { - task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, requests); - } else { - task.execute(requests); - } + task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, requests); } } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java index 4b1a519633..3f17551e8f 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java @@ -421,7 +421,7 @@ public class MapDataMenuController extends MenuController { getMapActivity().refreshMap(); } - }.execute((Void) null); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void) null); } }); confirm.setNegativeButton(R.string.shared_string_no, null); @@ -465,7 +465,7 @@ public class MapDataMenuController extends MenuController { getMapActivity().refreshMap(); } - }.execute((Void) null); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void) null); } private boolean move(File from, File to) { diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragment.java index 45a73efe37..2732b20ee0 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragment.java @@ -203,7 +203,7 @@ public class WptPtEditorFragment extends PointEditorFragment { } } else { addWpt(gpx, description, name, category, color); - new SaveGpxAsyncTask(getMyApplication(), gpx, editor.isGpxSelected()).execute(); + new SaveGpxAsyncTask(getMyApplication(), gpx, editor.isGpxSelected()).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } syncGpx(gpx); } @@ -227,7 +227,7 @@ public class WptPtEditorFragment extends PointEditorFragment { } else { gpx.updateWptPt(wpt, wpt.getLatitude(), wpt.getLongitude(), System.currentTimeMillis(), description, name, category, color); - new SaveGpxAsyncTask(getMyApplication(), gpx, editor.isGpxSelected()).execute(); + new SaveGpxAsyncTask(getMyApplication(), gpx, editor.isGpxSelected()).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } syncGpx(gpx); } @@ -248,7 +248,7 @@ public class WptPtEditorFragment extends PointEditorFragment { savingTrackHelper.deletePointData(wpt); } else { gpx.deleteWptPt(wpt); - new SaveGpxAsyncTask(getMyApplication(), gpx, editor.isGpxSelected()).execute(); + new SaveGpxAsyncTask(getMyApplication(), gpx, editor.isGpxSelected()).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } syncGpx(gpx); } diff --git a/OsmAnd/src/net/osmand/plus/mapillary/MapillaryAutoCompleteAdapter.java b/OsmAnd/src/net/osmand/plus/mapillary/MapillaryAutoCompleteAdapter.java index 4b074ecb5c..ee15586aef 100644 --- a/OsmAnd/src/net/osmand/plus/mapillary/MapillaryAutoCompleteAdapter.java +++ b/OsmAnd/src/net/osmand/plus/mapillary/MapillaryAutoCompleteAdapter.java @@ -90,7 +90,7 @@ public class MapillaryAutoCompleteAdapter extends ArrayAdapter implement names.add(NO_INTERNET_CONNECTION); wrong = true; } else { - Pair user = new GetMapillaryUserAsyncTask().execute(constraint.toString()).get(); + Pair user = new GetMapillaryUserAsyncTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, constraint.toString()).get(); if (user != null) { settings.MAPILLARY_FILTER_USER_KEY.set(user.first); settings.MAPILLARY_FILTER_USERNAME.set(user.second); diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java index 1909b7c19b..6646126999 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java @@ -928,7 +928,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene adapter.notifyDataSetChanged(); planRouteContext.recreateSnapTrkSegment(false); } - }.execute(); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } private class PlanRouteToolbarController extends TopToolbarController { diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java index 1ecb43e380..b65a26e9af 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java @@ -1283,7 +1283,7 @@ public class MeasurementToolFragment extends Fragment { } } } - }.execute(); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } private void enable(View... views) { diff --git a/OsmAnd/src/net/osmand/plus/monitoring/LiveMonitoringHelper.java b/OsmAnd/src/net/osmand/plus/monitoring/LiveMonitoringHelper.java index db98cb0a1d..0f2309ad54 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/LiveMonitoringHelper.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/LiveMonitoringHelper.java @@ -73,7 +73,7 @@ public class LiveMonitoringHelper { } if (isLiveMonitoringEnabled()) { if (!started) { - new LiveSender().execute(queue); + new LiveSender().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, queue); started = true; } } else { diff --git a/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java index b599107212..034001de31 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java @@ -391,10 +391,10 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment { public void reloadTracks() { asyncLoader = new LoadGpxTask(); - asyncLoader.execute(getActivity()); + asyncLoader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, getActivity()); if (asyncProcessor == null) { asyncProcessor = new ProcessGpxTask(); - asyncProcessor.execute(); + asyncProcessor.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } } @@ -506,7 +506,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment { public void doAction(int actionResId) { if (actionResId == R.string.shared_string_delete) { operationTask = new DeleteGpxTask(); - operationTask.execute(selectedItems.toArray(new GpxInfo[selectedItems.size()])); + operationTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, selectedItems.toArray(new GpxInfo[selectedItems.size()])); } else { operationTask = null; } @@ -598,7 +598,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment { private void runSelection(boolean showOnMap) { operationTask = new SelectGpxTask(showOnMap); originalSelectedItems.addAll(selectedItems); - operationTask.execute(originalSelectedItems.toArray(new GpxInfo[originalSelectedItems.size()])); + operationTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, originalSelectedItems.toArray(new GpxInfo[originalSelectedItems.size()])); } @Override @@ -802,7 +802,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment { if (info.file.renameTo(dest)) { app.getGpxDatabase().rename(info.file, dest); asyncLoader = new LoadGpxTask(); - asyncLoader.execute(getActivity()); + asyncLoader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, getActivity()); } else { Toast.makeText(app, R.string.file_can_not_be_moved, Toast.LENGTH_LONG).show(); } @@ -825,7 +825,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment { if (info.file.renameTo(dest)) { app.getGpxDatabase().rename(info.file, dest); asyncLoader = new LoadGpxTask(); - asyncLoader.execute(getActivity()); + asyncLoader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, getActivity()); } else { Toast.makeText(app, R.string.file_can_not_be_moved, Toast.LENGTH_LONG).show(); } @@ -1367,7 +1367,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment { item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { - new OpenGpxDetailsTask(gpxInfo).execute(); + new OpenGpxDetailsTask(gpxInfo).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); return true; } }); @@ -1393,7 +1393,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment { public void renamedTo(File file) { app.getGpxDatabase().rename(gpxInfo.file, file); asyncLoader = new LoadGpxTask(); - asyncLoader.execute(getActivity()); + asyncLoader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, getActivity()); } }); return true; @@ -1437,7 +1437,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment { @Override public void onClick(DialogInterface dialog, int which) { operationTask = new DeleteGpxTask(); - operationTask.execute(gpxInfo); + operationTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, gpxInfo); } }); builder.setNegativeButton(R.string.shared_string_cancel, null); diff --git a/OsmAnd/src/net/osmand/plus/myplaces/SplitSegmentDialogFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/SplitSegmentDialogFragment.java index 8468e67409..d62bd5cfe7 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/SplitSegmentDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/SplitSegmentDialogFragment.java @@ -237,7 +237,7 @@ public class SplitSegmentDialogFragment extends DialogFragment { } private void updateSplit(List groups, GpxSelectionHelper.SelectedGpxFile sf) { - new SplitTrackAsyncTask(sf, groups).execute((Void) null); + new SplitTrackAsyncTask(sf, groups).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void) null); } private void setupSplitIntervalView(View view) { diff --git a/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java index 8d4f9b564b..c2c640eefd 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java @@ -574,7 +574,7 @@ public class TrackPointFragment extends OsmandExpandableListFragment { return getString(R.string.points_delete_multiple_succesful); } - }.execute(); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } private void syncGpx(GPXFile gpxFile) { diff --git a/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java index b3166dc624..0830ea69fb 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java @@ -888,7 +888,7 @@ public class TrackSegmentFragment extends OsmAndListFragment { } private void updateSplit(List groups, SelectedGpxFile sf) { - new SplitTrackAsyncTask(sf, groups).execute((Void) null); + new SplitTrackAsyncTask(sf, groups).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void) null); } private void addOptionSplit(int value, boolean distance, List model) { @@ -1378,7 +1378,7 @@ public class TrackSegmentFragment extends OsmAndListFragment { GPXFile gpx = getGpx(); if (gpx != null) { SelectedGpxFile sf = app.getSelectedGpxHelper().selectGpxFile(gpx, vis.isChecked(), false); - new SaveGpxAsyncTask(gpx, vis.isChecked() ? sf : null).execute(); + new SaveGpxAsyncTask(gpx, vis.isChecked() ? sf : null).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } } } @@ -1476,7 +1476,7 @@ public class TrackSegmentFragment extends OsmAndListFragment { GPXFile gpx = getGpx(); if (gpx != null) { SelectedGpxFile sf = app.getSelectedGpxHelper().selectGpxFile(gpx, vis.isChecked(), false); - new SaveGpxAsyncTask(gpx, vis.isChecked() ? sf : null).execute(); + new SaveGpxAsyncTask(gpx, vis.isChecked() ? sf : null).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } } return true; @@ -1569,7 +1569,7 @@ public class TrackSegmentFragment extends OsmAndListFragment { GPXFile gpx = getGpx(); if (gpx != null) { SelectedGpxFile sf = app.getSelectedGpxHelper().selectGpxFile(gpx, vis.isChecked(), false); - new SaveGpxAsyncTask(gpx, vis.isChecked() ? sf : null).execute(); + new SaveGpxAsyncTask(gpx, vis.isChecked() ? sf : null).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } } return true; diff --git a/OsmAnd/src/net/osmand/plus/osmedit/DashOsmEditsFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/DashOsmEditsFragment.java index 721bc99fb3..9d6f3a25da 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/DashOsmEditsFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/DashOsmEditsFragment.java @@ -2,6 +2,7 @@ package net.osmand.plus.osmedit; import android.app.ProgressDialog; import android.content.DialogInterface; +import android.os.AsyncTask; import android.os.Bundle; import android.support.v7.app.AlertDialog; import android.view.LayoutInflater; @@ -179,7 +180,7 @@ public class DashOsmEditsFragment extends DashBaseFragment dialog.show(getChildFragmentManager(), ProgressDialogFragment.TAG); UploadOpenstreetmapPointAsyncTask uploadTask = new UploadOpenstreetmapPointAsyncTask(dialog, listener, plugin, toUpload.length, closeChangeSet, anonymously); - uploadTask.execute(toUpload); + uploadTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, toUpload); } private void getOsmPoints(ArrayList dataPoints) { diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java index 188915c41e..d117d4b479 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java @@ -537,7 +537,7 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment { postExecute.processResult(result); } } - }.execute(); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } public void setPoiCategory(PoiCategory type) { @@ -665,7 +665,7 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment { Toast.LENGTH_LONG).show(); } } - }.execute(); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } public static class MyAdapter extends FragmentPagerAdapter { diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java index 705182b4eb..bcaa26d95f 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java @@ -5,6 +5,7 @@ import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.content.Intent; +import android.os.AsyncTask; import android.support.v4.app.Fragment; import android.support.v7.app.AlertDialog; import android.view.LayoutInflater; @@ -186,7 +187,7 @@ public class OsmEditingPlugin extends OsmandPlugin { modifyOsmNote(mapActivity, (OsmNotesPoint) selectedObj); } else if (resId == R.string.poi_context_menu_delete) { new EditPoiDialogFragment.ShowDeleteDialogAsyncTask(mapActivity) - .execute((Amenity) selectedObj); + .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Amenity) selectedObj); } else if (resId == R.string.poi_context_menu_modify) { EditPoiDialogFragment.showEditInstance((Amenity) selectedObj, mapActivity); } else if (resId == R.string.poi_context_menu_modify_osm_change) { @@ -392,7 +393,7 @@ public class OsmEditingPlugin extends OsmandPlugin { public void onClick(DialogInterface dialog, int which) { new UploadGPXFilesTask(la, descr.getText().toString(), tags.getText().toString(), (UploadVisibility) visibility.getItemAtPosition(visibility.getSelectedItemPosition()) - ).execute(info); + ).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, info); } }); bldr.show(); diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java index 442bacd7cd..2f4bff96e6 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java @@ -155,7 +155,7 @@ public class OsmEditsFragment extends OsmAndListFragment item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { - new BackupOpenstreetmapPointAsyncTask().execute( + new BackupOpenstreetmapPointAsyncTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, listAdapter.dataPoints.toArray(new OsmPoint[listAdapter.dataPoints.size()])); return true; } @@ -632,7 +632,7 @@ public class OsmEditsFragment extends OsmAndListFragment dialog.show(getActivity().getSupportFragmentManager(), ProgressDialogFragment.TAG); UploadOpenstreetmapPointAsyncTask uploadTask = new UploadOpenstreetmapPointAsyncTask( dialog, listener, plugin, points.length, closeChangeSet, anonymously); - uploadTask.execute(points); + uploadTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, points); } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsLayer.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsLayer.java index cde7820fa4..1f86adec92 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsLayer.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsLayer.java @@ -207,13 +207,13 @@ public class OsmEditsLayer extends OsmandMapLayer implements ContextMenuLayer.IC Node node = objectInMotion.getEntity(); node.setLatitude(position.getLatitude()); node.setLongitude(position.getLongitude()); - new SaveOsmChangeAsyncTask(mOsmChangeUtil, callback, objectInMotion).execute(); + new SaveOsmChangeAsyncTask(mOsmChangeUtil, callback, objectInMotion).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else if (o instanceof OsmNotesPoint) { OsmNotesPoint objectInMotion = (OsmNotesPoint) o; objectInMotion.setLatitude(position.getLatitude()); objectInMotion.setLongitude(position.getLongitude()); new SaveOsmNoteAsyncTask(objectInMotion.getText(), activity, callback, plugin, mOsmBugsUtil) - .execute(objectInMotion); + .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, objectInMotion); } } } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsUploadListenerHelper.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsUploadListenerHelper.java index 291fd95011..9cfa16e007 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsUploadListenerHelper.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsUploadListenerHelper.java @@ -4,6 +4,7 @@ import android.app.Activity; import android.app.Dialog; import android.app.ProgressDialog; import android.content.DialogInterface; +import android.os.AsyncTask; import android.os.Bundle; import android.support.annotation.MainThread; import android.support.annotation.NonNull; @@ -102,7 +103,7 @@ public class OsmEditsUploadListenerHelper implements OsmEditsUploadListener { dialog.show(activity.getSupportFragmentManager(), ProgressDialogFragment.TAG); UploadOpenstreetmapPointAsyncTask uploadTask = new UploadOpenstreetmapPointAsyncTask( dialog, helper, plugin, toUpload.length, false, false); - uploadTask.execute(toUpload); + uploadTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, toUpload); } public static final class UploadingErrorDialogFragment extends DialogFragment { diff --git a/OsmAnd/src/net/osmand/plus/osmedit/SettingsOsmEditingActivity.java b/OsmAnd/src/net/osmand/plus/osmedit/SettingsOsmEditingActivity.java index c18f069e2c..d5c7fabe4a 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/SettingsOsmEditingActivity.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/SettingsOsmEditingActivity.java @@ -90,7 +90,7 @@ public class SettingsOsmEditingActivity extends SettingsBaseActivity { if (positiveResult) { settings.USER_NAME.set(userNameEditText.getText().toString()); settings.USER_PASSWORD.set(passwordEditText.getText().toString()); - new ValidateOsmLoginDetailsTask(SettingsOsmEditingActivity.this).execute(); + new ValidateOsmLoginDetailsTask(SettingsOsmEditingActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } } } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/dialogs/SendPoiDialogFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/dialogs/SendPoiDialogFragment.java index d9ea473e3a..7ce6d9be11 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/dialogs/SendPoiDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/dialogs/SendPoiDialogFragment.java @@ -3,6 +3,7 @@ package net.osmand.plus.osmedit.dialogs; import android.app.Dialog; import android.app.ProgressDialog; import android.content.DialogInterface; +import android.os.AsyncTask; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v4.app.DialogFragment; @@ -272,7 +273,7 @@ public class SendPoiDialogFragment extends DialogFragment { dialog.show(mapActivity.getSupportFragmentManager(), ProgressDialogFragment.TAG); UploadOpenstreetmapPointAsyncTask uploadTask = new UploadOpenstreetmapPointAsyncTask( dialog, listener, plugin, points.length, closeChangeSet, anonymously); - uploadTask.execute(points); + uploadTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, points); } } } diff --git a/OsmAnd/src/net/osmand/plus/osmo/OsMoControlDevice.java b/OsmAnd/src/net/osmand/plus/osmo/OsMoControlDevice.java index 416bf820aa..4ce92b46af 100644 --- a/OsmAnd/src/net/osmand/plus/osmo/OsMoControlDevice.java +++ b/OsmAnd/src/net/osmand/plus/osmo/OsMoControlDevice.java @@ -18,6 +18,7 @@ import org.json.JSONObject; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; +import android.os.AsyncTask; import android.os.BatteryManager; import android.os.Vibrator; @@ -112,7 +113,7 @@ public class OsMoControlDevice implements OsMoReactor { } return true; } else if(command.equals("TP")) { - plugin.getDownloadGpxTask(true).execute(obj); + plugin.getDownloadGpxTask(true).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, obj); } else if (command.equals("PP")) { service.pushCommand("PP"); } diff --git a/OsmAnd/src/net/osmand/plus/osmo/OsMoGroups.java b/OsmAnd/src/net/osmand/plus/osmo/OsMoGroups.java index d8a291fca9..3a431c3ad5 100644 --- a/OsmAnd/src/net/osmand/plus/osmo/OsMoGroups.java +++ b/OsmAnd/src/net/osmand/plus/osmo/OsMoGroups.java @@ -1,5 +1,7 @@ package net.osmand.plus.osmo; +import android.os.AsyncTask; + import com.google.gson.Gson; import net.osmand.Location; @@ -381,7 +383,7 @@ public class OsMoGroups implements OsMoReactor, OsmoTrackerListener { a.add(trackJson); } } - plugin.getDownloadGpxTask(true).execute(a.toArray(new JSONObject[a.size()])); + plugin.getDownloadGpxTask(true).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, a.toArray(new JSONObject[a.size()])); disableGroupTracks(gr, toDeleteT); } @@ -422,7 +424,7 @@ public class OsMoGroups implements OsMoReactor, OsmoTrackerListener { } if (points.size() > 0) { plugin.getSaveGpxTask(gr.name + " points", modify, false, isGroupConnect) - .execute(points.toArray(new WptPt[points.size()])); + .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, points.toArray(new WptPt[points.size()])); } } if (deleteUsers) { diff --git a/OsmAnd/src/net/osmand/plus/osmo/OsMoGroupsActivity.java b/OsmAnd/src/net/osmand/plus/osmo/OsMoGroupsActivity.java index fdbc759692..82d5ab2fb9 100644 --- a/OsmAnd/src/net/osmand/plus/osmo/OsMoGroupsActivity.java +++ b/OsmAnd/src/net/osmand/plus/osmo/OsMoGroupsActivity.java @@ -24,6 +24,7 @@ import android.graphics.Path; import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.net.Uri; +import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; import android.os.Handler; @@ -167,7 +168,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements } if (getIntent() != null) { if ("http".equals(getIntent().getScheme())) { - new OsMoIntentHandler(app, osMoPlugin).execute(getIntent()); + new OsMoIntentHandler(app, osMoPlugin).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, getIntent()); } } setContentView(R.layout.osmo_group_list); diff --git a/OsmAnd/src/net/osmand/plus/osmo/OsMoService.java b/OsmAnd/src/net/osmand/plus/osmo/OsMoService.java index ecf61eb0e6..9a162369ba 100644 --- a/OsmAnd/src/net/osmand/plus/osmo/OsMoService.java +++ b/OsmAnd/src/net/osmand/plus/osmo/OsMoService.java @@ -126,7 +126,7 @@ public class OsMoService implements OsMoReactor { } return null; } - }.execute((Void)null); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void)null); } public boolean isConnected() { @@ -446,7 +446,7 @@ public class OsMoService implements OsMoReactor { for(int i = 0; i < a.length; i++) { a[i] = (JSONObject) ar.get(i); } - task.execute(a); + task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, a); } catch (JSONException e) { e.printStackTrace(); showErrorMessage(e.getMessage()); diff --git a/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java b/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java index 08be343fef..59b321ac4b 100644 --- a/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java +++ b/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java @@ -436,7 +436,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin { builder.show(); } }; - t.execute(); + t.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } public static void defineNewEditLayer(final Activity activity, final ResultMatcher resultMatcher) { diff --git a/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsActivity.java b/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsActivity.java index 14a5028700..d2492e4a24 100644 --- a/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsActivity.java +++ b/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsActivity.java @@ -231,7 +231,7 @@ public class RoutePointsActivity extends OsmandListActivity { //getSherlock().setProgressBarIndeterminateVisibility(false); } - }.execute(plugin.getCurrentRoute()); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, plugin.getCurrentRoute()); } diff --git a/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsPlugin.java b/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsPlugin.java index 8466ce97da..6719a3f5f1 100644 --- a/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsPlugin.java +++ b/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsPlugin.java @@ -544,7 +544,7 @@ public class RoutePointsPlugin extends OsmandPlugin { saveFile(); return null; } - }.execute(getCurrentRoute()); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, getCurrentRoute()); } } diff --git a/OsmAnd/src/net/osmand/plus/search/QuickSearchCoordinatesFragment.java b/OsmAnd/src/net/osmand/plus/search/QuickSearchCoordinatesFragment.java index fc4a1aaaa5..da0eb3a959 100644 --- a/OsmAnd/src/net/osmand/plus/search/QuickSearchCoordinatesFragment.java +++ b/OsmAnd/src/net/osmand/plus/search/QuickSearchCoordinatesFragment.java @@ -628,7 +628,7 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os subtitleView.setText(country == null ? "" : country); } } - }.execute(latLon); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, latLon); updateLocationUI(latLon, heading); errorView.setVisibility(View.GONE); coordsView.setVisibility(View.VISIBLE); diff --git a/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java b/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java index 12c766c24c..18568a0bc8 100644 --- a/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java @@ -1918,7 +1918,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC startActivity(sendIntent); } }; - exportTask.execute(); + exportTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } } diff --git a/OsmAnd/src/net/osmand/plus/views/GPXLayer.java b/OsmAnd/src/net/osmand/plus/views/GPXLayer.java index 5bab0c2a70..944d8f5e90 100644 --- a/OsmAnd/src/net/osmand/plus/views/GPXLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/GPXLayer.java @@ -633,7 +633,7 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex gpxFile.updateWptPt(objectInMotion, position.getLatitude(), position.getLongitude(), System.currentTimeMillis(), objectInMotion.desc, objectInMotion.name, objectInMotion.category, objectInMotion.getColor()); - new SaveGpxFileAsyncTask(view.getApplication(), callback, objectInMotion).execute(gpxFile); + new SaveGpxFileAsyncTask(view.getApplication(), callback, objectInMotion).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, gpxFile); syncGpx(gpxFile); } else if (callback != null) { callback.onApplyMovedObject(false, o); diff --git a/OsmAnd/src/net/osmand/plus/views/OsmandMapLayer.java b/OsmAnd/src/net/osmand/plus/views/OsmandMapLayer.java index 6ca48615f1..bdbb19c4e8 100644 --- a/OsmAnd/src/net/osmand/plus/views/OsmandMapLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/OsmandMapLayer.java @@ -80,11 +80,7 @@ public abstract class OsmandMapLayer { public void executeTaskInBackground(AsyncTask task, Params... params) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { - task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params); - } else { - task.execute(params); - } + task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params); } public boolean isPresentInFullObjects(LatLon latLon) { diff --git a/OsmAnd/src/net/osmand/plus/views/Renderable.java b/OsmAnd/src/net/osmand/plus/views/Renderable.java index 52ed8f1cd2..7b4ac73be5 100644 --- a/OsmAnd/src/net/osmand/plus/views/Renderable.java +++ b/OsmAnd/src/net/osmand/plus/views/Renderable.java @@ -2,6 +2,7 @@ package net.osmand.plus.views; import android.graphics.Canvas; import android.graphics.Paint; +import android.os.AsyncTask; import net.osmand.data.QuadRect; import net.osmand.data.RotatedTileBox; @@ -137,7 +138,7 @@ public class Renderable { double cullDistance = Math.pow(2.0, segmentSize - zoom); // segmentSize == epsilon culler = new AsynchronousResampler.RamerDouglasPeucer(this, cullDistance); - culler.execute(""); + culler.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, ""); } } diff --git a/OsmAndCore-sample/src/net/osmand/core/samples/android/sample1/CurrentPositionHelper.java b/OsmAndCore-sample/src/net/osmand/core/samples/android/sample1/CurrentPositionHelper.java index 258405ea12..984c69fe6c 100644 --- a/OsmAndCore-sample/src/net/osmand/core/samples/android/sample1/CurrentPositionHelper.java +++ b/OsmAndCore-sample/src/net/osmand/core/samples/android/sample1/CurrentPositionHelper.java @@ -103,7 +103,7 @@ public class CurrentPositionHelper { } return null; } - }.execute((Void) null); + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void) null); res = true; } return res; diff --git a/OsmAndCore-sample/src/net/osmand/core/samples/android/sample1/GeocodingLookupService.java b/OsmAndCore-sample/src/net/osmand/core/samples/android/sample1/GeocodingLookupService.java index aeaefa2190..b8ea8eaa40 100644 --- a/OsmAndCore-sample/src/net/osmand/core/samples/android/sample1/GeocodingLookupService.java +++ b/OsmAndCore-sample/src/net/osmand/core/samples/android/sample1/GeocodingLookupService.java @@ -117,11 +117,7 @@ public class GeocodingLookupService { @SuppressWarnings("unchecked") private

void execute(AsyncTask task, P... requests) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { - task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, requests); - } else { - task.execute(requests); - } + task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, requests); } private boolean geocode(final LatLon latLon) {