Merge pull request #4347 from osmandapp/sasha_pasha_branch

Sasha pasha branch
This commit is contained in:
Alexey 2017-08-28 16:25:05 +03:00 committed by GitHub
commit 94e916b16f
28 changed files with 608 additions and 482 deletions

View file

@ -36,8 +36,8 @@
android:layout_height="wrap_content"
android:layout_weight="0.45"
android:background="?attr/selectableItemBackground"
android:paddingBottom="14dp"
android:paddingTop="14dp">
android:paddingBottom="@dimen/measurement_tool_content_padding_medium"
android:paddingTop="@dimen/measurement_tool_content_padding_medium">
<ImageView
android:id="@+id/main_icon"
@ -46,10 +46,10 @@
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginEnd="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="@dimen/measurement_tool_content_margin"
android:layout_marginLeft="@dimen/measurement_tool_content_margin"
android:layout_marginRight="@dimen/measurement_tool_content_margin"
android:layout_marginStart="@dimen/measurement_tool_content_margin"
android:background="@null"
tools:src="@drawable/ic_action_ruler"/>
@ -60,10 +60,10 @@
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginEnd="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="@dimen/measurement_tool_content_margin"
android:layout_marginLeft="@dimen/measurement_tool_content_margin"
android:layout_marginRight="@dimen/measurement_tool_content_margin"
android:layout_marginStart="@dimen/measurement_tool_content_margin"
android:background="@null"
tools:src="@drawable/ic_action_arrow_down"/>
@ -72,10 +72,10 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="4dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="4dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="@dimen/measurement_tool_text_margin_small"
android:layout_marginLeft="@dimen/measurement_tool_text_margin"
android:layout_marginRight="@dimen/measurement_tool_text_margin_small"
android:layout_marginStart="@dimen/measurement_tool_text_margin"
android:layout_toEndOf="@id/main_icon"
android:layout_toRightOf="@id/main_icon"
android:textAppearance="@style/TextAppearance.ListItemTitle"
@ -110,10 +110,10 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="4dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="4dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="@dimen/measurement_tool_text_margin_small"
android:layout_marginLeft="@dimen/measurement_tool_text_margin"
android:layout_marginRight="@dimen/measurement_tool_text_margin_small"
android:layout_marginStart="@dimen/measurement_tool_text_margin"
android:layout_toEndOf="@id/main_icon"
android:layout_toRightOf="@id/main_icon"
android:text="@string/move_point"
@ -125,13 +125,13 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="4dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="4dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="@dimen/measurement_tool_text_margin_small"
android:layout_marginLeft="@dimen/measurement_tool_text_margin"
android:layout_marginRight="@dimen/measurement_tool_text_margin_small"
android:layout_marginStart="@dimen/measurement_tool_text_margin"
android:layout_toEndOf="@id/main_icon"
android:layout_toRightOf="@id/main_icon"
tools:text="@string/add_point_before"
tools:text="@string/add_point_after"
android:textAppearance="@style/TextAppearance.ListItemTitle"
android:visibility="gone"/>
</RelativeLayout>
@ -144,7 +144,7 @@
<LinearLayout
android:id="@+id/measure_mode_controls"
android:layout_width="0dp"
android:layout_height="52dp"
android:layout_height="@dimen/measurement_tool_controls_height"
android:layout_weight="0.55">
<FrameLayout
@ -159,10 +159,10 @@
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:maxLines="1"
android:paddingEnd="12dp"
android:paddingLeft="16dp"
android:paddingRight="12dp"
android:paddingStart="16dp"
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:text="@string/shared_string_options"
android:textColor="?attr/color_dialog_buttons"
osmand:textAllCapsCompat="true"
@ -172,27 +172,23 @@
<ImageButton
android:id="@+id/undo_point_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"
android:paddingBottom="14dp"
android:paddingEnd="12dp"
android:paddingLeft="16dp"
android:paddingRight="12dp"
android:paddingStart="16dp"
android:paddingTop="14dp"
android:paddingEnd="@dimen/measurement_tool_undo_redo_padding_small"
android:paddingLeft="@dimen/measurement_tool_undo_redo_padding"
android:paddingRight="@dimen/measurement_tool_undo_redo_padding_small"
android:paddingStart="@dimen/measurement_tool_undo_redo_padding_small"
tools:src="@drawable/ic_action_undo_dark"/>
<ImageButton
android:id="@+id/redo_point_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"
android:paddingBottom="14dp"
android:paddingEnd="16dp"
android:paddingLeft="12dp"
android:paddingRight="16dp"
android:paddingStart="12dp"
android:paddingTop="14dp"
android:paddingEnd="@dimen/measurement_tool_undo_redo_padding"
android:paddingLeft="@dimen/measurement_tool_undo_redo_padding_small"
android:paddingRight="@dimen/measurement_tool_undo_redo_padding"
android:paddingStart="@dimen/measurement_tool_undo_redo_padding_small"
tools:src="@drawable/ic_action_redo_dark"/>
<FrameLayout
@ -205,16 +201,16 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="@dimen/measurement_tool_button_margin"
android:layout_marginEnd="@dimen/measurement_tool_button_margin"
android:layout_marginRight="@dimen/measurement_tool_button_margin"
android:layout_marginTop="@dimen/measurement_tool_button_margin"
android:background="@drawable/btn_round_blue"
android:drawableLeft="@drawable/ic_action_plus"
android:maxLines="1"
android:minHeight="36dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
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"/>
</FrameLayout>
@ -224,7 +220,7 @@
<RelativeLayout
android:id="@+id/move_point_controls"
android:layout_width="0dp"
android:layout_height="52dp"
android:layout_height="@dimen/measurement_tool_controls_height"
android:layout_weight="0.6"
android:visibility="gone">
@ -235,14 +231,14 @@
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="@dimen/measurement_tool_button_margin"
android:layout_marginEnd="@dimen/measurement_tool_button_margin"
android:layout_marginRight="@dimen/measurement_tool_button_margin"
android:layout_marginTop="@dimen/measurement_tool_button_margin"
android:background="@drawable/btn_round_blue"
android:minHeight="36dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
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_apply"
android:textColor="@color/color_white"/>
@ -252,10 +248,10 @@
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:paddingEnd="12dp"
android:paddingLeft="16dp"
android:paddingRight="12dp"
android:paddingStart="16dp"
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:text="@string/shared_string_cancel"
android:textColor="?attr/color_dialog_buttons"
osmand:textAllCapsCompat="true"
@ -265,7 +261,7 @@
<LinearLayout
android:id="@+id/add_point_before_after_controls"
android:layout_width="0dp"
android:layout_height="52dp"
android:layout_height="@dimen/measurement_tool_controls_height"
android:layout_weight="0.6"
android:gravity="center_vertical"
android:orientation="horizontal"
@ -277,10 +273,10 @@
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:paddingEnd="12dp"
android:paddingLeft="16dp"
android:paddingRight="12dp"
android:paddingStart="16dp"
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:text="@string/shared_string_cancel"
android:textColor="?attr/color_dialog_buttons"
osmand:textAllCapsCompat="true"
@ -295,14 +291,14 @@
android:id="@+id/apply_point_before_after_point_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="@dimen/measurement_tool_button_margin"
android:layout_marginEnd="@dimen/measurement_tool_button_margin"
android:layout_marginRight="@dimen/measurement_tool_button_margin"
android:layout_marginTop="@dimen/measurement_tool_button_margin"
android:background="?attr/btn_round_border"
android:minHeight="36dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
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_apply"
android:textColor="?attr/color_dialog_buttons"/>
@ -310,15 +306,15 @@
android:id="@+id/add_point_before_after_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="@dimen/measurement_tool_button_margin"
android:layout_marginEnd="@dimen/measurement_tool_button_margin"
android:layout_marginRight="@dimen/measurement_tool_button_margin"
android:layout_marginTop="@dimen/measurement_tool_button_margin"
android:background="@drawable/btn_round_blue"
android:drawableLeft="@drawable/ic_action_plus"
android:minHeight="36dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
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"/>
</LinearLayout>

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:padding="@dimen/measurement_tool_content_padding">
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="@string/keep_showing_on_map"/>
<android.support.v7.widget.SwitchCompat
android:id="@+id/toggle_show_on_map"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/measurement_tool_content_margin"
android:layout_marginStart="@dimen/measurement_tool_content_margin"/>
</LinearLayout>

View file

