diff --git a/OsmAnd/res/drawable-hdpi/ic_type_file.png b/OsmAnd/res/drawable-hdpi/ic_type_file.png
new file mode 100644
index 0000000000..1fc6a16b51
Binary files /dev/null and b/OsmAnd/res/drawable-hdpi/ic_type_file.png differ
diff --git a/OsmAnd/res/drawable-hdpi/list_warnings_tunnel.png b/OsmAnd/res/drawable-hdpi/list_warnings_tunnel.png
new file mode 100644
index 0000000000..04f82eaea6
Binary files /dev/null and b/OsmAnd/res/drawable-hdpi/list_warnings_tunnel.png differ
diff --git a/OsmAnd/res/drawable-hdpi/list_warnings_tunnel_us.png b/OsmAnd/res/drawable-hdpi/list_warnings_tunnel_us.png
new file mode 100644
index 0000000000..b43812a3e9
Binary files /dev/null and b/OsmAnd/res/drawable-hdpi/list_warnings_tunnel_us.png differ
diff --git a/OsmAnd/res/drawable-hdpi/warnings_tunnel.png b/OsmAnd/res/drawable-hdpi/warnings_tunnel.png
new file mode 100644
index 0000000000..b8e1e69c7d
Binary files /dev/null and b/OsmAnd/res/drawable-hdpi/warnings_tunnel.png differ
diff --git a/OsmAnd/res/drawable-hdpi/warnings_tunnel_us.png b/OsmAnd/res/drawable-hdpi/warnings_tunnel_us.png
new file mode 100644
index 0000000000..8c51deaa3d
Binary files /dev/null and b/OsmAnd/res/drawable-hdpi/warnings_tunnel_us.png differ
diff --git a/OsmAnd/res/drawable-mdpi/ic_type_file.png b/OsmAnd/res/drawable-mdpi/ic_type_file.png
new file mode 100644
index 0000000000..23d3b92e12
Binary files /dev/null and b/OsmAnd/res/drawable-mdpi/ic_type_file.png differ
diff --git a/OsmAnd/res/drawable-mdpi/list_warnings_tunnel.png b/OsmAnd/res/drawable-mdpi/list_warnings_tunnel.png
new file mode 100644
index 0000000000..2da91283d0
Binary files /dev/null and b/OsmAnd/res/drawable-mdpi/list_warnings_tunnel.png differ
diff --git a/OsmAnd/res/drawable-mdpi/list_warnings_tunnel_us.png b/OsmAnd/res/drawable-mdpi/list_warnings_tunnel_us.png
new file mode 100644
index 0000000000..f3977586c9
Binary files /dev/null and b/OsmAnd/res/drawable-mdpi/list_warnings_tunnel_us.png differ
diff --git a/OsmAnd/res/drawable-mdpi/warnings_tunnel.png b/OsmAnd/res/drawable-mdpi/warnings_tunnel.png
new file mode 100644
index 0000000000..c3f9a8c9d0
Binary files /dev/null and b/OsmAnd/res/drawable-mdpi/warnings_tunnel.png differ
diff --git a/OsmAnd/res/drawable-mdpi/warnings_tunnel_us.png b/OsmAnd/res/drawable-mdpi/warnings_tunnel_us.png
new file mode 100644
index 0000000000..75a6e7e419
Binary files /dev/null and b/OsmAnd/res/drawable-mdpi/warnings_tunnel_us.png differ
diff --git a/OsmAnd/res/drawable-xhdpi/ic_type_file.png b/OsmAnd/res/drawable-xhdpi/ic_type_file.png
new file mode 100644
index 0000000000..d948783ed9
Binary files /dev/null and b/OsmAnd/res/drawable-xhdpi/ic_type_file.png differ
diff --git a/OsmAnd/res/drawable-xhdpi/list_warnings_tunnel.png b/OsmAnd/res/drawable-xhdpi/list_warnings_tunnel.png
new file mode 100644
index 0000000000..e912550dbb
Binary files /dev/null and b/OsmAnd/res/drawable-xhdpi/list_warnings_tunnel.png differ
diff --git a/OsmAnd/res/drawable-xhdpi/list_warnings_tunnel_us.png b/OsmAnd/res/drawable-xhdpi/list_warnings_tunnel_us.png
new file mode 100644
index 0000000000..c1833eef11
Binary files /dev/null and b/OsmAnd/res/drawable-xhdpi/list_warnings_tunnel_us.png differ
diff --git a/OsmAnd/res/drawable-xhdpi/warnings_tunnel.png b/OsmAnd/res/drawable-xhdpi/warnings_tunnel.png
new file mode 100644
index 0000000000..6aa7050b8b
Binary files /dev/null and b/OsmAnd/res/drawable-xhdpi/warnings_tunnel.png differ
diff --git a/OsmAnd/res/drawable-xhdpi/warnings_tunnel_us.png b/OsmAnd/res/drawable-xhdpi/warnings_tunnel_us.png
new file mode 100644
index 0000000000..cf921af26b
Binary files /dev/null and b/OsmAnd/res/drawable-xhdpi/warnings_tunnel_us.png differ
diff --git a/OsmAnd/res/drawable-xxhdpi/ic_type_file.png b/OsmAnd/res/drawable-xxhdpi/ic_type_file.png
new file mode 100644
index 0000000000..7e85200608
Binary files /dev/null and b/OsmAnd/res/drawable-xxhdpi/ic_type_file.png differ
diff --git a/OsmAnd/res/drawable-xxhdpi/list_warnings_tunnel.png b/OsmAnd/res/drawable-xxhdpi/list_warnings_tunnel.png
new file mode 100644
index 0000000000..58ad1d03b3
Binary files /dev/null and b/OsmAnd/res/drawable-xxhdpi/list_warnings_tunnel.png differ
diff --git a/OsmAnd/res/drawable-xxhdpi/list_warnings_tunnel_us.png b/OsmAnd/res/drawable-xxhdpi/list_warnings_tunnel_us.png
new file mode 100644
index 0000000000..67e91a68ed
Binary files /dev/null and b/OsmAnd/res/drawable-xxhdpi/list_warnings_tunnel_us.png differ
diff --git a/OsmAnd/res/drawable-xxhdpi/warnings_tunnel.png b/OsmAnd/res/drawable-xxhdpi/warnings_tunnel.png
new file mode 100644
index 0000000000..55fc31f26f
Binary files /dev/null and b/OsmAnd/res/drawable-xxhdpi/warnings_tunnel.png differ
diff --git a/OsmAnd/res/drawable-xxhdpi/warnings_tunnel_us.png b/OsmAnd/res/drawable-xxhdpi/warnings_tunnel_us.png
new file mode 100644
index 0000000000..694220aa63
Binary files /dev/null and b/OsmAnd/res/drawable-xxhdpi/warnings_tunnel_us.png differ
diff --git a/OsmAnd/res/layout-land/parking_set_time_limit.xml b/OsmAnd/res/layout-land/parking_set_time_limit.xml
new file mode 100644
index 0000000000..9565af5655
--- /dev/null
+++ b/OsmAnd/res/layout-land/parking_set_time_limit.xml
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/OsmAnd/res/values-ru/phrases.xml b/OsmAnd/res/values-ru/phrases.xml
index 13184a236b..3220e7c2cf 100644
--- a/OsmAnd/res/values-ru/phrases.xml
+++ b/OsmAnd/res/values-ru/phrases.xml
@@ -3726,4 +3726,6 @@
Сельскохозяйственный магазин
+ Магазин каминов
+
diff --git a/OsmAnd/res/values/phrases.xml b/OsmAnd/res/values/phrases.xml
index 91c7c1c70b..dd43fb2776 100644
--- a/OsmAnd/res/values/phrases.xml
+++ b/OsmAnd/res/values/phrases.xml
@@ -3702,5 +3702,6 @@
Agricultural store
+ Fireplace store
diff --git a/OsmAnd/src/net/osmand/aidl/IOsmAndAidlInterface.aidl b/OsmAnd/src/net/osmand/aidl/IOsmAndAidlInterface.aidl
index 78beb7ca96..64410a3f9f 100644
--- a/OsmAnd/src/net/osmand/aidl/IOsmAndAidlInterface.aidl
+++ b/OsmAnd/src/net/osmand/aidl/IOsmAndAidlInterface.aidl
@@ -49,6 +49,8 @@ import net.osmand.aidl.note.StartVideoRecordingParams;
import net.osmand.aidl.note.StartAudioRecordingParams;
import net.osmand.aidl.note.StopRecordingParams;
+import net.osmand.aidl.gpx.RemoveGpxParams;
+
// NOTE: Add new methods at the end of file!!!
interface IOsmAndAidlInterface {
@@ -98,4 +100,5 @@ interface IOsmAndAidlInterface {
boolean navigate(in NavigateParams params);
boolean navigateGpx(in NavigateGpxParams params);
+ boolean removeGpx(in RemoveGpxParams params);
}
\ No newline at end of file
diff --git a/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java b/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java
index 5736d71f13..c5edd678c9 100644
--- a/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java
+++ b/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java
@@ -944,6 +944,7 @@ public class OsmandAidlApi {
app.getRendererRegistry().getCurrentSelectedRenderer(), color);
if (!destinationExists) {
GpxDataItem gpxDataItem = new GpxDataItem(destination, col);
+ gpxDataItem.setApiImported(true);
app.getGpxDatabase().add(gpxDataItem);
} else {
GpxDataItem item = app.getGpxDatabase().getItem(destination);
@@ -1112,6 +1113,7 @@ public class OsmandAidlApi {
if (selectedGpxFile != null) {
app.getSelectedGpxHelper().selectGpxFile(selectedGpxFile.getGpxFile(), false, false);
refreshMap();
+ return true;
}
}
return false;
@@ -1135,6 +1137,21 @@ public class OsmandAidlApi {
return false;
}
+ boolean removeGpx(String fileName) {
+ if (!Algorithms.isEmpty(fileName)) {
+ final File f = app.getAppPath(IndexConstants.GPX_INDEX_DIR + fileName);
+ if (f.exists()) {
+ GpxDataItem item = app.getGpxDatabase().getItem(f);
+ if (item != null && item.isApiImported()) {
+ Algorithms.removeAllFiles(f);
+ app.getGpxDatabase().remove(f);
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
boolean setMapLocation(double latitude, double longitude, int zoom, boolean animated) {
Intent intent = new Intent();
intent.setAction(AIDL_SET_MAP_LOCATION);
diff --git a/OsmAnd/src/net/osmand/aidl/OsmandAidlService.java b/OsmAnd/src/net/osmand/aidl/OsmandAidlService.java
index d7826cdbd0..0b4edf77bf 100644
--- a/OsmAnd/src/net/osmand/aidl/OsmandAidlService.java
+++ b/OsmAnd/src/net/osmand/aidl/OsmandAidlService.java
@@ -15,6 +15,7 @@ import net.osmand.aidl.favorite.group.UpdateFavoriteGroupParams;
import net.osmand.aidl.gpx.ASelectedGpxFile;
import net.osmand.aidl.gpx.HideGpxParams;
import net.osmand.aidl.gpx.ImportGpxParams;
+import net.osmand.aidl.gpx.RemoveGpxParams;
import net.osmand.aidl.gpx.ShowGpxParams;
import net.osmand.aidl.gpx.StartGpxRecordingParams;
import net.osmand.aidl.gpx.StopGpxRecordingParams;
@@ -269,6 +270,14 @@ public class OsmandAidlService extends Service {
return getApi().getActiveGpx(files);
}
+ @Override
+ public boolean removeGpx(RemoveGpxParams params) throws RemoteException {
+ if (params != null && params.getFileName() != null) {
+ return getApi().removeGpx(params.getFileName());
+ }
+ return false;
+ }
+
@Override
public boolean setMapLocation(SetMapLocationParams params) throws RemoteException {
if (params != null) {
diff --git a/OsmAnd/src/net/osmand/aidl/gpx/RemoveGpxParams.aidl b/OsmAnd/src/net/osmand/aidl/gpx/RemoveGpxParams.aidl
new file mode 100644
index 0000000000..e9025f7a19
--- /dev/null
+++ b/OsmAnd/src/net/osmand/aidl/gpx/RemoveGpxParams.aidl
@@ -0,0 +1,3 @@
+package net.osmand.aidl.gpx;
+
+parcelable RemoveGpxParams;
\ No newline at end of file
diff --git a/OsmAnd/src/net/osmand/aidl/gpx/RemoveGpxParams.java b/OsmAnd/src/net/osmand/aidl/gpx/RemoveGpxParams.java
new file mode 100644
index 0000000000..2253fa3616
--- /dev/null
+++ b/OsmAnd/src/net/osmand/aidl/gpx/RemoveGpxParams.java
@@ -0,0 +1,48 @@
+package net.osmand.aidl.gpx;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+public class RemoveGpxParams implements Parcelable {
+
+ private String fileName;
+
+ public RemoveGpxParams(String fileName) {
+ this.fileName = fileName;
+ }
+
+ public RemoveGpxParams(Parcel in) {
+ readFromParcel(in);
+ }
+
+ public static final Creator CREATOR = new
+ Creator() {
+ @Override
+ public RemoveGpxParams createFromParcel(Parcel in) {
+ return new RemoveGpxParams(in);
+ }
+
+ @Override
+ public RemoveGpxParams[] newArray(int size) {
+ return new RemoveGpxParams[size];
+ }
+ };
+
+ public String getFileName() {
+ return fileName;
+ }
+
+ @Override
+ public void writeToParcel(Parcel out, int flags) {
+ out.writeString(fileName);
+ }
+
+ private void readFromParcel(Parcel in) {
+ fileName = in.readString();
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+}
diff --git a/OsmAnd/src/net/osmand/plus/GPXDatabase.java b/OsmAnd/src/net/osmand/plus/GPXDatabase.java
index a4dc6305f7..a037e31a65 100644
--- a/OsmAnd/src/net/osmand/plus/GPXDatabase.java
+++ b/OsmAnd/src/net/osmand/plus/GPXDatabase.java
@@ -15,7 +15,7 @@ import java.util.List;
public class GPXDatabase {
private static final String DB_NAME = "gpx_database";
- private static final int DB_VERSION = 5;
+ private static final int DB_VERSION = 6;
private static final String GPX_TABLE_NAME = "gpxTable";
private static final String GPX_COL_NAME = "fileName";
private static final String GPX_COL_DIR = "fileDir";
@@ -45,6 +45,8 @@ public class GPXDatabase {
private static final String GPX_COL_SPLIT_TYPE = "splitType";
private static final String GPX_COL_SPLIT_INTERVAL = "splitInterval";
+ private static final String GPX_COL_API_IMPORTED = "apiImported";
+
public static final int GPX_SPLIT_TYPE_NO_SPLIT = -1;
public static final int GPX_SPLIT_TYPE_DISTANCE = 1;
public static final int GPX_SPLIT_TYPE_TIME = 2;
@@ -74,7 +76,8 @@ public class GPXDatabase {
GPX_COL_COLOR + " TEXT, " +
GPX_COL_FILE_LAST_MODIFIED_TIME + " long, " +
GPX_COL_SPLIT_TYPE + " int, " +
- GPX_COL_SPLIT_INTERVAL + " double);";
+ GPX_COL_SPLIT_INTERVAL + " double, " +
+ GPX_COL_API_IMPORTED + " int);"; // 1 = true, 0 = false
private static final String GPX_TABLE_SELECT = "SELECT " +
GPX_COL_NAME + ", " +
@@ -98,7 +101,8 @@ public class GPXDatabase {
GPX_COL_COLOR + ", " +
GPX_COL_FILE_LAST_MODIFIED_TIME + ", " +
GPX_COL_SPLIT_TYPE + ", " +
- GPX_COL_SPLIT_INTERVAL +
+ GPX_COL_SPLIT_INTERVAL + ", " +
+ GPX_COL_API_IMPORTED +
" FROM " + GPX_TABLE_NAME;
private OsmandApplication context;
@@ -110,6 +114,7 @@ public class GPXDatabase {
private long fileLastModifiedTime;
private int splitType;
private double splitInterval;
+ private boolean apiImported;
public GpxDataItem(File file, GPXTrackAnalysis analysis) {
this.file = file;
@@ -144,6 +149,14 @@ public class GPXDatabase {
public double getSplitInterval() {
return splitInterval;
}
+
+ public boolean isApiImported() {
+ return apiImported;
+ }
+
+ public void setApiImported(boolean apiImported) {
+ this.apiImported = apiImported;
+ }
}
public GPXDatabase(OsmandApplication app) {
@@ -224,6 +237,13 @@ public class GPXDatabase {
db.execSQL("ALTER TABLE " + GPX_TABLE_NAME + " ADD " + GPX_COL_SPLIT_INTERVAL + " double");
}
}
+
+ if (oldVersion < 6) {
+ db.execSQL("ALTER TABLE " + GPX_TABLE_NAME + " ADD " + GPX_COL_API_IMPORTED + " int");
+ db.execSQL("UPDATE " + GPX_TABLE_NAME +
+ " SET " + GPX_COL_API_IMPORTED + " = ? " +
+ "WHERE " + GPX_COL_API_IMPORTED + " IS NULL", new Object[]{0});
+ }
}
private boolean updateLastModifiedTime(GpxDataItem item) {
@@ -362,16 +382,22 @@ public class GPXDatabase {
}
if (a != null) {
db.execSQL(
- "INSERT INTO " + GPX_TABLE_NAME + " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
+ "INSERT INTO " + GPX_TABLE_NAME + " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
new Object[]{ fileName, fileDir, a.totalDistance, a.totalTracks, a.startTime, a.endTime,
a.timeSpan, a.timeMoving, a.totalDistanceMoving, a.diffElevationUp, a.diffElevationDown,
a.avgElevation, a.minElevation, a.maxElevation, a.maxSpeed, a.avgSpeed, a.points, a.wptPoints,
- color, item.file.lastModified(), item.splitType, item.splitInterval });
+ color, item.file.lastModified(), item.splitType, item.splitInterval, item.apiImported ? 1 : 0});
} else {
- db.execSQL(
- "INSERT INTO " + GPX_TABLE_NAME + "(" + GPX_COL_NAME + ", " + GPX_COL_DIR + ", " +
- GPX_COL_COLOR + ", " + GPX_COL_FILE_LAST_MODIFIED_TIME + ", " + GPX_COL_SPLIT_TYPE + ", " + GPX_COL_SPLIT_INTERVAL + ") VALUES (?, ?, ?, ?, ?, ?)",
- new Object[]{ fileName, fileDir, color, 0, item.splitType, item.splitInterval });
+ db.execSQL("INSERT INTO " + GPX_TABLE_NAME + "(" +
+ GPX_COL_NAME + ", " +
+ GPX_COL_DIR + ", " +
+ GPX_COL_COLOR + ", " +
+ GPX_COL_FILE_LAST_MODIFIED_TIME + ", " +
+ GPX_COL_SPLIT_TYPE + ", " +
+ GPX_COL_SPLIT_INTERVAL + ", " +
+ GPX_COL_API_IMPORTED +
+ ") VALUES (?, ?, ?, ?, ?, ?, ?)",
+ new Object[]{fileName, fileDir, color, 0, item.splitType, item.splitInterval, item.apiImported ? 1 : 0});
}
}
@@ -436,6 +462,7 @@ public class GPXDatabase {
long fileLastModifiedTime = query.getLong(19);
int splitType = (int)query.getInt(20);
double splitInterval = query.getDouble(21);
+ boolean apiImported = query.getInt(22) == 1;
GPXTrackAnalysis a = new GPXTrackAnalysis();
a.totalDistance = totalDistance;
@@ -471,6 +498,7 @@ public class GPXDatabase {
item.fileLastModifiedTime = fileLastModifiedTime;
item.splitType = splitType;
item.splitInterval = splitInterval;
+ item.apiImported = apiImported;
return item;
}
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/BaseMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/BaseMenuController.java
index 0d7cb6393e..bd2323d4ef 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/BaseMenuController.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/BaseMenuController.java
@@ -51,7 +51,7 @@ public abstract class BaseMenuController {
}
public float getHalfScreenMaxHeightKoef() {
- return .7f;
+ return .75f;
}
public int getSlideInAnimation() {
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java
index 6638225c95..6a17c4b1a9 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java
@@ -521,6 +521,13 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
}, timeout);
}
+ public void updateLayout() {
+ WeakReference fragmentRef = findMenuFragment();
+ if (fragmentRef != null) {
+ fragmentRef.get().updateLayout();
+ }
+ }
+
public void updateMenuUI() {
WeakReference fragmentRef = findMenuFragment();
if (fragmentRef != null) {
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java
index 66311a283b..f9d3980cf5 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java
@@ -98,6 +98,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
private int markerPaddingPx;
private int markerPaddingXPx;
+ private int topScreenPosY;
private OsmandMapTileView map;
private LatLon mapCenter;
@@ -112,7 +113,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
private boolean wasDrawerDisabled;
private boolean zoomIn;
- private float skipHalfScreenStateLimit;
+ private float skipScreenStateLimit;
private int screenOrientation;
private boolean created;
@@ -125,6 +126,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
markerPaddingPx = dpToPx(MARKER_PADDING_DP);
markerPaddingXPx = dpToPx(MARKER_PADDING_X_DP);
+ topScreenPosY = addStatusBarHeightIfNeeded(-dpToPx(SHADOW_HEIGHT_TOP_DP));
menu = getMapActivity().getContextMenu();
view = inflater.inflate(R.layout.map_context_menu_fragment, container, false);
@@ -270,11 +272,10 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
openMenuHalfScreen();
return true;
}
-
- if (menu.isLandscapeLayout()) {
- if (swipeDetector.onTouchEvent(event)) {
- menu.close();
- }
+ }
+ if (menu.isLandscapeLayout()) {
+ if (swipeDetector.onTouchEvent(event)) {
+ menu.close();
return true;
}
}
@@ -299,6 +300,9 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
hasMoved = true;
float y = event.getY();
float newY = getViewY() + (y - dy);
+ if (menu.isLandscapeLayout() && newY > 0) {
+ newY = 0;
+ }
setViewY((int) newY, false, false);
menuFullHeight = view.getHeight() - (int) newY + 10;
@@ -307,11 +311,14 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
mainView.setLayoutParams(lp);
mainView.requestLayout();
- velocity.addMovement(event);
- velocity.computeCurrentVelocity(1000);
- velocityY = Math.abs(velocity.getYVelocity());
- if (velocityY > maxVelocityY)
- maxVelocityY = velocityY;
+ if (velocity != null) {
+ velocity.addMovement(event);
+ velocity.computeCurrentVelocity(1000);
+ velocityY = Math.abs(velocity.getYVelocity());
+ if (velocityY > maxVelocityY) {
+ maxVelocityY = velocityY;
+ }
+ }
}
break;
@@ -325,10 +332,12 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
slidingUp = Math.abs(maxVelocityY) > 500 && (currentY - dyMain) < -50;
slidingDown = Math.abs(maxVelocityY) > 500 && (currentY - dyMain) > 50;
- velocity.recycle();
+ if (velocity != null) {
+ velocity.recycle();
+ }
- boolean skipHalfScreenState = Math.abs(currentY - dyMain) > skipHalfScreenStateLimit;
- changeMenuState(currentY, skipHalfScreenState, slidingUp, slidingDown);
+ boolean skipScreenState = Math.abs(currentY - dyMain) > skipScreenStateLimit;
+ changeMenuState(currentY, skipScreenState, slidingUp, slidingDown);
}
break;
@@ -487,7 +496,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
detailsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- menu.openMenuFullScreen();
+ openMenuHalfScreen();
}
});
TextView directionsButton = (TextView) view.findViewById(R.id.context_menu_directions_button);
@@ -543,7 +552,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
if (showShowHideButton) {
openMenuHeaderOnly();
} else {
- openMenuFullScreen();
+ openMenuHalfScreen();
}
}
});
@@ -575,7 +584,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
private void processScreenHeight(ViewParent parent) {
View container = (View)parent;
screenHeight = container.getHeight() + AndroidUtils.getStatusBarHeight(getActivity());
- skipHalfScreenStateLimit = screenHeight * SKIP_HALF_SCREEN_STATE_KOEF;
+ skipScreenStateLimit = screenHeight * SKIP_HALF_SCREEN_STATE_KOEF;
viewHeight = screenHeight - AndroidUtils.getStatusBarHeight(getMapActivity());
}
@@ -596,20 +605,25 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
}
}
- private void changeMenuState(int currentY, boolean skipHalfScreenState,
+ private void changeMenuState(int currentY, boolean skipScreenState,
boolean slidingUp, boolean slidingDown) {
boolean needCloseMenu = false;
int oldMenuState = menu.getCurrentMenuState();
- if (menuBottomViewHeight > 0 && slidingUp) {
- menu.slideUp();
- if (skipHalfScreenState) {
- menu.slideUp();
+ if (!menu.isLandscapeLayout()) {
+ if (slidingDown && !skipScreenState && oldMenuState == MenuState.FULL_SCREEN && currentY < topScreenPosY) {
+ slidingDown = false;
}
- } else if (slidingDown) {
- needCloseMenu = !menu.slideDown();
- if (!needCloseMenu && skipHalfScreenState) {
- menu.slideDown();
+ if (menuBottomViewHeight > 0 && slidingUp) {
+ menu.slideUp();
+ if (skipScreenState) {
+ menu.slideUp();
+ }
+ } else if (slidingDown) {
+ needCloseMenu = !menu.slideDown();
+ if (!needCloseMenu && skipScreenState) {
+ menu.slideDown();
+ }
}
}
int newMenuState = menu.getCurrentMenuState();
@@ -1240,6 +1254,19 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
}
}
+ private void updateZoomButtonsVisibility(int menuState) {
+ boolean zoomButtonsVisible = menu.zoomButtonsVisible() && menuState == MenuState.HEADER_ONLY;
+ if (zoomButtonsVisible) {
+ if (zoomButtonsView.getVisibility() != View.VISIBLE) {
+ zoomButtonsView.setVisibility(View.VISIBLE);
+ }
+ } else {
+ if (zoomButtonsView.getVisibility() == View.VISIBLE) {
+ zoomButtonsView.setVisibility(View.INVISIBLE);
+ }
+ }
+ }
+
private int getPosY() {
return getPosY(CURRENT_Y_UNDEFINED, false);
}
@@ -1256,22 +1283,23 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
minHalfY = viewHeight - (int) (viewHeight * menu.getHalfScreenMaxHeightKoef());
} else {
destinationState = MenuState.HEADER_ONLY;
- minHalfY = viewHeight;
+ minHalfY = viewHeight - (int) (viewHeight * .75f);
}
+ updateZoomButtonsVisibility(destinationState);
+
int posY = 0;
switch (destinationState) {
case MenuState.HEADER_ONLY:
posY = viewHeight - menuTitleHeight;
break;
case MenuState.HALF_SCREEN:
- posY = viewHeight - menuFullHeightMax;
- posY = Math.max(posY, minHalfY);
+ posY = minHalfY;
break;
case MenuState.FULL_SCREEN:
if (currentY != CURRENT_Y_UNDEFINED) {
int maxPosY = viewHeight - menuFullHeightMax;
- int minPosY = Math.max(maxPosY, minHalfY);
+ int minPosY = topScreenPosY;
if (maxPosY > minPosY) {
maxPosY = minPosY;
}
@@ -1283,8 +1311,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
posY = currentY;
}
} else {
- posY = -dpToPx(SHADOW_HEIGHT_TOP_DP);
- posY = addStatusBarHeightIfNeeded(posY);
+ posY = topScreenPosY;
}
break;
default:
@@ -1417,7 +1444,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
}
private void doLayoutMenu() {
- final int posY = getPosY();
+ final int posY = getPosY(getViewY(), false);
setViewY(posY, true, !initLayout || !centered);
updateMainViewLayout(posY);
}
@@ -1432,6 +1459,10 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
}
}
+ public void updateLayout() {
+ runLayoutListener();
+ }
+
public void refreshTitle() {
setAddressLocation();
runLayoutListener();
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java
index 995fd76267..a795e68072 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java
@@ -95,10 +95,16 @@ public class MenuBuilder {
private CardsRowBuilder onlinePhotoCardsRow;
private List onlinePhotoCards;
+ private CollapseExpandListener collapseExpandListener;
+
private String preferredMapLang;
private String preferredMapAppLang;
private boolean transliterateNames;
+ public interface CollapseExpandListener {
+ void onCollapseExpand(boolean collapsed);
+ }
+
public class PlainMenuItem {
private int iconId;
private String buttonText;
@@ -158,22 +164,22 @@ public class MenuBuilder {
public static class CollapsableView {
private View contenView;
+ private MenuBuilder menuBuilder;
private OsmandPreference collapsedPref;
private boolean collapsed;
- private OnCollExpListener onCollExpListener;
+ private CollapseExpandListener collapseExpandListener;
- public interface OnCollExpListener {
- void onCollapseExpand(boolean collapsed);
- }
-
- public CollapsableView(@NonNull View contenView, @NonNull OsmandPreference collapsedPref) {
+ public CollapsableView(@NonNull View contenView, @NonNull MenuBuilder menuBuilder,
+ @NonNull OsmandPreference collapsedPref) {
this.contenView = contenView;
+ this.menuBuilder = menuBuilder;
this.collapsedPref = collapsedPref;
}
- public CollapsableView(@NonNull View contenView, boolean collapsed) {
+ public CollapsableView(@NonNull View contenView, @NonNull MenuBuilder menuBuilder, boolean collapsed) {
this.contenView = contenView;
this.collapsed = collapsed;
+ this.menuBuilder = menuBuilder;
}
public View getContenView() {
@@ -194,17 +200,20 @@ public class MenuBuilder {
} else {
this.collapsed = collapsed;
}
- if (onCollExpListener != null) {
- onCollExpListener.onCollapseExpand(collapsed);
+ if (collapseExpandListener != null) {
+ collapseExpandListener.onCollapseExpand(collapsed);
+ }
+ if (menuBuilder.collapseExpandListener != null) {
+ menuBuilder.collapseExpandListener.onCollapseExpand(collapsed);
}
}
- public OnCollExpListener getOnCollExpListener() {
- return onCollExpListener;
+ public CollapseExpandListener getCollapseExpandListener() {
+ return collapseExpandListener;
}
- public void setOnCollExpListener(OnCollExpListener onCollExpListener) {
- this.onCollExpListener = onCollExpListener;
+ public void setCollapseExpandListener(CollapseExpandListener collapseExpandListener) {
+ this.collapseExpandListener = collapseExpandListener;
}
}
@@ -221,6 +230,10 @@ public class MenuBuilder {
transliterateNames = app.getSettings().MAP_TRANSLITERATE_NAMES.get();
}
+ public void setCollapseExpandListener(CollapseExpandListener collapseExpandListener) {
+ this.collapseExpandListener = collapseExpandListener;
+ }
+
public void setRoutes(List routes) {
this.routes = routes;
}
@@ -378,9 +391,9 @@ public class MenuBuilder {
boolean needUpdateOnly = onlinePhotoCardsRow != null && onlinePhotoCardsRow.getMenuBuilder() == this;
onlinePhotoCardsRow = new CardsRowBuilder(this, view, false);
onlinePhotoCardsRow.build();
- CollapsableView collapsableView = new CollapsableView(onlinePhotoCardsRow.getContentView(),
+ CollapsableView collapsableView = new CollapsableView(onlinePhotoCardsRow.getContentView(), this,
app.getSettings().ONLINE_PHOTOS_ROW_COLLAPSED);
- collapsableView.setOnCollExpListener(new CollapsableView.OnCollExpListener() {
+ collapsableView.setCollapseExpandListener(new CollapseExpandListener() {
@Override
public void onCollapseExpand(boolean collapsed) {
if (!collapsed && onlinePhotoCards == null) {
@@ -584,13 +597,13 @@ public class MenuBuilder {
@Override
public void onClick(View v) {
if (collapsableView.getContenView().getVisibility() == View.VISIBLE) {
- collapsableView.setCollapsed(true);
collapsableView.getContenView().setVisibility(View.GONE);
iconViewCollapse.setImageDrawable(getCollapseIcon(true));
+ collapsableView.setCollapsed(true);
} else {
- collapsableView.setCollapsed(false);
collapsableView.getContenView().setVisibility(View.VISIBLE);
iconViewCollapse.setImageDrawable(getCollapseIcon(false));
+ collapsableView.setCollapsed(false);
}
}
});
@@ -844,7 +857,7 @@ public class MenuBuilder {
buildTransportRouteRow(view, r, listener, showDivider);
}
- return new CollapsableView(view, collapsed);
+ return new CollapsableView(view, this, collapsed);
}
protected CollapsableView getCollapsableTextView(Context context, boolean collapsed, String text) {
@@ -857,7 +870,7 @@ public class MenuBuilder {
textView.setTextSize(16);
textView.setTextColor(app.getResources().getColor(light ? R.color.ctx_menu_bottom_view_text_color_light : R.color.ctx_menu_bottom_view_text_color_dark));
textView.setText(text);
- return new CollapsableView(textView, collapsed);
+ return new CollapsableView(textView, this, collapsed);
}
protected CollapsableView getCollapsableFavouritesView(final Context context, boolean collapsed, @NonNull final FavoriteGroup group, FavouritePoint selectedPoint) {
@@ -901,7 +914,7 @@ public class MenuBuilder {
view.addView(button);
}
- return new CollapsableView(view, collapsed);
+ return new CollapsableView(view, this, collapsed);
}
protected CollapsableView getCollapsableWaypointsView(final Context context, boolean collapsed, @NonNull final GPXFile gpxFile, WptPt selectedPoint) {
@@ -944,7 +957,7 @@ public class MenuBuilder {
view.addView(button);
}
- return new CollapsableView(view, collapsed);
+ return new CollapsableView(view, this, collapsed);
}
protected CollapsableView getCollapsableWikiView(Context context, boolean collapsed) {
@@ -966,7 +979,7 @@ public class MenuBuilder {
view.addView(button);
}
- return new CollapsableView(view, collapsed);
+ return new CollapsableView(view, this, collapsed);
}
protected LinearLayout buildCollapsableContentView(Context context, boolean collapsed, boolean needMargin) {
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java
index 9491e2daec..be62359549 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java
@@ -42,6 +42,7 @@ import net.osmand.plus.download.DownloadIndexesThread;
import net.osmand.plus.download.DownloadValidationManager;
import net.osmand.plus.download.IndexItem;
import net.osmand.plus.helpers.SearchHistoryHelper;
+import net.osmand.plus.mapcontextmenu.MenuBuilder.CollapseExpandListener;
import net.osmand.plus.mapcontextmenu.controllers.AMapPointMenuController;
import net.osmand.plus.mapcontextmenu.controllers.AmenityMenuController;
import net.osmand.plus.mapcontextmenu.controllers.FavouritePointMenuController;
@@ -81,7 +82,7 @@ import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
-public abstract class MenuController extends BaseMenuController {
+public abstract class MenuController extends BaseMenuController implements CollapseExpandListener {
public static class MenuState {
public static final int HEADER_ONLY = 1;
@@ -124,10 +125,46 @@ public abstract class MenuController extends BaseMenuController {
super(mapActivity);
this.pointDescription = pointDescription;
this.builder = builder;
+ this.builder.setCollapseExpandListener(this);
this.currentMenuState = getInitialMenuState();
this.builder.setLight(isLight());
}
+ public void onCreated() {
+ /*
+ toolbarController = new ContextMenuToolbarController(this);
+ toolbarController.setTitle(getNameStr());
+ toolbarController.setOnBackButtonClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (mapContextMenu != null) {
+ mapContextMenu.backToolbarAction(MenuController.this);
+ }
+ }
+ });
+ toolbarController.setOnTitleClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ }
+ });
+ toolbarController.setOnCloseButtonClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (mapContextMenu != null) {
+ mapContextMenu.close();
+ }
+ }
+ });
+ */
+ }
+
+ @Override
+ public void onCollapseExpand(boolean collapsed) {
+ if (mapContextMenu != null) {
+ mapContextMenu.updateMenuUI();
+ }
+ }
+
public String getPreferredMapLang() {
return builder.getPreferredMapLang();
}
@@ -208,6 +245,7 @@ public abstract class MenuController extends BaseMenuController {
}
menuController.menuType = menuType;
menuController.setLatLon(latLon);
+ menuController.onCreated();
return menuController;
}
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java
index 19d176fe5f..7529738871 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java
@@ -200,13 +200,13 @@ public class AmenityMenuBuilder extends MenuBuilder {
@Override
public void onClick(View v) {
if (collapsableView.getContenView().getVisibility() == View.VISIBLE) {
- collapsableView.setCollapsed(true);
collapsableView.getContenView().setVisibility(View.GONE);
iconViewCollapse.setImageDrawable(getCollapseIcon(true));
+ collapsableView.setCollapsed(true);
} else {
- collapsableView.setCollapsed(false);
collapsableView.getContenView().setVisibility(View.VISIBLE);
iconViewCollapse.setImageDrawable(getCollapseIcon(false));
+ collapsableView.setCollapsed(false);
}
}
});
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java
index 5d0df3abc6..2b51c08ac7 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java
@@ -25,6 +25,7 @@ import net.osmand.plus.download.DownloadIndexesThread;
import net.osmand.plus.download.DownloadValidationManager;
import net.osmand.plus.download.IndexItem;
import net.osmand.plus.helpers.FileNameTranslationHelper;
+import net.osmand.plus.liveupdates.LiveUpdatesHelper;
import net.osmand.plus.mapcontextmenu.MenuBuilder;
import net.osmand.plus.mapcontextmenu.MenuController;
import net.osmand.plus.srtmplugin.SRTMPlugin;
@@ -107,9 +108,10 @@ public class MapDataMenuController extends MenuController {
Toast.makeText(mapActivity, mapActivity.getString(R.string.activate_srtm_plugin),
Toast.LENGTH_SHORT).show();
}
- } else {
- new DownloadValidationManager(getMapActivity().getMyApplication())
- .startDownload(getMapActivity(), indexItem);
+ } else if (!downloaded || indexItem.isOutdated()) {
+ new DownloadValidationManager(app).startDownload(mapActivity, indexItem);
+ } else if (isLiveUpdatesOn()) {
+ LiveUpdatesHelper.runLiveUpdate(mapActivity, indexItem.getTargetFileName(), true);
}
}
}
@@ -179,6 +181,10 @@ public class MapDataMenuController extends MenuController {
updateData();
}
+ private boolean isLiveUpdatesOn() {
+ return getMapActivity().getMyApplication().getSettings().IS_LIVE_UPDATES_ON.get();
+ }
+
@Override
public boolean displayDistanceDirection() {
return true;
@@ -380,6 +386,8 @@ public class MapDataMenuController extends MenuController {
leftDownloadButtonController.caption = getMapActivity().getString(R.string.shared_string_update);
} else if (!downloaded) {
leftDownloadButtonController.caption = getMapActivity().getString(R.string.shared_string_download);
+ } else if (isLiveUpdatesOn()) {
+ leftDownloadButtonController.caption = getMapActivity().getString(R.string.live_update);
} else {
leftDownloadButtonController.visible = false;
}
diff --git a/OsmAnd/src/net/osmand/plus/mapillary/MapillaryImageDialog.java b/OsmAnd/src/net/osmand/plus/mapillary/MapillaryImageDialog.java
index 775ae2b11c..950a01ee3c 100644
--- a/OsmAnd/src/net/osmand/plus/mapillary/MapillaryImageDialog.java
+++ b/OsmAnd/src/net/osmand/plus/mapillary/MapillaryImageDialog.java
@@ -12,11 +12,7 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
-import android.webkit.ConsoleMessage;
import android.webkit.JavascriptInterface;
-import android.webkit.WebChromeClient;
-import android.webkit.WebResourceError;
-import android.webkit.WebResourceRequest;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
@@ -237,7 +233,7 @@ public class MapillaryImageDialog extends ContextMenuCardDialog {
view.setLayoutParams(lp);
webView.setWebViewClient(new WebViewClient() {
@Override
- public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
+ public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
webView.loadUrl("about:blank");
noInternetView.setVisibility(View.VISIBLE);
}