Fix review and landscape layout

This commit is contained in:
Dima-1 2020-07-17 15:33:32 +03:00
parent daba36f28e
commit 73bde7e6de
4 changed files with 37 additions and 37 deletions

View file

@ -70,9 +70,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/text_margin_small"
android:layout_marginEnd="@dimen/measurement_tool_text_margin"
android:layout_marginLeft="@dimen/measurement_tool_text_margin"
android:layout_marginRight="@dimen/text_margin_small"
android:layout_marginRight="@dimen/measurement_tool_text_margin"
android:layout_marginStart="@dimen/measurement_tool_text_margin"
android:layout_toEndOf="@id/main_icon"
android:layout_toRightOf="@id/main_icon"
@ -99,6 +99,10 @@
android:layout_toLeftOf="@id/up_down_button"
android:layout_toRightOf="@id/measurement_points_text_view"
android:layout_toStartOf="@id/up_down_button"
android:layout_marginEnd="@dimen/measurement_tool_text_margin"
android:layout_marginLeft="@dimen/measurement_tool_text_margin"
android:layout_marginRight="@dimen/measurement_tool_text_margin"
android:layout_marginStart="@dimen/measurement_tool_text_margin"
android:textColor="@color/color_distance"
android:textSize="@dimen/default_list_text_size"
tools:text=" 700 m"/>
@ -154,13 +158,15 @@
android:id="@+id/options_button"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/measurement_tool_button_padding"
android:layout_marginBottom="@dimen/measurement_tool_button_padding"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:maxLines="1"
android:paddingEnd="@dimen/measurement_tool_text_button_padding_small"
android:paddingLeft="@dimen/measurement_tool_text_button_padding"
android:paddingRight="@dimen/measurement_tool_text_button_padding_small"
android:paddingStart="@dimen/measurement_tool_text_button_padding"
android:paddingLeft="@dimen/measurement_tool_text_button_padding"
android:text="@string/shared_string_options"
android:textColor="?attr/color_dialog_buttons"
osmand:typeface="@string/font_roboto_medium"/>
@ -170,6 +176,7 @@
android:id="@+id/undo_point_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="?attr/selectableItemBackground"
android:padding="@dimen/measurement_tool_undo_redo_padding_small"
tools:src="@drawable/ic_action_undo_dark"/>
@ -178,6 +185,7 @@
android:id="@+id/redo_point_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/measurement_tool_button_padding"
android:layout_marginStart="@dimen/measurement_tool_button_padding"
android:background="?attr/selectableItemBackground"
@ -199,15 +207,15 @@
android:layout_marginRight="@dimen/measurement_tool_button_margin"
android:layout_marginTop="@dimen/measurement_tool_button_margin"
android:background="?attr/btn_round"
android:maxLines="1"
android:maxLines="1"
android:minHeight="@dimen/measurement_tool_button_height"
android:paddingLeft="@dimen/measurement_tool_button_padding"
android:paddingRight="@dimen/measurement_tool_button_padding"
android:text="@string/shared_string_add"
android:textColor="@color/color_white"
android:textAllCaps="false"
android:paddingEnd="@dimen/measurement_tool_button_padding"
android:paddingStart="@dimen/measurement_tool_button_padding" />
android:paddingEnd="@dimen/measurement_tool_button_padding"
android:paddingStart="@dimen/measurement_tool_button_padding" />
</FrameLayout>
</LinearLayout>
@ -237,8 +245,8 @@
android:text="@string/shared_string_apply"
android:textColor="@color/color_white"
android:textAllCaps="false"
android:paddingEnd="@dimen/measurement_tool_button_padding"
android:paddingStart="@dimen/measurement_tool_button_padding" />
android:paddingEnd="@dimen/measurement_tool_button_padding"
android:paddingStart="@dimen/measurement_tool_button_padding" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/cancel_move_point_button"
@ -300,8 +308,8 @@
android:text="@string/shared_string_apply"
android:textColor="?attr/color_dialog_buttons"
android:textAllCaps="false"
android:paddingEnd="@dimen/measurement_tool_button_padding"
android:paddingStart="@dimen/measurement_tool_button_padding" />
android:paddingEnd="@dimen/measurement_tool_button_padding"
android:paddingStart="@dimen/measurement_tool_button_padding" />
<Button
android:id="@+id/add_point_before_after_button"
@ -318,8 +326,8 @@
android:text="@string/shared_string_add"
android:textColor="@color/color_white"
android:textAllCaps="false"
android:paddingStart="@dimen/measurement_tool_button_padding"
android:paddingEnd="@dimen/measurement_tool_button_padding" />
android:paddingStart="@dimen/measurement_tool_button_padding"
android:paddingEnd="@dimen/measurement_tool_button_padding" />
</LinearLayout>
</LinearLayout>

View file

