Route planning menu in progress. Revert fav icon.

This commit is contained in:
Alexey Kulish 2015-12-10 16:50:55 +03:00
parent 2e1f895804
commit 2ca9484cd6
13 changed files with 869 additions and 604 deletions

View file

@ -1,242 +1,306 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout android:id="@+id/plan_route_info"
android:id="@+id/plan_route_info" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="fill_parent" android:layout_height="match_parent"
android:background="?attr/left_menu_view_bg" android:clickable="true"
android:orientation="vertical" > android:background="@color/color_transparent">
<LinearLayout <LinearLayout
android:id="@+id/ModesLayout" android:id="@+id/main_view"
android:layout_width="fill_parent" android:layout_width="@dimen/map_route_planning_land_width"
android:layout_height="@dimen/list_item_height" android:layout_height="match_parent"
android:layout_gravity="bottom"
android:background="?attr/left_menu_view_bg"
android:clickable="true"
android:orientation="vertical"> android:orientation="vertical">
<FrameLayout <LinearLayout
android:layout_width="match_parent" android:id="@+id/ModesLayout"
android:layout_height="wrap_content"> android:layout_width="fill_parent"
android:layout_height="@dimen/list_item_height"
android:orientation="vertical">
<View <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="wrap_content">
android:layout_gravity="bottom"
android:background="?attr/dashboard_divider" <View
android:focusable="false"/> android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_gravity="bottom"
android:background="?attr/dashboard_divider"
android:focusable="false"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/app_modes"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:gravity="left"
android:orientation="horizontal"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="@dimen/list_content_padding"
android:orientation="horizontal"
android:visibility="gone">
<ImageView
android:id="@+id/waypoints"
android:layout_width="@dimen/list_item_height"
android:layout_height="@dimen/list_item_height"
android:background="?attr/dashboard_button"
android:scaleType="center"
android:src="@drawable/map_action_waypoints"/>
</LinearLayout>
</LinearLayout>
</FrameLayout>
</LinearLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fillViewport="true">
<LinearLayout <LinearLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:orientation="vertical">
<LinearLayout <LinearLayout
android:id="@+id/app_modes" android:id="@+id/FromLayout"
android:layout_width="0dp" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="@dimen/list_item_height"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:gravity="left"
android:orientation="horizontal"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="@dimen/list_content_padding"
android:visibility="gone"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <ImageView
android:id="@+id/waypoints" android:id="@+id/fromIcon"
android:layout_width="@dimen/list_item_height" android:layout_width="24dp"
android:layout_height="@dimen/list_item_height" android:layout_height="match_parent"
android:background="?attr/dashboard_button" android:layout_marginLeft="@dimen/list_content_padding"
android:scaleType="center" android:layout_marginRight="@dimen/list_content_padding"
android:src="@drawable/map_action_waypoints"/> android:src="@drawable/map_default_location"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginTop="5dp"
android:text="@string/route_from"
android:textSize="@dimen/default_sub_text_size"/>
<Spinner
android:id="@+id/FromSpinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="-8dp"
android:background="@null"
android:textSize="@dimen/default_list_text_size"/>
</LinearLayout>
<ImageView
android:id="@+id/fromDropDownIcon"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="@dimen/list_header_text_left_margin"
android:src="@drawable/ic_action_arrow_drop_down"/>
</LinearLayout> </LinearLayout>
</LinearLayout>
</FrameLayout>
</LinearLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fillViewport="true">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/FromLayout"
android:layout_width="fill_parent"
android:layout_height="@dimen/list_item_height"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginTop="3dp"
android:text="@string/route_from"
android:textSize="@dimen/default_sub_text_size" />
<Spinner
android:id="@+id/FromSpinner"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginTop="3dp"
android:layout_weight="1"
android:textSize="@dimen/default_list_text_size" />
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:background="?attr/dashboard_divider" android:background="?attr/dashboard_divider"
android:focusable="false" /> android:focusable="false"/>
</LinearLayout>
<LinearLayout
android:id="@+id/ViaLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/ViaSubView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginTop="3dp"
android:gravity="left"
android:text="@string/route_via"
android:textSize="@dimen/default_sub_text_size" />
<TextView
android:id="@+id/ViaView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginTop="3dp"
android:gravity="left"
android:textSize="@dimen/default_desc_text_size" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"
android:focusable="false" />
</LinearLayout>
<LinearLayout
android:id="@+id/ToLayout"
android:layout_width="fill_parent"
android:layout_height="@dimen/list_item_height"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginTop="3dp"
android:text="@string/route_to"
android:textSize="@dimen/default_sub_text_size" >
</TextView>
<Spinner
android:id="@+id/ToSpinner"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginTop="3dp"
android:layout_weight="1"
android:textSize="@dimen/default_list_text_size" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"
android:focusable="false" />
</LinearLayout>
<LinearLayout
android:id="@+id/RouteInfoControls"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout <LinearLayout
android:id="@+id/Info" android:id="@+id/ViaLayout"
android:layout_width="match_parent"
android:layout_height="@dimen/list_item_height"
android:orientation="horizontal">
<ImageView
android:id="@+id/viaIcon"
android:layout_width="24dp"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:src="@drawable/map_default_location"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/ViaSubView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginTop="5dp"
android:gravity="left"
android:text="@string/route_via"
android:textSize="@dimen/default_sub_text_size"/>
<TextView
android:id="@+id/ViaView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/list_content_padding"
android:gravity="left"
android:singleLine="true"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"/>
</LinearLayout>
</LinearLayout>
<View
android:id="@+id/viaLayoutDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"
android:focusable="false"/>
<LinearLayout
android:id="@+id/ToLayout"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="@dimen/list_item_height" android:layout_height="@dimen/list_item_height"
android:background="?attr/dashboard_button" android:orientation="horizontal">
android:orientation="horizontal" >
<ImageView <ImageView
android:id="@+id/Prev" android:id="@+id/toIcon"
android:layout_width="@dimen/list_item_height" android:layout_width="24dp"
android:layout_height="@dimen/list_item_height" android:layout_height="match_parent"
android:background="?attr/dashboard_button" android:layout_marginLeft="@dimen/list_content_padding"
android:contentDescription="@string/shared_string_previous" android:layout_marginRight="@dimen/list_content_padding"
android:scaleType="center" android:src="@drawable/map_default_location"/>
android:src="@drawable/ic_prev" />
<ImageView <LinearLayout
android:id="@+id/InfoIcon"
android:layout_width="@dimen/list_item_height"
android:layout_height="@dimen/list_item_height"
android:layout_gravity="center_vertical"
android:contentDescription="@string/info_button"
android:scaleType="center"
android:src="@drawable/ic_action_info_dark" />
<TextView
android:id="@+id/InfoTextView"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_gravity="center_vertical|left"
android:layout_weight="1" android:layout_weight="1"
android:textSize="@dimen/default_desc_text_size" /> android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginTop="5dp"
android:text="@string/route_to"
android:textSize="@dimen/default_sub_text_size">
</TextView>
<Spinner
android:id="@+id/ToSpinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="-8dp"
android:background="@null"
android:textSize="@dimen/default_list_text_size"/>
</LinearLayout>
<ImageView <ImageView
android:id="@+id/Next" android:id="@+id/toDropDownIcon"
android:layout_width="@dimen/list_item_height" android:layout_width="wrap_content"
android:layout_height="@dimen/list_item_height" android:layout_height="match_parent"
android:layout_marginLeft="5dp" android:layout_marginRight="@dimen/list_header_text_left_margin"
android:background="?attr/dashboard_button" android:src="@drawable/ic_action_arrow_drop_down"/>
android:contentDescription="@string/shared_string_next"
android:scaleType="center"
android:src="@drawable/ic_next" />
</LinearLayout> </LinearLayout>
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:background="?attr/dashboard_divider" android:background="?attr/dashboard_divider"
android:focusable="false" /> android:focusable="false"/>
<LinearLayout
android:id="@+id/RouteInfoControls"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/Info"
android:layout_width="fill_parent"
android:layout_height="@dimen/list_item_height"
android:background="?attr/dashboard_button"
android:orientation="horizontal">
<ImageView
android:id="@+id/Prev"
android:layout_width="@dimen/list_item_height"
android:layout_height="@dimen/list_item_height"
android:background="?attr/dashboard_button"
android:contentDescription="@string/shared_string_previous"
android:scaleType="center"
android:src="@drawable/ic_prev"/>
<ImageView
android:id="@+id/InfoIcon"
android:layout_width="@dimen/list_item_height"
android:layout_height="@dimen/list_item_height"
android:layout_gravity="center_vertical"
android:contentDescription="@string/info_button"
android:scaleType="center"
android:src="@drawable/ic_action_info_dark"/>
<TextView
android:id="@+id/InfoTextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|left"
android:layout_weight="1"
android:textSize="@dimen/default_desc_text_size"/>
<ImageView
android:id="@+id/Next"
android:layout_width="@dimen/list_item_height"
android:layout_height="@dimen/list_item_height"
android:layout_marginLeft="5dp"
android:background="?attr/dashboard_button"
android:contentDescription="@string/shared_string_next"
android:scaleType="center"
android:src="@drawable/ic_next"/>
</LinearLayout>
</LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout>
</ScrollView> </ScrollView>
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:background="?attr/dashboard_divider" android:background="?attr/dashboard_divider"
android:focusable="false"/> android:focusable="false"/>
<include layout="@layout/map_route_prepare_bottom" /> <include layout="@layout/map_route_prepare_bottom"/>
</LinearLayout> </LinearLayout>
</FrameLayout>