@ -31,8 +31,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:paddingBottom="12dp"
android:paddingTop="12dp">
android:paddingBottom="@dimen/measurement_tool_content_padding_medium"
android:paddingTop="@dimen/measurement_tool_content_padding_medium">
<ImageView
android:id="@+id/main_icon"
@ -41,10 +41,10 @@
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginEnd="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="@dimen/measurement_tool_content_margin"
android:layout_marginLeft="@dimen/measurement_tool_content_margin"
android:layout_marginRight="@dimen/measurement_tool_content_margin"
android:layout_marginStart="@dimen/measurement_tool_content_margin"
android:background="@null"
tools:src="@drawable/ic_action_ruler"/>
@ -55,10 +55,10 @@
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginEnd="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="@dimen/measurement_tool_content_margin"
android:layout_marginLeft="@dimen/measurement_tool_content_margin"
android:layout_marginRight="@dimen/measurement_tool_content_margin"
android:layout_marginStart="@dimen/measurement_tool_content_margin"
android:background="@null"
tools:src="@drawable/ic_action_arrow_down"/>
@ -67,10 +67,10 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="4dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="4dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="@dimen/measurement_tool_text_margin_small"
android:layout_marginLeft="@dimen/measurement_tool_text_margin"
android:layout_marginRight="@dimen/measurement_tool_text_margin_small"
android:layout_marginStart="@dimen/measurement_tool_text_margin"
android:layout_toEndOf="@id/main_icon"
android:layout_toRightOf="@id/main_icon"
android:textAppearance="@style/TextAppearance.ListItemTitle"
@ -105,10 +105,10 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="4dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="4dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="@dimen/measurement_tool_text_margin_small"
android:layout_marginLeft="@dimen/measurement_tool_text_margin"
android:layout_marginRight="@dimen/measurement_tool_text_margin_small"
android:layout_marginStart="@dimen/measurement_tool_text_margin"
android:layout_toEndOf="@id/main_icon"
android:layout_toRightOf="@id/main_icon"
android:text="@string/move_point"
@ -120,10 +120,10 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="4dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="4dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="@dimen/measurement_tool_text_margin_small"
android:layout_marginLeft="@dimen/measurement_tool_text_margin"
android:layout_marginRight="@dimen/measurement_tool_text_margin_small"
android:layout_marginStart="@dimen/measurement_tool_text_margin"
android:layout_toEndOf="@id/main_icon"
android:layout_toRightOf="@id/main_icon"
tools:text="@string/add_point_after"
@ -139,7 +139,7 @@
<FrameLayout
android:id="@+id/points_list_container"
android:layout_width="match_parent"
android:layout_height="220dp"
android:layout_height="@dimen/measurement_tool_points_list_container_height"
android:background="@color/ctx_menu_info_view_bg_dark"
android:visibility="gone">
@ -162,7 +162,7 @@
<LinearLayout
android:id="@+id/measure_mode_controls"
android:layout_width="match_parent"
android:layout_height="52dp">
android:layout_height="@dimen/measurement_tool_controls_height">
<FrameLayout
android:layout_width="0dp"
@ -177,10 +177,10 @@
android:ellipsize="end"
android:gravity="center_vertical"
android:maxLines="1"
android:paddingEnd="12dp"
android:paddingLeft="16dp"
android:paddingRight="12dp"
android:paddingStart="16dp"
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:text="@string/shared_string_options"
android:textColor="?attr/color_dialog_buttons"
osmand:textAllCapsCompat="true"
@ -190,27 +190,23 @@
<ImageButton
android:id="@+id/undo_point_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"
android:paddingBottom="14dp"
android:paddingEnd="12dp"
android:paddingLeft="16dp"
android:paddingRight="12dp"
android:paddingStart="16dp"
android:paddingTop="14dp"
android:paddingEnd="@dimen/measurement_tool_undo_redo_padding_small"
android:paddingLeft="@dimen/measurement_tool_undo_redo_padding"
android:paddingRight="@dimen/measurement_tool_undo_redo_padding_small"
android:paddingStart="@dimen/measurement_tool_undo_redo_padding"
tools:src="@drawable/ic_action_undo_dark"/>
<ImageButton
android:id="@+id/redo_point_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"
android:paddingBottom="14dp"
android:paddingEnd="16dp"
android:paddingLeft="12dp"
android:paddingRight="16dp"
android:paddingStart="12dp"
android:paddingTop="14dp"
android:paddingEnd="@dimen/measurement_tool_undo_redo_padding"
android:paddingLeft="@dimen/measurement_tool_undo_redo_padding_small"
android:paddingRight="@dimen/measurement_tool_undo_redo_padding"
android:paddingStart="@dimen/measurement_tool_undo_redo_padding_small"
tools:src="@drawable/ic_action_redo_dark"/>
<FrameLayout
@ -223,17 +219,17 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="@dimen/measurement_tool_button_margin"
android:layout_marginEnd="@dimen/measurement_tool_button_margin"
android:layout_marginRight="@dimen/measurement_tool_button_margin"
android:layout_marginTop="@dimen/measurement_tool_button_margin"
android:background="@drawable/btn_round_blue"
android:drawableLeft="@drawable/ic_action_plus"
android:ellipsize="end"
android:maxLines="1"
android:minHeight="36dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
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"/>
</FrameLayout>
@ -243,7 +239,7 @@
<RelativeLayout
android:id="@+id/move_point_controls"
android:layout_width="match_parent"
android:layout_height="52dp"
android:layout_height="@dimen/measurement_tool_controls_height"
android:visibility="gone">
<Button
@ -253,14 +249,14 @@
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="@dimen/measurement_tool_button_margin"
android:layout_marginEnd="@dimen/measurement_tool_button_margin"
android:layout_marginRight="@dimen/measurement_tool_button_margin"
android:layout_marginTop="@dimen/measurement_tool_button_margin"
android:background="@drawable/btn_round_blue"
android:minHeight="36dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
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_apply"
android:textColor="@color/color_white"/>
@ -294,10 +290,10 @@
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:paddingEnd="12dp"
android:paddingLeft="16dp"
android:paddingRight="12dp"
android:paddingStart="16dp"
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:text="@string/shared_string_cancel"
android:textColor="?attr/color_dialog_buttons"
osmand:textAllCapsCompat="true"
@ -312,14 +308,14 @@
android:id="@+id/apply_point_before_after_point_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="@dimen/measurement_tool_button_margin"
android:layout_marginEnd="@dimen/measurement_tool_button_margin"
android:layout_marginRight="@dimen/measurement_tool_button_margin"
android:layout_marginTop="@dimen/measurement_tool_button_margin"
android:background="?attr/btn_round_border"
android:minHeight="36dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
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_apply"
android:textColor="?attr/color_dialog_buttons"/>
@ -327,15 +323,15 @@
android:id="@+id/add_point_before_after_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="@dimen/measurement_tool_button_margin"
android:layout_marginEnd="@dimen/measurement_tool_button_margin"
android:layout_marginRight="@dimen/measurement_tool_button_margin"
android:layout_marginTop="@dimen/measurement_tool_button_margin"
android:background="@drawable/btn_round_blue"
android:drawableLeft="@drawable/ic_action_plus"
android:minHeight="36dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
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"/>
</LinearLayout>

View file

