Nav menu in progress

This commit is contained in:
Alexey Kulish 2015-12-08 21:50:08 +03:00
parent 010a6cbbb5
commit aba7ce5cd8
20 changed files with 513 additions and 296 deletions

View file

@ -80,13 +80,6 @@
android:visibility="gone"
layout="@layout/recording_note_fragment" />
<include
android:layout_width="@dimen/map_route_planning_land_width"
android:layout_height="@dimen/map_route_buttons_height"
android:layout_gravity="bottom|left"
android:visibility="gone"
layout="@layout/map_route_prepare_bottom" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View file

@ -0,0 +1,242 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/plan_route_info"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="?attr/left_menu_view_bg"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/ModesLayout"
android:layout_width="fill_parent"
android:layout_height="@dimen/list_item_height"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<View
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:visibility="gone"
android:orientation="horizontal">
<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
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
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"
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
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>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"
android:focusable="false" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<View
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" />
</LinearLayout>

View file

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="?attr/left_menu_view_bg"
android:orientation="vertical" >
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<View
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">
<ImageView
android:id="@+id/avoid_roads"
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/ic_action_road_works_dark"/>
<ImageView
android:id="@+id/mute"
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/ic_action_volume_off"/>
</LinearLayout>
</LinearLayout>
</FrameLayout>
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1">
</ListView>
<View
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" />
</LinearLayout>

View file

@ -195,7 +195,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="@layout/map_route_prepare_bottom"/>
<include layout="@layout/recording_note_fragment"/>
<LinearLayout
android:id="@+id/map_context_menu_layout"

View file

@ -6,45 +6,51 @@
android:layout_height="@dimen/map_route_buttons_height"
android:layout_gravity="bottom" >
<ImageButton
android:id="@+id/map_dashboard_route_button"
android:layout_width="@dimen/map_route_buttons_width"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:background="?attr/btn_flat_bg"
android:visibility="gone"
android:src="@drawable/ic_action_test_light" />
<ImageButton
android:id="@+id/map_cancel_route_button"
android:layout_width="@dimen/map_route_buttons_width"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:background="?attr/btn_flat_bg"
android:background="?attr/dashboard_button"
android:src="@drawable/ic_action_test_light" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="?attr/dashboard_divider"/>
<ImageButton
android:id="@+id/map_waypoints_route_button"
android:layout_width="@dimen/map_route_buttons_width"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:background="?attr/btn_flat_bg"
android:background="?attr/dashboard_button"
android:src="@drawable/ic_action_test_light" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="?attr/dashboard_divider"/>
<ImageButton
android:id="@+id/map_options_route_button"
android:layout_width="@dimen/map_route_buttons_width"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:background="?attr/btn_flat_bg"
android:background="?attr/dashboard_button"
android:src="@drawable/ic_action_test_light" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="?attr/dashboard_divider"/>
<TextView
android:id="@+id/map_go_route_button"
android:layout_height="match_parent"
android:layout_width="fill_parent"
android:layout_gravity="center_vertical"
android:background="?attr/btn_flat_bg"
android:background="?attr/dashboard_button"
android:drawableLeft="@drawable/ic_action_test_light"
android:drawablePadding="4dp"
android:gravity="center_vertical"

View file

@ -2,8 +2,7 @@
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginLeft="5dp">
android:layout_gravity="left">
<LinearLayout
android:id="@+id/app_modes_content"

View file

@ -19,9 +19,6 @@
android:layout_gravity="bottom"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:layout_marginBottom="1dp"
android:background="@color/osmand_orange"
android:focusable="false" />

View file

@ -3,51 +3,58 @@
android:id="@+id/plan_route_info"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="?attr/bg_color"
android:background="?attr/bottom_menu_view_bg"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/ModesLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
android:layout_height="@dimen/list_item_height"
android:orientation="vertical">
<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" >
<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>
<View
<FrameLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/listDivider"
android:focusable="false" />
android:layout_height="wrap_content">
<View
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:visibility="gone"
android:orientation="horizontal">
<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
@ -89,7 +96,7 @@
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/listDivider"
android:background="?attr/dashboard_divider"
android:focusable="false" />
</LinearLayout>
@ -125,7 +132,7 @@
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/listDivider"
android:background="?attr/dashboard_divider"
android:focusable="false" />
</LinearLayout>
@ -158,7 +165,7 @@
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/listDivider"
android:background="?attr/dashboard_divider"
android:focusable="false" />
</LinearLayout>
@ -212,15 +219,18 @@
android:src="@drawable/ic_next" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/listDivider"
android:focusable="false" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<View
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" />
</LinearLayout>