View file

@ -48,15 +48,23 @@
<include layout="@layout/map_hud_bottom"/> <include layout="@layout/map_hud_bottom"/>
</FrameLayout> </FrameLayout>
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom"> android:layout_gravity="bottom">
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1px"/> android:layout_height="1px"/>
</FrameLayout> </FrameLayout>
<FrameLayout
android:id="@+id/routeMenuContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<include <include
layout="@layout/dashboard_over_map" layout="@layout/dashboard_over_map"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -66,9 +74,11 @@
android:id="@+id/fragmentContainer" android:id="@+id/fragmentContainer"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"/> android:layout_height="match_parent"/>
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"/> android:layout_height="match_parent"/>
</FrameLayout> </FrameLayout>
<ListView <ListView

View file

@ -1,236 +1,306 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout android:id="@+id/plan_route_info"
android:id="@+id/plan_route_info" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="fill_parent" android:layout_height="match_parent"
android:background="?attr/bottom_menu_view_bg" android:clickable="true"
android:orientation="vertical" > android:background="@color/color_transparent">
<LinearLayout <LinearLayout
android:id="@+id/ModesLayout" android:id="@+id/main_view"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="@dimen/list_item_height" android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="?attr/bottom_menu_view_bg"
android:clickable="true"
android:orientation="vertical"> android:orientation="vertical">
<FrameLayout <LinearLayout
android:layout_width="match_parent" android:id="@+id/ModesLayout"
android:layout_height="wrap_content"> android:layout_width="fill_parent"
android:layout_height="@dimen/list_item_height"
android:orientation="vertical">
<View <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="wrap_content">
android:layout_gravity="bottom"
android:background="?attr/dashboard_divider" <View
android:focusable="false"/> android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_gravity="bottom"
android:background="?attr/dashboard_divider"
android:focusable="false"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/app_modes"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:gravity="left"
android:orientation="horizontal"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="@dimen/list_content_padding"
android:orientation="horizontal"
android:visibility="gone">
<ImageView
android:id="@+id/waypoints"
android:layout_width="@dimen/list_item_height"
android:layout_height="@dimen/list_item_height"
android:background="?attr/dashboard_button"
android:scaleType="center"
android:src="@drawable/map_action_waypoints"/>
</LinearLayout>
</LinearLayout>
</FrameLayout>
</LinearLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fillViewport="true">
<LinearLayout <LinearLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:orientation="vertical">
<LinearLayout <LinearLayout
android:id="@+id/app_modes" android:id="@+id/FromLayout"
android:layout_width="0dp" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="@dimen/list_item_height"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:gravity="left"
android:orientation="horizontal"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="@dimen/list_content_padding"
android:visibility="gone"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <ImageView
android:id="@+id/waypoints" android:id="@+id/fromIcon"
android:layout_width="@dimen/list_item_height" android:layout_width="24dp"
android:layout_height="@dimen/list_item_height" android:layout_height="match_parent"
android:background="?attr/dashboard_button" android:layout_marginLeft="@dimen/list_content_padding"
android:scaleType="center" android:layout_marginRight="@dimen/list_content_padding"
android:src="@drawable/map_action_waypoints"/> android:src="@drawable/map_default_location"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginTop="5dp"
android:text="@string/route_from"
android:textSize="@dimen/default_sub_text_size"/>
<Spinner
android:id="@+id/FromSpinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="-8dp"
android:background="@null"
android:textSize="@dimen/default_list_text_size"/>
</LinearLayout>
<ImageView
android:id="@+id/fromDropDownIcon"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="@dimen/list_header_text_left_margin"
android:src="@drawable/ic_action_arrow_drop_down"/>
</LinearLayout> </LinearLayout>
</LinearLayout>
</FrameLayout>
</LinearLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fillViewport="true">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/FromLayout"
android:layout_width="fill_parent"
android:layout_height="@dimen/list_item_height"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginTop="3dp"
android:text="@string/route_from"
android:textSize="@dimen/default_sub_text_size" />
<Spinner
android:id="@+id/FromSpinner"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginTop="3dp"
android:layout_weight="1"
android:textSize="@dimen/default_list_text_size" />
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:background="?attr/dashboard_divider" android:background="?attr/dashboard_divider"
android:focusable="false" /> android:focusable="false"/>
</LinearLayout>
<LinearLayout
android:id="@+id/ViaLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/ViaSubView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginTop="3dp"
android:gravity="left"
android:text="@string/route_via"
android:textSize="@dimen/default_sub_text_size" />
<TextView
android:id="@+id/ViaView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginTop="3dp"
android:gravity="left"
android:textSize="@dimen/default_desc_text_size" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"
android:focusable="false" />
</LinearLayout>
<LinearLayout
android:id="@+id/ToLayout"
android:layout_width="fill_parent"
android:layout_height="@dimen/list_item_height"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginTop="3dp"
android:text="@string/route_to"
android:textSize="@dimen/default_sub_text_size" >
</TextView>
<Spinner
android:id="@+id/ToSpinner"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginTop="3dp"
android:layout_weight="1"
android:textSize="@dimen/default_list_text_size" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"
android:focusable="false" />
</LinearLayout>
<LinearLayout
android:id="@+id/RouteInfoControls"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout <LinearLayout
android:id="@+id/Info" android:id="@+id/ViaLayout"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="@dimen/list_item_height" android:layout_height="@dimen/list_item_height"
android:background="?attr/dashboard_button" android:orientation="horizontal">
android:orientation="horizontal" >
<ImageView <ImageView
android:id="@+id/Prev" android:id="@+id/viaIcon"
android:layout_width="@dimen/list_item_height" android:layout_width="24dp"
android:layout_height="@dimen/list_item_height" android:layout_height="match_parent"
android:background="?attr/dashboard_button" android:layout_marginLeft="@dimen/list_content_padding"
android:contentDescription="@string/shared_string_previous" android:layout_marginRight="@dimen/list_content_padding"
android:scaleType="center" android:src="@drawable/map_default_location"/>
android:src="@drawable/ic_prev" />
<ImageView <LinearLayout
android:id="@+id/InfoIcon"
android:layout_width="@dimen/list_item_height"
android:layout_height="@dimen/list_item_height"
android:layout_gravity="center_vertical"
android:contentDescription="@string/info_button"
android:scaleType="center"
android:src="@drawable/ic_action_info_dark" />
<TextView
android:id="@+id/InfoTextView"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_gravity="center_vertical|left"
android:layout_weight="1" android:layout_weight="1"
android:textSize="@dimen/default_desc_text_size" /> android:orientation="vertical">
<TextView
android:id="@+id/ViaSubView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginTop="5dp"
android:gravity="left"
android:text="@string/route_via"
android:textSize="@dimen/default_sub_text_size"/>
<TextView
android:id="@+id/ViaView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/list_content_padding"
android:gravity="left"
android:singleLine="true"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"/>
</LinearLayout>
<ImageView
android:id="@+id/Next"
android:layout_width="@dimen/list_item_height"
android:layout_height="@dimen/list_item_height"
android:layout_marginLeft="5dp"
android:background="?attr/dashboard_button"
android:contentDescription="@string/shared_string_next"
android:scaleType="center"
android:src="@drawable/ic_next" />
</LinearLayout> </LinearLayout>
<View
android:id="@+id/viaLayoutDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"
android:focusable="false"/>
<LinearLayout
android:id="@+id/ToLayout"
android:layout_width="fill_parent"
android:layout_height="@dimen/list_item_height"
android:orientation="horizontal">
<ImageView
android:id="@+id/toIcon"
android:layout_width="24dp"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:src="@drawable/map_default_location"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginTop="5dp"
android:text="@string/route_to"
android:textSize="@dimen/default_sub_text_size">
</TextView>
<Spinner
android:id="@+id/ToSpinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="-8dp"
android:background="@null"
android:textSize="@dimen/default_list_text_size"/>
</LinearLayout>
<ImageView
android:id="@+id/toDropDownIcon"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="@dimen/list_header_text_left_margin"
android:src="@drawable/ic_action_arrow_drop_down"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"
android:focusable="false"/>
<LinearLayout
android:id="@+id/RouteInfoControls"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/Info"
android:layout_width="fill_parent"
android:layout_height="@dimen/list_item_height"
android:background="?attr/dashboard_button"
android:orientation="horizontal">
<ImageView
android:id="@+id/Prev"
android:layout_width="@dimen/list_item_height"
android:layout_height="@dimen/list_item_height"
android:background="?attr/dashboard_button"
android:contentDescription="@string/shared_string_previous"
android:scaleType="center"
android:src="@drawable/ic_prev"/>
<ImageView
android:id="@+id/InfoIcon"
android:layout_width="@dimen/list_item_height"
android:layout_height="@dimen/list_item_height"
android:layout_gravity="center_vertical"
android:contentDescription="@string/info_button"
android:scaleType="center"
android:src="@drawable/ic_action_info_dark"/>
<TextView
android:id="@+id/InfoTextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|left"
android:layout_weight="1"
android:textSize="@dimen/default_desc_text_size"/>
<ImageView
android:id="@+id/Next"
android:layout_width="@dimen/list_item_height"
android:layout_height="@dimen/list_item_height"
android:layout_marginLeft="5dp"
android:background="?attr/dashboard_button"
android:contentDescription="@string/shared_string_next"
android:scaleType="center"
android:src="@drawable/ic_next"/>
</LinearLayout>
</LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout>
</ScrollView>
<View </ScrollView>
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_gravity="bottom"
android:background="?attr/dashboard_divider"
android:focusable="false"/>
<include layout="@layout/map_route_prepare_bottom" /> <View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_gravity="bottom"
android:background="?attr/dashboard_divider"
android:focusable="false"/>
</LinearLayout> <include layout="@layout/map_route_prepare_bottom"/>
</LinearLayout>
</FrameLayout>