@ -22,12 +22,12 @@
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/options_title"
android:layout_width="match_parent"
android:layout_height="52dp"
android:layout_height="@dimen/measurement_tool_bottom_title_height"
android:gravity="center_vertical"
android:paddingEnd="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingStart="16dp"
android:paddingEnd="@dimen/measurement_tool_content_padding"
android:paddingLeft="@dimen/measurement_tool_content_padding"
android:paddingRight="@dimen/measurement_tool_content_padding"
android:paddingStart="@dimen/measurement_tool_content_padding"
android:text="@string/shared_string_options"
android:textAppearance="@style/TextAppearance.ListItemTitle"
osmand:typeface="@string/font_roboto_medium"/>
@ -35,21 +35,21 @@
<RelativeLayout
android:id="@+id/snap_to_road_row"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_height="@dimen/measurement_tool_bottom_list_item_height"
android:background="?attr/selectableItemBackground"
android:minHeight="48dp"
android:paddingEnd="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingStart="16dp">
android:minHeight="@dimen/measurement_tool_bottom_list_item_height"
android:paddingEnd="@dimen/measurement_tool_content_padding"
android:paddingLeft="@dimen/measurement_tool_content_padding"
android:paddingRight="@dimen/measurement_tool_content_padding"
android:paddingStart="@dimen/measurement_tool_content_padding">
<ImageView
android:id="@+id/snap_to_road_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="24dp"
android:layout_marginRight="24dp"
android:layout_marginEnd="@dimen/measurement_tool_bottom_icon_margin"
android:layout_marginRight="@dimen/measurement_tool_bottom_icon_margin"
tools:src="@drawable/ic_action_snap_to_road"/>
<android.support.v7.widget.SwitchCompat
@ -59,8 +59,8 @@
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginLeft="@dimen/measurement_tool_content_margin"
android:layout_marginStart="@dimen/measurement_tool_content_margin"
android:background="@null"
android:clickable="false"
android:focusable="false"
@ -99,22 +99,22 @@
<View
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_marginBottom="8dp"
android:layout_marginLeft="64dp"
android:layout_marginStart="64dp"
android:layout_marginTop="7dp"
android:layout_marginBottom="@dimen/measurement_tool_bottom_divider_margin_bottom"
android:layout_marginLeft="@dimen/measurement_tool_bottom_divider_margin_start"
android:layout_marginStart="@dimen/measurement_tool_bottom_divider_margin_start"
android:layout_marginTop="@dimen/measurement_tool_bottom_divider_margin_top"
android:background="?attr/dashboard_divider"/>
<RelativeLayout
android:id="@+id/save_as_new_segment_row"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_height="@dimen/measurement_tool_bottom_list_item_height"
android:background="?attr/selectableItemBackground"
android:minHeight="48dp"
android:paddingEnd="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingStart="16dp"
android:minHeight="@dimen/measurement_tool_bottom_list_item_height"
android:paddingEnd="@dimen/measurement_tool_content_padding"
android:paddingLeft="@dimen/measurement_tool_content_padding"
android:paddingRight="@dimen/measurement_tool_content_padding"
android:paddingStart="@dimen/measurement_tool_content_padding"
android:visibility="gone">
<ImageView
@ -122,8 +122,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="24dp"
android:layout_marginRight="24dp"
android:layout_marginEnd="@dimen/measurement_tool_bottom_icon_margin"
android:layout_marginRight="@dimen/measurement_tool_bottom_icon_margin"
tools:src="@drawable/ic_action_polygom_dark"/>
<TextView
@ -140,21 +140,21 @@
<RelativeLayout
android:id="@+id/save_as_new_track_row"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_height="@dimen/measurement_tool_bottom_list_item_height"
android:background="?attr/selectableItemBackground"
android:minHeight="48dp"
android:paddingEnd="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingStart="16dp">
android:minHeight="@dimen/measurement_tool_bottom_list_item_height"
android:paddingEnd="@dimen/measurement_tool_content_padding"
android:paddingLeft="@dimen/measurement_tool_content_padding"
android:paddingRight="@dimen/measurement_tool_content_padding"
android:paddingStart="@dimen/measurement_tool_content_padding">
<ImageView
android:id="@+id/save_as_new_track_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="24dp"
android:layout_marginRight="24dp"
android:layout_marginEnd="@dimen/measurement_tool_bottom_icon_margin"
android:layout_marginRight="@dimen/measurement_tool_bottom_icon_margin"
tools:src="@drawable/ic_action_polygom_dark"/>
<TextView
@ -171,21 +171,21 @@
<RelativeLayout
android:id="@+id/add_to_the_track_row"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_height="@dimen/measurement_tool_bottom_list_item_height"
android:background="?attr/selectableItemBackground"
android:minHeight="48dp"
android:paddingEnd="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingStart="16dp">
android:minHeight="@dimen/measurement_tool_bottom_list_item_height"
android:paddingEnd="@dimen/measurement_tool_content_padding"
android:paddingLeft="@dimen/measurement_tool_content_padding"
android:paddingRight="@dimen/measurement_tool_content_padding"
android:paddingStart="@dimen/measurement_tool_content_padding">
<ImageView
android:id="@+id/add_to_the_track_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="24dp"
android:layout_marginRight="24dp"
android:layout_marginEnd="@dimen/measurement_tool_bottom_icon_margin"
android:layout_marginRight="@dimen/measurement_tool_bottom_icon_margin"
tools:src="@drawable/ic_action_split_interval"/>
<TextView
@ -202,30 +202,30 @@
<View
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_marginBottom="8dp"
android:layout_marginLeft="64dp"
android:layout_marginStart="64dp"
android:layout_marginTop="7dp"
android:layout_marginBottom="@dimen/measurement_tool_bottom_divider_margin_bottom"
android:layout_marginLeft="@dimen/measurement_tool_bottom_divider_margin_start"
android:layout_marginStart="@dimen/measurement_tool_bottom_divider_margin_start"
android:layout_marginTop="@dimen/measurement_tool_bottom_divider_margin_top"
android:background="?attr/dashboard_divider"/>
<RelativeLayout
android:id="@+id/clear_all_row"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_height="@dimen/measurement_tool_bottom_list_item_height"
android:background="?attr/selectableItemBackground"
android:minHeight="48dp"
android:paddingEnd="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingStart="16dp">
android:minHeight="@dimen/measurement_tool_bottom_list_item_height"
android:paddingEnd="@dimen/measurement_tool_content_padding"
android:paddingLeft="@dimen/measurement_tool_content_padding"
android:paddingRight="@dimen/measurement_tool_content_padding"
android:paddingStart="@dimen/measurement_tool_content_padding">
<ImageView
android:id="@+id/clear_all_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="24dp"
android:layout_marginRight="24dp"
android:layout_marginEnd="@dimen/measurement_tool_bottom_icon_margin"
android:layout_marginRight="@dimen/measurement_tool_bottom_icon_margin"
tools:src="@drawable/ic_action_reset_to_default_dark"/>
<TextView
@ -262,7 +262,7 @@
android:text="@string/shared_string_close"
android:textAllCaps="true"
android:textColor="?attr/color_dialog_buttons"
android:textSize="14sp"
android:textSize="@dimen/default_desc_text_size"
android:textStyle="bold"/>
</FrameLayout>

View file

@ -16,28 +16,28 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="8dp">
android:paddingBottom="@dimen/measurement_tool_content_padding_small">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/save_as_new_track_title"
android:layout_width="match_parent"
android:layout_height="52dp"
android:layout_height="@dimen/measurement_tool_bottom_title_height"
android:gravity="center_vertical"
android:paddingEnd="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingStart="16dp"
android:paddingEnd="@dimen/measurement_tool_content_padding"
android:paddingLeft="@dimen/measurement_tool_content_padding"
android:paddingRight="@dimen/measurement_tool_content_padding"
android:paddingStart="@dimen/measurement_tool_content_padding"
android:text="@string/shared_string_save_as_gpx"
android:textAppearance="@style/TextAppearance.ListItemTitle"
osmand:typeface="@string/font_roboto_medium"/>
<TextView
android:layout_width="match_parent"
android:layout_height="44dp"
android:paddingEnd="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingStart="16dp"
android:layout_height="@dimen/measurement_tool_bottom_descr_height"
android:paddingEnd="@dimen/measurement_tool_content_padding"
android:paddingLeft="@dimen/measurement_tool_content_padding"
android:paddingRight="@dimen/measurement_tool_content_padding"
android:paddingStart="@dimen/measurement_tool_content_padding"
android:text="@string/measurement_tool_save_as_new_track_descr"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"/>
@ -52,10 +52,10 @@
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="8dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="@dimen/measurement_tool_content_margin_small"
android:layout_marginLeft="@dimen/measurement_tool_content_margin"
android:layout_marginRight="@dimen/measurement_tool_content_margin_small"
android:layout_marginStart="@dimen/measurement_tool_content_margin"
android:layout_weight="1">
<ImageView
@ -73,9 +73,9 @@
android:layout_height="wrap_content"
android:layout_alignLeft="@id/route_point_image"
android:layout_alignStart="@id/route_point_image"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="8dp"
android:layout_marginLeft="@dimen/measurement_tool_bottom_image_text_margin_start"
android:layout_marginStart="@dimen/measurement_tool_bottom_image_text_margin_start"
android:layout_marginTop="@dimen/measurement_tool_content_margin_small"
android:text="@string/route_point"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_split_segments_sub"/>
@ -84,10 +84,10 @@
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="16dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="@dimen/measurement_tool_content_margin"
android:layout_marginLeft="@dimen/measurement_tool_content_margin_small"
android:layout_marginRight="@dimen/measurement_tool_content_margin"
android:layout_marginStart="@dimen/measurement_tool_content_margin_small"
android:layout_weight="1">
<ImageView
@ -105,9 +105,9 @@
android:layout_height="wrap_content"
android:layout_alignLeft="@id/line_image"
android:layout_alignStart="@id/line_image"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="8dp"
android:layout_marginLeft="@dimen/measurement_tool_bottom_image_text_margin_start"
android:layout_marginStart="@dimen/measurement_tool_bottom_image_text_margin_start"
android:layout_marginTop="@dimen/measurement_tool_content_margin_small"
android:text="@string/line"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_split_segments_sub"/>
@ -118,21 +118,21 @@
<RelativeLayout
android:id="@+id/save_as_route_point_row"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_height="@dimen/measurement_tool_bottom_list_item_height"
android:background="?attr/selectableItemBackground"
android:minHeight="48dp"
android:paddingEnd="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingStart="16dp">
android:minHeight="@dimen/measurement_tool_bottom_list_item_height"
android:paddingEnd="@dimen/measurement_tool_content_padding"
android:paddingLeft="@dimen/measurement_tool_content_padding"
android:paddingRight="@dimen/measurement_tool_content_padding"
android:paddingStart="@dimen/measurement_tool_content_padding">
<ImageView
android:id="@+id/route_point_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="24dp"
android:layout_marginRight="24dp"
android:layout_marginEnd="@dimen/measurement_tool_bottom_icon_margin"
android:layout_marginRight="@dimen/measurement_tool_bottom_icon_margin"
tools:src="@drawable/ic_action_route_points"/>
<TextView
@ -149,21 +149,21 @@
<RelativeLayout
android:id="@+id/save_as_line_row"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_height="@dimen/measurement_tool_bottom_list_item_height"
android:background="?attr/selectableItemBackground"
android:minHeight="48dp"
android:paddingEnd="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingStart="16dp">
android:minHeight="@dimen/measurement_tool_bottom_list_item_height"
android:paddingEnd="@dimen/measurement_tool_content_padding"
android:paddingLeft="@dimen/measurement_tool_content_padding"
android:paddingRight="@dimen/measurement_tool_content_padding"
android:paddingStart="@dimen/measurement_tool_content_padding">
<ImageView
android:id="@+id/line_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="24dp"
android:layout_marginRight="24dp"
android:layout_marginEnd="@dimen/measurement_tool_bottom_icon_margin"
android:layout_marginRight="@dimen/measurement_tool_bottom_icon_margin"
tools:src="@drawable/ic_action_split_interval"/>
<TextView
@ -199,7 +199,7 @@
android:text="@string/shared_string_cancel"
android:textAllCaps="true"
android:textColor="?attr/color_dialog_buttons"
android:textSize="14sp"
android:textSize="@dimen/default_desc_text_size"
android:textStyle="bold"/>
</FrameLayout>

