Merge remote-tracking branch 'origin/master'
BIN
OsmAnd/res/drawable-hdpi/ic_type_file.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
OsmAnd/res/drawable-hdpi/list_warnings_tunnel.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
OsmAnd/res/drawable-hdpi/list_warnings_tunnel_us.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
OsmAnd/res/drawable-hdpi/warnings_tunnel.png
Normal file
After Width: | Height: | Size: 6.5 KiB |
BIN
OsmAnd/res/drawable-hdpi/warnings_tunnel_us.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
OsmAnd/res/drawable-mdpi/ic_type_file.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
OsmAnd/res/drawable-mdpi/list_warnings_tunnel.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
OsmAnd/res/drawable-mdpi/list_warnings_tunnel_us.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
OsmAnd/res/drawable-mdpi/warnings_tunnel.png
Normal file
After Width: | Height: | Size: 4.4 KiB |
BIN
OsmAnd/res/drawable-mdpi/warnings_tunnel_us.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
OsmAnd/res/drawable-xhdpi/ic_type_file.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
OsmAnd/res/drawable-xhdpi/list_warnings_tunnel.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
OsmAnd/res/drawable-xhdpi/list_warnings_tunnel_us.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
OsmAnd/res/drawable-xhdpi/warnings_tunnel.png
Normal file
After Width: | Height: | Size: 8.8 KiB |
BIN
OsmAnd/res/drawable-xhdpi/warnings_tunnel_us.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
OsmAnd/res/drawable-xxhdpi/ic_type_file.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
OsmAnd/res/drawable-xxhdpi/list_warnings_tunnel.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
OsmAnd/res/drawable-xxhdpi/list_warnings_tunnel_us.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
OsmAnd/res/drawable-xxhdpi/warnings_tunnel.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
OsmAnd/res/drawable-xxhdpi/warnings_tunnel_us.png
Normal file
After Width: | Height: | Size: 6.9 KiB |
61
OsmAnd/res/layout-land/parking_set_time_limit.xml
Normal file
|
@ -0,0 +1,61 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/dialog_content_bottom_margin"
|
||||
android:paddingLeft="@dimen/dialog_content_margin"
|
||||
android:paddingRight="@dimen/dialog_content_margin"
|
||||
android:paddingTop="@dimen/dialog_content_bottom_margin">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/parkTime"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="30dp"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/osmand_parking_position_description_add"/>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/osmand_parking_hours"/>
|
||||
|
||||
<TimePicker
|
||||
android:id="@+id/parking_time_picker"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/osmand_parking_minutes"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/check_event_in_calendar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:checked="true"
|
||||
android:text="@string/osmand_parking_add_event"/>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
|
@ -3726,4 +3726,6 @@
|
|||
|
||||
<string name="poi_agrarian">Сельскохозяйственный магазин</string>
|
||||
|
||||
<string name="poi_shop_fireplace">Магазин каминов</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -3702,5 +3702,6 @@
|
|||
|
||||
<string name="poi_agrarian">Agricultural store</string>
|
||||
|
||||
<string name="poi_shop_fireplace">Fireplace store</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -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);
|
||||
}
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
3
OsmAnd/src/net/osmand/aidl/gpx/RemoveGpxParams.aidl
Normal file
|
@ -0,0 +1,3 @@
|
|||
package net.osmand.aidl.gpx;
|
||||
|
||||
parcelable RemoveGpxParams;
|
48
OsmAnd/src/net/osmand/aidl/gpx/RemoveGpxParams.java
Normal file
|
@ -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<RemoveGpxParams> CREATOR = new
|
||||
Creator<RemoveGpxParams>() {
|
||||
@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;
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ public abstract class BaseMenuController {
|
|||
}
|
||||
|
||||
public float getHalfScreenMaxHeightKoef() {
|
||||
return .7f;
|
||||
return .75f;
|
||||
}
|
||||
|
||||
public int getSlideInAnimation() {
|
||||
|
|
|
@ -521,6 +521,13 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
|||
}, timeout);
|
||||
}
|
||||
|
||||
public void updateLayout() {
|
||||
WeakReference<MapContextMenuFragment> fragmentRef = findMenuFragment();
|
||||
if (fragmentRef != null) {
|
||||
fragmentRef.get().updateLayout();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateMenuUI() {
|
||||
WeakReference<MapContextMenuFragment> fragmentRef = findMenuFragment();
|
||||
if (fragmentRef != null) {
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
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,12 +311,15 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
|||
mainView.setLayoutParams(lp);
|
||||
mainView.requestLayout();
|
||||
|
||||
if (velocity != null) {
|
||||
velocity.addMovement(event);
|
||||
velocity.computeCurrentVelocity(1000);
|
||||
velocityY = Math.abs(velocity.getYVelocity());
|
||||
if (velocityY > maxVelocityY)
|
||||
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;
|
||||
|
||||
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,22 +605,27 @@ 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 (!menu.isLandscapeLayout()) {
|
||||
if (slidingDown && !skipScreenState && oldMenuState == MenuState.FULL_SCREEN && currentY < topScreenPosY) {
|
||||
slidingDown = false;
|
||||
}
|
||||
if (menuBottomViewHeight > 0 && slidingUp) {
|
||||
menu.slideUp();
|
||||
if (skipHalfScreenState) {
|
||||
if (skipScreenState) {
|
||||
menu.slideUp();
|
||||
}
|
||||
} else if (slidingDown) {
|
||||
needCloseMenu = !menu.slideDown();
|
||||
if (!needCloseMenu && skipHalfScreenState) {
|
||||
if (!needCloseMenu && skipScreenState) {
|
||||
menu.slideDown();
|
||||
}
|
||||
}
|
||||
}
|
||||
int newMenuState = menu.getCurrentMenuState();
|
||||
boolean needMapAdjust = oldMenuState != newMenuState && newMenuState != MenuState.FULL_SCREEN;
|
||||
|
||||
|
@ -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();
|
||||
|
|
|
@ -95,10 +95,16 @@ public class MenuBuilder {
|
|||
private CardsRowBuilder onlinePhotoCardsRow;
|
||||
private List<AbstractCard> 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<Boolean> collapsedPref;
|
||||
private boolean collapsed;
|
||||
private OnCollExpListener onCollExpListener;
|
||||
private CollapseExpandListener collapseExpandListener;
|
||||
|
||||
public interface OnCollExpListener {
|
||||
void onCollapseExpand(boolean collapsed);
|
||||
}
|
||||
|
||||
public CollapsableView(@NonNull View contenView, @NonNull OsmandPreference<Boolean> collapsedPref) {
|
||||
public CollapsableView(@NonNull View contenView, @NonNull MenuBuilder menuBuilder,
|
||||
@NonNull OsmandPreference<Boolean> 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<TransportStopRoute> 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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|