From 439830a7f51ca4ef0bba124c32da150c2a88bc33 Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Wed, 27 Sep 2017 14:54:24 +0300 Subject: [PATCH 01/41] Fix crash in groups --- .../plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java index 017e820089..ee065546e5 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java @@ -281,7 +281,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter Date: Wed, 27 Sep 2017 15:13:08 +0300 Subject: [PATCH 02/41] Add UseLocationCard to markers list; add small fixes --- OsmAnd/res/layout/map_marker_item_new.xml | 16 +- OsmAnd/res/layout/use_location_card.xml | 17 +- .../plus/mapmarkers/PlanRouteFragment.java | 14 +- .../adapters/MapMarkersListAdapter.java | 199 ++++++++++-------- 4 files changed, 156 insertions(+), 90 deletions(-) diff --git a/OsmAnd/res/layout/map_marker_item_new.xml b/OsmAnd/res/layout/map_marker_item_new.xml index 98c29f7025..96c4cff626 100644 --- a/OsmAnd/res/layout/map_marker_item_new.xml +++ b/OsmAnd/res/layout/map_marker_item_new.xml @@ -7,11 +7,21 @@ android:descendantFocusability="blocksDescendants" android:orientation="vertical"> - + tools:visibility="visible"> + + + + + + - + + + + + + + + + diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java index e571d25b4a..c7b7b3c709 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java @@ -27,6 +27,7 @@ import net.osmand.plus.IconsCache; import net.osmand.plus.MapMarkersHelper; import net.osmand.plus.MapMarkersHelper.MapMarker; import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener; +import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.base.MapViewTrackingUtilities; @@ -161,7 +162,9 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene toolbarController.setOnBackButtonClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - quit(false); + if (quit(false)) { + MapMarkersDialogFragment.showInstance(mapActivity); + } } }); mapActivity.showTopToolbar(toolbarController); @@ -201,7 +204,14 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene toPosition = holder.getAdapterPosition(); if (toPosition >= 0 && fromPosition >= 0 && toPosition != fromPosition) { mapActivity.getMyApplication().getMapMarkersHelper().checkAndFixActiveMarkersOrderIfNeeded(); - adapter.notifyDataSetChanged(); + mapActivity.getMyApplication().getSettings().MAP_MARKERS_ORDER_BY_MODE.set(OsmandSettings.MapMarkersOrderByMode.CUSTOM); + mapActivity.refreshMap(); + try { + adapter.notifyDataSetChanged(); + } catch (Exception e) { + // to avoid crash because of: + // java.lang.IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling + } } } }); diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java index 0648d29be4..8963cba67c 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java @@ -22,11 +22,15 @@ import java.util.Date; import java.util.List; import java.util.Locale; -public class MapMarkersListAdapter extends RecyclerView.Adapter +public class MapMarkersListAdapter extends RecyclerView.Adapter implements MapMarkersItemTouchHelperCallback.ItemTouchHelperAdapter { + private static final int USE_LOCATION_CARD_TYPE = 1; + private static final int MARKER_ITEM_TYPE = 2; + private MapActivity mapActivity; private List markers; + private boolean locationCardDisplayed = true; private MapMarkersListAdapterListener listener; private LatLon location; @@ -50,107 +54,121 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter 1) { - month = Character.toUpperCase(month.charAt(0)) + month.substring(1); - } - String day = new SimpleDateFormat("dd", Locale.getDefault()).format(date); - descr = month + " " + day; - } - holder.description.setText(descr); - if (location != null) { - holder.distance.setTextColor(ContextCompat.getColor(mapActivity, useCenter - ? R.color.color_distance : R.color.color_myloc_distance)); - float dist = (float) MapUtils.getDistance(location.getLatitude(), location.getLongitude(), - marker.getLatitude(), marker.getLongitude()); - holder.distance.setText(OsmAndFormatter.getFormattedDistance(dist, mapActivity.getMyApplication())); + itemHolder.point.setVisibility(View.VISIBLE); + + itemHolder.iconReorder.setOnTouchListener(new View.OnTouchListener() { + @Override + public boolean onTouch(View view, MotionEvent event) { + if (MotionEventCompat.getActionMasked(event) == MotionEvent.ACTION_DOWN) { + listener.onDragStarted(itemHolder); + } + return false; + } + }); + + itemHolder.title.setText(marker.getName(mapActivity)); + + String descr; + if ((descr = marker.groupName) != null) { + if (descr.equals("")) { + descr = mapActivity.getString(R.string.shared_string_favorites); + } + } else { + Date date = new Date(marker.creationDate); + String month = new SimpleDateFormat("MMM", Locale.getDefault()).format(date); + if (month.length() > 1) { + month = Character.toUpperCase(month.charAt(0)) + month.substring(1); + } + String day = new SimpleDateFormat("dd", Locale.getDefault()).format(date); + descr = month + " " + day; + } + itemHolder.description.setText(descr); + + if (location != null) { + itemHolder.distance.setTextColor(ContextCompat.getColor(mapActivity, useCenter + ? R.color.color_distance : R.color.color_myloc_distance)); + float dist = (float) MapUtils.getDistance(location.getLatitude(), location.getLongitude(), + marker.getLatitude(), marker.getLongitude()); + itemHolder.distance.setText(OsmAndFormatter.getFormattedDistance(dist, mapActivity.getMyApplication())); + } } } @Override public int getItemCount() { - return markers.size(); + return locationCardDisplayed ? markers.size() + 1 : markers.size(); } public MapMarker getItem(int position) { - return markers.get(position); + return markers.get(locationCardDisplayed ? position - 1 : position); } @Override @@ -160,7 +178,10 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter Date: Wed, 27 Sep 2017 17:14:50 +0300 Subject: [PATCH 03/41] Hide quick actions button in Plan Route mode; open markers list by default; fix small bug --- .../plus/mapmarkers/PlanRouteFragment.java | 20 +++++++++++++++++++ .../MapMarkersItemTouchHelperCallback.java | 6 ++++-- .../plus/views/MapQuickActionLayer.java | 3 +++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java index c7b7b3c709..eb82305124 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java @@ -1,6 +1,7 @@ package net.osmand.plus.mapmarkers; import android.graphics.drawable.Drawable; +import android.os.Build; import android.os.Bundle; import android.support.annotation.DrawableRes; import android.support.annotation.Nullable; @@ -14,6 +15,7 @@ import android.view.ContextThemeWrapper; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.view.ViewTreeObserver; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.TextView; @@ -221,6 +223,24 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene markersRv.setLayoutManager(new LinearLayoutManager(getContext())); markersRv.setAdapter(adapter); + if (portrait) { + showMarkersList(); + } else { + mainView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { + @Override + public void onGlobalLayout() { + showMarkersList(); + + ViewTreeObserver obs = mainView.getViewTreeObserver(); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { + obs.removeOnGlobalLayoutListener(this); + } else { + obs.removeGlobalOnLayoutListener(this); + } + } + }); + } + return view; } diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersItemTouchHelperCallback.java b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersItemTouchHelperCallback.java index f8829b793c..32f08e9e0d 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersItemTouchHelperCallback.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersItemTouchHelperCallback.java @@ -132,8 +132,10 @@ public class MapMarkersItemTouchHelperCallback extends ItemTouchHelper.Callback @Override public void clearView(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { super.clearView(recyclerView, viewHolder); - ((MapMarkerItemViewHolder) viewHolder).optionsBtn.setVisibility(View.VISIBLE); - iconHidden = false; + if (iconHidden) { + ((MapMarkerItemViewHolder) viewHolder).optionsBtn.setVisibility(View.VISIBLE); + iconHidden = false; + } adapter.onItemDismiss(viewHolder); } diff --git a/OsmAnd/src/net/osmand/plus/views/MapQuickActionLayer.java b/OsmAnd/src/net/osmand/plus/views/MapQuickActionLayer.java index f5129c680a..f08e20539a 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapQuickActionLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapQuickActionLayer.java @@ -41,6 +41,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe private final ContextMenuLayer contextMenuLayer; private final MeasurementToolLayer measurementToolLayer; + private final MapMarkersLayer mapMarkersLayer; private ImageView contextMarker; private final MapActivity mapActivity; private final OsmandApplication app; @@ -66,6 +67,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe settings = activity.getMyApplication().getSettings(); quickActionRegistry = activity.getMapLayers().getQuickActionRegistry(); measurementToolLayer = mapActivity.getMapLayers().getMeasurementToolLayer(); + mapMarkersLayer = mapActivity.getMapLayers().getMapMarkersLayer(); } @@ -323,6 +325,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe contextMenuLayer.isInChangeMarkerPositionMode() || contextMenuLayer.isInGpxDetailsMode() || measurementToolLayer.isInMeasurementMode() || + mapMarkersLayer.isInPlanRouteMode() || mapActivity.getContextMenu().isVisible() && !mapActivity.getContextMenu().findMenuFragment().get().isRemoving() || mapActivity.getContextMenu().isVisible() && mapActivity.getContextMenu().findMenuFragment().get().isAdded() || mapActivity.getContextMenu().getMultiSelectionMenu().isVisible() && mapActivity.getContextMenu().getMultiSelectionMenu().getFragmentByTag().isAdded() || From ae01e250a92ad6a3337d3995140135f86ba24c54 Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Wed, 27 Sep 2017 18:07:03 +0300 Subject: [PATCH 04/41] Add on click listeners --- OsmAnd/res/layout/use_location_card.xml | 12 +++++------ .../plus/mapmarkers/PlanRouteFragment.java | 10 ++++++++++ .../adapters/MapMarkersListAdapter.java | 20 ++++++++++++++++++- 3 files changed, 35 insertions(+), 7 deletions(-) diff --git a/OsmAnd/res/layout/use_location_card.xml b/OsmAnd/res/layout/use_location_card.xml index 4a54f97736..2401f4df67 100644 --- a/OsmAnd/res/layout/use_location_card.xml +++ b/OsmAnd/res/layout/use_location_card.xml @@ -69,8 +69,8 @@ + android:layout_marginLeft="44dp" + android:layout_marginStart="44dp"> Date: Wed, 27 Sep 2017 19:50:33 +0300 Subject: [PATCH 05/41] Make keyboard clickable --- .../fragment_coordinate_input_dialog.xml | 33 +++- .../layout/input_coordinate_keyboard_item.xml | 6 +- OsmAnd/res/values/colors.xml | 2 + .../net/osmand/plus/OsmandTextFieldBoxes.java | 88 ++++++++++ .../CoordinateInputDialogFragment.java | 160 +++++++++++++++--- 5 files changed, 258 insertions(+), 31 deletions(-) create mode 100644 OsmAnd/src/net/osmand/plus/OsmandTextFieldBoxes.java diff --git a/OsmAnd/res/layout/fragment_coordinate_input_dialog.xml b/OsmAnd/res/layout/fragment_coordinate_input_dialog.xml index e1a67fc667..e5c17996b0 100644 --- a/OsmAnd/res/layout/fragment_coordinate_input_dialog.xml +++ b/OsmAnd/res/layout/fragment_coordinate_input_dialog.xml @@ -68,33 +68,41 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> - + android:layout_height="wrap_content" + app:labelText="@string/navigate_point_latitude"> - + - + android:layout_height="wrap_content" + app:labelText="@string/navigate_point_longitude"> - + @@ -104,17 +112,24 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> - + android:layout_height="wrap_content" + app:labelText="@string/shared_string_name"> - + + + - \ No newline at end of file diff --git a/OsmAnd/res/values/colors.xml b/OsmAnd/res/values/colors.xml index ddca75eb3b..82634e5bfa 100644 --- a/OsmAnd/res/values/colors.xml +++ b/OsmAnd/res/values/colors.xml @@ -264,4 +264,6 @@ #525e66 + #545454 + \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/OsmandTextFieldBoxes.java b/OsmAnd/src/net/osmand/plus/OsmandTextFieldBoxes.java new file mode 100644 index 0000000000..77f321df5f --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/OsmandTextFieldBoxes.java @@ -0,0 +1,88 @@ +package net.osmand.plus; + +import android.content.Context; +import android.support.v4.view.ViewCompat; +import android.util.AttributeSet; +import android.view.View; +import android.view.inputmethod.InputMethodManager; + +import studio.carbonylgroup.textfieldboxes.TextFieldBoxes; + +public class OsmandTextFieldBoxes extends TextFieldBoxes { + + private boolean useOsmandKeyboard; + + public void setUseOsmandKeyboard(boolean useOsmandKeyboard) { + this.useOsmandKeyboard = useOsmandKeyboard; + } + + public OsmandTextFieldBoxes(Context context) { + super(context); + } + + public OsmandTextFieldBoxes(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public OsmandTextFieldBoxes(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + @Override + protected void onFinishInflate() { + super.onFinishInflate(); + if (editText != null) { + this.panel.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View view) { + if(!OsmandTextFieldBoxes.this.isActivated()) { + OsmandTextFieldBoxes.this.activate(true); + } + + OsmandTextFieldBoxes.this.setHasFocus(true); + if (!useOsmandKeyboard) { + OsmandTextFieldBoxes.this.inputMethodManager.showSoftInput(OsmandTextFieldBoxes.this.editText, InputMethodManager.SHOW_IMPLICIT); + } + } + }); + + this.iconImageButton.setOnClickListener(new OnClickListener() { + public void onClick(View v) { + select(); + } + }); + } + } + + public void select() { + if(!OsmandTextFieldBoxes.this.isActivated()) { + OsmandTextFieldBoxes.this.activate(true); + } + + OsmandTextFieldBoxes.this.setHasFocus(true); + if (!useOsmandKeyboard) { + OsmandTextFieldBoxes.this.inputMethodManager.showSoftInput(OsmandTextFieldBoxes.this.editText, InputMethodManager.SHOW_IMPLICIT); + } + } + + @Override + public void activate(boolean animated) { + super.activate(animated); + } + + @Override + protected void deactivate() { + if(this.editText.getText().toString().isEmpty()) { + ViewCompat.animate(this.floatingLabel).alpha(1.0F).scaleX(1.0F).scaleY(1.0F).translationY(0.0F).setDuration((long)this.ANIMATION_DURATION); + this.editTextLayout.setVisibility(View.INVISIBLE); + if(this.editText.hasFocus()) { + if (!useOsmandKeyboard) { + this.inputMethodManager.hideSoftInputFromWindow(this.editText.getWindowToken(), InputMethodManager.RESULT_UNCHANGED_SHOWN); + } + this.editText.clearFocus(); + } + } + + this.activated = false; + } +} diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java index e3cc6b2e56..1c9c990f18 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java @@ -2,17 +2,22 @@ package net.osmand.plus.mapmarkers; import android.content.Context; import android.os.Bundle; +import android.support.annotation.LayoutRes; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.DialogFragment; -import android.support.v4.content.ContextCompat; import android.support.v7.widget.Toolbar; +import android.text.Editable; import android.text.InputType; +import android.text.TextWatcher; +import android.view.Gravity; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; +import android.view.inputmethod.InputMethodManager; +import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.EditText; import android.widget.GridView; @@ -20,14 +25,29 @@ import android.widget.TextView; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandSettings; +import net.osmand.plus.OsmandTextFieldBoxes; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.helpers.FontCache; +import net.osmand.plus.widgets.TextViewEx; + +import java.util.ArrayList; +import java.util.List; + +import studio.carbonylgroup.textfieldboxes.ExtendedEditText; public class CoordinateInputDialogFragment extends DialogFragment { + private static final int DELETE_BUTTON_POSITION = 9; + private static final int CLEAR_BUTTON_POSITION = 11; + public static final String TAG = "CoordinateInputDialogFragment"; private boolean lightTheme; + private EditText focusedEditText; + private boolean useOsmandKeyboard = true; + private List textFieldBoxes = new ArrayList<>(); + private List extendedEditTexts = new ArrayList<>(); @Override public void onCreate(Bundle savedInstanceState) { @@ -45,9 +65,6 @@ public class CoordinateInputDialogFragment extends DialogFragment { final MapActivity mapActivity = getMapActivity(); Toolbar toolbar = (Toolbar) mainView.findViewById(R.id.coordinate_input_toolbar); - if (!lightTheme) { - toolbar.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.actionbar_dark_color)); - } toolbar.setNavigationIcon(getMyApplication().getIconsCache().getIcon(R.drawable.ic_arrow_back)); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @@ -64,47 +81,141 @@ public class CoordinateInputDialogFragment extends DialogFragment { } }); - final EditText latitudeEditText = (EditText) mainView.findViewById(R.id.latitude_edit_text); - final EditText longitudeEditText = (EditText) mainView.findViewById(R.id.longitude_edit_text); - final EditText nameEditText = (EditText) mainView.findViewById(R.id.name_edit_text); + final OsmandTextFieldBoxes latitudeBox = (OsmandTextFieldBoxes) mainView.findViewById(R.id.latitude_box); + textFieldBoxes.add(latitudeBox); + final OsmandTextFieldBoxes longitudeBox = (OsmandTextFieldBoxes) mainView.findViewById(R.id.longitude_box); + textFieldBoxes.add(longitudeBox); + final OsmandTextFieldBoxes nameBox = (OsmandTextFieldBoxes) mainView.findViewById(R.id.name_box); + textFieldBoxes.add(nameBox); - View.OnTouchListener editTextOnTouchListener = new View.OnTouchListener() { + final ExtendedEditText latitudeEditText = (ExtendedEditText) mainView.findViewById(R.id.latitude_edit_text); + extendedEditTexts.add(latitudeEditText); + final ExtendedEditText longitudeEditText = (ExtendedEditText) mainView.findViewById(R.id.longitude_edit_text); + extendedEditTexts.add(longitudeEditText); + final ExtendedEditText nameEditText = (ExtendedEditText) mainView.findViewById(R.id.name_edit_text); + extendedEditTexts.add(nameEditText); + + final View.OnFocusChangeListener focusChangeListener = new View.OnFocusChangeListener() { @Override - public boolean onTouch(View view, MotionEvent motionEvent) { - EditText editText = null; + public void onFocusChange(View view, boolean b) { + ExtendedEditText editText = null; + OsmandTextFieldBoxes fieldBox = null; switch (view.getId()) { case R.id.latitude_edit_text: editText = latitudeEditText; + fieldBox = latitudeBox; break; case R.id.longitude_edit_text: editText = longitudeEditText; + fieldBox = longitudeBox; break; case R.id.name_edit_text: editText = nameEditText; + fieldBox = nameBox; break; } - if (editText != null) { - editText.requestFocus(); + if (fieldBox != null) { + if (b) { + fieldBox.setHasFocus(true); + focusedEditText = editText; + } else { + fieldBox.setHasFocus(false); + focusedEditText = null; + } } - return true; } }; - latitudeEditText.setOnTouchListener(editTextOnTouchListener); - longitudeEditText.setOnTouchListener(editTextOnTouchListener); - nameEditText.setOnTouchListener(editTextOnTouchListener); + TextWatcher textWatcher = new TextWatcher() { + int len = 0; + + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { + if (focusedEditText != null) { + String str = focusedEditText.getText().toString(); + len = str.length(); + } + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void afterTextChanged(Editable editable) { + if (focusedEditText != null) { + String str = focusedEditText.getText().toString(); + if(str.length() == 2 && len < str.length()){ + focusedEditText.append(":"); + } else if (str.length() == 5 && len < str.length()) { + focusedEditText.append("."); + } else if (str.length() == 10) { + if (focusedEditText == latitudeEditText) { + longitudeBox.select(); + } else if (focusedEditText == longitudeEditText) { + nameBox.select(); + } + } + } + } + }; + + latitudeEditText.setOnFocusChangeListener(focusChangeListener); + longitudeEditText.setOnFocusChangeListener(focusChangeListener); + nameEditText.setOnFocusChangeListener(focusChangeListener); + + latitudeEditText.addTextChangedListener(textWatcher); + longitudeEditText.addTextChangedListener(textWatcher); + nameEditText.addTextChangedListener(textWatcher); + + changeKeyboardInBoxes(useOsmandKeyboard); + changeKeyboardInEditTexts(useOsmandKeyboard); String[] keyboardItems = new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", getString(R.string.shared_string_delete), "0", getString(R.string.shared_string_clear) }; - GridView keyboardGrid = (GridView) mainView.findViewById(R.id.keyboard_grid_view); - KeyboardAdapter keyboardAdapter = new KeyboardAdapter(mapActivity, keyboardItems); + final GridView keyboardGrid = (GridView) mainView.findViewById(R.id.keyboard_grid_view); + final KeyboardAdapter keyboardAdapter = new KeyboardAdapter(mapActivity, keyboardItems); keyboardGrid.setAdapter(keyboardAdapter); + keyboardGrid.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView adapterView, View view, int i, long l) { + if (focusedEditText != null) { + switch (i) { + case DELETE_BUTTON_POSITION: + String str = focusedEditText.getText().toString(); + if (str.length() > 0) { + str = str.substring(0, str.length() - 1); + focusedEditText.setText(str); + } + break; + case CLEAR_BUTTON_POSITION: + focusedEditText.setText(""); + break; + default: + focusedEditText.append(keyboardAdapter.getItem(i)); + } + } + } + }); return mainView; } + public void changeKeyboardInBoxes(boolean useOsmandKeyboard) { + for (OsmandTextFieldBoxes textFieldBox : textFieldBoxes) { + textFieldBox.setUseOsmandKeyboard(useOsmandKeyboard); + } + } + + public void changeKeyboardInEditTexts(boolean useOsmandKeyboard) { + for (ExtendedEditText extendedEditText : extendedEditTexts) { + extendedEditText.setInputType(useOsmandKeyboard ? InputType.TYPE_NULL : InputType.TYPE_CLASS_TEXT); + } + } + private MapActivity getMapActivity() { return (MapActivity) getActivity(); } @@ -128,8 +239,8 @@ public class CoordinateInputDialogFragment extends DialogFragment { private class KeyboardAdapter extends ArrayAdapter { - KeyboardAdapter(@NonNull Context context, String[] items) { - super(context, 0, items); + KeyboardAdapter(@NonNull Context context, @NonNull String[] objects) { + super(context, 0, objects); } @NonNull @@ -139,7 +250,14 @@ public class CoordinateInputDialogFragment extends DialogFragment { convertView = LayoutInflater.from(getContext()).inflate(R.layout.input_coordinate_keyboard_item, parent, false); } - ((TextView) convertView.findViewById(R.id.keyboard_item)).setText(getItem(position)); + TextViewEx keyboardItem = (TextViewEx) convertView.findViewById(R.id.keyboard_item); + if (position == DELETE_BUTTON_POSITION || position == CLEAR_BUTTON_POSITION) { + keyboardItem.setTextSize(getResources().getDimension(R.dimen.default_list_text_size)); + } else { + keyboardItem.setTextSize(getResources().getDimension(R.dimen.map_button_text_size)); + } + + keyboardItem.setText(getItem(position)); return convertView; } From 6bb5aa6ae2ae225cb282524138f97a5e4dd76bdf Mon Sep 17 00:00:00 2001 From: PavelRatushnyi Date: Thu, 28 Sep 2017 11:17:14 +0300 Subject: [PATCH 06/41] Create background for keyboard item --- OsmAnd/res/drawable/keyboard_item_dark_bg.xml | 7 +++++++ OsmAnd/res/drawable/keyboard_item_light_bg.xml | 7 +++++++ OsmAnd/res/layout/input_coordinate_keyboard_item.xml | 1 - .../mapmarkers/CoordinateInputDialogFragment.java | 11 ++++++----- 4 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 OsmAnd/res/drawable/keyboard_item_dark_bg.xml create mode 100644 OsmAnd/res/drawable/keyboard_item_light_bg.xml diff --git a/OsmAnd/res/drawable/keyboard_item_dark_bg.xml b/OsmAnd/res/drawable/keyboard_item_dark_bg.xml new file mode 100644 index 0000000000..b4a642e69e --- /dev/null +++ b/OsmAnd/res/drawable/keyboard_item_dark_bg.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/drawable/keyboard_item_light_bg.xml b/OsmAnd/res/drawable/keyboard_item_light_bg.xml new file mode 100644 index 0000000000..6c0b9d69b2 --- /dev/null +++ b/OsmAnd/res/drawable/keyboard_item_light_bg.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/layout/input_coordinate_keyboard_item.xml b/OsmAnd/res/layout/input_coordinate_keyboard_item.xml index 67497a6c0f..6c467df338 100644 --- a/OsmAnd/res/layout/input_coordinate_keyboard_item.xml +++ b/OsmAnd/res/layout/input_coordinate_keyboard_item.xml @@ -4,7 +4,6 @@ xmlns:osmand="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="56dp" - android:background="?attr/bg_color" android:orientation="vertical"> Date: Thu, 28 Sep 2017 12:02:43 +0300 Subject: [PATCH 07/41] Add coordinate format dialog --- ...r_coordinate_input_bottom_sheet_dialog.xml | 296 ++++++++++++++++++ OsmAnd/res/values/strings.xml | 2 + ...rdinateInputBottomSheetDialogFragment.java | 170 ++++++++++ .../CoordinateInputDialogFragment.java | 3 + 4 files changed, 471 insertions(+) create mode 100644 OsmAnd/res/layout/fragment_marker_coordinate_input_bottom_sheet_dialog.xml create mode 100644 OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputBottomSheetDialogFragment.java diff --git a/OsmAnd/res/layout/fragment_marker_coordinate_input_bottom_sheet_dialog.xml b/OsmAnd/res/layout/fragment_marker_coordinate_input_bottom_sheet_dialog.xml new file mode 100644 index 0000000000..e44479208b --- /dev/null +++ b/OsmAnd/res/layout/fragment_marker_coordinate_input_bottom_sheet_dialog.xml @@ -0,0 +1,296 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 0b293f24c2..82b48f1fb2 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -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 --> + Choose oordinate format before start. YOu can always change it by tapping Options. + Fast Coordinates input Use location Add your location as first point to plan perfect route. My Location diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputBottomSheetDialogFragment.java new file mode 100644 index 0000000000..069e3dbc37 --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputBottomSheetDialogFragment.java @@ -0,0 +1,170 @@ +package net.osmand.plus.mapmarkers; + +import android.graphics.drawable.Drawable; +import android.os.Build; +import android.os.Bundle; +import android.support.annotation.DrawableRes; +import android.support.annotation.Nullable; +import android.view.ContextThemeWrapper; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.ViewTreeObserver; +import android.view.Window; +import android.view.WindowManager; +import android.widget.ImageView; +import android.widget.TextView; + +import net.osmand.AndroidUtils; +import net.osmand.data.PointDescription; +import net.osmand.plus.R; +import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.base.BottomSheetDialogFragment; +import net.osmand.plus.helpers.AndroidUiHelper; + +import org.w3c.dom.Text; + +public class CoordinateInputBottomSheetDialogFragment extends BottomSheetDialogFragment { + + public final static String TAG = "CoordinateInputBottomSheetDialogFragment"; + + private boolean portrait; + private View mainView; + private boolean night; + + private Format currentFormat = Format.DEGREES; + + private enum Format { + DEGREES, + MINUTES, + SECONDS, + UTM, + OLC + } + + @Nullable + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + final MapActivity mapActivity = (MapActivity) getActivity(); + portrait = AndroidUiHelper.isOrientationPortrait(getActivity()); + night = !mapActivity.getMyApplication().getSettings().isLightContent(); + final int themeRes = night ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme; + + mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.fragment_marker_coordinate_input_bottom_sheet_dialog, container); + if (portrait) { + AndroidUtils.setBackground(getActivity(), mainView, night, R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark); + } + + if (night) { + ((TextView) mainView.findViewById(R.id.coordinate_input_title)).setTextColor(getResources().getColor(R.color.ctx_menu_info_text_dark)); + } + + ImageView degreesIcon = (ImageView) mainView.findViewById(R.id.degrees_icon); + TextView degreesText = (TextView) mainView.findViewById(R.id.degrees_text); + if (currentFormat == Format.DEGREES) { + degreesIcon.setImageDrawable(getIcon(R.drawable.ic_action_coordinates_latitude, R.color.dashboard_blue)); + } else { + degreesIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_coordinates_latitude)); + } + + ImageView minutesIcon = (ImageView) mainView.findViewById(R.id.minutes_icon); + TextView minutesText = (TextView) mainView.findViewById(R.id.minutes_text); + if (currentFormat == Format.MINUTES) { + minutesIcon.setImageDrawable(getIcon(R.drawable.ic_action_coordinates_latitude, R.color.dashboard_blue)); + } else { + minutesIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_coordinates_latitude)); + } + + ImageView secondsIcon = (ImageView) mainView.findViewById(R.id.seconds_icon); + TextView secondsText = (TextView) mainView.findViewById(R.id.seconds_text); + if (currentFormat == Format.SECONDS) { + secondsIcon.setImageDrawable(getIcon(R.drawable.ic_action_coordinates_latitude, R.color.dashboard_blue)); + } else { + secondsIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_coordinates_latitude)); + } + + ImageView utmIcon = (ImageView) mainView.findViewById(R.id.utm_icon); + TextView utmText = (TextView) mainView.findViewById(R.id.utm_text); + if (currentFormat == Format.UTM) { + utmIcon.setImageDrawable(getIcon(R.drawable.ic_action_coordinates_latitude, R.color.dashboard_blue)); + } else { + utmIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_coordinates_latitude)); + } + + ImageView olcIcon = (ImageView) mainView.findViewById(R.id.olc_icon); + TextView olcText = (TextView) mainView.findViewById(R.id.olc_text); + if (currentFormat == Format.OLC) { + olcIcon.setImageDrawable(getIcon(R.drawable.ic_action_coordinates_latitude, R.color.dashboard_blue)); + } else { + olcIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_coordinates_latitude)); + } + + ((TextView) mainView.findViewById(R.id.degrees_text)).setText(PointDescription.formatToHumanString(getContext(), PointDescription.FORMAT_DEGREES)); + ((TextView) mainView.findViewById(R.id.minutes_text)).setText(PointDescription.formatToHumanString(getContext(), PointDescription.FORMAT_MINUTES)); + ((TextView) mainView.findViewById(R.id.seconds_text)).setText(PointDescription.formatToHumanString(getContext(), PointDescription.FORMAT_SECONDS)); + ((TextView) mainView.findViewById(R.id.utm_text)).setText(PointDescription.formatToHumanString(getContext(), PointDescription.UTM_FORMAT)); + ((TextView) mainView.findViewById(R.id.olc_text)).setText(PointDescription.formatToHumanString(getContext(), PointDescription.OLC_FORMAT)); + + mainView.findViewById(R.id.cancel_row).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + dismiss(); + } + }); + + final int screenHeight = AndroidUtils.getScreenHeight(getActivity()); + final int statusBarHeight = AndroidUtils.getStatusBarHeight(getActivity()); + final int navBarHeight = AndroidUtils.getNavBarHeight(getActivity()); + + mainView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { + @Override + public void onGlobalLayout() { + final View scrollView = mainView.findViewById(R.id.marker_show_direction_scroll_view); + int scrollViewHeight = scrollView.getHeight(); + int dividerHeight = AndroidUtils.dpToPx(getContext(), 1); + int cancelButtonHeight = getContext().getResources().getDimensionPixelSize(R.dimen.bottom_sheet_cancel_button_height); + int spaceForScrollView = screenHeight - statusBarHeight - navBarHeight - dividerHeight - cancelButtonHeight; + if (scrollViewHeight > spaceForScrollView) { + scrollView.getLayoutParams().height = spaceForScrollView; + scrollView.requestLayout(); + } + + if (!portrait) { + if (screenHeight - statusBarHeight - mainView.getHeight() + >= AndroidUtils.dpToPx(getActivity(), 8)) { + AndroidUtils.setBackground(getActivity(), mainView, false, + R.drawable.bg_bottom_sheet_topsides_landscape_light, R.drawable.bg_bottom_sheet_topsides_landscape_dark); + } else { + AndroidUtils.setBackground(getActivity(), mainView, false, + R.drawable.bg_bottom_sheet_sides_landscape_light, R.drawable.bg_bottom_sheet_sides_landscape_dark); + } + } + + ViewTreeObserver obs = mainView.getViewTreeObserver(); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { + obs.removeOnGlobalLayoutListener(this); + } else { + obs.removeGlobalOnLayoutListener(this); + } + } + }); + + return mainView; + } + + @Override + public void onStart() { + super.onStart(); + if (!portrait) { + final Window window = getDialog().getWindow(); + WindowManager.LayoutParams params = window.getAttributes(); + params.width = getActivity().getResources().getDimensionPixelSize(R.dimen.landscape_bottom_sheet_dialog_fragment_width); + window.setAttributes(params); + } + } + + @Override + protected Drawable getContentIcon(@DrawableRes int id) { + return getIcon(id, night ? R.color.ctx_menu_info_text_dark : R.color.on_map_icon_color); + } +} diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java index 630c34b234..188677f5a3 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java @@ -56,6 +56,9 @@ public class CoordinateInputDialogFragment extends DialogFragment { lightTheme = app.getSettings().OSMAND_THEME.get() == OsmandSettings.OSMAND_LIGHT_THEME; int themeId = lightTheme ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme; setStyle(STYLE_NO_FRAME, themeId); + + CoordinateInputBottomSheetDialogFragment fragment = new CoordinateInputBottomSheetDialogFragment(); + fragment.show(getMapActivity().getSupportFragmentManager(), CoordinateInputBottomSheetDialogFragment.TAG); } @Nullable From 7c8e39d0ebb13e4f78b5135ded03a0c7d26a9b8c Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Thu, 28 Sep 2017 12:36:41 +0300 Subject: [PATCH 08/41] Add displaying of selected markers --- .../src/net/osmand/plus/MapMarkersHelper.java | 4 +- .../plus/mapmarkers/PlanRouteFragment.java | 67 +++++++++++++++++-- 2 files changed, 64 insertions(+), 7 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java b/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java index 09fef6e6c1..fa6ff570d2 100644 --- a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java +++ b/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java @@ -225,7 +225,7 @@ public class MapMarkersHelper { this.ctx = ctx; settings = ctx.getSettings(); markersDbHelper = ctx.getMapMarkersDbHelper(); - startFromMyLocation = settings.ROUTE_MAP_MARKERS_START_MY_LOC.get(); +// startFromMyLocation = settings.ROUTE_MAP_MARKERS_START_MY_LOC.get(); removeDisabledGroups(); loadMarkers(); createMapMarkersGroups(); @@ -237,7 +237,7 @@ public class MapMarkersHelper { public void setStartFromMyLocation(boolean startFromMyLocation) { this.startFromMyLocation = startFromMyLocation; - settings.ROUTE_MAP_MARKERS_START_MY_LOC.set(startFromMyLocation); +// settings.ROUTE_MAP_MARKERS_START_MY_LOC.set(startFromMyLocation); } public void lookupAddressAll() { diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java index 518fc5c1ec..7872a00953 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java @@ -24,6 +24,7 @@ import android.widget.Toast; import net.osmand.AndroidUtils; import net.osmand.Location; import net.osmand.data.LatLon; +import net.osmand.data.RotatedTileBox; import net.osmand.plus.ApplicationMode; import net.osmand.plus.IconsCache; import net.osmand.plus.MapMarkersHelper; @@ -44,8 +45,9 @@ import net.osmand.plus.views.OsmandMapTileView; import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory; import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController; +import java.util.List; + import static net.osmand.plus.OsmandSettings.LANDSCAPE_MIDDLE_RIGHT_CONSTANT; -import static net.osmand.plus.OsmandSettings.MIDDLE_TOP_CONSTANT; public class PlanRouteFragment extends Fragment implements OsmAndLocationListener { @@ -59,6 +61,8 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene private int previousMapPosition; private int selectedCount = 0; + private int toolbarHeight; + private Location location; private boolean locationUpdateStarted; @@ -91,6 +95,8 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene hideMarkersListFragment(); } + toolbarHeight = mapActivity.getResources().getDimensionPixelSize(R.dimen.dashboard_map_toolbar); + iconsCache = mapActivity.getMyApplication().getIconsCache(); nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls(); final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme; @@ -141,6 +147,8 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene } adapter.notifyDataSetChanged(); updateSelectButton(); + showMarkersRouteOnMap(); + mapActivity.refreshMap(); } }); @@ -193,6 +201,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene marker.selected = !marker.selected; adapter.notifyItemChanged(pos); updateSelectButton(); + showMarkersRouteOnMap(); } @Override @@ -354,6 +363,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene } setupAppModesBtn(); + showMarkersRouteOnMap(); mapActivity.refreshMap(); updateText(); updateSelectButton(); @@ -407,6 +417,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene mapActivity.findViewById(R.id.snap_to_road_image_button).setVisibility(View.GONE); mainView.findViewById(R.id.snap_to_road_progress_bar).setVisibility(View.GONE); + markersLayer.clearRoute(); mapActivity.refreshMap(); } } @@ -424,7 +435,6 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene } } - private void updateLocationUi() { final MapActivity mapActivity = (MapActivity) getActivity(); if (mapActivity != null && adapter != null) { @@ -472,9 +482,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene } OsmandMapTileView tileView = mapActivity.getMapView(); previousMapPosition = tileView.getMapPosition(); - if (portrait) { - tileView.setMapPosition(MIDDLE_TOP_CONSTANT); - } else { + if (!portrait) { tileView.setMapPosition(LANDSCAPE_MIDDLE_RIGHT_CONSTANT); } mapActivity.refreshMap(); @@ -546,6 +554,55 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene } } + private void showMarkersRouteOnMap() { + MapActivity mapActivity = getMapActivity(); + if (mapActivity != null) { + List points = markersHelper.getSelectedMarkersLatLon(); + mapActivity.getMapLayers().getMapMarkersLayer().setRoute(points); + showRouteOnMap(points); + } + } + + private void showRouteOnMap(List points) { + MapActivity mapActivity = getMapActivity(); + if (points.size() > 0 && mapActivity != null) { + OsmandMapTileView mapView = mapActivity.getMapView(); + double left = 0, right = 0; + double top = 0, bottom = 0; + Location myLocation = mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation(); + if (mapActivity.getMyApplication().getMapMarkersHelper().isStartFromMyLocation() && myLocation != null) { + left = myLocation.getLongitude(); + right = myLocation.getLongitude(); + top = myLocation.getLatitude(); + bottom = myLocation.getLatitude(); + } + for (LatLon l : points) { + if (left == 0) { + left = l.getLongitude(); + right = l.getLongitude(); + top = l.getLatitude(); + bottom = l.getLatitude(); + } else { + left = Math.min(left, l.getLongitude()); + right = Math.max(right, l.getLongitude()); + top = Math.max(top, l.getLatitude()); + bottom = Math.min(bottom, l.getLatitude()); + } + } + + RotatedTileBox tb = mapView.getCurrentRotatedTileBox().copy(); + int tileBoxWidthPx = 0; + int tileBoxHeightPx = 0; + + if (portrait) { + tileBoxHeightPx = 3 * (tb.getPixHeight() - mainView.getHeight() - toolbarHeight) / 4; + } else { + tileBoxWidthPx = tb.getPixWidth() - mainView.findViewById(R.id.up_down_row).getWidth(); + } + mapView.fitRectToMap(left, right, top, bottom, tileBoxWidthPx, tileBoxHeightPx, toolbarHeight * 3 / 2); + } + } + public boolean quit(boolean hideMarkersListFirst) { if (markersListOpened && hideMarkersListFirst) { hideMarkersList(); From ee943cbf4f02552a65f4f7b5d30221dbc9ca2910 Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Thu, 28 Sep 2017 13:12:41 +0300 Subject: [PATCH 09/41] Disable context menu in plan route mode --- OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java b/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java index 15cdc2ec9c..1d5fe1bac8 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java @@ -414,12 +414,12 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi @Override public boolean disableSingleTap() { - return false; + return inPlanRouteMode; } @Override public boolean disableLongPressOnMap() { - return false; + return inPlanRouteMode; } @Override From 20a99ac9c6aa4914d84a16d9eb38492ce64c57df Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Thu, 28 Sep 2017 14:54:20 +0300 Subject: [PATCH 10/41] Replace Use My Location card with location item --- OsmAnd/res/layout/use_location_card.xml | 110 ------------ OsmAnd/res/values/strings.xml | 3 - .../src/net/osmand/plus/MapMarkersHelper.java | 4 +- .../plus/mapmarkers/PlanRouteFragment.java | 20 +-- .../adapters/MapMarkersListAdapter.java | 170 +++++++----------- 5 files changed, 73 insertions(+), 234 deletions(-) delete mode 100644 OsmAnd/res/layout/use_location_card.xml diff --git a/OsmAnd/res/layout/use_location_card.xml b/OsmAnd/res/layout/use_location_card.xml deleted file mode 100644 index 2401f4df67..0000000000 --- a/OsmAnd/res/layout/use_location_card.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 82b48f1fb2..4a25aa9adc 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -11,9 +11,6 @@ --> Choose oordinate format before start. YOu can always change it by tapping Options. Fast Coordinates input - Use location - Add your location as first point to plan perfect route. - My Location Finish Plan route Sort diff --git a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java b/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java index fa6ff570d2..09fef6e6c1 100644 --- a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java +++ b/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java @@ -225,7 +225,7 @@ public class MapMarkersHelper { this.ctx = ctx; settings = ctx.getSettings(); markersDbHelper = ctx.getMapMarkersDbHelper(); -// startFromMyLocation = settings.ROUTE_MAP_MARKERS_START_MY_LOC.get(); + startFromMyLocation = settings.ROUTE_MAP_MARKERS_START_MY_LOC.get(); removeDisabledGroups(); loadMarkers(); createMapMarkersGroups(); @@ -237,7 +237,7 @@ public class MapMarkersHelper { public void setStartFromMyLocation(boolean startFromMyLocation) { this.startFromMyLocation = startFromMyLocation; -// settings.ROUTE_MAP_MARKERS_START_MY_LOC.set(startFromMyLocation); + settings.ROUTE_MAP_MARKERS_START_MY_LOC.set(startFromMyLocation); } public void lookupAddressAll() { diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java index 7872a00953..fdc5c4ec1b 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java @@ -196,9 +196,13 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene @Override public void onItemClick(View view) { int pos = markersRv.getChildAdapterPosition(view); - MapMarker marker = adapter.getItem(pos); - selectedCount = marker.selected ? selectedCount - 1 : selectedCount + 1; - marker.selected = !marker.selected; + if (pos == 0) { + Toast.makeText(mapActivity, "location selected", Toast.LENGTH_SHORT).show(); + } else { + MapMarker marker = adapter.getItem(pos); + selectedCount = marker.selected ? selectedCount - 1 : selectedCount + 1; + marker.selected = !marker.selected; + } adapter.notifyItemChanged(pos); updateSelectButton(); showMarkersRouteOnMap(); @@ -225,16 +229,6 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene } } } - - @Override - public void onUseLocationClick() { - Toast.makeText(mapActivity, "use location", Toast.LENGTH_SHORT).show(); - } - - @Override - public void onDoNotUseLocationClick() { - Toast.makeText(mapActivity, "do not use location", Toast.LENGTH_SHORT).show(); - } }); boolean isSmartphone = getResources().getConfiguration().smallestScreenWidthDp < 600; markersRv.setPadding(0, 0, 0, AndroidUtils.dpToPx(mapActivity, isSmartphone ? 72 : 108)); diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java index 17bdbc117b..edb94ecb51 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java @@ -22,15 +22,11 @@ import java.util.Date; import java.util.List; import java.util.Locale; -public class MapMarkersListAdapter extends RecyclerView.Adapter +public class MapMarkersListAdapter extends RecyclerView.Adapter implements MapMarkersItemTouchHelperCallback.ItemTouchHelperAdapter { - private static final int USE_LOCATION_CARD_TYPE = 1; - private static final int MARKER_ITEM_TYPE = 2; - private MapActivity mapActivity; private List markers; - private boolean locationCardDisplayed = true; private MapMarkersListAdapterListener listener; private LatLon location; @@ -54,102 +50,79 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter Date: Thu, 28 Sep 2017 15:18:31 +0300 Subject: [PATCH 11/41] Add functionality to use location item --- .../src/net/osmand/plus/mapmarkers/PlanRouteFragment.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java index fdc5c4ec1b..5ff75abd8e 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java @@ -138,11 +138,13 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene @Override public void onClick(View view) { int activeMarkersCount = markersHelper.getMapMarkers().size(); - if (selectedCount == activeMarkersCount) { + if (selectedCount == activeMarkersCount && markersHelper.isStartFromMyLocation()) { markersHelper.deselectAllActiveMarkers(); + markersHelper.setStartFromMyLocation(false); selectedCount = 0; } else { markersHelper.selectAllActiveMarkers(); + markersHelper.setStartFromMyLocation(true); selectedCount = activeMarkersCount; } adapter.notifyDataSetChanged(); @@ -197,7 +199,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene public void onItemClick(View view) { int pos = markersRv.getChildAdapterPosition(view); if (pos == 0) { - Toast.makeText(mapActivity, "location selected", Toast.LENGTH_SHORT).show(); + markersHelper.setStartFromMyLocation(!mapActivity.getMyApplication().getSettings().ROUTE_MAP_MARKERS_START_MY_LOC.get()); } else { MapMarker marker = adapter.getItem(pos); selectedCount = marker.selected ? selectedCount - 1 : selectedCount + 1; @@ -422,7 +424,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene } private void updateSelectButton() { - if (selectedCount == markersHelper.getMapMarkers().size()) { + if (selectedCount == markersHelper.getMapMarkers().size() && markersHelper.isStartFromMyLocation()) { ((TextView) mainView.findViewById(R.id.select_all_button)).setText(getString(R.string.shared_string_deselect_all)); } else { ((TextView) mainView.findViewById(R.id.select_all_button)).setText(getString(R.string.shared_string_select_all)); From e72d419e9aa32eade54aabcc73c3ef69615aaf18 Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Thu, 28 Sep 2017 15:35:36 +0300 Subject: [PATCH 12/41] Add support for different coordinate formats --- .../fragment_coordinate_input_dialog.xml | 2 - ...r_coordinate_input_bottom_sheet_dialog.xml | 365 ++++++++---------- OsmAnd/res/values/strings.xml | 2 +- ...rdinateInputBottomSheetDialogFragment.java | 88 ++++- .../CoordinateInputDialogFragment.java | 122 ++++-- 5 files changed, 332 insertions(+), 247 deletions(-) diff --git a/OsmAnd/res/layout/fragment_coordinate_input_dialog.xml b/OsmAnd/res/layout/fragment_coordinate_input_dialog.xml index e5c17996b0..f993663744 100644 --- a/OsmAnd/res/layout/fragment_coordinate_input_dialog.xml +++ b/OsmAnd/res/layout/fragment_coordinate_input_dialog.xml @@ -77,7 +77,6 @@ @@ -97,7 +96,6 @@ diff --git a/OsmAnd/res/layout/fragment_marker_coordinate_input_bottom_sheet_dialog.xml b/OsmAnd/res/layout/fragment_marker_coordinate_input_bottom_sheet_dialog.xml index e44479208b..f294958fc2 100644 --- a/OsmAnd/res/layout/fragment_marker_coordinate_input_bottom_sheet_dialog.xml +++ b/OsmAnd/res/layout/fragment_marker_coordinate_input_bottom_sheet_dialog.xml @@ -42,230 +42,197 @@ android:textColor="?android:textColorSecondary" android:textSize="@dimen/default_desc_text_size"/> - + android:layout_height="@dimen/bottom_sheet_list_item_height" + android:background="?attr/selectableItemBackground" + android:gravity="center_vertical" + android:minHeight="@dimen/bottom_sheet_list_item_height" + android:paddingEnd="@dimen/bottom_sheet_content_padding" + android:paddingLeft="@dimen/bottom_sheet_content_padding" + android:paddingRight="@dimen/bottom_sheet_content_padding" + android:paddingStart="@dimen/bottom_sheet_content_padding"> - + - + - + + - - - - - + android:layout_height="@dimen/bottom_sheet_list_item_height" + android:background="?attr/selectableItemBackground" + android:gravity="center_vertical" + android:minHeight="@dimen/bottom_sheet_list_item_height" + android:paddingEnd="@dimen/bottom_sheet_content_padding" + android:paddingLeft="@dimen/bottom_sheet_content_padding" + android:paddingRight="@dimen/bottom_sheet_content_padding" + android:paddingStart="@dimen/bottom_sheet_content_padding"> - + - + - + + - - - - - - + android:layout_height="@dimen/bottom_sheet_list_item_height" + android:background="?attr/selectableItemBackground" + android:gravity="center_vertical" + android:minHeight="@dimen/bottom_sheet_list_item_height" + android:paddingEnd="@dimen/bottom_sheet_content_padding" + android:paddingLeft="@dimen/bottom_sheet_content_padding" + android:paddingRight="@dimen/bottom_sheet_content_padding" + android:paddingStart="@dimen/bottom_sheet_content_padding"> - + - + - + + - - - - - - + android:layout_height="@dimen/bottom_sheet_list_item_height" + android:background="?attr/selectableItemBackground" + android:gravity="center_vertical" + android:minHeight="@dimen/bottom_sheet_list_item_height" + android:paddingEnd="@dimen/bottom_sheet_content_padding" + android:paddingLeft="@dimen/bottom_sheet_content_padding" + android:paddingRight="@dimen/bottom_sheet_content_padding" + android:paddingStart="@dimen/bottom_sheet_content_padding"> - + - + - + + - - - - - - + android:layout_height="@dimen/bottom_sheet_list_item_height" + android:background="?attr/selectableItemBackground" + android:gravity="center_vertical" + android:minHeight="@dimen/bottom_sheet_list_item_height" + android:paddingEnd="@dimen/bottom_sheet_content_padding" + android:paddingLeft="@dimen/bottom_sheet_content_padding" + android:paddingRight="@dimen/bottom_sheet_content_padding" + android:paddingStart="@dimen/bottom_sheet_content_padding"> - + - + - - - - - - + + diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 82b48f1fb2..241d599842 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -9,7 +9,7 @@ 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 --> - Choose oordinate format before start. YOu can always change it by tapping Options. + Choose coordinate format before start. You can always change it by tapping Options. Fast Coordinates input Use location Add your location as first point to plan perfect route. diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputBottomSheetDialogFragment.java index 069e3dbc37..08bbba07f8 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputBottomSheetDialogFragment.java @@ -5,6 +5,7 @@ import android.os.Build; import android.os.Bundle; import android.support.annotation.DrawableRes; import android.support.annotation.Nullable; +import android.support.v4.content.ContextCompat; import android.view.ContextThemeWrapper; import android.view.LayoutInflater; import android.view.View; @@ -22,8 +23,6 @@ import net.osmand.plus.activities.MapActivity; import net.osmand.plus.base.BottomSheetDialogFragment; import net.osmand.plus.helpers.AndroidUiHelper; -import org.w3c.dom.Text; - public class CoordinateInputBottomSheetDialogFragment extends BottomSheetDialogFragment { public final static String TAG = "CoordinateInputBottomSheetDialogFragment"; @@ -31,15 +30,20 @@ public class CoordinateInputBottomSheetDialogFragment extends BottomSheetDialogF private boolean portrait; private View mainView; private boolean night; + private int coordinateFormat = -1; + private CoordinateInputFormatChangeListener listener; - private Format currentFormat = Format.DEGREES; + public void setListener(CoordinateInputFormatChangeListener listener) { + this.listener = listener; + } - private enum Format { - DEGREES, - MINUTES, - SECONDS, - UTM, - OLC + @Override + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + Bundle args = getArguments(); + if (args != null) { + coordinateFormat = getArguments().getInt(CoordinateInputDialogFragment.COORDINATE_FORMAT, -1); + } } @Nullable @@ -61,49 +65,89 @@ public class CoordinateInputBottomSheetDialogFragment extends BottomSheetDialogF ImageView degreesIcon = (ImageView) mainView.findViewById(R.id.degrees_icon); TextView degreesText = (TextView) mainView.findViewById(R.id.degrees_text); - if (currentFormat == Format.DEGREES) { + if (coordinateFormat == PointDescription.FORMAT_DEGREES) { degreesIcon.setImageDrawable(getIcon(R.drawable.ic_action_coordinates_latitude, R.color.dashboard_blue)); + degreesText.setTextColor(ContextCompat.getColor(mapActivity, R.color.dashboard_blue)); } else { degreesIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_coordinates_latitude)); } + degreesText.setText(PointDescription.formatToHumanString(getContext(), PointDescription.FORMAT_DEGREES)); ImageView minutesIcon = (ImageView) mainView.findViewById(R.id.minutes_icon); TextView minutesText = (TextView) mainView.findViewById(R.id.minutes_text); - if (currentFormat == Format.MINUTES) { + if (coordinateFormat == PointDescription.FORMAT_MINUTES) { minutesIcon.setImageDrawable(getIcon(R.drawable.ic_action_coordinates_latitude, R.color.dashboard_blue)); + minutesText.setTextColor(ContextCompat.getColor(mapActivity, R.color.dashboard_blue)); } else { minutesIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_coordinates_latitude)); } + minutesText.setText(PointDescription.formatToHumanString(getContext(), PointDescription.FORMAT_MINUTES)); ImageView secondsIcon = (ImageView) mainView.findViewById(R.id.seconds_icon); TextView secondsText = (TextView) mainView.findViewById(R.id.seconds_text); - if (currentFormat == Format.SECONDS) { + if (coordinateFormat == PointDescription.FORMAT_SECONDS) { secondsIcon.setImageDrawable(getIcon(R.drawable.ic_action_coordinates_latitude, R.color.dashboard_blue)); + secondsText.setTextColor(ContextCompat.getColor(mapActivity, R.color.dashboard_blue)); } else { secondsIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_coordinates_latitude)); } + secondsText.setText(PointDescription.formatToHumanString(getContext(), PointDescription.FORMAT_SECONDS)); ImageView utmIcon = (ImageView) mainView.findViewById(R.id.utm_icon); TextView utmText = (TextView) mainView.findViewById(R.id.utm_text); - if (currentFormat == Format.UTM) { + if (coordinateFormat == PointDescription.UTM_FORMAT) { utmIcon.setImageDrawable(getIcon(R.drawable.ic_action_coordinates_latitude, R.color.dashboard_blue)); + utmText.setTextColor(ContextCompat.getColor(mapActivity, R.color.dashboard_blue)); } else { utmIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_coordinates_latitude)); } + utmText.setText(PointDescription.formatToHumanString(getContext(), PointDescription.UTM_FORMAT)); ImageView olcIcon = (ImageView) mainView.findViewById(R.id.olc_icon); TextView olcText = (TextView) mainView.findViewById(R.id.olc_text); - if (currentFormat == Format.OLC) { + if (coordinateFormat == PointDescription.OLC_FORMAT) { olcIcon.setImageDrawable(getIcon(R.drawable.ic_action_coordinates_latitude, R.color.dashboard_blue)); + olcText.setTextColor(ContextCompat.getColor(mapActivity, R.color.dashboard_blue)); } else { olcIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_coordinates_latitude)); } + olcText.setText(PointDescription.formatToHumanString(getContext(), PointDescription.OLC_FORMAT)); - ((TextView) mainView.findViewById(R.id.degrees_text)).setText(PointDescription.formatToHumanString(getContext(), PointDescription.FORMAT_DEGREES)); - ((TextView) mainView.findViewById(R.id.minutes_text)).setText(PointDescription.formatToHumanString(getContext(), PointDescription.FORMAT_MINUTES)); - ((TextView) mainView.findViewById(R.id.seconds_text)).setText(PointDescription.formatToHumanString(getContext(), PointDescription.FORMAT_SECONDS)); - ((TextView) mainView.findViewById(R.id.utm_text)).setText(PointDescription.formatToHumanString(getContext(), PointDescription.UTM_FORMAT)); - ((TextView) mainView.findViewById(R.id.olc_text)).setText(PointDescription.formatToHumanString(getContext(), PointDescription.OLC_FORMAT)); + View.OnClickListener formatChangeListener = new View.OnClickListener() { + @Override + public void onClick(View view) { + int format; + switch (view.getId()) { + case R.id.degrees_row: + format = PointDescription.FORMAT_DEGREES; + break; + case R.id.minutes_row: + format = PointDescription.FORMAT_MINUTES; + break; + case R.id.seconds_row: + format = PointDescription.FORMAT_SECONDS; + break; + case R.id.utm_row: + format = PointDescription.UTM_FORMAT; + break; + case R.id.olc_row: + format = PointDescription.OLC_FORMAT; + break; + default: + throw new IllegalArgumentException("Unsupported format"); + } + if (listener != null) { + listener.onCoordinateFormatChanged(format); + } + dismiss(); + } + }; + + mainView.findViewById(R.id.degrees_row).setOnClickListener(formatChangeListener); + mainView.findViewById(R.id.minutes_row).setOnClickListener(formatChangeListener); + mainView.findViewById(R.id.seconds_row).setOnClickListener(formatChangeListener); + mainView.findViewById(R.id.utm_row).setOnClickListener(formatChangeListener); + mainView.findViewById(R.id.olc_row).setOnClickListener(formatChangeListener); mainView.findViewById(R.id.cancel_row).setOnClickListener(new View.OnClickListener() { @Override @@ -119,7 +163,7 @@ public class CoordinateInputBottomSheetDialogFragment extends BottomSheetDialogF mainView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { - final View scrollView = mainView.findViewById(R.id.marker_show_direction_scroll_view); + final View scrollView = mainView.findViewById(R.id.marker_coordinate_input_scroll_view); int scrollViewHeight = scrollView.getHeight(); int dividerHeight = AndroidUtils.dpToPx(getContext(), 1); int cancelButtonHeight = getContext().getResources().getDimensionPixelSize(R.dimen.bottom_sheet_cancel_button_height); @@ -167,4 +211,8 @@ public class CoordinateInputBottomSheetDialogFragment extends BottomSheetDialogF protected Drawable getContentIcon(@DrawableRes int id) { return getIcon(id, night ? R.color.ctx_menu_info_text_dark : R.color.on_map_icon_color); } + + interface CoordinateInputFormatChangeListener { + void onCoordinateFormatChanged(int format); + } } diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java index 188677f5a3..af036556c0 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java @@ -2,33 +2,29 @@ package net.osmand.plus.mapmarkers; import android.content.Context; import android.os.Bundle; -import android.support.annotation.LayoutRes; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.DialogFragment; +import android.support.v4.app.Fragment; import android.support.v7.widget.Toolbar; import android.text.Editable; +import android.text.InputFilter; import android.text.InputType; import android.text.TextWatcher; -import android.view.Gravity; import android.view.LayoutInflater; -import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; -import android.view.WindowManager; -import android.view.inputmethod.InputMethodManager; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.EditText; import android.widget.GridView; -import android.widget.TextView; +import net.osmand.data.PointDescription; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandTextFieldBoxes; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; -import net.osmand.plus.helpers.FontCache; import net.osmand.plus.widgets.TextViewEx; import java.util.ArrayList; @@ -38,16 +34,23 @@ import studio.carbonylgroup.textfieldboxes.ExtendedEditText; public class CoordinateInputDialogFragment extends DialogFragment { + public static final String TAG = "CoordinateInputDialogFragment"; + + public static final String COORDINATE_FORMAT = "coordinate_format"; + private static final int DELETE_BUTTON_POSITION = 9; private static final int CLEAR_BUTTON_POSITION = 11; - - public static final String TAG = "CoordinateInputDialogFragment"; + private static final int DEGREES_MAX_LENGTH = 8; + private static final int MINUTES_MAX_LENGTH = 10; + private static final int SECONDS_MAX_LENGTH = 13; private boolean lightTheme; private EditText focusedEditText; private boolean useOsmandKeyboard = true; - private List textFieldBoxes = new ArrayList<>(); - private List extendedEditTexts = new ArrayList<>(); + private List textFieldBoxes; + private ExtendedEditText nameEditText; + private List extendedLatLonEditTexts; + private int coordinateFormat = -1; @Override public void onCreate(Bundle savedInstanceState) { @@ -57,8 +60,11 @@ public class CoordinateInputDialogFragment extends DialogFragment { int themeId = lightTheme ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme; setStyle(STYLE_NO_FRAME, themeId); - CoordinateInputBottomSheetDialogFragment fragment = new CoordinateInputBottomSheetDialogFragment(); - fragment.show(getMapActivity().getSupportFragmentManager(), CoordinateInputBottomSheetDialogFragment.TAG); + if (coordinateFormat == -1) { + CoordinateInputBottomSheetDialogFragment fragment = new CoordinateInputBottomSheetDialogFragment(); + fragment.setListener(createCoordinateInputFormatChangeListener()); + fragment.show(getMapActivity().getSupportFragmentManager(), CoordinateInputBottomSheetDialogFragment.TAG); + } } @Nullable @@ -67,6 +73,13 @@ public class CoordinateInputDialogFragment extends DialogFragment { final View mainView = inflater.inflate(R.layout.fragment_coordinate_input_dialog, container); final MapActivity mapActivity = getMapActivity(); + if (coordinateFormat == -1) { + Fragment coordinateInputBottomSheetDialogFragment = mapActivity.getSupportFragmentManager().findFragmentByTag(CoordinateInputBottomSheetDialogFragment.TAG); + if (coordinateInputBottomSheetDialogFragment != null) { + ((CoordinateInputBottomSheetDialogFragment) coordinateInputBottomSheetDialogFragment).setListener(createCoordinateInputFormatChangeListener()); + } + } + Toolbar toolbar = (Toolbar) mainView.findViewById(R.id.coordinate_input_toolbar); toolbar.setNavigationIcon(getMyApplication().getIconsCache().getIcon(R.drawable.ic_arrow_back)); @@ -80,10 +93,16 @@ public class CoordinateInputDialogFragment extends DialogFragment { optionsButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - + CoordinateInputBottomSheetDialogFragment fragment = new CoordinateInputBottomSheetDialogFragment(); + Bundle args = new Bundle(); + args.putInt(COORDINATE_FORMAT, coordinateFormat); + fragment.setArguments(args); + fragment.setListener(createCoordinateInputFormatChangeListener()); + fragment.show(getMapActivity().getSupportFragmentManager(), CoordinateInputBottomSheetDialogFragment.TAG); } }); + textFieldBoxes = new ArrayList<>(); final OsmandTextFieldBoxes latitudeBox = (OsmandTextFieldBoxes) mainView.findViewById(R.id.latitude_box); textFieldBoxes.add(latitudeBox); final OsmandTextFieldBoxes longitudeBox = (OsmandTextFieldBoxes) mainView.findViewById(R.id.longitude_box); @@ -91,12 +110,12 @@ public class CoordinateInputDialogFragment extends DialogFragment { final OsmandTextFieldBoxes nameBox = (OsmandTextFieldBoxes) mainView.findViewById(R.id.name_box); textFieldBoxes.add(nameBox); + extendedLatLonEditTexts = new ArrayList<>(); final ExtendedEditText latitudeEditText = (ExtendedEditText) mainView.findViewById(R.id.latitude_edit_text); - extendedEditTexts.add(latitudeEditText); + extendedLatLonEditTexts.add(latitudeEditText); final ExtendedEditText longitudeEditText = (ExtendedEditText) mainView.findViewById(R.id.longitude_edit_text); - extendedEditTexts.add(longitudeEditText); - final ExtendedEditText nameEditText = (ExtendedEditText) mainView.findViewById(R.id.name_edit_text); - extendedEditTexts.add(nameEditText); + extendedLatLonEditTexts.add(longitudeEditText); + nameEditText = (ExtendedEditText) mainView.findViewById(R.id.name_edit_text); final View.OnFocusChangeListener focusChangeListener = new View.OnFocusChangeListener() { @Override @@ -147,16 +166,33 @@ public class CoordinateInputDialogFragment extends DialogFragment { @Override public void afterTextChanged(Editable editable) { - if (focusedEditText != null) { + if (focusedEditText != null && focusedEditText != nameEditText) { String str = focusedEditText.getText().toString(); - if(str.length() == 2 && len < str.length()){ - focusedEditText.append(":"); - } else if (str.length() == 5 && len < str.length()) { + int strLength = str.length(); + if (strLength == 2 && len < strLength) { + String strToAppend; + if (coordinateFormat == PointDescription.FORMAT_DEGREES) { + strToAppend = "."; + } else { + strToAppend = ":"; + } + focusedEditText.append(strToAppend); + } else if (strLength == 5 && coordinateFormat != PointDescription.FORMAT_DEGREES && len < strLength) { + String strToAppend; + if (coordinateFormat == PointDescription.FORMAT_MINUTES) { + strToAppend = "."; + } else { + strToAppend = ":"; + } + focusedEditText.append(strToAppend); + } else if (strLength == 8 && coordinateFormat == PointDescription.FORMAT_SECONDS && len < strLength) { focusedEditText.append("."); - } else if (str.length() == 10) { + } else if ((strLength == DEGREES_MAX_LENGTH && coordinateFormat == PointDescription.FORMAT_DEGREES) + || (strLength == MINUTES_MAX_LENGTH && coordinateFormat == PointDescription.FORMAT_MINUTES) + || (strLength == SECONDS_MAX_LENGTH && coordinateFormat == PointDescription.FORMAT_SECONDS)) { if (focusedEditText == latitudeEditText) { longitudeBox.select(); - } else if (focusedEditText == longitudeEditText) { + } else { nameBox.select(); } } @@ -207,6 +243,40 @@ public class CoordinateInputDialogFragment extends DialogFragment { return mainView; } + @Override + public void onDestroyView() { + focusedEditText = null; + if (getDialog() != null && getRetainInstance()) { + getDialog().setDismissMessage(null); + } + super.onDestroyView(); + } + + private CoordinateInputBottomSheetDialogFragment.CoordinateInputFormatChangeListener createCoordinateInputFormatChangeListener() { + return new CoordinateInputBottomSheetDialogFragment.CoordinateInputFormatChangeListener() { + @Override + public void onCoordinateFormatChanged(int format) { + coordinateFormat = format; + changeEditTextLengths(); + } + }; + } + + private void changeEditTextLengths() { + int maxLength; + if (coordinateFormat == PointDescription.FORMAT_DEGREES) { + maxLength = DEGREES_MAX_LENGTH; + } else if (coordinateFormat == PointDescription.FORMAT_MINUTES) { + maxLength = MINUTES_MAX_LENGTH; + } else { + maxLength = SECONDS_MAX_LENGTH; + } + InputFilter[] filtersArray = new InputFilter[] {new InputFilter.LengthFilter(maxLength)}; + for (ExtendedEditText extendedEditText : extendedLatLonEditTexts) { + extendedEditText.setFilters(filtersArray); + } + } + public void changeKeyboardInBoxes(boolean useOsmandKeyboard) { for (OsmandTextFieldBoxes textFieldBox : textFieldBoxes) { textFieldBox.setUseOsmandKeyboard(useOsmandKeyboard); @@ -214,9 +284,10 @@ public class CoordinateInputDialogFragment extends DialogFragment { } public void changeKeyboardInEditTexts(boolean useOsmandKeyboard) { - for (ExtendedEditText extendedEditText : extendedEditTexts) { + for (ExtendedEditText extendedEditText : extendedLatLonEditTexts) { extendedEditText.setInputType(useOsmandKeyboard ? InputType.TYPE_NULL : InputType.TYPE_CLASS_TEXT); } + nameEditText.setInputType(useOsmandKeyboard ? InputType.TYPE_NULL : InputType.TYPE_CLASS_TEXT); } private MapActivity getMapActivity() { @@ -233,6 +304,7 @@ public class CoordinateInputDialogFragment extends DialogFragment { return false; } CoordinateInputDialogFragment fragment = new CoordinateInputDialogFragment(); + fragment.setRetainInstance(true); fragment.show(mapActivity.getSupportFragmentManager(), TAG); return true; } catch (RuntimeException e) { From d22c799325e2eedc85b3c0b7a8b317e6e0f550bd Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Thu, 28 Sep 2017 16:59:14 +0300 Subject: [PATCH 13/41] Draw lines to location in onPrepareBufferImage --- .../osmand/plus/views/MapMarkersLayer.java | 42 ++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java b/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java index 1d5fe1bac8..0730dd6f96 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java @@ -219,25 +219,18 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi } @Override - public void onDraw(Canvas canvas, RotatedTileBox tileBox, DrawSettings nightMode) { - - Location myLoc = map.getMyApplication().getLocationProvider().getLastStaleKnownLocation(); - widgetsFactory.updateInfo(myLoc == null - ? tileBox.getCenterLatLon() : new LatLon(myLoc.getLatitude(), myLoc.getLongitude()), tileBox.getZoom()); + public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tileBox, DrawSettings nightMode) { OsmandSettings settings = map.getMyApplication().getSettings(); - - if (tileBox.getZoom() < 3 || !settings.USE_MAP_MARKERS.get()) { - return; - } - + Location myLoc = map.getMapViewTrackingUtilities().getMyLocation(); MapMarkersHelper markersHelper = map.getMyApplication().getMapMarkersHelper(); + List activeMapMarkers = markersHelper.getMapMarkers(); + if (route.size() > 0) { path.reset(); boolean first = true; - Location myLocation = map.getMapViewTrackingUtilities().getMyLocation(); - if (markersHelper.isStartFromMyLocation() && myLocation != null) { - int locationX = tileBox.getPixXFromLonNoRot(myLocation.getLongitude()); - int locationY = tileBox.getPixYFromLatNoRot(myLocation.getLatitude()); + if (markersHelper.isStartFromMyLocation() && myLoc != null) { + int locationX = tileBox.getPixXFromLonNoRot(myLoc.getLongitude()); + int locationY = tileBox.getPixYFromLatNoRot(myLoc.getLatitude()); path.moveTo(locationX, locationY); first = false; } @@ -254,8 +247,6 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi canvas.drawPath(path, paint); } - List activeMapMarkers = markersHelper.getMapMarkers(); - if (settings.SHOW_LINES_TO_FIRST_MARKERS.get() && myLoc != null) { lineAttrs.updatePaints(view, nightMode, tileBox); textAttrs.updatePaints(view, nightMode, tileBox); @@ -319,8 +310,22 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi canvas.rotate(tileBox.getRotate(), tileBox.getCenterPixelX(), tileBox.getCenterPixelY()); } } + } - for (MapMarker marker : activeMapMarkers) { + @Override + public void onDraw(Canvas canvas, RotatedTileBox tileBox, DrawSettings nightMode) { + Location myLoc = map.getMyApplication().getLocationProvider().getLastStaleKnownLocation(); + widgetsFactory.updateInfo(myLoc == null + ? tileBox.getCenterLatLon() : new LatLon(myLoc.getLatitude(), myLoc.getLongitude()), tileBox.getZoom()); + OsmandSettings settings = map.getMyApplication().getSettings(); + + if (tileBox.getZoom() < 3 || !settings.USE_MAP_MARKERS.get()) { + return; + } + + MapMarkersHelper markersHelper = map.getMyApplication().getMapMarkersHelper(); + + for (MapMarker marker : markersHelper.getMapMarkers()) { if (isLocationVisible(tileBox, marker) && !overlappedByWaypoint(marker) && !isInMotion(marker)) { Bitmap bmp = getMapMarkerBitmap(marker.colorIndex); @@ -336,9 +341,8 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi if (settings.SHOW_ARROWS_TO_FIRST_MARKERS.get()) { LatLon loc = tileBox.getCenterLatLon(); - List mapMarkers = markersHelper.getMapMarkers(); int i = 0; - for (MapMarker marker : mapMarkers) { + for (MapMarker marker : markersHelper.getMapMarkers()) { if (!isLocationVisible(tileBox, marker) && !isInMotion(marker)) { canvas.save(); net.osmand.Location.distanceBetween(loc.getLatitude(), loc.getLongitude(), From dad003d8d37483eeb1132abf18a79d908d4a022f Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Thu, 28 Sep 2017 18:11:29 +0300 Subject: [PATCH 14/41] Change rendering line attributes --- .../osmand/plus/views/MapMarkersLayer.java | 14 ++++---- .../osmand/plus/views/RulerControlLayer.java | 35 ++++++++----------- 2 files changed, 22 insertions(+), 27 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java b/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java index 0730dd6f96..4373b697e9 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java @@ -69,7 +69,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi private float[] calculations = new float[2]; private final RenderingLineAttributes lineAttrs = new RenderingLineAttributes("measureDistanceLine"); - private final RenderingLineAttributes textAttrs = new RenderingLineAttributes("rulerCircle"); + private final RenderingLineAttributes textAttrs = new RenderingLineAttributes("rulerLineFont"); private Paint paint; private Path path; private List route = new ArrayList<>(); @@ -77,7 +77,6 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi private TIntArrayList tx = new TIntArrayList(); private TIntArrayList ty = new TIntArrayList(); private Path linePath = new Path(); - private String distanceText; private ContextMenuLayer contextMenuLayer; @@ -141,8 +140,8 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi paint.setAlpha(200); float textSize = TEXT_SIZE * map.getResources().getDisplayMetrics().density; + textAttrs.paint.setTextSize(textSize); textAttrs.paint2.setTextSize(textSize); - textAttrs.paint3.setTextSize(textSize); widgetsFactory = new MapMarkersWidgetsFactory(map); @@ -250,7 +249,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi if (settings.SHOW_LINES_TO_FIRST_MARKERS.get() && myLoc != null) { lineAttrs.updatePaints(view, nightMode, tileBox); textAttrs.updatePaints(view, nightMode, tileBox); - textAttrs.paint2.setStyle(Paint.Style.FILL); + textAttrs.paint.setStyle(Paint.Style.FILL); int locX = (int) tileBox.getPixXFromLatLon(myLoc.getLatitude(), myLoc.getLongitude()); int locY = (int) tileBox.getPixYFromLatLon(myLoc.getLatitude(), myLoc.getLongitude()); @@ -277,6 +276,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi float generalDist = (float) MapUtils.getDistance(myLoc.getLatitude(), myLoc.getLongitude(), marker.getLatitude(), marker.getLongitude()); String generalDistSt = OsmAndFormatter.getFormattedDistance(generalDist, view.getApplication()); boolean locationInvisible = locX < 0 || locX > tileBox.getPixWidth() || locY < 0 || locY > tileBox.getPixHeight(); + String distanceText; if (locationInvisible) { float centerToMarkerDist = (float) MapUtils.getDistance(tileBox.getLatLonFromPixel(pos[0], pos[1]), marker.getLatitude(), marker.getLongitude()); String centerToMarkerDistSt = OsmAndFormatter.getFormattedDistance(centerToMarkerDist, view.getApplication()); @@ -289,7 +289,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi distanceText = generalDistSt; } Rect bounds = new Rect(); - textAttrs.paint2.getTextBounds(distanceText, 0, distanceText.length(), bounds); + textAttrs.paint.getTextBounds(distanceText, 0, distanceText.length(), bounds); float hOffset = pm.getLength() / 2 - bounds.width() / 2; lineAttrs.paint.setColor(colors[marker.colorIndex]); @@ -300,12 +300,12 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi } if (locX >= markerX) { canvas.rotate(180, pos[0], pos[1]); - canvas.drawTextOnPath(distanceText, linePath, hOffset, bounds.height() + VERTICAL_OFFSET, textAttrs.paint3); canvas.drawTextOnPath(distanceText, linePath, hOffset, bounds.height() + VERTICAL_OFFSET, textAttrs.paint2); + canvas.drawTextOnPath(distanceText, linePath, hOffset, bounds.height() + VERTICAL_OFFSET, textAttrs.paint); canvas.rotate(-180, pos[0], pos[1]); } else { - canvas.drawTextOnPath(distanceText, linePath, hOffset, -VERTICAL_OFFSET, textAttrs.paint3); canvas.drawTextOnPath(distanceText, linePath, hOffset, -VERTICAL_OFFSET, textAttrs.paint2); + canvas.drawTextOnPath(distanceText, linePath, hOffset, -VERTICAL_OFFSET, textAttrs.paint); } canvas.rotate(tileBox.getRotate(), tileBox.getCenterPixelX(), tileBox.getCenterPixelY()); } diff --git a/OsmAnd/src/net/osmand/plus/views/RulerControlLayer.java b/OsmAnd/src/net/osmand/plus/views/RulerControlLayer.java index d605728a18..583d5d42db 100644 --- a/OsmAnd/src/net/osmand/plus/views/RulerControlLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/RulerControlLayer.java @@ -76,10 +76,9 @@ public class RulerControlLayer extends OsmandMapLayer { private Bitmap centerIconNight; private Paint bitmapPaint; private RenderingLineAttributes lineAttrs; + private RenderingLineAttributes lineFontAttrs; private RenderingLineAttributes circleAttrs; private RenderingLineAttributes circleAttrsAlt; - private float circleTextSize; - private float lineTextSize; private Handler handler; @@ -122,8 +121,12 @@ public class RulerControlLayer extends OsmandMapLayer { lineAttrs = new RenderingLineAttributes("rulerLine"); - circleTextSize = TEXT_SIZE * mapActivity.getResources().getDisplayMetrics().density; - lineTextSize = DISTANCE_TEXT_SIZE * mapActivity.getResources().getDisplayMetrics().density; + float circleTextSize = TEXT_SIZE * mapActivity.getResources().getDisplayMetrics().density; + float lineTextSize = DISTANCE_TEXT_SIZE * mapActivity.getResources().getDisplayMetrics().density; + + lineFontAttrs = new RenderingLineAttributes("rulerLineFont"); + lineFontAttrs.paint.setTextSize(lineTextSize); + lineFontAttrs.paint2.setTextSize(lineTextSize); circleAttrs = new RenderingLineAttributes("rulerCircle"); circleAttrs.paint2.setTextSize(circleTextSize); @@ -179,6 +182,8 @@ public class RulerControlLayer extends OsmandMapLayer { public void onDraw(Canvas canvas, RotatedTileBox tb, DrawSettings settings) { if (rulerModeOn()) { lineAttrs.updatePaints(view, settings, tb); + lineFontAttrs.updatePaints(view, settings, tb); + lineFontAttrs.paint.setStyle(Style.FILL); circleAttrs.updatePaints(view, settings, tb); circleAttrs.paint2.setStyle(Style.FILL); circleAttrsAlt.updatePaints(view, settings, tb); @@ -221,14 +226,7 @@ public class RulerControlLayer extends OsmandMapLayer { } if (mode == RulerMode.FIRST || mode == RulerMode.SECOND) { updateData(tb, center); - RenderingLineAttributes attrs; - if (mode == RulerMode.FIRST) { - circleAttrs.paint2.setTextSize(circleTextSize); - circleAttrs.paint3.setTextSize(circleTextSize); - attrs = circleAttrs; - } else { - attrs = circleAttrsAlt; - } + RenderingLineAttributes attrs = mode == RulerMode.FIRST ? circleAttrs : circleAttrsAlt; for (int i = 1; i <= cacheDistances.size(); i++) { drawCircle(canvas, tb, i, center, attrs); } @@ -268,22 +266,19 @@ public class RulerControlLayer extends OsmandMapLayer { private void drawTextOnCenterOfPath(Canvas canvas, float x1, float x2, Path path, String text) { PathMeasure pm = new PathMeasure(path, false); Rect bounds = new Rect(); - circleAttrs.paint2.getTextBounds(text, 0, text.length(), bounds); + lineFontAttrs.paint.getTextBounds(text, 0, text.length(), bounds); float hOffset = pm.getLength() / 2 - bounds.width() / 2; - circleAttrs.paint2.setTextSize(lineTextSize); - circleAttrs.paint3.setTextSize(lineTextSize); - if (x1 >= x2) { float[] pos = new float[2]; pm.getPosTan(pm.getLength() / 2, pos, null); canvas.rotate(180, pos[0], pos[1]); - canvas.drawTextOnPath(text, path, hOffset, bounds.height() + VERTICAL_OFFSET, circleAttrs.paint3); - canvas.drawTextOnPath(text, path, hOffset, bounds.height() + VERTICAL_OFFSET, circleAttrs.paint2); + canvas.drawTextOnPath(text, path, hOffset, bounds.height() + VERTICAL_OFFSET, lineFontAttrs.paint2); + canvas.drawTextOnPath(text, path, hOffset, bounds.height() + VERTICAL_OFFSET, lineFontAttrs.paint); canvas.rotate(-180, pos[0], pos[1]); } else { - canvas.drawTextOnPath(text, path, hOffset, -VERTICAL_OFFSET, circleAttrs.paint3); - canvas.drawTextOnPath(text, path, hOffset, -VERTICAL_OFFSET, circleAttrs.paint2); + canvas.drawTextOnPath(text, path, hOffset, -VERTICAL_OFFSET, lineFontAttrs.paint2); + canvas.drawTextOnPath(text, path, hOffset, -VERTICAL_OFFSET, lineFontAttrs.paint); } } From 27c204643d80df8f316f1c60313ce6b038a457c1 Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Thu, 28 Sep 2017 19:02:56 +0300 Subject: [PATCH 15/41] Add option menu and keyboard styling --- .../fragment_coordinate_input_dialog.xml | 48 ++++- ...r_coordinate_input_bottom_sheet_dialog.xml | 192 +---------------- ...nate_input_options_bottom_sheet_helper.xml | 120 +++++++++++ .../res/layout/marker_coordinate_formats.xml | 199 ++++++++++++++++++ OsmAnd/res/values/strings.xml | 2 + ...rdinateInputBottomSheetDialogFragment.java | 103 ++++++++- .../CoordinateInputDialogFragment.java | 66 ++++-- 7 files changed, 511 insertions(+), 219 deletions(-) create mode 100644 OsmAnd/res/layout/fragment_marker_coordinate_input_options_bottom_sheet_helper.xml create mode 100644 OsmAnd/res/layout/marker_coordinate_formats.xml diff --git a/OsmAnd/res/layout/fragment_coordinate_input_dialog.xml b/OsmAnd/res/layout/fragment_coordinate_input_dialog.xml index f993663744..bd3c04fbbc 100644 --- a/OsmAnd/res/layout/fragment_coordinate_input_dialog.xml +++ b/OsmAnd/res/layout/fragment_coordinate_input_dialog.xml @@ -144,13 +144,14 @@ - - + + + + + + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/layout/fragment_marker_coordinate_input_bottom_sheet_dialog.xml b/OsmAnd/res/layout/fragment_marker_coordinate_input_bottom_sheet_dialog.xml index f294958fc2..e970fe8da9 100644 --- a/OsmAnd/res/layout/fragment_marker_coordinate_input_bottom_sheet_dialog.xml +++ b/OsmAnd/res/layout/fragment_marker_coordinate_input_bottom_sheet_dialog.xml @@ -42,197 +42,7 @@ android:textColor="?android:textColorSecondary" android:textSize="@dimen/default_desc_text_size"/> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/OsmAnd/res/layout/fragment_marker_coordinate_input_options_bottom_sheet_helper.xml b/OsmAnd/res/layout/fragment_marker_coordinate_input_options_bottom_sheet_helper.xml new file mode 100644 index 0000000000..cd2b841a19 --- /dev/null +++ b/OsmAnd/res/layout/fragment_marker_coordinate_input_options_bottom_sheet_helper.xml @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/layout/marker_coordinate_formats.xml b/OsmAnd/res/layout/marker_coordinate_formats.xml new file mode 100644 index 0000000000..e03dad94c8 --- /dev/null +++ b/OsmAnd/res/layout/marker_coordinate_formats.xml @@ -0,0 +1,199 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index a788363c22..0c0198ec86 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -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 --> + Coordinates format + Use system keyboard Choose coordinate format before start. You can always change it by tapping Options. Fast Coordinates input Finish diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputBottomSheetDialogFragment.java index 08bbba07f8..f2b78c94f8 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputBottomSheetDialogFragment.java @@ -1,11 +1,13 @@ package net.osmand.plus.mapmarkers; +import android.content.DialogInterface; import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Bundle; import android.support.annotation.DrawableRes; import android.support.annotation.Nullable; import android.support.v4.content.ContextCompat; +import android.support.v7.widget.SwitchCompat; import android.view.ContextThemeWrapper; import android.view.LayoutInflater; import android.view.View; @@ -13,7 +15,9 @@ import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.view.Window; import android.view.WindowManager; +import android.widget.CompoundButton; import android.widget.ImageView; +import android.widget.RadioButton; import android.widget.TextView; import net.osmand.AndroidUtils; @@ -31,7 +35,9 @@ public class CoordinateInputBottomSheetDialogFragment extends BottomSheetDialogF private View mainView; private boolean night; private int coordinateFormat = -1; + private boolean useOsmandKeyboard = true; private CoordinateInputFormatChangeListener listener; + private boolean shouldClose; public void setListener(CoordinateInputFormatChangeListener listener) { this.listener = listener; @@ -42,7 +48,10 @@ public class CoordinateInputBottomSheetDialogFragment extends BottomSheetDialogF super.onCreate(savedInstanceState); Bundle args = getArguments(); if (args != null) { - coordinateFormat = getArguments().getInt(CoordinateInputDialogFragment.COORDINATE_FORMAT, -1); + coordinateFormat = args.getInt(CoordinateInputDialogFragment.COORDINATE_FORMAT); + useOsmandKeyboard = args.getBoolean(CoordinateInputDialogFragment.USE_OSMAND_KEYBOARD); + } else { + shouldClose = true; } } @@ -54,7 +63,8 @@ public class CoordinateInputBottomSheetDialogFragment extends BottomSheetDialogF night = !mapActivity.getMyApplication().getSettings().isLightContent(); final int themeRes = night ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme; - mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.fragment_marker_coordinate_input_bottom_sheet_dialog, container); + mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes), coordinateFormat == -1 ? + R.layout.fragment_marker_coordinate_input_bottom_sheet_dialog : R.layout.fragment_marker_coordinate_input_options_bottom_sheet_helper, container); if (portrait) { AndroidUtils.setBackground(getActivity(), mainView, night, R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark); } @@ -68,6 +78,7 @@ public class CoordinateInputBottomSheetDialogFragment extends BottomSheetDialogF if (coordinateFormat == PointDescription.FORMAT_DEGREES) { degreesIcon.setImageDrawable(getIcon(R.drawable.ic_action_coordinates_latitude, R.color.dashboard_blue)); degreesText.setTextColor(ContextCompat.getColor(mapActivity, R.color.dashboard_blue)); + ((RadioButton) mainView.findViewById(R.id.degrees_radio_button)).setChecked(true); } else { degreesIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_coordinates_latitude)); } @@ -78,6 +89,7 @@ public class CoordinateInputBottomSheetDialogFragment extends BottomSheetDialogF if (coordinateFormat == PointDescription.FORMAT_MINUTES) { minutesIcon.setImageDrawable(getIcon(R.drawable.ic_action_coordinates_latitude, R.color.dashboard_blue)); minutesText.setTextColor(ContextCompat.getColor(mapActivity, R.color.dashboard_blue)); + ((RadioButton) mainView.findViewById(R.id.minutes_radio_button)).setChecked(true); } else { minutesIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_coordinates_latitude)); } @@ -88,6 +100,7 @@ public class CoordinateInputBottomSheetDialogFragment extends BottomSheetDialogF if (coordinateFormat == PointDescription.FORMAT_SECONDS) { secondsIcon.setImageDrawable(getIcon(R.drawable.ic_action_coordinates_latitude, R.color.dashboard_blue)); secondsText.setTextColor(ContextCompat.getColor(mapActivity, R.color.dashboard_blue)); + ((RadioButton) mainView.findViewById(R.id.seconds_radio_button)).setChecked(true); } else { secondsIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_coordinates_latitude)); } @@ -98,6 +111,7 @@ public class CoordinateInputBottomSheetDialogFragment extends BottomSheetDialogF if (coordinateFormat == PointDescription.UTM_FORMAT) { utmIcon.setImageDrawable(getIcon(R.drawable.ic_action_coordinates_latitude, R.color.dashboard_blue)); utmText.setTextColor(ContextCompat.getColor(mapActivity, R.color.dashboard_blue)); + ((RadioButton) mainView.findViewById(R.id.utm_radio_button)).setChecked(true); } else { utmIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_coordinates_latitude)); } @@ -108,38 +122,58 @@ public class CoordinateInputBottomSheetDialogFragment extends BottomSheetDialogF if (coordinateFormat == PointDescription.OLC_FORMAT) { olcIcon.setImageDrawable(getIcon(R.drawable.ic_action_coordinates_latitude, R.color.dashboard_blue)); olcText.setTextColor(ContextCompat.getColor(mapActivity, R.color.dashboard_blue)); + ((RadioButton) mainView.findViewById(R.id.olc_radio_button)).setChecked(true); } else { olcIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_coordinates_latitude)); } olcText.setText(PointDescription.formatToHumanString(getContext(), PointDescription.OLC_FORMAT)); + if (coordinateFormat != -1) { + ((CompoundButton) mainView.findViewById(R.id.use_system_keyboard_switch)).setChecked(!useOsmandKeyboard); + ((ImageView) mainView.findViewById(R.id.use_system_keyboard_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_keyboard)); + mainView.findViewById(R.id.use_system_keyboard_row).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + useOsmandKeyboard = !useOsmandKeyboard; + ((CompoundButton) mainView.findViewById(R.id.use_system_keyboard_switch)).setChecked(!useOsmandKeyboard); + if (listener != null) { + listener.onKeyboardChanged(useOsmandKeyboard); + } + } + }); + highlightSelectedItem(true); + } + View.OnClickListener formatChangeListener = new View.OnClickListener() { @Override public void onClick(View view) { - int format; + highlightSelectedItem(false); switch (view.getId()) { case R.id.degrees_row: - format = PointDescription.FORMAT_DEGREES; + coordinateFormat = PointDescription.FORMAT_DEGREES; break; case R.id.minutes_row: - format = PointDescription.FORMAT_MINUTES; + coordinateFormat = PointDescription.FORMAT_MINUTES; break; case R.id.seconds_row: - format = PointDescription.FORMAT_SECONDS; + coordinateFormat = PointDescription.FORMAT_SECONDS; break; case R.id.utm_row: - format = PointDescription.UTM_FORMAT; + coordinateFormat = PointDescription.UTM_FORMAT; break; case R.id.olc_row: - format = PointDescription.OLC_FORMAT; + coordinateFormat = PointDescription.OLC_FORMAT; break; default: throw new IllegalArgumentException("Unsupported format"); } + highlightSelectedItem(true); if (listener != null) { - listener.onCoordinateFormatChanged(format); + listener.onCoordinateFormatChanged(coordinateFormat); + } + if (shouldClose) { + dismiss(); } - dismiss(); } }; @@ -153,6 +187,9 @@ public class CoordinateInputBottomSheetDialogFragment extends BottomSheetDialogF @Override public void onClick(View view) { dismiss(); + if (shouldClose && listener != null) { + listener.onCancel(); + } } }); @@ -207,12 +244,58 @@ public class CoordinateInputBottomSheetDialogFragment extends BottomSheetDialogF } } + @Override + public void onCancel(DialogInterface dialog) { + super.onCancel(dialog); + if (shouldClose && listener != null) { + listener.onCancel(); + } + } + @Override protected Drawable getContentIcon(@DrawableRes int id) { return getIcon(id, night ? R.color.ctx_menu_info_text_dark : R.color.on_map_icon_color); } + private void highlightSelectedItem(boolean check) { + int iconColor = check ? R.color.dashboard_blue : night ? R.color.ctx_menu_info_text_dark : R.color.on_map_icon_color; + int textColor = ContextCompat.getColor(getContext(), check ? (night ? R.color.color_dialog_buttons_dark : R.color.dashboard_blue) : night ? R.color.color_white : R.color.color_black); + switch (coordinateFormat) { + case PointDescription.FORMAT_DEGREES: + ((TextView) mainView.findViewById(R.id.degrees_text)).setTextColor(textColor); + ((ImageView) mainView.findViewById(R.id.degrees_icon)).setImageDrawable((getIcon(R.drawable.ic_action_coordinates_latitude, iconColor))); + ((RadioButton) mainView.findViewById(R.id.degrees_radio_button)).setChecked(check); + break; + case PointDescription.FORMAT_MINUTES: + ((TextView) mainView.findViewById(R.id.minutes_text)).setTextColor(textColor); + ((ImageView) mainView.findViewById(R.id.minutes_icon)).setImageDrawable((getIcon(R.drawable.ic_action_coordinates_latitude, iconColor))); + ((RadioButton) mainView.findViewById(R.id.minutes_radio_button)).setChecked(check); + break; + case PointDescription.FORMAT_SECONDS: + ((TextView) mainView.findViewById(R.id.seconds_text)).setTextColor(textColor); + ((ImageView) mainView.findViewById(R.id.seconds_icon)).setImageDrawable((getIcon(R.drawable.ic_action_coordinates_latitude, iconColor))); + ((RadioButton) mainView.findViewById(R.id.seconds_radio_button)).setChecked(check); + break; + case PointDescription.UTM_FORMAT: + ((TextView) mainView.findViewById(R.id.utm_text)).setTextColor(textColor); + ((ImageView) mainView.findViewById(R.id.utm_icon)).setImageDrawable((getIcon(R.drawable.ic_action_coordinates_latitude, iconColor))); + ((RadioButton) mainView.findViewById(R.id.utm_radio_button)).setChecked(check); + break; + case PointDescription.OLC_FORMAT: + ((TextView) mainView.findViewById(R.id.olc_text)).setTextColor(textColor); + ((ImageView) mainView.findViewById(R.id.olc_icon)).setImageDrawable((getIcon(R.drawable.ic_action_coordinates_latitude, iconColor))); + ((RadioButton) mainView.findViewById(R.id.olc_radio_button)).setChecked(check); + break; + } + } + interface CoordinateInputFormatChangeListener { + void onCoordinateFormatChanged(int format); + + void onKeyboardChanged(boolean useOsmandKeyboard); + + void onCancel(); + } } diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java index af036556c0..1da2a01d58 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java @@ -18,8 +18,11 @@ import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.EditText; import android.widget.GridView; +import android.widget.ImageView; +import net.osmand.AndroidUtils; import net.osmand.data.PointDescription; +import net.osmand.plus.IconsCache; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandTextFieldBoxes; @@ -37,6 +40,7 @@ public class CoordinateInputDialogFragment extends DialogFragment { public static final String TAG = "CoordinateInputDialogFragment"; public static final String COORDINATE_FORMAT = "coordinate_format"; + public static final String USE_OSMAND_KEYBOARD = "use_osmand_keyboard"; private static final int DELETE_BUTTON_POSITION = 9; private static final int CLEAR_BUTTON_POSITION = 11; @@ -47,10 +51,10 @@ public class CoordinateInputDialogFragment extends DialogFragment { private boolean lightTheme; private EditText focusedEditText; private boolean useOsmandKeyboard = true; + private int coordinateFormat = -1; private List textFieldBoxes; private ExtendedEditText nameEditText; private List extendedLatLonEditTexts; - private int coordinateFormat = -1; @Override public void onCreate(Bundle savedInstanceState) { @@ -60,11 +64,9 @@ public class CoordinateInputDialogFragment extends DialogFragment { int themeId = lightTheme ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme; setStyle(STYLE_NO_FRAME, themeId); - if (coordinateFormat == -1) { - CoordinateInputBottomSheetDialogFragment fragment = new CoordinateInputBottomSheetDialogFragment(); - fragment.setListener(createCoordinateInputFormatChangeListener()); - fragment.show(getMapActivity().getSupportFragmentManager(), CoordinateInputBottomSheetDialogFragment.TAG); - } + CoordinateInputBottomSheetDialogFragment fragment = new CoordinateInputBottomSheetDialogFragment(); + fragment.setListener(createCoordinateInputFormatChangeListener()); + fragment.show(getMapActivity().getSupportFragmentManager(), CoordinateInputBottomSheetDialogFragment.TAG); } @Nullable @@ -72,12 +74,11 @@ public class CoordinateInputDialogFragment extends DialogFragment { public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { final View mainView = inflater.inflate(R.layout.fragment_coordinate_input_dialog, container); final MapActivity mapActivity = getMapActivity(); + final IconsCache ic = getMyApplication().getIconsCache(); - if (coordinateFormat == -1) { - Fragment coordinateInputBottomSheetDialogFragment = mapActivity.getSupportFragmentManager().findFragmentByTag(CoordinateInputBottomSheetDialogFragment.TAG); - if (coordinateInputBottomSheetDialogFragment != null) { - ((CoordinateInputBottomSheetDialogFragment) coordinateInputBottomSheetDialogFragment).setListener(createCoordinateInputFormatChangeListener()); - } + Fragment coordinateInputBottomSheetDialogFragment = mapActivity.getSupportFragmentManager().findFragmentByTag(CoordinateInputBottomSheetDialogFragment.TAG); + if (coordinateInputBottomSheetDialogFragment != null) { + ((CoordinateInputBottomSheetDialogFragment) coordinateInputBottomSheetDialogFragment).setListener(createCoordinateInputFormatChangeListener()); } Toolbar toolbar = (Toolbar) mainView.findViewById(R.id.coordinate_input_toolbar); @@ -96,6 +97,7 @@ public class CoordinateInputDialogFragment extends DialogFragment { CoordinateInputBottomSheetDialogFragment fragment = new CoordinateInputBottomSheetDialogFragment(); Bundle args = new Bundle(); args.putInt(COORDINATE_FORMAT, coordinateFormat); + args.putBoolean(USE_OSMAND_KEYBOARD, useOsmandKeyboard); fragment.setArguments(args); fragment.setListener(createCoordinateInputFormatChangeListener()); fragment.show(getMapActivity().getSupportFragmentManager(), CoordinateInputBottomSheetDialogFragment.TAG); @@ -208,8 +210,11 @@ public class CoordinateInputDialogFragment extends DialogFragment { longitudeEditText.addTextChangedListener(textWatcher); nameEditText.addTextChangedListener(textWatcher); - changeKeyboardInBoxes(useOsmandKeyboard); - changeKeyboardInEditTexts(useOsmandKeyboard); + changeKeyboardInBoxes(); + changeKeyboardInEditTexts(); + + View keyboardLayout = mainView.findViewById(R.id.keyboard_layout); + AndroidUtils.setBackground(mapActivity, keyboardLayout, !lightTheme, R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark); String[] keyboardItems = new String[] { "1", "2", "3", "4", "5", "6", @@ -240,6 +245,25 @@ public class CoordinateInputDialogFragment extends DialogFragment { } }); + final ImageView showHideKeyBoardIcon = (ImageView) mainView.findViewById(R.id.show_hide_keyboard_icon); + final View keyboardDivider = mainView.findViewById(R.id.keyboard_divider); + showHideKeyBoardIcon.setImageDrawable(ic.getThemedIcon(R.drawable.ic_action_arrow_down)); + showHideKeyBoardIcon.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + int keyboardVisibility = keyboardGrid.getVisibility(); + if (keyboardVisibility == View.VISIBLE) { + keyboardGrid.setVisibility(View.GONE); + keyboardDivider.setVisibility(View.GONE); + showHideKeyBoardIcon.setImageDrawable(ic.getThemedIcon(R.drawable.ic_action_arrow_up)); + } else { + keyboardGrid.setVisibility(View.VISIBLE); + keyboardDivider.setVisibility(View.VISIBLE); + showHideKeyBoardIcon.setImageDrawable(ic.getThemedIcon(R.drawable.ic_action_arrow_down)); + } + } + }); + return mainView; } @@ -259,6 +283,18 @@ public class CoordinateInputDialogFragment extends DialogFragment { coordinateFormat = format; changeEditTextLengths(); } + + @Override + public void onKeyboardChanged(boolean useOsmandKeyboard) { + CoordinateInputDialogFragment.this.useOsmandKeyboard = useOsmandKeyboard; + changeKeyboardInBoxes(); + changeKeyboardInEditTexts(); + } + + @Override + public void onCancel() { + dismiss(); + } }; } @@ -277,13 +313,13 @@ public class CoordinateInputDialogFragment extends DialogFragment { } } - public void changeKeyboardInBoxes(boolean useOsmandKeyboard) { + public void changeKeyboardInBoxes() { for (OsmandTextFieldBoxes textFieldBox : textFieldBoxes) { textFieldBox.setUseOsmandKeyboard(useOsmandKeyboard); } } - public void changeKeyboardInEditTexts(boolean useOsmandKeyboard) { + public void changeKeyboardInEditTexts() { for (ExtendedEditText extendedEditText : extendedLatLonEditTexts) { extendedEditText.setInputType(useOsmandKeyboard ? InputType.TYPE_NULL : InputType.TYPE_CLASS_TEXT); } From aa3b8960923046dbef95ddb4185ee8aa60a46f69 Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Fri, 29 Sep 2017 11:52:16 +0300 Subject: [PATCH 16/41] Remove utm and olc formats --- .../res/layout/marker_coordinate_formats.xml | 76 ------------------- ...rdinateInputBottomSheetDialogFragment.java | 40 ---------- 2 files changed, 116 deletions(-) diff --git a/OsmAnd/res/layout/marker_coordinate_formats.xml b/OsmAnd/res/layout/marker_coordinate_formats.xml index e03dad94c8..3d589075c9 100644 --- a/OsmAnd/res/layout/marker_coordinate_formats.xml +++ b/OsmAnd/res/layout/marker_coordinate_formats.xml @@ -120,80 +120,4 @@ android:focusable="false"/> - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputBottomSheetDialogFragment.java index f2b78c94f8..413e330aae 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputBottomSheetDialogFragment.java @@ -106,28 +106,6 @@ public class CoordinateInputBottomSheetDialogFragment extends BottomSheetDialogF } secondsText.setText(PointDescription.formatToHumanString(getContext(), PointDescription.FORMAT_SECONDS)); - ImageView utmIcon = (ImageView) mainView.findViewById(R.id.utm_icon); - TextView utmText = (TextView) mainView.findViewById(R.id.utm_text); - if (coordinateFormat == PointDescription.UTM_FORMAT) { - utmIcon.setImageDrawable(getIcon(R.drawable.ic_action_coordinates_latitude, R.color.dashboard_blue)); - utmText.setTextColor(ContextCompat.getColor(mapActivity, R.color.dashboard_blue)); - ((RadioButton) mainView.findViewById(R.id.utm_radio_button)).setChecked(true); - } else { - utmIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_coordinates_latitude)); - } - utmText.setText(PointDescription.formatToHumanString(getContext(), PointDescription.UTM_FORMAT)); - - ImageView olcIcon = (ImageView) mainView.findViewById(R.id.olc_icon); - TextView olcText = (TextView) mainView.findViewById(R.id.olc_text); - if (coordinateFormat == PointDescription.OLC_FORMAT) { - olcIcon.setImageDrawable(getIcon(R.drawable.ic_action_coordinates_latitude, R.color.dashboard_blue)); - olcText.setTextColor(ContextCompat.getColor(mapActivity, R.color.dashboard_blue)); - ((RadioButton) mainView.findViewById(R.id.olc_radio_button)).setChecked(true); - } else { - olcIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_coordinates_latitude)); - } - olcText.setText(PointDescription.formatToHumanString(getContext(), PointDescription.OLC_FORMAT)); - if (coordinateFormat != -1) { ((CompoundButton) mainView.findViewById(R.id.use_system_keyboard_switch)).setChecked(!useOsmandKeyboard); ((ImageView) mainView.findViewById(R.id.use_system_keyboard_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_keyboard)); @@ -158,12 +136,6 @@ public class CoordinateInputBottomSheetDialogFragment extends BottomSheetDialogF case R.id.seconds_row: coordinateFormat = PointDescription.FORMAT_SECONDS; break; - case R.id.utm_row: - coordinateFormat = PointDescription.UTM_FORMAT; - break; - case R.id.olc_row: - coordinateFormat = PointDescription.OLC_FORMAT; - break; default: throw new IllegalArgumentException("Unsupported format"); } @@ -180,8 +152,6 @@ public class CoordinateInputBottomSheetDialogFragment extends BottomSheetDialogF mainView.findViewById(R.id.degrees_row).setOnClickListener(formatChangeListener); mainView.findViewById(R.id.minutes_row).setOnClickListener(formatChangeListener); mainView.findViewById(R.id.seconds_row).setOnClickListener(formatChangeListener); - mainView.findViewById(R.id.utm_row).setOnClickListener(formatChangeListener); - mainView.findViewById(R.id.olc_row).setOnClickListener(formatChangeListener); mainView.findViewById(R.id.cancel_row).setOnClickListener(new View.OnClickListener() { @Override @@ -276,16 +246,6 @@ public class CoordinateInputBottomSheetDialogFragment extends BottomSheetDialogF ((ImageView) mainView.findViewById(R.id.seconds_icon)).setImageDrawable((getIcon(R.drawable.ic_action_coordinates_latitude, iconColor))); ((RadioButton) mainView.findViewById(R.id.seconds_radio_button)).setChecked(check); break; - case PointDescription.UTM_FORMAT: - ((TextView) mainView.findViewById(R.id.utm_text)).setTextColor(textColor); - ((ImageView) mainView.findViewById(R.id.utm_icon)).setImageDrawable((getIcon(R.drawable.ic_action_coordinates_latitude, iconColor))); - ((RadioButton) mainView.findViewById(R.id.utm_radio_button)).setChecked(check); - break; - case PointDescription.OLC_FORMAT: - ((TextView) mainView.findViewById(R.id.olc_text)).setTextColor(textColor); - ((ImageView) mainView.findViewById(R.id.olc_icon)).setImageDrawable((getIcon(R.drawable.ic_action_coordinates_latitude, iconColor))); - ((RadioButton) mainView.findViewById(R.id.olc_radio_button)).setChecked(check); - break; } } From f3e535198c9f9b1f3dd346f37d51d277a7a4a7cd Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Fri, 29 Sep 2017 11:54:53 +0300 Subject: [PATCH 17/41] Fix max symbols count --- .../plus/mapmarkers/CoordinateInputDialogFragment.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java index 1da2a01d58..151bddc2fc 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java @@ -44,9 +44,9 @@ public class CoordinateInputDialogFragment extends DialogFragment { private static final int DELETE_BUTTON_POSITION = 9; private static final int CLEAR_BUTTON_POSITION = 11; - private static final int DEGREES_MAX_LENGTH = 8; - private static final int MINUTES_MAX_LENGTH = 10; - private static final int SECONDS_MAX_LENGTH = 13; + private static final int DEGREES_MAX_LENGTH = 6; + private static final int MINUTES_MAX_LENGTH = 9; + private static final int SECONDS_MAX_LENGTH = 12; private boolean lightTheme; private EditText focusedEditText; From fdbd1c32b7d7e9f89c90302873e5f255b46c5b0f Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Fri, 29 Sep 2017 12:01:33 +0300 Subject: [PATCH 18/41] Show zoom and location buttons with opened markers list in plan route mode --- .../net/osmand/plus/mapmarkers/PlanRouteFragment.java | 2 -- OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java | 10 +++------- OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java | 9 --------- 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java index 5ff75abd8e..7ad0ebcac2 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java @@ -468,7 +468,6 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene MapMarkersLayer markersLayer = getMapMarkersLayer(); if (mapActivity != null && markersLayer != null) { markersListOpened = true; - markersLayer.setMarkersListOpened(true); upDownIconIv.setImageDrawable(getContentIcon(R.drawable.ic_action_arrow_down)); View listContainer = mainView.findViewById(R.id.markers_list_container); if (portrait && listContainer != null) { @@ -490,7 +489,6 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene MapMarkersLayer markersLayer = getMapMarkersLayer(); if (mapActivity != null && markersLayer != null) { markersListOpened = false; - markersLayer.setMarkersListOpened(false); upDownIconIv.setImageDrawable(getContentIcon(R.drawable.ic_action_arrow_up)); View listContainer = mainView.findViewById(R.id.markers_list_container); if (portrait && listContainer != null) { diff --git a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java index e50ad180cb..b78c7e2aa5 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java @@ -727,8 +727,8 @@ public class MapControlsLayer extends OsmandMapLayer { routePlanningBtn.updateVisibility(showButtons); menuControl.updateVisibility(showButtons); - mapZoomIn.updateVisibility(!routeDialogOpened && !isInExpandedRouteMode()); - mapZoomOut.updateVisibility(!routeDialogOpened && !isInExpandedRouteMode()); + mapZoomIn.updateVisibility(!routeDialogOpened); + mapZoomOut.updateVisibility(!routeDialogOpened); compassHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && shouldShowCompass() && !isInMeasurementToolMode() && !isInPlanRouteMode()); @@ -814,7 +814,7 @@ public class MapControlsLayer extends OsmandMapLayer { backToLocationControl.iv.setContentDescription(mapActivity.getString(R.string.map_widget_back_to_loc)); } boolean visible = !(tracked && rh.isFollowingMode()); - backToLocationControl.updateVisibility(visible && !dialogOpened && !isInExpandedRouteMode()); + backToLocationControl.updateVisibility(visible && !dialogOpened); if (app.accessibilityEnabled()) { backToLocationControl.iv.setClickable(enabled && visible); } @@ -1136,10 +1136,6 @@ public class MapControlsLayer extends OsmandMapLayer { return mapActivity.getMapLayers().getMapMarkersLayer().isInPlanRouteMode(); } - private boolean isInExpandedRouteMode() { - return mapActivity.getMapLayers().getMapMarkersLayer().isMarkersListOpened(); - } - public static View.OnLongClickListener getOnClickMagnifierListener(final OsmandMapTileView view) { return new View.OnLongClickListener() { diff --git a/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java b/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java index 4373b697e9..ce6952a492 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java @@ -81,7 +81,6 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi private ContextMenuLayer contextMenuLayer; private boolean inPlanRouteMode; - private boolean markersListOpened; public MapMarkersLayer(MapActivity map) { this.map = map; @@ -99,14 +98,6 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi this.inPlanRouteMode = inPlanRouteMode; } - public boolean isMarkersListOpened() { - return inPlanRouteMode && markersListOpened; - } - - public void setMarkersListOpened(boolean markersListOpened) { - this.markersListOpened = markersListOpened; - } - private void initUI() { bitmapPaint = new Paint(); bitmapPaint.setDither(true); From 04a7d84933070007f6a8d55e40d8f26902bbe64d Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Fri, 29 Sep 2017 12:10:32 +0300 Subject: [PATCH 19/41] Fix background in dark map theme --- .../osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java index edb94ecb51..dfa1c47a3a 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java @@ -63,7 +63,7 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter Date: Fri, 29 Sep 2017 13:04:30 +0300 Subject: [PATCH 20/41] Add calculation of time and distance --- .../plus/mapmarkers/PlanRouteFragment.java | 35 +++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java index 7ad0ebcac2..0e137616f7 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java @@ -29,6 +29,7 @@ import net.osmand.plus.ApplicationMode; import net.osmand.plus.IconsCache; import net.osmand.plus.MapMarkersHelper; import net.osmand.plus.MapMarkersHelper.MapMarker; +import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener; import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; @@ -44,6 +45,7 @@ import net.osmand.plus.views.MapMarkersLayer; import net.osmand.plus.views.OsmandMapTileView; import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory; import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController; +import net.osmand.util.MapUtils; import java.util.List; @@ -148,6 +150,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene selectedCount = activeMarkersCount; } adapter.notifyDataSetChanged(); + updateText(); updateSelectButton(); showMarkersRouteOnMap(); mapActivity.refreshMap(); @@ -207,6 +210,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene } adapter.notifyItemChanged(pos); updateSelectButton(); + updateText(); showMarkersRouteOnMap(); } @@ -323,6 +327,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene public void onApplicationModeItemClick(ApplicationMode mode) { appMode = mode; setupAppModesBtn(); + updateText(); } }; } @@ -355,7 +360,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene } if (appMode == null) { - appMode = mapActivity.getMyApplication().getSettings().getApplicationMode(); + appMode = ApplicationMode.DEFAULT; } setupAppModesBtn(); @@ -419,8 +424,32 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene } private void updateText() { - distanceTv.setText("1.39 km,"); - timeTv.setText("~ 45 min."); + MapActivity mapActivity = getMapActivity(); + if (mapActivity != null) { + boolean defaultMode = appMode.getStringKey().equals(ApplicationMode.DEFAULT.getStringKey()); + + float dist = 0; + Location myLoc = mapActivity.getMapViewTrackingUtilities().getMyLocation(); + boolean useLocation = myLoc != null && mapActivity.getMyApplication().getSettings().ROUTE_MAP_MARKERS_START_MY_LOC.get(); + List markers = markersHelper.getSelectedMarkersLatLon(); + if (useLocation ? markers.size() > 0 : markers.size() > 1) { + if (useLocation) { + dist += MapUtils.getDistance(myLoc.getLatitude(), myLoc.getLongitude(), + markers.get(0).getLatitude(), markers.get(0).getLongitude()); + } + for (int i = 1; i < markers.size(); i++) { + dist += MapUtils.getDistance(markers.get(i - 1), markers.get(i)); + } + } + distanceTv.setText(OsmAndFormatter.getFormattedDistance(dist, mapActivity.getMyApplication()) + (defaultMode ? "" : ",")); + + if (defaultMode) { + timeTv.setText(""); + } else { + int seconds = (int) (dist / appMode.getDefaultSpeed()); + timeTv.setText("~ " + OsmAndFormatter.getFormattedDuration(seconds, mapActivity.getMyApplication())); + } + } } private void updateSelectButton() { From 13159ef3e5a494c5a001f0089ca5f541f8c1dc87 Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Fri, 29 Sep 2017 13:29:21 +0300 Subject: [PATCH 21/41] Hide coordinate input from menu --- .../res/layout/fragment_marker_options_bottom_sheet_dialog.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/OsmAnd/res/layout/fragment_marker_options_bottom_sheet_dialog.xml b/OsmAnd/res/layout/fragment_marker_options_bottom_sheet_dialog.xml index 66cfb182c6..eb047321cc 100644 --- a/OsmAnd/res/layout/fragment_marker_options_bottom_sheet_dialog.xml +++ b/OsmAnd/res/layout/fragment_marker_options_bottom_sheet_dialog.xml @@ -111,6 +111,7 @@ android:background="?attr/dashboard_divider"/> Date: Fri, 29 Sep 2017 13:34:27 +0300 Subject: [PATCH 22/41] The height of the fragment is half the height of the screen --- .../res/layout-land/fragment_plan_route.xml | 1 + OsmAnd/res/layout/fragment_plan_route.xml | 1 + .../plus/mapmarkers/PlanRouteFragment.java | 40 ++++++++++++------- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/OsmAnd/res/layout-land/fragment_plan_route.xml b/OsmAnd/res/layout-land/fragment_plan_route.xml index fdb701f691..874e5f1f9a 100644 --- a/OsmAnd/res/layout-land/fragment_plan_route.xml +++ b/OsmAnd/res/layout-land/fragment_plan_route.xml @@ -104,6 +104,7 @@ android:background="?attr/dashboard_divider"/> diff --git a/OsmAnd/res/layout/fragment_plan_route.xml b/OsmAnd/res/layout/fragment_plan_route.xml index dab4c87390..3437362038 100644 --- a/OsmAnd/res/layout/fragment_plan_route.xml +++ b/OsmAnd/res/layout/fragment_plan_route.xml @@ -123,6 +123,7 @@ diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java index 0e137616f7..30c979bc8c 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java @@ -242,23 +242,33 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene markersRv.setLayoutManager(new LinearLayoutManager(getContext())); markersRv.setAdapter(adapter); - if (portrait) { - showMarkersList(); - } else { - mainView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { - @Override - public void onGlobalLayout() { - showMarkersList(); + final int screenH = AndroidUtils.getScreenHeight(mapActivity); + final int statusBarH = AndroidUtils.getStatusBarHeight(mapActivity); + final int navBarH = AndroidUtils.getNavBarHeight(mapActivity); + final int availableHeight = (screenH - statusBarH - navBarH) / 2; - ViewTreeObserver obs = mainView.getViewTreeObserver(); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { - obs.removeOnGlobalLayoutListener(this); - } else { - obs.removeGlobalOnLayoutListener(this); - } + mainView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { + @Override + public void onGlobalLayout() { + if (portrait) { + int upDownRowH = mainView.findViewById(R.id.up_down_row).getHeight(); + int buttonsRowH = mainView.findViewById(R.id.buttons_row).getHeight(); + int listContainerH = availableHeight - upDownRowH - buttonsRowH; + View listContainer = mainView.findViewById(R.id.markers_list_container); + listContainer.getLayoutParams().height = listContainerH; + listContainer.requestLayout(); } - }); - } + + showMarkersList(); + + ViewTreeObserver obs = mainView.getViewTreeObserver(); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { + obs.removeOnGlobalLayoutListener(this); + } else { + obs.removeGlobalOnLayoutListener(this); + } + } + }); return view; } From 9dc47fe3ff8950812aa93eec4e54b8070345edd7 Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Fri, 29 Sep 2017 14:09:33 +0300 Subject: [PATCH 23/41] Fix #4494 --- OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java index 34ff60c127..0a59053e76 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java @@ -50,6 +50,7 @@ import net.osmand.plus.views.ContextMenuLayer; import net.osmand.plus.views.OsmandMapLayer; import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController; import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarControllerType; +import net.osmand.util.Algorithms; import net.osmand.util.MapUtils; import java.lang.ref.WeakReference; @@ -875,6 +876,9 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL && pointDescription.getName().equals(PointDescription.getAddressNotFoundStr(mapActivity))) { return new PointDescription(PointDescription.POINT_TYPE_LOCATION, ""); } else { + if (Algorithms.isEmpty(pointDescription.getName())) { + pointDescription.setName(nameStr); + } return pointDescription; } } From e871dc064dad41468fc6b594c6e2571562d5845f Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Fri, 29 Sep 2017 14:29:22 +0300 Subject: [PATCH 24/41] Add displaying the count of selected markers; extract variables --- .../res/layout-land/fragment_plan_route.xml | 54 +++++++++++++------ OsmAnd/res/layout/fragment_plan_route.xml | 54 +++++++++++++------ OsmAnd/res/values/strings.xml | 1 + .../plus/mapmarkers/PlanRouteFragment.java | 4 ++ .../adapters/MapMarkersListAdapter.java | 22 ++++---- 5 files changed, 91 insertions(+), 44 deletions(-) diff --git a/OsmAnd/res/layout-land/fragment_plan_route.xml b/OsmAnd/res/layout-land/fragment_plan_route.xml index 874e5f1f9a..7123151125 100644 --- a/OsmAnd/res/layout-land/fragment_plan_route.xml +++ b/OsmAnd/res/layout-land/fragment_plan_route.xml @@ -51,33 +51,53 @@ + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:layout_weight="1" + android:orientation="vertical"> + + + + + + + - - + android:textSize="@dimen/default_sub_text_size" + tools:text="3 markers"/> + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:layout_weight="1" + android:orientation="vertical"> + + + + + + + - - + android:textSize="@dimen/default_sub_text_size" + tools:text="3 markers"/> + Markers Coordinates format Use system keyboard Choose coordinate format before start. You can always change it by tapping Options. diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java index 30c979bc8c..c8b5bac64a 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java @@ -78,6 +78,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene private ImageView upDownIconIv; private TextView distanceTv; private TextView timeTv; + private TextView countTv; @Nullable @Override @@ -113,6 +114,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene distanceTv = (TextView) mainView.findViewById(R.id.markers_distance_text_view); timeTv = (TextView) mainView.findViewById(R.id.markers_time_text_view); + countTv = (TextView) mainView.findViewById(R.id.markers_count_text_view); enterPlanRouteMode(); @@ -459,6 +461,8 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene int seconds = (int) (dist / appMode.getDefaultSpeed()); timeTv.setText("~ " + OsmAndFormatter.getFormattedDuration(seconds, mapActivity.getMyApplication())); } + + countTv.setText(mapActivity.getString(R.string.shared_string_markers) + ": " + selectedCount); } } diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java index dfa1c47a3a..5ded437f6a 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java @@ -65,18 +65,20 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter Date: Fri, 29 Sep 2017 14:44:39 +0300 Subject: [PATCH 25/41] Add default mode --- .../net/osmand/plus/mapmarkers/PlanRouteFragment.java | 1 + .../SnapToRoadBottomSheetDialogFragment.java | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java index c8b5bac64a..52ca61e6db 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java @@ -394,6 +394,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene public void onClick(View view) { SnapToRoadBottomSheetDialogFragment fragment = new SnapToRoadBottomSheetDialogFragment(); fragment.setListener(createSnapToRoadFragmentListener()); + fragment.setRemoveDefaultMode(false); fragment.show(mapActivity.getSupportFragmentManager(), SnapToRoadBottomSheetDialogFragment.TAG); } }); diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/SnapToRoadBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/SnapToRoadBottomSheetDialogFragment.java index a9acf56f8f..74971b97da 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/SnapToRoadBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/SnapToRoadBottomSheetDialogFragment.java @@ -11,7 +11,6 @@ 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; @@ -36,11 +35,16 @@ public class SnapToRoadBottomSheetDialogFragment extends android.support.design. private boolean nightMode; private boolean portrait; private boolean snapToRoadEnabled; + private boolean removeDefaultMode = true; public void setListener(SnapToRoadFragmentListener listener) { this.listener = listener; } + public void setRemoveDefaultMode(boolean removeDefaultMode) { + this.removeDefaultMode = removeDefaultMode; + } + @Override public void setupDialog(Dialog dialog, int style) { super.setupDialog(dialog, style); @@ -73,7 +77,9 @@ public class SnapToRoadBottomSheetDialogFragment extends android.support.design. LinearLayout container = (LinearLayout) mainView.findViewById(R.id.navigation_types_container); final List modes = new ArrayList<>(ApplicationMode.values(settings)); - modes.remove(ApplicationMode.DEFAULT); + if (removeDefaultMode) { + modes.remove(ApplicationMode.DEFAULT); + } View.OnClickListener onClickListener = new View.OnClickListener() { @Override From 9e6a0ede96d44cdec6f870583c6690b6df8bff8d Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Fri, 29 Sep 2017 14:49:17 +0300 Subject: [PATCH 26/41] Fix #4494 --- .../plus/mapcontextmenu/MapContextMenu.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java index 0a59053e76..140160dce9 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java @@ -703,7 +703,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL mapActivity.getDashboard().setDashboardVisibility(true, DashboardOnMap.DashboardType.MAP_MARKERS); } else { mapActivity.getMapActions().addMapMarker(latLon.getLatitude(), latLon.getLongitude(), - getPointDescriptionForTarget()); + getPointDescriptionForMarker()); } } else { mapActivity.getMapActions().addAsTarget(latLon.getLatitude(), latLon.getLongitude(), @@ -876,9 +876,17 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL && pointDescription.getName().equals(PointDescription.getAddressNotFoundStr(mapActivity))) { return new PointDescription(PointDescription.POINT_TYPE_LOCATION, ""); } else { - if (Algorithms.isEmpty(pointDescription.getName())) { - pointDescription.setName(nameStr); - } + return pointDescription; + } + } + + public PointDescription getPointDescriptionForMarker() { + if (pointDescription.isLocation() + && pointDescription.getName().equals(PointDescription.getAddressNotFoundStr(mapActivity))) { + return new PointDescription(PointDescription.POINT_TYPE_LOCATION, ""); + } else if (Algorithms.isEmpty(pointDescription.getName())) { + return new PointDescription(PointDescription.POINT_TYPE_MAP_MARKER, nameStr); + } else { return pointDescription; } } From f7242538de450d61de451f0f6f9f5b773469484d Mon Sep 17 00:00:00 2001 From: xmd5a Date: Fri, 29 Sep 2017 15:01:32 +0300 Subject: [PATCH 27/41] Add string --- OsmAnd/res/values/strings.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 7da72138f3..79a042598c 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -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 --> + Avoid ice roads, fords + Avoid ice roads and fords Use location Add your location as first point to plan perfect route. My Location From 64f39675b09df22fee7501199c987824102b8971 Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Fri, 29 Sep 2017 15:41:54 +0300 Subject: [PATCH 28/41] Use lastStaleKnownLocation with map markers --- OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java | 4 ++-- OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java index 52ca61e6db..f698b996cb 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java @@ -442,7 +442,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene boolean defaultMode = appMode.getStringKey().equals(ApplicationMode.DEFAULT.getStringKey()); float dist = 0; - Location myLoc = mapActivity.getMapViewTrackingUtilities().getMyLocation(); + Location myLoc = mapActivity.getMyApplication().getLocationProvider().getLastStaleKnownLocation(); boolean useLocation = myLoc != null && mapActivity.getMyApplication().getSettings().ROUTE_MAP_MARKERS_START_MY_LOC.get(); List markers = markersHelper.getSelectedMarkersLatLon(); if (useLocation ? markers.size() > 0 : markers.size() > 1) { @@ -607,7 +607,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene OsmandMapTileView mapView = mapActivity.getMapView(); double left = 0, right = 0; double top = 0, bottom = 0; - Location myLocation = mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation(); + Location myLocation = mapActivity.getMyApplication().getLocationProvider().getLastStaleKnownLocation(); if (mapActivity.getMyApplication().getMapMarkersHelper().isStartFromMyLocation() && myLocation != null) { left = myLocation.getLongitude(); right = myLocation.getLongitude(); diff --git a/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java b/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java index ce6952a492..d4132bc769 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java @@ -211,7 +211,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi @Override public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tileBox, DrawSettings nightMode) { OsmandSettings settings = map.getMyApplication().getSettings(); - Location myLoc = map.getMapViewTrackingUtilities().getMyLocation(); + Location myLoc = map.getMyApplication().getLocationProvider().getLastStaleKnownLocation(); MapMarkersHelper markersHelper = map.getMyApplication().getMapMarkersHelper(); List activeMapMarkers = markersHelper.getMapMarkers(); From 2877f89d0e22e8a3aae4cef895df61b87517c301 Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Fri, 29 Sep 2017 16:23:32 +0300 Subject: [PATCH 29/41] Fix copy paste --- .../src/net/osmand/plus/mapcontextmenu/MapContextMenu.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java index 140160dce9..1de0101a7c 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java @@ -881,13 +881,10 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL } public PointDescription getPointDescriptionForMarker() { - if (pointDescription.isLocation() - && pointDescription.getName().equals(PointDescription.getAddressNotFoundStr(mapActivity))) { - return new PointDescription(PointDescription.POINT_TYPE_LOCATION, ""); - } else if (Algorithms.isEmpty(pointDescription.getName())) { + if (Algorithms.isEmpty(pointDescription.getName())) { return new PointDescription(PointDescription.POINT_TYPE_MAP_MARKER, nameStr); } else { - return pointDescription; + return getPointDescriptionForTarget(); } } From 343ca3ee11ded7a57fd73a1c3734d9bda074376c Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Fri, 29 Sep 2017 16:50:47 +0300 Subject: [PATCH 30/41] Add check for string is not address not found --- OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java index 1de0101a7c..0edb507132 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java @@ -881,7 +881,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL } public PointDescription getPointDescriptionForMarker() { - if (Algorithms.isEmpty(pointDescription.getName())) { + if (Algorithms.isEmpty(pointDescription.getName()) && !nameStr.equals(PointDescription.getAddressNotFoundStr(mapActivity))) { return new PointDescription(PointDescription.POINT_TYPE_MAP_MARKER, nameStr); } else { return getPointDescriptionForTarget(); From b2a7723ae3652d419518d650d431bd64e519eac7 Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Fri, 29 Sep 2017 16:53:46 +0300 Subject: [PATCH 31/41] Fix finding name for marker --- .../src/net/osmand/plus/mapcontextmenu/MapContextMenu.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java index 0edb507132..86e41c349e 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java @@ -881,10 +881,11 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL } public PointDescription getPointDescriptionForMarker() { - if (Algorithms.isEmpty(pointDescription.getName()) && !nameStr.equals(PointDescription.getAddressNotFoundStr(mapActivity))) { + PointDescription pd = getPointDescriptionForTarget(); + if (Algorithms.isEmpty(pd.getName()) && !nameStr.equals(PointDescription.getAddressNotFoundStr(mapActivity))) { return new PointDescription(PointDescription.POINT_TYPE_MAP_MARKER, nameStr); } else { - return getPointDescriptionForTarget(); + return pd; } } From 2b14185b09a5781d5192d8a9b51fe209b2c6e66f Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Fri, 29 Sep 2017 16:58:44 +0300 Subject: [PATCH 32/41] Save selections in DB --- .../src/net/osmand/plus/MapMarkersHelper.java | 18 ++++++++----- .../plus/mapmarkers/MapMarkersDbHelper.java | 26 ++++++++++++++----- .../plus/mapmarkers/PlanRouteFragment.java | 2 +- 3 files changed, 32 insertions(+), 14 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java b/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java index 09fef6e6c1..754822a9c9 100644 --- a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java +++ b/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java @@ -338,7 +338,7 @@ public class MapMarkersHelper { mapMarker.pointDescription.setName(address); } markersDbHelper.updateMarker(mapMarker); - updateMarker(mapMarker); + refreshMarker(mapMarker); } }, null); ctx.getGeocodingLookupService().lookupAddress(lookupRequest); @@ -553,13 +553,19 @@ public class MapMarkersHelper { public void deselectAllActiveMarkers() { for (MapMarker m : mapMarkers) { - m.selected = false; + if (m.selected) { + m.selected = false; + markersDbHelper.updateMarker(m); + } } } public void selectAllActiveMarkers() { for (MapMarker m : mapMarkers) { - m.selected = true; + if (!m.selected) { + m.selected = true; + markersDbHelper.updateMarker(m); + } } } @@ -807,20 +813,20 @@ public class MapMarkersHelper { listeners.remove(l); } - private void updateMarker(MapMarker marker) { + private void refreshMarker(MapMarker marker) { for (MapMarkerChangedListener l : listeners) { l.onMapMarkerChanged(marker); } } - private void updateMarkers() { + private void refreshMarkers() { for (MapMarkerChangedListener l : listeners) { l.onMapMarkersChanged(); } } public void refresh() { - updateMarkers(); + refreshMarkers(); } private void cancelAddressRequests() { diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java index 490c78da22..c6a7a27b51 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java @@ -21,7 +21,7 @@ import java.util.Random; public class MapMarkersDbHelper { - private static final int DB_VERSION = 9; + private static final int DB_VERSION = 10; public static final String DB_NAME = "map_markers_db"; private static final String MARKERS_TABLE_NAME = "map_markers"; @@ -37,6 +37,7 @@ public class MapMarkersDbHelper { private static final String MARKERS_COL_COLOR = "marker_color"; private static final String MARKERS_COL_NEXT_KEY = "marker_next_key"; private static final String MARKERS_COL_DISABLED = "marker_disabled"; + private static final String MARKERS_COL_SELECTED = "marker_selected"; private static final String MARKERS_TABLE_CREATE = "CREATE TABLE IF NOT EXISTS " + MARKERS_TABLE_NAME + " (" + @@ -51,7 +52,8 @@ public class MapMarkersDbHelper { MARKERS_COL_GROUP_KEY + " TEXT, " + MARKERS_COL_COLOR + " int, " + MARKERS_COL_NEXT_KEY + " TEXT, " + - MARKERS_COL_DISABLED + " int);"; + MARKERS_COL_DISABLED + " int, " + // 1 = true, 0 = false + MARKERS_COL_SELECTED + " int);"; // 1 = true, 0 = false private static final String MARKERS_TABLE_SELECT = "SELECT " + MARKERS_COL_ID + ", " + @@ -65,7 +67,8 @@ public class MapMarkersDbHelper { MARKERS_COL_GROUP_KEY + ", " + MARKERS_COL_COLOR + ", " + MARKERS_COL_NEXT_KEY + ", " + - MARKERS_COL_DISABLED + + MARKERS_COL_DISABLED + ", " + + MARKERS_COL_SELECTED + " FROM " + MARKERS_TABLE_NAME; private static final String GROUPS_TABLE_NAME = "map_markers_groups"; @@ -134,6 +137,12 @@ public class MapMarkersDbHelper { " SET " + MARKERS_COL_DISABLED + " = ? " + "WHERE " + MARKERS_COL_DISABLED + " IS NULL", new Object[]{0}); } + if (oldVersion < 10) { + db.execSQL("ALTER TABLE " + MARKERS_TABLE_NAME + " ADD " + MARKERS_COL_SELECTED + " int"); + db.execSQL("UPDATE " + MARKERS_TABLE_NAME + + " SET" + MARKERS_COL_SELECTED + " = ? " + + "WHERE " + MARKERS_COL_SELECTED + " IS NULL", new Object[]{0}); + } } private void saveExistingMarkersToDb() { @@ -319,10 +328,10 @@ public class MapMarkersDbHelper { "WHERE " + MARKERS_COL_NEXT_KEY + " = ?", new Object[]{marker.id, TAIL_NEXT_VALUE}); } - db.execSQL("INSERT INTO " + MARKERS_TABLE_NAME + " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", + db.execSQL("INSERT INTO " + MARKERS_TABLE_NAME + " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", new Object[]{marker.id, marker.getLatitude(), marker.getLongitude(), descr, active, currentTime, visited, marker.groupName, marker.groupKey, marker.colorIndex, - marker.history ? HISTORY_NEXT_VALUE : TAIL_NEXT_VALUE, 0}); + marker.history ? HISTORY_NEXT_VALUE : TAIL_NEXT_VALUE, 0, 0}); } public List getMarkersFromGroup(MarkersSyncGroup group) { @@ -398,6 +407,7 @@ public class MapMarkersDbHelper { String groupKey = query.getString(8); int colorIndex = query.getInt(9); String nextKey = query.getString(10); + boolean selected = query.getInt(12) == 1; LatLon latLon = new LatLon(lat, lon); MapMarker marker = new MapMarker(latLon, PointDescription.deserializeFromString(desc, latLon), @@ -409,6 +419,7 @@ public class MapMarkersDbHelper { marker.groupName = groupName; marker.groupKey = groupKey; marker.nextKey = nextKey; + marker.selected = selected; return marker; } @@ -437,9 +448,10 @@ public class MapMarkersDbHelper { MARKERS_COL_LAT + " = ?, " + MARKERS_COL_LON + " = ?, " + MARKERS_COL_DESCRIPTION + " = ?, " + - MARKERS_COL_COLOR + " = ? " + + MARKERS_COL_COLOR + " = ?, " + + MARKERS_COL_SELECTED + " = ? " + "WHERE " + MARKERS_COL_ID + " = ?", - new Object[]{marker.getLatitude(), marker.getLongitude(), descr, marker.colorIndex, marker.id}); + new Object[]{marker.getLatitude(), marker.getLongitude(), descr, marker.colorIndex, marker.selected, marker.id}); } finally { db.close(); } diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java index f698b996cb..dd5c0206ed 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java @@ -209,6 +209,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene MapMarker marker = adapter.getItem(pos); selectedCount = marker.selected ? selectedCount - 1 : selectedCount + 1; marker.selected = !marker.selected; + markersHelper.updateMapMarker(marker, false); } adapter.notifyItemChanged(pos); updateSelectButton(); @@ -655,7 +656,6 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene if (markersListOpened) { hideMarkersList(); } - markersHelper.deselectAllActiveMarkers(); activity.getSupportFragmentManager().beginTransaction().remove(this).commitAllowingStateLoss(); } From c522dc1a74e8c196d13c44eb84d49882dbb49d05 Mon Sep 17 00:00:00 2001 From: Dmitriy Prodchenko Date: Fri, 29 Sep 2017 17:59:17 +0300 Subject: [PATCH 33/41] Add icons for: Reverse order and Door-to-Door sort. --- .../ic_action_sort_door_to_door.png | Bin 0 -> 1445 bytes .../ic_action_sort_reverse_order.png | Bin 0 -> 1228 bytes .../ic_action_sort_door_to_door.png | Bin 0 -> 1249 bytes .../ic_action_sort_reverse_order.png | Bin 0 -> 1153 bytes .../ic_action_sort_door_to_door.png | Bin 0 -> 1603 bytes .../ic_action_sort_reverse_order.png | Bin 0 -> 1292 bytes .../ic_action_sort_door_to_door.png | Bin 0 -> 1924 bytes .../ic_action_sort_reverse_order.png | Bin 0 -> 1440 bytes 8 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 OsmAnd/res/drawable-hdpi/ic_action_sort_door_to_door.png create mode 100644 OsmAnd/res/drawable-hdpi/ic_action_sort_reverse_order.png create mode 100644 OsmAnd/res/drawable-mdpi/ic_action_sort_door_to_door.png create mode 100644 OsmAnd/res/drawable-mdpi/ic_action_sort_reverse_order.png create mode 100644 OsmAnd/res/drawable-xhdpi/ic_action_sort_door_to_door.png create mode 100644 OsmAnd/res/drawable-xhdpi/ic_action_sort_reverse_order.png create mode 100644 OsmAnd/res/drawable-xxhdpi/ic_action_sort_door_to_door.png create mode 100644 OsmAnd/res/drawable-xxhdpi/ic_action_sort_reverse_order.png diff --git a/OsmAnd/res/drawable-hdpi/ic_action_sort_door_to_door.png b/OsmAnd/res/drawable-hdpi/ic_action_sort_door_to_door.png new file mode 100644 index 0000000000000000000000000000000000000000..97fc7e63f7d5cc8a85eec20be97f3f2fca413c60 GIT binary patch literal 1445 zcmeAS@N?(olHy`uVBq!ia0vp^Dj>|k1|%Oc%$NbBBuiW)N`mv#O3D+9QW+dm@{>{( zJaZG%Q-e|yQz{EjrrIztFjr)TM3hAM`dB6B=jtVb)aX^@765fKFxc2v6eK2Rr0UTq__OB&@Hb09I0xZL0)vRD^GUf^&XRs)DJWnQpS7v4w)UrJkXw zrG=4+j)IYap_#scrM{twu7RPIfu)s!p#l^r0c|TvNwW%aaf8|g1^l#~=$>Fbx5 zm+O@q>*W`v>l<2HTIw4Z=^Gj80#)c1SLT%@R_NvxE5l51Ni9w;$}A|!%+FH*nV6WA zUs__T1av9H3%LcpzHo!{ilG4o3^M(S!~%UoJp=vRT#&!Os*6j4QW4I;s=7F&vLIDI zD784hv?v)EA8E=k&A_n3ZxKi#&^1>6MVY`zNz8G{PcF?(%`5SAu~h=f=%r+)SfyAP zq?nteS?F4tn3(ID7+M82VPS|+9>rI@A~Cd16Zrr*iU#n{}?)WXum#L>{u z)!fp>%mm0WbhL1FGBq$Vg6Z|lD=taQOHPH^oe8uXsu!pSk6tV1qSVBa{GyQj{2W*+ z2*}7U$uG{xFHmrH2F1F$f`)Hma%LV#P!kkU5P!R*7G;*DrnnX5=PH0h+A0%^D-2W2 zlatd7QgjV1(oA$sQjHCD6H|;#bPW>?EsRYpEzJzm%$1<}Q^*ZLeW0WCLCFOv`M`vL zX%fVQX9ge#o}E(jfO)70m{|_^{4Zl*U_9*U;uunK>&=YaUd)anZRM&GLc#~H`GwT5 zb8}z37I)uKTTnFcx=2>GRJ3+=^g*W%yXHv=icwk;9V#5J?LTn08*Y|7{A`00U(J~_ zGh@`A@0x7T_gKN(NGQeU4YQ~N%c})v4Hw0^_nh_+yz=N>(BnFTj3uqx4(@q;$8G=8 z+=aU~oY2!K{4=qwt<`B_s#=vWsQ2oTT|Gxf`3bM)TxEZb~&>D|2eGuzHg56eKFS!I$evWDDBvG>#WHQcJBnq zEtfW3SUqF?hNRm@6Yf1fwaIeBt;c(pb@_K34vl=M{OaDpnH9C|SO3Y`{JZMJ|6tqk z#$!kKczvH^{f+tCNzDyxV!t_GNf&U=`|&#Gr@&`fgXG91Ge6wq{?fGlbj=c`Z$jVt z4>U$hm+aphGh4oDV%jbFX6xhgF3yj#O5Uiwah}g^zO6Iv9TVc+we{fFNy<-`N`KDW zy(ZrC&E%QcvX)2RYi)>IyIEz14(~zEA8)=LvGCX<|8Gmov-@dNbe_~6y>!axz4o+e zr~j;v@Y4Id4_G>$-omG{K0@ulZJGMmjfWoEXV^Z8ZeV0M*M2#m{6NeBP{HZx>gTe~ HDWM4f{mB*> literal 0 HcmV?d00001 diff --git a/OsmAnd/res/drawable-hdpi/ic_action_sort_reverse_order.png b/OsmAnd/res/drawable-hdpi/ic_action_sort_reverse_order.png new file mode 100644 index 0000000000000000000000000000000000000000..7eaa60a5c753694c18af55992ddbfe6cb069d1fe GIT binary patch literal 1228 zcmbVMU2NM#95>w;+FA&pO>_|9c?@;H**?cfY|~Jsak56#Ny#DzJU}n@xv?65%yx+z ziB5wtm^7Fs^K0~s63(8$a-h|UcZ%mzo$;0Cd+VGY=j40GwdKAQ+dN}V!CXj z8C=82m_Kv@k5bg8$f`HOhBm3_uFawt!$!78*c3H77I{dY#Ub6qGnSKMetYMAhPI3x z^Ke?@HLrkM)Dz{Vk>BfIScN|a+(^(tf^i#di~g@m&? zX3eRFHboa)AJb_z19X^@=&a1bv@8kYy|lo?49CkH6afzvURHQW_a25=^9@s}simGR za>_BSF!U6T>vTG7C&jw{3&p48@RmBP*H`kVP>IL@1|#Bs5Kc1t=q< zX{0gK`+7FwkC)U`7N$j674r}lv$C2IC0T`esW_hI1)yj>p#a#$ZH z?2sAq$*}wl?|Y35+An1_Uyr_PUb%X8?4#*{$-$=wPbjU6`Ne@*#|Q}`@@;Pb{vszsQw8CE=S#CQ+FjE|76d$o4-8MS$uNS<;2MI+Le3E zZ>|f5lisDn^~A{sz`M6^{_u}iUU>0jHJM8;Z&^O~vRIj0UfRRbk8OE%zg9(!uWq?; zynA=z*>Ou*{Ap?5$I_z*zD(JjwYq`i>%x_zs?a^tZdw>@(H=tJk*;%8gWoEm%S^HNe2lA9CL6j=CSVc!S8 QSK|LmxmZzOAD@2eAIG1NZ~y=R literal 0 HcmV?d00001 diff --git a/OsmAnd/res/drawable-mdpi/ic_action_sort_door_to_door.png b/OsmAnd/res/drawable-mdpi/ic_action_sort_door_to_door.png new file mode 100644 index 0000000000000000000000000000000000000000..e4bda56bd1502982d5d748e180d26921c86526c7 GIT binary patch literal 1249 zcmbVMTWs4@81@>mmO-PyShtljSuRXts$(C=i7#ttlQ?ZNk+w=B5s8=ja@?54c4oW8 ztw8E3gxXOiC=>UMBJscrydia(w60=QV;ZnYeSsIC;$c#eCJls!G^rf7N#UW|1D5P_ z&VT;z`|q9`9_(-3*S-(Ku-4pwR6y&Y;BDE9zQ5Fx_t0|K%a*(mTlZ?R1F@85D-h3_ z@)#^YS(`ldE$qgykZ%-AUMc^)sM=;!4s@cvSw(0J>+bQZvN{euT!CYTl_c(5S|)Hq zOA;@{^K`zNfn{T0%7G(OgGF^}Top8;=Q+IF7ZHI8JsJ1Sisg!alGx%E(LNAU1iq!> zjVFn1r%L%@JYzc$k4F=v3SvCY2~iLic!ur585$%gTA%<+(muNuum|Rgt1VV^lrEw(x*a zR_qBcNgz+RLoloP{0_0@))R$NM)`7;0#TYW%^jUR z9(rd3jB@v2LxCdlMjUbsR1~=)+3JJ|EiWe}33LNxrLu{%Ah9U`vYa3#SYD7oiqEFwG{ZEoIm`8AON9;F2C`kp zrXGkDGY*tJ+bP<1rO^e$W!tmevR%b9nV{+%ek?Dmh7|~(4GOg#w*(#IWvKNzwux_L zS~Pa?0%)A7>a<1zUS~-b#sDd63`+tT@G({p5Wy3=Rii(f%#8^pH412D1Dh8o%sh5;he4j literal 0 HcmV?d00001 diff --git a/OsmAnd/res/drawable-mdpi/ic_action_sort_reverse_order.png b/OsmAnd/res/drawable-mdpi/ic_action_sort_reverse_order.png new file mode 100644 index 0000000000000000000000000000000000000000..0027b2720a23233eff68e0a9ff7ae618d3a90ba7 GIT binary patch literal 1153 zcmbVMOK8+U7)})*)T+ftwLOi|gM!&)ve|ADy4KxIt1E6T>w>FzFq_PFLz{=m)J=OrU=C@AVdS_O+((H=xlLD8$Ah*t0*KEOkfqE6b~>Y?;tAeote{_p?4|CNEx zjvdQun`$YFTAtdeWXQTcc$Y3F-*=_hBv~49TMqBF3%I1Zh>GiW9)XmpcA*SX^}fST zQ42*a^o?u|=hC}n%{D`7pcC>IB0^jVhJlT)Y({^RD55z1Drd4ovjGiHtOLu~# z?II8fH8UCviy$h6U_=smVJqM{*vxVg3k8OQGAGF#1eJ#--dw#PXO#AeFLH{}MT{Mp zWlN<}s1y#_ZWjwBNn$yk<#~o^FkYX9RiClEja3T@@-)|Quwh#uu&CzkUL2zd)0q%V zC!L-(YaZ}xv8EZsHLdO84EjrBPHivS=O8wNJiFJ`NIeQ0t6-A5`5gs{ zgpIt%HAqp^9>vyrO=RJe5~ImYNH=s@7dbsD6huZ6geW6GDa?p`zQ7QS&ct!jo92)6`jl?F8{PoRYZC+*v<|EIn0g|vd9d% zWLWM_UjIl2?NUmKXZ_dtso%d_7cw;;ZY-L}z1)8C_|So&4QD>p4y`ZN-B_!L$2ia+ z)Hi+sx9ZCuUQVp5IovY(9;_~pZ1_GBe>^y~_(#p@+_Lg`;&#JWaI>Q6*Rp}L6XMlx zSGk|?!OejQl-_l!{>_qu+mAMtM+fQWYs%y2E~=rc5>_#Jb#~+x8wo@qR5C*3pLi0SPUWWoCy0BvrwPfQMPaaz@p?6Q@)F zOB+@5bT-%)Ffrw9VXeT-t+l(T+6oG%RoPiUW{8js_!*G|LVh0?Btk~jh+RV3hsBTz z7*P=`jH(x;+_qxC#0w0d(`JAal5PO>xE9gj1{6yJP#DR8U>rg)5Jm_XCtw5^eN>V+ zf%XzkbN;9=>10%ui(-I)pz7*sZFRbq7nVQ>j^hxFLMRGK8ep)76Uh+B1!qPqn3*6Y zumO?fIUsD2^zc=pQ6({b5rRKpv%NIT1xFJlr3?y@0SM8;kl!DUYeYLJI+=fIyiz;p zstGWVlL_)w0wvYMJ2L{7a`$>iVMU1z;SgAWO1ja~EKSe`nAT%n z1Bhdo9>fql9WPSPG)#~@V1&a3cw7@UV7CImNQxd>v>4cl5Ryni;dc2?`$R-iPlmTIhe0~L94Cg8W=N2RW%y1nE|bYgt2x&dx^`!4Z_$~Y z_;YV-`kEDs&K^D(?MQ67R&X&Tt07eKV8BzqskY?EUF)DWv3^X#fnQRd$oD2roSruQ zsru0=xRtT>c&!7I(EH7FwGzF$W!o0tA@A481N5y`RmYBL%9{OwnA>M(bzZ%L#m{~h zQJlB&n#*mIlhV4Q&;ItE{NpU5zmdIvy0;|*o4%+}ekeHDX!-2k)HU%piuzSaV`=4Z z@u#lL(Assaxuv(2)KY>?E^YoHsX%$WWLPL0zozNiOG90j#$#fg+H0Xn19ZWzwd zgY7XpDpG*%%H+g}STtAf$=Q10%n6I9F%IpD+R{4IL2I|AKY48L=G2{g6DI5&TL0j= z)8SrLw<*5#imzem7fr~mr}9G=E2DY}>mAyd-BVi^bs5#)xSJlwe$aeFrie|wk&3O> zSrZN)IiOkBcj5gp&-N2&&yUBi>)O7x$lceU@;ohD9xEfpQ3pSgO-Ks=)~y!1`OCbrrhfpi Ch(qT9 literal 0 HcmV?d00001 diff --git a/OsmAnd/res/drawable-xhdpi/ic_action_sort_reverse_order.png b/OsmAnd/res/drawable-xhdpi/ic_action_sort_reverse_order.png new file mode 100644 index 0000000000000000000000000000000000000000..071740d5898cf1c2b8dc18d9674e784fa175a447 GIT binary patch literal 1292 zcmbVMTWs4@7FAo~|bww%@-U!?1>Ahmb}q?Y^FE=$ozm<5jfW=Op@^!-nD%MGIn4*~mdW zsfl@*hN3+B+!AcXu)30(>2vy0oxEgdKGDVaN}7q-7}k2QWQx)dbnqO^t9pc3`Fw%E zRXIXr11UOX#$iG27_;Evv963XHY9N}aj*?cQiN1@V9{NJ_vT#zUMB1h_E69>5tI1Sy)M087$2#< z5~_#NTqUF2-QAE2MBeb-mWqlZ4hx1fqCwqB3K0U`_+(Y)8A zlT%2@08W&1asUFUs%I;HjHP1$!~{-YqW~mAoDgKgoB*QXL@YovOqH9|ZAa84ShcMp z+ZAs7u3SEDLD4a+jA0B{yP&6FIEGy?OgtWUs~*BzQlg~luJBQ}P#bXz&{Cg=@*&I6 z@bygd>K0xAIV4F6Et4Ruup|rpfD~nhC4mUSewO2cKnW2QzWjePNFk>vw_X0zK2;Iw zNq4(B4Ct^qPEbcPWT9b6_3#9S)jXCIqM6dQpR!NvoM`tRIlkwlFns6XPhaf6v-_D? zOQL^%a(-GE*f-Vm?cn%VEniQCmUh%AO~wzG^YaImk1q$AHy`kfW1jK$h2Y-b_x=6b z%4%`BVd>>#?WgK~z2|alvBul@?EcyQmzqw$!oB4UUL!tkey?`ndj8B)G3vt9nN(Z% zhup2%?~a_U`}2zDjkWRG=})@L4-L(+%#8U+eXqQ?VKseq@`Fxd<-9FUlrI&sO7`8% zXR}&;?-%jO^2Mijl&{|k?0)UsYGd?m;@(R?X7jz%i|vD0{>IFen_sSB57yW2 mJh6y3d9fNVcJ!B@$@5tG_SJ3HUpqYR|0$X15)vh*H9^Fz{+fc0jlKKWFgs*R0Dw!Yy=T&I>zcIyCDlC8#jxIqM)c1 z5GxfGFHmWjDp$3JiEr(jqqLxGO;8MW~RcmR-ZWL^PIR5C)?E4-2Jn#L^=ETod zjvwPUhQVNrSH&n2=rzXqdW@pwyxuY;z4%g58fq?Kplk?N%Vw?i#Rb{yU9Yc84T$Ry9LpwU=*Okl5n$(^~h1p0&rBunjfm> zt1Xe35sz6;Vsn?zPSh_?(ZeWf#)p8^E}<2eFbVXp!Y=QWQ7yo69G zGS(}nH0pRDk{~f4lpDs;gF-PNg1KNQEEYf^fPfE%@%S(gggAUq!iOb%5Eyz`v^5en zND>s$L$>IXjAf)Ki-gCs*=$^!kV}wBJP?Lq9$&x{2sku?V_jyZ5Ie_g4H(v-z^r-_ zw@^4?2AmoZ9g#-KShT0FLNHm>>eq_R)}chvDdX7@3lHS-c_x!Hu9s*lm4N;0#v9Sr z#AOzYmw;J`G*VC3!w@h`rgQgpLrx&=jU7pR13PPV|!pxLPA!E^BxG0WFP%$4B zK?X4gh9D6K0%0LXEYKM^m;i(kRELIQpnh1-oA?nBKLP|JU|0dkK`=@LE5aZ#tN`WW zsEAO$KrqZznXMFJ)?>rAaoY9}mxjNED~TjAgd)g9f=C_if_NiA5mqB%0U{%vRTlxl zYDABlotGat3-u~)1xDgaF*KSaOu)-bOYk>%0iq(k-oQsWpx6L$AWR5y5L5thKm-&E zAs7w=4IdWJ}PSR$VqwDb&?s1))< zd(%U$%;+umF5a+y#<~f4m}@|mZr|Q_p7{N=H!OFeS4eq$;<4EMI@7)%xf`=%ay1$a zvpj!n2`g5bT@*ZZXZxc4SqHL5uN_ElSs)dK4~ADbo-OrXp%v`dVQD+PY~a?4@cE@T z9-P~GD|Q<&E1vbh<4V#D%h>I%oxTMv*XN_2O(R=epSoRmJg$;a#q*Mwk`A1%fI(d@>y%l2}Mf#OfE+=)}G&aX0HFr=81hw1$>e8^lz|coNB5s$S_u! z*8Rc`Bdkf8S!eJ+i~5b>hkFL2yyV!8N1=<$l-2TEr<6NA9Hl!3_TQ6szw?{;_HIbo z7?|s(@>Uo6rLVGG-4uRso8+9EQM0Q9EUAAS?pab=RVe%5!gu$#Y8u>&++nbXVHw|j z8>^^4-}A1;jalGr%{uvY?kHx?jFs z+&Wlmb&+>^H(sk*(5|0uJMLM!gxOY+q$X*Kmg63?j z-96`uTh{137o>$hB{!XF-W^xGr8)VGiK+;>w5Gmbn)cF^F2596;gs^Zrx|^R^U^9p zMw7aPc^#TXWl2|uYOqB=eNww@bKg?U-{~vr8qR$UZ?$j!S{JGol5Of~^4dO!YHEG= zN)hhro0<1X6W5@%6-4JhA2idH6L-$+Drcg9(UNVTC6txdW-ItOnOXfPkTc5nMr&#b zGe5W~;qHqBeZxvoPM177O?1fJP)mt=+GcjN*fxCQ`1RZFF}j;{E5xFiZcN7Cb$74p T;yv#<|BI@q*@~kPi?jX#y&?Vu literal 0 HcmV?d00001 diff --git a/OsmAnd/res/drawable-xxhdpi/ic_action_sort_reverse_order.png b/OsmAnd/res/drawable-xxhdpi/ic_action_sort_reverse_order.png new file mode 100644 index 0000000000000000000000000000000000000000..a69685c1d99251a18d46cccbe05f82076b431c0e GIT binary patch literal 1440 zcmbVMe@xVN6ffWwf?%fM9Owc~8Dk2)ws(bVDmTe@sIEfQ+_{Vhe!?5ATeqfd@#LUewaA?rYCGK0`*p?9gSd;eq zeee4|@4fHmz1PDf#XI6+HpL(a66Yx7OW|6mztNAw@7~|e?0`$6W-r(FC~mD@Pyv!B zDK3CIyh0Ty1%lL2I|8y1Bq}JEm22hBB2HAiMnShR2EBfWMv&~BpkEMcfQGt2mF%-( zbAuN#RF9>Juxv)_Mdm4+&#Ksztm9U)cXm*f;4!l4U(4g1j3vfXzw&<6G zdtFUn=%R^MW5t$|DtDHkHbn(!rZEc_DKmpwSR<9mGA23$HIY;nL9zrz<0QqAEJsr4 z@`J%>s^sQM`GVzGP_kmxn&#&SqQ1V~SZ_8eY864TEK86k!eqjs1s-VdX+jY91yaHu zcn}a(*{{ip57j*iE~QShVldOCD|r1*=Za%rV3{aL84(ox1Z5-%uUEg=u^Kq8XN_@)&!5 zCTTK-u?}BA6MP~F$ChF2Wi0HqTCj2 z887``1__uHp|{Jw+9#}nJ*jV3h5-sI;{<$ghEzB#_5}O{fyJUL0oR~jWFiK~yO)(r^bH(x1jXx@W9e1U%jYCbd zX`^>u4jnN>MCT%rPlS*)C=wA3g&&Z&>V6t%eW&{ufc>~R?!)y^or}0Sl$|rK3`!Sf zT!YrufvY)&u5T`U@g_65FYn3ey=}jzZ#y)VdUj)SYmW8v<5b%Ib(4vAjYIPZ^?1|T z)ShHd(!glNf#fNp`(x>QX|_7MHFdg~F^-%#ol^Mr!7t~#Zk@aP>dC&{ol`}BroW$b z-4j2Uapuy`)33LUZaQ!_YHLJdnZgTAL(gp9)-ut3za@2{ufOLaQ-h%oVux>x*Nmw9ET=Co7)m@g zwzm4=!Q=g&vAGJlsVnw;UFc3A)cMB7Yd5nhdn>wHB8NZ0W}iww^=+tV_Cj!hsqK1j zQfS_qFnMm5>t^)q2NU-{+R|Tl?bc&DdAWmMzc6-hjJrLaXt=Z?3Ub=R|JA+jzw{z6 dRaQpEBF)!(AGQv+wd?;(hrO6TmH*;ve*=!h`Pl#f literal 0 HcmV?d00001 From 7e334dc92d902aa86e09c92c85ba9557af7d8609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B5=D1=80=D0=B3=D1=96=D0=B9=20=D0=94=D1=83=D0=B1?= =?UTF-8?q?=D0=B8=D0=BA?= Date: Thu, 28 Sep 2017 14:33:23 +0000 Subject: [PATCH 34/41] Translated using Weblate (Ukrainian) Currently translated at 100.0% (2441 of 2441 strings) --- OsmAnd/res/values-uk/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd/res/values-uk/strings.xml b/OsmAnd/res/values-uk/strings.xml index 4c0452df16..79c918fd57 100644 --- a/OsmAnd/res/values-uk/strings.xml +++ b/OsmAnd/res/values-uk/strings.xml @@ -1526,7 +1526,7 @@ Обчислити маршрут OsmAnd для першого та останнього сегментів маршруту Чи Ви хочете використовувати відображення треку для навігації? Додати як наступний пункт призначення - Обрати GPX… + Виберіть GPX… Виберіть пункт призначення Виберіть на мапі Закладки @@ -2232,7 +2232,7 @@ Вилучити всі активні позначки? Очистити історію позначок мапи? Поточні позназчки - Позначки мапи + Маркери мапи Позначка мапи Рекомендується вимкнути показ полігонів. Файл GPX з координатами нотаток From 18243a13735de2e6862754de7112f10c2e61b62c Mon Sep 17 00:00:00 2001 From: iman Date: Fri, 29 Sep 2017 13:02:50 +0000 Subject: [PATCH 35/41] Translated using Weblate (Persian) Currently translated at 74.1% (1809 of 2441 strings) --- OsmAnd/res/values-fa/strings.xml | 186 ++++++++++++++++++++----------- 1 file changed, 122 insertions(+), 64 deletions(-) diff --git a/OsmAnd/res/values-fa/strings.xml b/OsmAnd/res/values-fa/strings.xml index 1f4b2f9c66..2aca6248cb 100644 --- a/OsmAnd/res/values-fa/strings.xml +++ b/OsmAnd/res/values-fa/strings.xml @@ -764,9 +764,7 @@ OsmAnd حتی در زمانی که صفحه خاموش است در حال اجرا می‌ماند فضای کافی برای دانلود %1$s مگابایت وجود ندارد (فضای خالی: %2$s). - آیا {0} فایل را دانلود میکنید؟ -حافظه استفاده شده {1} مگابایت است. -(حافظه قابل استفاده {2} مگابایت است.) + آیا {0} فایل را دانلود می‌کنید؟ حافظهٔ استفاده شده {1} مگابایت است. (حافظهٔ قابل‌استفاده {2} مگابایت است.) تم شفاف کتابخانه بومی بر روی این دستگاه پشتیبانی نمیشود. @@ -1387,7 +1385,7 @@ دستگاه های متصل - OsMo گروه + گروه‌های OsMo شروع خودکار پس از راه اندازی و ارسال موقعیت شروع خودکار سفر شناسه شخصی ردیاب @@ -1440,7 +1438,7 @@ انقضاء در شرح خط مشی - شناسه گروه + ID گروه نام گروه پیوند به گروه پیوستن @@ -1799,11 +1797,14 @@ "آزاد %1$s… " پیشفرض جاده‌های کنتراست بالا - نمیتوان به سرور OsMo متصل شد: -- اتصال اینترنتی خود را بررسی کنید؛ -- تنظیمات را بررسی کنید؛ -- توییتر ما را بررسی کنید: https://twitter.com/OsMomobi - کاربر ناشناس قادر به:\n- ایجاد گروه نیست؛\n- همزمان سازی گروهها و دستگاهها با سرور نمیباشد؛\n- مدیریت گروهها و دستگاهها در دفتر خصوصی نمیباشد. + نمی‌توان به سرور OsMo متصل شد: +\n- اتصال اینترنتی خود را بررسی کنید؛ +\n- تنظیمات را بررسی کنید؛ +\n- توییتر ما را بررسی کنید: https://twitter.com/OsMomobi + کاربر ناشناس نمی‌تواند: +\n- گروه بسازد؛ +\n- گروه‌ها و دستگاه‌ها را با سرور همگام کند؛ +\n- گروه‌ها و دستگاه‌ها را در یک پیشخوان شخصی روی وبسایت مدیریت کند. اروپا - هلند به روزرسانی وجود ندارد به‌روزرسانی پویا @@ -1856,18 +1857,18 @@ غیرفعال رنگ‌بندی براساس دامنه مسیر رنگ‌بندی براساس OSMC - اشتراک گذاری موقعیت - آدرسی مشخص نشد + اشتراک‌گذاری موقعیت + آدرسی پیدا نشد نزدیک - مخقی کردن - پائین‌ترین کیفیت + مخفی‌کردن + پایین‌ترین کیفیت بالاترین کیفیت کیفیت ویدئوی خروجی - انتخاب کیفیت ویدئوی خروجی + کیفیت ویدئوی خروجی را انتخاب کنید قالب صدای خروجی - انتخاب فرمت صدای خروجی + قالب صدای خروجی را انتخاب کنید لطفاً نوع درست POI را انتخاب کنید یا از این مرحله رد شوید - کلید منو به عوض نشان دادن منو داشبورد را نشان میدهد + کلید منو پیشخوان را نشان می‌دهد، نه منو را دسترسی از نقشه نسخه‌ها بازخورد @@ -1895,11 +1896,10 @@ مسیر فعلی نقشه را جابه‌جا کنید تا جای نشان عوض شود - مرتب سازی - انتخاب فایل GPX %s - ما به اطلاعات شما برای ارائه خدمات نیازمندیم - آیا {0} فایل را دانلود میکنید؟ -اکنون فضای خالی {2} MB است. شما نیازمند {3} MB فضای خالی و {1} MB فضای اضافی هستید. + مرتب‌سازی + %s فایل GPX انتخاب شده است + برای اینکه اطلاعاتی دربارهٔ مشارکت‌ها را برایتان ارسال کنیم، نوشتن آن لازم است + آیا {0} فایل را دانلود می‌کنید؟ {3} مگابایت برای ذخیره‌سازی موقت و {1} مگابایت برای ذخیره‌سازی دائمی صرف شده است. (فضای موجود {2} مگابایت است.) نوع ضبط چند تایی انجام شده @@ -1968,71 +1968,71 @@ اتوبوس قطار ما را دنبال کنید - مسیر پیامهای صوتی - نشان دادن مقصد به صورت صوتی - مسیر پیام لمسی - اعلان مقصد از طریق ویبره - فعال کردن مسیریاب OSM آنلاین (بتا) - مسیریاب آنلان OSM - مقصد مشخص نیست + بازخورد صوتی برای مسیریابی + نشان‌دادن جهت مقصد با پیام صوتی + بازخورد لمسی برای مسیریابی + نشان‌دادن جهت مقصد از طریق لرزاندن + فعال‌کردن مسیریابی از روی تغییرات OSM Live (آزمایشی) + مسیریابی با OSM Live + مقصد را مشخص نکرده‌اید حالت آهن ربای گوشی وضعیت نسبی - هنگامی که مسیر درست است آنرا تغییر نده - هنگامی که از مسیر خارج شدید مسیر جدید را اتوماتیک تعیین میکند - عدم تغییر مسیر یا مقصد اشتباه - در صورت انتخاب مقصد نادرست مسیر اتوماتیک تغییر کند - اعلام هوشمند اتوماتیک - در صورت تغییر مقصد آنرا اعلام کن - اعلام دوره اتوماتیک - حداقل زمان تکرار اعلامها - رنگ پیش فرض - انتخاب دسته بندی + با خارج‌شدن از مسیر، مسیر تازه‌ای پیدا نکن + هنگامی که از مسیر خارج شوید، برنامه به‌صورت خودکار مسیریابی تازه‌ای انجام نمی‌دهد + هنگام حرکت در جهت مخالف، مسیر تازه‌ای پیدا نکن + وقتی دارید فقط در جهت مخالف حرکت می‌کنید، به‌صورت خودکار مسیریابی مجدد نمی‌کند + اعلام هوشمند خودکار + فقط اگر جهتم از سمت نقطهٔ مقصد منحرف شد، اعلام کن + بازهٔ زمانی اعلام خودکار + حداقل زمان تکرار اعلام‌ها + رنگ پیش‌فرض + انتخاب دسته نام - دسته بندی + دسته توضیحات نقشه به موقعیت متصل شد - جمع کردن - باز کردن - لیست خالیست + لیست جمع‌شده + لیست بازشده + لیست خالی لیست درختی نصب نیست - باز + بازکردن برو به بالا حالت نقشه باریک متوسط - کلفت - لطفا در نقشه علامت بزنید + ضخیم + لطفاً نشان‌ها را از طریق نقشه اضافه کنید هیچ نقطه ای پیدا نشد گزارش - اکنون برنامه اجازه ذخیره سازی در کارت حافظه را دارد. برنامه را ببندید و دوباره اجرا کنید. + اکنون برنامه اجازهٔ ذخیره‌سازی در کارت حافظه را دارد. برنامه را ببندید و دوباره اجرا کنید. برو بالا برو پایین پایان مسیریابی - اجتناب از جاده - پوشه ذخیره سازی فقط خواندنی است. پوشه ذخیره سازی به طور موقت به حافظه داخلی تغییر پیدا کرد. لطفا مکان ذخیره سازی معتبر را انتخاب نمایید. + اجتناب از جادهٔ + "پوشهٔ ذخیره‌سازی فقط‌خواندنی است. پوشهٔ ذخیره‌سازی به‌طور موقت به حافظهٔ داخلی تغییر کرد. لطفاً مکان ذخیره‌سازی معتبر را انتخاب نمایید." اشتراک گذاری حافظه نوار بالا گزارش کامل - پیدا کردن مجدد مسیر - OpenStreetMap یوزر و پسورد - کمک مالی - تعداد گیرنده ها - اصلاح %1$s، رتبه %2$s، اصلاح نهایی %3$s - رتبه بند ویراستاران OSM - اشتراک آنلاین OSM + پیداکردن مجدد مسیر + نام کاربری و رمز عبور OpenStreetMap + کمک‌های مالی + تعداد گیرندگان + اصلاحات: %1$s، رتبه: %2$s، کل اصلاحات: %3$s + رتبه‌بندی ویرایشگران OSM + اشتراک OSM Live اشتراک اسم جهانی - اسم من را در گزارش نشان نده - پشتیبانی منطقه ای - هزینه ماهانه + اسم من را در گزارش‌ها نشان نده + منطقهٔ پشتیبانی‌شده + هزینهٔ ماهانه پرداخت ماهیانه فعال - غیر فعال - لطفا آدرس ایمیل درست وارد کنید - اسم جهانی را وارد کنید - تشکر از شما برای به اشتراک به روز رسانی آنلاین! - بخشی از کمکهای مالی شما پرداخت میشود به کاربرانی که در آن منطقه اصلاحات نقشه را انجام میدهند. + غیرفعال + لطفاً نشانی ایمیل معتبر وارد کنید + لطفاً اسم جهانی را وارد کنید + سپاسگزاریم که مشترک به‌روزرسانی‌های زنده شدید! + "بخشی از کمک‌های مالی شما به کاربرانی پرداخت می‌شود که در آن منطقه اصلاحات نقشه را انجام می‌دهند." تنظیمات اشتراک زوم خودکار روشن/خاموش انتخاب خیابان @@ -2187,4 +2187,62 @@ \n • اضافه‌شدن بومی‌سازی‌های بیشتر و پشتیبانی از نام‌های محلی \n \n • رفع بسیاری از مشکلات دیگر و بهبود عملکرد برنامه + لطفاً ابتدا اشتراک OSM Live را بخرید + با این اشتراک می‌توانید نقشه‌های سرتاسر جهان را به‌صورت ساعتی به‌روز کنید. بخشی از درآمد حاصله به جامعهٔ OSM برمی‌گردد‌‌ وصرف هر یک از مشارکت‌های OSM می‌شود. اگر OSM و OsmAnd را دوست دارید و مایلید از آن‌ها پشتیبانی کنید، بهترین راه همین تهیهٔ اشتراک است. + نشان نقشه را انتخاب کنید + نشان‌های دیگر + آپلود به‌صورت ناشناس + نوار تنظیم شفافیت رانشان بده + فضای ذخیره‌سازی ناکافی است! {3} مگابایت برای ذخیره‌سازی موقت و {1} مگابایت برای ذخیره‌سازی دائمی لازم است. فضای موجود فقط {2} مگابایت است. + آپلود یادداشت OSM + اولین نشان نقشه + دومین نشان نقشه + نوار ابزار + ابزارک‌ها + آیا همهٔ نقاط را به نشان‌های نقشه اضافه می‌کنید؟ + افزودن به نشان‌های نقشه + انتخاب نشان‌های نقشه + برعکس‌کردن ترتیب + فعال‌کذدن ویژگی نشان‌های نقشه + آیا همهٔ نشان‌های فعال را حذف می‌کنید؟ + آیا تاریخچهٔ نشان‌های نقشه را پاک می‌کنید؟ + نشان‌های فعال + نشان‌های نقشه + نشان نقشه + توصیه می‌کنیم رسم چندضلعی‌ها را غیرفعال کنید. + مسیرهای MTB را نشان بده + چندضلعی‌ها را نشان بده + وضعیت + ذخیره‌کردن تغییرات + نشانی ایمیل + اشیای زیر زمین + اطلاعات وجود ندارد + حذف + بیشتر بخوانید + می‌توانید به‌روزرسانی‌های دانلودشده را حذف کنید تا به نسخهٔ اولیهٔ نقشه برگردید + جاده مسدود است + انتخاب + عوض‌کردن مبدأ با مقصد + آیکون‌های POI + حذف شد + حذف شدند + مبدأ + انتخاب نشده + هنگامی که فضای استفاده‌شده بیشتر از حجم فضای ذخیره‌سازی می‌شود قطعه‌ها را جایگزین کن + طول هر کدام از قطعات ضبط‌شده نباید از مدت‌زمان تعیین‌شده بیشتر باشد + حجم فضای ذخیره‌سازی + مقدار فضای موجود برای همهٔ قطعات ضبط‌شده + به‌روزرسانی‌های زنده + نقشه‌های موجود + راهنمای صوتی را انتخاب کنید + برای زبان خودتان راهنمای صوتی را انتخاب یا دانلود کنید + جاده‌هایی را انتخاب کنید که باید در هنگام مسیریابی از آن‌ها اجتناب شود + برنامه اجازهٔ دسترسی به موقعیت مکانی را ندارد. + برنامه اجازهٔ دسترسی به دوربین را ندارد. + برنامه اجازهٔ دسترسی به میکروفون را ندارد. + مسافت: + مدت زمان: + راه مال‌رو + بیت‌رِیت صدا + بیت‌رِیت صدا را انتخاب کنید From fbbb176d197ee4118e24956d41d198661d815ffe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Sok=C3=B3=C5=82?= Date: Fri, 29 Sep 2017 04:16:47 +0000 Subject: [PATCH 36/41] Translated using Weblate (Polish) Currently translated at 98.7% (2410 of 2441 strings) --- OsmAnd/res/values-pl/strings.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values-pl/strings.xml b/OsmAnd/res/values-pl/strings.xml index 91e0c85070..2bd97bb803 100644 --- a/OsmAnd/res/values-pl/strings.xml +++ b/OsmAnd/res/values-pl/strings.xml @@ -2840,7 +2840,7 @@ Reprezentuje obszar: %1$s x %2$s Wskaźnik odległości Kolejność sortowania Opcje znacznika - Wybierz w jaki sposób wskazywać odległość i kierunek do znaczników mapy na ekranie: + Proszę wybrać w jaki sposób wskazywać odległość i kierunek do znaczników mapy na ekranie: Zmiana orientacji mapy Wybiera prędkość, poniżej której orientacja mapy zmieni się z „względem kierunku ruchu” na „względem kompasu” Wszystkie znaczniki mapy przeniesiono do historii @@ -2865,4 +2865,5 @@ Reprezentuje obszar: %1$s x %2$s Wyświetl strzałki na mapie Wyświetl minione Ukryj minione + Wprowadź współrzędne From 6f16586583da3a2c9fa56ee1488a7455b8b9538f Mon Sep 17 00:00:00 2001 From: Softmap Date: Fri, 29 Sep 2017 11:20:57 +0000 Subject: [PATCH 37/41] Translated using Weblate (Arabic) Currently translated at 46.3% (1473 of 3176 strings) --- OsmAnd/res/values-ar/phrases.xml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/OsmAnd/res/values-ar/phrases.xml b/OsmAnd/res/values-ar/phrases.xml index 617466d3ef..7caa517a9c 100644 --- a/OsmAnd/res/values-ar/phrases.xml +++ b/OsmAnd/res/values-ar/phrases.xml @@ -1582,4 +1582,29 @@ مسار جري مضمار سباق الرماية + دائرة دوران + نقطة دوران في مجرى مائي + غابة محمية + أرض صناعية سابقة + حقل أخضر + يعمل + منجم تعدين + ممر منجم + مقياس الغاز + صومعة + مأمور + حافظة رضيع + بولينج 9 دبابيس + بولينج 10 دبابيس + الكرة الحديدية + ركوب الدراجات + حقل هوكي + غولف + كرة السلة الهولندية + المضرب + تزحلق بالعجلات + الرماية + ركوب الأمواج + عمل فني + ميدان معركة From d62ab66fa9c440445a173818130eb27fbccb89f5 Mon Sep 17 00:00:00 2001 From: Zahnstocher Date: Fri, 29 Sep 2017 08:36:44 +0000 Subject: [PATCH 38/41] Translated using Weblate (German) Currently translated at 100.0% (3176 of 3176 strings) --- OsmAnd/res/values-de/phrases.xml | 38 ++++++++++++++++---------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/OsmAnd/res/values-de/phrases.xml b/OsmAnd/res/values-de/phrases.xml index 8ef4336b4b..487dbb7bfe 100644 --- a/OsmAnd/res/values-de/phrases.xml +++ b/OsmAnd/res/values-de/phrases.xml @@ -198,7 +198,7 @@ Fast Food Fährhafen Feuerlöscher - Brandschutzklappe + Brandpatsche Löschschlauch Hydrant Feuerwehr @@ -433,12 +433,12 @@ Fischgeschäft Ankerplatz Ankerplatz - Signalfeuer (Schifffahrtszeichen) + Bake (Seezeichen) Untiefenbake (Kardinal) Fahrrinnenbake (Lateral) Mitte-Fahrwasser-Bake Sonderzeichen-Bake - Anlegestelle + Landesteg Seezeichenbrücke Seezeichengebäude Untiefentonne (Kardinal) @@ -647,7 +647,7 @@ Wikipedia Benutzerdefiniert - Luftverkehr + Seilbahntransport Weinhandlung Medizinische Versorgung @@ -1567,7 +1567,7 @@ Iglesia ni Cristo Mennoniten Quäker - Vereinigung „Assemblies of God” + Assemblies of God Bekenntnisfrei Nazaräer Vereinigte Methodisten @@ -2550,7 +2550,7 @@ Offizieller Name Seezeichen Deich - Delphin + Dalbe Wegweiser: Forstabteilung Wegweiser: Forstparzelle @@ -2964,14 +2964,14 @@ Sonnenuhr - Werbeträger: Mast - Werbeträger: Wand - Werbeträger: Baum - Werbeträger: Sockel - Werbeträger: Boden - Werbeträger: Decke - Werbeträger: Dach - Werbeträger: Turm + Anbringung: Mast + Anbringung: Wand + Anbringung: Baum + Anbringung: Sockel + Anbringung: Boden + Anbringung: Decke + Anbringung: Dach + Anbringung: Turm Aquakultur Aquakultur: Garnelen @@ -2993,7 +2993,7 @@ Gewächshaus Ausgabe: Dampf - Werbeträger: hängend + Anbringung: hängend Generalkonsulat Honorarkonsulat Schwerkraft @@ -3001,10 +3001,10 @@ Ausgangsleistung: heißes Wasser Ausgangsleistung: Druckluft Ausgangsleistung: Biogas - Werbeträger: Plakatwand + Anbringung: Werbetafel Hochkommissar - Feuerwehrmann + Feuerwehrbetreiber Anzahl Wickeltische @@ -3093,7 +3093,7 @@ Fahrradwerkstatt Dienstleistung Selbstbedienung - Dosieren + Rezeptur Typ Bewertung in Sternen Konfession @@ -3268,7 +3268,7 @@ Esslokal Yakiniku Udon - Bierstube + Brasserie Yakitori Teriyaki From 7729bdf88f4dddd85974a9950c8f5db22a77cf64 Mon Sep 17 00:00:00 2001 From: Franco Date: Thu, 28 Sep 2017 21:50:19 +0000 Subject: [PATCH 39/41] Translated using Weblate (Spanish (American)) Currently translated at 100.0% (3176 of 3176 strings) --- OsmAnd/res/values-es-rUS/phrases.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/res/values-es-rUS/phrases.xml b/OsmAnd/res/values-es-rUS/phrases.xml index 11abc5162e..7208ec90e1 100644 --- a/OsmAnd/res/values-es-rUS/phrases.xml +++ b/OsmAnd/res/values-es-rUS/phrases.xml @@ -446,7 +446,7 @@ Fuente Ruinas históricas Piedra rúnica - Naufragio + Pecio/naufragio Barco histórico Mina histórica Monumento From a701ce468f9b8c99de63e1bb4c1b523605495e49 Mon Sep 17 00:00:00 2001 From: Franco Date: Thu, 28 Sep 2017 21:49:41 +0000 Subject: [PATCH 40/41] Translated using Weblate (Spanish (Argentina)) Currently translated at 100.0% (3176 of 3176 strings) --- OsmAnd/res/values-es-rAR/phrases.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/res/values-es-rAR/phrases.xml b/OsmAnd/res/values-es-rAR/phrases.xml index 91e0310cc4..89f75ad541 100644 --- a/OsmAnd/res/values-es-rAR/phrases.xml +++ b/OsmAnd/res/values-es-rAR/phrases.xml @@ -471,7 +471,7 @@ Fuente Ruinas históricas Piedra rúnica - Naufragio + Pecio/naufragio Barco histórico Mina histórica Monumento From f107de74847cd8b598e05621a81f7eaed7275a3e Mon Sep 17 00:00:00 2001 From: Ldm Public Date: Fri, 29 Sep 2017 17:15:42 +0000 Subject: [PATCH 41/41] Translated using Weblate (French) Currently translated at 100.0% (2448 of 2448 strings) --- OsmAnd/res/values-fr/strings.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/OsmAnd/res/values-fr/strings.xml b/OsmAnd/res/values-fr/strings.xml index 09b270def6..d728132ac2 100644 --- a/OsmAnd/res/values-fr/strings.xml +++ b/OsmAnd/res/values-fr/strings.xml @@ -2952,4 +2952,11 @@ représentant la zone : %1$s x %2$s Enregistrer comme trace Déplacer vers l\'historique Le groupe sera supprimé au prochain démarrage + Marques + Format des coordonnées + Utiliser le clavier système + Définissez le format des coordonnées avec de démarrer. Vous pourrez les modifier plus tard dans les Options. + Saisie rapide des coordonnées + Éviter les routes sur glace, les fjords + Éviter les routes sur glace et les fjords