View file

@ -2,61 +2,59 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="?attr/bg_color"
android:background="?attr/bottom_menu_view_bg"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_gravity="bottom"
android:background="?attr/dashboard_divider"
android:focusable="false"/>
<LinearLayout
android:id="@+id/app_modes"
android:layout_width="0dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:gravity="left"
android:orientation="horizontal" />
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" >
<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"/>
<ImageView
android:id="@+id/avoid_roads"
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/ic_action_road_works_dark" />
<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">
<ImageView
android:id="@+id/mute"
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/ic_action_volume_off" />
<ImageView
android:id="@+id/avoid_roads"
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/ic_action_road_works_dark"/>
<ImageView
android:id="@+id/mute"
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/ic_action_volume_off"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/listDivider"
android:focusable="false" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/listDivider"
android:focusable="false" />
</FrameLayout>
<ListView
android:id="@android:id/list"
@ -65,7 +63,13 @@
android:layout_weight="1">
</ListView>
<View
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" />
</LinearLayout>

View file

@ -5,7 +5,6 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/map_route_preparation_layout"
android:layout_gravity="bottom"
android:background="?attr/bottom_menu_view_bg"
android:clickable="true"

View file

@ -33,8 +33,9 @@
<dimen name="map_button_spacing_land">9dp</dimen>
<dimen name="map_button_margin">9dp</dimen>
<dimen name="map_routing_progress_width">150dp</dimen>
<dimen name="map_mode_button_width">48dp</dimen>
<dimen name="map_button_inset_shadow">3dp</dimen>
<dimen name="map_button_inset">3dp</dimen>
<dimen name="map_button_rect_rad">4dp</dimen>

View file

@ -54,7 +54,8 @@
<dimen name="map_route_buttons_width">60dp</dimen>
<dimen name="map_route_buttons_height">54dp</dimen>
<dimen name="map_route_buttons_height_land">48dp</dimen>
<dimen name="map_mode_button_width">48dp</dimen>
<dimen name="map_address_height">40dp</dimen>
<dimen name="map_button_size">52dp</dimen>
<dimen name="map_small_button_size">44dp</dimen>

View file

@ -22,7 +22,7 @@ import net.osmand.plus.R;
import net.osmand.plus.routing.RouteDirectionInfo;
import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.views.TurnPathHelper;
import net.osmand.plus.views.controls.MapRouteInfoControl;
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoControl;
import net.osmand.util.Algorithms;
import android.content.Intent;
import android.net.Uri;

View file