View file

@ -16,24 +16,24 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="8dp">
android:paddingBottom="@dimen/measurement_tool_content_padding_small">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="56dp"
android:minHeight="56dp"
android:paddingEnd="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingStart="16dp">
android:layout_height="@dimen/measurement_tool_selected_point_title_height"
android:minHeight="@dimen/measurement_tool_selected_point_title_height"
android:paddingEnd="@dimen/measurement_tool_content_padding"
android:paddingLeft="@dimen/measurement_tool_content_padding"
android:paddingRight="@dimen/measurement_tool_content_padding"
android:paddingStart="@dimen/measurement_tool_content_padding">
<ImageView
android:id="@+id/selected_point_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="24dp"
android:layout_marginRight="24dp"
android:layout_marginEnd="@dimen/measurement_tool_bottom_icon_margin"
android:layout_marginRight="@dimen/measurement_tool_bottom_icon_margin"
tools:src="@drawable/ic_action_measure_point"/>
<LinearLayout
@ -74,9 +74,9 @@
android:textAppearance="@style/TextAppearance.ListItemTitle"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
tools:text="Altitude: 345 m"/>
android:layout_marginLeft="@dimen/measurement_tool_content_margin_small"
android:layout_marginRight="@dimen/measurement_tool_content_margin_small"
tools:text="A: 345 m"/>
<android.support.v7.widget.AppCompatTextView
android:maxLines="1"
@ -86,7 +86,7 @@
android:textAppearance="@style/TextAppearance.ListItemTitle"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"
tools:text="Speed: 45 km/h"/>
tools:text="S: 45 km/h"/>
</LinearLayout>
</LinearLayout>
@ -95,27 +95,27 @@
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginBottom="8dp"
android:layout_marginBottom="@dimen/measurement_tool_divider_margin"
android:background="?attr/dashboard_divider"/>
<RelativeLayout
android:id="@+id/move_point_row"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_height="@dimen/measurement_tool_bottom_list_item_height"
android:background="?attr/selectableItemBackground"
android:minHeight="48dp"
android:paddingEnd="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingStart="16dp">
android:minHeight="@dimen/measurement_tool_bottom_list_item_height"
android:paddingEnd="@dimen/measurement_tool_content_padding"
android:paddingLeft="@dimen/measurement_tool_content_padding"
android:paddingRight="@dimen/measurement_tool_content_padding"
android:paddingStart="@dimen/measurement_tool_content_padding">
<ImageView
android:id="@+id/move_point_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="24dp"
android:layout_marginRight="24dp"
android:layout_marginEnd="@dimen/measurement_tool_bottom_icon_margin"
android:layout_marginRight="@dimen/measurement_tool_bottom_icon_margin"
tools:src="@drawable/ic_action_move_point"/>
<TextView
@ -132,21 +132,21 @@
<RelativeLayout
android:id="@+id/delete_point_row"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_height="@dimen/measurement_tool_bottom_list_item_height"
android:background="?attr/selectableItemBackground"
android:minHeight="48dp"
android:paddingEnd="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingStart="16dp">
android:minHeight="@dimen/measurement_tool_bottom_list_item_height"
android:paddingEnd="@dimen/measurement_tool_content_padding"
android:paddingLeft="@dimen/measurement_tool_content_padding"
android:paddingRight="@dimen/measurement_tool_content_padding"
android:paddingStart="@dimen/measurement_tool_content_padding">
<ImageView
android:id="@+id/delete_point_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="24dp"
android:layout_marginRight="24dp"
android:layout_marginEnd="@dimen/measurement_tool_bottom_icon_margin"
android:layout_marginRight="@dimen/measurement_tool_bottom_icon_margin"
tools:src="@drawable/ic_action_remove_dark"/>
<TextView
@ -163,30 +163,30 @@
<View
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_marginBottom="8dp"
android:layout_marginLeft="64dp"
android:layout_marginStart="64dp"
android:layout_marginTop="7dp"
android:layout_marginBottom="@dimen/measurement_tool_bottom_divider_margin_bottom"
android:layout_marginLeft="@dimen/measurement_tool_bottom_divider_margin_start"
android:layout_marginStart="@dimen/measurement_tool_bottom_divider_margin_start"
android:layout_marginTop="@dimen/measurement_tool_bottom_divider_margin_top"
android:background="?attr/dashboard_divider"/>
<RelativeLayout
android:id="@+id/add_point_after_row"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_height="@dimen/measurement_tool_bottom_list_item_height"
android:background="?attr/selectableItemBackground"
android:minHeight="48dp"
android:paddingEnd="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingStart="16dp">
android:minHeight="@dimen/measurement_tool_bottom_list_item_height"
android:paddingEnd="@dimen/measurement_tool_content_padding"
android:paddingLeft="@dimen/measurement_tool_content_padding"
android:paddingRight="@dimen/measurement_tool_content_padding"
android:paddingStart="@dimen/measurement_tool_content_padding">
<ImageView
android:id="@+id/add_point_after_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="24dp"
android:layout_marginRight="24dp"
android:layout_marginEnd="@dimen/measurement_tool_bottom_icon_margin"
android:layout_marginRight="@dimen/measurement_tool_bottom_icon_margin"
tools:src="@drawable/ic_action_addpoint_above"/>
<TextView
@ -203,21 +203,21 @@
<RelativeLayout
android:id="@+id/add_point_before_row"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_height="@dimen/measurement_tool_bottom_list_item_height"
android:background="?attr/selectableItemBackground"
android:minHeight="48dp"
android:paddingEnd="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingStart="16dp">
android:minHeight="@dimen/measurement_tool_bottom_list_item_height"
android:paddingEnd="@dimen/measurement_tool_content_padding"
android:paddingLeft="@dimen/measurement_tool_content_padding"
android:paddingRight="@dimen/measurement_tool_content_padding"
android:paddingStart="@dimen/measurement_tool_content_padding">
<ImageView
android:id="@+id/add_point_before_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="24dp"
android:layout_marginRight="24dp"
android:layout_marginEnd="@dimen/measurement_tool_bottom_icon_margin"
android:layout_marginRight="@dimen/measurement_tool_bottom_icon_margin"
tools:src="@drawable/ic_action_addpoint_below"/>
<TextView
@ -254,7 +254,7 @@
android:text="@string/shared_string_close"
android:textAllCaps="true"
android:textColor="?attr/color_dialog_buttons"
android:textSize="14sp"
android:textSize="@dimen/default_desc_text_size"
android:textStyle="bold"/>
</FrameLayout>

View file

@ -16,27 +16,27 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="8dp">
android:paddingBottom="@dimen/measurement_tool_content_padding_small">
<TextView
android:id="@+id/choose_navigation_title"
android:layout_width="match_parent"
android:layout_height="52dp"
android:layout_height="@dimen/measurement_tool_bottom_title_height"
android:gravity="center_vertical"
android:paddingEnd="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingStart="16dp"
android:paddingEnd="@dimen/measurement_tool_content_padding"
android:paddingLeft="@dimen/measurement_tool_content_padding"
android:paddingRight="@dimen/measurement_tool_content_padding"
android:paddingStart="@dimen/measurement_tool_content_padding"
android:text="@string/choose_navigation_type"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
<TextView
android:layout_width="match_parent"
android:layout_height="44dp"
android:paddingEnd="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingStart="16dp"
android:layout_height="@dimen/measurement_tool_bottom_descr_height"
android:paddingEnd="@dimen/measurement_tool_content_padding"
android:paddingLeft="@dimen/measurement_tool_content_padding"
android:paddingRight="@dimen/measurement_tool_content_padding"
android:paddingStart="@dimen/measurement_tool_content_padding"
android:text="@string/measurement_tool_snap_to_road_descr"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"/>
@ -60,7 +60,7 @@
android:text="@string/shared_string_cancel"
android:textAllCaps="true"
android:textColor="?attr/color_dialog_buttons"
android:textSize="14sp"
android:textSize="@dimen/default_desc_text_size"
android:textStyle="bold"/>
</FrameLayout>

View file