View file

@ -7,7 +7,7 @@
<dimen name="map_route_buttons_width">90dp</dimen> <dimen name="map_route_buttons_width">90dp</dimen>
<dimen name="map_route_buttons_height">81dp</dimen> <dimen name="map_route_buttons_height">81dp</dimen>
<dimen name="map_route_buttons_height_land">72dp</dimen> <dimen name="map_route_buttons_height_land">72dp</dimen>
<dimen name="map_route_planning_max_height">400dp</dimen> <dimen name="map_route_planning_max_height">450dp</dimen>
<dimen name="map_minwidth_widget">160dp</dimen> <dimen name="map_minwidth_widget">160dp</dimen>
<dimen name="map_route_planning_land_width">510dp</dimen> <dimen name="map_route_planning_land_width">510dp</dimen>

View file

@ -86,7 +86,7 @@
<dimen name="map_button_stroke">1dp</dimen> <dimen name="map_button_stroke">1dp</dimen>
<dimen name="map_button_stroke_dark">1dp</dimen> <dimen name="map_button_stroke_dark">1dp</dimen>
<dimen name="map_route_planning_land_width">320dp</dimen> <dimen name="map_route_planning_land_width">320dp</dimen>
<dimen name="map_route_planning_max_height">280dp</dimen> <dimen name="map_route_planning_max_height">330dp</dimen>
<dimen name="map_minwidth_widget">100dp</dimen> <dimen name="map_minwidth_widget">100dp</dimen>

View file

