From 79a24596bcc9423b1494d6e0f65a85ce255107c6 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Fri, 6 May 2016 22:56:48 +0200 Subject: [PATCH] Update dependencies --- OsmAnd/build.gradle | 17 ++++---- .../osmand/plus/views/ContextMenuLayer.java | 39 ++++++++++++++++--- plugins/Osmand-ParkingPlugin/build.gradle | 1 - settings.gradle | 4 -- 4 files changed, 40 insertions(+), 21 deletions(-) diff --git a/OsmAnd/build.gradle b/OsmAnd/build.gradle index f897d2081f..49065e3e7f 100644 --- a/OsmAnd/build.gradle +++ b/OsmAnd/build.gradle @@ -1,5 +1,4 @@ apply plugin: 'com.android.application' - // Global Parameters accepted // APK_NUMBER_VERSION - version number of apk // APK_VERSION - build number like #9999Z, for dev builds appended to app_version like 2.0.0 in no_translate.xml) @@ -355,19 +354,17 @@ repositories { dependencies { compile project(path: ':OsmAnd-java', configuration: 'android') - compile project(':eclipse-compile:design') - compile project(':eclipse-compile:cardview') - compile project(':eclipse-compile:gridlayout') - // compile project(":eclipse-compile:recyclerview") + // compile project(':eclipse-compile:design') + // compile project(':eclipse-compile:cardview') + // compile project(':eclipse-compile:gridlayout') + compile 'com.android.support:gridlayout-v7:23.3.0' + compile 'com.android.support:cardview-v7:23.3.0' + compile 'com.android.support:appcompat-v7:23.3.0' + compile 'com.android.support:design:23.3.0' compile fileTree(include: ['*.jar'], exclude: ['QtAndroid-bundled.jar', 'QtAndroidAccessibility-bundled.jar', 'OsmAndCore_android.jar', 'OsmAndCore_wrapper.jar', 'android-support-multidex.jar'], dir: 'libs') - // compile "com.github.ksoichiro:android-observablescrollview:1.5.0" - // compile "com.android.support:appcompat-v7:22.2.1" - // compile "com.github.shell-software:fab:1.0.5" - // compile 'com.android.support:design:22.2.1' legacyCompile "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@jar" qtcoredebugCompile "net.osmand:OsmAndCore_androidNativeDebug:0.1-SNAPSHOT@aar" qtcoredebugCompile "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@aar" qtcoreCompile "net.osmand:OsmAndCore_androidNativeRelease:0.1-SNAPSHOT@aar" qtcoreCompile "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@aar" - compile files('libs/gson-2.5.jar') } diff --git a/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java b/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java index f7d51f5fa0..2172068451 100644 --- a/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java @@ -14,6 +14,7 @@ import android.support.annotation.RequiresPermission; import android.support.v4.content.ContextCompat; import android.view.GestureDetector; import android.view.MotionEvent; +import android.view.View; import android.widget.ArrayAdapter; import android.widget.FrameLayout.LayoutParams; import android.widget.ImageView; @@ -155,7 +156,7 @@ public class ContextMenuLayer extends OsmandMapLayer { if (obj != null && isObjectMoveable(obj)) { Vibrator vibrator = (Vibrator) activity.getSystemService(Context.VIBRATOR_SERVICE); vibrator.vibrate(VIBRATE_SHORT); - mInChangeMarkerPositionMode = true; + activity.getContextMenu().hide(); LatLon ll = menu.getLatLon(); RotatedTileBox rb = new RotatedTileBox(tileBox); @@ -164,7 +165,9 @@ public class ContextMenuLayer extends OsmandMapLayer { double lat = rb.getLatFromPixel(tileBox.getCenterPixelX(), tileBox.getCenterPixelY()); double lon = rb.getLonFromPixel(tileBox.getCenterPixelX(), tileBox.getCenterPixelY()); view.setLatLon(lat, lon); - mMoveMarkerBottomSheetHelper.show(menu.getLeftIcon()); + enterMovingMode(); + view.refreshMap(); + return true; } return false; @@ -175,6 +178,8 @@ public class ContextMenuLayer extends OsmandMapLayer { return true; } + + public PointF getMoveableCenterPoint(RotatedTileBox tb) { return new PointF(tb.getPixWidth() / 2, tb.getPixHeight() / 2); } @@ -211,19 +216,41 @@ public class ContextMenuLayer extends OsmandMapLayer { if (!mInChangeMarkerPositionMode) { throw new IllegalStateException("Not in change marker position mode"); } - mInChangeMarkerPositionMode = false; - + Object obj = getMoveableObject(); + quitMovingMarker(); RotatedTileBox tileBox = activity.getMapView().getCurrentRotatedTileBox(); PointF newMarkerPosition = getMoveableCenterPoint(tileBox); LatLon ll = tileBox.getLatLonFromPixel(newMarkerPosition.x, newMarkerPosition.y); - applyMovedObject(getMoveableObject(), ll); + applyMovedObject(obj, ll); // TODO pass object properly showContextMenu(newMarkerPosition, tileBox, true); view.refreshMap(); } - public void cancelMovingMarker() { + private void quitMovingMarker() { mInChangeMarkerPositionMode = false; + mark(View.VISIBLE, R.id.map_menu_button, R.id.map_route_info_button, R.id.map_ruler_layout, + R.id.map_left_widgets_panel, R.id.map_right_widgets_panel, R.id.map_center_info); + } + + private void enterMovingMode() { + mInChangeMarkerPositionMode = true; + mMoveMarkerBottomSheetHelper.show(menu.getLeftIcon()); + mark(View.INVISIBLE, R.id.map_menu_button, R.id.map_route_info_button, R.id.map_ruler_layout, + R.id.map_left_widgets_panel, R.id.map_right_widgets_panel, R.id.map_center_info); + } + + private void mark(int status, int... widgets) { + for(int i = 0; i < widgets.length ; i++) { + View v = activity.findViewById(widgets[i]); + if(v != null) { + v.setVisibility(status); + } + } + } + + public void cancelMovingMarker() { + quitMovingMarker(); activity.getContextMenu().show(); } diff --git a/plugins/Osmand-ParkingPlugin/build.gradle b/plugins/Osmand-ParkingPlugin/build.gradle index eada5a8a41..d162118597 100644 --- a/plugins/Osmand-ParkingPlugin/build.gradle +++ b/plugins/Osmand-ParkingPlugin/build.gradle @@ -64,5 +64,4 @@ repositories { } dependencies { - compile project(":eclipse-compile:appcompat") } diff --git a/settings.gradle b/settings.gradle index e6c2f9a135..4c604d0ff3 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,8 +1,4 @@ include ':OsmAnd-java' -include ':eclipse-compile:gridlayout' -include ':eclipse-compile:cardview' -include ':eclipse-compile:design' -include ':eclipse-compile:appcompat' include ':OsmAnd' include ':plugins:OsmAnd-AddressPlugin' include ':plugins:Osmand-ParkingPlugin'