@ -3,21 +3,21 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_height="@dimen/measurement_tool_bottom_list_item_height"
android:background="?attr/selectableItemBackground"
android:minHeight="48dp"
android:paddingEnd="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingStart="16dp">
android:minHeight="@dimen/measurement_tool_bottom_list_item_height"
android:paddingEnd="@dimen/measurement_tool_content_padding"
android:paddingLeft="@dimen/measurement_tool_content_padding"
android:paddingRight="@dimen/measurement_tool_content_padding"
android:paddingStart="@dimen/measurement_tool_content_padding">
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="24dp"
android:layout_marginRight="24dp"
android:layout_marginEnd="@dimen/measurement_tool_bottom_icon_margin"
android:layout_marginRight="@dimen/measurement_tool_bottom_icon_margin"
tools:src="@drawable/ic_action_car_dark"/>
<TextView

View file

@ -9,21 +9,21 @@
android:id="@+id/gpx_name_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="@dimen/measurement_tool_content_margin"
android:layout_marginLeft="@dimen/measurement_tool_content_margin"
android:layout_marginRight="@dimen/measurement_tool_content_margin"
android:layout_marginStart="@dimen/measurement_tool_content_margin"
android:layout_marginTop="@dimen/measurement_tool_content_margin"
android:inputType="text"/>
<TextView
android:id="@+id/file_exists_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="@dimen/measurement_tool_content_margin"
android:layout_marginLeft="@dimen/measurement_tool_content_margin"
android:layout_marginRight="@dimen/measurement_tool_content_margin"
android:layout_marginStart="@dimen/measurement_tool_content_margin"
android:gravity="center_horizontal"
android:text="@string/file_with_name_already_exists"
android:textColor="@color/marker_red"
@ -32,13 +32,13 @@
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="8dp"
android:layout_marginTop="@dimen/measurement_tool_divider_margin"
android:background="?attr/dashboard_divider"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp">
android:padding="@dimen/measurement_tool_content_padding">
<android.support.v7.widget.SwitchCompat
android:id="@+id/toggle_show_on_map"
@ -47,8 +47,8 @@
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"/>
android:layout_marginLeft="@dimen/measurement_tool_content_margin"
android:layout_marginStart="@dimen/measurement_tool_content_margin"/>
<TextView
android:layout_width="wrap_content"

View file

@ -7,4 +7,6 @@
<dimen name="my_places_empty_state_image_margin_top">39dp</dimen>
<dimen name="my_places_empty_state_image_margin_bottom">39dp</dimen>
<dimen name="measurement_tool_content_padding_medium">14dp</dimen>
</resources>

View file

@ -2,4 +2,6 @@
<resources>
<dimen name="my_places_empty_state_image_margin_top">59dp</dimen>
<dimen name="my_places_empty_state_image_margin_bottom">59dp</dimen>
<dimen name="measurement_tool_content_padding_medium">21dp</dimen>
</resources>

View file

@ -90,5 +90,37 @@
<dimen name="my_places_empty_state_text_button_padding_left">72dp</dimen>
<dimen name="my_places_empty_state_text_button_padding_right">90dp</dimen>
<dimen name="my_places_empty_state_text_button_padding_top">96dp</dimen>
<dimen name="measure_distance_bottom_sheet_cancel_button_height">72dp</dimen>
<dimen name="landscape_bottom_sheet_dialog_fragment_width">540dp</dimen>
<dimen name="measurement_tool_select_radius">30dp</dimen>
<dimen name="measurement_tool_content_margin">24dp</dimen>
<dimen name="measurement_tool_content_margin_small">12dp</dimen>
<dimen name="measurement_tool_content_padding">24dp</dimen>
<dimen name="measurement_tool_content_padding_small">12dp</dimen>
<dimen name="measurement_tool_divider_margin">12dp</dimen>
<dimen name="measurement_tool_content_padding_medium">18dp</dimen>
<dimen name="measurement_tool_text_margin_small">6dp</dimen>
<dimen name="measurement_tool_text_margin">12dp</dimen>
<dimen name="measurement_tool_points_list_container_height">330dp</dimen>
<dimen name="measurement_tool_controls_height">78dp</dimen>
<dimen name="measurement_tool_text_button_padding_small">18dp</dimen>
<dimen name="measurement_tool_text_button_padding">24dp</dimen>
<dimen name="measurement_tool_undo_redo_padding_small">18dp</dimen>
<dimen name="measurement_tool_undo_redo_padding_medium">21dp</dimen>
<dimen name="measurement_tool_undo_redo_padding">24dp</dimen>
<dimen name="measurement_tool_button_margin">12dp</dimen>
<dimen name="measurement_tool_button_padding">12dp</dimen>
<dimen name="measurement_tool_button_height">54dp</dimen>
<dimen name="measurement_tool_bottom_title_height">78dp</dimen>
<dimen name="measurement_tool_bottom_descr_height">66dp</dimen>
<dimen name="measurement_tool_bottom_list_item_height">72dp</dimen>
<dimen name="measurement_tool_bottom_icon_margin">36dp</dimen>
<dimen name="measurement_tool_bottom_divider_margin_top">11dp</dimen>
<dimen name="measurement_tool_bottom_divider_margin_bottom">12dp</dimen>
<dimen name="measurement_tool_bottom_divider_margin_start">96dp</dimen>
<dimen name="measurement_tool_bottom_image_text_margin_start">15dp</dimen>
<dimen name="measurement_tool_selected_point_title_height">84dp</dimen>
</resources>

View file

@ -160,4 +160,31 @@
<dimen name="landscape_bottom_sheet_dialog_fragment_width">360dp</dimen>
<dimen name="measurement_tool_select_radius">20dp</dimen>
<dimen name="measurement_tool_content_margin">16dp</dimen>
<dimen name="measurement_tool_content_margin_small">8dp</dimen>
<dimen name="measurement_tool_content_padding">16dp</dimen>
<dimen name="measurement_tool_content_padding_small">8dp</dimen>
<dimen name="measurement_tool_divider_margin">8dp</dimen>
<dimen name="measurement_tool_content_padding_medium">12dp</dimen>
<dimen name="measurement_tool_text_margin_small">4dp</dimen>
<dimen name="measurement_tool_text_margin">8dp</dimen>
<dimen name="measurement_tool_points_list_container_height">220dp</dimen>
<dimen name="measurement_tool_controls_height">52dp</dimen>
<dimen name="measurement_tool_text_button_padding_small">12dp</dimen>
<dimen name="measurement_tool_text_button_padding">16dp</dimen>
<dimen name="measurement_tool_undo_redo_padding_small">12dp</dimen>
<dimen name="measurement_tool_undo_redo_padding_medium">14dp</dimen>
<dimen name="measurement_tool_undo_redo_padding">16dp</dimen>
<dimen name="measurement_tool_button_margin">8dp</dimen>
<dimen name="measurement_tool_button_padding">8dp</dimen>
<dimen name="measurement_tool_button_height">36dp</dimen>
<dimen name="measurement_tool_bottom_title_height">52dp</dimen>
<dimen name="measurement_tool_bottom_descr_height">44dp</dimen>
<dimen name="measurement_tool_bottom_list_item_height">48dp</dimen>
<dimen name="measurement_tool_bottom_icon_margin">24dp</dimen>
<dimen name="measurement_tool_bottom_divider_margin_top">7dp</dimen>
<dimen name="measurement_tool_bottom_divider_margin_bottom">8dp</dimen>
<dimen name="measurement_tool_bottom_divider_margin_start">64dp</dimen>
<dimen name="measurement_tool_bottom_image_text_margin_start">10dp</dimen>
<dimen name="measurement_tool_selected_point_title_height">56dp</dimen>
</resources>

View file

@ -9,6 +9,8 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
-->
<string name="keep_showing_on_map">Keep showing on map</string>
<string name="exit_without_saving">Exit without saving?</string>
<string name="line">Line</string>
<string name="save_as_route_point">Save as route points</string>
<string name="save_as_line">Save as line</string>

View file

@ -27,12 +27,9 @@ public class MeasurementEditingContext {
private OsmandApplication application;
private final MeasurementCommandManager commandManager = new MeasurementCommandManager();
private TrkSegment before = new TrkSegment();
// cache should be deleted if before changed or snappedToRoadPoints
private final TrkSegment before = new TrkSegment();
private TrkSegment beforeCacheForSnap;
private TrkSegment after = new TrkSegment();
// cache should be deleted if after changed or snappedToRoadPoints
private final TrkSegment after = new TrkSegment();
private TrkSegment afterCacheForSnap;
private NewGpxData newGpxData;
@ -41,45 +38,56 @@ public class MeasurementEditingContext {
private WptPt originalPointToMove;
private boolean inSnapToRoadMode;
private boolean needUpdateCacheForSnap;
private int calculatedPairs;
private SnapToRoadProgressListener progressListener;
private ApplicationMode snapToRoadAppMode;
private RouteCalculationProgress calculationProgress;
private Queue<Pair<WptPt, WptPt>> snapToRoadPairsToCalculate = new ConcurrentLinkedQueue<>();
private Map<Pair<WptPt, WptPt>, List<WptPt>> snappedToRoadPoints = new ConcurrentHashMap<>();
private final Queue<Pair<WptPt, WptPt>> snapToRoadPairsToCalculate = new ConcurrentLinkedQueue<>();
private final Map<Pair<WptPt, WptPt>, List<WptPt>> snappedToRoadPoints = new ConcurrentHashMap<>();
public void setApplication(OsmandApplication application) {
this.application = application;
}
public MeasurementCommandManager getCommandManager() {
MeasurementCommandManager getCommandManager() {
return commandManager;
}
public boolean isInSnapToRoadMode() {
boolean isInSnapToRoadMode() {
return inSnapToRoadMode;
}
public int getSelectedPointPosition() {
public boolean isNeedUpdateCacheForSnap() {
return needUpdateCacheForSnap;
}
public void setNeedUpdateCacheForSnap(boolean needUpdateCacheForSnap) {
this.needUpdateCacheForSnap = needUpdateCacheForSnap;
updateCacheForSnapIfNeeded(true);
}
int getSelectedPointPosition() {
return selectedPointPosition;
}
public void setSelectedPointPosition(int selectedPointPosition) {
void setSelectedPointPosition(int selectedPointPosition) {
this.selectedPointPosition = selectedPointPosition;
}
public WptPt getOriginalPointToMove() {
WptPt getOriginalPointToMove() {
return originalPointToMove;
}
public void setOriginalPointToMove(WptPt originalPointToMove) {
void setOriginalPointToMove(WptPt originalPointToMove) {
this.originalPointToMove = originalPointToMove;
}
public void setInSnapToRoadMode(boolean inSnapToRoadMode) {
void setInSnapToRoadMode(boolean inSnapToRoadMode) {
this.inSnapToRoadMode = inSnapToRoadMode;
}
public NewGpxData getNewGpxData() {
NewGpxData getNewGpxData() {
return newGpxData;
}
@ -87,30 +95,31 @@ public class MeasurementEditingContext {
this.newGpxData = newGpxData;
}
public void setProgressListener(SnapToRoadProgressListener progressListener) {
void setProgressListener(SnapToRoadProgressListener progressListener) {
this.progressListener = progressListener;
}
public ApplicationMode getSnapToRoadAppMode() {
ApplicationMode getSnapToRoadAppMode() {
return snapToRoadAppMode;
}
public void setSnapToRoadAppMode(ApplicationMode snapToRoadAppMode) {
void setSnapToRoadAppMode(ApplicationMode snapToRoadAppMode) {
if (this.snapToRoadAppMode != null
&& !this.snapToRoadAppMode.getStringKey().equals(snapToRoadAppMode.getStringKey())) {
snappedToRoadPoints.clear();
updateCacheForSnapIfNeeded(true);
}
this.snapToRoadAppMode = snapToRoadAppMode;
}
public Map<Pair<WptPt, WptPt>, List<WptPt>> getSnappedPoints() {
return snappedToRoadPoints;
}
public TrkSegment getBeforeTrkSegmentLine() {
TrkSegment getBeforeTrkSegmentLine() {
if (beforeCacheForSnap != null) {
return beforeCacheForSnap;
}
return before;
}
public TrkSegment getAfterTrkSegmentLine() {
TrkSegment getAfterTrkSegmentLine() {
if (afterCacheForSnap != null) {
return afterCacheForSnap;
}
@ -121,11 +130,11 @@ public class MeasurementEditingContext {
return getBeforePoints();
}
public List<WptPt> getBeforePoints() {
List<WptPt> getBeforePoints() {
return before.points;
}
public List<WptPt> getAfterPoints() {
List<WptPt> getAfterPoints() {
return after.points;
}
@ -133,7 +142,7 @@ public class MeasurementEditingContext {
return before.points.size();
}
public void splitSegments(int position) {
void splitSegments(int position) {
List<WptPt> points = new ArrayList<>();
points.addAll(before.points);
points.addAll(after.points);
@ -159,21 +168,31 @@ public class MeasurementEditingContext {
updateCacheForSnapIfNeeded(false);
}
public WptPt removePoint(int position) {
public WptPt removePoint(int position, boolean updateSnapToRoad) {
WptPt pt = before.points.remove(position);
updateCacheForSnapIfNeeded(false);
if (updateSnapToRoad) {
updateCacheForSnapIfNeeded(false);
}
return pt;
}
public void clearSegments() {
before.points.clear();
after.points.clear();
beforeCacheForSnap = null;
afterCacheForSnap = null;
if (inSnapToRoadMode) {
beforeCacheForSnap.points.clear();
afterCacheForSnap.points.clear();
needUpdateCacheForSnap = true;
} else {
beforeCacheForSnap = null;
afterCacheForSnap = null;
needUpdateCacheForSnap = false;
}
}
void scheduleRouteCalculateIfNotEmpty() {
if (application == null || (before.points.size() < 1 && after.points.size() < 1)) {
needUpdateCacheForSnap = true;
if (application == null || (before.points.size() == 0 && after.points.size() == 0)) {
return;
}
snapToRoadPairsToCalculate.clear();
@ -221,7 +240,7 @@ public class MeasurementEditingContext {
}
private void updateCacheForSnapIfNeeded(boolean both) {
if (inSnapToRoadMode) {
if (needUpdateCacheForSnap) {
recreateCacheForSnap(beforeCacheForSnap = new TrkSegment(), before);
if (both) {
recreateCacheForSnap(afterCacheForSnap = new TrkSegment(), after);
@ -249,6 +268,7 @@ public class MeasurementEditingContext {
LatLon end = new LatLon(currentPair.second.getLatitude(), currentPair.second.getLongitude());
final RouteCalculationParams params = new RouteCalculationParams();
params.inSnapToRoadMode = true;
params.start = start;
params.end = end;
params.leftSide = settings.DRIVING_REGION.get().leftHandDriving;
@ -260,6 +280,11 @@ public class MeasurementEditingContext {
params.calculationProgressCallback = new RoutingHelper.RouteCalculationProgressCallback() {
@Override
public void updateProgress(int progress) {
int pairs = calculatedPairs + snapToRoadPairsToCalculate.size();
if (pairs != 0) {
int pairProgress = 100 / pairs;
progress = calculatedPairs * pairProgress + progress / pairs;
}
progressListener.updateProgress(progress);
}
@ -270,7 +295,7 @@ public class MeasurementEditingContext {
@Override
public void finish() {
progressListener.refreshMap();
calculatedPairs = 0;
}
};
params.resultListener = new RouteCalculationParams.RouteCalculationResultListener() {
@ -283,9 +308,15 @@ public class MeasurementEditingContext {
pt.lon = loc.getLongitude();
pts.add(pt);
}
calculatedPairs++;
snappedToRoadPoints.put(currentPair, pts);
updateCacheForSnapIfNeeded(true);
progressListener.refreshMap();
application.runInUIThread(new Runnable() {
@Override
public void run() {
progressListener.refresh();
}
});
if (!snapToRoadPairsToCalculate.isEmpty()) {
application.getRoutingHelper().startRouteCalculationThread(getParams(), true, true);
} else {
@ -310,6 +341,6 @@ public class MeasurementEditingContext {
void hideProgressBar();
void refreshMap();
void refresh();
}
}

View file

@ -48,6 +48,7 @@ import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.TrackActivity;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.helpers.GpxUiHelper;
import net.osmand.plus.measurementtool.NewGpxData.ActionType;
import net.osmand.plus.measurementtool.OptionsBottomSheetDialogFragment.OptionsFragmentListener;
import net.osmand.plus.measurementtool.SaveAsNewTrackBottomSheetDialogFragment.SaveAsNewTrackFragmentListener;
import net.osmand.plus.measurementtool.SelectedPointBottomSheetDialogFragment.SelectedPointFragmentListener;
@ -60,7 +61,6 @@ import net.osmand.plus.measurementtool.command.ClearPointsCommand;
import net.osmand.plus.measurementtool.command.MovePointCommand;
import net.osmand.plus.measurementtool.command.RemovePointCommand;
import net.osmand.plus.measurementtool.command.ReorderPointCommand;
import net.osmand.plus.measurementtool.NewGpxData.ActionType;
import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory;
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
@ -115,7 +115,7 @@ public class MeasurementToolFragment extends Fragment {
LINE
}
public void setEditingCtx(MeasurementEditingContext editingCtx) {
private void setEditingCtx(MeasurementEditingContext editingCtx) {
this.editingCtx = editingCtx;
}
@ -144,8 +144,9 @@ public class MeasurementToolFragment extends Fragment {
}
@Override
public void refreshMap() {
public void refresh() {
measurementLayer.refreshMap();
updateText();
}
});
@ -463,16 +464,9 @@ public class MeasurementToolFragment extends Fragment {
if (pointsListOpened) {
hidePointsList();
}
if (editingCtx.getOriginalPointToMove() != null) {
switchMovePointMode(false);
} else if (editingCtx.getSelectedPointPosition() != -1) {
switchAddPointBeforeAfterMode(false);
}
closeModes();
MeasurementToolLayer layer = getMeasurementLayer();
if (layer != null) {
if (editingCtx.getOriginalPointToMove() != null) {
layer.exitMovePointMode(true);
}
layer.setOnSingleTapListener(null);
layer.setOnEnterMovePointModeListener(null);
}
@ -606,7 +600,7 @@ public class MeasurementToolFragment extends Fragment {
@Override
public void addPointAfterOnClick() {
if (measurementLayer != null) {
measurementLayer.moveMapToPoint(editingCtx.getSelectedPointPosition());
measurementLayer.moveMapToPoint(editingCtx.getSelectedPointPosition());
editingCtx.splitSegments(editingCtx.getSelectedPointPosition() + 1);
}
((TextView) mainView.findViewById(R.id.add_point_before_after_text)).setText(mainView.getResources().getString(R.string.add_point_after));
@ -617,7 +611,7 @@ public class MeasurementToolFragment extends Fragment {
@Override
public void addPointBeforeOnClick() {
if (measurementLayer != null) {
measurementLayer.moveMapToPoint(editingCtx.getSelectedPointPosition());
measurementLayer.moveMapToPoint(editingCtx.getSelectedPointPosition());
editingCtx.splitSegments(editingCtx.getSelectedPointPosition());
}
((TextView) mainView.findViewById(R.id.add_point_before_after_text)).setText(mainView.getResources().getString(R.string.add_point_before));
@ -858,12 +852,24 @@ public class MeasurementToolFragment extends Fragment {
}
}
private void closeModes() {
if (editingCtx.getOriginalPointToMove() != null) {
switchMovePointMode(false);
} else if (editingCtx.getSelectedPointPosition() != -1) {
switchAddPointBeforeAfterMode(false);
}
MeasurementToolLayer layer = getMeasurementLayer();
if (layer != null && editingCtx.getOriginalPointToMove() != null) {
layer.exitMovePointMode(true);
}
}
private void addPointBeforeAfter() {
MeasurementToolLayer measurementLayer = getMeasurementLayer();
if (measurementLayer != null) {
int selectedPoint = editingCtx.getSelectedPointPosition(); //after = 1; before = 1;
int pointsCount = editingCtx.getPointsCount(); //after = 2; before = 1;
if (addCenterPoint()) { //выбрать вторую точку
int selectedPoint = editingCtx.getSelectedPointPosition();
int pointsCount = editingCtx.getPointsCount();
if (addCenterPoint()) {
if (selectedPoint == pointsCount) {
editingCtx.splitSegments(editingCtx.getPointsCount() - 1);
} else {
@ -1118,7 +1124,7 @@ public class MeasurementToolFragment extends Fragment {
fout = new File(dir, fileName);
}
}
saveNewGpx(dir, fileName, showOnMapToggle.isChecked(), saveType);
saveNewGpx(dir, fileName, showOnMapToggle.isChecked(), saveType, false);
}
})
.setNegativeButton(R.string.shared_string_cancel, null)
@ -1126,12 +1132,12 @@ public class MeasurementToolFragment extends Fragment {
}
}
private void saveNewGpx(File dir, String fileName, boolean checked, SaveType saveType) {
saveGpx(dir, fileName, checked, null, false, null, saveType);
private void saveNewGpx(File dir, String fileName, boolean checked, SaveType saveType, boolean close) {
saveGpx(dir, fileName, checked, null, false, null, saveType, close);
}
private void saveExistingGpx(GPXFile gpx, boolean showOnMap, NewGpxData.ActionType actionType, boolean openTrackActivity) {
saveGpx(null, null, showOnMap, gpx, openTrackActivity, actionType, null);
saveGpx(null, null, showOnMap, gpx, openTrackActivity, actionType, null, false);
}
private void saveGpx(final File dir,
@ -1140,7 +1146,8 @@ public class MeasurementToolFragment extends Fragment {
final GPXFile gpx,
final boolean openTrackActivity,
final NewGpxData.ActionType actionType,
final SaveType saveType) {
final SaveType saveType,
final boolean close) {
new AsyncTask<Void, Void, String>() {
@ -1149,6 +1156,7 @@ public class MeasurementToolFragment extends Fragment {
@Override
protected void onPreExecute() {
closeModes();
MapActivity activity = getMapActivity();
if (activity != null) {
progressDialog = new ProgressDialog(activity);
@ -1240,6 +1248,9 @@ public class MeasurementToolFragment extends Fragment {
Toast.makeText(activity,
MessageFormat.format(getString(R.string.gpx_saved_sucessfully), toSave.getAbsolutePath()),
Toast.LENGTH_LONG).show();
if (close) {
dismiss(activity);
}
}
} else {
Toast.makeText(activity, warning, Toast.LENGTH_LONG).show();
@ -1368,17 +1379,49 @@ public class MeasurementToolFragment extends Fragment {
dismiss(mapActivity);
return;
}
new AlertDialog.Builder(mapActivity)
.setTitle(getString(R.string.are_you_sure))
AlertDialog.Builder builder = new AlertDialog.Builder(mapActivity);
if (editingCtx.getNewGpxData() == null) {
final File dir = mapActivity.getMyApplication().getAppPath(IndexConstants.GPX_INDEX_DIR);
final LayoutInflater inflater = mapActivity.getLayoutInflater();
final View view = inflater.inflate(R.layout.close_measurement_tool_dialog, null);
final SwitchCompat showOnMapToggle = (SwitchCompat) view.findViewById(R.id.toggle_show_on_map);
builder.setView(view);
builder.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
final String name = new SimpleDateFormat("yyyy-M-dd_HH-mm_EEE", Locale.US).format(new Date());
String fileName = name + GPX_SUFFIX;
File fout = new File(dir, fileName);
int ind = 1;
while (fout.exists()) {
fileName = name + "_" + (++ind) + GPX_SUFFIX;
fout = new File(dir, fileName);
}
saveNewGpx(dir, fileName, showOnMapToggle.isChecked(), SaveType.LINE, true);
}
});
} else {
builder.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
GPXFile gpx = editingCtx.getNewGpxData().getGpxFile();
SelectedGpxFile selectedGpxFile = mapActivity.getMyApplication().getSelectedGpxHelper().getSelectedFileByPath(gpx.path);
boolean showOnMap = selectedGpxFile != null;
ActionType actionType = editingCtx.getNewGpxData().getActionType();
saveExistingGpx(gpx, showOnMap, actionType, true);
}
});
}
builder.setTitle(getString(R.string.exit_without_saving))
.setMessage(getString(R.string.unsaved_changes_will_be_lost))
.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
.setNegativeButton(R.string.shared_string_cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
public void onClick(DialogInterface dialogInterface, int i) {
dismiss(mapActivity);
}
})
.setNegativeButton(R.string.shared_string_cancel, null)
.show();
});
builder.show();
}
}

View file

@ -41,9 +41,9 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
private int marginPointIconY;
private int marginApplyingPointIconX;
private int marginApplyingPointIconY;
private Path path = new Path();
private TIntArrayList tx = new TIntArrayList();
private TIntArrayList ty = new TIntArrayList();
private final Path path = new Path();
private final TIntArrayList tx = new TIntArrayList();
private final TIntArrayList ty = new TIntArrayList();
private OnMeasureDistanceToCenter measureDistanceToCenterListener;
private OnSingleTapListener singleTapListener;
private OnEnterMovePointModeListener enterMovePointModeListener;
@ -102,7 +102,7 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
String getDistanceSt() {
float dist = 0;
List<WptPt> points = editingCtx.getPoints();
List<WptPt> points = editingCtx.getBeforeTrkSegmentLine().points;
if (points.size() > 0) {
for (int i = 1; i < points.size(); i++) {
dist += MapUtils.getDistance(points.get(i - 1).lat, points.get(i - 1).lon,
@ -131,7 +131,7 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
@Override
public boolean onLongPressEvent(PointF point, RotatedTileBox tileBox) {
if (inMeasurementMode) {
if (!overlapped && getEditingCtx().getSelectedPointPosition() == -1 && editingCtx.getPointsCount() > 0) {
if (!overlapped && getEditingCtx().getSelectedPointPosition() == -1 && editingCtx.getPointsCount() > 0) {
selectPoint(point.x, point.y, false);
if (editingCtx.getSelectedPointPosition() != -1) {
enterMovingPointMode();
@ -146,7 +146,7 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
void enterMovingPointMode() {
moveMapToPoint(editingCtx.getSelectedPointPosition());
WptPt pt = editingCtx.removePoint(editingCtx.getSelectedPointPosition());
WptPt pt = editingCtx.removePoint(editingCtx.getSelectedPointPosition(), false);
editingCtx.setOriginalPointToMove(pt);
editingCtx.splitSegments(editingCtx.getSelectedPointPosition());
}
@ -367,17 +367,17 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
view.getAnimatedDraggingThread().startMoving(lat, lon, view.getZoom(), true);
}
public void moveMapToPoint(int pos) {
if (editingCtx.getPointsCount() > 0) {
if (pos >= editingCtx.getPointsCount()) {
pos = editingCtx.getPointsCount() - 1;
} else if (pos < 0) {
pos = 0;
}
WptPt pt = editingCtx.getPoints().get(pos);
moveMapToLatLon(pt.getLatitude(), pt.getLongitude());
}
}
public void moveMapToPoint(int pos) {
if (editingCtx.getPointsCount() > 0) {
if (pos >= editingCtx.getPointsCount()) {
pos = editingCtx.getPointsCount() - 1;
} else if (pos < 0) {
pos = 0;
}
WptPt pt = editingCtx.getPoints().get(pos);
moveMapToLatLon(pt.getLatitude(), pt.getLongitude());
}
}
public void refreshMap() {
view.refreshMap();

View file

@ -4,7 +4,12 @@ import net.osmand.data.QuadRect;
import net.osmand.plus.GPXUtilities;
public class NewGpxData {
public enum ActionType { ADD_SEGMENT, ADD_ROUTE_POINTS, EDIT_SEGMENT }
public enum ActionType {
ADD_SEGMENT,
ADD_ROUTE_POINTS,
EDIT_SEGMENT
}
private GPXUtilities.GPXFile gpxFile;
private GPXUtilities.TrkSegment trkSegment;

View file

@ -18,7 +18,6 @@ import android.widget.TextView;
import net.osmand.AndroidUtils;
import net.osmand.plus.R;
import net.osmand.plus.Version;
import net.osmand.plus.base.BottomSheetDialogFragment;
import net.osmand.plus.helpers.AndroidUiHelper;

View file

@ -17,7 +17,7 @@ import net.osmand.plus.IconsCache;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.measurementtool.NewGpxData;
import net.osmand.plus.measurementtool.NewGpxData.ActionType;
import net.osmand.util.MapUtils;
import java.util.Collections;
@ -30,9 +30,9 @@ public class MeasurementToolAdapter extends RecyclerView.Adapter<MeasurementTool
private final List<WptPt> points;
private MeasurementAdapterListener listener;
private boolean nightMode;
private NewGpxData.ActionType actionType;
private final ActionType actionType;
public MeasurementToolAdapter(MapActivity mapActivity, List<WptPt> points, NewGpxData.ActionType actionType) {
public MeasurementToolAdapter(MapActivity mapActivity, List<WptPt> points, ActionType actionType) {
this.mapActivity = mapActivity;
this.points = points;
this.actionType = actionType;
@ -77,14 +77,14 @@ public class MeasurementToolAdapter extends RecyclerView.Adapter<MeasurementTool
holder.icon.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_measure_point,
nightMode ? R.color.ctx_menu_info_text_dark : R.color.icon_color));
if (nightMode) {
holder.title.setTextColor(mapActivity.getMyApplication().getResources().getColor(R.color.primary_text_dark));
holder.title.setTextColor(ContextCompat.getColor(mapActivity, R.color.primary_text_dark));
}
WptPt pt = points.get(pos);
String pointTitle = pt.name;
if (!TextUtils.isEmpty(pointTitle)) {
holder.title.setText(pointTitle);
} else {
if (actionType == NewGpxData.ActionType.ADD_ROUTE_POINTS) {
if (actionType == ActionType.ADD_ROUTE_POINTS) {
holder.title.setText(mapActivity.getString(R.string.route_point) + " - " + (pos + 1));
} else {
holder.title.setText(mapActivity.getString(R.string.plugin_distance_point) + " - " + (pos + 1));
@ -105,7 +105,7 @@ public class MeasurementToolAdapter extends RecyclerView.Adapter<MeasurementTool
holder.descr.setText(OsmAndFormatter.getFormattedDistance(dist, mapActivity.getMyApplication()));
}
}
if (actionType == NewGpxData.ActionType.EDIT_SEGMENT) {
if (actionType == ActionType.EDIT_SEGMENT) {
double elevation = pt.ele;
if (!Double.isNaN(elevation)) {
String eleStr = (mapActivity.getString(R.string.altitude)).substring(0, 1);

View file

@ -7,7 +7,7 @@ public class AddPointCommand extends MeasurementModeCommand {
private final int position;
private WptPt point;
private boolean center;
private final boolean center;
public AddPointCommand(MeasurementToolLayer measurementLayer, boolean center) {
this.measurementLayer = measurementLayer;
@ -28,7 +28,7 @@ public class AddPointCommand extends MeasurementModeCommand {
@Override
public void undo() {
measurementLayer.getEditingCtx().removePoint(position);
measurementLayer.getEditingCtx().removePoint(position, true);
measurementLayer.refreshMap();
}

View file

@ -9,6 +9,7 @@ import java.util.List;
public class ClearPointsCommand extends MeasurementModeCommand {
private List<WptPt> points;
private boolean needUpdateCache;
public ClearPointsCommand(MeasurementToolLayer measurementLayer) {
this.measurementLayer = measurementLayer;
@ -17,6 +18,7 @@ public class ClearPointsCommand extends MeasurementModeCommand {
@Override
public boolean execute() {
List<WptPt> pts = measurementLayer.getEditingCtx().getPoints();
needUpdateCache = measurementLayer.getEditingCtx().isNeedUpdateCacheForSnap();
points = new LinkedList<>(pts);
pts.clear();
measurementLayer.getEditingCtx().clearSegments();
@ -27,6 +29,9 @@ public class ClearPointsCommand extends MeasurementModeCommand {
@Override
public void undo() {
measurementLayer.getEditingCtx().addPoints(points);
if (needUpdateCache) {
measurementLayer.getEditingCtx().setNeedUpdateCacheForSnap(true);
}
measurementLayer.refreshMap();
}

View file

@ -1,6 +1,6 @@
package net.osmand.plus.measurementtool.command;
public interface Command {
interface Command {
boolean execute();

View file

@ -23,14 +23,14 @@ public class MovePointCommand extends MeasurementModeCommand {
@Override
public void undo() {
measurementLayer.getEditingCtx().removePoint(position);
measurementLayer.getEditingCtx().removePoint(position, false);
measurementLayer.getEditingCtx().addPoint(position, oldPoint);
measurementLayer.refreshMap();
}
@Override
public void redo() {
measurementLayer.getEditingCtx().removePoint(position);
measurementLayer.getEditingCtx().removePoint(position, false);
measurementLayer.getEditingCtx().addPoint(position, newPoint);
measurementLayer.refreshMap();
}

View file

@ -15,7 +15,7 @@ public class RemovePointCommand extends MeasurementModeCommand {
@Override
public boolean execute() {
point = measurementLayer.getEditingCtx().removePoint(position);
point = measurementLayer.getEditingCtx().removePoint(position, true);
measurementLayer.refreshMap();
return true;
}
@ -29,7 +29,7 @@ public class RemovePointCommand extends MeasurementModeCommand {
@Override
public void redo() {
measurementLayer.getEditingCtx().removePoint(position);
measurementLayer.getEditingCtx().removePoint(position, true);
measurementLayer.refreshMap();
}

View file

@ -1,8 +1,9 @@
package net.osmand.plus.measurementtool.command;
import net.osmand.plus.GPXUtilities.WptPt;
import net.osmand.plus.measurementtool.MeasurementToolLayer;
import java.util.Collections;
import java.util.List;
public class ReorderPointCommand extends MeasurementModeCommand {
@ -22,16 +23,17 @@ public class ReorderPointCommand extends MeasurementModeCommand {
@Override
public void undo() {
swap();
reorder(from, to);
}
@Override
public void redo() {
swap();
reorder(to, from);
}
private void swap() {
Collections.swap(measurementLayer.getEditingCtx().getPoints(), from, to);
private void reorder(int addTo, int removeFrom) {
List<WptPt> points = measurementLayer.getEditingCtx().getPoints();
points.add(addTo, points.remove(removeFrom));
measurementLayer.refreshMap();
}

View file

@ -1,41 +0,0 @@
package net.osmand.plus.measurementtool.command;
import net.osmand.plus.GPXUtilities.WptPt;
import net.osmand.plus.measurementtool.MeasurementToolLayer;
import java.util.List;
public class SnapToRoadCommand extends MeasurementModeCommand {
private List<WptPt> snappedPoints;
public SnapToRoadCommand(MeasurementToolLayer measurementLayer, List<WptPt> points) {
this.measurementLayer = measurementLayer;
this.snappedPoints = points;
}
@Override
public boolean execute() {
// measurementLayer.getSnappedToRoadPoints().clear();
// measurementLayer.getSnappedToRoadPoints().addAll(snappedPoints);
// measurementLayer.refreshMap();
return true;
}
@Override
public void undo() {
// measurementLayer.getSnappedToRoadPoints().clear();
measurementLayer.refreshMap();
}
@Override
public void redo() {
// measurementLayer.getSnappedToRoadPoints().addAll(snappedPoints);
measurementLayer.refreshMap();
}
@Override
MeasurementCommandType getType() {
return MeasurementCommandType.SNAP_TO_ROAD;
}
}

View file

@ -869,7 +869,9 @@ public class RoutingHelper {
RouteCalculationResult prev = route;
synchronized (RoutingHelper.this) {
if (res.isCalculated()) {
route = res;
if (!params.inSnapToRoadMode) {
route = res;
}
if (params.resultListener != null) {
params.resultListener.onRouteCalculated(res.getRouteLocations());
}
@ -880,8 +882,9 @@ public class RoutingHelper {
currentRunningJob = null;
}
if(res.isCalculated()){
setNewRoute(prev, res, params.start);
if (!params.inSnapToRoadMode) {
setNewRoute(prev, res, params.start);
}
} else if (onlineSourceWithoutInternet) {
lastRouteCalcError = app.getString(R.string.error_calculating_route)
+ ":\n" + app.getString(R.string.internet_connection_required_for_online_route);