@ -22,7 +22,7 @@ import net.osmand.plus.R;
import net.osmand.plus.routing.RouteDirectionInfo; import net.osmand.plus.routing.RouteDirectionInfo;
import net.osmand.plus.routing.RoutingHelper; import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.views.TurnPathHelper; import net.osmand.plus.views.TurnPathHelper;
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoControl; import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
@ -144,7 +144,7 @@ public class ShowRouteInfoActivity extends OsmandListActivity {
RouteDirectionInfo item = ((RouteInfoAdapter)getListAdapter()).getItem(position - 1); RouteDirectionInfo item = ((RouteInfoAdapter)getListAdapter()).getItem(position - 1);
Location loc = helper.getLocationFromRouteDirection(item); Location loc = helper.getLocationFromRouteDirection(item);
if(loc != null){ if(loc != null){
MapRouteInfoControl.directionInfo = position - 1; MapRouteInfoMenu.directionInfo = position - 1;
OsmandSettings settings = ((OsmandApplication) getApplication()).getSettings(); OsmandSettings settings = ((OsmandApplication) getApplication()).getSettings();
settings.setMapLocationToShow(loc.getLatitude(),loc.getLongitude(), settings.setMapLocationToShow(loc.getLatitude(),loc.getLongitude(),
Math.max(13, settings.getLastKnownMapZoom()), Math.max(13, settings.getLastKnownMapZoom()),

View file

@ -13,7 +13,6 @@ import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter; import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect; import android.graphics.Rect;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.util.DisplayMetrics;
import net.osmand.plus.R; import net.osmand.plus.R;
@ -36,30 +35,22 @@ public class FavoriteImageDrawable extends Drawable {
this.withShadow = withShadow; this.withShadow = withShadow;
this.resources = ctx.getResources(); this.resources = ctx.getResources();
this.color = color; this.color = color;
paintIcon = new Paint();
int col = color == 0 || color == Color.BLACK ? getResources().getColor(R.color.color_favorite) : color;
paintIcon.setColorFilter(new PorterDuffColorFilter(col, PorterDuff.Mode.SRC_IN));
paintBackground = new Paint(); paintBackground = new Paint();
int col = color == 0 || color == Color.BLACK ? getResources().getColor(R.color.color_favorite) : color;
paintBackground.setColorFilter(new PorterDuffColorFilter(col, PorterDuff.Mode.MULTIPLY));
paintIcon = new Paint();
favIcon = BitmapFactory.decodeResource(ctx.getResources(), R.drawable.map_favorite); favIcon = BitmapFactory.decodeResource(ctx.getResources(), R.drawable.map_favorite);
favBackground = BitmapFactory.decodeResource(ctx.getResources(), R.drawable.map_white_favorite_shield); favBackground = BitmapFactory.decodeResource(ctx.getResources(), R.drawable.map_white_favorite_shield);
listDrawable = getResources().getDrawable(R.drawable.ic_action_fav_dark).mutate(); listDrawable = getResources().getDrawable(R.drawable.ic_action_fav_dark).mutate();
listDrawable.setColorFilter(new PorterDuffColorFilter(col, PorterDuff.Mode.SRC_IN));
DisplayMetrics metrics = getResources().getDisplayMetrics();
paintOuter = new Paint(); paintOuter = new Paint();
paintOuter.setAntiAlias(true); paintOuter.setAntiAlias(true);
paintOuter.setStyle(Style.FILL_AND_STROKE); paintOuter.setStyle(Style.FILL_AND_STROKE);
paintInnerCircle = new Paint(); paintInnerCircle = new Paint();
paintInnerCircle.setStyle(Style.FILL_AND_STROKE); paintInnerCircle.setStyle(Style.FILL_AND_STROKE);
if(metrics != null && metrics.density > 0) { paintOuter.setColor(color == 0 || color == Color.BLACK ? 0x88555555 : color);
paintOuter.setStrokeWidth(metrics.density * 1); paintInnerCircle.setColor(color == 0 || color == Color.BLACK ? getResources().getColor(R.color.color_favorite)
} else { : color);
paintOuter.setStrokeWidth(1);
}
// paintOuter.setColor(color == 0 || color == Color.BLACK ? 0x88555555 : color);
paintOuter.setColor(0xffbbbbbb);
paintInnerCircle.setColor(Color.WHITE);
paintInnerCircle.setAntiAlias(true); paintInnerCircle.setAntiAlias(true);
} }

View file

@ -5,12 +5,13 @@ import android.content.DialogInterface;
import android.content.DialogInterface.OnDismissListener; import android.content.DialogInterface.OnDismissListener;
import android.content.Intent; import android.content.Intent;
import android.graphics.PointF; import android.graphics.PointF;
import android.graphics.drawable.Drawable;
import android.support.v4.app.Fragment;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.Spinner; import android.widget.Spinner;
import android.widget.TextView; import android.widget.TextView;
@ -21,10 +22,9 @@ import net.osmand.data.LatLon;
import net.osmand.data.PointDescription; import net.osmand.data.PointDescription;
import net.osmand.data.RotatedTileBox; import net.osmand.data.RotatedTileBox;
import net.osmand.plus.ApplicationMode; import net.osmand.plus.ApplicationMode;
import net.osmand.plus.IconsCache;
import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmAndLocationProvider;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.TargetPointsHelper; import net.osmand.plus.TargetPointsHelper;
@ -34,7 +34,6 @@ import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.ShowRouteInfoActivity; import net.osmand.plus.activities.ShowRouteInfoActivity;
import net.osmand.plus.activities.actions.AppModeDialog; import net.osmand.plus.activities.actions.AppModeDialog;
import net.osmand.plus.activities.search.SearchAddressActivity; import net.osmand.plus.activities.search.SearchAddressActivity;
import net.osmand.plus.development.OsmandDevelopmentPlugin;
import net.osmand.plus.dialogs.FavoriteDialogs; import net.osmand.plus.dialogs.FavoriteDialogs;
import net.osmand.plus.mapcontextmenu.MapContextMenu; import net.osmand.plus.mapcontextmenu.MapContextMenu;
import net.osmand.plus.routing.RouteDirectionInfo; import net.osmand.plus.routing.RouteDirectionInfo;
@ -43,27 +42,27 @@ import net.osmand.plus.routing.RoutingHelper.IRouteInformationListener;
import net.osmand.plus.views.MapControlsLayer; import net.osmand.plus.views.MapControlsLayer;
import net.osmand.plus.views.OsmandMapTileView; import net.osmand.plus.views.OsmandMapTileView;
import java.lang.ref.WeakReference;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
public class MapRouteInfoControl implements IRouteInformationListener { public class MapRouteInfoMenu implements IRouteInformationListener {
public static int directionInfo = -1; public static int directionInfo = -1;
public static boolean controlVisible = false; public static boolean controlVisible = false;
private final MapContextMenu contextMenu; private final MapContextMenu contextMenu;
private final RoutingHelper routingHelper; private final RoutingHelper routingHelper;
private OsmandMapTileView mapView; private OsmandMapTileView mapView;
private Dialog dialog; private boolean selectFromMapTouch;
private boolean selectFromMapTouch;
private boolean selectFromMapForTarget; private boolean selectFromMapForTarget;
private boolean showDialog = false; private boolean showMenu = false;
private MapActivity mapActivity; private MapActivity mapActivity;
private MapControlsLayer mapControlsLayer; private MapControlsLayer mapControlsLayer;
public static final String TARGET_SELECT = "TARGET_SELECT"; public static final String TARGET_SELECT = "TARGET_SELECT";
public MapRouteInfoControl(MapActivity mapActivity, MapControlsLayer mapControlsLayer) { public MapRouteInfoMenu(MapActivity mapActivity, MapControlsLayer mapControlsLayer) {
this.mapActivity = mapActivity; this.mapActivity = mapActivity;
this.mapControlsLayer = mapControlsLayer; this.mapControlsLayer = mapControlsLayer;
contextMenu = mapActivity.getContextMenu(); contextMenu = mapActivity.getContextMenu();
@ -71,61 +70,59 @@ public class MapRouteInfoControl implements IRouteInformationListener {
mapView = mapActivity.getMapView(); mapView = mapActivity.getMapView();
routingHelper.addListener(this); routingHelper.addListener(this);
} }
public boolean onSingleTap(PointF point, RotatedTileBox tileBox) { public boolean onSingleTap(PointF point, RotatedTileBox tileBox) {
if(selectFromMapTouch) { if (selectFromMapTouch) {
LatLon latlon = tileBox.getLatLonFromPixel(point.x, point.y); LatLon latlon = tileBox.getLatLonFromPixel(point.x, point.y);
selectFromMapTouch = false; selectFromMapTouch = false;
if(selectFromMapForTarget) { if (selectFromMapForTarget) {
getTargets().navigateToPoint(latlon, true, -1); getTargets().navigateToPoint(latlon, true, -1);
} else { } else {
getTargets().setStartPoint(latlon, true, null); getTargets().setStartPoint(latlon, true, null);
} }
contextMenu.showMinimized(latlon, null, null); contextMenu.showMinimized(latlon, null, null);
showDialog(); show();
return true; return true;
} }
return false; return false;
} }
public void setVisible(boolean visible) { public void setVisible(boolean visible) {
if(visible) { if (visible) {
if (showDialog){ if (showMenu) {
//if (getTargets().getPointToNavigate() == null){ show();
showDialog(); showMenu = false;
//}
showDialog = false;
} }
controlVisible = true; controlVisible = true;
} else { } else {
hideDialog(); hide();
controlVisible = false; controlVisible = false;
} }
} }
public void showHideDialog() { public void showHideMenu() {
if(dialog != null) { if (isVisible()) {
hideDialog(); hide();
} else { } else {
showDialog(); show();
} }
} }
public void updateDialog() { public void updateMenu() {
if(dialog != null) { WeakReference<MapRouteInfoMenuFragment> fragmentRef = findMenuFragment();
updateInfo(dialog.findViewById(R.id.plan_route_info)); if (fragmentRef != null)
} fragmentRef.get().updateInfo();
} }
private void updateInfo(final View main) { public void updateInfo(final View main) {
updateViaView(main); updateViaView(main);
updateFromSpinner(main); updateFromSpinner(main);
updateToSpinner(main); updateToSpinner(main);
updateApplicationModes(main); updateApplicationModes(main);
mapControlsLayer.updateRouteButtons(main, true); mapControlsLayer.updateRouteButtons(main, true);
boolean addButtons = routingHelper.isRouteCalculated(); boolean addButtons = routingHelper.isRouteCalculated();
if(addButtons) { if (addButtons) {
updateRouteButtons(main); updateRouteButtons(main);
} else { } else {
updateRouteCalcProgress(main); updateRouteCalcProgress(main);
@ -134,7 +131,7 @@ public class MapRouteInfoControl implements IRouteInformationListener {
private void updateRouteCalcProgress(final View main) { private void updateRouteCalcProgress(final View main) {
TargetPointsHelper targets = getTargets(); TargetPointsHelper targets = getTargets();
if(targets.hasTooLongDistanceToNavigate()) { if (targets.hasTooLongDistanceToNavigate()) {
main.findViewById(R.id.RouteInfoControls).setVisibility(View.VISIBLE); main.findViewById(R.id.RouteInfoControls).setVisibility(View.VISIBLE);
TextView textView = (TextView) main.findViewById(R.id.InfoTextView); TextView textView = (TextView) main.findViewById(R.id.InfoTextView);
ImageView iconView = (ImageView) main.findViewById(R.id.InfoIcon); ImageView iconView = (ImageView) main.findViewById(R.id.InfoIcon);
@ -143,7 +140,7 @@ public class MapRouteInfoControl implements IRouteInformationListener {
textView.setText(R.string.route_is_too_long); textView.setText(R.string.route_is_too_long);
textView.setVisibility(View.VISIBLE); textView.setVisibility(View.VISIBLE);
iconView.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getContentIcon(R.drawable.ic_warning)); iconView.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getContentIcon(R.drawable.ic_warning));
} else{ } else {
main.findViewById(R.id.RouteInfoControls).setVisibility(View.GONE); main.findViewById(R.id.RouteInfoControls).setVisibility(View.GONE);
} }
} }
@ -151,7 +148,7 @@ public class MapRouteInfoControl implements IRouteInformationListener {
private void updateApplicationModes(final View parentView) { private void updateApplicationModes(final View parentView) {
final OsmandSettings settings = mapActivity.getMyApplication().getSettings(); final OsmandSettings settings = mapActivity.getMyApplication().getSettings();
ApplicationMode am = settings.APPLICATION_MODE.get(); ApplicationMode am = settings.APPLICATION_MODE.get();
final Set<ApplicationMode> selected = new HashSet<ApplicationMode>(); final Set<ApplicationMode> selected = new HashSet<>();
selected.add(am); selected.add(am);
ViewGroup vg = (ViewGroup) parentView.findViewById(R.id.app_modes); ViewGroup vg = (ViewGroup) parentView.findViewById(R.id.app_modes);
vg.removeAllViews(); vg.removeAllViews();
@ -165,17 +162,26 @@ public class MapRouteInfoControl implements IRouteInformationListener {
mapActivity.getRoutingHelper().recalculateRouteDueToSettingsChange(); mapActivity.getRoutingHelper().recalculateRouteDueToSettingsChange();
} }
} }
}); });
} }
private void updateViaView(final View parentView) { private void updateViaView(final View parentView) {
String via = generateViaDescription(); String via = generateViaDescription();
if(via.length() == 0){ if (via.length() == 0) {
parentView.findViewById(R.id.ViaLayout).setVisibility(View.GONE); parentView.findViewById(R.id.ViaLayout).setVisibility(View.GONE);
parentView.findViewById(R.id.viaLayoutDivider).setVisibility(View.GONE);
} else { } else {
parentView.findViewById(R.id.ViaLayout).setVisibility(View.VISIBLE); parentView.findViewById(R.id.ViaLayout).setVisibility(View.VISIBLE);
parentView.findViewById(R.id.viaLayoutDivider).setVisibility(View.VISIBLE);
((TextView) parentView.findViewById(R.id.ViaView)).setText(via); ((TextView) parentView.findViewById(R.id.ViaView)).setText(via);
} }
ImageView viaIcon = (ImageView) parentView.findViewById(R.id.viaIcon);
if (isLight()) {
viaIcon.setImageDrawable(getIconOrig(R.drawable.widget_intermediate_day));
} else {
viaIcon.setImageDrawable(getIconOrig(R.drawable.widget_intermediate_night));
}
} }
private void updateToSpinner(final View parentView) { private void updateToSpinner(final View parentView) {
@ -183,24 +189,41 @@ public class MapRouteInfoControl implements IRouteInformationListener {
toSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { toSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override @Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if(position == 1) { if (position == 1) {
selectFavorite(parentView, true); selectFavorite(parentView, true);
} else if(position == 2) { } else if (position == 2) {
selectOnScreen(parentView, true); selectOnScreen(true);
} else if(position == 3) { } else if (position == 3) {
Intent intent = new Intent(mapActivity, SearchAddressActivity.class); Intent intent = new Intent(mapActivity, SearchAddressActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
intent.putExtra(TARGET_SELECT, true); intent.putExtra(TARGET_SELECT, true);
mapActivity.startActivityForResult(intent, MapControlsLayer.REQUEST_ADDRESS_SELECT); mapActivity.startActivityForResult(intent, MapControlsLayer.REQUEST_ADDRESS_SELECT);
} }
} }
@Override @Override
public void onNothingSelected(AdapterView<?> parent) { public void onNothingSelected(AdapterView<?> parent) {
} }
}); });
ImageView toIcon = (ImageView) parentView.findViewById(R.id.toIcon);
if (isLight()) {
toIcon.setImageDrawable(getIconOrig(R.drawable.widget_target_day));
} else {
toIcon.setImageDrawable(getIconOrig(R.drawable.widget_target_night));
}
ImageView toDropDownIcon = (ImageView) parentView.findViewById(R.id.toDropDownIcon);
toDropDownIcon.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getContentIcon(R.drawable.ic_action_arrow_drop_down));
toDropDownIcon.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
toSpinner.performClick();
}
});
} }
@SuppressWarnings("deprecation")
private void updateFromSpinner(final View parentView) { private void updateFromSpinner(final View parentView) {
final TargetPointsHelper targets = getTargets(); final TargetPointsHelper targets = getTargets();
final Spinner fromSpinner = setupFromSpinner(parentView); final Spinner fromSpinner = setupFromSpinner(parentView);
@ -208,43 +231,56 @@ public class MapRouteInfoControl implements IRouteInformationListener {
@Override @Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if(position == 0) { if (position == 0) {
if(targets.getPointToStart() != null) { if (targets.getPointToStart() != null) {
targets.clearStartPoint(true); targets.clearStartPoint(true);
} }
} else if(position == 1) { } else if (position == 1) {
selectFavorite(parentView, false); selectFavorite(parentView, false);
} else if(position == 2) { } else if (position == 2) {
selectOnScreen(parentView, false); selectOnScreen(false);
} else if(position == 3) { } else if (position == 3) {
Intent intent = new Intent(mapActivity, SearchAddressActivity.class); Intent intent = new Intent(mapActivity, SearchAddressActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
intent.putExtra(TARGET_SELECT, false); intent.putExtra(TARGET_SELECT, false);
mapActivity.startActivityForResult(intent, MapControlsLayer.REQUEST_ADDRESS_SELECT); mapActivity.startActivityForResult(intent, MapControlsLayer.REQUEST_ADDRESS_SELECT);
} }
} }
@Override @Override
public void onNothingSelected(AdapterView<?> parent) { public void onNothingSelected(AdapterView<?> parent) {
} }
}); });
ImageView fromIcon = (ImageView) parentView.findViewById(R.id.fromIcon);
ApplicationMode appMode = mapActivity.getMyApplication().getSettings().getApplicationMode();
fromIcon.setImageDrawable(mapActivity.getResources().getDrawable(appMode.getResourceLocationDay()));
ImageView fromDropDownIcon = (ImageView) parentView.findViewById(R.id.fromDropDownIcon);
fromDropDownIcon.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getContentIcon(R.drawable.ic_action_arrow_drop_down));
fromDropDownIcon.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
fromSpinner.performClick();
}
});
} }
protected void selectOnScreen(View parentView, boolean target) { protected void selectOnScreen(boolean target) {
selectFromMapTouch = true; selectFromMapTouch = true;
selectFromMapForTarget = target; selectFromMapForTarget = target;
hideDialog(); hide();
} }
public void selectAddress(String name, LatLon l, final boolean target) { public void selectAddress(String name, LatLon l, final boolean target) {
PointDescription pd = new PointDescription(PointDescription.POINT_TYPE_ADDRESS, name); PointDescription pd = new PointDescription(PointDescription.POINT_TYPE_ADDRESS, name);
if(target) { if (target) {
getTargets().navigateToPoint(l, true, -1, pd); getTargets().navigateToPoint(l, true, -1, pd);
} else { } else {
getTargets().setStartPoint(l, true, pd); getTargets().setStartPoint(l, true, pd);
} }
hideDialog(); hide();
showDialog(); show();
} }
protected void selectFavorite(final View parentView, final boolean target) { protected void selectFavorite(final View parentView, final boolean target) {
@ -267,26 +303,34 @@ public class MapRouteInfoControl implements IRouteInformationListener {
FavoriteDialogs.showFavoritesDialog(mapActivity, favouritesAdapter, click, dismissListener, dlgHolder, true); FavoriteDialogs.showFavoritesDialog(mapActivity, favouritesAdapter, click, dismissListener, dlgHolder, true);
} }
private boolean isLight() {
return mapActivity.getMyApplication().getSettings().isLightContent();
}
private Drawable getIconOrig(int iconId) {
IconsCache iconsCache = mapActivity.getMyApplication().getIconsCache();
return iconsCache.getIcon(iconId, 0, 0f);
}
private OnItemClickListener getOnClickListener(final boolean target, final FavouritesAdapter favouritesAdapter, private OnItemClickListener getOnClickListener(final boolean target, final FavouritesAdapter favouritesAdapter,
final Dialog[] dlg) { final Dialog[] dlg) {
return new AdapterView.OnItemClickListener() { return new AdapterView.OnItemClickListener() {
@Override @Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
FavouritePoint fp = favouritesAdapter.getItem(position); FavouritePoint fp = favouritesAdapter.getItem(position);
LatLon point = new LatLon(fp.getLatitude(), fp.getLongitude()); LatLon point = new LatLon(fp.getLatitude(), fp.getLongitude());
if(target) { if (target) {
getTargets().navigateToPoint(point, true, -1, fp.getPointDescription()); getTargets().navigateToPoint(point, true, -1, fp.getPointDescription());
} else { } else {
getTargets().setStartPoint(point, true, fp.getPointDescription()); getTargets().setStartPoint(point, true, fp.getPointDescription());
} }
if(dlg != null && dlg.length > 0 && dlg[0] != null) { if (dlg != null && dlg.length > 0 && dlg[0] != null) {
dlg[0].dismiss(); dlg[0].dismiss();
} }
//Next 2 lines ensure Dialog is shown in the right correct position after a selection been made //Next 2 lines ensure Dialog is shown in the right correct position after a selection been made
hideDialog(); hide();
showDialog(); show();
} }
}; };
} }
@ -294,15 +338,24 @@ public class MapRouteInfoControl implements IRouteInformationListener {
public static int getDirectionInfo() { public static int getDirectionInfo() {
return directionInfo; return directionInfo;
} }
public boolean isDialogVisible() { public boolean isVisible() {
return dialog != null && dialog.isShowing(); return findMenuFragment() != null;
}
public WeakReference<MapRouteInfoMenuFragment> findMenuFragment() {
Fragment fragment = mapActivity.getSupportFragmentManager().findFragmentByTag(MapRouteInfoMenuFragment.TAG);
if (fragment != null && !fragment.isDetached()) {
return new WeakReference<>((MapRouteInfoMenuFragment) fragment);
} else {
return null;
}
} }
public static boolean isControlVisible() { public static boolean isControlVisible() {
return controlVisible; return controlVisible;
} }
private void updateRouteButtons(final View mainView) { private void updateRouteButtons(final View mainView) {
mainView.findViewById(R.id.RouteInfoControls).setVisibility(View.VISIBLE); mainView.findViewById(R.id.RouteInfoControls).setVisibility(View.VISIBLE);
final OsmandApplication ctx = mapActivity.getMyApplication(); final OsmandApplication ctx = mapActivity.getMyApplication();
@ -337,10 +390,10 @@ public class MapRouteInfoControl implements IRouteInformationListener {
ImageView next = (ImageView) mainView.findViewById(R.id.Next); ImageView next = (ImageView) mainView.findViewById(R.id.Next);
next.setVisibility(View.VISIBLE); next.setVisibility(View.VISIBLE);
next.setImageDrawable(ctx.getIconsCache().getContentIcon(R.drawable.ic_next)); next.setImageDrawable(ctx.getIconsCache().getContentIcon(R.drawable.ic_next));
next.setOnClickListener(new View.OnClickListener(){ next.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if(routingHelper.getRouteDirections() != null && directionInfo < routingHelper.getRouteDirections().size() - 1){ if (routingHelper.getRouteDirections() != null && directionInfo < routingHelper.getRouteDirections().size() - 1) {
directionInfo++; directionInfo++;
RouteDirectionInfo info = routingHelper.getRouteDirections().get(directionInfo); RouteDirectionInfo info = routingHelper.getRouteDirections().get(directionInfo);
net.osmand.Location l = routingHelper.getLocationFromRouteDirection(info); net.osmand.Location l = routingHelper.getLocationFromRouteDirection(info);
@ -350,10 +403,10 @@ public class MapRouteInfoControl implements IRouteInformationListener {
mapView.refreshMap(); mapView.refreshMap();
updateInfo(mainView); updateInfo(mainView);
} }
}); });
View info = mainView.findViewById(R.id.Info); View info = mainView.findViewById(R.id.Info);
info.setOnClickListener(new View.OnClickListener(){ info.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Intent intent = new Intent(mapView.getContext(), ShowRouteInfoActivity.class); Intent intent = new Intent(mapView.getContext(), ShowRouteInfoActivity.class);
@ -361,10 +414,10 @@ public class MapRouteInfoControl implements IRouteInformationListener {
mapView.getContext().startActivity(intent); mapView.getContext().startActivity(intent);
} }
}); });
TextView textView = (TextView) mainView.findViewById(R.id.InfoTextView); TextView textView = (TextView) mainView.findViewById(R.id.InfoTextView);
ImageView iconView = (ImageView) mainView.findViewById(R.id.InfoIcon); ImageView iconView = (ImageView) mainView.findViewById(R.id.InfoIcon);
if(directionInfo >= 0) { if (directionInfo >= 0) {
iconView.setVisibility(View.GONE); iconView.setVisibility(View.GONE);
} else { } else {
iconView.setImageDrawable(ctx.getIconsCache().getContentIcon(R.drawable.ic_action_info_dark)); iconView.setImageDrawable(ctx.getIconsCache().getContentIcon(R.drawable.ic_action_info_dark));
@ -379,81 +432,52 @@ public class MapRouteInfoControl implements IRouteInformationListener {
} }
} }
private Button attachSimulateRoute(final View mainView, final OsmandApplication ctx) {
final Button simulateRoute = null;//(Button) mainView.findViewById(R.id.SimulateRoute);
final OsmAndLocationProvider loc = ctx.getLocationProvider();
if(mapActivity.getRoutingHelper().isFollowingMode()) {
simulateRoute.setVisibility(View.GONE);
}
if (OsmandPlugin.getEnabledPlugin(OsmandDevelopmentPlugin.class) == null) {
simulateRoute.setVisibility(View.GONE);
}
simulateRoute.setText(loc.getLocationSimulation().isRouteAnimating() ? R.string.animate_route_off : R.string.animate_route);
simulateRoute.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mainView.findViewById(R.id.RouteInfoControls).setVisibility(View.GONE);
if(loc.getLocationSimulation().isRouteAnimating()) {
loc.getLocationSimulation().startStopRouteAnimation(mapActivity);
hideDialog();
} else {
simulateRoute.setText(R.string.animate_route_off);
loc.getLocationSimulation().startStopRouteAnimation(mapActivity);
}
}
});
return simulateRoute;
}
@Override @Override
public void newRouteIsCalculated(boolean newRoute, ValueHolder<Boolean> showToast) { public void newRouteIsCalculated(boolean newRoute, ValueHolder<Boolean> showToast) {
directionInfo = -1; directionInfo = -1;
updateDialog(); updateMenu();
if(isDialogVisible()) { if (isVisible()) {
showToast.value = false; showToast.value = false;
} }
} }
public String generateViaDescription() { public String generateViaDescription() {
TargetPointsHelper targets = getTargets(); TargetPointsHelper targets = getTargets();
String via = "";
List<TargetPoint> points = targets.getIntermediatePointsNavigation(); List<TargetPoint> points = targets.getIntermediatePointsNavigation();
if (points.size() == 0) { if (points.size() == 0) {
return via; return "";
} }
StringBuilder via = new StringBuilder();
for (int i = 0; i < points.size(); i++) { for (int i = 0; i < points.size(); i++) {
if (i > 0) { if (i > 0) {
via += "\n"; via.append(" ");
} }
via += " " + getRoutePointDescription(points.get(i).point, points.get(i).getOnlyName()); via.append(getRoutePointDescription(points.get(i).point, points.get(i).getOnlyName()));
} }
return via; return via.toString();
} }
public String getRoutePointDescription(double lat, double lon) { public String getRoutePointDescription(double lat, double lon) {
return mapActivity.getString(R.string.route_descr_lat_lon, lat, lon); return mapActivity.getString(R.string.route_descr_lat_lon, lat, lon);
} }
public String getRoutePointDescription(LatLon l, String d) { public String getRoutePointDescription(LatLon l, String d) {
if(d != null && d.length() > 0) { if (d != null && d.length() > 0) {
return d.replace(':', ' '); return d.replace(':', ' ');
} }
if(l != null) { if (l != null) {
return mapActivity.getString(R.string.route_descr_lat_lon, l.getLatitude(), l.getLongitude()); return mapActivity.getString(R.string.route_descr_lat_lon, l.getLatitude(), l.getLongitude());
} }
return ""; return "";
} }
private Spinner setupFromSpinner( View view) { private Spinner setupFromSpinner(View view) {
ArrayList<String> fromActions = new ArrayList<String>(); ArrayList<String> fromActions = new ArrayList<>();
fromActions.add(mapActivity.getString(R.string.route_descr_current_location)); fromActions.add(mapActivity.getString(R.string.route_descr_current_location));
fromActions.add(mapActivity.getString(R.string.shared_string_favorite) + mapActivity.getString(R.string.shared_string_ellipsis)); fromActions.add(mapActivity.getString(R.string.shared_string_favorite) + mapActivity.getString(R.string.shared_string_ellipsis));
fromActions.add(mapActivity.getString(R.string.shared_string_select_on_map)); fromActions.add(mapActivity.getString(R.string.shared_string_select_on_map));
fromActions.add(mapActivity.getString(R.string.shared_string_address) + mapActivity.getString(R.string.shared_string_ellipsis)); fromActions.add(mapActivity.getString(R.string.shared_string_address) + mapActivity.getString(R.string.shared_string_ellipsis));
TargetPoint start = getTargets().getPointToStart(); TargetPoint start = getTargets().getPointToStart();
if (start != null) { if (start != null) {
String oname = start.getOnlyName().length() > 0 ? start.getOnlyName() String oname = start.getOnlyName().length() > 0 ? start.getOnlyName()
@ -461,43 +485,43 @@ public class MapRouteInfoControl implements IRouteInformationListener {
fromActions.add(oname); fromActions.add(oname);
} }
final Spinner fromSpinner = ((Spinner) view.findViewById(R.id.FromSpinner)); final Spinner fromSpinner = ((Spinner) view.findViewById(R.id.FromSpinner));
ArrayAdapter<String> fromAdapter = new ArrayAdapter<String>(view.getContext(), ArrayAdapter<String> fromAdapter = new ArrayAdapter<>(view.getContext(),
android.R.layout.simple_spinner_item, android.R.layout.simple_spinner_item,
fromActions fromActions
); );
fromAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); fromAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
fromSpinner.setAdapter(fromAdapter); fromSpinner.setAdapter(fromAdapter);
if(start != null) { if (start != null) {
fromSpinner.setSelection(fromActions.size() - 1); fromSpinner.setSelection(fromActions.size() - 1);
} else { } else {
if(mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation() == null) { if (mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation() == null) {
fromSpinner.setPromptId(R.string.search_poi_location); fromSpinner.setPromptId(R.string.search_poi_location);
} }
//fromSpinner.setSelection(0); //fromSpinner.setSelection(0);
} }
return fromSpinner; return fromSpinner;
} }
private Spinner setupToSpinner(View view) { private Spinner setupToSpinner(View view) {
final Spinner toSpinner = ((Spinner) view.findViewById(R.id.ToSpinner)); final Spinner toSpinner = ((Spinner) view.findViewById(R.id.ToSpinner));
final TargetPointsHelper targets = getTargets(); final TargetPointsHelper targets = getTargets();
ArrayList<String> toActions = new ArrayList<String>(); ArrayList<String> toActions = new ArrayList<>();
if (targets.getPointToNavigate() != null) { if (targets.getPointToNavigate() != null) {
toActions.add(mapActivity.getString(R.string.route_descr_destination) + " " toActions.add(mapActivity.getString(R.string.route_descr_destination) + " "
+ getRoutePointDescription(targets.getPointToNavigate().point, + getRoutePointDescription(targets.getPointToNavigate().point,
targets.getPointToNavigate().getOnlyName())); targets.getPointToNavigate().getOnlyName()));
} else { } else {
toSpinner.setPromptId(R.string.route_descr_select_destination); toSpinner.setPromptId(R.string.route_descr_select_destination);
toActions.add(mapActivity.getString(R.string.route_descr_select_destination)); toActions.add(mapActivity.getString(R.string.route_descr_select_destination));
} }
toActions.add(mapActivity.getString(R.string.shared_string_favorite) + mapActivity.getString(R.string.shared_string_ellipsis)); toActions.add(mapActivity.getString(R.string.shared_string_favorite) + mapActivity.getString(R.string.shared_string_ellipsis));
toActions.add(mapActivity.getString(R.string.shared_string_select_on_map)); toActions.add(mapActivity.getString(R.string.shared_string_select_on_map));
toActions.add(mapActivity.getString(R.string.shared_string_address) + mapActivity.getString(R.string.shared_string_ellipsis)); toActions.add(mapActivity.getString(R.string.shared_string_address) + mapActivity.getString(R.string.shared_string_ellipsis));
ArrayAdapter<String> toAdapter = new ArrayAdapter<String>(view.getContext(), ArrayAdapter<String> toAdapter = new ArrayAdapter<>(view.getContext(),
android.R.layout.simple_spinner_item, android.R.layout.simple_spinner_item,
toActions toActions
); );
toAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); toAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
toSpinner.setAdapter(toAdapter); toSpinner.setAdapter(toAdapter);
return toSpinner; return toSpinner;
@ -510,36 +534,22 @@ public class MapRouteInfoControl implements IRouteInformationListener {
@Override @Override
public void routeWasCancelled() { public void routeWasCancelled() {
directionInfo = -1; directionInfo = -1;
// do not hide dialog (needed for use case entering Planning mode without destination) // do not hide fragment (needed for use case entering Planning mode without destination)
} }
public void showDialog() {
final View ll = mapActivity.getLayoutInflater().inflate(R.layout.plan_route_info, null);
updateInfo(ll);
dialog = MapRoutePreferencesControl.showDialog(mapControlsLayer, mapActivity, ll, new OnDismissListener() {
@Override
public void onDismiss(DialogInterface d) { public void show() {
dialog = null; MapRouteInfoMenuFragment.showInstance(mapActivity);
}
});
} }
public void hideDialog() { public void hide() {
Dialog dialog = this.dialog; WeakReference<MapRouteInfoMenuFragment> fragmentRef = findMenuFragment();
if (dialog != null) { if (fragmentRef != null) {
if(dialog instanceof MapRoutePreferencesControl.RoutePrepareDialog && fragmentRef.get().dismiss();
((MapRoutePreferencesControl.RoutePrepareDialog) dialog).getListener() != null) {
((MapRoutePreferencesControl.RoutePrepareDialog) dialog).getListener().onDismiss(dialog);
((MapRoutePreferencesControl.RoutePrepareDialog) dialog).cancelDismissListener();
}
dialog.dismiss();
this.dialog = null;
} }
} }
public void setShowDialog() { public void setShowMenu() {
showDialog = true; showMenu = true;
} }
} }

