RP refactoring
This commit is contained in:
parent
403f4de845
commit
2c15e15250
9 changed files with 195 additions and 791 deletions
|
@ -78,7 +78,7 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<net.osmand.plus.views.controls.DynamicListView
|
<com.github.ksoichiro.android.observablescrollview.ObservableListView
|
||||||
android:id="@+id/dash_list_view"
|
android:id="@+id/dash_list_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
|
|
@ -123,13 +123,17 @@
|
||||||
android:text="@string/route_from"
|
android:text="@string/route_from"
|
||||||
android:textSize="@dimen/default_sub_text_size" />
|
android:textSize="@dimen/default_sub_text_size" />
|
||||||
|
|
||||||
<Spinner
|
<TextView
|
||||||
android:id="@+id/FromSpinner"
|
android:id="@+id/fromText"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="-8dp"
|
android:layout_marginEnd="@dimen/list_content_padding"
|
||||||
android:background="@null"
|
android:layout_marginRight="@dimen/list_content_padding"
|
||||||
android:textSize="@dimen/default_list_text_size" />
|
android:gravity="left"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textColor="?android:textColorPrimary"
|
||||||
|
android:textSize="@dimen/default_list_text_size"
|
||||||
|
tools:text="My position" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -237,11 +241,13 @@
|
||||||
android:id="@+id/ViaView"
|
android:id="@+id/ViaView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="@dimen/list_content_padding"
|
||||||
android:layout_marginRight="@dimen/list_content_padding"
|
android:layout_marginRight="@dimen/list_content_padding"
|
||||||
android:gravity="left"
|
android:gravity="left"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textColor="?android:textColorPrimary"
|
android:textColor="?android:textColorPrimary"
|
||||||
android:textSize="@dimen/default_list_text_size" />
|
android:textSize="@dimen/default_list_text_size"
|
||||||
|
tools:text="Intermediate point"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -342,13 +348,17 @@
|
||||||
android:text="@string/route_to"
|
android:text="@string/route_to"
|
||||||
android:textSize="@dimen/default_sub_text_size" />
|
android:textSize="@dimen/default_sub_text_size" />
|
||||||
|
|
||||||
<Spinner
|
<TextView
|
||||||
android:id="@+id/ToSpinner"
|
android:id="@+id/toText"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="-8dp"
|
android:layout_marginEnd="@dimen/list_content_padding"
|
||||||
android:background="@null"
|
android:layout_marginRight="@dimen/list_content_padding"
|
||||||
android:textSize="@dimen/default_list_text_size" />
|
android:gravity="left"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textColor="?android:textColorPrimary"
|
||||||
|
android:textSize="@dimen/default_list_text_size"
|
||||||
|
tools:text="Destination"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -498,7 +508,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:foregroundGravity="top|fill_horizontal"
|
android:foregroundGravity="top|fill_horizontal"
|
||||||
tools:foreground="@drawable/bg_contextmenu_shadow">
|
android:foreground="@drawable/bg_contextmenu_shadow">
|
||||||
|
|
||||||
<net.osmand.plus.LockableScrollView
|
<net.osmand.plus.LockableScrollView
|
||||||
android:id="@+id/route_menu_bottom_scroll"
|
android:id="@+id/route_menu_bottom_scroll"
|
||||||
|
@ -540,7 +550,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="top"
|
android:layout_gravity="top"
|
||||||
android:scaleType="fitXY"
|
android:scaleType="fitXY"
|
||||||
android:src="@drawable/bg_shadow_list_bottom" />
|
android:src="@drawable/bg_contextmenu_shadow" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,7 @@ import net.osmand.plus.mapmarkers.MapMarkersDialogFragment;
|
||||||
import net.osmand.plus.mapmarkers.MarkersPlanRouteContext;
|
import net.osmand.plus.mapmarkers.MarkersPlanRouteContext;
|
||||||
import net.osmand.plus.measurementtool.MeasurementToolFragment;
|
import net.osmand.plus.measurementtool.MeasurementToolFragment;
|
||||||
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||||
|
import net.osmand.plus.routepreparationmenu.WaypointsFragment;
|
||||||
import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder;
|
import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.plus.views.BaseMapLayer;
|
import net.osmand.plus.views.BaseMapLayer;
|
||||||
|
@ -943,7 +944,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openIntermediatePointsDialog() {
|
public void openIntermediatePointsDialog() {
|
||||||
mapActivity.getDashboard().setDashboardVisibility(true, DashboardType.WAYPOINTS);
|
WaypointsFragment.showInstance(mapActivity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openRoutePreferencesDialog() {
|
public void openRoutePreferencesDialog() {
|
||||||
|
|
|
@ -3,6 +3,7 @@ package net.osmand.plus.dashboard;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
|
import android.support.v4.app.FragmentActivity;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.support.v7.widget.PopupMenu;
|
import android.support.v7.widget.PopupMenu;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -15,19 +16,18 @@ import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.TargetPointsHelper;
|
import net.osmand.plus.TargetPointsHelper;
|
||||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
|
|
||||||
import net.osmand.plus.dashboard.tools.DashFragmentData;
|
import net.osmand.plus.dashboard.tools.DashFragmentData;
|
||||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||||
import net.osmand.plus.helpers.WaypointDialogHelper;
|
import net.osmand.plus.helpers.WaypointDialogHelper;
|
||||||
import net.osmand.plus.helpers.WaypointHelper;
|
import net.osmand.plus.helpers.WaypointHelper;
|
||||||
import net.osmand.plus.helpers.WaypointHelper.LocationPointWrapper;
|
import net.osmand.plus.helpers.WaypointHelper.LocationPointWrapper;
|
||||||
|
import net.osmand.plus.routepreparationmenu.WaypointsFragment;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -70,7 +70,9 @@ public class DashWaypointsFragment extends DashLocationFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupWaypoints() {
|
private void setupWaypoints() {
|
||||||
|
FragmentActivity activity = getActivity();
|
||||||
View mainView = getView();
|
View mainView = getView();
|
||||||
|
if (activity != null && mainView != null) {
|
||||||
WaypointHelper wh = getMyApplication().getWaypointHelper();
|
WaypointHelper wh = getMyApplication().getWaypointHelper();
|
||||||
List<LocationPointWrapper> allPoints = wh.getAllPoints();
|
List<LocationPointWrapper> allPoints = wh.getAllPoints();
|
||||||
if (allPoints.size() == 0) {
|
if (allPoints.size() == 0) {
|
||||||
|
@ -86,7 +88,11 @@ public class DashWaypointsFragment extends DashLocationFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
dashboard.setDashboardVisibility(true, DashboardType.WAYPOINTS, AndroidUtils.getCenterViewCoordinates(v));
|
FragmentActivity activity = getActivity();
|
||||||
|
if (activity instanceof MapActivity) {
|
||||||
|
dashboard.hideDashboard();
|
||||||
|
WaypointsFragment.showInstance((MapActivity) activity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
LinearLayout favorites = (LinearLayout) mainView.findViewById(R.id.items);
|
LinearLayout favorites = (LinearLayout) mainView.findViewById(R.id.items);
|
||||||
|
@ -94,15 +100,16 @@ public class DashWaypointsFragment extends DashLocationFragment {
|
||||||
List<DashLocationView> distances = new ArrayList<DashLocationFragment.DashLocationView>();
|
List<DashLocationView> distances = new ArrayList<DashLocationFragment.DashLocationView>();
|
||||||
for (int i = 0; i < 3 && i < allPoints.size(); i++) {
|
for (int i = 0; i < 3 && i < allPoints.size(); i++) {
|
||||||
LocationPointWrapper ps = allPoints.get(i);
|
LocationPointWrapper ps = allPoints.get(i);
|
||||||
View dv = getActivity().getLayoutInflater().inflate(R.layout.divider, null);
|
View dv = activity.getLayoutInflater().inflate(R.layout.divider, null);
|
||||||
favorites.addView(dv);
|
favorites.addView(dv);
|
||||||
View v = WaypointDialogHelper.updateWaypointItemView(false, null, getMyApplication(),
|
View v = WaypointDialogHelper.updateWaypointItemView(false, null, getMyApplication(),
|
||||||
getActivity(), null, null, ps, null, !getMyApplication().getSettings().isLightContent(), true);
|
activity, null, null, ps, null, !getMyApplication().getSettings().isLightContent(), true);
|
||||||
favorites.addView(v);
|
favorites.addView(v);
|
||||||
|
|
||||||
}
|
}
|
||||||
this.distances = distances;
|
this.distances = distances;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setupTargets() {
|
public void setupTargets() {
|
||||||
View mainView = getView();
|
View mainView = getView();
|
||||||
|
|
|
@ -7,7 +7,6 @@ import android.animation.ObjectAnimator;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Resources;
|
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
@ -18,7 +17,6 @@ import android.support.v4.app.FragmentTransaction;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v4.view.ViewCompat;
|
import android.support.v4.view.ViewCompat;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.util.TypedValue;
|
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
@ -40,6 +38,7 @@ import android.widget.ProgressBar;
|
||||||
import android.widget.ScrollView;
|
import android.widget.ScrollView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.github.ksoichiro.android.observablescrollview.ObservableListView;
|
||||||
import com.github.ksoichiro.android.observablescrollview.ObservableScrollView;
|
import com.github.ksoichiro.android.observablescrollview.ObservableScrollView;
|
||||||
import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks;
|
import com.github.ksoichiro.android.observablescrollview.ObservableScrollViewCallbacks;
|
||||||
import com.github.ksoichiro.android.observablescrollview.ScrollState;
|
import com.github.ksoichiro.android.observablescrollview.ScrollState;
|
||||||
|
@ -48,18 +47,15 @@ import net.osmand.AndroidUtils;
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.ValueHolder;
|
import net.osmand.ValueHolder;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.PointDescription;
|
|
||||||
import net.osmand.plus.ApplicationMode;
|
import net.osmand.plus.ApplicationMode;
|
||||||
import net.osmand.plus.ContextMenuAdapter;
|
import net.osmand.plus.ContextMenuAdapter;
|
||||||
import net.osmand.plus.ContextMenuAdapter.OnRowItemClick;
|
import net.osmand.plus.ContextMenuAdapter.OnRowItemClick;
|
||||||
import net.osmand.plus.ContextMenuItem;
|
import net.osmand.plus.ContextMenuItem;
|
||||||
import net.osmand.plus.UiUtilities;
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
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.UiUtilities;
|
||||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.dashboard.tools.DashFragmentData;
|
import net.osmand.plus.dashboard.tools.DashFragmentData;
|
||||||
import net.osmand.plus.dashboard.tools.DashboardSettingsDialogFragment;
|
import net.osmand.plus.dashboard.tools.DashboardSettingsDialogFragment;
|
||||||
|
@ -71,16 +67,15 @@ import net.osmand.plus.download.DownloadIndexesThread;
|
||||||
import net.osmand.plus.download.IndexItem;
|
import net.osmand.plus.download.IndexItem;
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
import net.osmand.plus.helpers.WaypointDialogHelper;
|
import net.osmand.plus.helpers.WaypointDialogHelper;
|
||||||
import net.osmand.plus.helpers.WaypointDialogHelper.WaypointDialogHelperCallbacks;
|
|
||||||
import net.osmand.plus.helpers.WaypointHelper.LocationPointWrapper;
|
import net.osmand.plus.helpers.WaypointHelper.LocationPointWrapper;
|
||||||
import net.osmand.plus.mapcontextmenu.other.RoutePreferencesMenu;
|
import net.osmand.plus.mapcontextmenu.other.RoutePreferencesMenu;
|
||||||
import net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.LocalRoutingParameter;
|
|
||||||
import net.osmand.plus.mapillary.MapillaryFiltersFragment;
|
import net.osmand.plus.mapillary.MapillaryFiltersFragment;
|
||||||
import net.osmand.plus.mapillary.MapillaryPlugin.MapillaryFirstDialogFragment;
|
import net.osmand.plus.mapillary.MapillaryPlugin.MapillaryFirstDialogFragment;
|
||||||
import net.osmand.plus.osmedit.OsmNotesMenu;
|
import net.osmand.plus.osmedit.OsmNotesMenu;
|
||||||
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
|
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.LocalRoutingParameter;
|
||||||
import net.osmand.plus.routing.IRouteInformationListener;
|
import net.osmand.plus.routing.IRouteInformationListener;
|
||||||
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.plus.srtmplugin.ContourLinesMenu;
|
import net.osmand.plus.srtmplugin.ContourLinesMenu;
|
||||||
import net.osmand.plus.srtmplugin.HillshadeMenu;
|
import net.osmand.plus.srtmplugin.HillshadeMenu;
|
||||||
import net.osmand.plus.srtmplugin.SRTMPlugin;
|
import net.osmand.plus.srtmplugin.SRTMPlugin;
|
||||||
|
@ -88,11 +83,6 @@ import net.osmand.plus.views.DownloadedRegionsLayer;
|
||||||
import net.osmand.plus.views.MapInfoLayer;
|
import net.osmand.plus.views.MapInfoLayer;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
import net.osmand.plus.views.controls.DynamicListView;
|
import net.osmand.plus.views.controls.DynamicListView;
|
||||||
import net.osmand.plus.views.controls.DynamicListViewCallbacks;
|
|
||||||
import net.osmand.plus.views.controls.StableArrayAdapter;
|
|
||||||
import net.osmand.plus.views.controls.SwipeDismissListViewTouchListener;
|
|
||||||
import net.osmand.plus.views.controls.SwipeDismissListViewTouchListener.DismissCallbacks;
|
|
||||||
import net.osmand.plus.views.controls.SwipeDismissListViewTouchListener.Undoable;
|
|
||||||
import net.osmand.plus.views.mapwidgets.MapWidgetRegistry;
|
import net.osmand.plus.views.mapwidgets.MapWidgetRegistry;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
|
@ -103,10 +93,7 @@ import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static android.util.TypedValue.COMPLEX_UNIT_DIP;
|
public class DashboardOnMap implements ObservableScrollViewCallbacks, IRouteInformationListener {
|
||||||
|
|
||||||
public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicListViewCallbacks,
|
|
||||||
IRouteInformationListener, WaypointDialogHelperCallbacks {
|
|
||||||
private static final org.apache.commons.logging.Log LOG =
|
private static final org.apache.commons.logging.Log LOG =
|
||||||
PlatformUtil.getLog(DashboardOnMap.class);
|
PlatformUtil.getLog(DashboardOnMap.class);
|
||||||
private static final String TAG = "DashboardOnMap";
|
private static final String TAG = "DashboardOnMap";
|
||||||
|
@ -142,7 +129,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
|
|
||||||
private ArrayAdapter<?> listAdapter;
|
private ArrayAdapter<?> listAdapter;
|
||||||
private OnItemClickListener listAdapterOnClickListener;
|
private OnItemClickListener listAdapterOnClickListener;
|
||||||
private SwipeDismissListViewTouchListener swipeDismissListener;
|
|
||||||
|
|
||||||
private boolean visible = false;
|
private boolean visible = false;
|
||||||
private DashboardType visibleType;
|
private DashboardType visibleType;
|
||||||
|
@ -155,7 +141,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
private boolean mapLinkedToLocation;
|
private boolean mapLinkedToLocation;
|
||||||
private float mapRotation;
|
private float mapRotation;
|
||||||
private boolean inLocationUpdate = false;
|
private boolean inLocationUpdate = false;
|
||||||
private DynamicListView listView;
|
private ObservableListView listView;
|
||||||
private View listBackgroundView;
|
private View listBackgroundView;
|
||||||
private Toolbar toolbar;
|
private Toolbar toolbar;
|
||||||
private View paddingView;
|
private View paddingView;
|
||||||
|
@ -180,8 +166,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum DashboardType {
|
public enum DashboardType {
|
||||||
WAYPOINTS,
|
|
||||||
WAYPOINTS_FLAT,
|
|
||||||
CONFIGURE_SCREEN,
|
CONFIGURE_SCREEN,
|
||||||
CONFIGURE_MAP,
|
CONFIGURE_MAP,
|
||||||
LIST_MENU,
|
LIST_MENU,
|
||||||
|
@ -235,7 +219,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
public void createDashboardView() {
|
public void createDashboardView() {
|
||||||
baseColor = ContextCompat.getColor(mapActivity, R.color.osmand_orange) & 0x00ffffff;
|
baseColor = ContextCompat.getColor(mapActivity, R.color.osmand_orange) & 0x00ffffff;
|
||||||
waypointDialogHelper = new WaypointDialogHelper(mapActivity);
|
waypointDialogHelper = new WaypointDialogHelper(mapActivity);
|
||||||
waypointDialogHelper.addHelperCallbacks(this);
|
|
||||||
landscape = !AndroidUiHelper.isOrientationPortrait(mapActivity);
|
landscape = !AndroidUiHelper.isOrientationPortrait(mapActivity);
|
||||||
dashboardView = (FrameLayout) mapActivity.findViewById(R.id.dashboard);
|
dashboardView = (FrameLayout) mapActivity.findViewById(R.id.dashboard);
|
||||||
AndroidUtils.addStatusBarPadding21v(mapActivity, dashboardView);
|
AndroidUtils.addStatusBarPadding21v(mapActivity, dashboardView);
|
||||||
|
@ -247,122 +230,11 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
};
|
};
|
||||||
toolbar = ((Toolbar) dashboardView.findViewById(R.id.toolbar));
|
toolbar = ((Toolbar) dashboardView.findViewById(R.id.toolbar));
|
||||||
ObservableScrollView scrollView = ((ObservableScrollView) dashboardView.findViewById(R.id.main_scroll));
|
ObservableScrollView scrollView = ((ObservableScrollView) dashboardView.findViewById(R.id.main_scroll));
|
||||||
listView = (DynamicListView) dashboardView.findViewById(R.id.dash_list_view);
|
listView = (ObservableListView) dashboardView.findViewById(R.id.dash_list_view);
|
||||||
//listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
|
//listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
|
||||||
listView.setDrawSelectorOnTop(true);
|
listView.setDrawSelectorOnTop(true);
|
||||||
listView.setDynamicListViewCallbacks(this);
|
listView.setScrollViewCallbacks(this);
|
||||||
listEmptyTextView = (TextView) dashboardView.findViewById(R.id.emptyTextView);
|
listEmptyTextView = (TextView) dashboardView.findViewById(R.id.emptyTextView);
|
||||||
|
|
||||||
// Create a ListView-specific touch listener. ListViews are given special treatment because
|
|
||||||
// by default they handle touches for their list items... i.e. they're in charge of drawing
|
|
||||||
// the pressed state (the list selector), handling list item clicks, etc.
|
|
||||||
swipeDismissListener = new SwipeDismissListViewTouchListener(
|
|
||||||
mapActivity,
|
|
||||||
listView,
|
|
||||||
new DismissCallbacks() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canDismiss(int position) {
|
|
||||||
if (listAdapter instanceof StableArrayAdapter
|
|
||||||
&& (visibleType == DashboardType.WAYPOINTS || visibleType == DashboardType.WAYPOINTS_FLAT)) {
|
|
||||||
List<Object> activeObjects = ((StableArrayAdapter) listAdapter).getActiveObjects();
|
|
||||||
Object obj = listAdapter.getItem(position);
|
|
||||||
if (obj instanceof LocationPointWrapper) {
|
|
||||||
LocationPointWrapper w = (LocationPointWrapper) obj;
|
|
||||||
if (w.getPoint() instanceof TargetPoint) {
|
|
||||||
return !((TargetPoint) w.getPoint()).start;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return activeObjects.contains(obj);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Undoable onDismiss(final int position) {
|
|
||||||
final Object item;
|
|
||||||
final StableArrayAdapter stableAdapter;
|
|
||||||
final int activeObjPos;
|
|
||||||
if (listAdapter instanceof StableArrayAdapter) {
|
|
||||||
stableAdapter = (StableArrayAdapter) listAdapter;
|
|
||||||
item = stableAdapter.getItem(position);
|
|
||||||
|
|
||||||
stableAdapter.setNotifyOnChange(false);
|
|
||||||
stableAdapter.remove(item);
|
|
||||||
stableAdapter.getObjects().remove(item);
|
|
||||||
activeObjPos = stableAdapter.getActiveObjects().indexOf(item);
|
|
||||||
stableAdapter.getActiveObjects().remove(item);
|
|
||||||
stableAdapter.refreshData();
|
|
||||||
stableAdapter.notifyDataSetChanged();
|
|
||||||
} else {
|
|
||||||
item = null;
|
|
||||||
stableAdapter = null;
|
|
||||||
activeObjPos = 0;
|
|
||||||
}
|
|
||||||
return new Undoable() {
|
|
||||||
@Override
|
|
||||||
public void undo() {
|
|
||||||
if (item != null) {
|
|
||||||
stableAdapter.setNotifyOnChange(false);
|
|
||||||
stableAdapter.insert(item, position);
|
|
||||||
stableAdapter.getObjects().add(position, item);
|
|
||||||
stableAdapter.getActiveObjects().add(activeObjPos, item);
|
|
||||||
stableAdapter.refreshData();
|
|
||||||
if (visibleType == DashboardType.WAYPOINTS || visibleType == DashboardType.WAYPOINTS_FLAT) {
|
|
||||||
onItemsSwapped(stableAdapter.getActiveObjects());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTitle() {
|
|
||||||
List<Object> activeObjects;
|
|
||||||
if ((visibleType == DashboardType.WAYPOINTS || visibleType == DashboardType.WAYPOINTS_FLAT)
|
|
||||||
&& (getMyApplication().getRoutingHelper().isRoutePlanningMode() || getMyApplication().getRoutingHelper().isFollowingMode())
|
|
||||||
&& item != null
|
|
||||||
&& ((activeObjects = stableAdapter.getActiveObjects()).isEmpty() || isContainsOnlyStart(activeObjects))) {
|
|
||||||
return mapActivity.getResources().getString(R.string.cancel_navigation);
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onHidePopup() {
|
|
||||||
if (listAdapter instanceof StableArrayAdapter) {
|
|
||||||
StableArrayAdapter stableAdapter = (StableArrayAdapter) listAdapter;
|
|
||||||
stableAdapter.refreshData();
|
|
||||||
if (visibleType == DashboardType.WAYPOINTS || visibleType == DashboardType.WAYPOINTS_FLAT) {
|
|
||||||
onItemsSwapped(stableAdapter.getActiveObjects());
|
|
||||||
}
|
|
||||||
List<Object> activeObjects = stableAdapter.getActiveObjects();
|
|
||||||
if (activeObjects.isEmpty() || isContainsOnlyStart(activeObjects)) {
|
|
||||||
hideDashboard();
|
|
||||||
if (visibleType == DashboardType.WAYPOINTS || visibleType == DashboardType.WAYPOINTS_FLAT) {
|
|
||||||
mapActivity.getMapActions().stopNavigationWithoutConfirm();
|
|
||||||
getMyApplication().getTargetPointsHelper().removeAllWayPoints(false, true);
|
|
||||||
mapActivity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu().hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isContainsOnlyStart(List<Object> items) {
|
|
||||||
if (items.size() == 1) {
|
|
||||||
Object item = items.get(0);
|
|
||||||
if (item instanceof LocationPointWrapper) {
|
|
||||||
LocationPointWrapper w = (LocationPointWrapper) item;
|
|
||||||
if (w.getPoint() instanceof TargetPoint) {
|
|
||||||
return ((TargetPoint) w.getPoint()).start;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
gradientToolbar = ContextCompat.getDrawable(mapActivity, R.drawable.gradient_toolbar).mutate();
|
gradientToolbar = ContextCompat.getDrawable(mapActivity, R.drawable.gradient_toolbar).mutate();
|
||||||
if (AndroidUiHelper.isOrientationPortrait(mapActivity)) {
|
if (AndroidUiHelper.isOrientationPortrait(mapActivity)) {
|
||||||
this.portrait = true;
|
this.portrait = true;
|
||||||
|
@ -432,10 +304,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
private void updateToolbarActions() {
|
private void updateToolbarActions() {
|
||||||
TextView tv = (TextView) dashboardView.findViewById(R.id.toolbar_text);
|
TextView tv = (TextView) dashboardView.findViewById(R.id.toolbar_text);
|
||||||
tv.setText("");
|
tv.setText("");
|
||||||
boolean waypointsVisible = visibleType == DashboardType.WAYPOINTS || visibleType == DashboardType.WAYPOINTS_FLAT;
|
if (visibleType == DashboardType.CONFIGURE_MAP) {
|
||||||
if (waypointsVisible) {
|
|
||||||
tv.setText(R.string.shared_string_waypoints);
|
|
||||||
} else if (visibleType == DashboardType.CONFIGURE_MAP) {
|
|
||||||
tv.setText(R.string.configure_map);
|
tv.setText(R.string.configure_map);
|
||||||
} else if (visibleType == DashboardType.CONFIGURE_SCREEN) {
|
} else if (visibleType == DashboardType.CONFIGURE_SCREEN) {
|
||||||
tv.setText(R.string.layer_map_appearance);
|
tv.setText(R.string.layer_map_appearance);
|
||||||
|
@ -478,24 +347,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (waypointsVisible && getMyApplication().getWaypointHelper().getAllPoints().size() > 0) {
|
|
||||||
if (getMyApplication().getWaypointHelper().isRouteCalculated()) {
|
|
||||||
flat.setVisibility(View.VISIBLE);
|
|
||||||
final boolean flatNow = visibleType == DashboardType.WAYPOINTS_FLAT;
|
|
||||||
flat.setImageDrawable(iconsCache.getIcon(flatNow ? R.drawable.ic_tree_list_dark
|
|
||||||
: R.drawable.ic_flat_list_dark));
|
|
||||||
flat.setContentDescription(mapActivity.getString(flatNow ? R.string.access_tree_list : R.string.drawer));
|
|
||||||
flat.setOnClickListener(new View.OnClickListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
setDashboardVisibility(true, flatNow ? DashboardType.WAYPOINTS : DashboardType.WAYPOINTS_FLAT,
|
|
||||||
previousVisibleType, false, AndroidUtils.getCenterViewCoordinates(v));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (visibleType == DashboardType.DASHBOARD || visibleType == DashboardType.LIST_MENU) {
|
if (visibleType == DashboardType.DASHBOARD || visibleType == DashboardType.LIST_MENU) {
|
||||||
settingsButton.setVisibility(View.VISIBLE);
|
settingsButton.setVisibility(View.VISIBLE);
|
||||||
settingsButton.setOnClickListener(new View.OnClickListener() {
|
settingsButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -607,12 +458,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
button = actionButtons.get(DashboardActionButtonType.MY_LOCATION);
|
button = actionButtons.get(DashboardActionButtonType.MY_LOCATION);
|
||||||
} else if (type == DashboardType.ROUTE_PREFERENCES) {
|
} else if (type == DashboardType.ROUTE_PREFERENCES) {
|
||||||
button = actionButtons.get(DashboardActionButtonType.NAVIGATE);
|
button = actionButtons.get(DashboardActionButtonType.NAVIGATE);
|
||||||
} else if (type == DashboardType.WAYPOINTS || type == DashboardType.WAYPOINTS_FLAT) {
|
|
||||||
if (isInRouteOrPlannigMode()) {
|
|
||||||
button = actionButtons.get(DashboardActionButtonType.NAVIGATE);
|
|
||||||
} else {
|
|
||||||
button = actionButtons.get(DashboardActionButtonType.ROUTE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (button != null) {
|
if (button != null) {
|
||||||
|
@ -720,10 +565,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
DashboardOnMap.staticVisible = visible;
|
DashboardOnMap.staticVisible = visible;
|
||||||
DashboardOnMap.staticVisibleType = type;
|
DashboardOnMap.staticVisibleType = type;
|
||||||
mapActivity.enableDrawer();
|
mapActivity.enableDrawer();
|
||||||
|
|
||||||
if (swipeDismissListener != null) {
|
|
||||||
swipeDismissListener.discardUndo();
|
|
||||||
}
|
|
||||||
removeMapillaryFiltersFragment();
|
removeMapillaryFiltersFragment();
|
||||||
|
|
||||||
if (visible) {
|
if (visible) {
|
||||||
|
@ -825,14 +666,13 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
// listView.setBackgroundColor(backgroundColor);
|
// listView.setBackgroundColor(backgroundColor);
|
||||||
listEmptyTextView.setBackgroundColor(backgroundColor);
|
listEmptyTextView.setBackgroundColor(backgroundColor);
|
||||||
}
|
}
|
||||||
if (visibleType != DashboardType.WAYPOINTS
|
if (visibleType != DashboardType.CONFIGURE_SCREEN
|
||||||
&& visibleType != DashboardType.CONFIGURE_SCREEN
|
|
||||||
&& visibleType != DashboardType.CONFIGURE_MAP
|
&& visibleType != DashboardType.CONFIGURE_MAP
|
||||||
&& visibleType != DashboardType.CONTOUR_LINES
|
&& visibleType != DashboardType.CONTOUR_LINES
|
||||||
&& visibleType != DashboardType.HILLSHADE
|
&& visibleType != DashboardType.HILLSHADE
|
||||||
&& visibleType != DashboardType.OSM_NOTES) {
|
&& visibleType != DashboardType.OSM_NOTES) {
|
||||||
listView.setDivider(dividerDrawable);
|
listView.setDivider(dividerDrawable);
|
||||||
listView.setDividerHeight(dpToPx(1f));
|
listView.setDividerHeight(AndroidUtils.dpToPx(mapActivity, 1f));
|
||||||
} else {
|
} else {
|
||||||
listView.setDivider(null);
|
listView.setDivider(null);
|
||||||
}
|
}
|
||||||
|
@ -843,35 +683,10 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int dpToPx(float dp) {
|
|
||||||
Resources r = mapActivity.getResources();
|
|
||||||
return (int) TypedValue.applyDimension(COMPLEX_UNIT_DIP, dp, r.getDisplayMetrics());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateListAdapter() {
|
private void updateListAdapter() {
|
||||||
listEmptyTextView.setVisibility(View.GONE);
|
listEmptyTextView.setVisibility(View.GONE);
|
||||||
listView.setEmptyView(null);
|
listView.setEmptyView(null);
|
||||||
ContextMenuAdapter cm = null;
|
ContextMenuAdapter cm = null;
|
||||||
if (DashboardType.WAYPOINTS == visibleType || DashboardType.WAYPOINTS_FLAT == visibleType) {
|
|
||||||
|
|
||||||
StableArrayAdapter listAdapter = waypointDialogHelper.getWaypointsDrawerAdapter(true, deletedPoints, mapActivity, running,
|
|
||||||
DashboardType.WAYPOINTS_FLAT == visibleType, nightMode);
|
|
||||||
OnItemClickListener listener = waypointDialogHelper.getDrawerItemClickListener(mapActivity, running,
|
|
||||||
listAdapter);
|
|
||||||
|
|
||||||
setDynamicListItems(listView, listAdapter);
|
|
||||||
updateListAdapter(listAdapter, listener);
|
|
||||||
|
|
||||||
if (listAdapter.getObjects().size() == 0) {
|
|
||||||
listEmptyTextView.setText(mapActivity.getString(R.string.no_waypoints_found));
|
|
||||||
if (landscape) {
|
|
||||||
listView.setEmptyView(listEmptyTextView);
|
|
||||||
} else {
|
|
||||||
listEmptyTextView.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if (visibleType == DashboardType.CONFIGURE_SCREEN) {
|
if (visibleType == DashboardType.CONFIGURE_SCREEN) {
|
||||||
cm = mapActivity.getMapLayers().getMapWidgetRegistry().getViewConfigureMenuAdapter(mapActivity);
|
cm = mapActivity.getMapLayers().getMapWidgetRegistry().getViewConfigureMenuAdapter(mapActivity);
|
||||||
} else if (visibleType == DashboardType.CONFIGURE_MAP) {
|
} else if (visibleType == DashboardType.CONFIGURE_MAP) {
|
||||||
|
@ -898,7 +713,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
updateListAdapter(cm);
|
updateListAdapter(cm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void updateListAdapter(ContextMenuAdapter cm) {
|
public void updateListAdapter(ContextMenuAdapter cm) {
|
||||||
boolean nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
boolean nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||||
|
@ -956,12 +770,9 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
.detach(mapillaryFragment)
|
.detach(mapillaryFragment)
|
||||||
.attach(mapillaryFragment)
|
.attach(mapillaryFragment)
|
||||||
.commit();
|
.commit();
|
||||||
} else if (visibleType == DashboardType.WAYPOINTS
|
} else if (visibleType == DashboardType.CONFIGURE_SCREEN || force) {
|
||||||
|| visibleType == DashboardType.CONFIGURE_SCREEN
|
|
||||||
|| force) {
|
|
||||||
updateListAdapter();
|
updateListAdapter();
|
||||||
} else if (visibleType == DashboardType.CONFIGURE_MAP
|
} else if (visibleType == DashboardType.CONFIGURE_MAP || visibleType == DashboardType.ROUTE_PREFERENCES) {
|
||||||
|| visibleType == DashboardType.ROUTE_PREFERENCES) {
|
|
||||||
int index = listView.getFirstVisiblePosition();
|
int index = listView.getFirstVisiblePosition();
|
||||||
View v = listView.getChildAt(0);
|
View v = listView.getChildAt(0);
|
||||||
int top = (v == null) ? 0 : (v.getTop() - listView.getPaddingTop());
|
int top = (v == null) ? 0 : (v.getTop() - listView.getPaddingTop());
|
||||||
|
@ -972,14 +783,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setDynamicListItems(DynamicListView listView, StableArrayAdapter listAdapter) {
|
|
||||||
listView.setItemsList(listAdapter.getObjects());
|
|
||||||
|
|
||||||
if (DashboardType.WAYPOINTS == visibleType || DashboardType.WAYPOINTS_FLAT == visibleType) {
|
|
||||||
listView.setActiveItemsList(listAdapter.getActiveObjects());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private OnItemClickListener getOptionsMenuOnClickListener(final ContextMenuAdapter cm,
|
private OnItemClickListener getOptionsMenuOnClickListener(final ContextMenuAdapter cm,
|
||||||
final ArrayAdapter<ContextMenuItem> listAdapter) {
|
final ArrayAdapter<ContextMenuItem> listAdapter) {
|
||||||
return new AdapterView.OnItemClickListener() {
|
return new AdapterView.OnItemClickListener() {
|
||||||
|
@ -1063,8 +866,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
}, 4000);
|
}, 4000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void navigationAction() {
|
||||||
public void navigationAction() {
|
|
||||||
RoutingHelper routingHelper = mapActivity.getRoutingHelper();
|
RoutingHelper routingHelper = mapActivity.getRoutingHelper();
|
||||||
if (!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) {
|
if (!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) {
|
||||||
mapActivity.getMapActions().enterRoutePlanningMode(null, null);
|
mapActivity.getMapActions().enterRoutePlanningMode(null, null);
|
||||||
|
@ -1077,7 +879,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
hideDashboard(animate);
|
hideDashboard(animate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// To bounce animate view
|
// To bounce animate view
|
||||||
private void open(boolean animation, int[] animationCoordinates) {
|
private void open(boolean animation, int[] animationCoordinates) {
|
||||||
if (animation) {
|
if (animation) {
|
||||||
|
@ -1166,7 +967,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
animationCoordinates = null;
|
animationCoordinates = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void addOrUpdateDashboardFragments() {
|
private void addOrUpdateDashboardFragments() {
|
||||||
OsmandSettings settings = getMyApplication().getSettings();
|
OsmandSettings settings = getMyApplication().getSettings();
|
||||||
TransactionBuilder builder =
|
TransactionBuilder builder =
|
||||||
|
@ -1192,7 +992,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
return visible;
|
return visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDetach(DashBaseFragment dashBaseFragment) {
|
void onDetach(DashBaseFragment dashBaseFragment) {
|
||||||
Iterator<WeakReference<DashBaseFragment>> it = fragList.iterator();
|
Iterator<WeakReference<DashBaseFragment>> it = fragList.iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
WeakReference<DashBaseFragment> wr = it.next();
|
WeakReference<DashBaseFragment> wr = it.next();
|
||||||
|
@ -1202,7 +1002,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void updateLocation(final boolean centerChanged, final boolean locationChanged,
|
public void updateLocation(final boolean centerChanged, final boolean locationChanged,
|
||||||
final boolean compassChanged) {
|
final boolean compassChanged) {
|
||||||
if (inLocationUpdate) {
|
if (inLocationUpdate) {
|
||||||
|
@ -1240,16 +1039,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
dashboardView.requestLayout();
|
dashboardView.requestLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void onMenuPressed() {
|
|
||||||
if (!isVisible()) {
|
|
||||||
setDashboardVisibility(true, DashboardType.DASHBOARD);
|
|
||||||
} else {
|
|
||||||
hideDashboard();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public boolean onBackPressed() {
|
public boolean onBackPressed() {
|
||||||
if (isVisible()) {
|
if (isVisible()) {
|
||||||
backPressed();
|
backPressed();
|
||||||
|
@ -1258,7 +1047,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void backPressed() {
|
private void backPressed() {
|
||||||
if (previousVisibleType != visibleType && previousVisibleType != null) {
|
if (previousVisibleType != visibleType && previousVisibleType != null) {
|
||||||
if (visibleType == DashboardType.MAPILLARY) {
|
if (visibleType == DashboardType.MAPILLARY) {
|
||||||
|
@ -1275,10 +1063,11 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
View currentFocus = mapActivity.getCurrentFocus();
|
View currentFocus = mapActivity.getCurrentFocus();
|
||||||
if (currentFocus != null) {
|
if (currentFocus != null) {
|
||||||
InputMethodManager imm = (InputMethodManager) mapActivity.getSystemService(Context.INPUT_METHOD_SERVICE);
|
InputMethodManager imm = (InputMethodManager) mapActivity.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
|
if (imm != null) {
|
||||||
imm.hideSoftInputFromWindow(currentFocus.getWindowToken(), 0);
|
imm.hideSoftInputFromWindow(currentFocus.getWindowToken(), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) {
|
public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) {
|
||||||
|
@ -1298,8 +1087,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
|
|
||||||
private boolean isActionButtonVisible() {
|
private boolean isActionButtonVisible() {
|
||||||
return visibleType == DashboardType.DASHBOARD
|
return visibleType == DashboardType.DASHBOARD
|
||||||
|| visibleType == DashboardType.WAYPOINTS
|
|
||||||
|| visibleType == DashboardType.WAYPOINTS_FLAT
|
|
||||||
|| visibleType == DashboardType.LIST_MENU
|
|| visibleType == DashboardType.LIST_MENU
|
||||||
|| visibleType == DashboardType.ROUTE_PREFERENCES
|
|| visibleType == DashboardType.ROUTE_PREFERENCES
|
||||||
|| visibleType == DashboardType.CONFIGURE_SCREEN;
|
|| visibleType == DashboardType.CONFIGURE_SCREEN;
|
||||||
|
@ -1322,7 +1109,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateTopButton(int scrollY) {
|
private void updateTopButton(int scrollY) {
|
||||||
|
|
||||||
if (actionButton != null && portrait && isActionButtonVisible()) {
|
if (actionButton != null && portrait && isActionButtonVisible()) {
|
||||||
double scale = mapActivity.getResources().getDisplayMetrics().density;
|
double scale = mapActivity.getResources().getDisplayMetrics().density;
|
||||||
int originalPosition = mFlexibleSpaceImageHeight - (int) (80 * scale);
|
int originalPosition = mFlexibleSpaceImageHeight - (int) (80 * scale);
|
||||||
|
@ -1350,7 +1136,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void updateColorOfToolbar(int scrollY) {
|
private void updateColorOfToolbar(int scrollY) {
|
||||||
if (portrait) {
|
if (portrait) {
|
||||||
float sh = mFlexibleSpaceImageHeight - mFlexibleBlurSpaceHeight;
|
float sh = mFlexibleSpaceImageHeight - mFlexibleBlurSpaceHeight;
|
||||||
|
@ -1425,7 +1210,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public <T extends DashBaseFragment> T getFragmentByClass(Class<T> class1) {
|
<T extends DashBaseFragment> T getFragmentByClass(Class<T> class1) {
|
||||||
for (WeakReference<DashBaseFragment> f : fragList) {
|
for (WeakReference<DashBaseFragment> f : fragList) {
|
||||||
DashBaseFragment b = f.get();
|
DashBaseFragment b = f.get();
|
||||||
if (b != null && !b.isDetached() && class1.isInstance(b)) {
|
if (b != null && !b.isDetached() && class1.isInstance(b)) {
|
||||||
|
@ -1436,26 +1221,26 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void blacklistFragmentByTag(String tag) {
|
void blacklistFragmentByTag(String tag) {
|
||||||
hideFragmentByTag(tag);
|
hideFragmentByTag(tag);
|
||||||
getMyApplication().getSettings().registerBooleanPreference(SHOULD_SHOW + tag, true)
|
getMyApplication().getSettings().registerBooleanPreference(SHOULD_SHOW + tag, true)
|
||||||
.makeGlobal().set(false);
|
.makeGlobal().set(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hideFragmentByTag(String tag) {
|
void hideFragmentByTag(String tag) {
|
||||||
FragmentManager manager = mapActivity.getSupportFragmentManager();
|
FragmentManager manager = mapActivity.getSupportFragmentManager();
|
||||||
FragmentTransaction transaction = manager.beginTransaction();
|
FragmentTransaction transaction = manager.beginTransaction();
|
||||||
Fragment frag = manager.findFragmentByTag(tag);
|
Fragment frag = manager.findFragmentByTag(tag);
|
||||||
transaction.hide(frag).commit();
|
transaction.hide(frag).commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unblacklistFragmentClass(String tag) {
|
void unblacklistFragmentClass(String tag) {
|
||||||
unhideFragmentByTag(tag);
|
unhideFragmentByTag(tag);
|
||||||
getMyApplication().getSettings().registerBooleanPreference(SHOULD_SHOW + tag, true)
|
getMyApplication().getSettings().registerBooleanPreference(SHOULD_SHOW + tag, true)
|
||||||
.makeGlobal().set(true);
|
.makeGlobal().set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unhideFragmentByTag(String tag) {
|
void unhideFragmentByTag(String tag) {
|
||||||
FragmentManager manager = mapActivity.getSupportFragmentManager();
|
FragmentManager manager = mapActivity.getSupportFragmentManager();
|
||||||
FragmentTransaction transaction = manager.beginTransaction();
|
FragmentTransaction transaction = manager.beginTransaction();
|
||||||
Fragment frag = manager.findFragmentByTag(tag);
|
Fragment frag = manager.findFragmentByTag(tag);
|
||||||
|
@ -1470,7 +1255,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
return dashboardView;
|
return dashboardView;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> List<T> handleNumberOfRows(List<T> list, OsmandSettings settings,
|
public static <T> void handleNumberOfRows(List<T> list, OsmandSettings settings,
|
||||||
String rowNumberTag) {
|
String rowNumberTag) {
|
||||||
int numberOfRows = settings.registerIntPreference(rowNumberTag, 3)
|
int numberOfRows = settings.registerIntPreference(rowNumberTag, 3)
|
||||||
.makeGlobal().get();
|
.makeGlobal().get();
|
||||||
|
@ -1479,7 +1264,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
list.remove(numberOfRows);
|
list.remove(numberOfRows);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class DefaultShouldShow extends DashFragmentData.ShouldShowFunction {
|
public static class DefaultShouldShow extends DashFragmentData.ShouldShowFunction {
|
||||||
|
@ -1489,66 +1273,8 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onItemSwapping(int position) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public void onItemsSwapped(final List<Object> items) {
|
|
||||||
getMyApplication().runInUIThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (visibleType == DashboardType.WAYPOINTS || visibleType == DashboardType.WAYPOINTS_FLAT) {
|
|
||||||
List<TargetPoint> allTargets = new ArrayList<>();
|
|
||||||
TargetPoint start = null;
|
|
||||||
if (items != null) {
|
|
||||||
for (Object obj : items) {
|
|
||||||
if (obj instanceof LocationPointWrapper) {
|
|
||||||
LocationPointWrapper p = (LocationPointWrapper) obj;
|
|
||||||
if (p.getPoint() instanceof TargetPoint) {
|
|
||||||
TargetPoint t = (TargetPoint) p.getPoint();
|
|
||||||
if (t.start) {
|
|
||||||
start = t;
|
|
||||||
} else {
|
|
||||||
t.intermediate = true;
|
|
||||||
}
|
|
||||||
allTargets.add(t);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (allTargets.size() > 0) {
|
|
||||||
allTargets.get(allTargets.size() - 1).intermediate = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
TargetPointsHelper targetPointsHelper = getMyApplication().getTargetPointsHelper();
|
|
||||||
if (start != null) {
|
|
||||||
int startInd = allTargets.indexOf(start);
|
|
||||||
TargetPoint first = allTargets.remove(0);
|
|
||||||
if (startInd != 0) {
|
|
||||||
start.start = false;
|
|
||||||
start.intermediate = startInd != allTargets.size() - 1;
|
|
||||||
if (targetPointsHelper.getPointToStart() == null) {
|
|
||||||
start.getOriginalPointDescription().setName(PointDescription
|
|
||||||
.getLocationNamePlain(getMyApplication(), start.getLatitude(), start.getLongitude()));
|
|
||||||
}
|
|
||||||
first.start = true;
|
|
||||||
first.intermediate = false;
|
|
||||||
targetPointsHelper.setStartPoint(new LatLon(first.getLatitude(), first.getLongitude()),
|
|
||||||
false, first.getPointDescription(getMyApplication()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
targetPointsHelper.reorderAllTargetPoints(allTargets, false);
|
|
||||||
newRouteIsCalculated(false, new ValueHolder<Boolean>());
|
|
||||||
targetPointsHelper.updateRouteAndRefresh(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 50);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void newRouteIsCalculated(boolean newRoute, ValueHolder<Boolean> showToast) {
|
public void newRouteIsCalculated(boolean newRoute, ValueHolder<Boolean> showToast) {
|
||||||
reloadAdapter();
|
|
||||||
showToast.value = false;
|
showToast.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1559,50 +1285,4 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
@Override
|
@Override
|
||||||
public void routeWasFinished() {
|
public void routeWasFinished() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onWindowVisibilityChanged(int visibility) {
|
|
||||||
if (visibility != View.VISIBLE && swipeDismissListener != null) {
|
|
||||||
swipeDismissListener.discardUndo();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void reloadAdapter() {
|
|
||||||
if (listAdapter != null && listAdapter instanceof StableArrayAdapter) {
|
|
||||||
StableArrayAdapter stableAdapter = (StableArrayAdapter) listAdapter;
|
|
||||||
if (DashboardType.WAYPOINTS == visibleType || DashboardType.WAYPOINTS_FLAT == visibleType) {
|
|
||||||
waypointDialogHelper.reloadListAdapter(stableAdapter);
|
|
||||||
}
|
|
||||||
setDynamicListItems(listView, stableAdapter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void deleteSwipeItem(int position) {
|
|
||||||
if (swipeDismissListener != null) {
|
|
||||||
swipeDismissListener.delete(position);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deleteWaypoint(int position) {
|
|
||||||
deleteSwipeItem(position);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void exchangeWaypoints(int pos1, int pos2) {
|
|
||||||
if (swipeDismissListener != null) {
|
|
||||||
swipeDismissListener.discardUndo();
|
|
||||||
}
|
|
||||||
if (pos1 != -1 && pos2 != -1) {
|
|
||||||
StableArrayAdapter stableAdapter = (StableArrayAdapter) listAdapter;
|
|
||||||
Object item1 = stableAdapter.getActiveObjects().get(pos1);
|
|
||||||
Object item2 = stableAdapter.getActiveObjects().get(pos2);
|
|
||||||
stableAdapter.getActiveObjects().set(pos1, item2);
|
|
||||||
stableAdapter.getActiveObjects().set(pos2, item1);
|
|
||||||
|
|
||||||
stableAdapter.refreshData();
|
|
||||||
onItemsSwapped(stableAdapter.getActiveObjects());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,7 @@ import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
|
||||||
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerHalfItem;
|
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerHalfItem;
|
||||||
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
|
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
|
||||||
import net.osmand.plus.helpers.WaypointHelper.LocationPointWrapper;
|
import net.osmand.plus.helpers.WaypointHelper.LocationPointWrapper;
|
||||||
|
import net.osmand.plus.routepreparationmenu.AddPointBottomSheetDialog;
|
||||||
import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu;
|
import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu;
|
||||||
import net.osmand.plus.poi.PoiUIFilter;
|
import net.osmand.plus.poi.PoiUIFilter;
|
||||||
import net.osmand.plus.views.controls.DynamicListView.DragIcon;
|
import net.osmand.plus.views.controls.DynamicListView.DragIcon;
|
||||||
|
@ -319,108 +320,6 @@ public class WaypointDialogHelper {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public StableArrayAdapter getWaypointsDrawerAdapter(
|
|
||||||
final boolean edit, final List<LocationPointWrapper> deletedPoints,
|
|
||||||
final MapActivity ctx, final int[] running, final boolean flat, final boolean nightMode) {
|
|
||||||
|
|
||||||
this.flat = flat;
|
|
||||||
this.deletedPoints = deletedPoints;
|
|
||||||
|
|
||||||
final List<Object> points = getPoints();
|
|
||||||
List<Object> activePoints = getActivePoints(points);
|
|
||||||
|
|
||||||
final WaypointDialogHelper helper = this;
|
|
||||||
|
|
||||||
final StableArrayAdapter listAdapter = new StableArrayAdapter(ctx,
|
|
||||||
R.layout.waypoint_reached, R.id.title, points, activePoints) {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void buildDividers() {
|
|
||||||
dividers = getCustomDividers(ctx, getObjects(), nightMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isEnabled(int position) {
|
|
||||||
Object obj = getItem(position);
|
|
||||||
boolean labelView = (obj instanceof Integer);
|
|
||||||
boolean topDividerView = (obj instanceof Boolean) && ((Boolean) obj);
|
|
||||||
boolean bottomDividerView = (obj instanceof Boolean) && !((Boolean) obj);
|
|
||||||
|
|
||||||
boolean enabled = !labelView && !topDividerView && !bottomDividerView;
|
|
||||||
|
|
||||||
if (enabled && obj instanceof RadiusItem) {
|
|
||||||
int type = ((RadiusItem) obj).type;
|
|
||||||
enabled = type != WaypointHelper.POI;
|
|
||||||
}
|
|
||||||
|
|
||||||
return enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
|
||||||
// User super class to create the View
|
|
||||||
View v = convertView;
|
|
||||||
final ArrayAdapter<Object> thisAdapter = this;
|
|
||||||
Object obj = getItem(position);
|
|
||||||
boolean labelView = (obj instanceof Integer);
|
|
||||||
boolean topDividerView = (obj instanceof Boolean) && ((Boolean) obj);
|
|
||||||
boolean bottomDividerView = (obj instanceof Boolean) && !((Boolean) obj);
|
|
||||||
if (obj instanceof RadiusItem) {
|
|
||||||
final int type = ((RadiusItem) obj).type;
|
|
||||||
v = createItemForRadiusProximity(ctx, type, running, position, thisAdapter, nightMode);
|
|
||||||
//Drawable d = new ColorDrawable(mapActivity.getResources().getColor(R.color.dashboard_divider_light));
|
|
||||||
AndroidUtils.setListItemBackground(mapActivity, v, nightMode);
|
|
||||||
} else if (labelView) {
|
|
||||||
v = createItemForCategory(ctx, (Integer) obj, running, position, thisAdapter, nightMode, helper);
|
|
||||||
AndroidUtils.setListItemBackground(mapActivity, v, nightMode);
|
|
||||||
} else if (topDividerView) {
|
|
||||||
v = ctx.getLayoutInflater().inflate(R.layout.card_top_divider, null);
|
|
||||||
AndroidUtils.setListBackground(mapActivity, v, nightMode);
|
|
||||||
} else if (bottomDividerView) {
|
|
||||||
v = ctx.getLayoutInflater().inflate(R.layout.card_bottom_divider, null);
|
|
||||||
AndroidUtils.setListBackground(mapActivity, v, nightMode);
|
|
||||||
} else if (obj instanceof LocationPointWrapper) {
|
|
||||||
LocationPointWrapper point = (LocationPointWrapper) obj;
|
|
||||||
v = updateWaypointItemView(edit, deletedPoints, app, ctx, helper, v, point, this,
|
|
||||||
nightMode, flat);
|
|
||||||
AndroidUtils.setListItemBackground(mapActivity, v, nightMode);
|
|
||||||
}
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
for (Object p : points) {
|
|
||||||
if (p instanceof LocationPointWrapper) {
|
|
||||||
LocationPointWrapper w = (LocationPointWrapper) p;
|
|
||||||
if (w.type == WaypointHelper.TARGETS) {
|
|
||||||
final TargetPoint t = (TargetPoint) w.point;
|
|
||||||
if (t.getOriginalPointDescription() != null
|
|
||||||
&& t.getOriginalPointDescription().isSearchingAddress(mapActivity)) {
|
|
||||||
GeocodingLookupService.AddressLookupRequest lookupRequest
|
|
||||||
= new GeocodingLookupService.AddressLookupRequest(t.point, new GeocodingLookupService.OnAddressLookupResult() {
|
|
||||||
@Override
|
|
||||||
public void geocodingDone(String address) {
|
|
||||||
if (!helperCallbacks.isEmpty()) {
|
|
||||||
for (WaypointDialogHelperCallbacks callback : helperCallbacks) {
|
|
||||||
callback.reloadAdapter();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
reloadListAdapter(listAdapter);
|
|
||||||
}
|
|
||||||
//updateRouteInfoMenu(ctx);
|
|
||||||
}
|
|
||||||
}, null);
|
|
||||||
app.getGeocodingLookupService().lookupAddress(lookupRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return listAdapter;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static View updateWaypointItemView(final boolean edit, final List<LocationPointWrapper> deletedPoints,
|
public static View updateWaypointItemView(final boolean edit, final List<LocationPointWrapper> deletedPoints,
|
||||||
final OsmandApplication app, final Activity ctx,
|
final OsmandApplication app, final Activity ctx,
|
||||||
final WaypointDialogHelper helper, View v,
|
final WaypointDialogHelper helper, View v,
|
||||||
|
@ -1129,42 +1028,20 @@ public class WaypointDialogHelper {
|
||||||
return R.string.shared_string_close;
|
return R.string.shared_string_close;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void openAddPointDialog(MapActivity mapActivity) {
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putBoolean(AddPointBottomSheetDialog.TARGET_KEY, false);
|
||||||
|
args.putBoolean(AddPointBottomSheetDialog.INTERMEDIATE_KEY, true);
|
||||||
|
AddPointBottomSheetDialog fragment = new AddPointBottomSheetDialog();
|
||||||
|
fragment.setArguments(args);
|
||||||
|
fragment.setUsedOnMap(false);
|
||||||
|
fragment.show(mapActivity.getSupportFragmentManager(), AddPointBottomSheetDialog.TAG);
|
||||||
|
}
|
||||||
|
|
||||||
private void onWaypointItemClick(BaseBottomSheetItem[] addWaypointItem) {
|
private void onWaypointItemClick(BaseBottomSheetItem[] addWaypointItem) {
|
||||||
final MapActivity mapActivity = getMapActivity();
|
final MapActivity mapActivity = getMapActivity();
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
final MapRouteInfoMenu routeMenu = mapActivity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu();
|
openAddPointDialog(mapActivity);
|
||||||
final ListPopupWindow popup = new ListPopupWindow(mapActivity);
|
|
||||||
popup.setAnchorView(addWaypointItem[0].getView());
|
|
||||||
popup.setDropDownGravity(Gravity.END | Gravity.TOP);
|
|
||||||
popup.setVerticalOffset(AndroidUtils.dpToPx(mapActivity, 48f));
|
|
||||||
popup.setModal(true);
|
|
||||||
popup.setAdapter(routeMenu.getIntermediatesPopupAdapter(mapActivity));
|
|
||||||
popup.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
||||||
boolean hideDashboard = false;
|
|
||||||
if (id == MapRouteInfoMenu.SPINNER_FAV_ID) {
|
|
||||||
routeMenu.selectFavorite(null, false, true);
|
|
||||||
} else if (id == MapRouteInfoMenu.SPINNER_MAP_ID) {
|
|
||||||
hideDashboard = true;
|
|
||||||
routeMenu.selectOnScreen(false, true);
|
|
||||||
} else if (id == MapRouteInfoMenu.SPINNER_ADDRESS_ID) {
|
|
||||||
mapActivity.showQuickSearch(MapActivity.ShowQuickSearchMode.INTERMEDIATE_SELECTION, false);
|
|
||||||
} else if (id == MapRouteInfoMenu.SPINNER_MAP_MARKER_MORE_ID) {
|
|
||||||
routeMenu.selectMapMarker(-1, false, true);
|
|
||||||
} else if (id == MapRouteInfoMenu.SPINNER_MAP_MARKER_1_ID) {
|
|
||||||
routeMenu.selectMapMarker(0, false, true);
|
|
||||||
} else if (id == MapRouteInfoMenu.SPINNER_MAP_MARKER_2_ID) {
|
|
||||||
routeMenu.selectMapMarker(1, false, true);
|
|
||||||
}
|
|
||||||
popup.dismiss();
|
|
||||||
dismiss();
|
|
||||||
if (hideDashboard) {
|
|
||||||
mapActivity.getDashboard().hideDashboard();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
popup.show();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,16 +15,13 @@ import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.support.v7.widget.AppCompatImageView;
|
import android.support.v7.widget.AppCompatImageView;
|
||||||
import android.view.MotionEvent;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.AdapterView;
|
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.HorizontalScrollView;
|
import android.widget.HorizontalScrollView;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.Spinner;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
|
@ -358,14 +355,17 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
public void updateInfo(final View main) {
|
public void updateInfo(final View main) {
|
||||||
mainView = main;
|
mainView = main;
|
||||||
nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||||
updateViaView(main);
|
|
||||||
updateFromSpinner(main);
|
updateStartPointView();
|
||||||
updateToSpinner(main);
|
updateWaypointsView();
|
||||||
updateApplicationModes(mainView);
|
updateFinishPointView();
|
||||||
updateApplicationModesOptions(main);
|
|
||||||
updateOptionsButtons(main);
|
updateApplicationModes();
|
||||||
|
updateApplicationModesOptions();
|
||||||
|
updateOptionsButtons();
|
||||||
|
|
||||||
routeCards.clear();
|
routeCards.clear();
|
||||||
|
|
||||||
if (isBasicRouteCalculated()) {
|
if (isBasicRouteCalculated()) {
|
||||||
GPXUtilities.GPXFile gpx = GPXUtilities.makeGpxFromRoute(routingHelper.getRoute());
|
GPXUtilities.GPXFile gpx = GPXUtilities.makeGpxFromRoute(routingHelper.getRoute());
|
||||||
if (gpx != null) {
|
if (gpx != null) {
|
||||||
|
@ -401,11 +401,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateApplicationModesOptions() {
|
public void updateApplicationModesOptions() {
|
||||||
updateApplicationModesOptions(mainView);
|
AppCompatImageView foldButtonView = (AppCompatImageView) mainView.findViewById(R.id.fold_button);
|
||||||
}
|
|
||||||
|
|
||||||
private void updateApplicationModesOptions(final View parentView) {
|
|
||||||
AppCompatImageView foldButtonView = (AppCompatImageView) parentView.findViewById(R.id.fold_button);
|
|
||||||
foldButtonView.setImageResource(currentMenuState == MenuState.HEADER_ONLY ?
|
foldButtonView.setImageResource(currentMenuState == MenuState.HEADER_ONLY ?
|
||||||
R.drawable.ic_action_arrow_up : R.drawable.ic_action_arrow_down);
|
R.drawable.ic_action_arrow_up : R.drawable.ic_action_arrow_down);
|
||||||
foldButtonView.setOnClickListener(new View.OnClickListener() {
|
foldButtonView.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -415,7 +411,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
parentView.findViewById(R.id.app_modes_options).setOnClickListener(new View.OnClickListener() {
|
mainView.findViewById(R.id.app_modes_options).setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
availableProfileDialog();
|
availableProfileDialog();
|
||||||
|
@ -429,7 +425,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
} else {
|
} else {
|
||||||
openMenuHeaderOnly();
|
openMenuHeaderOnly();
|
||||||
}
|
}
|
||||||
updateApplicationModesOptions(mainView);
|
updateApplicationModesOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void availableProfileDialog() {
|
private void availableProfileDialog() {
|
||||||
|
@ -457,7 +453,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
b.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
|
b.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
updateApplicationModes(mainView);
|
updateApplicationModes();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
b.setView(v);
|
b.setView(v);
|
||||||
|
@ -482,11 +478,11 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateApplicationModes(final View parentView) {
|
private void updateApplicationModes() {
|
||||||
final ApplicationMode am = routingHelper.getAppMode();
|
final ApplicationMode am = routingHelper.getAppMode();
|
||||||
final Set<ApplicationMode> selected = new HashSet<>();
|
final Set<ApplicationMode> selected = new HashSet<>();
|
||||||
selected.add(am);
|
selected.add(am);
|
||||||
ViewGroup vg = (ViewGroup) parentView.findViewById(R.id.app_modes);
|
ViewGroup vg = (ViewGroup) mainView.findViewById(R.id.app_modes);
|
||||||
vg.removeAllViews();
|
vg.removeAllViews();
|
||||||
View.OnClickListener listener = new View.OnClickListener() {
|
View.OnClickListener listener = new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -495,7 +491,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
ApplicationMode next = selected.iterator().next();
|
ApplicationMode next = selected.iterator().next();
|
||||||
updateApplicationMode(am, next);
|
updateApplicationMode(am, next);
|
||||||
}
|
}
|
||||||
updateOptionsButtons(mainView);
|
updateOptionsButtons();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
final List<ApplicationMode> values = new ArrayList<ApplicationMode>(ApplicationMode.values(mapActivity.getMyApplication()));
|
final List<ApplicationMode> values = new ArrayList<ApplicationMode>(ApplicationMode.values(mapActivity.getMyApplication()));
|
||||||
|
@ -541,7 +537,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateOptionsButtons(final View main) {
|
private void updateOptionsButtons() {
|
||||||
final boolean nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
final boolean nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||||
final OsmandSettings settings = app.getSettings();
|
final OsmandSettings settings = app.getSettings();
|
||||||
final int colorActive = ContextCompat.getColor(app, nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
final int colorActive = ContextCompat.getColor(app, nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
||||||
|
@ -550,17 +546,17 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
final RoutingOptionsHelper.RouteMenuAppModes mode = routingOptionsHelper.modes.get(applicationMode);
|
final RoutingOptionsHelper.RouteMenuAppModes mode = routingOptionsHelper.modes.get(applicationMode);
|
||||||
int margin = AndroidUtils.dpToPx(app, 3);
|
int margin = AndroidUtils.dpToPx(app, 3);
|
||||||
|
|
||||||
View startButton = main.findViewById(R.id.start_button);
|
View startButton = mainView.findViewById(R.id.start_button);
|
||||||
if (isRouteCalculated()) {
|
if (isRouteCalculated()) {
|
||||||
AndroidUtils.setBackground(app, startButton, nightMode, R.color.active_buttons_and_links_light, R.color.active_buttons_and_links_dark);
|
AndroidUtils.setBackground(app, startButton, nightMode, R.color.active_buttons_and_links_light, R.color.active_buttons_and_links_dark);
|
||||||
int color = nightMode ? R.color.main_font_dark : R.color.card_and_list_background_light;
|
int color = nightMode ? R.color.main_font_dark : R.color.card_and_list_background_light;
|
||||||
((TextView) main.findViewById(R.id.start_button_descr)).setTextColor(ContextCompat.getColor(app, color));
|
((TextView) mainView.findViewById(R.id.start_button_descr)).setTextColor(ContextCompat.getColor(app, color));
|
||||||
((ImageView) main.findViewById(R.id.start_icon)).setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_start_navigation, color));
|
((ImageView) mainView.findViewById(R.id.start_icon)).setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_start_navigation, color));
|
||||||
} else {
|
} else {
|
||||||
AndroidUtils.setBackground(app, startButton, nightMode, R.color.activity_background_light, R.color.route_info_cancel_button_color_dark);
|
AndroidUtils.setBackground(app, startButton, nightMode, R.color.activity_background_light, R.color.route_info_cancel_button_color_dark);
|
||||||
int color = R.color.description_font_and_bottom_sheet_icons;
|
int color = R.color.description_font_and_bottom_sheet_icons;
|
||||||
((TextView) main.findViewById(R.id.start_button_descr)).setTextColor(ContextCompat.getColor(app, color));
|
((TextView) mainView.findViewById(R.id.start_button_descr)).setTextColor(ContextCompat.getColor(app, color));
|
||||||
((ImageView) main.findViewById(R.id.start_icon)).setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_start_navigation, color));
|
((ImageView) mainView.findViewById(R.id.start_icon)).setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_start_navigation, color));
|
||||||
}
|
}
|
||||||
startButton.setOnClickListener(new View.OnClickListener() {
|
startButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -569,7 +565,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
View cancelButton = main.findViewById(R.id.cancel_button);
|
View cancelButton = mainView.findViewById(R.id.cancel_button);
|
||||||
AndroidUtils.setBackground(app, cancelButton, nightMode, R.color.card_and_list_background_light, R.color.card_and_list_background_dark);
|
AndroidUtils.setBackground(app, cancelButton, nightMode, R.color.card_and_list_background_light, R.color.card_and_list_background_dark);
|
||||||
cancelButton.setOnClickListener(new View.OnClickListener() {
|
cancelButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -578,9 +574,9 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
LinearLayout optionsButton = (LinearLayout) main.findViewById(R.id.map_options_route_button);
|
LinearLayout optionsButton = (LinearLayout) mainView.findViewById(R.id.map_options_route_button);
|
||||||
TextView optionsTitle = (TextView) main.findViewById(R.id.map_options_route_button_title);
|
TextView optionsTitle = (TextView) mainView.findViewById(R.id.map_options_route_button_title);
|
||||||
ImageView optionsIcon = (ImageView) main.findViewById(R.id.map_options_route_button_icon);
|
ImageView optionsIcon = (ImageView) mainView.findViewById(R.id.map_options_route_button_icon);
|
||||||
Drawable drawable = app.getUIUtilities().getIcon(R.drawable.map_action_settings, nightMode ? R.color.route_info_control_icon_color_dark : R.color.route_info_control_icon_color_light);
|
Drawable drawable = app.getUIUtilities().getIcon(R.drawable.map_action_settings, nightMode ? R.color.route_info_control_icon_color_dark : R.color.route_info_control_icon_color_light);
|
||||||
if (Build.VERSION.SDK_INT >= 21) {
|
if (Build.VERSION.SDK_INT >= 21) {
|
||||||
Drawable active = app.getUIUtilities().getIcon(R.drawable.map_action_settings, nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
Drawable active = app.getUIUtilities().getIcon(R.drawable.map_action_settings, nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
||||||
|
@ -599,7 +595,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
scrollView.setVerticalScrollBarEnabled(false);
|
scrollView.setVerticalScrollBarEnabled(false);
|
||||||
scrollView.setHorizontalScrollBarEnabled(false);
|
scrollView.setHorizontalScrollBarEnabled(false);
|
||||||
|
|
||||||
LinearLayout optionsContainer = (LinearLayout) main.findViewById(R.id.route_options_container);
|
LinearLayout optionsContainer = (LinearLayout) mainView.findViewById(R.id.route_options_container);
|
||||||
optionsContainer.removeAllViews();
|
optionsContainer.removeAllViews();
|
||||||
if (mode == null) {
|
if (mode == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -658,7 +654,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
app.getPoiFilters().removeSelectedPoiFilter(poiUIFilter);
|
app.getPoiFilters().removeSelectedPoiFilter(poiUIFilter);
|
||||||
mapActivity.getMapView().refreshMap();
|
mapActivity.getMapView().refreshMap();
|
||||||
updateOptionsButtons(mainView);
|
updateOptionsButtons();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
item.addView(container, newLp);
|
item.addView(container, newLp);
|
||||||
|
@ -672,7 +668,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
app.getWaypointHelper().enableWaypointType(WaypointHelper.ALARMS, false);
|
app.getWaypointHelper().enableWaypointType(WaypointHelper.ALARMS, false);
|
||||||
updateOptionsButtons(mainView);
|
updateOptionsButtons();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
AndroidUtils.setBackground(app, container, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark);
|
AndroidUtils.setBackground(app, container, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark);
|
||||||
|
@ -686,7 +682,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
app.getWaypointHelper().enableWaypointType(WaypointHelper.FAVORITES, false);
|
app.getWaypointHelper().enableWaypointType(WaypointHelper.FAVORITES, false);
|
||||||
updateOptionsButtons(mainView);
|
updateOptionsButtons();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
AndroidUtils.setBackground(app, container, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark);
|
AndroidUtils.setBackground(app, container, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark);
|
||||||
|
@ -723,7 +719,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
if (mode.parameters.size() > 2) {
|
if (mode.parameters.size() > 2) {
|
||||||
item.removeView(v);
|
item.removeView(v);
|
||||||
} else {
|
} else {
|
||||||
updateOptionsButtons(mainView);
|
updateOptionsButtons();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -757,7 +753,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
if (mode.parameters.size() > 2) {
|
if (mode.parameters.size() > 2) {
|
||||||
item.removeView(v);
|
item.removeView(v);
|
||||||
} else {
|
} else {
|
||||||
updateOptionsButtons(mainView);
|
updateOptionsButtons();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -777,7 +773,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
routingOptionsHelper.showLocalRoutingParameterGroupDialog(group, mapActivity, new RoutingOptionsHelper.OnClickListener() {
|
routingOptionsHelper.showLocalRoutingParameterGroupDialog(group, mapActivity, new RoutingOptionsHelper.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick() {
|
public void onClick() {
|
||||||
updateOptionsButtons(mainView);
|
updateOptionsButtons();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -915,46 +911,33 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
RouteOptionsBottomSheet.showInstance(mapActivity.getSupportFragmentManager());
|
RouteOptionsBottomSheet.showInstance(mapActivity.getSupportFragmentManager());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clickRouteWaypoints() {
|
private void updateWaypointsView() {
|
||||||
if (getTargets().checkPointToNavigateShort()) {
|
|
||||||
mapActivity.getMapActions().openIntermediatePointsDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateViaView(final View parentView) {
|
|
||||||
String via = generateViaDescription();
|
String via = generateViaDescription();
|
||||||
View viaLayout = parentView.findViewById(R.id.ViaLayout);
|
View viaLayout = mainView.findViewById(R.id.ViaLayout);
|
||||||
View viaLayoutDivider = parentView.findViewById(R.id.viaLayoutDivider);
|
View viaLayoutDivider = mainView.findViewById(R.id.viaLayoutDivider);
|
||||||
if (via.length() == 0) {
|
if (via.length() == 0) {
|
||||||
viaLayout.setVisibility(View.GONE);
|
viaLayout.setVisibility(View.GONE);
|
||||||
viaLayoutDivider.setVisibility(View.GONE);
|
viaLayoutDivider.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
viaLayout.setVisibility(View.VISIBLE);
|
viaLayout.setVisibility(View.VISIBLE);
|
||||||
viaLayoutDivider.setVisibility(View.VISIBLE);
|
viaLayoutDivider.setVisibility(View.VISIBLE);
|
||||||
((TextView) parentView.findViewById(R.id.ViaView)).setText(via);
|
((TextView) mainView.findViewById(R.id.ViaView)).setText(via);
|
||||||
((TextView) parentView.findViewById(R.id.ViaSubView)).setText(app.getString(R.string.intermediate_destinations, getTargets().getIntermediatePoints().size()));
|
((TextView) mainView.findViewById(R.id.ViaSubView)).setText(app.getString(R.string.intermediate_destinations, getTargets().getIntermediatePoints().size()));
|
||||||
}
|
}
|
||||||
FrameLayout viaButton = (FrameLayout) parentView.findViewById(R.id.via_button);
|
FrameLayout viaButton = (FrameLayout) mainView.findViewById(R.id.via_button);
|
||||||
|
|
||||||
viaButton.setOnClickListener(new View.OnClickListener() {
|
viaButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
// clickRouteWaypoints();
|
|
||||||
if (getTargets().checkPointToNavigateShort()) {
|
if (getTargets().checkPointToNavigateShort()) {
|
||||||
WaypointsFragment.showInstance(mapActivity);
|
WaypointsFragment.showInstance(mapActivity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ImageView viaIcon = (ImageView) parentView.findViewById(R.id.viaIcon);
|
ImageView viaIcon = (ImageView) mainView.findViewById(R.id.viaIcon);
|
||||||
viaIcon.setImageDrawable(getIconOrig(R.drawable.list_intermediate));
|
viaIcon.setImageDrawable(getIconOrig(R.drawable.list_intermediate));
|
||||||
viaIcon.setOnClickListener(new View.OnClickListener() {
|
LinearLayout viaButtonContainer = (LinearLayout) mainView.findViewById(R.id.via_button_container);
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
clickRouteWaypoints();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
LinearLayout viaButtonContainer = (LinearLayout) parentView.findViewById(R.id.via_button_container);
|
|
||||||
|
|
||||||
AndroidUtils.setBackground(app, viaButton, nightMode, R.drawable.btn_border_trans_rounded_light, R.drawable.btn_border_trans_rounded_dark);
|
AndroidUtils.setBackground(app, viaButton, nightMode, R.drawable.btn_border_trans_rounded_light, R.drawable.btn_border_trans_rounded_dark);
|
||||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
@ -962,7 +945,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
} else {
|
} else {
|
||||||
AndroidUtils.setBackground(app, viaButtonContainer, nightMode, R.drawable.ripple_rounded_light, R.drawable.ripple_rounded_dark);
|
AndroidUtils.setBackground(app, viaButtonContainer, nightMode, R.drawable.ripple_rounded_light, R.drawable.ripple_rounded_dark);
|
||||||
}
|
}
|
||||||
ImageView viaButtonImageView = (ImageView) parentView.findViewById(R.id.via_button_image_view);
|
ImageView viaButtonImageView = (ImageView) mainView.findViewById(R.id.via_button_image_view);
|
||||||
|
|
||||||
Drawable normal = mapActivity.getMyApplication().getUIUtilities().getIcon(R.drawable.ic_action_edit_dark, nightMode ? R.color.route_info_control_icon_color_dark : R.color.route_info_control_icon_color_light);
|
Drawable normal = mapActivity.getMyApplication().getUIUtilities().getIcon(R.drawable.ic_action_edit_dark, nightMode ? R.color.route_info_control_icon_color_dark : R.color.route_info_control_icon_color_light);
|
||||||
if (Build.VERSION.SDK_INT >= 21) {
|
if (Build.VERSION.SDK_INT >= 21) {
|
||||||
|
@ -973,50 +956,9 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
viaButtonImageView.setImageDrawable(normal);
|
viaButtonImageView.setImageDrawable(normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateToSpinner(final View parentView) {
|
private void updateFinishPointView() {
|
||||||
final Spinner toSpinner = setupToSpinner(parentView);
|
setupToText(mainView);
|
||||||
toSpinner.setClickable(false);
|
final View toLayout = mainView.findViewById(R.id.ToLayout);
|
||||||
final View toLayout = parentView.findViewById(R.id.ToLayout);
|
|
||||||
toSpinner.setOnTouchListener(new View.OnTouchListener() {
|
|
||||||
@Override
|
|
||||||
public boolean onTouch(View v, MotionEvent event) {
|
|
||||||
event.offsetLocation(AndroidUtils.dpToPx(mapActivity, 48f), 0);
|
|
||||||
toLayout.onTouchEvent(event);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
toSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
||||||
@Override
|
|
||||||
public void onItemSelected(AdapterView<?> parent, View view, int position, final long id) {
|
|
||||||
parentView.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (id == SPINNER_FAV_ID) {
|
|
||||||
selectFavorite(parentView, true, false);
|
|
||||||
} else if (id == SPINNER_MAP_ID) {
|
|
||||||
selectOnScreen(true, false);
|
|
||||||
} else if (id == SPINNER_ADDRESS_ID) {
|
|
||||||
mapActivity.showQuickSearch(MapActivity.ShowQuickSearchMode.DESTINATION_SELECTION, false);
|
|
||||||
setupToSpinner(parentView);
|
|
||||||
} else if (id == SPINNER_MAP_MARKER_MORE_ID) {
|
|
||||||
selectMapMarker(-1, true, false);
|
|
||||||
setupToSpinner(parentView);
|
|
||||||
} else if (id == SPINNER_MAP_MARKER_1_ID) {
|
|
||||||
selectMapMarker(0, true, false);
|
|
||||||
} else if (id == SPINNER_MAP_MARKER_2_ID) {
|
|
||||||
selectMapMarker(1, true, false);
|
|
||||||
} else if (id == SPINNER_MAP_MARKER_3_ID) {
|
|
||||||
selectMapMarker(2, true, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onNothingSelected(AdapterView<?> parent) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
toLayout.setOnClickListener(new View.OnClickListener() {
|
toLayout.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -1024,8 +966,8 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
final FrameLayout toButton = (FrameLayout) parentView.findViewById(R.id.to_button);
|
final FrameLayout toButton = (FrameLayout) mainView.findViewById(R.id.to_button);
|
||||||
final LinearLayout toButtonContainer = (LinearLayout) parentView.findViewById(R.id.to_button_container);
|
final LinearLayout toButtonContainer = (LinearLayout) mainView.findViewById(R.id.to_button_container);
|
||||||
|
|
||||||
AndroidUtils.setBackground(app, toButton, nightMode, R.drawable.btn_border_trans_rounded_light, R.drawable.btn_border_trans_rounded_dark);
|
AndroidUtils.setBackground(app, toButton, nightMode, R.drawable.btn_border_trans_rounded_light, R.drawable.btn_border_trans_rounded_dark);
|
||||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
@ -1033,7 +975,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
} else {
|
} else {
|
||||||
AndroidUtils.setBackground(app, toButtonContainer, nightMode, R.drawable.ripple_rounded_light, R.drawable.ripple_rounded_dark);
|
AndroidUtils.setBackground(app, toButtonContainer, nightMode, R.drawable.ripple_rounded_light, R.drawable.ripple_rounded_dark);
|
||||||
}
|
}
|
||||||
ImageView toButtonImageView = (ImageView) parentView.findViewById(R.id.to_button_image_view);
|
ImageView toButtonImageView = (ImageView) mainView.findViewById(R.id.to_button_image_view);
|
||||||
|
|
||||||
Drawable normal = mapActivity.getMyApplication().getUIUtilities().getIcon(R.drawable.ic_action_plus, nightMode ? R.color.route_info_control_icon_color_dark : R.color.route_info_control_icon_color_light);
|
Drawable normal = mapActivity.getMyApplication().getUIUtilities().getIcon(R.drawable.ic_action_plus, nightMode ? R.color.route_info_control_icon_color_dark : R.color.route_info_control_icon_color_light);
|
||||||
if (Build.VERSION.SDK_INT >= 21) {
|
if (Build.VERSION.SDK_INT >= 21) {
|
||||||
|
@ -1050,7 +992,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
updateToIcon(parentView);
|
updateToIcon(mainView);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateToIcon(View parentView) {
|
private void updateToIcon(View parentView) {
|
||||||
|
@ -1058,58 +1000,9 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
toIcon.setImageDrawable(getIconOrig(R.drawable.list_destination));
|
toIcon.setImageDrawable(getIconOrig(R.drawable.list_destination));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateFromSpinner(final View parentView) {
|
private void updateStartPointView() {
|
||||||
final TargetPointsHelper targets = getTargets();
|
setupFromText(mainView);
|
||||||
final Spinner fromSpinner = setupFromSpinner(parentView);
|
final View fromLayout = mainView.findViewById(R.id.FromLayout);
|
||||||
fromSpinner.setClickable(false);
|
|
||||||
final View fromLayout = parentView.findViewById(R.id.FromLayout);
|
|
||||||
fromSpinner.setOnTouchListener(new View.OnTouchListener() {
|
|
||||||
@Override
|
|
||||||
public boolean onTouch(View v, MotionEvent event) {
|
|
||||||
event.offsetLocation(AndroidUtils.dpToPx(mapActivity, 48f), 0);
|
|
||||||
fromLayout.onTouchEvent(event);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
fromSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onItemSelected(AdapterView<?> parent, View view, int position, final long id) {
|
|
||||||
parentView.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (id == SPINNER_MY_LOCATION_ID) {
|
|
||||||
if (targets.getPointToStart() != null) {
|
|
||||||
targets.clearStartPoint(true);
|
|
||||||
mapActivity.getMyApplication().getSettings().backupPointToStart();
|
|
||||||
}
|
|
||||||
updateFromIcon(parentView);
|
|
||||||
} else if (id == SPINNER_FAV_ID) {
|
|
||||||
selectFavorite(parentView, false, false);
|
|
||||||
} else if (id == SPINNER_MAP_ID) {
|
|
||||||
selectOnScreen(false, false);
|
|
||||||
} else if (id == SPINNER_ADDRESS_ID) {
|
|
||||||
mapActivity.showQuickSearch(MapActivity.ShowQuickSearchMode.START_POINT_SELECTION, false);
|
|
||||||
setupFromSpinner(parentView);
|
|
||||||
} else if (id == SPINNER_MAP_MARKER_MORE_ID) {
|
|
||||||
selectMapMarker(-1, false, false);
|
|
||||||
setupFromSpinner(parentView);
|
|
||||||
} else if (id == SPINNER_MAP_MARKER_1_ID) {
|
|
||||||
selectMapMarker(0, false, false);
|
|
||||||
} else if (id == SPINNER_MAP_MARKER_2_ID) {
|
|
||||||
selectMapMarker(1, false, false);
|
|
||||||
} else if (id == SPINNER_MAP_MARKER_3_ID) {
|
|
||||||
selectMapMarker(2, false, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onNothingSelected(AdapterView<?> parent) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
fromLayout.setOnClickListener(new View.OnClickListener() {
|
fromLayout.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -1117,8 +1010,8 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
FrameLayout fromButton = (FrameLayout) parentView.findViewById(R.id.from_button);
|
FrameLayout fromButton = (FrameLayout) mainView.findViewById(R.id.from_button);
|
||||||
final LinearLayout fromButtonContainer = (LinearLayout) parentView.findViewById(R.id.from_button_container);
|
final LinearLayout fromButtonContainer = (LinearLayout) mainView.findViewById(R.id.from_button_container);
|
||||||
|
|
||||||
AndroidUtils.setBackground(app, fromButton, nightMode, R.drawable.btn_border_trans_rounded_light, R.drawable.btn_border_trans_rounded_dark);
|
AndroidUtils.setBackground(app, fromButton, nightMode, R.drawable.btn_border_trans_rounded_light, R.drawable.btn_border_trans_rounded_dark);
|
||||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
@ -1127,7 +1020,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
AndroidUtils.setBackground(app, fromButtonContainer, nightMode, R.drawable.ripple_rounded_light, R.drawable.ripple_rounded_dark);
|
AndroidUtils.setBackground(app, fromButtonContainer, nightMode, R.drawable.ripple_rounded_light, R.drawable.ripple_rounded_dark);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageView swapDirectionView = (ImageView) parentView.findViewById(R.id.from_button_image_view);
|
ImageView swapDirectionView = (ImageView) mainView.findViewById(R.id.from_button_image_view);
|
||||||
|
|
||||||
Drawable normal = mapActivity.getMyApplication().getUIUtilities().getIcon(R.drawable.ic_action_change_navigation_points, nightMode ? R.color.route_info_control_icon_color_dark : R.color.route_info_control_icon_color_light);
|
Drawable normal = mapActivity.getMyApplication().getUIUtilities().getIcon(R.drawable.ic_action_change_navigation_points, nightMode ? R.color.route_info_control_icon_color_dark : R.color.route_info_control_icon_color_light);
|
||||||
if (Build.VERSION.SDK_INT >= 21) {
|
if (Build.VERSION.SDK_INT >= 21) {
|
||||||
|
@ -1160,7 +1053,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
updateFromIcon(parentView);
|
updateFromIcon(mainView);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateFromIcon(View parentView) {
|
public void updateFromIcon(View parentView) {
|
||||||
|
@ -1200,9 +1093,9 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
public void setupSpinners(final boolean target, final boolean intermediate) {
|
public void setupSpinners(final boolean target, final boolean intermediate) {
|
||||||
if (!intermediate && mainView != null) {
|
if (!intermediate && mainView != null) {
|
||||||
if (target) {
|
if (target) {
|
||||||
setupToSpinner(mainView);
|
setupToText(mainView);
|
||||||
} else {
|
} else {
|
||||||
setupFromSpinner(mainView);
|
setupFromText(mainView);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1337,24 +1230,12 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
private Spinner setupFromSpinner(View view) {
|
private void setupFromText(View view) {
|
||||||
List<RouteSpinnerRow> fromActions = new ArrayList<>();
|
|
||||||
fromActions.add(new RouteSpinnerRow(SPINNER_MY_LOCATION_ID, R.drawable.ic_action_get_my_location,
|
|
||||||
mapActivity.getString(R.string.shared_string_my_location)));
|
|
||||||
fromActions.add(new RouteSpinnerRow(SPINNER_FAV_ID, R.drawable.ic_action_fav_dark,
|
|
||||||
mapActivity.getString(R.string.shared_string_favorite) + mapActivity.getString(R.string.shared_string_ellipsis)));
|
|
||||||
fromActions.add(new RouteSpinnerRow(SPINNER_MAP_ID, R.drawable.ic_action_marker_dark,
|
|
||||||
mapActivity.getString(R.string.shared_string_select_on_map)));
|
|
||||||
fromActions.add(new RouteSpinnerRow(SPINNER_ADDRESS_ID, R.drawable.ic_action_home_dark,
|
|
||||||
mapActivity.getString(R.string.shared_string_address) + mapActivity.getString(R.string.shared_string_ellipsis)));
|
|
||||||
|
|
||||||
TargetPoint start = getTargets().getPointToStart();
|
TargetPoint start = getTargets().getPointToStart();
|
||||||
int startPos = -1;
|
String name = null;
|
||||||
if (start != null) {
|
if (start != null) {
|
||||||
String oname = start.getOnlyName().length() > 0 ? start.getOnlyName()
|
name = start.getOnlyName().length() > 0 ? start.getOnlyName() :
|
||||||
: (mapActivity.getString(R.string.route_descr_map_location) + " " + getRoutePointDescription(start.getLatitude(), start.getLongitude()));
|
(mapActivity.getString(R.string.route_descr_map_location) + " " + getRoutePointDescription(start.getLatitude(), start.getLongitude()));
|
||||||
startPos = fromActions.size();
|
|
||||||
fromActions.add(new RouteSpinnerRow(SPINNER_START_ID, R.drawable.ic_action_get_my_location, oname));
|
|
||||||
|
|
||||||
final LatLon latLon = start.point;
|
final LatLon latLon = start.point;
|
||||||
final PointDescription pointDescription = start.getOriginalPointDescription();
|
final PointDescription pointDescription = start.getOriginalPointDescription();
|
||||||
|
@ -1372,35 +1253,21 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addMarkersToSpinner(fromActions);
|
final TextView fromText = ((TextView) view.findViewById(R.id.fromText));
|
||||||
|
|
||||||
final Spinner fromSpinner = ((Spinner) view.findViewById(R.id.FromSpinner));
|
|
||||||
RouteSpinnerArrayAdapter fromAdapter = new RouteSpinnerArrayAdapter(view.getContext());
|
|
||||||
for (RouteSpinnerRow row : fromActions) {
|
|
||||||
fromAdapter.add(row);
|
|
||||||
}
|
|
||||||
fromSpinner.setAdapter(fromAdapter);
|
|
||||||
if (start != null) {
|
if (start != null) {
|
||||||
fromSpinner.setSelection(startPos);
|
fromText.setText(name);
|
||||||
} else {
|
} else {
|
||||||
if (mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation() == null) {
|
fromText.setText(R.string.shared_string_my_location);
|
||||||
fromSpinner.setPromptId(R.string.search_poi_location);
|
|
||||||
}
|
}
|
||||||
//fromSpinner.setSelection(0);
|
|
||||||
}
|
|
||||||
return fromSpinner;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Spinner setupToSpinner(View view) {
|
private void setupToText(View view) {
|
||||||
final Spinner toSpinner = ((Spinner) view.findViewById(R.id.ToSpinner));
|
final TextView toText = ((TextView) view.findViewById(R.id.toText));
|
||||||
final TargetPointsHelper targets = getTargets();
|
final TargetPointsHelper targets = getTargets();
|
||||||
List<RouteSpinnerRow> toActions = new ArrayList<>();
|
|
||||||
|
|
||||||
TargetPoint finish = getTargets().getPointToNavigate();
|
TargetPoint finish = getTargets().getPointToNavigate();
|
||||||
if (finish != null) {
|
if (finish != null) {
|
||||||
toActions.add(new RouteSpinnerRow(SPINNER_FINISH_ID, R.drawable.ic_action_get_my_location,
|
toText.setText(getRoutePointDescription(targets.getPointToNavigate().point,
|
||||||
getRoutePointDescription(targets.getPointToNavigate().point,
|
targets.getPointToNavigate().getOnlyName()));
|
||||||
targets.getPointToNavigate().getOnlyName())));
|
|
||||||
|
|
||||||
final LatLon latLon = finish.point;
|
final LatLon latLon = finish.point;
|
||||||
final PointDescription pointDescription = finish.getOriginalPointDescription();
|
final PointDescription pointDescription = finish.getOriginalPointDescription();
|
||||||
|
@ -1418,25 +1285,8 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
toSpinner.setPromptId(R.string.route_descr_select_destination);
|
toText.setText(R.string.route_descr_select_destination);
|
||||||
toActions.add(new RouteSpinnerRow(SPINNER_HINT_ID, R.drawable.ic_action_get_my_location,
|
|
||||||
mapActivity.getString(R.string.route_descr_select_destination)));
|
|
||||||
}
|
}
|
||||||
toActions.add(new RouteSpinnerRow(SPINNER_FAV_ID, R.drawable.ic_action_fav_dark,
|
|
||||||
mapActivity.getString(R.string.shared_string_favorite) + mapActivity.getString(R.string.shared_string_ellipsis)));
|
|
||||||
toActions.add(new RouteSpinnerRow(SPINNER_MAP_ID, R.drawable.ic_action_marker_dark,
|
|
||||||
mapActivity.getString(R.string.shared_string_select_on_map)));
|
|
||||||
toActions.add(new RouteSpinnerRow(SPINNER_ADDRESS_ID, R.drawable.ic_action_home_dark,
|
|
||||||
mapActivity.getString(R.string.shared_string_address) + mapActivity.getString(R.string.shared_string_ellipsis)));
|
|
||||||
|
|
||||||
addMarkersToSpinner(toActions);
|
|
||||||
|
|
||||||
RouteSpinnerArrayAdapter toAdapter = new RouteSpinnerArrayAdapter(view.getContext());
|
|
||||||
for (RouteSpinnerRow row : toActions) {
|
|
||||||
toAdapter.add(row);
|
|
||||||
}
|
|
||||||
toSpinner.setAdapter(toAdapter);
|
|
||||||
return toSpinner;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public RoutePopupListArrayAdapter getIntermediatesPopupAdapter(Context ctx) {
|
public RoutePopupListArrayAdapter getIntermediatesPopupAdapter(Context ctx) {
|
||||||
|
|
|
@ -142,13 +142,6 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
|
||||||
bottomScrollView.setScrollingEnabled(false);
|
bottomScrollView.setScrollingEnabled(false);
|
||||||
bottomScrollView.setBackgroundColor(getResources().getColor(nightMode ? R.color.activity_background_dark : R.color.activity_background_light));
|
bottomScrollView.setBackgroundColor(getResources().getColor(nightMode ? R.color.activity_background_dark : R.color.activity_background_light));
|
||||||
|
|
||||||
FrameLayout bottomContainer = (FrameLayout) view.findViewById(R.id.bottom_container);
|
|
||||||
if (!menu.isRouteCalculated()) {
|
|
||||||
bottomContainer.setForeground(getContentIcon(R.drawable.bg_contextmenu_shadow));
|
|
||||||
} else {
|
|
||||||
bottomContainer.setForeground(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
cardsContainer = (LinearLayout) view.findViewById(R.id.route_menu_cards_container);
|
cardsContainer = (LinearLayout) view.findViewById(R.id.route_menu_cards_container);
|
||||||
|
|
||||||
buildBottomView();
|
buildBottomView();
|
||||||
|
@ -182,8 +175,6 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
|
||||||
private boolean slidingUp;
|
private boolean slidingUp;
|
||||||
private boolean slidingDown;
|
private boolean slidingDown;
|
||||||
|
|
||||||
private boolean hasMoved;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
scroller = new OverScroller(getMapActivity());
|
scroller = new OverScroller(getMapActivity());
|
||||||
final ViewConfiguration configuration = ViewConfiguration.get(getMapActivity());
|
final ViewConfiguration configuration = ViewConfiguration.get(getMapActivity());
|
||||||
|
@ -205,7 +196,6 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
|
||||||
|
|
||||||
switch (event.getAction()) {
|
switch (event.getAction()) {
|
||||||
case MotionEvent.ACTION_DOWN:
|
case MotionEvent.ACTION_DOWN:
|
||||||
hasMoved = false;
|
|
||||||
mDownY = event.getRawY();
|
mDownY = event.getRawY();
|
||||||
dy = event.getY();
|
dy = event.getY();
|
||||||
dyMain = getViewY();
|
dyMain = getViewY();
|
||||||
|
@ -219,7 +209,6 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
|
||||||
moving = true;
|
moving = true;
|
||||||
}
|
}
|
||||||
if (moving) {
|
if (moving) {
|
||||||
hasMoved = true;
|
|
||||||
float y = event.getY();
|
float y = event.getY();
|
||||||
float newY = getViewY() + (y - dy);
|
float newY = getViewY() + (y - dy);
|
||||||
if (!portrait && newY > topScreenPosY) {
|
if (!portrait && newY > topScreenPosY) {
|
||||||
|
@ -248,7 +237,6 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
|
||||||
case MotionEvent.ACTION_UP:
|
case MotionEvent.ACTION_UP:
|
||||||
if (moving) {
|
if (moving) {
|
||||||
moving = false;
|
moving = false;
|
||||||
hasMoved = false;
|
|
||||||
int currentY = getViewY();
|
int currentY = getViewY();
|
||||||
|
|
||||||
final VelocityTracker velocityTracker = this.velocityTracker;
|
final VelocityTracker velocityTracker = this.velocityTracker;
|
||||||
|
@ -278,7 +266,6 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
|
||||||
break;
|
break;
|
||||||
case MotionEvent.ACTION_CANCEL:
|
case MotionEvent.ACTION_CANCEL:
|
||||||
moving = false;
|
moving = false;
|
||||||
hasMoved = false;
|
|
||||||
recycleVelocityTracker();
|
recycleVelocityTracker();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -949,13 +936,6 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
|
||||||
ctx.setupRouteCalculationProgressBar((ProgressBar) mainView.findViewById(R.id.progress_bar));
|
ctx.setupRouteCalculationProgressBar((ProgressBar) mainView.findViewById(R.id.progress_bar));
|
||||||
setupRouteCalculationButtonProgressBar((ProgressBar) view.findViewById(R.id.progress_bar_button));
|
setupRouteCalculationButtonProgressBar((ProgressBar) view.findViewById(R.id.progress_bar_button));
|
||||||
|
|
||||||
FrameLayout bottomContainer = (FrameLayout) view.findViewById(R.id.bottom_container);
|
|
||||||
if (!menu.isRouteCalculated()) {
|
|
||||||
bottomContainer.setForeground(getContentIcon(R.drawable.bg_contextmenu_shadow));
|
|
||||||
} else {
|
|
||||||
bottomContainer.setForeground(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
updateControlButtons();
|
updateControlButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@ import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
|
||||||
import net.osmand.Location;
|
import net.osmand.Location;
|
||||||
import net.osmand.binary.RouteDataObject;
|
import net.osmand.binary.RouteDataObject;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
|
@ -31,12 +30,12 @@ import net.osmand.plus.OsmandSettings.RulerMode;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.actions.StartGPSStatus;
|
import net.osmand.plus.activities.actions.StartGPSStatus;
|
||||||
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
|
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
import net.osmand.plus.helpers.WaypointDialogHelper;
|
import net.osmand.plus.helpers.WaypointDialogHelper;
|
||||||
import net.osmand.plus.helpers.WaypointHelper;
|
import net.osmand.plus.helpers.WaypointHelper;
|
||||||
import net.osmand.plus.helpers.WaypointHelper.LocationPointWrapper;
|
import net.osmand.plus.helpers.WaypointHelper.LocationPointWrapper;
|
||||||
import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu;
|
import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu;
|
||||||
|
import net.osmand.plus.routepreparationmenu.WaypointsFragment;
|
||||||
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;
|
||||||
|
@ -1004,7 +1003,7 @@ public class MapInfoWidgetsFactory {
|
||||||
all.setOnClickListener(new OnClickListener() {
|
all.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
map.getDashboard().setDashboardVisibility(true, DashboardType.WAYPOINTS, AndroidUtils.getCenterViewCoordinates(view));
|
WaypointsFragment.showInstance(map);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
remove.setOnClickListener(new OnClickListener() {
|
remove.setOnClickListener(new OnClickListener() {
|
||||||
|
|
Loading…
Reference in a new issue