Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
31a8b920c1
13 changed files with 261 additions and 47 deletions
122
OsmAnd/res/layout/map_marker_item_new.xml
Normal file
122
OsmAnd/res/layout/map_marker_item_new.xml
Normal file
|
@ -0,0 +1,122 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:descendantFocusability="blocksDescendants">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/bg_color">
|
||||
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:id="@+id/marker_reorder_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:padding="16dp"
|
||||
android:tint="?attr/secondary_icon_color"
|
||||
tools:src="@drawable/ic_action_reorder"/>
|
||||
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:id="@+id/marker_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_toEndOf="@id/marker_reorder_icon"
|
||||
android:layout_toRightOf="@id/marker_reorder_icon"
|
||||
tools:src="@drawable/ic_action_flag_dark"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/marker_options_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginLeft="14dp"
|
||||
android:layout_marginRight="14dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:focusableInTouchMode="true"
|
||||
tools:src="@drawable/ic_overflow_menu_white"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toEndOf="@+id/marker_icon"
|
||||
android:layout_toLeftOf="@id/marker_options_button"
|
||||
android:layout_toRightOf="@+id/marker_icon"
|
||||
android:layout_toStartOf="@id/marker_options_button"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.v7.widget.AppCompatTextView
|
||||
android:id="@+id/measure_point_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
tools:text="Van Gogh Museum"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/direction_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:src="@drawable/ic_direction_arrow"/>
|
||||
|
||||
<android.support.v7.widget.AppCompatTextView
|
||||
android:id="@+id/marker_distance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_marginRight="4dp"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/marker_blue"
|
||||
android:textSize="@dimen/default_sub_text_size"
|
||||
tools:text="213 m"/>
|
||||
|
||||
<android.support.v7.widget.AppCompatTextView
|
||||
android:id="@+id/point_icon_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="•"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_sub_text_size"/>
|
||||
|
||||
<android.support.v7.widget.AppCompatTextView
|
||||
android:id="@+id/marker_description"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_marginRight="4dp"
|
||||
android:maxLines="1"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_sub_text_size"
|
||||
tools:text="Amsterdam Weekend"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/points_divider"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="1dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_toEndOf="@+id/marker_reorder_icon"
|
||||
android:layout_toRightOf="@+id/marker_reorder_icon"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
</RelativeLayout>
|
||||
|
||||
</FrameLayout>
|
|
@ -9,6 +9,8 @@
|
|||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<string name="do_not_use_animations">Do not use animations</string>
|
||||
<string name="do_not_use_animations_descr">It disables animations in app</string>
|
||||
<string name="keep_showing_on_map">Keep showing on map</string>
|
||||
<string name="exit_without_saving">Exit without saving?</string>
|
||||
<string name="line">Line</string>
|
||||
|
|
|
@ -262,6 +262,14 @@
|
|||
<item name="android:textColorSecondary">@color/color_white</item>
|
||||
</style>
|
||||
|
||||
<style name="OsmandDarkTheme.NoAnimation">
|
||||
<item name="alertDialogTheme">@style/Theme.AppCompat.Dialog.Alert.NoAnimation</item>
|
||||
</style>
|
||||
|
||||
<style name="OsmandLightTheme.NoAnimation">
|
||||
<item name="alertDialogTheme">@style/Theme.AppCompat.Light.Dialog.Alert.NoAnimation</item>
|
||||
</style>
|
||||
|
||||
<style name="OsmandDarkTheme" parent="Theme.AppCompat">
|
||||
<item name="mapBackground">@color/map_background_color_dark</item>
|
||||
<item name="chart_marker_background">@drawable/chart_marker_background_dark</item>
|
||||
|
@ -339,6 +347,14 @@
|
|||
<item name="android:textColor">@color/color_white</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.AppCompat.Dialog.Alert.NoAnimation">
|
||||
<item name="android:windowAnimationStyle">@null</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.AppCompat.Light.Dialog.Alert.NoAnimation">
|
||||
<item name="android:windowAnimationStyle">@null</item>
|
||||
</style>
|
||||
|
||||
<!-- Standard action bar override -->
|
||||
<style name="Widget.Styled.ActionBarDark" parent="Widget.AppCompat.Light.ActionBar.Solid.Inverse">
|
||||
<item name="background">@color/actionbar_dark_color</item>
|
||||
|
@ -374,6 +390,11 @@
|
|||
|
||||
<!-- Dialog popup -->
|
||||
<style name="Animations"/>
|
||||
|
||||
<style name="Animations.NoAnimation">
|
||||
<item name="@android:windowEnterAnimation">@null</item>
|
||||
<item name="@android:windowExitAnimation">@null</item>
|
||||
</style>
|
||||
<!-- PopDownMenu -->
|
||||
<style name="Animations.PopDownMenu"/>
|
||||
|
||||
|
|
|
@ -694,10 +694,19 @@ public class OsmandApplication extends MultiDexApplication {
|
|||
|
||||
public void applyTheme(Context c) {
|
||||
int t = R.style.OsmandDarkTheme;
|
||||
boolean doNotUseAnimations = osmandSettings.DO_NOT_USE_ANIMATIONS.get();
|
||||
if (osmandSettings.OSMAND_THEME.get() == OsmandSettings.OSMAND_DARK_THEME) {
|
||||
t = R.style.OsmandDarkTheme;
|
||||
if (doNotUseAnimations) {
|
||||
t = R.style.OsmandDarkTheme_NoAnimation;
|
||||
} else {
|
||||
t = R.style.OsmandDarkTheme;
|
||||
}
|
||||
} else if (osmandSettings.OSMAND_THEME.get() == OsmandSettings.OSMAND_LIGHT_THEME) {
|
||||
t = R.style.OsmandLightTheme;
|
||||
if (doNotUseAnimations) {
|
||||
t = R.style.OsmandLightTheme_NoAnimation;
|
||||
} else {
|
||||
t = R.style.OsmandLightTheme;
|
||||
}
|
||||
}
|
||||
setLanguage(c);
|
||||
c.setTheme(t);
|
||||
|
|
|
@ -885,6 +885,7 @@ public class OsmandSettings {
|
|||
public final OsmandPreference<Boolean> USE_KALMAN_FILTER_FOR_COMPASS = new BooleanPreference("use_kalman_filter_compass", true).makeGlobal().cache();
|
||||
|
||||
public final OsmandPreference<Boolean> DO_NOT_SHOW_STARTUP_MESSAGES = new BooleanPreference("do_not_show_startup_messages", false).makeGlobal().cache();
|
||||
public final OsmandPreference<Boolean> DO_NOT_USE_ANIMATIONS = new BooleanPreference("do_not_use_animations", false).makeGlobal().cache();
|
||||
public final OsmandPreference<Boolean> DO_NOT_SEND_ANONYMOUS_APP_USAGE = new BooleanPreference("do_not_send_anonymous_app_usage", false).makeGlobal().cache();
|
||||
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ import android.content.DialogInterface;
|
|||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Rect;
|
||||
import android.media.AudioManager;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
|
@ -39,6 +40,7 @@ import android.widget.ProgressBar;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.Location;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.SecondSplashScreenFragment;
|
||||
|
@ -200,7 +202,6 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
setRequestedOrientation(AndroidUiHelper.getScreenOrientation(this));
|
||||
overridePendingTransition(0, 0);
|
||||
long tm = System.currentTimeMillis();
|
||||
app = getMyApplication();
|
||||
settings = app.getSettings();
|
||||
|
@ -1404,11 +1405,15 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
|
||||
public void openDrawer() {
|
||||
mapActions.updateDrawerMenu();
|
||||
drawerLayout.openDrawer(Gravity.LEFT);
|
||||
boolean animate = !settings.DO_NOT_USE_ANIMATIONS.get();
|
||||
drawerLayout.openDrawer(Gravity.LEFT, animate);
|
||||
}
|
||||
|
||||
public void disableDrawer() {
|
||||
drawerDisabled = true;
|
||||
if (settings.DO_NOT_USE_ANIMATIONS.get()) {
|
||||
closeDrawer();
|
||||
}
|
||||
drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
|
||||
}
|
||||
|
||||
|
@ -1421,8 +1426,25 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
return drawerDisabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchTouchEvent(MotionEvent event) {
|
||||
if (settings.DO_NOT_USE_ANIMATIONS.get()) {
|
||||
if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
if (drawerLayout.isDrawerOpen(Gravity.LEFT)) {
|
||||
int width = AndroidUtils.dpToPx(this, 280);
|
||||
if (event.getRawX() > width) {
|
||||
closeDrawer();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.dispatchTouchEvent(event);
|
||||
}
|
||||
|
||||
public void closeDrawer() {
|
||||
drawerLayout.closeDrawer(Gravity.LEFT);
|
||||
boolean animate = !settings.DO_NOT_USE_ANIMATIONS.get();
|
||||
drawerLayout.closeDrawer(Gravity.LEFT, animate);
|
||||
}
|
||||
|
||||
public void toggleDrawer() {
|
||||
|
|
|
@ -478,6 +478,7 @@ public class SettingsGeneralActivity extends SettingsBaseActivity implements OnR
|
|||
misc.addPreference(createCheckBoxPreference(settings.DO_NOT_SEND_ANONYMOUS_APP_USAGE, R.string.do_not_send_anonymous_app_usage, R.string.do_not_send_anonymous_app_usage_desc));
|
||||
}
|
||||
misc.addPreference(createCheckBoxPreference(settings.DO_NOT_SHOW_STARTUP_MESSAGES, R.string.do_not_show_startup_messages, R.string.do_not_show_startup_messages_desc));
|
||||
misc.addPreference(createCheckBoxPreference(settings.DO_NOT_USE_ANIMATIONS, R.string.do_not_use_animations, R.string.do_not_use_animations_descr));
|
||||
}
|
||||
|
||||
|
||||
|
@ -518,6 +519,8 @@ public class SettingsGeneralActivity extends SettingsBaseActivity implements OnR
|
|||
restartApp();
|
||||
} else if (id.equals(settings.METRIC_SYSTEM.getId())) {
|
||||
settings.METRIC_SYSTEM_CHANGED_MANUALLY.set(true);
|
||||
} else if (id.equals(settings.DO_NOT_USE_ANIMATIONS.getId())) {
|
||||
restartApp();
|
||||
} else {
|
||||
updateAllSettings();
|
||||
}
|
||||
|
|
|
@ -29,7 +29,9 @@ public abstract class BottomSheetDialogFragment extends DialogFragment {
|
|||
final Dialog dialog = new Dialog(getActivity(), themeId);
|
||||
dialog.setCanceledOnTouchOutside(true);
|
||||
dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
|
||||
dialog.getWindow().getAttributes().windowAnimations = R.style.Animations_PopUpMenu_Bottom;
|
||||
if (!getMyApplication().getSettings().DO_NOT_USE_ANIMATIONS.get()) {
|
||||
dialog.getWindow().getAttributes().windowAnimations = R.style.Animations_PopUpMenu_Bottom;
|
||||
}
|
||||
dialog.setCanceledOnTouchOutside(true);
|
||||
return dialog;
|
||||
}
|
||||
|
|
|
@ -757,7 +757,8 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
|||
}
|
||||
|
||||
public void setDashboardVisibility(boolean visible, DashboardType type) {
|
||||
setDashboardVisibility(visible, type, this.visible ? visibleType : null, true);
|
||||
boolean animate = !getMyApplication().getSettings().DO_NOT_USE_ANIMATIONS.get();
|
||||
setDashboardVisibility(visible, type, this.visible ? visibleType : null, animate);
|
||||
}
|
||||
|
||||
public void setDashboardVisibility(boolean visible, DashboardType type, boolean animation) {
|
||||
|
@ -1187,7 +1188,8 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
|||
mapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode();
|
||||
mapActivity.refreshMap();
|
||||
}
|
||||
hideDashboard(true);
|
||||
boolean animate = !getMyApplication().getSettings().DO_NOT_USE_ANIMATIONS.get();
|
||||
hideDashboard(animate);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import android.os.Bundle;
|
|||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -94,10 +95,15 @@ public class MapRouteInfoMenuFragment extends Fragment {
|
|||
}
|
||||
|
||||
public void show(MapActivity mapActivity) {
|
||||
int slideInAnim = R.anim.slide_in_bottom;
|
||||
int slideOutAnim = R.anim.slide_out_bottom;
|
||||
int slideInAnim = 0;
|
||||
int slideOutAnim = 0;
|
||||
if (!mapActivity.getMyApplication().getSettings().DO_NOT_USE_ANIMATIONS.get()) {
|
||||
slideInAnim = R.anim.slide_in_bottom;
|
||||
slideOutAnim = R.anim.slide_out_bottom;
|
||||
}
|
||||
|
||||
mapActivity.getSupportFragmentManager().beginTransaction()
|
||||
mapActivity.getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
.setCustomAnimations(slideInAnim, slideOutAnim, slideInAnim, slideOutAnim)
|
||||
.add(R.id.routeMenuContainer, this, TAG)
|
||||
.addToBackStack(TAG)
|
||||
|
@ -165,10 +171,10 @@ public class MapRouteInfoMenuFragment extends Fragment {
|
|||
}
|
||||
|
||||
public static boolean showInstance(final MapActivity mapActivity) {
|
||||
try {
|
||||
boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
||||
int slideInAnim;
|
||||
int slideOutAnim;
|
||||
boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
||||
int slideInAnim = 0;
|
||||
int slideOutAnim = 0;
|
||||
if (!mapActivity.getMyApplication().getSettings().DO_NOT_USE_ANIMATIONS.get()) {
|
||||
if (portrait) {
|
||||
slideInAnim = R.anim.slide_in_bottom;
|
||||
slideOutAnim = R.anim.slide_out_bottom;
|
||||
|
@ -176,14 +182,18 @@ public class MapRouteInfoMenuFragment extends Fragment {
|
|||
slideInAnim = R.anim.slide_in_left;
|
||||
slideOutAnim = R.anim.slide_out_left;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
mapActivity.getContextMenu().hideMenues();
|
||||
|
||||
MapRouteInfoMenuFragment fragment = new MapRouteInfoMenuFragment();
|
||||
mapActivity.getSupportFragmentManager().beginTransaction()
|
||||
mapActivity.getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
.setCustomAnimations(slideInAnim, slideOutAnim, slideInAnim, slideOutAnim)
|
||||
.add(R.id.routeMenuContainer, fragment, TAG)
|
||||
.addToBackStack(TAG).commitAllowingStateLoss();
|
||||
.addToBackStack(TAG)
|
||||
.commitAllowingStateLoss();
|
||||
|
||||
return true;
|
||||
|
||||
|
|
|
@ -112,7 +112,8 @@ public class MeasurementToolFragment extends Fragment {
|
|||
|
||||
private enum SaveType {
|
||||
ROUTE_POINT,
|
||||
LINE
|
||||
LINE,
|
||||
SNAP_TO_ROAD
|
||||
}
|
||||
|
||||
private void setEditingCtx(MeasurementEditingContext editingCtx) {
|
||||
|
@ -459,12 +460,12 @@ public class MeasurementToolFragment extends Fragment {
|
|||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
cancelModes();
|
||||
exitMeasurementMode();
|
||||
adapter.setAdapterListener(null);
|
||||
if (pointsListOpened) {
|
||||
hidePointsList();
|
||||
}
|
||||
closeModes();
|
||||
MeasurementToolLayer layer = getMeasurementLayer();
|
||||
if (layer != null) {
|
||||
layer.setOnSingleTapListener(null);
|
||||
|
@ -819,7 +820,7 @@ public class MeasurementToolFragment extends Fragment {
|
|||
gpxFile = result[0];
|
||||
SelectedGpxFile selectedGpxFile = mapActivity.getMyApplication().getSelectedGpxHelper().getSelectedFileByPath(gpxFile.path);
|
||||
boolean showOnMap = selectedGpxFile != null;
|
||||
saveExistingGpx(gpxFile, showOnMap, null, false);
|
||||
saveExistingGpx(gpxFile, showOnMap, ActionType.ADD_SEGMENT, false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -837,7 +838,7 @@ public class MeasurementToolFragment extends Fragment {
|
|||
int position = editingCtx.getSelectedPointPosition();
|
||||
editingCtx.getCommandManager().execute(new MovePointCommand(measurementLayer, oldPoint, newPoint, position));
|
||||
editingCtx.addPoint(newPoint);
|
||||
measurementLayer.exitMovePointMode(false);
|
||||
exitMovePointMode(false);
|
||||
doAddOrMovePointCommonStuff();
|
||||
measurementLayer.refreshMap();
|
||||
}
|
||||
|
@ -845,22 +846,28 @@ public class MeasurementToolFragment extends Fragment {
|
|||
|
||||
private void cancelMovePointMode() {
|
||||
switchMovePointMode(false);
|
||||
MeasurementToolLayer measurementToolLayer = getMeasurementLayer();
|
||||
if (measurementToolLayer != null) {
|
||||
measurementToolLayer.exitMovePointMode(true);
|
||||
measurementToolLayer.refreshMap();
|
||||
exitMovePointMode(true);
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null) {
|
||||
mapActivity.refreshMap();
|
||||
}
|
||||
}
|
||||
|
||||
private void closeModes() {
|
||||
if (editingCtx.getOriginalPointToMove() != null) {
|
||||
switchMovePointMode(false);
|
||||
} else if (editingCtx.getSelectedPointPosition() != -1) {
|
||||
switchAddPointBeforeAfterMode(false);
|
||||
void exitMovePointMode(boolean saveOriginalPoint) {
|
||||
if (saveOriginalPoint) {
|
||||
WptPt pt = editingCtx.getOriginalPointToMove();
|
||||
editingCtx.addPoint(pt);
|
||||
}
|
||||
MeasurementToolLayer layer = getMeasurementLayer();
|
||||
if (layer != null && editingCtx.getOriginalPointToMove() != null) {
|
||||
layer.exitMovePointMode(true);
|
||||
editingCtx.setOriginalPointToMove(null);
|
||||
editingCtx.setSelectedPointPosition(-1);
|
||||
editingCtx.splitSegments(editingCtx.getBeforePoints().size() + editingCtx.getAfterPoints().size());
|
||||
}
|
||||
|
||||
private void cancelModes() {
|
||||
if (editingCtx.getOriginalPointToMove() != null) {
|
||||
cancelMovePointMode();
|
||||
} else if (editingCtx.getSelectedPointPosition() != -1) {
|
||||
cancelAddPointBeforeOrAfterMode();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1074,7 +1081,7 @@ public class MeasurementToolFragment extends Fragment {
|
|||
final SwitchCompat showOnMapToggle = (SwitchCompat) view.findViewById(R.id.toggle_show_on_map);
|
||||
showOnMapToggle.setChecked(true);
|
||||
|
||||
final String suggestedName = new SimpleDateFormat("yyyy-M-dd_HH-mm_EEE", Locale.US).format(new Date());
|
||||
final String suggestedName = new SimpleDateFormat("yyyy-MM-dd_HH-mm_EEE", Locale.US).format(new Date());
|
||||
String displayedName = suggestedName;
|
||||
File fout = new File(dir, suggestedName + GPX_SUFFIX);
|
||||
int ind = 1;
|
||||
|
@ -1156,7 +1163,7 @@ public class MeasurementToolFragment extends Fragment {
|
|||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
closeModes();
|
||||
cancelModes();
|
||||
MapActivity activity = getMapActivity();
|
||||
if (activity != null) {
|
||||
progressDialog = new ProgressDialog(activity);
|
||||
|
@ -1184,6 +1191,19 @@ public class MeasurementToolFragment extends Fragment {
|
|||
Route rt = new Route();
|
||||
gpx.routes.add(rt);
|
||||
rt.points.addAll(points);
|
||||
} else if (saveType == SaveType.SNAP_TO_ROAD) {
|
||||
TrkSegment segmentToSave = new TrkSegment();
|
||||
TrkSegment before = editingCtx.getBeforeTrkSegmentLine();
|
||||
TrkSegment after = editingCtx.getAfterTrkSegmentLine();
|
||||
segmentToSave.points.addAll(before.points);
|
||||
segmentToSave.points.addAll(after.points);
|
||||
Track track = new Track();
|
||||
track.segments.add(segmentToSave);
|
||||
gpx.tracks.add(track);
|
||||
|
||||
Route rt = new Route();
|
||||
rt.points.addAll(points);
|
||||
gpx.routes.add(rt);
|
||||
}
|
||||
}
|
||||
if (activity != null) {
|
||||
|
@ -1390,7 +1410,7 @@ public class MeasurementToolFragment extends Fragment {
|
|||
builder.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
final String name = new SimpleDateFormat("yyyy-M-dd_HH-mm_EEE", Locale.US).format(new Date());
|
||||
final String name = new SimpleDateFormat("yyyy-MM-dd_HH-mm_EEE", Locale.US).format(new Date());
|
||||
String fileName = name + GPX_SUFFIX;
|
||||
File fout = new File(dir, fileName);
|
||||
int ind = 1;
|
||||
|
@ -1398,7 +1418,13 @@ public class MeasurementToolFragment extends Fragment {
|
|||
fileName = name + "_" + (++ind) + GPX_SUFFIX;
|
||||
fout = new File(dir, fileName);
|
||||
}
|
||||
saveNewGpx(dir, fileName, showOnMapToggle.isChecked(), SaveType.LINE, true);
|
||||
SaveType saveType;
|
||||
if (editingCtx.isInSnapToRoadMode()) {
|
||||
saveType = SaveType.SNAP_TO_ROAD;
|
||||
} else {
|
||||
saveType = SaveType.LINE;
|
||||
}
|
||||
saveNewGpx(dir, fileName, showOnMapToggle.isChecked(), saveType, true);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
|
|
@ -300,16 +300,6 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
|
|||
}
|
||||
}
|
||||
|
||||
void exitMovePointMode(boolean saveOriginalPoint) {
|
||||
if (saveOriginalPoint) {
|
||||
WptPt pt = editingCtx.getOriginalPointToMove();
|
||||
editingCtx.addPoint(pt);
|
||||
}
|
||||
editingCtx.setOriginalPointToMove(null);
|
||||
editingCtx.setSelectedPointPosition(-1);
|
||||
editingCtx.splitSegments(editingCtx.getBeforePoints().size() + editingCtx.getAfterPoints().size());
|
||||
}
|
||||
|
||||
private void drawCenterIcon(Canvas canvas, RotatedTileBox tb, QuadPoint center, boolean nightMode) {
|
||||
canvas.rotate(-tb.getRotate(), center.x, center.y);
|
||||
if (nightMode) {
|
||||
|
|
|
@ -11,6 +11,7 @@ import android.view.ContextThemeWrapper;
|
|||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.animation.Animation;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
@ -43,6 +44,9 @@ public class SnapToRoadBottomSheetDialogFragment extends android.support.design.
|
|||
@Override
|
||||
public void setupDialog(Dialog dialog, int style) {
|
||||
super.setupDialog(dialog, style);
|
||||
if (getMyApplication().getSettings().DO_NOT_USE_ANIMATIONS.get()) {
|
||||
dialog.getWindow().setWindowAnimations(R.style.Animations_NoAnimation);
|
||||
}
|
||||
|
||||
nightMode = getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||
portrait = AndroidUiHelper.isOrientationPortrait(getActivity());
|
||||
|
|
Loading…
Reference in a new issue