@ -103,13 +103,14 @@ public class AppModeDialog {
static private View createToggle(LayoutInflater layoutInflater, OsmandApplication ctx, LinearLayout layout, ApplicationMode mode){
int metrics = (int) ctx.getResources().getDimension(R.dimen.list_item_height);
View tb = layoutInflater.inflate(R.layout.mode_view, null);
int metricsX = (int) ctx.getResources().getDimension(R.dimen.map_mode_button_width);
int metricsY = (int) ctx.getResources().getDimension(R.dimen.list_item_height);
View tb = layoutInflater.inflate(R.layout.mode_view, null);
tb.findViewById(R.id.app_mode_icon).setContentDescription(mode.toHumanString(ctx));
ImageView iv = (ImageView) tb.findViewById(R.id.app_mode_icon);
iv.setImageDrawable(ctx.getIconsCache().getIcon(mode.getSmallIconDark(), R.color.osmand_orange));
// tb.setCompoundDrawablesWithIntrinsicBounds(null, ctx.getIconsCache().getIcon(mode.getIconId(), R.color.app_mode_icon_color), null, null);
LayoutParams lp = new LinearLayout.LayoutParams(metrics, metrics);
LayoutParams lp = new LinearLayout.LayoutParams(metricsX, metricsY);
// lp.setMargins(left, 0, 0, 0);
layout.addView(tb, lp);
return tb;

View file

@ -259,6 +259,10 @@ public class MapContextMenu extends MenuTitleController {
}
}
public void showMinimized(LatLon latLon, PointDescription pointDescription, Object object) {
init(latLon, pointDescription, object);
}
public void close() {
if (active) {
active = false;

View file

@ -1,4 +1,4 @@
package net.osmand.plus.views.controls;
package net.osmand.plus.mapcontextmenu.other;
import android.app.Dialog;
import android.content.DialogInterface;
@ -42,7 +42,6 @@ import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.routing.RoutingHelper.IRouteInformationListener;
import net.osmand.plus.views.MapControlsLayer;
import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.plus.views.controls.MapRoutePreferencesControl.RoutePrepareDialog;
import java.util.ArrayList;
import java.util.HashSet;
@ -82,7 +81,7 @@ public class MapRouteInfoControl implements IRouteInformationListener {
} else {
getTargets().setStartPoint(latlon, true, null);
}
contextMenu.show(latlon, null, null);
contextMenu.showMinimized(latlon, null, null);
showDialog();
return true;
}
@ -120,7 +119,6 @@ public class MapRouteInfoControl implements IRouteInformationListener {
}
private void updateInfo(final View main) {
updateWptBtn(main);
updateViaView(main);
updateFromSpinner(main);
updateToSpinner(main);
@ -150,22 +148,6 @@ public class MapRouteInfoControl implements IRouteInformationListener {
}
}
private void updateWptBtn(final View parentView) {
ImageView wptBtn = (ImageView) parentView.findViewById(R.id.waypoints);
wptBtn.setImageDrawable(mapActivity.getMyApplication().getIconsCache()
.getContentIcon(R.drawable.map_action_waypoints));
wptBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (getTargets().checkPointToNavigateShort()) {
hideDialog();
mapActivity.getMapActions().openIntermediatePointsDialog();
}
}
});
}
private void updateApplicationModes(final View parentView) {
final OsmandSettings settings = mapActivity.getMyApplication().getSettings();
ApplicationMode am = settings.APPLICATION_MODE.get();
@ -339,9 +321,7 @@ public class MapRouteInfoControl implements IRouteInformationListener {
if (routingHelper.getRouteDirections().size() > directionInfo) {
RouteDirectionInfo info = routingHelper.getRouteDirections().get(directionInfo);
net.osmand.Location l = routingHelper.getLocationFromRouteDirection(info);
contextMenu.show(new LatLon(l.getLatitude(), l.getLongitude()), null, info);
// contextMenuLayer.setLocation(new LatLon(l.getLatitude(), l.getLongitude()),
// info.getDescriptionRoute(ctx));
contextMenu.showMinimized(new LatLon(l.getLatitude(), l.getLongitude()), null, info);
mapView.getAnimatedDraggingThread().startMoving(l.getLatitude(), l.getLongitude(),
mapView.getZoom(), true);
}
@ -364,8 +344,7 @@ public class MapRouteInfoControl implements IRouteInformationListener {
directionInfo++;
RouteDirectionInfo info = routingHelper.getRouteDirections().get(directionInfo);
net.osmand.Location l = routingHelper.getLocationFromRouteDirection(info);
contextMenu.show(new LatLon(l.getLatitude(), l.getLongitude()), null, info);
// contextMenuLayer.setLocation(new LatLon(l.getLatitude(), l.getLongitude()), info.getDescriptionRoute(ctx));
contextMenu.showMinimized(new LatLon(l.getLatitude(), l.getLongitude()), null, info);
mapView.getAnimatedDraggingThread().startMoving(l.getLatitude(), l.getLongitude(), mapView.getZoom(), true);
}
mapView.refreshMap();
@ -550,10 +529,10 @@ public class MapRouteInfoControl implements IRouteInformationListener {
public void hideDialog() {
Dialog dialog = this.dialog;
if (dialog != null) {
if(dialog instanceof RoutePrepareDialog &&
((RoutePrepareDialog) dialog).getListener() != null) {
((RoutePrepareDialog) dialog).getListener().onDismiss(dialog);
((RoutePrepareDialog) dialog).cancelDismissListener();
if(dialog instanceof MapRoutePreferencesControl.RoutePrepareDialog &&
((MapRoutePreferencesControl.RoutePrepareDialog) dialog).getListener() != null) {
((MapRoutePreferencesControl.RoutePrepareDialog) dialog).getListener().onDismiss(dialog);
((MapRoutePreferencesControl.RoutePrepareDialog) dialog).cancelDismissListener();
}
dialog.dismiss();
this.dialog = null;

View file

@ -1,4 +1,4 @@
package net.osmand.plus.views.controls;
package net.osmand.plus.mapcontextmenu.other;
import java.io.File;
import java.util.ArrayList;
@ -36,6 +36,8 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnDismissListener;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.support.v7.widget.PopupMenu;
import android.view.Gravity;
import android.view.MenuItem;
@ -150,15 +152,15 @@ public class MapRoutePreferencesControl {
public OnDismissListener getListener() {
return listener;
}
@Override
public void setOnDismissListener(OnDismissListener l) {
this.listener = l;
super.setOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
if(listener != null) {
if (listener != null) {
listener.onDismiss(dialog);
}
}
@ -188,13 +190,14 @@ public class MapRoutePreferencesControl {
lp.width = (int) mapActivity.getResources().getDimension(R.dimen.map_route_planning_land_width);
lp.gravity = Gravity.LEFT;
}
dialog.getContext().setTheme(R.style.Dialog_Fullscreen);
//dialog.getContext().setTheme(R.style.Dialog_Fullscreen);
dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(ll, new LayoutParams(WindowManager.LayoutParams.MATCH_PARENT,
portrait ? WindowManager.LayoutParams.WRAP_CONTENT : WindowManager.LayoutParams.MATCH_PARENT));
dialog.setCanceledOnTouchOutside(true);
dialog.getWindow().setAttributes(lp);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
if (maxHeight != -1) {
ll.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
boolean wrap = true;

View file

@ -26,7 +26,6 @@ import android.widget.TextView;
import net.londatiga.android.ActionItem;
import net.londatiga.android.QuickAction;
import net.osmand.PlatformUtil;
import net.osmand.core.android.MapRendererContext;
import net.osmand.data.LatLon;
import net.osmand.data.RotatedTileBox;
@ -37,24 +36,22 @@ import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.OsmandSettings.CommonPreference;
import net.osmand.plus.R;
import net.osmand.plus.TargetPointsHelper;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.search.SearchAddressFragment;
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoControl;
import net.osmand.plus.mapcontextmenu.other.MapRoutePreferencesControl;
import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.views.controls.MapRouteInfoControl;
import net.osmand.plus.views.controls.MapRoutePreferencesControl;
import net.osmand.plus.views.corenative.NativeCoreContext;
import org.apache.commons.logging.Log;
import java.util.ArrayList;
import java.util.List;
import gnu.trove.list.array.TIntArrayList;
public class MapControlsLayer extends OsmandMapLayer {
private static final Log LOG = PlatformUtil.getLog(MapControlsLayer.class);
private static final int TIMEOUT_TO_SHOW_BUTTONS = 7000;
public static final int REQUEST_ADDRESS_SELECT = 2;
@ -67,7 +64,7 @@ public class MapControlsLayer extends OsmandMapLayer {
return mc;
}
private List<MapHudButton> controls = new ArrayList<MapControlsLayer.MapHudButton>();
private List<MapHudButton> controls = new ArrayList<>();
private final MapActivity mapActivity;
private int shadowColor = -1;
// private RulerControl rulerControl;
@ -80,11 +77,8 @@ public class MapControlsLayer extends OsmandMapLayer {
private MapRoutePreferencesControl optionsRouteControlDialog;
private MapRouteInfoControl mapRouteInfoControlDialog;
private View routePreparationLayout;
private MapHudButton backToLocationControl;
private MapHudButton menuControl;
private MapHudButton optionsRouteControl;
private MapHudButton routeGoControl;
private MapHudButton compassHud;
private float cachedRotate = 0;
private static long startCounter;
@ -100,7 +94,6 @@ public class MapControlsLayer extends OsmandMapLayer {
private MapHudButton mapZoomOut;
private MapHudButton mapZoomIn;
private MapHudButton layersHud;
private MapHudButton mapDashControl;
private long lastZoom;
public MapControlsLayer(MapActivity activity) {
@ -196,7 +189,7 @@ public class MapControlsLayer extends OsmandMapLayer {
private void initTopControls() {
View configureMap = mapActivity.findViewById(R.id.map_layers_button);
layersHud = createHudButton((ImageView) configureMap, R.drawable.map_layer_dark)
layersHud = createHudButton(configureMap, R.drawable.map_layer_dark)
.setIconsId(R.drawable.map_layer_dark, R.drawable.map_layer_night)
.setBg(R.drawable.btn_inset_circle_trans, R.drawable.btn_inset_circle_night);
controls.add(layersHud);
@ -209,7 +202,7 @@ public class MapControlsLayer extends OsmandMapLayer {
});
View compass = mapActivity.findViewById(R.id.map_compass_button);
compassHud = createHudButton((ImageView) compass, R.drawable.map_compass).setIconColorId(0).
compassHud = createHudButton(compass, R.drawable.map_compass).setIconColorId(0).
setBg(R.drawable.btn_inset_circle_trans, R.drawable.btn_inset_circle_night);
compassHud.compass = true;
controls.add(compassHud);
@ -224,93 +217,11 @@ public class MapControlsLayer extends OsmandMapLayer {
}
private void initRouteControls() {
routePreparationLayout = mapActivity.findViewById(R.id.map_route_preparation_layout);
View dashRouteButton = mapActivity.findViewById(R.id.map_dashboard_route_button);
final boolean dash = settings.SHOW_DASHBOARD_ON_MAP_SCREEN.get();
mapDashControl = createHudButton((ImageView) dashRouteButton,
dash ? R.drawable.map_dashboard : R.drawable.map_drawer).setBg(
R.drawable.btn_flat, R.drawable.btn_flat_night);
controls.add(mapDashControl);
dashRouteButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (dash) {
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.DASHBOARD);
} else {
mapActivity.openDrawer();
}
}
});
View cancelRouteButton = mapActivity.findViewById(R.id.map_cancel_route_button);
controls.add(createHudButton((ImageView) cancelRouteButton, R.drawable.map_action_cancel).setBg(
R.drawable.btn_flat, R.drawable.btn_flat_night));
cancelRouteButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
clickRouteCancel();
}
});
mapRouteInfoControlDialog = new MapRouteInfoControl(mapActivity, this);
View waypointsButton = mapActivity.findViewById(R.id.map_waypoints_route_button);
controls.add(createHudButton((ImageView) waypointsButton, R.drawable.map_action_waypoints).setBg(
R.drawable.btn_flat, R.drawable.btn_flat_night));
waypointsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
clickRouteWaypoints();
}
});
View optionsRouteButton = mapActivity.findViewById(R.id.map_options_route_button);
optionsRouteControl = createHudButton((ImageView) optionsRouteButton, R.drawable.map_action_settings
).setBg(R.drawable.btn_flat, R.drawable.btn_flat_night);
optionsRouteControlDialog = new MapRoutePreferencesControl(mapActivity, this);
controls.add(optionsRouteControl);
optionsRouteButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
clickRouteParams();
}
});
TextView routeGoButton = (TextView) mapActivity.findViewById(R.id.map_go_route_button);
routeGoControl = createHudButton(routeGoButton,
R.drawable.map_start_navigation).setIconColorId(R.color.color_myloc_distance).setBg(
R.drawable.btn_flat, R.drawable.btn_flat_night);
controls.add(routeGoControl);
routeGoButton.setText(mapActivity.getString(R.string.shared_string_go));
routeGoButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
clickRouteGo();
}
});
}
public void updateRouteButtons(View main, boolean routeInfo) {
ImageView dashButton = (ImageView) main.findViewById(R.id.map_dashboard_route_button);
dashButton.setImageDrawable(app.getIconsCache().getContentIcon(R.drawable.map_dashboard));
dashButton.setVisibility(AndroidUiHelper.isOrientationPortrait(mapActivity) ?
View.GONE : View.VISIBLE);
dashButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mapRouteInfoControlDialog.hideDialog();
optionsRouteControlDialog.hideDialog();
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.DASHBOARD);
}
});
ImageView cancelRouteButton = (ImageView) main.findViewById(R.id.map_cancel_route_button);
cancelRouteButton.setImageDrawable(app.getIconsCache().getContentIcon(R.drawable.map_action_cancel));
cancelRouteButton.setOnClickListener(new View.OnClickListener() {
@ -321,8 +232,7 @@ public class MapControlsLayer extends OsmandMapLayer {
});
ImageView waypointsButton = (ImageView) main.findViewById(R.id.map_waypoints_route_button);
waypointsButton.setImageDrawable(routeInfo ? app.getIconsCache().getIcon(R.drawable.map_action_waypoints,
R.color.osmand_orange) : app.getIconsCache().getContentIcon(R.drawable.map_action_waypoints));
waypointsButton.setImageDrawable(app.getIconsCache().getContentIcon(R.drawable.map_action_waypoints));
waypointsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -341,7 +251,7 @@ public class MapControlsLayer extends OsmandMapLayer {
});
TextView routeGoButton = (TextView) main.findViewById(R.id.map_go_route_button);
routeGoButton.setCompoundDrawables(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) ?
mapActivity.getString(R.string.shared_string_go) : "");
routeGoButton.setOnClickListener(new View.OnClickListener() {
@ -358,6 +268,10 @@ public class MapControlsLayer extends OsmandMapLayer {
}
}
private TargetPointsHelper getTargets() {
return mapActivity.getMyApplication().getTargetPointsHelper();
}
protected void clickRouteParams() {
notifyClicked();
mapRouteInfoControlDialog.hideDialog();
@ -365,9 +279,15 @@ public class MapControlsLayer extends OsmandMapLayer {
}
protected void clickRouteWaypoints() {
notifyClicked();
optionsRouteControlDialog.hideDialog();
mapRouteInfoControlDialog.showHideDialog();
if (getTargets().checkPointToNavigateShort()) {
notifyClicked();
if (optionsRouteControlDialog.isDialogVisible()) {
optionsRouteControlDialog.hideDialog();
} else if (mapRouteInfoControlDialog.isDialogVisible()) {
mapRouteInfoControlDialog.hideDialog();
}
mapActivity.getMapActions().openIntermediatePointsDialog();
}
}
protected void clickRouteCancel() {
@ -404,7 +324,7 @@ public class MapControlsLayer extends OsmandMapLayer {
private void initControls() {
View backToLocation = mapActivity.findViewById(R.id.map_my_location_button);
backToLocationControl = createHudButton((ImageView) backToLocation, R.drawable.map_my_location)
backToLocationControl = createHudButton(backToLocation, R.drawable.map_my_location)
.setBg(R.drawable.btn_circle_blue);
controls.add(backToLocationControl);
@ -425,7 +345,7 @@ public class MapControlsLayer extends OsmandMapLayer {
View backToMenuButton = mapActivity.findViewById(R.id.map_menu_button);
final boolean dash = settings.SHOW_DASHBOARD_ON_MAP_SCREEN.get();
menuControl = createHudButton((ImageView) backToMenuButton,
menuControl = createHudButton(backToMenuButton,
!dash ? R.drawable.map_drawer : R.drawable.map_dashboard).setBg(
R.drawable.btn_round, R.drawable.btn_round_night);
controls.add(menuControl);
@ -478,7 +398,7 @@ public class MapControlsLayer extends OsmandMapLayer {
if (!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) {
mapActivity.getMapActions().enterRoutePlanningMode(null, null);
} else {
switchToRoutePlanningLayout();
showRouteInfoControlDialog();
}
}
@ -503,7 +423,7 @@ public class MapControlsLayer extends OsmandMapLayer {
private void initZooms() {
final OsmandMapTileView view = mapActivity.getMapView();
View zoomInButton = mapActivity.findViewById(R.id.map_zoom_in_button);
mapZoomIn = createHudButton((ImageView) zoomInButton, R.drawable.map_zoom_in).
mapZoomIn = createHudButton(zoomInButton, R.drawable.map_zoom_in).
setIconsId(R.drawable.map_zoom_in, R.drawable.map_zoom_in_night).setRoundTransparent();
controls.add(mapZoomIn);
zoomInButton.setOnClickListener(new View.OnClickListener() {
@ -521,7 +441,7 @@ public class MapControlsLayer extends OsmandMapLayer {
final View.OnLongClickListener listener = MapControlsLayer.getOnClickMagnifierListener(view);
zoomInButton.setOnLongClickListener(listener);
View zoomOutButton = mapActivity.findViewById(R.id.map_zoom_out_button);
mapZoomOut = createHudButton((ImageView) zoomOutButton, R.drawable.map_zoom_out).
mapZoomOut = createHudButton(zoomOutButton, R.drawable.map_zoom_out).
setIconsId(R.drawable.map_zoom_out, R.drawable.map_zoom_out_night).setRoundTransparent();
controls.add(mapZoomOut);
zoomOutButton.setOnClickListener(new View.OnClickListener() {
@ -564,7 +484,7 @@ public class MapControlsLayer extends OsmandMapLayer {
@Deprecated
public void startCounter() {
OsmandSettings settings = mapActivity.getMyApplication().getSettings();
//OsmandSettings settings = mapActivity.getMyApplication().getSettings();
int del = 0; // settings.DELAY_TO_START_NAVIGATION.get();
if (del <= 0) {
return;
@ -627,15 +547,13 @@ public class MapControlsLayer extends OsmandMapLayer {
boolean dialogOpened = optionsRouteControlDialog.isDialogVisible() || mapRouteInfoControlDialog.isDialogVisible();
boolean showRouteCalculationControls = routePlanningMode ||
((System.currentTimeMillis() - touchEvent < TIMEOUT_TO_SHOW_BUTTONS) && routeFollowingMode);
boolean showMenuButton = (showRouteCalculationControls && portrait) ||
(!routeFollowingMode && !routePlanningMode);
updateMyLocation(rh, dialogOpened);
// routePlanningBtn.setIconResId(routeFollowingMode ? R.drawable.ic_action_gabout_dark : R.drawable.map_directions );
// routePlanningBtn.updateVisibility(showButtons && !routePlanningMode);
routePlanningBtn.setIconResId(R.drawable.map_directions);
routePlanningBtn.updateVisibility(!routeFollowingMode && !routePlanningMode);
routePlanningBtn.updateVisibility(!dialogOpened);
menuControl.updateVisibility(showMenuButton && !dialogOpened);
menuControl.updateVisibility(!dialogOpened);
mapZoomIn.updateVisibility(!dialogOpened);
mapZoomOut.updateVisibility(!dialogOpened);
compassHud.updateVisibility(!dialogOpened);
@ -662,35 +580,21 @@ public class MapControlsLayer extends OsmandMapLayer {
zoomText.setText(getZoomLevel(tileBox));
}
}
int vis = showRouteCalculationControls ? View.VISIBLE : View.GONE;
if (showRouteCalculationControls) {
((TextView) routeGoControl.iv).setTextColor(textColor);
String text = portrait ? mapActivity.getString(R.string.shared_string_go) : "";
if (startCounter > 0) {
int get = (int) ((startCounter - System.currentTimeMillis()) / 1000l);
text += " (" + get + ")";
}
((TextView) routeGoControl.iv).setText(text);
}
if (routePreparationLayout.getVisibility() != vis) {
routePreparationLayout.setVisibility(vis);
mapDashControl.updateVisibility(showRouteCalculationControls && !portrait);
mapRouteInfoControlDialog.setVisible(showRouteCalculationControls);
if (showRouteCalculationControls) {
if (!mapActivity.getRoutingHelper().isFollowingMode()
&& !mapActivity.getRoutingHelper().isPauseNavigation()) {
startCounter();
}
} else {
stopCounter();
mapRouteInfoControlDialog.setVisible(showRouteCalculationControls);
if (showRouteCalculationControls) {
if (!mapActivity.getRoutingHelper().isFollowingMode()
&& !mapActivity.getRoutingHelper().isPauseNavigation()) {
startCounter();
}
} else {
stopCounter();
}
updateCompass(isNight);
for (MapHudButton mc : controls) {
mc.update(mapActivity.getMyApplication(), nightMode == null ? false : nightMode.isNightMode());
mc.update(mapActivity.getMyApplication(), nightMode != null && nightMode.isNightMode());
}
}

View file

@ -33,7 +33,7 @@ import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
import net.osmand.plus.routing.RouteDirectionInfo;
import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
import net.osmand.plus.views.controls.MapRouteInfoControl;
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoControl;
import net.osmand.plus.views.mapwidgets.NextTurnInfoWidget.TurnDrawable;
import net.osmand.router.TurnType;

View file

@ -30,7 +30,7 @@ import net.osmand.plus.views.AnimateDraggingMapThread;
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.plus.views.TurnPathHelper;
import net.osmand.plus.views.controls.MapRouteInfoControl;
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoControl;
import net.osmand.router.RouteResultPreparation;
import net.osmand.router.TurnType;
import net.osmand.util.Algorithms;