Update route preparation
This commit is contained in:
parent
3172aef7c5
commit
f74c332d41
16 changed files with 106 additions and 77 deletions
|
@ -5,8 +5,12 @@
|
|||
android:orientation="horizontal"
|
||||
android:weightSum="1" >
|
||||
|
||||
<View android:layout_width="@dimen/map_route_planning_land_width"
|
||||
android:layout_height="0dp"
|
||||
android:id="@+id/map_route_land_left_margin"
|
||||
android:layout_gravity="top|left"
|
||||
android:visibility="gone" />
|
||||
<!-- LEFT widgets colon -->
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -54,7 +54,7 @@ import net.osmand.plus.TargetPointsHelper;
|
|||
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
import net.osmand.plus.helpers.ColorDialogs;
|
||||
import net.osmand.plus.helpers.ScreenOrientationHelper;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.plus.myplaces.FavoritesActivity;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
||||
|
@ -371,7 +371,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
|
|||
}
|
||||
});
|
||||
|
||||
if (ScreenOrientationHelper.isOrientationPortrait(getActivity())) {
|
||||
if (AndroidUiHelper.isOrientationPortrait(getActivity())) {
|
||||
menu = ((FavoritesActivity) getActivity()).getClearToolbar(true).getMenu();
|
||||
} else {
|
||||
((FavoritesActivity) getActivity()).getClearToolbar(false);
|
||||
|
|
|
@ -12,7 +12,7 @@ import android.support.v7.widget.Toolbar;
|
|||
import android.view.*;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.helpers.ScreenOrientationHelper;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import android.os.Bundle;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
|
@ -105,7 +105,7 @@ public class HelpActivity extends OsmandActionBarActivity {
|
|||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
if (ScreenOrientationHelper.isOrientationPortrait(this)){
|
||||
if (AndroidUiHelper.isOrientationPortrait(this)){
|
||||
menu = getClearToolbar(true).getMenu();
|
||||
} else {
|
||||
getClearToolbar(false);
|
||||
|
|
|
@ -10,7 +10,7 @@ import net.osmand.plus.activities.search.SearchActivity;
|
|||
import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
|
||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
import net.osmand.plus.dialogs.FavoriteDialogs;
|
||||
import net.osmand.plus.helpers.ScreenOrientationHelper;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.util.MapUtils;
|
||||
import android.app.Dialog;
|
||||
import android.content.Intent;
|
||||
|
@ -109,7 +109,7 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
|
|||
@Override
|
||||
public void onCreateOptionsMenu(Menu onCreate, MenuInflater inflater) {
|
||||
OsmandApplication app = (OsmandApplication) getActivity().getApplication();
|
||||
boolean portrait = ScreenOrientationHelper.isOrientationPortrait(getActivity());
|
||||
boolean portrait = AndroidUiHelper.isOrientationPortrait(getActivity());
|
||||
boolean light = app.getSettings().isLightActionBar();
|
||||
Menu menu = onCreate;
|
||||
if(getActivity() instanceof SearchActivity) {
|
||||
|
|
|
@ -11,7 +11,7 @@ import net.osmand.plus.activities.MapActivity;
|
|||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
import net.osmand.plus.dialogs.FavoriteDialogs;
|
||||
import net.osmand.plus.helpers.FileNameTranslationHelper;
|
||||
import net.osmand.plus.helpers.ScreenOrientationHelper;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.plus.resources.RegionAddressRepository;
|
||||
import net.osmand.util.Algorithms;
|
||||
import android.app.Dialog;
|
||||
|
@ -84,7 +84,7 @@ public class SearchAddressFragment extends Fragment {
|
|||
@Override
|
||||
public void onCreateOptionsMenu(Menu onCreate, MenuInflater inflater) {
|
||||
Menu menu = onCreate;
|
||||
boolean portrait = ScreenOrientationHelper.isOrientationPortrait(getActivity());
|
||||
boolean portrait = AndroidUiHelper.isOrientationPortrait(getActivity());
|
||||
if(getActivity() instanceof SearchActivity) {
|
||||
if (portrait) {
|
||||
menu = ((SearchActivity) getActivity()).getClearToolbar(true).getMenu();
|
||||
|
|
|
@ -22,7 +22,7 @@ import net.osmand.plus.development.DashSimulateFragment;
|
|||
import net.osmand.plus.development.OsmandDevelopmentPlugin;
|
||||
import net.osmand.plus.dialogs.ConfigureMapMenu;
|
||||
import net.osmand.plus.download.DownloadActivity;
|
||||
import net.osmand.plus.helpers.ScreenOrientationHelper;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.plus.helpers.WaypointDialogHelper;
|
||||
import net.osmand.plus.helpers.WaypointHelper.LocationPointWrapper;
|
||||
import net.osmand.plus.monitoring.DashTrackFragment;
|
||||
|
@ -126,7 +126,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
|||
public void createDashboardView() {
|
||||
baseColor = mapActivity.getResources().getColor(R.color.osmand_orange) & 0x00ffffff;
|
||||
waypointDialogHelper = new WaypointDialogHelper(mapActivity);
|
||||
landscape = !ScreenOrientationHelper.isOrientationPortrait(mapActivity);
|
||||
landscape = !AndroidUiHelper.isOrientationPortrait(mapActivity);
|
||||
dashboardView = (FrameLayout) mapActivity.findViewById(R.id.dashboard);
|
||||
View.OnClickListener listener = new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -138,7 +138,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
|||
ObservableScrollView scrollView = ((ObservableScrollView) dashboardView.findViewById(R.id.main_scroll));
|
||||
listView = (ListView) dashboardView.findViewById(R.id.dash_list_view);
|
||||
gradientToolbar = mapActivity.getResources().getDrawable(R.drawable.gradient_toolbar).mutate();
|
||||
if (ScreenOrientationHelper.isOrientationPortrait(mapActivity)) {
|
||||
if (AndroidUiHelper.isOrientationPortrait(mapActivity)) {
|
||||
this.portrait = true;
|
||||
scrollView.setScrollViewCallbacks(this);
|
||||
((ObservableListView) listView).setScrollViewCallbacks(this);
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
package net.osmand.plus.helpers;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.res.Configuration;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.Surface;
|
||||
import net.osmand.PlatformUtil;
|
||||
import android.view.View;
|
||||
|
||||
/**
|
||||
* Created by dummy on 28.01.15.
|
||||
*/
|
||||
public class ScreenOrientationHelper {
|
||||
public class AndroidUiHelper {
|
||||
|
||||
public static int getScreenOrientation(Activity activity) {
|
||||
int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();
|
||||
|
@ -75,9 +76,26 @@ public class ScreenOrientationHelper {
|
|||
|
||||
return orientation;
|
||||
}
|
||||
|
||||
public static boolean updateVisibility(View view, boolean visible) {
|
||||
if (view != null && visible != (view.getVisibility() == View.VISIBLE)) {
|
||||
if (visible) {
|
||||
view.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
view.setVisibility(View.GONE);
|
||||
}
|
||||
view.invalidate();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isLargeDevice(Activity ctx) {
|
||||
return (ctx.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE;
|
||||
}
|
||||
|
||||
public static boolean isOrientationPortrait(Activity ctx) {
|
||||
int orientation = ScreenOrientationHelper.getScreenOrientation(ctx);
|
||||
int orientation = AndroidUiHelper.getScreenOrientation(ctx);
|
||||
return orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT ||
|
||||
orientation == ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
|
||||
}
|
|
@ -57,7 +57,7 @@ import net.osmand.plus.activities.SavingTrackHelper;
|
|||
import net.osmand.plus.activities.TrackActivity;
|
||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
import net.osmand.plus.download.LocalIndexesFragment;
|
||||
import net.osmand.plus.helpers.ScreenOrientationHelper;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||
import net.osmand.plus.osmedit.OsmEditingPlugin;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
@ -327,7 +327,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
}
|
||||
});
|
||||
|
||||
if (ScreenOrientationHelper.isOrientationPortrait(getActivity())) {
|
||||
if (AndroidUiHelper.isOrientationPortrait(getActivity())) {
|
||||
menu = ((FavoritesActivity) getActivity()).getClearToolbar(true).getMenu();
|
||||
} else {
|
||||
((FavoritesActivity) getActivity()).getClearToolbar(false);
|
||||
|
@ -366,7 +366,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
final MenuItem item;
|
||||
item = menu.add(0, optionsMenuAdapter.getElementId(j), j + 1, optionsMenuAdapter.getItemName(j));
|
||||
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
if (ScreenOrientationHelper.isOrientationPortrait(getActivity())) {
|
||||
if (AndroidUiHelper.isOrientationPortrait(getActivity())) {
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem menuItem) {
|
||||
|
@ -427,7 +427,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
|
||||
private void enableSelectionMode(boolean selectionMode) {
|
||||
this.selectionMode = selectionMode;
|
||||
if (ScreenOrientationHelper.isOrientationPortrait(getActivity())) {
|
||||
if (AndroidUiHelper.isOrientationPortrait(getActivity())) {
|
||||
((FavoritesActivity) getActivity()).setToolbarVisibility(!selectionMode);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ import net.osmand.plus.R;
|
|||
import net.osmand.plus.activities.ActionBarProgressActivity;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
import net.osmand.plus.helpers.ScreenOrientationHelper;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.plus.myplaces.FavoritesActivity;
|
||||
|
||||
import org.xmlpull.v1.XmlSerializer;
|
||||
|
@ -123,7 +123,7 @@ public class OsmEditsFragment extends ListFragment implements OsmEditsUploadList
|
|||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
menu.clear();
|
||||
|
||||
if (ScreenOrientationHelper.isOrientationPortrait(getActivity())) {
|
||||
if (AndroidUiHelper.isOrientationPortrait(getActivity())) {
|
||||
menu = ((ActionBarProgressActivity) getActivity()).getClearToolbar(true).getMenu();
|
||||
} else {
|
||||
((ActionBarProgressActivity) getActivity()).getClearToolbar(false);
|
||||
|
|
|
@ -80,7 +80,7 @@ import net.osmand.plus.activities.OsmandExpandableListActivity;
|
|||
import net.osmand.plus.activities.actions.ShareDialog;
|
||||
import net.osmand.plus.base.MapViewTrackingUtilities;
|
||||
import net.osmand.plus.helpers.ColorDialogs;
|
||||
import net.osmand.plus.helpers.ScreenOrientationHelper;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.plus.osmo.OsMoGroups.OsMoGroupsUIListener;
|
||||
import net.osmand.plus.osmo.OsMoGroupsStorage.OsMoDevice;
|
||||
import net.osmand.plus.osmo.OsMoGroupsStorage.OsMoGroup;
|
||||
|
@ -451,7 +451,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
|
|||
@Override
|
||||
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
|
||||
selectedObject = o;
|
||||
boolean portrait = ScreenOrientationHelper.isOrientationPortrait(OsMoGroupsActivity.this);
|
||||
boolean portrait = AndroidUiHelper.isOrientationPortrait(OsMoGroupsActivity.this);
|
||||
if (portrait) {
|
||||
menu = getClearToolbar(true).getMenu();
|
||||
} else {
|
||||
|
@ -524,7 +524,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
|
|||
public void onDestroyActionMode(ActionMode mode) {
|
||||
selectedObject = null;
|
||||
refreshList();
|
||||
if (ScreenOrientationHelper.isOrientationPortrait(OsMoGroupsActivity.this)){
|
||||
if (AndroidUiHelper.isOrientationPortrait(OsMoGroupsActivity.this)){
|
||||
onCreateOptionsMenu(menu);
|
||||
}
|
||||
}
|
||||
|
@ -1030,7 +1030,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
|
|||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
menu.clear();
|
||||
Menu oldMenu = menu;
|
||||
boolean portrait = ScreenOrientationHelper.isOrientationPortrait(this);
|
||||
boolean portrait = AndroidUiHelper.isOrientationPortrait(this);
|
||||
if (portrait) {
|
||||
menu = getClearToolbar(true).getMenu();
|
||||
} else {
|
||||
|
|
|
@ -514,22 +514,9 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
@Override
|
||||
public void onDraw(Canvas canvas, RotatedTileBox tileBox, DrawSettings nightMode) {
|
||||
updateControls(tileBox, nightMode);
|
||||
boolean b = optionsRouteControlDialog.isDialogVisible() || mapRouteInfoControlDialog.isDialogVisible();
|
||||
updateVisibility(mapActivity.findViewById(R.id.map_right_widgets_panel), !b);
|
||||
}
|
||||
|
||||
protected boolean updateVisibility(View view, boolean visible) {
|
||||
if (view != null && visible != (view.getVisibility() == View.VISIBLE)) {
|
||||
if (visible) {
|
||||
view.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
view.setVisibility(View.GONE);
|
||||
}
|
||||
view.invalidate();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private void updateControls(RotatedTileBox tileBox, DrawSettings nightMode) {
|
||||
boolean isNight = nightMode != null && nightMode.isNightMode();
|
||||
|
|
|
@ -12,7 +12,7 @@ import net.osmand.plus.OsmandSettings;
|
|||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.dialogs.ConfigureMapMenu;
|
||||
import net.osmand.plus.helpers.ScreenOrientationHelper;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory;
|
||||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopTextView;
|
||||
import net.osmand.plus.views.mapwidgets.MapWidgetRegistry;
|
||||
|
@ -193,7 +193,7 @@ public class MapInfoLayer extends OsmandMapLayer {
|
|||
}
|
||||
|
||||
private void updateStreetName(boolean nightMode, TextState ts) {
|
||||
streetNameView.setBackgroundResource(ScreenOrientationHelper.isOrientationPortrait(map) ? ts.boxTop
|
||||
streetNameView.setBackgroundResource(AndroidUiHelper.isOrientationPortrait(map) ? ts.boxTop
|
||||
: ts.boxFree);
|
||||
streetNameView.updateTextColor(nightMode, ts.textColor, ts.textShadowColor, ts.textBold, ts.textShadowRadius);
|
||||
}
|
||||
|
|
|
@ -113,7 +113,9 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
|
|||
private float rotate; // accumulate
|
||||
|
||||
private int mapPosition;
|
||||
|
||||
|
||||
private int mapPositionX;
|
||||
|
||||
private boolean showMapPosition = true;
|
||||
|
||||
private IMapLocationListener locationListener;
|
||||
|
@ -398,6 +400,10 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
|
|||
public void setMapPosition(int type) {
|
||||
this.mapPosition = type;
|
||||
}
|
||||
|
||||
public void setMapPositionX(int type) {
|
||||
this.mapPositionX = type;
|
||||
}
|
||||
|
||||
public OsmandSettings getSettings() {
|
||||
return settings;
|
||||
|
@ -472,10 +478,13 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
|
|||
return;
|
||||
}
|
||||
final float ratioy = mapPosition == OsmandSettings.BOTTOM_CONSTANT ? 0.85f : 0.5f;
|
||||
final float ratiox = mapPositionX == 0 ? 0.5f : 0.75f;
|
||||
final int cy = (int) (ratioy * view.getHeight());
|
||||
final int cx = (int) (ratiox * view.getWidth());
|
||||
if (currentViewport.getPixWidth() != view.getWidth() || currentViewport.getPixHeight() != view.getHeight() ||
|
||||
currentViewport.getCenterPixelY() != cy) {
|
||||
currentViewport.setPixelDimensions(view.getWidth(), view.getHeight(), 0.5f, ratioy);
|
||||
currentViewport.getCenterPixelY() != cy ||
|
||||
currentViewport.getCenterPixelX() != cx) {
|
||||
currentViewport.setPixelDimensions(view.getWidth(), view.getHeight(), ratiox, ratioy);
|
||||
refreshBufferImage(drawSettings);
|
||||
}
|
||||
if (view instanceof SurfaceView) {
|
||||
|
|
|
@ -27,7 +27,6 @@ import net.osmand.plus.activities.search.SearchAddressActivity;
|
|||
import net.osmand.plus.activities.search.SearchAddressFragment;
|
||||
import net.osmand.plus.development.OsmandDevelopmentPlugin;
|
||||
import net.osmand.plus.dialogs.FavoriteDialogs;
|
||||
import net.osmand.plus.helpers.ScreenOrientationHelper;
|
||||
import net.osmand.plus.routing.RouteDirectionInfo;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.plus.routing.RoutingHelper.IRouteInformationListener;
|
||||
|
@ -39,15 +38,8 @@ import android.content.DialogInterface;
|
|||
import android.content.DialogInterface.OnDismissListener;
|
||||
import android.content.Intent;
|
||||
import android.graphics.PointF;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.View.MeasureSpec;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.ArrayAdapter;
|
||||
|
@ -543,15 +535,10 @@ public class MapRouteInfoControl implements IRouteInformationListener {
|
|||
public void showDialog() {
|
||||
final View ll = mapActivity.getLayoutInflater().inflate(R.layout.plan_route_info, null);
|
||||
updateInfo(ll);
|
||||
dialog = MapRoutePreferencesControl.createDialog(mapActivity, ll);
|
||||
final boolean switched = mapControlsLayer.switchToRoutePlanningLayout();
|
||||
dialog.show();
|
||||
dialog.setOnDismissListener(new OnDismissListener() {
|
||||
dialog = MapRoutePreferencesControl.showDialog(mapControlsLayer, mapActivity, ll, new OnDismissListener() {
|
||||
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dlg) {
|
||||
if(switched) {
|
||||
mapControlsLayer.switchToRouteFollowingLayout();
|
||||
}
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
dialog = null;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -22,7 +22,7 @@ import net.osmand.plus.activities.SettingsBaseActivity;
|
|||
import net.osmand.plus.activities.SettingsNavigationActivity;
|
||||
import net.osmand.plus.activities.actions.AppModeDialog;
|
||||
import net.osmand.plus.helpers.GpxUiHelper;
|
||||
import net.osmand.plus.helpers.ScreenOrientationHelper;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder;
|
||||
import net.osmand.plus.routing.RouteProvider.RouteService;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
|
@ -37,11 +37,9 @@ import android.content.DialogInterface;
|
|||
import android.content.DialogInterface.OnDismissListener;
|
||||
import android.content.Intent;
|
||||
import android.support.v7.widget.PopupMenu;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.MeasureSpec;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
|
||||
|
@ -133,26 +131,23 @@ public class MapRoutePreferencesControl {
|
|||
dialog.hide();
|
||||
dialog = null;
|
||||
} else {
|
||||
final boolean switched = controlsLayer.switchToRoutePlanningLayout();
|
||||
dialog = createDialog(mapActivity, createLayout());
|
||||
dialog.show();
|
||||
dialog.setOnDismissListener(new OnDismissListener() {
|
||||
dialog = showDialog(controlsLayer, mapActivity, createLayout(), new OnDismissListener() {
|
||||
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dlg) {
|
||||
dialog = null;
|
||||
if(switched) {
|
||||
controlsLayer.switchToRouteFollowingLayout();
|
||||
}
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
dialog = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static Dialog createDialog(MapActivity mapActivity, final View ll) {
|
||||
public static Dialog showDialog(final MapControlsLayer controlsLayer, final MapActivity mapActivity, final View ll,
|
||||
final OnDismissListener dismiss) {
|
||||
final boolean switched = controlsLayer.switchToRoutePlanningLayout();
|
||||
final Dialog dialog = new Dialog(mapActivity);
|
||||
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
|
||||
final int maxHeight ;
|
||||
boolean portrait = ScreenOrientationHelper.isOrientationPortrait(mapActivity);
|
||||
boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
||||
if(portrait) {
|
||||
maxHeight = (int) mapActivity.getResources().getDimension(R.dimen.map_route_planning_max_height);
|
||||
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
|
@ -188,8 +183,37 @@ public class MapRoutePreferencesControl {
|
|||
}
|
||||
});
|
||||
}
|
||||
if(!portrait) {
|
||||
mapActivity.getMapView().setMapPositionX(1);
|
||||
mapActivity.getMapView().refreshMap();
|
||||
}
|
||||
dialog.show();
|
||||
if(!AndroidUiHelper.isLargeDevice(mapActivity)) {
|
||||
AndroidUiHelper.updateVisibility(mapActivity.findViewById(R.id.map_right_widgets_panel), false);
|
||||
AndroidUiHelper.updateVisibility(mapActivity.findViewById(R.id.map_left_widgets_panel), false);
|
||||
}
|
||||
if(!portrait) {
|
||||
AndroidUiHelper.updateVisibility(mapActivity.findViewById(R.id.map_route_land_left_margin), true);
|
||||
}
|
||||
dialog.setOnDismissListener(new OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dlg) {
|
||||
mapActivity.getMapView().setMapPositionX(0);
|
||||
mapActivity.getMapView().refreshMap();
|
||||
AndroidUiHelper.updateVisibility(mapActivity.findViewById(R.id.map_route_land_left_margin), false);
|
||||
AndroidUiHelper.updateVisibility(mapActivity.findViewById(R.id.map_right_widgets_panel), true);
|
||||
AndroidUiHelper.updateVisibility(mapActivity.findViewById(R.id.map_left_widgets_panel), true);
|
||||
if(switched) {
|
||||
controlsLayer.switchToRouteFollowingLayout();
|
||||
}
|
||||
if(dismiss != null){
|
||||
dismiss.onDismiss(dialog);
|
||||
}
|
||||
}
|
||||
});
|
||||
return dialog;
|
||||
}
|
||||
|
||||
|
||||
private void updateGpxRoutingParameter(OtherLocalRoutingParameter gpxParam) {
|
||||
GPXRouteParamsBuilder rp = mapActivity.getRoutingHelper().getCurrentGPXRoute();
|
||||
|
|
|
@ -19,7 +19,7 @@ import net.osmand.plus.TargetPointsHelper;
|
|||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.base.MapViewTrackingUtilities;
|
||||
import net.osmand.plus.helpers.ScreenOrientationHelper;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.plus.helpers.WaypointHelper;
|
||||
import net.osmand.plus.routing.AlarmInfo;
|
||||
import net.osmand.plus.routing.AlarmInfo.AlarmInfoType;
|
||||
|
@ -734,7 +734,7 @@ public class RouteInfoWidgetsFactory {
|
|||
text = (TextView) ma.findViewById(R.id.map_ruler_text);
|
||||
textShadow = (TextView) ma.findViewById(R.id.map_ruler_text_shadow);
|
||||
maxWidth = ma.getResources().getDimensionPixelSize(R.dimen.map_ruler_width);
|
||||
orientationPortrait = ScreenOrientationHelper.isOrientationPortrait(ma);
|
||||
orientationPortrait = AndroidUiHelper.isOrientationPortrait(ma);
|
||||
}
|
||||
|
||||
public void updateTextSize(boolean isNight, int textColor, int textShadowColor, int shadowRadius) {
|
||||
|
|
Loading…
Reference in a new issue