parent
3d8110c696
commit
00ef735807
5 changed files with 44 additions and 27 deletions
|
@ -550,7 +550,11 @@ public class TileSourceManager {
|
||||||
|
|
||||||
private static String findOneTile(File dir) {
|
private static String findOneTile(File dir) {
|
||||||
if (dir.isDirectory()) {
|
if (dir.isDirectory()) {
|
||||||
for (File file : dir.listFiles()) {
|
File[] files = dir.listFiles();
|
||||||
|
if (files == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
for (File file : files) {
|
||||||
if (file.isDirectory()) {
|
if (file.isDirectory()) {
|
||||||
String ext = findOneTile(file);
|
String ext = findOneTile(file);
|
||||||
if (ext != null) {
|
if (ext != null) {
|
||||||
|
|
|
@ -16,6 +16,7 @@ import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.plus.FavouritesDbHelper;
|
import net.osmand.plus.FavouritesDbHelper;
|
||||||
import net.osmand.plus.FavouritesDbHelper.FavoritesListener;
|
import net.osmand.plus.FavouritesDbHelper.FavoritesListener;
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.base.FavoriteImageDrawable;
|
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||||
|
@ -94,8 +95,11 @@ public class DashFavoritesFragment extends DashLocationFragment {
|
||||||
|
|
||||||
public void setupFavorites() {
|
public void setupFavorites() {
|
||||||
View mainView = getView();
|
View mainView = getView();
|
||||||
final FavouritesDbHelper helper = getMyApplication().getFavorites();
|
OsmandApplication app = getMyApplication();
|
||||||
points = new ArrayList<FavouritePoint>(helper.getFavouritePoints());
|
if (mainView == null || app == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
points = new ArrayList<FavouritePoint>(app.getFavorites().getFavouritePoints());
|
||||||
if (points.size() == 0) {
|
if (points.size() == 0) {
|
||||||
(mainView.findViewById(R.id.main_fav)).setVisibility(View.GONE);
|
(mainView.findViewById(R.id.main_fav)).setVisibility(View.GONE);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -71,11 +71,9 @@ import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.text.MessageFormat;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
@ -833,7 +831,9 @@ public class DownloadActivity extends AbstractDownloadActivity implements Downlo
|
||||||
.setOnClickListener(new OnClickListener() {
|
.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
OsmandApplication app = (OsmandApplication) getActivity().getApplication();
|
FragmentActivity activity = getActivity();
|
||||||
|
if (activity != null && regionCenter != null) {
|
||||||
|
OsmandApplication app = (OsmandApplication) activity.getApplication();
|
||||||
app.getSettings().setMapLocationToShow(
|
app.getSettings().setMapLocationToShow(
|
||||||
regionCenter.getLatitude(),
|
regionCenter.getLatitude(),
|
||||||
regionCenter.getLongitude(),
|
regionCenter.getLongitude(),
|
||||||
|
@ -841,7 +841,8 @@ public class DownloadActivity extends AbstractDownloadActivity implements Downlo
|
||||||
new PointDescription(PointDescription.POINT_TYPE_WORLD_REGION_SHOW_ON_MAP, ""));
|
new PointDescription(PointDescription.POINT_TYPE_WORLD_REGION_SHOW_ON_MAP, ""));
|
||||||
|
|
||||||
dismiss();
|
dismiss();
|
||||||
MapActivity.launchMapActivityMoveToTop(getActivity());
|
MapActivity.launchMapActivityMoveToTop(activity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
package net.osmand.plus.measurementtool;
|
package net.osmand.plus.measurementtool;
|
||||||
|
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
|
|
||||||
|
import net.osmand.GPXUtilities.TrkSegment;
|
||||||
|
import net.osmand.GPXUtilities.WptPt;
|
||||||
import net.osmand.Location;
|
import net.osmand.Location;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.plus.ApplicationMode;
|
import net.osmand.plus.ApplicationMode;
|
||||||
import net.osmand.GPXUtilities.TrkSegment;
|
|
||||||
import net.osmand.GPXUtilities.WptPt;
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.measurementtool.command.MeasurementCommandManager;
|
import net.osmand.plus.measurementtool.command.MeasurementCommandManager;
|
||||||
import net.osmand.plus.routing.RouteCalculationParams;
|
import net.osmand.plus.routing.RouteCalculationParams;
|
||||||
|
@ -212,8 +213,10 @@ public class MeasurementEditingContext {
|
||||||
snapToRoadPairsToCalculate.clear();
|
snapToRoadPairsToCalculate.clear();
|
||||||
findPointsToCalculate(Arrays.asList(before.points, after.points));
|
findPointsToCalculate(Arrays.asList(before.points, after.points));
|
||||||
RoutingHelper routingHelper = application.getRoutingHelper();
|
RoutingHelper routingHelper = application.getRoutingHelper();
|
||||||
if (!snapToRoadPairsToCalculate.isEmpty() && progressListener != null && !routingHelper.isRouteBeingCalculated()) {
|
if (progressListener != null && !routingHelper.isRouteBeingCalculated()) {
|
||||||
routingHelper.startRouteCalculationThread(getParams(), true, true);
|
RouteCalculationParams params = getParams();
|
||||||
|
if (params != null) {
|
||||||
|
routingHelper.startRouteCalculationThread(params, true, true);
|
||||||
application.runInUIThread(new Runnable() {
|
application.runInUIThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -222,6 +225,7 @@ public class MeasurementEditingContext {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void findPointsToCalculate(List<List<WptPt>> pointsList) {
|
private void findPointsToCalculate(List<List<WptPt>> pointsList) {
|
||||||
for (List<WptPt> points : pointsList) {
|
for (List<WptPt> points : pointsList) {
|
||||||
|
@ -270,9 +274,12 @@ public class MeasurementEditingContext {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
private RouteCalculationParams getParams() {
|
private RouteCalculationParams getParams() {
|
||||||
final Pair<WptPt, WptPt> currentPair = snapToRoadPairsToCalculate.poll();
|
final Pair<WptPt, WptPt> currentPair = snapToRoadPairsToCalculate.poll();
|
||||||
|
if (currentPair == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
Location start = new Location("");
|
Location start = new Location("");
|
||||||
start.setLatitude(currentPair.first.getLatitude());
|
start.setLatitude(currentPair.first.getLatitude());
|
||||||
start.setLongitude(currentPair.first.getLongitude());
|
start.setLongitude(currentPair.first.getLongitude());
|
||||||
|
@ -341,8 +348,9 @@ public class MeasurementEditingContext {
|
||||||
progressListener.refresh();
|
progressListener.refresh();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (!snapToRoadPairsToCalculate.isEmpty()) {
|
RouteCalculationParams params = getParams();
|
||||||
application.getRoutingHelper().startRouteCalculationThread(getParams(), true, true);
|
if (params != null) {
|
||||||
|
application.getRoutingHelper().startRouteCalculationThread(params, true, true);
|
||||||
} else {
|
} else {
|
||||||
application.runInUIThread(new Runnable() {
|
application.runInUIThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -454,7 +454,7 @@ public class DataStorageFragment extends BaseSettingsFragment implements DataSto
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void reloadData() {
|
protected void reloadData() {
|
||||||
new ReloadData(activity, getMyApplication()).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void) null);
|
new ReloadData(activity, app).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void) null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue