Merge pull request #4492 from osmandapp/sasha_pasha_branch

Sasha pasha branch
This commit is contained in:
Alexey 2017-09-29 16:03:37 +03:00 committed by GitHub
commit f1e07956d1
26 changed files with 1393 additions and 320 deletions

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/map_widget_blue" android:state_pressed="true"/>
<item android:color="@color/bg_color_dark"/>
</selector>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/map_widget_blue" android:state_pressed="true"/>
<item android:drawable="@color/bg_color_light"/>
</selector>

View file

@ -51,33 +51,53 @@
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/markers_distance_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
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:ellipsize="end"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.ListItemTitle"
tools:text="1.39 km,"/>
<TextView
android:id="@+id/markers_time_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"
tools:text="~ 45 min."/>
</LinearLayout>
<TextView
android:id="@+id/markers_distance_text_view"
android:id="@+id/markers_count_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
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:ellipsize="end"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.ListItemTitle"
tools:text="1.39 km,"/>
<TextView
android:id="@+id/markers_time_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"
tools:text="~ 45 min."/>
android:textSize="@dimen/default_sub_text_size"
tools:text="3 markers"/>
</LinearLayout>
<net.osmand.plus.widgets.TextViewEx
@ -104,6 +124,7 @@
android:background="?attr/dashboard_divider"/>
<LinearLayout
android:id="@+id/buttons_row"
android:layout_width="0dp"
android:layout_height="@dimen/measurement_tool_controls_height"
android:layout_weight="0.5">

View file

@ -68,33 +68,39 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
<net.osmand.plus.OsmandTextFieldBoxes
android:id="@+id/latitude_box"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
app:labelText="@string/navigate_point_latitude">
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
android:hint="50:00.0000"
android:id="@+id/latitude_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</studio.carbonylgroup.textfieldboxes.TextFieldBoxes>
</net.osmand.plus.OsmandTextFieldBoxes>
<View
android:layout_width="16dp"
android:layout_height="match_parent"/>
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
<net.osmand.plus.OsmandTextFieldBoxes
android:id="@+id/longitude_box"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
app:labelText="@string/navigate_point_longitude">
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
android:hint="50:00.0000"
android:id="@+id/longitude_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</studio.carbonylgroup.textfieldboxes.TextFieldBoxes>
</net.osmand.plus.OsmandTextFieldBoxes>
</LinearLayout>
@ -104,17 +110,24 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
<net.osmand.plus.OsmandTextFieldBoxes
android:id="@+id/name_box"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
app:labelText="@string/shared_string_name">
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
android:hint="@string/access_hint_enter_name"
android:id="@+id/name_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</studio.carbonylgroup.textfieldboxes.TextFieldBoxes>
</net.osmand.plus.OsmandTextFieldBoxes>
<View
android:layout_width="16dp"
android:layout_height="match_parent"/>
<View
android:layout_width="0dp"
@ -131,13 +144,14 @@
</LinearLayout>
<FrameLayout
<LinearLayout
android:id="@+id/keyboard_layout"
android:layout_gravity="bottom"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<GridView
osmand:visibility="gone"
android:id="@+id/keyboard_grid_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -147,6 +161,47 @@
android:stretchMode="columnWidth"
android:numColumns="3"/>
</FrameLayout>
<View
android:id="@+id/keyboard_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
<LinearLayout
android:background="?attr/bg_color"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="56dp">
<ImageView
android:id="@+id/show_hide_keyboard_icon"
android:padding="@dimen/bottom_sheet_content_padding"
android:background="?attr/selectableItemBackground"
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
osmand:src="@drawable/ic_action_arrow_down"/>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="?attr/dashboard_divider"/>
<net.osmand.plus.widgets.TextViewEx
android:maxLines="1"
android:ellipsize="end"
android:id="@+id/add_marker"
android:textAllCaps="true"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:gravity="center"
android:textColor="@color/keyboard_color"
osmand:typeface="@string/font_roboto_regular"
android:text="@string/shared_string_add"/>
</LinearLayout>
</LinearLayout>
</FrameLayout>

View file

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
android:orientation="vertical">
<ScrollView
android:id="@+id/marker_coordinate_input_scroll_view"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="@dimen/bottom_sheet_content_padding_small">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/coordinate_input_title"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_title_height"
android:gravity="center_vertical"
android:paddingEnd="@dimen/bottom_sheet_content_padding"
android:paddingLeft="@dimen/bottom_sheet_content_padding"
android:paddingRight="@dimen/bottom_sheet_content_padding"
android:paddingStart="@dimen/bottom_sheet_content_padding"
android:text="@string/fast_coordinates_input"
android:textAppearance="@style/TextAppearance.ListItemTitle"
osmand:typeface="@string/font_roboto_medium"/>
<TextView
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_descr_height"
android:paddingEnd="@dimen/bottom_sheet_content_padding"
android:paddingLeft="@dimen/bottom_sheet_content_padding"
android:paddingRight="@dimen/bottom_sheet_content_padding"
android:paddingStart="@dimen/bottom_sheet_content_padding"
android:text="@string/fast_coordinates_input_descr"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"/>
<include layout="@layout/marker_coordinate_formats"/>
</LinearLayout>
</ScrollView>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
<FrameLayout
android:id="@+id/cancel_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_cancel_button_height"
android:background="?attr/selectableItemBackground">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/shared_string_close"
android:textAllCaps="true"
android:textColor="?attr/color_dialog_buttons"
android:textSize="@dimen/default_desc_text_size"
android:textStyle="bold"/>
</FrameLayout>
</LinearLayout>

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
android:orientation="vertical">
<ScrollView
android:id="@+id/marker_coordinate_input_scroll_view"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="@dimen/bottom_sheet_content_padding_small">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/coordinate_input_title"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_title_height"
android:gravity="center_vertical"
android:paddingEnd="@dimen/bottom_sheet_content_padding"
android:paddingLeft="@dimen/bottom_sheet_content_padding"
android:paddingRight="@dimen/bottom_sheet_content_padding"
android:paddingStart="@dimen/bottom_sheet_content_padding"
android:text="@string/shared_string_options"
android:textAppearance="@style/TextAppearance.ListItemTitle"
osmand:typeface="@string/font_roboto_medium"/>
<LinearLayout
android:id="@+id/use_system_keyboard_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:background="?attr/selectableItemBackground"
android:descendantFocusability="blocksDescendants"
android:minHeight="@dimen/bottom_sheet_list_item_height"
android:paddingLeft="@dimen/bottom_sheet_content_padding"
android:paddingRight="@dimen/bottom_sheet_content_padding">
<ImageView
android:layout_gravity="center_vertical"
android:id="@+id/use_system_keyboard_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_keyboard"/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/use_system_keyboard"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
<android.support.v7.widget.SwitchCompat
android:id="@+id/use_system_keyboard_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:background="@null"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
<TextView
android:textColor="?android:textColorSecondary"
android:ellipsize="end"
android:maxLines="1"
android:textAllCaps="true"
android:paddingTop="@dimen/bottom_sheet_content_padding_small"
android:paddingBottom="@dimen/bottom_sheet_content_padding_small"
android:paddingLeft="@dimen/bottom_sheet_content_padding"
android:paddingRight="@dimen/bottom_sheet_content_padding"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/coordinates_format"/>
<include layout="@layout/marker_coordinate_formats"/>
</LinearLayout>
</ScrollView>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
<FrameLayout
android:id="@+id/cancel_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_cancel_button_height"
android:background="?attr/selectableItemBackground">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/shared_string_close"
android:textAllCaps="true"
android:textColor="?attr/color_dialog_buttons"
android:textSize="@dimen/default_desc_text_size"
android:textStyle="bold"/>
</FrameLayout>
</LinearLayout>

View file

@ -111,6 +111,7 @@
android:background="?attr/dashboard_divider"/>
<LinearLayout
android:visibility="gone"
android:id="@+id/coordinate_input_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"

View file

@ -46,33 +46,53 @@
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/markers_distance_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
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:ellipsize="end"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.ListItemTitle"
tools:text="1.39 km,"/>
<TextView
android:id="@+id/markers_time_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"
tools:text="~ 45 min."/>
</LinearLayout>
<TextView
android:id="@+id/markers_distance_text_view"
android:id="@+id/markers_count_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
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:ellipsize="end"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.ListItemTitle"
tools:text="1.39 km,"/>
<TextView
android:id="@+id/markers_time_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"
tools:text="~ 45 min."/>
android:textSize="@dimen/default_sub_text_size"
tools:text="3 markers"/>
</LinearLayout>
<net.osmand.plus.widgets.TextViewEx
@ -123,6 +143,7 @@
</FrameLayout>
<LinearLayout
android:id="@+id/buttons_row"
android:layout_width="match_parent"
android:layout_height="@dimen/measurement_tool_controls_height">

View file

@ -1,16 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="?attr/bg_color"
android:orientation="vertical">
<TextView
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/keyboard_item"
android:textAllCaps="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textColor="@color/keyboard_color"
osmand:typeface="@string/font_roboto_regular"
tools:text="3"/>
</LinearLayout>

View file

@ -7,11 +7,21 @@
android:descendantFocusability="blocksDescendants"
android:orientation="vertical">
<include
<LinearLayout
android:id="@+id/top_divider"
layout="@layout/list_item_divider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible"/>
tools:visibility="visible">
<View
android:layout_width="match_parent"
android:layout_height="4dp"/>
<include layout="@layout/card_top_divider"/>
</LinearLayout>
<LinearLayout
android:id="@+id/main_layout"

View file

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/degrees_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="@dimen/bottom_sheet_list_item_height"
android:paddingEnd="@dimen/bottom_sheet_content_padding"
android:paddingLeft="@dimen/bottom_sheet_content_padding"
android:paddingRight="@dimen/bottom_sheet_content_padding"
android:paddingStart="@dimen/bottom_sheet_content_padding">
<ImageView
android:id="@+id/degrees_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_coordinates_latitude"/>
<TextView
android:id="@+id/degrees_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.ListItemTitle"
tools:text="DDD.DD"/>
<RadioButton
android:id="@+id/degrees_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:focusable="false"/>
</LinearLayout>
<LinearLayout
android:id="@+id/minutes_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="@dimen/bottom_sheet_list_item_height"
android:paddingEnd="@dimen/bottom_sheet_content_padding"
android:paddingLeft="@dimen/bottom_sheet_content_padding"
android:paddingRight="@dimen/bottom_sheet_content_padding"
android:paddingStart="@dimen/bottom_sheet_content_padding">
<ImageView
android:id="@+id/minutes_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_coordinates_latitude"/>
<TextView
android:id="@+id/minutes_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.ListItemTitle"
tools:text="DDD MM.MM"/>
<RadioButton
android:id="@+id/minutes_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:focusable="false"/>
</LinearLayout>
<LinearLayout
android:id="@+id/seconds_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="@dimen/bottom_sheet_list_item_height"
android:paddingEnd="@dimen/bottom_sheet_content_padding"
android:paddingLeft="@dimen/bottom_sheet_content_padding"
android:paddingRight="@dimen/bottom_sheet_content_padding"
android:paddingStart="@dimen/bottom_sheet_content_padding">
<ImageView
android:id="@+id/seconds_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_coordinates_latitude"/>
<TextView
android:id="@+id/seconds_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.ListItemTitle"
tools:text="DDD MM SS.SS"/>
<RadioButton
android:id="@+id/seconds_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:focusable="false"/>
</LinearLayout>
</LinearLayout>

View file

@ -1,97 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/list_item_divider"/>
<LinearLayout
android:id="@+id/background_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.AppCompatImageView
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_gravity="center_vertical"
android:scaleType="centerInside"
android:src="@drawable/map_pedestrian_location"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:minHeight="56dp"
android:orientation="vertical"
android:paddingBottom="12dp"
android:paddingTop="10dp">
<android.support.v7.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/my_location"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
<android.support.v7.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:ellipsize="end"
android:maxLines="2"
android:text="@string/add_location_as_first_point_descr"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginLeft="56dp"
android:layout_marginStart="56dp">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/use_location_button"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"
android:ellipsize="end"
android:gravity="center_vertical"
android:maxLines="1"
android:paddingEnd="@dimen/measurement_tool_text_button_padding_small"
android:paddingRight="@dimen/measurement_tool_text_button_padding_small"
android:text="@string/use_location"
android:textColor="?attr/color_dialog_buttons"
osmand:textAllCapsCompat="true"
osmand:typeface="@string/font_roboto_medium"/>
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/do_not_use_location_button"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"
android:ellipsize="end"
android:gravity="center_vertical"
android:maxLines="1"
android:paddingLeft="@dimen/measurement_tool_text_button_padding_small"
android:paddingStart="@dimen/measurement_tool_text_button_padding_small"
android:text="@string/shared_string_do_not_use"
android:textColor="?attr/color_dialog_buttons"
osmand:textAllCapsCompat="true"
osmand:typeface="@string/font_roboto_medium"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>

View file

@ -264,4 +264,6 @@
<color name="marker_circle_button_color_dark">#525e66</color>
<color name="keyboard_color">#545454</color>
</resources>

View file

@ -9,6 +9,11 @@
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="shared_string_markers">Markers</string>
<string name="coordinates_format">Coordinates format</string>
<string name="use_system_keyboard">Use system keyboard</string>
<string name="fast_coordinates_input_descr">Choose coordinate format before start. You can always change it by tapping Options.</string>
<string name="fast_coordinates_input">Fast Coordinates input</string>
<string name="routing_attr_avoid_ice_roads_fords_name">Avoid ice roads, fords</string>
<string name="routing_attr_avoid_ice_roads_fords_description">Avoid ice roads and fords</string>
<string name="use_location">Use location</string>

View file

@ -0,0 +1,88 @@
package net.osmand.plus;
import android.content.Context;
import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import studio.carbonylgroup.textfieldboxes.TextFieldBoxes;
public class OsmandTextFieldBoxes extends TextFieldBoxes {
private boolean useOsmandKeyboard;
public void setUseOsmandKeyboard(boolean useOsmandKeyboard) {
this.useOsmandKeyboard = useOsmandKeyboard;
}
public OsmandTextFieldBoxes(Context context) {
super(context);
}
public OsmandTextFieldBoxes(Context context, AttributeSet attrs) {
super(context, attrs);
}
public OsmandTextFieldBoxes(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
if (editText != null) {
this.panel.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
if(!OsmandTextFieldBoxes.this.isActivated()) {
OsmandTextFieldBoxes.this.activate(true);
}
OsmandTextFieldBoxes.this.setHasFocus(true);
if (!useOsmandKeyboard) {
OsmandTextFieldBoxes.this.inputMethodManager.showSoftInput(OsmandTextFieldBoxes.this.editText, InputMethodManager.SHOW_IMPLICIT);
}
}
});
this.iconImageButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
select();
}
});
}
}
public void select() {
if(!OsmandTextFieldBoxes.this.isActivated()) {
OsmandTextFieldBoxes.this.activate(true);
}
OsmandTextFieldBoxes.this.setHasFocus(true);
if (!useOsmandKeyboard) {
OsmandTextFieldBoxes.this.inputMethodManager.showSoftInput(OsmandTextFieldBoxes.this.editText, InputMethodManager.SHOW_IMPLICIT);
}
}
@Override
public void activate(boolean animated) {
super.activate(animated);
}
@Override
protected void deactivate() {
if(this.editText.getText().toString().isEmpty()) {
ViewCompat.animate(this.floatingLabel).alpha(1.0F).scaleX(1.0F).scaleY(1.0F).translationY(0.0F).setDuration((long)this.ANIMATION_DURATION);
this.editTextLayout.setVisibility(View.INVISIBLE);
if(this.editText.hasFocus()) {
if (!useOsmandKeyboard) {
this.inputMethodManager.hideSoftInputFromWindow(this.editText.getWindowToken(), InputMethodManager.RESULT_UNCHANGED_SHOWN);
}
this.editText.clearFocus();
}
}
this.activated = false;
}
}

View file

@ -0,0 +1,261 @@
package net.osmand.plus.mapmarkers;
import android.content.DialogInterface;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.DrawableRes;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.SwitchCompat;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.Window;
import android.view.WindowManager;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.TextView;
import net.osmand.AndroidUtils;
import net.osmand.data.PointDescription;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.BottomSheetDialogFragment;
import net.osmand.plus.helpers.AndroidUiHelper;
public class CoordinateInputBottomSheetDialogFragment extends BottomSheetDialogFragment {
public final static String TAG = "CoordinateInputBottomSheetDialogFragment";
private boolean portrait;
private View mainView;
private boolean night;
private int coordinateFormat = -1;
private boolean useOsmandKeyboard = true;
private CoordinateInputFormatChangeListener listener;
private boolean shouldClose;
public void setListener(CoordinateInputFormatChangeListener listener) {
this.listener = listener;
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle args = getArguments();
if (args != null) {
coordinateFormat = args.getInt(CoordinateInputDialogFragment.COORDINATE_FORMAT);
useOsmandKeyboard = args.getBoolean(CoordinateInputDialogFragment.USE_OSMAND_KEYBOARD);
} else {
shouldClose = true;
}
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final MapActivity mapActivity = (MapActivity) getActivity();
portrait = AndroidUiHelper.isOrientationPortrait(getActivity());
night = !mapActivity.getMyApplication().getSettings().isLightContent();
final int themeRes = night ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes), coordinateFormat == -1 ?
R.layout.fragment_marker_coordinate_input_bottom_sheet_dialog : R.layout.fragment_marker_coordinate_input_options_bottom_sheet_helper, container);
if (portrait) {
AndroidUtils.setBackground(getActivity(), mainView, night, R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark);
}
if (night) {
((TextView) mainView.findViewById(R.id.coordinate_input_title)).setTextColor(getResources().getColor(R.color.ctx_menu_info_text_dark));
}
ImageView degreesIcon = (ImageView) mainView.findViewById(R.id.degrees_icon);
TextView degreesText = (TextView) mainView.findViewById(R.id.degrees_text);
if (coordinateFormat == PointDescription.FORMAT_DEGREES) {
degreesIcon.setImageDrawable(getIcon(R.drawable.ic_action_coordinates_latitude, R.color.dashboard_blue));
degreesText.setTextColor(ContextCompat.getColor(mapActivity, R.color.dashboard_blue));
((RadioButton) mainView.findViewById(R.id.degrees_radio_button)).setChecked(true);
} else {
degreesIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_coordinates_latitude));
}
degreesText.setText(PointDescription.formatToHumanString(getContext(), PointDescription.FORMAT_DEGREES));
ImageView minutesIcon = (ImageView) mainView.findViewById(R.id.minutes_icon);
TextView minutesText = (TextView) mainView.findViewById(R.id.minutes_text);
if (coordinateFormat == PointDescription.FORMAT_MINUTES) {
minutesIcon.setImageDrawable(getIcon(R.drawable.ic_action_coordinates_latitude, R.color.dashboard_blue));
minutesText.setTextColor(ContextCompat.getColor(mapActivity, R.color.dashboard_blue));
((RadioButton) mainView.findViewById(R.id.minutes_radio_button)).setChecked(true);
} else {
minutesIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_coordinates_latitude));
}
minutesText.setText(PointDescription.formatToHumanString(getContext(), PointDescription.FORMAT_MINUTES));
ImageView secondsIcon = (ImageView) mainView.findViewById(R.id.seconds_icon);
TextView secondsText = (TextView) mainView.findViewById(R.id.seconds_text);
if (coordinateFormat == PointDescription.FORMAT_SECONDS) {
secondsIcon.setImageDrawable(getIcon(R.drawable.ic_action_coordinates_latitude, R.color.dashboard_blue));
secondsText.setTextColor(ContextCompat.getColor(mapActivity, R.color.dashboard_blue));
((RadioButton) mainView.findViewById(R.id.seconds_radio_button)).setChecked(true);
} else {
secondsIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_coordinates_latitude));
}
secondsText.setText(PointDescription.formatToHumanString(getContext(), PointDescription.FORMAT_SECONDS));
if (coordinateFormat != -1) {
((CompoundButton) mainView.findViewById(R.id.use_system_keyboard_switch)).setChecked(!useOsmandKeyboard);
((ImageView) mainView.findViewById(R.id.use_system_keyboard_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_keyboard));
mainView.findViewById(R.id.use_system_keyboard_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
useOsmandKeyboard = !useOsmandKeyboard;
((CompoundButton) mainView.findViewById(R.id.use_system_keyboard_switch)).setChecked(!useOsmandKeyboard);
if (listener != null) {
listener.onKeyboardChanged(useOsmandKeyboard);
}
}
});
highlightSelectedItem(true);
}
View.OnClickListener formatChangeListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
highlightSelectedItem(false);
switch (view.getId()) {
case R.id.degrees_row:
coordinateFormat = PointDescription.FORMAT_DEGREES;
break;
case R.id.minutes_row:
coordinateFormat = PointDescription.FORMAT_MINUTES;
break;
case R.id.seconds_row:
coordinateFormat = PointDescription.FORMAT_SECONDS;
break;
default:
throw new IllegalArgumentException("Unsupported format");
}
highlightSelectedItem(true);
if (listener != null) {
listener.onCoordinateFormatChanged(coordinateFormat);
}
if (shouldClose) {
dismiss();
}
}
};
mainView.findViewById(R.id.degrees_row).setOnClickListener(formatChangeListener);
mainView.findViewById(R.id.minutes_row).setOnClickListener(formatChangeListener);
mainView.findViewById(R.id.seconds_row).setOnClickListener(formatChangeListener);
mainView.findViewById(R.id.cancel_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dismiss();
if (shouldClose && listener != null) {
listener.onCancel();
}
}
});
final int screenHeight = AndroidUtils.getScreenHeight(getActivity());
final int statusBarHeight = AndroidUtils.getStatusBarHeight(getActivity());
final int navBarHeight = AndroidUtils.getNavBarHeight(getActivity());
mainView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
final View scrollView = mainView.findViewById(R.id.marker_coordinate_input_scroll_view);
int scrollViewHeight = scrollView.getHeight();
int dividerHeight = AndroidUtils.dpToPx(getContext(), 1);
int cancelButtonHeight = getContext().getResources().getDimensionPixelSize(R.dimen.bottom_sheet_cancel_button_height);
int spaceForScrollView = screenHeight - statusBarHeight - navBarHeight - dividerHeight - cancelButtonHeight;
if (scrollViewHeight > spaceForScrollView) {
scrollView.getLayoutParams().height = spaceForScrollView;
scrollView.requestLayout();
}
if (!portrait) {
if (screenHeight - statusBarHeight - mainView.getHeight()
>= AndroidUtils.dpToPx(getActivity(), 8)) {
AndroidUtils.setBackground(getActivity(), mainView, false,
R.drawable.bg_bottom_sheet_topsides_landscape_light, R.drawable.bg_bottom_sheet_topsides_landscape_dark);
} else {
AndroidUtils.setBackground(getActivity(), mainView, false,
R.drawable.bg_bottom_sheet_sides_landscape_light, R.drawable.bg_bottom_sheet_sides_landscape_dark);
}
}
ViewTreeObserver obs = mainView.getViewTreeObserver();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
obs.removeOnGlobalLayoutListener(this);
} else {
obs.removeGlobalOnLayoutListener(this);
}
}
});
return mainView;
}
@Override
public void onStart() {
super.onStart();
if (!portrait) {
final Window window = getDialog().getWindow();
WindowManager.LayoutParams params = window.getAttributes();
params.width = getActivity().getResources().getDimensionPixelSize(R.dimen.landscape_bottom_sheet_dialog_fragment_width);
window.setAttributes(params);
}
}
@Override
public void onCancel(DialogInterface dialog) {
super.onCancel(dialog);
if (shouldClose && listener != null) {
listener.onCancel();
}
}
@Override
protected Drawable getContentIcon(@DrawableRes int id) {
return getIcon(id, night ? R.color.ctx_menu_info_text_dark : R.color.on_map_icon_color);
}
private void highlightSelectedItem(boolean check) {
int iconColor = check ? R.color.dashboard_blue : night ? R.color.ctx_menu_info_text_dark : R.color.on_map_icon_color;
int textColor = ContextCompat.getColor(getContext(), check ? (night ? R.color.color_dialog_buttons_dark : R.color.dashboard_blue) : night ? R.color.color_white : R.color.color_black);
switch (coordinateFormat) {
case PointDescription.FORMAT_DEGREES:
((TextView) mainView.findViewById(R.id.degrees_text)).setTextColor(textColor);
((ImageView) mainView.findViewById(R.id.degrees_icon)).setImageDrawable((getIcon(R.drawable.ic_action_coordinates_latitude, iconColor)));
((RadioButton) mainView.findViewById(R.id.degrees_radio_button)).setChecked(check);
break;
case PointDescription.FORMAT_MINUTES:
((TextView) mainView.findViewById(R.id.minutes_text)).setTextColor(textColor);
((ImageView) mainView.findViewById(R.id.minutes_icon)).setImageDrawable((getIcon(R.drawable.ic_action_coordinates_latitude, iconColor)));
((RadioButton) mainView.findViewById(R.id.minutes_radio_button)).setChecked(check);
break;
case PointDescription.FORMAT_SECONDS:
((TextView) mainView.findViewById(R.id.seconds_text)).setTextColor(textColor);
((ImageView) mainView.findViewById(R.id.seconds_icon)).setImageDrawable((getIcon(R.drawable.ic_action_coordinates_latitude, iconColor)));
((RadioButton) mainView.findViewById(R.id.seconds_radio_button)).setChecked(check);
break;
}
}
interface CoordinateInputFormatChangeListener {
void onCoordinateFormatChanged(int format);
void onKeyboardChanged(boolean useOsmandKeyboard);
void onCancel();
}
}

View file

@ -5,29 +5,56 @@ import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment;
import android.support.v4.content.ContextCompat;
import android.support.v4.app.Fragment;
import android.support.v7.widget.Toolbar;
import android.text.Editable;
import android.text.InputFilter;
import android.text.InputType;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.GridView;
import android.widget.TextView;
import android.widget.ImageView;
import net.osmand.AndroidUtils;
import net.osmand.data.PointDescription;
import net.osmand.plus.IconsCache;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.OsmandTextFieldBoxes;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.widgets.TextViewEx;
import java.util.ArrayList;
import java.util.List;
import studio.carbonylgroup.textfieldboxes.ExtendedEditText;
public class CoordinateInputDialogFragment extends DialogFragment {
public static final String TAG = "CoordinateInputDialogFragment";
public static final String COORDINATE_FORMAT = "coordinate_format";
public static final String USE_OSMAND_KEYBOARD = "use_osmand_keyboard";
private static final int DELETE_BUTTON_POSITION = 9;
private static final int CLEAR_BUTTON_POSITION = 11;
private static final int DEGREES_MAX_LENGTH = 6;
private static final int MINUTES_MAX_LENGTH = 9;
private static final int SECONDS_MAX_LENGTH = 12;
private boolean lightTheme;
private EditText focusedEditText;
private boolean useOsmandKeyboard = true;
private int coordinateFormat = -1;
private List<OsmandTextFieldBoxes> textFieldBoxes;
private ExtendedEditText nameEditText;
private List<ExtendedEditText> extendedLatLonEditTexts;
@Override
public void onCreate(Bundle savedInstanceState) {
@ -36,6 +63,10 @@ public class CoordinateInputDialogFragment extends DialogFragment {
lightTheme = app.getSettings().OSMAND_THEME.get() == OsmandSettings.OSMAND_LIGHT_THEME;
int themeId = lightTheme ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme;
setStyle(STYLE_NO_FRAME, themeId);
CoordinateInputBottomSheetDialogFragment fragment = new CoordinateInputBottomSheetDialogFragment();
fragment.setListener(createCoordinateInputFormatChangeListener());
fragment.show(getMapActivity().getSupportFragmentManager(), CoordinateInputBottomSheetDialogFragment.TAG);
}
@Nullable
@ -43,11 +74,14 @@ public class CoordinateInputDialogFragment extends DialogFragment {
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final View mainView = inflater.inflate(R.layout.fragment_coordinate_input_dialog, container);
final MapActivity mapActivity = getMapActivity();
final IconsCache ic = getMyApplication().getIconsCache();
Fragment coordinateInputBottomSheetDialogFragment = mapActivity.getSupportFragmentManager().findFragmentByTag(CoordinateInputBottomSheetDialogFragment.TAG);
if (coordinateInputBottomSheetDialogFragment != null) {
((CoordinateInputBottomSheetDialogFragment) coordinateInputBottomSheetDialogFragment).setListener(createCoordinateInputFormatChangeListener());
}
Toolbar toolbar = (Toolbar) mainView.findViewById(R.id.coordinate_input_toolbar);
if (!lightTheme) {
toolbar.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.actionbar_dark_color));
}
toolbar.setNavigationIcon(getMyApplication().getIconsCache().getIcon(R.drawable.ic_arrow_back));
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@ -60,51 +94,238 @@ public class CoordinateInputDialogFragment extends DialogFragment {
optionsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
CoordinateInputBottomSheetDialogFragment fragment = new CoordinateInputBottomSheetDialogFragment();
Bundle args = new Bundle();
args.putInt(COORDINATE_FORMAT, coordinateFormat);
args.putBoolean(USE_OSMAND_KEYBOARD, useOsmandKeyboard);
fragment.setArguments(args);
fragment.setListener(createCoordinateInputFormatChangeListener());
fragment.show(getMapActivity().getSupportFragmentManager(), CoordinateInputBottomSheetDialogFragment.TAG);
}
});
final EditText latitudeEditText = (EditText) mainView.findViewById(R.id.latitude_edit_text);
final EditText longitudeEditText = (EditText) mainView.findViewById(R.id.longitude_edit_text);
final EditText nameEditText = (EditText) mainView.findViewById(R.id.name_edit_text);
textFieldBoxes = new ArrayList<>();
final OsmandTextFieldBoxes latitudeBox = (OsmandTextFieldBoxes) mainView.findViewById(R.id.latitude_box);
textFieldBoxes.add(latitudeBox);
final OsmandTextFieldBoxes longitudeBox = (OsmandTextFieldBoxes) mainView.findViewById(R.id.longitude_box);
textFieldBoxes.add(longitudeBox);
final OsmandTextFieldBoxes nameBox = (OsmandTextFieldBoxes) mainView.findViewById(R.id.name_box);
textFieldBoxes.add(nameBox);
View.OnTouchListener editTextOnTouchListener = new View.OnTouchListener() {
extendedLatLonEditTexts = new ArrayList<>();
final ExtendedEditText latitudeEditText = (ExtendedEditText) mainView.findViewById(R.id.latitude_edit_text);
extendedLatLonEditTexts.add(latitudeEditText);
final ExtendedEditText longitudeEditText = (ExtendedEditText) mainView.findViewById(R.id.longitude_edit_text);
extendedLatLonEditTexts.add(longitudeEditText);
nameEditText = (ExtendedEditText) mainView.findViewById(R.id.name_edit_text);
final View.OnFocusChangeListener focusChangeListener = new View.OnFocusChangeListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
EditText editText = null;
public void onFocusChange(View view, boolean b) {
ExtendedEditText editText = null;
OsmandTextFieldBoxes fieldBox = null;
switch (view.getId()) {
case R.id.latitude_edit_text:
editText = latitudeEditText;
fieldBox = latitudeBox;
break;
case R.id.longitude_edit_text:
editText = longitudeEditText;
fieldBox = longitudeBox;
break;
case R.id.name_edit_text:
editText = nameEditText;
fieldBox = nameBox;
break;
}
if (editText != null) {
editText.requestFocus();
if (fieldBox != null) {
if (b) {
fieldBox.setHasFocus(true);
focusedEditText = editText;
} else {
fieldBox.setHasFocus(false);
focusedEditText = null;
}
}
return true;
}
};
latitudeEditText.setOnTouchListener(editTextOnTouchListener);
longitudeEditText.setOnTouchListener(editTextOnTouchListener);
nameEditText.setOnTouchListener(editTextOnTouchListener);
TextWatcher textWatcher = new TextWatcher() {
int len = 0;
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
if (focusedEditText != null) {
String str = focusedEditText.getText().toString();
len = str.length();
}
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void afterTextChanged(Editable editable) {
if (focusedEditText != null && focusedEditText != nameEditText) {
String str = focusedEditText.getText().toString();
int strLength = str.length();
if (strLength == 2 && len < strLength) {
String strToAppend;
if (coordinateFormat == PointDescription.FORMAT_DEGREES) {
strToAppend = ".";
} else {
strToAppend = ":";
}
focusedEditText.append(strToAppend);
} else if (strLength == 5 && coordinateFormat != PointDescription.FORMAT_DEGREES && len < strLength) {
String strToAppend;
if (coordinateFormat == PointDescription.FORMAT_MINUTES) {
strToAppend = ".";
} else {
strToAppend = ":";
}
focusedEditText.append(strToAppend);
} else if (strLength == 8 && coordinateFormat == PointDescription.FORMAT_SECONDS && len < strLength) {
focusedEditText.append(".");
} else if ((strLength == DEGREES_MAX_LENGTH && coordinateFormat == PointDescription.FORMAT_DEGREES)
|| (strLength == MINUTES_MAX_LENGTH && coordinateFormat == PointDescription.FORMAT_MINUTES)
|| (strLength == SECONDS_MAX_LENGTH && coordinateFormat == PointDescription.FORMAT_SECONDS)) {
if (focusedEditText == latitudeEditText) {
longitudeBox.select();
} else {
nameBox.select();
}
}
}
}
};
latitudeEditText.setOnFocusChangeListener(focusChangeListener);
longitudeEditText.setOnFocusChangeListener(focusChangeListener);
nameEditText.setOnFocusChangeListener(focusChangeListener);
latitudeEditText.addTextChangedListener(textWatcher);
longitudeEditText.addTextChangedListener(textWatcher);
nameEditText.addTextChangedListener(textWatcher);
changeKeyboardInBoxes();
changeKeyboardInEditTexts();
View keyboardLayout = mainView.findViewById(R.id.keyboard_layout);
AndroidUtils.setBackground(mapActivity, keyboardLayout, !lightTheme, R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark);
String[] keyboardItems = new String[] { "1", "2", "3",
"4", "5", "6",
"7", "8", "9",
getString(R.string.shared_string_delete), "0", getString(R.string.shared_string_clear) };
GridView keyboardGrid = (GridView) mainView.findViewById(R.id.keyboard_grid_view);
KeyboardAdapter keyboardAdapter = new KeyboardAdapter(mapActivity, keyboardItems);
final GridView keyboardGrid = (GridView) mainView.findViewById(R.id.keyboard_grid_view);
final KeyboardAdapter keyboardAdapter = new KeyboardAdapter(mapActivity, keyboardItems);
keyboardGrid.setAdapter(keyboardAdapter);
keyboardGrid.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
if (focusedEditText != null) {
switch (i) {
case DELETE_BUTTON_POSITION:
String str = focusedEditText.getText().toString();
if (str.length() > 0) {
str = str.substring(0, str.length() - 1);
focusedEditText.setText(str);
}
break;
case CLEAR_BUTTON_POSITION:
focusedEditText.setText("");
break;
default:
focusedEditText.append(keyboardAdapter.getItem(i));
}
}
}
});
final ImageView showHideKeyBoardIcon = (ImageView) mainView.findViewById(R.id.show_hide_keyboard_icon);
final View keyboardDivider = mainView.findViewById(R.id.keyboard_divider);
showHideKeyBoardIcon.setImageDrawable(ic.getThemedIcon(R.drawable.ic_action_arrow_down));
showHideKeyBoardIcon.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
int keyboardVisibility = keyboardGrid.getVisibility();
if (keyboardVisibility == View.VISIBLE) {
keyboardGrid.setVisibility(View.GONE);
keyboardDivider.setVisibility(View.GONE);
showHideKeyBoardIcon.setImageDrawable(ic.getThemedIcon(R.drawable.ic_action_arrow_up));
} else {
keyboardGrid.setVisibility(View.VISIBLE);
keyboardDivider.setVisibility(View.VISIBLE);
showHideKeyBoardIcon.setImageDrawable(ic.getThemedIcon(R.drawable.ic_action_arrow_down));
}
}
});
return mainView;
}
@Override
public void onDestroyView() {
focusedEditText = null;
if (getDialog() != null && getRetainInstance()) {
getDialog().setDismissMessage(null);
}
super.onDestroyView();
}
private CoordinateInputBottomSheetDialogFragment.CoordinateInputFormatChangeListener createCoordinateInputFormatChangeListener() {
return new CoordinateInputBottomSheetDialogFragment.CoordinateInputFormatChangeListener() {
@Override
public void onCoordinateFormatChanged(int format) {
coordinateFormat = format;
changeEditTextLengths();
}
@Override
public void onKeyboardChanged(boolean useOsmandKeyboard) {
CoordinateInputDialogFragment.this.useOsmandKeyboard = useOsmandKeyboard;
changeKeyboardInBoxes();
changeKeyboardInEditTexts();
}
@Override
public void onCancel() {
dismiss();
}
};
}
private void changeEditTextLengths() {
int maxLength;
if (coordinateFormat == PointDescription.FORMAT_DEGREES) {
maxLength = DEGREES_MAX_LENGTH;
} else if (coordinateFormat == PointDescription.FORMAT_MINUTES) {
maxLength = MINUTES_MAX_LENGTH;
} else {
maxLength = SECONDS_MAX_LENGTH;
}
InputFilter[] filtersArray = new InputFilter[] {new InputFilter.LengthFilter(maxLength)};
for (ExtendedEditText extendedEditText : extendedLatLonEditTexts) {
extendedEditText.setFilters(filtersArray);
}
}
public void changeKeyboardInBoxes() {
for (OsmandTextFieldBoxes textFieldBox : textFieldBoxes) {
textFieldBox.setUseOsmandKeyboard(useOsmandKeyboard);
}
}
public void changeKeyboardInEditTexts() {
for (ExtendedEditText extendedEditText : extendedLatLonEditTexts) {
extendedEditText.setInputType(useOsmandKeyboard ? InputType.TYPE_NULL : InputType.TYPE_CLASS_TEXT);
}
nameEditText.setInputType(useOsmandKeyboard ? InputType.TYPE_NULL : InputType.TYPE_CLASS_TEXT);
}
private MapActivity getMapActivity() {
return (MapActivity) getActivity();
}
@ -119,6 +340,7 @@ public class CoordinateInputDialogFragment extends DialogFragment {
return false;
}
CoordinateInputDialogFragment fragment = new CoordinateInputDialogFragment();
fragment.setRetainInstance(true);
fragment.show(mapActivity.getSupportFragmentManager(), TAG);
return true;
} catch (RuntimeException e) {
@ -128,8 +350,8 @@ public class CoordinateInputDialogFragment extends DialogFragment {
private class KeyboardAdapter extends ArrayAdapter<String> {
KeyboardAdapter(@NonNull Context context, String[] items) {
super(context, 0, items);
KeyboardAdapter(@NonNull Context context, @NonNull String[] objects) {
super(context, 0, objects);
}
@NonNull
@ -138,8 +360,16 @@ public class CoordinateInputDialogFragment extends DialogFragment {
if (convertView == null) {
convertView = LayoutInflater.from(getContext()).inflate(R.layout.input_coordinate_keyboard_item, parent, false);
}
convertView.setBackgroundResource(lightTheme ? R.drawable.keyboard_item_light_bg : R.drawable.keyboard_item_dark_bg);
((TextView) convertView.findViewById(R.id.keyboard_item)).setText(getItem(position));
TextViewEx keyboardItem = (TextViewEx) convertView.findViewById(R.id.keyboard_item);
// if (position == DELETE_BUTTON_POSITION || position == CLEAR_BUTTON_POSITION) {
// keyboardItem.setTextSize(getResources().getDimension(R.dimen.default_list_text_size));
// } else {
// keyboardItem.setTextSize(getResources().getDimension(R.dimen.map_button_text_size));
// }
keyboardItem.setText(getItem(position));
return convertView;
}

View file

@ -1,6 +1,7 @@
package net.osmand.plus.mapmarkers;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.DrawableRes;
import android.support.annotation.Nullable;
@ -14,6 +15,7 @@ import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
@ -22,11 +24,14 @@ import android.widget.Toast;
import net.osmand.AndroidUtils;
import net.osmand.Location;
import net.osmand.data.LatLon;
import net.osmand.data.RotatedTileBox;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.IconsCache;
import net.osmand.plus.MapMarkersHelper;
import net.osmand.plus.MapMarkersHelper.MapMarker;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.MapViewTrackingUtilities;
@ -40,9 +45,11 @@ import net.osmand.plus.views.MapMarkersLayer;
import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory;
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
import net.osmand.util.MapUtils;
import java.util.List;
import static net.osmand.plus.OsmandSettings.LANDSCAPE_MIDDLE_RIGHT_CONSTANT;
import static net.osmand.plus.OsmandSettings.MIDDLE_TOP_CONSTANT;
public class PlanRouteFragment extends Fragment implements OsmAndLocationListener {
@ -56,6 +63,8 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
private int previousMapPosition;
private int selectedCount = 0;
private int toolbarHeight;
private Location location;
private boolean locationUpdateStarted;
@ -69,6 +78,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
private ImageView upDownIconIv;
private TextView distanceTv;
private TextView timeTv;
private TextView countTv;
@Nullable
@Override
@ -88,6 +98,8 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
hideMarkersListFragment();
}
toolbarHeight = mapActivity.getResources().getDimensionPixelSize(R.dimen.dashboard_map_toolbar);
iconsCache = mapActivity.getMyApplication().getIconsCache();
nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
@ -102,6 +114,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
distanceTv = (TextView) mainView.findViewById(R.id.markers_distance_text_view);
timeTv = (TextView) mainView.findViewById(R.id.markers_time_text_view);
countTv = (TextView) mainView.findViewById(R.id.markers_count_text_view);
enterPlanRouteMode();
@ -129,15 +142,20 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
@Override
public void onClick(View view) {
int activeMarkersCount = markersHelper.getMapMarkers().size();
if (selectedCount == activeMarkersCount) {
if (selectedCount == activeMarkersCount && markersHelper.isStartFromMyLocation()) {
markersHelper.deselectAllActiveMarkers();
markersHelper.setStartFromMyLocation(false);
selectedCount = 0;
} else {
markersHelper.selectAllActiveMarkers();
markersHelper.setStartFromMyLocation(true);
selectedCount = activeMarkersCount;
}
adapter.notifyDataSetChanged();
updateText();
updateSelectButton();
showMarkersRouteOnMap();
mapActivity.refreshMap();
}
});
@ -161,7 +179,9 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
toolbarController.setOnBackButtonClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
quit(false);
if (quit(false)) {
MapMarkersDialogFragment.showInstance(mapActivity);
}
}
});
mapActivity.showTopToolbar(toolbarController);
@ -183,11 +203,17 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
@Override
public void onItemClick(View view) {
int pos = markersRv.getChildAdapterPosition(view);
MapMarker marker = adapter.getItem(pos);
selectedCount = marker.selected ? selectedCount - 1 : selectedCount + 1;
marker.selected = !marker.selected;
if (pos == 0) {
markersHelper.setStartFromMyLocation(!mapActivity.getMyApplication().getSettings().ROUTE_MAP_MARKERS_START_MY_LOC.get());
} else {
MapMarker marker = adapter.getItem(pos);
selectedCount = marker.selected ? selectedCount - 1 : selectedCount + 1;
marker.selected = !marker.selected;
}
adapter.notifyItemChanged(pos);
updateSelectButton();
updateText();
showMarkersRouteOnMap();
}
@Override
@ -201,7 +227,14 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
toPosition = holder.getAdapterPosition();
if (toPosition >= 0 && fromPosition >= 0 && toPosition != fromPosition) {
mapActivity.getMyApplication().getMapMarkersHelper().checkAndFixActiveMarkersOrderIfNeeded();
adapter.notifyDataSetChanged();
mapActivity.getMyApplication().getSettings().MAP_MARKERS_ORDER_BY_MODE.set(OsmandSettings.MapMarkersOrderByMode.CUSTOM);
mapActivity.refreshMap();
try {
adapter.notifyDataSetChanged();
} catch (Exception e) {
// to avoid crash because of:
// java.lang.IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling
}
}
}
});
@ -211,6 +244,34 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
markersRv.setLayoutManager(new LinearLayoutManager(getContext()));
markersRv.setAdapter(adapter);
final int screenH = AndroidUtils.getScreenHeight(mapActivity);
final int statusBarH = AndroidUtils.getStatusBarHeight(mapActivity);
final int navBarH = AndroidUtils.getNavBarHeight(mapActivity);
final int availableHeight = (screenH - statusBarH - navBarH) / 2;
mainView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
if (portrait) {
int upDownRowH = mainView.findViewById(R.id.up_down_row).getHeight();
int buttonsRowH = mainView.findViewById(R.id.buttons_row).getHeight();
int listContainerH = availableHeight - upDownRowH - buttonsRowH;
View listContainer = mainView.findViewById(R.id.markers_list_container);
listContainer.getLayoutParams().height = listContainerH;
listContainer.requestLayout();
}
showMarkersList();
ViewTreeObserver obs = mainView.getViewTreeObserver();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
obs.removeOnGlobalLayoutListener(this);
} else {
obs.removeGlobalOnLayoutListener(this);
}
}
});
return view;
}
@ -278,6 +339,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
public void onApplicationModeItemClick(ApplicationMode mode) {
appMode = mode;
setupAppModesBtn();
updateText();
}
};
}
@ -310,10 +372,11 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
}
if (appMode == null) {
appMode = mapActivity.getMyApplication().getSettings().getApplicationMode();
appMode = ApplicationMode.DEFAULT;
}
setupAppModesBtn();
showMarkersRouteOnMap();
mapActivity.refreshMap();
updateText();
updateSelectButton();
@ -331,6 +394,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
public void onClick(View view) {
SnapToRoadBottomSheetDialogFragment fragment = new SnapToRoadBottomSheetDialogFragment();
fragment.setListener(createSnapToRoadFragmentListener());
fragment.setRemoveDefaultMode(false);
fragment.show(mapActivity.getSupportFragmentManager(), SnapToRoadBottomSheetDialogFragment.TAG);
}
});
@ -367,24 +431,50 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
mapActivity.findViewById(R.id.snap_to_road_image_button).setVisibility(View.GONE);
mainView.findViewById(R.id.snap_to_road_progress_bar).setVisibility(View.GONE);
markersLayer.clearRoute();
mapActivity.refreshMap();
}
}
private void updateText() {
distanceTv.setText("1.39 km,");
timeTv.setText("~ 45 min.");
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
boolean defaultMode = appMode.getStringKey().equals(ApplicationMode.DEFAULT.getStringKey());
float dist = 0;
Location myLoc = mapActivity.getMyApplication().getLocationProvider().getLastStaleKnownLocation();
boolean useLocation = myLoc != null && mapActivity.getMyApplication().getSettings().ROUTE_MAP_MARKERS_START_MY_LOC.get();
List<LatLon> markers = markersHelper.getSelectedMarkersLatLon();
if (useLocation ? markers.size() > 0 : markers.size() > 1) {
if (useLocation) {
dist += MapUtils.getDistance(myLoc.getLatitude(), myLoc.getLongitude(),
markers.get(0).getLatitude(), markers.get(0).getLongitude());
}
for (int i = 1; i < markers.size(); i++) {
dist += MapUtils.getDistance(markers.get(i - 1), markers.get(i));
}
}
distanceTv.setText(OsmAndFormatter.getFormattedDistance(dist, mapActivity.getMyApplication()) + (defaultMode ? "" : ","));
if (defaultMode) {
timeTv.setText("");
} else {
int seconds = (int) (dist / appMode.getDefaultSpeed());
timeTv.setText("~ " + OsmAndFormatter.getFormattedDuration(seconds, mapActivity.getMyApplication()));
}
countTv.setText(mapActivity.getString(R.string.shared_string_markers) + ": " + selectedCount);
}
}
private void updateSelectButton() {
if (selectedCount == markersHelper.getMapMarkers().size()) {
if (selectedCount == markersHelper.getMapMarkers().size() && markersHelper.isStartFromMyLocation()) {
((TextView) mainView.findViewById(R.id.select_all_button)).setText(getString(R.string.shared_string_deselect_all));
} else {
((TextView) mainView.findViewById(R.id.select_all_button)).setText(getString(R.string.shared_string_select_all));
}
}
private void updateLocationUi() {
final MapActivity mapActivity = (MapActivity) getActivity();
if (mapActivity != null && adapter != null) {
@ -422,7 +512,6 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
MapMarkersLayer markersLayer = getMapMarkersLayer();
if (mapActivity != null && markersLayer != null) {
markersListOpened = true;
markersLayer.setMarkersListOpened(true);
upDownIconIv.setImageDrawable(getContentIcon(R.drawable.ic_action_arrow_down));
View listContainer = mainView.findViewById(R.id.markers_list_container);
if (portrait && listContainer != null) {
@ -432,9 +521,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
}
OsmandMapTileView tileView = mapActivity.getMapView();
previousMapPosition = tileView.getMapPosition();
if (portrait) {
tileView.setMapPosition(MIDDLE_TOP_CONSTANT);
} else {
if (!portrait) {
tileView.setMapPosition(LANDSCAPE_MIDDLE_RIGHT_CONSTANT);
}
mapActivity.refreshMap();
@ -446,7 +533,6 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
MapMarkersLayer markersLayer = getMapMarkersLayer();
if (mapActivity != null && markersLayer != null) {
markersListOpened = false;
markersLayer.setMarkersListOpened(false);
upDownIconIv.setImageDrawable(getContentIcon(R.drawable.ic_action_arrow_up));
View listContainer = mainView.findViewById(R.id.markers_list_container);
if (portrait && listContainer != null) {
@ -506,6 +592,55 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
}
}
private void showMarkersRouteOnMap() {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
List<LatLon> points = markersHelper.getSelectedMarkersLatLon();
mapActivity.getMapLayers().getMapMarkersLayer().setRoute(points);
showRouteOnMap(points);
}
}
private void showRouteOnMap(List<LatLon> points) {
MapActivity mapActivity = getMapActivity();
if (points.size() > 0 && mapActivity != null) {
OsmandMapTileView mapView = mapActivity.getMapView();
double left = 0, right = 0;
double top = 0, bottom = 0;
Location myLocation = mapActivity.getMyApplication().getLocationProvider().getLastStaleKnownLocation();
if (mapActivity.getMyApplication().getMapMarkersHelper().isStartFromMyLocation() && myLocation != null) {
left = myLocation.getLongitude();
right = myLocation.getLongitude();
top = myLocation.getLatitude();
bottom = myLocation.getLatitude();
}
for (LatLon l : points) {
if (left == 0) {
left = l.getLongitude();
right = l.getLongitude();
top = l.getLatitude();
bottom = l.getLatitude();
} else {
left = Math.min(left, l.getLongitude());
right = Math.max(right, l.getLongitude());
top = Math.max(top, l.getLatitude());
bottom = Math.min(bottom, l.getLatitude());
}
}
RotatedTileBox tb = mapView.getCurrentRotatedTileBox().copy();
int tileBoxWidthPx = 0;
int tileBoxHeightPx = 0;
if (portrait) {
tileBoxHeightPx = 3 * (tb.getPixHeight() - mainView.getHeight() - toolbarHeight) / 4;
} else {
tileBoxWidthPx = tb.getPixWidth() - mainView.findViewById(R.id.up_down_row).getWidth();
}
mapView.fitRectToMap(left, right, top, bottom, tileBoxWidthPx, tileBoxHeightPx, toolbarHeight * 3 / 2);
}
}
public boolean quit(boolean hideMarkersListFirst) {
if (markersListOpened && hideMarkersListFirst) {
hideMarkersList();

View file

@ -281,7 +281,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
}
} else {
boolean firstItemInDisplayGroup = position - 1 != -1 && getItem(position - 1) instanceof Integer;
boolean lastItemInDisplayGroup = !(getItem(position) instanceof MapMarker);
boolean lastItemInDisplayGroup = position == getItemCount() || !(getItem(position) instanceof MapMarker);
if (firstItemInDisplayGroup && lastItemInDisplayGroup) {
items.remove(position - 1);
}

View file

@ -132,8 +132,10 @@ public class MapMarkersItemTouchHelperCallback extends ItemTouchHelper.Callback
@Override
public void clearView(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
super.clearView(recyclerView, viewHolder);
((MapMarkerItemViewHolder) viewHolder).optionsBtn.setVisibility(View.VISIBLE);
iconHidden = false;
if (iconHidden) {
((MapMarkerItemViewHolder) viewHolder).optionsBtn.setVisibility(View.VISIBLE);
iconHidden = false;
}
adapter.onItemDismiss(viewHolder);
}

View file

@ -63,18 +63,22 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
@Override
public void onBindViewHolder(final MapMarkerItemViewHolder holder, int pos) {
boolean night = !mapActivity.getMyApplication().getSettings().isLightContent();
boolean night = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
IconsCache iconsCache = mapActivity.getMyApplication().getIconsCache();
MapMarker marker = markers.get(pos);
holder.icon.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_flag_dark, MapMarker.getColorId(marker.colorIndex)));
holder.iconReorder.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_reorder));
holder.iconDirection.setVisibility(View.GONE);
boolean locationItem = pos == 0;
boolean firstMarkerItem = pos == 1;
boolean lastMarkerItem = pos == getItemCount() - 1;
MapMarker marker = locationItem ? null : getItem(pos);
holder.mainLayout.setBackgroundColor(ContextCompat.getColor(mapActivity, night ? R.color.bg_color_dark : R.color.bg_color_light));
holder.title.setTextColor(ContextCompat.getColor(mapActivity, night ? R.color.color_white : R.color.color_black));
holder.divider.setBackgroundColor(ContextCompat.getColor(mapActivity, night ? R.color.actionbar_dark_color : R.color.dashboard_divider_light));
holder.title.setText(locationItem ? mapActivity.getString(R.string.shared_string_my_location) : marker.getName(mapActivity));
holder.iconDirection.setVisibility(View.GONE);
holder.optionsBtn.setVisibility(View.GONE);
holder.description.setTextColor(ContextCompat.getColor(mapActivity, night ? R.color.dash_search_icon_dark : R.color.icon_color));
holder.divider.setBackgroundColor(ContextCompat.getColor(mapActivity, night ? R.color.actionbar_dark_color : R.color.dashboard_divider_light));
holder.divider.setVisibility(lastMarkerItem ? View.GONE : View.VISIBLE);
holder.checkBox.setVisibility(View.VISIBLE);
holder.checkBox.setOnClickListener(new View.OnClickListener() {
@Override
@ -82,75 +86,79 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
listener.onItemClick(holder.itemView);
}
});
holder.checkBox.setChecked(marker.selected);
holder.bottomShadow.setVisibility(lastMarkerItem ? View.VISIBLE : View.GONE);
if (pos == 0 || pos == getItemCount() - 1) {
holder.firstDescription.setVisibility(View.VISIBLE);
if (pos == 0) {
holder.topDivider.setVisibility(View.VISIBLE);
holder.firstDescription.setText(mapActivity.getString(R.string.shared_string_control_start) + "");
} else {
holder.firstDescription.setText(mapActivity.getString(R.string.shared_string_finish) + "");
}
holder.firstDescription.setVisibility((firstMarkerItem || lastMarkerItem) ? View.VISIBLE : View.GONE);
if (firstMarkerItem) {
holder.firstDescription.setText(mapActivity.getString(R.string.shared_string_control_start) + "");
} else if (lastMarkerItem) {
holder.firstDescription.setText(mapActivity.getString(R.string.shared_string_finish) + "");
}
if (locationItem) {
holder.topDivider.setVisibility(View.VISIBLE);
holder.flagIconLeftSpace.setVisibility(View.VISIBLE);
holder.icon.setImageDrawable(ContextCompat.getDrawable(mapActivity, R.drawable.map_pedestrian_location));
holder.point.setVisibility(View.GONE);
holder.checkBox.setChecked(mapActivity.getMyApplication().getMapMarkersHelper().isStartFromMyLocation());
holder.iconReorder.setVisibility(View.GONE);
holder.description.setVisibility(View.GONE);
holder.distance.setVisibility(View.GONE);
} else {
holder.firstDescription.setVisibility(View.GONE);
holder.topDivider.setVisibility(View.GONE);
}
holder.flagIconLeftSpace.setVisibility(View.GONE);
holder.icon.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_flag_dark, MapMarker.getColorId(marker.colorIndex)));
holder.point.setVisibility(View.VISIBLE);
holder.checkBox.setChecked(marker.selected);
if (pos == getItemCount() - 1) {
holder.bottomShadow.setVisibility(View.VISIBLE);
holder.divider.setVisibility(View.GONE);
} else {
holder.bottomShadow.setVisibility(View.GONE);
holder.divider.setVisibility(View.VISIBLE);
}
holder.point.setVisibility(View.VISIBLE);
holder.iconReorder.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent event) {
if (MotionEventCompat.getActionMasked(event) == MotionEvent.ACTION_DOWN) {
listener.onDragStarted(holder);
holder.iconReorder.setVisibility(View.VISIBLE);
holder.iconReorder.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_reorder));
holder.iconReorder.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent event) {
if (MotionEventCompat.getActionMasked(event) == MotionEvent.ACTION_DOWN) {
listener.onDragStarted(holder);
}
return false;
}
return false;
}
});
});
holder.title.setText(marker.getName(mapActivity));
String descr;
if ((descr = marker.groupName) != null) {
if (descr.equals("")) {
descr = mapActivity.getString(R.string.shared_string_favorites);
holder.description.setVisibility(View.VISIBLE);
holder.description.setTextColor(ContextCompat.getColor(mapActivity, night ? R.color.dash_search_icon_dark : R.color.icon_color));
String descr;
if ((descr = marker.groupName) != null) {
if (descr.equals("")) {
descr = mapActivity.getString(R.string.shared_string_favorites);
}
} else {
Date date = new Date(marker.creationDate);
String month = new SimpleDateFormat("MMM", Locale.getDefault()).format(date);
if (month.length() > 1) {
month = Character.toUpperCase(month.charAt(0)) + month.substring(1);
}
String day = new SimpleDateFormat("dd", Locale.getDefault()).format(date);
descr = month + " " + day;
}
} else {
Date date = new Date(marker.creationDate);
String month = new SimpleDateFormat("MMM", Locale.getDefault()).format(date);
if (month.length() > 1) {
month = Character.toUpperCase(month.charAt(0)) + month.substring(1);
}
String day = new SimpleDateFormat("dd", Locale.getDefault()).format(date);
descr = month + " " + day;
}
holder.description.setText(descr);
holder.description.setText(descr);
if (location != null) {
holder.distance.setTextColor(ContextCompat.getColor(mapActivity, useCenter
? R.color.color_distance : R.color.color_myloc_distance));
float dist = (float) MapUtils.getDistance(location.getLatitude(), location.getLongitude(),
marker.getLatitude(), marker.getLongitude());
holder.distance.setText(OsmAndFormatter.getFormattedDistance(dist, mapActivity.getMyApplication()));
if (location != null) {
holder.distance.setVisibility(View.VISIBLE);
holder.distance.setTextColor(ContextCompat.getColor(mapActivity, useCenter
? R.color.color_distance : R.color.color_myloc_distance));
float dist = (float) MapUtils.getDistance(location.getLatitude(), location.getLongitude(),
marker.getLatitude(), marker.getLongitude());
holder.distance.setText(OsmAndFormatter.getFormattedDistance(dist, mapActivity.getMyApplication()));
}
}
}
@Override
public int getItemCount() {
return markers.size();
return markers.size() + 1;
}
public MapMarker getItem(int position) {
return markers.get(position);
return markers.get(position - 1);
}
@Override
@ -160,7 +168,10 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
@Override
public boolean onItemMove(int from, int to) {
Collections.swap(markers, from, to);
if (to == 0) {
return false;
}
Collections.swap(markers, from - 1, to - 1);
notifyItemMoved(from, to);
return true;
}

View file

@ -11,7 +11,6 @@ import android.view.ContextThemeWrapper;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
@ -36,11 +35,16 @@ public class SnapToRoadBottomSheetDialogFragment extends android.support.design.
private boolean nightMode;
private boolean portrait;
private boolean snapToRoadEnabled;
private boolean removeDefaultMode = true;
public void setListener(SnapToRoadFragmentListener listener) {
this.listener = listener;
}
public void setRemoveDefaultMode(boolean removeDefaultMode) {
this.removeDefaultMode = removeDefaultMode;
}
@Override
public void setupDialog(Dialog dialog, int style) {
super.setupDialog(dialog, style);
@ -73,7 +77,9 @@ public class SnapToRoadBottomSheetDialogFragment extends android.support.design.
LinearLayout container = (LinearLayout) mainView.findViewById(R.id.navigation_types_container);
final List<ApplicationMode> modes = new ArrayList<>(ApplicationMode.values(settings));
modes.remove(ApplicationMode.DEFAULT);
if (removeDefaultMode) {
modes.remove(ApplicationMode.DEFAULT);
}
View.OnClickListener onClickListener = new View.OnClickListener() {
@Override

View file

@ -727,8 +727,8 @@ public class MapControlsLayer extends OsmandMapLayer {
routePlanningBtn.updateVisibility(showButtons);
menuControl.updateVisibility(showButtons);
mapZoomIn.updateVisibility(!routeDialogOpened && !isInExpandedRouteMode());
mapZoomOut.updateVisibility(!routeDialogOpened && !isInExpandedRouteMode());
mapZoomIn.updateVisibility(!routeDialogOpened);
mapZoomOut.updateVisibility(!routeDialogOpened);
compassHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && shouldShowCompass()
&& !isInMeasurementToolMode() && !isInPlanRouteMode());
@ -814,7 +814,7 @@ public class MapControlsLayer extends OsmandMapLayer {
backToLocationControl.iv.setContentDescription(mapActivity.getString(R.string.map_widget_back_to_loc));
}
boolean visible = !(tracked && rh.isFollowingMode());
backToLocationControl.updateVisibility(visible && !dialogOpened && !isInExpandedRouteMode());
backToLocationControl.updateVisibility(visible && !dialogOpened);
if (app.accessibilityEnabled()) {
backToLocationControl.iv.setClickable(enabled && visible);
}
@ -1136,10 +1136,6 @@ public class MapControlsLayer extends OsmandMapLayer {
return mapActivity.getMapLayers().getMapMarkersLayer().isInPlanRouteMode();
}
private boolean isInExpandedRouteMode() {
return mapActivity.getMapLayers().getMapMarkersLayer().isMarkersListOpened();
}
public static View.OnLongClickListener getOnClickMagnifierListener(final OsmandMapTileView view) {
return new View.OnLongClickListener() {

View file

@ -69,7 +69,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
private float[] calculations = new float[2];
private final RenderingLineAttributes lineAttrs = new RenderingLineAttributes("measureDistanceLine");
private final RenderingLineAttributes textAttrs = new RenderingLineAttributes("rulerCircle");
private final RenderingLineAttributes textAttrs = new RenderingLineAttributes("rulerLineFont");
private Paint paint;
private Path path;
private List<LatLon> route = new ArrayList<>();
@ -77,12 +77,10 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
private TIntArrayList tx = new TIntArrayList();
private TIntArrayList ty = new TIntArrayList();
private Path linePath = new Path();
private String distanceText;
private ContextMenuLayer contextMenuLayer;
private boolean inPlanRouteMode;
private boolean markersListOpened;
public MapMarkersLayer(MapActivity map) {
this.map = map;
@ -100,14 +98,6 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
this.inPlanRouteMode = inPlanRouteMode;
}
public boolean isMarkersListOpened() {
return inPlanRouteMode && markersListOpened;
}
public void setMarkersListOpened(boolean markersListOpened) {
this.markersListOpened = markersListOpened;
}
private void initUI() {
bitmapPaint = new Paint();
bitmapPaint.setDither(true);
@ -141,8 +131,8 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
paint.setAlpha(200);
float textSize = TEXT_SIZE * map.getResources().getDisplayMetrics().density;
textAttrs.paint.setTextSize(textSize);
textAttrs.paint2.setTextSize(textSize);
textAttrs.paint3.setTextSize(textSize);
widgetsFactory = new MapMarkersWidgetsFactory(map);
@ -219,25 +209,18 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
}
@Override
public void onDraw(Canvas canvas, RotatedTileBox tileBox, DrawSettings nightMode) {
Location myLoc = map.getMyApplication().getLocationProvider().getLastStaleKnownLocation();
widgetsFactory.updateInfo(myLoc == null
? tileBox.getCenterLatLon() : new LatLon(myLoc.getLatitude(), myLoc.getLongitude()), tileBox.getZoom());
public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tileBox, DrawSettings nightMode) {
OsmandSettings settings = map.getMyApplication().getSettings();
if (tileBox.getZoom() < 3 || !settings.USE_MAP_MARKERS.get()) {
return;
}
Location myLoc = map.getMyApplication().getLocationProvider().getLastStaleKnownLocation();
MapMarkersHelper markersHelper = map.getMyApplication().getMapMarkersHelper();
List<MapMarker> activeMapMarkers = markersHelper.getMapMarkers();
if (route.size() > 0) {
path.reset();
boolean first = true;
Location myLocation = map.getMapViewTrackingUtilities().getMyLocation();
if (markersHelper.isStartFromMyLocation() && myLocation != null) {
int locationX = tileBox.getPixXFromLonNoRot(myLocation.getLongitude());
int locationY = tileBox.getPixYFromLatNoRot(myLocation.getLatitude());
if (markersHelper.isStartFromMyLocation() && myLoc != null) {
int locationX = tileBox.getPixXFromLonNoRot(myLoc.getLongitude());
int locationY = tileBox.getPixYFromLatNoRot(myLoc.getLatitude());
path.moveTo(locationX, locationY);
first = false;
}
@ -254,12 +237,10 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
canvas.drawPath(path, paint);
}
List<MapMarker> activeMapMarkers = markersHelper.getMapMarkers();
if (settings.SHOW_LINES_TO_FIRST_MARKERS.get() && myLoc != null) {
lineAttrs.updatePaints(view, nightMode, tileBox);
textAttrs.updatePaints(view, nightMode, tileBox);
textAttrs.paint2.setStyle(Paint.Style.FILL);
textAttrs.paint.setStyle(Paint.Style.FILL);
int locX = (int) tileBox.getPixXFromLatLon(myLoc.getLatitude(), myLoc.getLongitude());
int locY = (int) tileBox.getPixYFromLatLon(myLoc.getLatitude(), myLoc.getLongitude());
@ -286,6 +267,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
float generalDist = (float) MapUtils.getDistance(myLoc.getLatitude(), myLoc.getLongitude(), marker.getLatitude(), marker.getLongitude());
String generalDistSt = OsmAndFormatter.getFormattedDistance(generalDist, view.getApplication());
boolean locationInvisible = locX < 0 || locX > tileBox.getPixWidth() || locY < 0 || locY > tileBox.getPixHeight();
String distanceText;
if (locationInvisible) {
float centerToMarkerDist = (float) MapUtils.getDistance(tileBox.getLatLonFromPixel(pos[0], pos[1]), marker.getLatitude(), marker.getLongitude());
String centerToMarkerDistSt = OsmAndFormatter.getFormattedDistance(centerToMarkerDist, view.getApplication());
@ -298,7 +280,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
distanceText = generalDistSt;
}
Rect bounds = new Rect();
textAttrs.paint2.getTextBounds(distanceText, 0, distanceText.length(), bounds);
textAttrs.paint.getTextBounds(distanceText, 0, distanceText.length(), bounds);
float hOffset = pm.getLength() / 2 - bounds.width() / 2;
lineAttrs.paint.setColor(colors[marker.colorIndex]);
@ -309,18 +291,32 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
}
if (locX >= markerX) {
canvas.rotate(180, pos[0], pos[1]);
canvas.drawTextOnPath(distanceText, linePath, hOffset, bounds.height() + VERTICAL_OFFSET, textAttrs.paint3);
canvas.drawTextOnPath(distanceText, linePath, hOffset, bounds.height() + VERTICAL_OFFSET, textAttrs.paint2);
canvas.drawTextOnPath(distanceText, linePath, hOffset, bounds.height() + VERTICAL_OFFSET, textAttrs.paint);
canvas.rotate(-180, pos[0], pos[1]);
} else {
canvas.drawTextOnPath(distanceText, linePath, hOffset, -VERTICAL_OFFSET, textAttrs.paint3);
canvas.drawTextOnPath(distanceText, linePath, hOffset, -VERTICAL_OFFSET, textAttrs.paint2);
canvas.drawTextOnPath(distanceText, linePath, hOffset, -VERTICAL_OFFSET, textAttrs.paint);
}
canvas.rotate(tileBox.getRotate(), tileBox.getCenterPixelX(), tileBox.getCenterPixelY());
}
}
}
for (MapMarker marker : activeMapMarkers) {
@Override
public void onDraw(Canvas canvas, RotatedTileBox tileBox, DrawSettings nightMode) {
Location myLoc = map.getMyApplication().getLocationProvider().getLastStaleKnownLocation();
widgetsFactory.updateInfo(myLoc == null
? tileBox.getCenterLatLon() : new LatLon(myLoc.getLatitude(), myLoc.getLongitude()), tileBox.getZoom());
OsmandSettings settings = map.getMyApplication().getSettings();
if (tileBox.getZoom() < 3 || !settings.USE_MAP_MARKERS.get()) {
return;
}
MapMarkersHelper markersHelper = map.getMyApplication().getMapMarkersHelper();
for (MapMarker marker : markersHelper.getMapMarkers()) {
if (isLocationVisible(tileBox, marker) && !overlappedByWaypoint(marker)
&& !isInMotion(marker)) {
Bitmap bmp = getMapMarkerBitmap(marker.colorIndex);
@ -336,9 +332,8 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
if (settings.SHOW_ARROWS_TO_FIRST_MARKERS.get()) {
LatLon loc = tileBox.getCenterLatLon();
List<MapMarker> mapMarkers = markersHelper.getMapMarkers();
int i = 0;
for (MapMarker marker : mapMarkers) {
for (MapMarker marker : markersHelper.getMapMarkers()) {
if (!isLocationVisible(tileBox, marker) && !isInMotion(marker)) {
canvas.save();
net.osmand.Location.distanceBetween(loc.getLatitude(), loc.getLongitude(),
@ -414,12 +409,12 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
@Override
public boolean disableSingleTap() {
return false;
return inPlanRouteMode;
}
@Override
public boolean disableLongPressOnMap() {
return false;
return inPlanRouteMode;
}
@Override

View file

@ -41,6 +41,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
private final ContextMenuLayer contextMenuLayer;
private final MeasurementToolLayer measurementToolLayer;
private final MapMarkersLayer mapMarkersLayer;
private ImageView contextMarker;
private final MapActivity mapActivity;
private final OsmandApplication app;
@ -66,6 +67,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
settings = activity.getMyApplication().getSettings();
quickActionRegistry = activity.getMapLayers().getQuickActionRegistry();
measurementToolLayer = mapActivity.getMapLayers().getMeasurementToolLayer();
mapMarkersLayer = mapActivity.getMapLayers().getMapMarkersLayer();
}
@ -323,6 +325,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
contextMenuLayer.isInChangeMarkerPositionMode() ||
contextMenuLayer.isInGpxDetailsMode() ||
measurementToolLayer.isInMeasurementMode() ||
mapMarkersLayer.isInPlanRouteMode() ||
mapActivity.getContextMenu().isVisible() && !mapActivity.getContextMenu().findMenuFragment().get().isRemoving() ||
mapActivity.getContextMenu().isVisible() && mapActivity.getContextMenu().findMenuFragment().get().isAdded() ||
mapActivity.getContextMenu().getMultiSelectionMenu().isVisible() && mapActivity.getContextMenu().getMultiSelectionMenu().getFragmentByTag().isAdded() ||

View file

@ -76,10 +76,9 @@ public class RulerControlLayer extends OsmandMapLayer {
private Bitmap centerIconNight;
private Paint bitmapPaint;
private RenderingLineAttributes lineAttrs;
private RenderingLineAttributes lineFontAttrs;
private RenderingLineAttributes circleAttrs;
private RenderingLineAttributes circleAttrsAlt;
private float circleTextSize;
private float lineTextSize;
private Handler handler;
@ -122,8 +121,12 @@ public class RulerControlLayer extends OsmandMapLayer {
lineAttrs = new RenderingLineAttributes("rulerLine");
circleTextSize = TEXT_SIZE * mapActivity.getResources().getDisplayMetrics().density;
lineTextSize = DISTANCE_TEXT_SIZE * mapActivity.getResources().getDisplayMetrics().density;
float circleTextSize = TEXT_SIZE * mapActivity.getResources().getDisplayMetrics().density;
float lineTextSize = DISTANCE_TEXT_SIZE * mapActivity.getResources().getDisplayMetrics().density;
lineFontAttrs = new RenderingLineAttributes("rulerLineFont");
lineFontAttrs.paint.setTextSize(lineTextSize);
lineFontAttrs.paint2.setTextSize(lineTextSize);
circleAttrs = new RenderingLineAttributes("rulerCircle");
circleAttrs.paint2.setTextSize(circleTextSize);
@ -179,6 +182,8 @@ public class RulerControlLayer extends OsmandMapLayer {
public void onDraw(Canvas canvas, RotatedTileBox tb, DrawSettings settings) {
if (rulerModeOn()) {
lineAttrs.updatePaints(view, settings, tb);
lineFontAttrs.updatePaints(view, settings, tb);
lineFontAttrs.paint.setStyle(Style.FILL);
circleAttrs.updatePaints(view, settings, tb);
circleAttrs.paint2.setStyle(Style.FILL);
circleAttrsAlt.updatePaints(view, settings, tb);
@ -221,14 +226,7 @@ public class RulerControlLayer extends OsmandMapLayer {
}
if (mode == RulerMode.FIRST || mode == RulerMode.SECOND) {
updateData(tb, center);
RenderingLineAttributes attrs;
if (mode == RulerMode.FIRST) {
circleAttrs.paint2.setTextSize(circleTextSize);
circleAttrs.paint3.setTextSize(circleTextSize);
attrs = circleAttrs;
} else {
attrs = circleAttrsAlt;
}
RenderingLineAttributes attrs = mode == RulerMode.FIRST ? circleAttrs : circleAttrsAlt;
for (int i = 1; i <= cacheDistances.size(); i++) {
drawCircle(canvas, tb, i, center, attrs);
}
@ -268,22 +266,19 @@ public class RulerControlLayer extends OsmandMapLayer {
private void drawTextOnCenterOfPath(Canvas canvas, float x1, float x2, Path path, String text) {
PathMeasure pm = new PathMeasure(path, false);
Rect bounds = new Rect();
circleAttrs.paint2.getTextBounds(text, 0, text.length(), bounds);
lineFontAttrs.paint.getTextBounds(text, 0, text.length(), bounds);
float hOffset = pm.getLength() / 2 - bounds.width() / 2;
circleAttrs.paint2.setTextSize(lineTextSize);
circleAttrs.paint3.setTextSize(lineTextSize);
if (x1 >= x2) {
float[] pos = new float[2];
pm.getPosTan(pm.getLength() / 2, pos, null);
canvas.rotate(180, pos[0], pos[1]);
canvas.drawTextOnPath(text, path, hOffset, bounds.height() + VERTICAL_OFFSET, circleAttrs.paint3);
canvas.drawTextOnPath(text, path, hOffset, bounds.height() + VERTICAL_OFFSET, circleAttrs.paint2);
canvas.drawTextOnPath(text, path, hOffset, bounds.height() + VERTICAL_OFFSET, lineFontAttrs.paint2);
canvas.drawTextOnPath(text, path, hOffset, bounds.height() + VERTICAL_OFFSET, lineFontAttrs.paint);
canvas.rotate(-180, pos[0], pos[1]);
} else {
canvas.drawTextOnPath(text, path, hOffset, -VERTICAL_OFFSET, circleAttrs.paint3);
canvas.drawTextOnPath(text, path, hOffset, -VERTICAL_OFFSET, circleAttrs.paint2);
canvas.drawTextOnPath(text, path, hOffset, -VERTICAL_OFFSET, lineFontAttrs.paint2);
canvas.drawTextOnPath(text, path, hOffset, -VERTICAL_OFFSET, lineFontAttrs.paint);
}
}