Replace async task execute with executeOnExecutor
This commit is contained in:
parent
556dca60b0
commit
616a0ada34
70 changed files with 125 additions and 135 deletions
|
@ -66,7 +66,7 @@ public class AndroidNetworkUtils {
|
|||
}
|
||||
}
|
||||
|
||||
}.execute((Void) null);
|
||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void) null);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ public class CurrentPositionHelper {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
}.execute((Void) null);
|
||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void) null);
|
||||
res = true;
|
||||
}
|
||||
return res;
|
||||
|
|
|
@ -117,11 +117,7 @@ public class GeocodingLookupService {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <P> void execute(AsyncTask<P, ?, ?> 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) {
|
||||
|
|
|
@ -16,7 +16,7 @@ public class OsmAndTaskManager {
|
|||
OsmAndTaskRunnable<Params, Progress, Result> r, Params... params) {
|
||||
InternalTaskExecutor<Params, Progress, Result> exec = new InternalTaskExecutor<Params, Progress, Result>(r);
|
||||
r.exec = exec;
|
||||
exec.execute(params);
|
||||
exec.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params);
|
||||
return exec;
|
||||
}
|
||||
|
||||
|
|
|
@ -201,7 +201,7 @@ public class OsmandApplication extends MultiDexApplication {
|
|||
|
||||
protected void onPostExecute(Void result) {
|
||||
}
|
||||
}.execute();
|
||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
public IconsCache getIconsCache() {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -182,7 +182,7 @@ public class IntermediatePointsDialog {
|
|||
originalPositions.addAll(newOriginalPositions);
|
||||
listadapter.notifyDataSetChanged();
|
||||
};
|
||||
}.execute(new Void[0]);
|
||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Void[0]);
|
||||
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -309,7 +309,7 @@ public class TrackActivity extends TabActivity {
|
|||
}
|
||||
}
|
||||
}
|
||||
}.execute((Void) null);
|
||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void) null);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ public class GeoIntentActivity extends OsmandListActivity {
|
|||
});
|
||||
progress.setCancelable(true);
|
||||
|
||||
task.execute();
|
||||
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
setIntent(null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -223,7 +223,7 @@ public class SearchAddressOnlineFragment extends Fragment implements SearchActiv
|
|||
adapter.setPlaces(places);
|
||||
}
|
||||
};
|
||||
}.execute((Void) null);
|
||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void) null);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ public abstract class SearchByNameAbstractActivity<T> 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -149,7 +149,7 @@ public class FailSafeFuntions {
|
|||
|
||||
|
||||
};
|
||||
task.execute(gpxPath);
|
||||
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, gpxPath);
|
||||
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -384,7 +384,7 @@ public class DistanceCalculatorPlugin extends OsmandPlugin {
|
|||
}
|
||||
};
|
||||
};
|
||||
exportTask.execute();
|
||||
exportTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
private void startEditingHelp(MapActivity ctx) {
|
||||
final CommonPreference<Boolean> pref = app.getSettings().registerBooleanPreference("show_measurement_help_first_time", true);
|
||||
|
|
|
@ -784,7 +784,7 @@ public class DownloadActivity extends AbstractDownloadActivity implements Downlo
|
|||
newDownloadIndexes();
|
||||
}
|
||||
};
|
||||
task.execute();
|
||||
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -322,11 +322,7 @@ public class DownloadIndexesThread {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <P> void execute(BasicProgressAsyncTask<?, P, ?, ?> 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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -325,7 +325,7 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
|
|||
}
|
||||
}
|
||||
}
|
||||
}.execute((Void) null);
|
||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void) null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -376,7 +376,7 @@ public class FirstUsageWizardFragment extends Fragment implements OsmAndLocation
|
|||
showNoLocationFragment(getActivity());
|
||||
}
|
||||
}
|
||||
}.execute();
|
||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
|
||||
} else {
|
||||
FragmentActivity activity = getActivity();
|
||||
|
|
|
@ -86,7 +86,7 @@ public class DiscountHelper {
|
|||
processDiscountResponse(response, mapActivity);
|
||||
}
|
||||
}
|
||||
}.execute();
|
||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
@SuppressLint("SimpleDateFormat")
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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<Object> listAdapter) {
|
||||
|
@ -1049,6 +1049,6 @@ public class WaypointDialogHelper {
|
|||
updateRouteInfoMenu(activity);
|
||||
}
|
||||
|
||||
}.execute();
|
||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
}
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<Protocol.RecipientsByMonth> 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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -758,10 +758,6 @@ public class MenuBuilder {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <P> void execute(AsyncTask<P, ?, ?> 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ public class MapillaryAutoCompleteAdapter extends ArrayAdapter<String> implement
|
|||
names.add(NO_INTERNET_CONNECTION);
|
||||
wrong = true;
|
||||
} else {
|
||||
Pair<String, String> user = new GetMapillaryUserAsyncTask().execute(constraint.toString()).get();
|
||||
Pair<String, String> 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);
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -1283,7 +1283,7 @@ public class MeasurementToolFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
}
|
||||
}.execute();
|
||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
private void enable(View... views) {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -237,7 +237,7 @@ public class SplitSegmentDialogFragment extends DialogFragment {
|
|||
}
|
||||
|
||||
private void updateSplit(List<GpxDisplayGroup> 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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -888,7 +888,7 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
|||
}
|
||||
|
||||
private void updateSplit(List<GpxDisplayGroup> 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<GpxDisplayGroup> 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;
|
||||
|
|
|
@ -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<OsmPoint> dataPoints) {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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<TileSourceTemplate> resultMatcher) {
|
||||
|
|
|
@ -231,7 +231,7 @@ public class RoutePointsActivity extends OsmandListActivity {
|
|||
//getSherlock().setProgressBarIndeterminateVisibility(false);
|
||||
|
||||
}
|
||||
}.execute(plugin.getCurrentRoute());
|
||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, plugin.getCurrentRoute());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -544,7 +544,7 @@ public class RoutePointsPlugin extends OsmandPlugin {
|
|||
saveFile();
|
||||
return null;
|
||||
}
|
||||
}.execute(getCurrentRoute());
|
||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, getCurrentRoute());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1918,7 +1918,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
|||
startActivity(sendIntent);
|
||||
}
|
||||
};
|
||||
exportTask.execute();
|
||||
exportTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -80,11 +80,7 @@ public abstract class OsmandMapLayer {
|
|||
|
||||
|
||||
public <Params> void executeTaskInBackground(AsyncTask<Params, ?, ?> 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) {
|
||||
|
|
|
@ -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, "");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ public class CurrentPositionHelper {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
}.execute((Void) null);
|
||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void) null);
|
||||
res = true;
|
||||
}
|
||||
return res;
|
||||
|
|
|
@ -117,11 +117,7 @@ public class GeocodingLookupService {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <P> void execute(AsyncTask<P, ?, ?> 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) {
|
||||
|
|
Loading…
Reference in a new issue