@ -46,7 +46,7 @@ public class MeasurementEditingContext {
private boolean inSnapToRoadMode;
private boolean needUpdateCacheForSnap;
private int calculatedPairs;
private int trkptIndex;
private SnapToRoadProgressListener progressListener;
private ApplicationMode snapToRoadAppMode;
private RouteCalculationProgress calculationProgress;
@ -392,7 +392,7 @@ public class MeasurementEditingContext {
}
calculatedPairs++;
snappedToRoadPoints.put(currentPair, pts);
trkptIndex = currentPair.first.getTrkPtIndex();
int trkptIndex = currentPair.first.getTrkPtIndex();
trkptIndex += pts.size() - 1;
currentPair.second.setTrkPtIndex(trkptIndex);
updateCacheForSnapIfNeeded(true);

View file

@ -78,7 +78,6 @@ import net.osmand.plus.views.MapControlsLayer;
import net.osmand.plus.views.controls.ReorderItemTouchHelperCallback;
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory;
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
import net.osmand.util.Algorithms;
import java.io.File;
import java.text.MessageFormat;
@ -941,9 +940,9 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
MeasurementToolLayer measurementLayer = getMeasurementLayer();
if (measurementLayer != null) {
WptPt newPoint = measurementLayer.getMovedPointToApply();
String profileType = editingCtx.getSnapToRoadAppMode().getStringKey();
if (!Algorithms.isEmpty(profileType)) {
newPoint.setProfileType(profileType);
ApplicationMode applicationMode = editingCtx.getSnapToRoadAppMode();
if (applicationMode != null) {
newPoint.setProfileType(applicationMode.getStringKey());
}
WptPt oldPoint = editingCtx.getOriginalPointToMove();
int position = editingCtx.getSelectedPointPosition();

View file

@ -7,12 +7,12 @@ import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PointF;
import net.osmand.GPXUtilities.TrkSegment;
import net.osmand.GPXUtilities.WptPt;
import net.osmand.Location;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.data.RotatedTileBox;
import net.osmand.GPXUtilities.TrkSegment;
import net.osmand.GPXUtilities.WptPt;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.R;
import net.osmand.plus.settings.backend.ApplicationMode;
@ -20,7 +20,6 @@ import net.osmand.plus.views.ContextMenuLayer;
import net.osmand.plus.views.OsmandMapLayer;
import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.plus.views.Renderable;
import net.osmand.util.Algorithms;
import net.osmand.util.MapUtils;
import java.util.ArrayList;
@ -208,9 +207,9 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
WptPt lastPoint = editingCtx.getPoints().get(editingCtx.getPointsCount() - 1);
LatLon centerLatLon = tb.getCenterLatLon();
distance = (float) MapUtils.getDistance(
lastPoint.lat, lastPoint.lon, centerLatLon.getLatitude(), centerLatLon.getLongitude());
lastPoint.lat, lastPoint.lon, centerLatLon.getLatitude(), centerLatLon.getLongitude());
bearing = getLocationFromLL(lastPoint.lat, lastPoint.lon)
.bearingTo(getLocationFromLL(centerLatLon.getLatitude(), centerLatLon.getLongitude()));
.bearingTo(getLocationFromLL(centerLatLon.getLatitude(), centerLatLon.getLongitude()));
}
measureDistanceToCenterListener.onMeasure(distance, bearing);
}
@ -232,13 +231,13 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
float locY = tb.getPixYFromLatLon(pt.lat, pt.lon);
tx.add(locX);
ty.add(locY);
tx.add((float)tb.getCenterPixelX());
ty.add((float)tb.getCenterPixelY());
tx.add((float) tb.getCenterPixelX());
ty.add((float) tb.getCenterPixelY());
}
if (after.points.size() > 0) {
if (before.points.size() == 0) {
tx.add((float)tb.getCenterPixelX());
ty.add((float)tb.getCenterPixelY());
tx.add((float) tb.getCenterPixelX());
ty.add((float) tb.getCenterPixelY());
}
WptPt pt = after.points.get(0);
float locX = tb.getPixXFromLatLon(pt.lat, pt.lon);
@ -325,11 +324,8 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
if (allowed) {
ApplicationMode applicationMode = editingCtx.getSnapToRoadAppMode();
if(applicationMode!=null) {
String profileType = applicationMode.getStringKey();
if (!Algorithms.isEmpty(profileType)) {
pt.setProfileType(profileType);
}
if (applicationMode != null) {
pt.setProfileType(applicationMode.getStringKey());
}
editingCtx.addPoint(pt);
return pt;
@ -348,11 +344,8 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
boolean allowed = editingCtx.getPointsCount() == 0 || !editingCtx.getPoints().get(editingCtx.getPointsCount() - 1).equals(pt);
if (allowed) {
ApplicationMode applicationMode = editingCtx.getSnapToRoadAppMode();
if(applicationMode!=null) {
String profileType = applicationMode.getStringKey();
if (!Algorithms.isEmpty(profileType)) {
pt.setProfileType(profileType);
}
if (applicationMode != null) {
pt.setProfileType(applicationMode.getStringKey());
}
editingCtx.addPoint(pt);
moveMapToLatLon(lat, lon);