View file

@ -0,0 +1,109 @@
package net.osmand.plus.mapcontextmenu.other;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.helpers.AndroidUiHelper;
public class MapRouteInfoMenuFragment extends Fragment {
public static final String TAG = "MapRouteInfoMenuFragment";
private MapRouteInfoMenu menu;
private View mainView;
private MapActivity getMapActivity() {
return (MapActivity) getActivity();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
MapActivity mapActivity = getMapActivity();
menu = mapActivity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu();
View view = inflater.inflate(R.layout.plan_route_info, container, false);
if (menu == null) {
return view;
}
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
mainView = view.findViewById(R.id.main_view);
updateInfo();
return view;
}
@Override
public void onResume() {
super.onResume();
if (menu == null) {
dismiss();
}
}
public void updateInfo() {
menu.updateInfo(mainView);
}
public void show(MapActivity mapActivity) {
int slideInAnim = R.anim.slide_in_bottom;
int slideOutAnim = R.anim.slide_out_bottom;
mapActivity.getSupportFragmentManager().beginTransaction()
.setCustomAnimations(slideInAnim, slideOutAnim, slideInAnim, slideOutAnim)
.add(R.id.routeMenuContainer, this, TAG)
.addToBackStack(TAG)
.commitAllowingStateLoss();
}
public void dismiss() {
FragmentActivity activity = getActivity();
if (activity != null) {
try {
activity.getSupportFragmentManager().popBackStack(TAG,
FragmentManager.POP_BACK_STACK_INCLUSIVE);
} catch (Exception e) {
//
}
}
}
public static boolean showInstance(final MapActivity mapActivity) {
try {
boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
int slideInAnim;
int slideOutAnim;
if (portrait) {
slideInAnim = R.anim.slide_in_bottom;
slideOutAnim = R.anim.slide_out_bottom;
} else {
slideInAnim = R.anim.slide_in_left;
slideOutAnim = R.anim.slide_out_left;
}
MapRouteInfoMenuFragment fragment = new MapRouteInfoMenuFragment();
mapActivity.getSupportFragmentManager().beginTransaction()
.setCustomAnimations(slideInAnim, slideOutAnim, slideInAnim, slideOutAnim)
.add(R.id.routeMenuContainer, fragment, TAG)
.addToBackStack(TAG).commitAllowingStateLoss();
return true;
} catch (RuntimeException e) {
return false;
}
}
}

View file

@ -3,8 +3,11 @@ package net.osmand.plus.views;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.PointF; import android.graphics.PointF;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import net.osmand.data.FavouritePoint; import net.osmand.data.FavouritePoint;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
@ -33,6 +36,7 @@ public class FavoritesLayer extends OsmandMapLayer implements ContextMenuLayer.
private MapTextLayer textLayer; private MapTextLayer textLayer;
private Paint paintIcon; private Paint paintIcon;
private Bitmap pointSmall; private Bitmap pointSmall;
private int defaultColor;
private OsmandSettings settings; private OsmandSettings settings;
@ -60,6 +64,7 @@ public class FavoritesLayer extends OsmandMapLayer implements ContextMenuLayer.
textLayer = view.getLayerByClass(MapTextLayer.class); textLayer = view.getLayerByClass(MapTextLayer.class);
paintIcon = new Paint(); paintIcon = new Paint();
pointSmall = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_white_shield_small); pointSmall = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_white_shield_small);
defaultColor = view.getResources().getColor(R.color.color_favorite);
} }
private boolean calculateBelongs(int ex, int ey, int objx, int objy, int radius) { private boolean calculateBelongs(int ex, int ey, int objx, int objy, int radius) {
@ -101,6 +106,8 @@ public class FavoritesLayer extends OsmandMapLayer implements ContextMenuLayer.
float y = tileBox.getPixYFromLatLon(o.getLatitude(), o.getLongitude()); float y = tileBox.getPixYFromLatLon(o.getLatitude(), o.getLongitude());
if (intersects(boundIntersections, x, y, iconSize, iconSize)) { if (intersects(boundIntersections, x, y, iconSize, iconSize)) {
int col = o.getColor() == 0 || o.getColor() == Color.BLACK ? defaultColor : o.getColor();
paintIcon.setColorFilter(new PorterDuffColorFilter(col, PorterDuff.Mode.MULTIPLY));
canvas.drawBitmap(pointSmall, x - pointSmall.getWidth() / 2, y - pointSmall.getHeight() / 2, paintIcon); canvas.drawBitmap(pointSmall, x - pointSmall.getWidth() / 2, y - pointSmall.getHeight() / 2, paintIcon);
} else { } else {
fullObjects.add(o); fullObjects.add(o);

View file

@ -41,7 +41,7 @@ import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.search.SearchAddressFragment; import net.osmand.plus.activities.search.SearchAddressFragment;
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType; import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoControl; import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
import net.osmand.plus.mapcontextmenu.other.MapRoutePreferencesControl; import net.osmand.plus.mapcontextmenu.other.MapRoutePreferencesControl;
import net.osmand.plus.routing.RoutingHelper; import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.views.corenative.NativeCoreContext; import net.osmand.plus.views.corenative.NativeCoreContext;
@ -76,7 +76,7 @@ public class MapControlsLayer extends OsmandMapLayer {
private OsmandSettings settings; private OsmandSettings settings;
private MapRoutePreferencesControl optionsRouteControlDialog; private MapRoutePreferencesControl optionsRouteControlDialog;
private MapRouteInfoControl mapRouteInfoControlDialog; private MapRouteInfoMenu mapRouteInfoMenu;
private MapHudButton backToLocationControl; private MapHudButton backToLocationControl;
private MapHudButton menuControl; private MapHudButton menuControl;
private MapHudButton compassHud; private MapHudButton compassHud;
@ -103,6 +103,10 @@ public class MapControlsLayer extends OsmandMapLayer {
mapView = mapActivity.getMapView(); mapView = mapActivity.getMapView();
} }
public MapRouteInfoMenu getMapRouteInfoMenu() {
return mapRouteInfoMenu;
}
@Override @Override
public boolean drawInScreenPixels() { public boolean drawInScreenPixels() {
return true; return true;
@ -217,7 +221,7 @@ public class MapControlsLayer extends OsmandMapLayer {
} }
private void initRouteControls() { private void initRouteControls() {
mapRouteInfoControlDialog = new MapRouteInfoControl(mapActivity, this); mapRouteInfoMenu = new MapRouteInfoMenu(mapActivity, this);
optionsRouteControlDialog = new MapRoutePreferencesControl(mapActivity, this); optionsRouteControlDialog = new MapRoutePreferencesControl(mapActivity, this);
} }
@ -252,8 +256,8 @@ public class MapControlsLayer extends OsmandMapLayer {
TextView routeGoButton = (TextView) main.findViewById(R.id.map_go_route_button); TextView routeGoButton = (TextView) main.findViewById(R.id.map_go_route_button);
routeGoButton.setCompoundDrawablesWithIntrinsicBounds(app.getIconsCache().getIcon(R.drawable.map_start_navigation, R.color.color_myloc_distance), null, null, null); routeGoButton.setCompoundDrawablesWithIntrinsicBounds(app.getIconsCache().getIcon(R.drawable.map_start_navigation, R.color.color_myloc_distance), null, null, null);
routeGoButton.setText(AndroidUiHelper.isOrientationPortrait(mapActivity) ? routeGoButton.setText(/*AndroidUiHelper.isOrientationPortrait(mapActivity) ?*/
mapActivity.getString(R.string.shared_string_go) : ""); mapActivity.getString(R.string.shared_string_go) /*: ""*/);
routeGoButton.setOnClickListener(new View.OnClickListener() { routeGoButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -274,25 +278,25 @@ public class MapControlsLayer extends OsmandMapLayer {
protected void clickRouteParams() { protected void clickRouteParams() {
notifyClicked(); notifyClicked();
mapRouteInfoControlDialog.hideDialog(); if (optionsRouteControlDialog.isDialogVisible()) {
optionsRouteControlDialog.showAndHideDialog(); optionsRouteControlDialog.hideDialog();
mapRouteInfoMenu.showHideMenu();
} else {
mapRouteInfoMenu.hide();
optionsRouteControlDialog.showAndHideDialog();
}
} }
protected void clickRouteWaypoints() { protected void clickRouteWaypoints() {
if (getTargets().checkPointToNavigateShort()) { if (getTargets().checkPointToNavigateShort()) {
notifyClicked(); notifyClicked();
if (optionsRouteControlDialog.isDialogVisible()) {
optionsRouteControlDialog.hideDialog();
} else if (mapRouteInfoControlDialog.isDialogVisible()) {
mapRouteInfoControlDialog.hideDialog();
}
mapActivity.getMapActions().openIntermediatePointsDialog(); mapActivity.getMapActions().openIntermediatePointsDialog();
} }
} }
protected void clickRouteCancel() { protected void clickRouteCancel() {
notifyClicked(); notifyClicked();
mapRouteInfoControlDialog.hideDialog(); mapRouteInfoMenu.hide();
optionsRouteControlDialog.hideDialog(); optionsRouteControlDialog.hideDialog();
if (mapActivity.getRoutingHelper().isFollowingMode()) { if (mapActivity.getRoutingHelper().isFollowingMode()) {
mapActivity.getMapActions().stopNavigationActionConfirm(); mapActivity.getMapActions().stopNavigationActionConfirm();
@ -303,7 +307,7 @@ public class MapControlsLayer extends OsmandMapLayer {
protected void clickRouteGo() { protected void clickRouteGo() {
notifyClicked(); notifyClicked();
mapRouteInfoControlDialog.hideDialog(); mapRouteInfoMenu.hide();
optionsRouteControlDialog.hideDialog(); optionsRouteControlDialog.hideDialog();
// RoutingHelper routingHelper = mapActivity.getMyApplication().getRoutingHelper(); // RoutingHelper routingHelper = mapActivity.getMyApplication().getRoutingHelper();
// if (!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) { // if (!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) {
@ -315,11 +319,11 @@ public class MapControlsLayer extends OsmandMapLayer {
} }
public void showRouteInfoControlDialog() { public void showRouteInfoControlDialog() {
mapRouteInfoControlDialog.showHideDialog(); mapRouteInfoMenu.showHideMenu();
} }
public void showDialog() { public void showDialog() {
mapRouteInfoControlDialog.setShowDialog(); mapRouteInfoMenu.setShowMenu();
} }
private void initControls() { private void initControls() {
@ -462,7 +466,7 @@ public class MapControlsLayer extends OsmandMapLayer {
switchToRouteFollowingLayout(); switchToRouteFollowingLayout();
} else { } else {
if (!app.getTargetPointsHelper().checkPointToNavigateShort()) { if (!app.getTargetPointsHelper().checkPointToNavigateShort()) {
mapRouteInfoControlDialog.showDialog(); mapRouteInfoMenu.show();
} else { } else {
touchEvent = 0; touchEvent = 0;
mapActivity.getMapViewTrackingUtilities().backToLocationImpl(); mapActivity.getMapViewTrackingUtilities().backToLocationImpl();
@ -531,7 +535,7 @@ public class MapControlsLayer extends OsmandMapLayer {
int textColor = isNight ? mapActivity.getResources().getColor(R.color.widgettext_night) : Color.BLACK; int textColor = isNight ? mapActivity.getResources().getColor(R.color.widgettext_night) : Color.BLACK;
if (shadowColor != shadw) { if (shadowColor != shadw) {
shadowColor = shadw; shadowColor = shadw;
// TODO // TODOnightMode
// updatextColor(textColor, shadw, rulerControl, zoomControls, mapMenuControls); // updatextColor(textColor, shadw, rulerControl, zoomControls, mapMenuControls);
} }
boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity); boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
@ -544,7 +548,7 @@ public class MapControlsLayer extends OsmandMapLayer {
routePlanningMode = true; routePlanningMode = true;
} }
boolean routeFollowingMode = !routePlanningMode && rh.isFollowingMode(); boolean routeFollowingMode = !routePlanningMode && rh.isFollowingMode();
boolean dialogOpened = optionsRouteControlDialog.isDialogVisible() || mapRouteInfoControlDialog.isDialogVisible(); boolean dialogOpened = optionsRouteControlDialog.isDialogVisible() || mapRouteInfoMenu.isVisible();
boolean showRouteCalculationControls = routePlanningMode || boolean showRouteCalculationControls = routePlanningMode ||
((System.currentTimeMillis() - touchEvent < TIMEOUT_TO_SHOW_BUTTONS) && routeFollowingMode); ((System.currentTimeMillis() - touchEvent < TIMEOUT_TO_SHOW_BUTTONS) && routeFollowingMode);
updateMyLocation(rh, dialogOpened); updateMyLocation(rh, dialogOpened);
@ -581,7 +585,7 @@ public class MapControlsLayer extends OsmandMapLayer {
} }
} }
mapRouteInfoControlDialog.setVisible(showRouteCalculationControls); mapRouteInfoMenu.setVisible(showRouteCalculationControls);
if (showRouteCalculationControls) { if (showRouteCalculationControls) {
if (!mapActivity.getRoutingHelper().isFollowingMode() if (!mapActivity.getRoutingHelper().isFollowingMode()
&& !mapActivity.getRoutingHelper().isPauseNavigation()) { && !mapActivity.getRoutingHelper().isPauseNavigation()) {
@ -634,7 +638,7 @@ public class MapControlsLayer extends OsmandMapLayer {
public boolean onSingleTap(PointF point, RotatedTileBox tileBox) { public boolean onSingleTap(PointF point, RotatedTileBox tileBox) {
if (mapRouteInfoControlDialog.onSingleTap(point, tileBox)) { if (mapRouteInfoMenu.onSingleTap(point, tileBox)) {
return true; return true;
} }
stopCounter(); stopCounter();
@ -933,14 +937,14 @@ public class MapControlsLayer extends OsmandMapLayer {
public void onActivityResult(int requestCode, int resultCode, Intent data) { public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_ADDRESS_SELECT && resultCode == SearchAddressFragment.SELECT_ADDRESS_POINT_RESULT_OK) { if (requestCode == REQUEST_ADDRESS_SELECT && resultCode == SearchAddressFragment.SELECT_ADDRESS_POINT_RESULT_OK) {
String name = data.getStringExtra(SearchAddressFragment.SELECT_ADDRESS_POINT_INTENT_KEY); String name = data.getStringExtra(SearchAddressFragment.SELECT_ADDRESS_POINT_INTENT_KEY);
boolean target = data.getBooleanExtra(MapRouteInfoControl.TARGET_SELECT, true); boolean target = data.getBooleanExtra(MapRouteInfoMenu.TARGET_SELECT, true);
LatLon latLon = new LatLon( LatLon latLon = new LatLon(
data.getDoubleExtra(SearchAddressFragment.SELECT_ADDRESS_POINT_LAT, 0), data.getDoubleExtra(SearchAddressFragment.SELECT_ADDRESS_POINT_LAT, 0),
data.getDoubleExtra(SearchAddressFragment.SELECT_ADDRESS_POINT_LON, 0)); data.getDoubleExtra(SearchAddressFragment.SELECT_ADDRESS_POINT_LON, 0));
if (name != null) { if (name != null) {
mapRouteInfoControlDialog.selectAddress(name, latLon, target); mapRouteInfoMenu.selectAddress(name, latLon, target);
} else { } else {
mapRouteInfoControlDialog.selectAddress("", latLon, target); mapRouteInfoMenu.selectAddress("", latLon, target);
} }
} }
} }

View file

@ -33,7 +33,7 @@ import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
import net.osmand.plus.routing.RouteDirectionInfo; import net.osmand.plus.routing.RouteDirectionInfo;
import net.osmand.plus.routing.RoutingHelper; import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.views.OsmandMapLayer.DrawSettings; import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoControl; import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
import net.osmand.plus.views.mapwidgets.NextTurnInfoWidget.TurnDrawable; import net.osmand.plus.views.mapwidgets.NextTurnInfoWidget.TurnDrawable;
import net.osmand.router.TurnType; import net.osmand.router.TurnType;
@ -237,8 +237,8 @@ public class MapInfoWidgetsFactory {
} }
} }
} else { } else {
int di = MapRouteInfoControl.getDirectionInfo(); int di = MapRouteInfoMenu.getDirectionInfo();
if (di >= 0 && MapRouteInfoControl.isControlVisible() && if (di >= 0 && MapRouteInfoMenu.isControlVisible() &&
di < routingHelper.getRouteDirections().size()) { di < routingHelper.getRouteDirections().size()) {
showNextTurn = true; showNextTurn = true;
RouteDirectionInfo next = routingHelper.getRouteDirections().get(di); RouteDirectionInfo next = routingHelper.getRouteDirections().get(di);

View file

@ -30,7 +30,7 @@ import net.osmand.plus.views.AnimateDraggingMapThread;
import net.osmand.plus.views.OsmandMapLayer.DrawSettings; import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
import net.osmand.plus.views.OsmandMapTileView; import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.plus.views.TurnPathHelper; import net.osmand.plus.views.TurnPathHelper;
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoControl; import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
import net.osmand.router.RouteResultPreparation; import net.osmand.router.RouteResultPreparation;
import net.osmand.router.TurnType; import net.osmand.router.TurnType;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
@ -583,8 +583,8 @@ public class RouteInfoWidgetsFactory {
dist = r.distanceTo; dist = r.distanceTo;
} }
} else { } else {
int di = MapRouteInfoControl.getDirectionInfo(); int di = MapRouteInfoMenu.getDirectionInfo();
if (di >= 0 && MapRouteInfoControl.isControlVisible() if (di >= 0 && MapRouteInfoMenu.isControlVisible()
&& di < rh.getRouteDirections().size()) { && di < rh.getRouteDirections().size()) {
RouteDirectionInfo next = rh.getRouteDirections().get(di); RouteDirectionInfo next = rh.getRouteDirections().get(di);
if (next != null) { if (next != null) {