From 847f99fbd52be54f6dc4d6579aeafeb2bedc8758 Mon Sep 17 00:00:00 2001 From: Skalii Date: Wed, 13 Jan 2021 16:07:28 +0200 Subject: [PATCH 01/11] "URL with all parameters will ..." is now above url --- .../osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java b/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java index 59df4ef698..e6ca05991b 100644 --- a/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java +++ b/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java @@ -284,7 +284,7 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { return false; } }); - exampleCard.setFieldBoxHelperText(getString(R.string.online_routing_example_hint)); + exampleCard.setFieldBoxLabelText(getString(R.string.online_routing_example_hint)); exampleCard.setButton(getString(R.string.test_route_calculation), new View.OnClickListener() { @Override public void onClick(View v) { From 5a8a39ecf51bc8e93f70b385b296e0b8af051e1f Mon Sep 17 00:00:00 2001 From: Skalii Date: Wed, 13 Jan 2021 16:59:50 +0200 Subject: [PATCH 02/11] fix previous; "Vehicle" block, descrease padding below scroll buttons --- .../net/osmand/plus/onlinerouting/OnlineRoutingCard.java | 6 ++++++ .../plus/onlinerouting/OnlineRoutingEngineFragment.java | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingCard.java b/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingCard.java index 1b9e7f3b29..6c49386c47 100644 --- a/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingCard.java +++ b/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingCard.java @@ -5,6 +5,7 @@ import android.text.TextWatcher; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnFocusChangeListener; +import android.view.ViewGroup; import android.widget.EditText; import android.widget.TextView; @@ -127,6 +128,11 @@ public class OnlineRoutingCard extends BaseCard { rvSelectionMenu.setAdapter(adapter); } + public void removeBottomMarginSelectionMenu() { + ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) rvSelectionMenu.getLayoutParams(); + params.bottomMargin = 0; + } + public void setDescription(@NonNull String description) { showElements(tvDescription); tvDescription.setText(description); diff --git a/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java b/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java index e6ca05991b..b70fcc89a3 100644 --- a/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java +++ b/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java @@ -230,6 +230,7 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { return false; } }); + vehicleCard.removeBottomMarginSelectionMenu(); vehicleCard.setFieldBoxLabelText(getString(R.string.shared_string_custom)); vehicleCard.setOnTextChangedListener(new OnTextChangedListener() { @Override @@ -284,7 +285,8 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { return false; } }); - exampleCard.setFieldBoxLabelText(getString(R.string.online_routing_example_hint)); + exampleCard.setDescription(getString(R.string.online_routing_example_hint)); + exampleCard.showFieldBox(); exampleCard.setButton(getString(R.string.test_route_calculation), new View.OnClickListener() { @Override public void onClick(View v) { From 4c4a439adcba078ca445fefc12a32ccddd0801a2 Mon Sep 17 00:00:00 2001 From: Skalii Date: Thu, 14 Jan 2021 12:30:49 +0200 Subject: [PATCH 03/11] Close keyboard on scrolling --- .../OnlineRoutingEngineFragment.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java b/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java index b70fcc89a3..541803dbfd 100644 --- a/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java +++ b/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java @@ -7,6 +7,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; +import android.view.ViewTreeObserver; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.TextView; @@ -61,12 +62,14 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { private View view; private ViewGroup segmentsContainer; + private ViewGroup scrollView; private OnlineRoutingCard nameCard; private OnlineRoutingCard typeCard; private OnlineRoutingCard vehicleCard; private OnlineRoutingCard apiKeyCard; private OnlineRoutingCard exampleCard; private View testResultsContainer; + private ViewTreeObserver.OnScrollChangedListener onScroll; private ApplicationMode appMode; @@ -137,6 +140,20 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { view = getInflater().inflate( R.layout.online_routing_engine_fragment, container, false); segmentsContainer = (ViewGroup) view.findViewById(R.id.segments_container); + scrollView = (ViewGroup) segmentsContainer.getParent(); + onScroll = new ViewTreeObserver.OnScrollChangedListener() { + int pastY = 0; + @Override + public void onScrollChanged() { + int y = scrollView.getScrollY(); + if (pastY != y) { + pastY = y; + View vieww = view.findFocus(); + AndroidUtils.hideSoftKeyboard(requireActivity(), vieww); + } + } + }; + scrollView.getViewTreeObserver().addOnScrollChangedListener(onScroll); if (Build.VERSION.SDK_INT >= 21) { AndroidUtils.addStatusBarPadding21v(getContext(), view); } @@ -156,6 +173,12 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { return view; } + @Override + public void onDestroyView() { + super.onDestroyView(); + scrollView.getViewTreeObserver().removeOnScrollChangedListener(onScroll); + } + private void setupNameCard() { nameCard = new OnlineRoutingCard(mapActivity, isNightMode()); nameCard.build(mapActivity); From ebbcb1778ff82127123f4409741ba4477a2cba03 Mon Sep 17 00:00:00 2001 From: Skalii Date: Thu, 14 Jan 2021 13:13:55 +0200 Subject: [PATCH 04/11] fix descrease padding below scroll buttons in "Vehicle" block --- .../net/osmand/plus/onlinerouting/OnlineRoutingCard.java | 4 ++-- .../plus/onlinerouting/OnlineRoutingEngineFragment.java | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingCard.java b/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingCard.java index 6c49386c47..b9509fc026 100644 --- a/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingCard.java +++ b/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingCard.java @@ -128,9 +128,9 @@ public class OnlineRoutingCard extends BaseCard { rvSelectionMenu.setAdapter(adapter); } - public void removeBottomMarginSelectionMenu() { + public void updateBottomMarginSelectionMenu(int bottomMargin) { ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) rvSelectionMenu.getLayoutParams(); - params.bottomMargin = 0; + params.bottomMargin = bottomMargin; } public void setDescription(@NonNull String description) { diff --git a/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java b/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java index 541803dbfd..457fc2ee17 100644 --- a/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java +++ b/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java @@ -248,12 +248,17 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { if (engine.vehicleType != vehicle) { engine.vehicleType = vehicle; updateCardViews(nameCard, vehicleCard, exampleCard); + if (vehicle == VehicleType.CUSTOM) { + vehicleCard.updateBottomMarginSelectionMenu((int) getResources().getDimension(R.dimen.content_padding)); + } else { + vehicleCard.updateBottomMarginSelectionMenu(0); + } return true; } return false; } }); - vehicleCard.removeBottomMarginSelectionMenu(); + vehicleCard.updateBottomMarginSelectionMenu(0); vehicleCard.setFieldBoxLabelText(getString(R.string.shared_string_custom)); vehicleCard.setOnTextChangedListener(new OnTextChangedListener() { @Override From d75134129d4d38c0951a2e7ac558b668b1c3df49 Mon Sep 17 00:00:00 2001 From: Skalii Date: Thu, 14 Jan 2021 18:14:45 +0200 Subject: [PATCH 05/11] Textfields, use profile color as active color; Dismiss bottom sheet --- .../plus/onlinerouting/OnlineRoutingCard.java | 4 + .../OnlineRoutingEngineFragment.java | 80 +++++++++++++++++-- 2 files changed, 79 insertions(+), 5 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingCard.java b/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingCard.java index b9509fc026..0ac677a4ae 100644 --- a/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingCard.java +++ b/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingCard.java @@ -68,6 +68,10 @@ public class OnlineRoutingCard extends BaseCard { bottomDivider = view.findViewById(R.id.bottom_divider); button = view.findViewById(R.id.button); + textFieldBoxes.setPrimaryColor(nightMode + ? view.getContext().getResources().getColor(R.color.active_color_primary_dark) + : view.getContext().getResources().getColor(R.color.active_color_primary_light)); + editText.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { diff --git a/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java b/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java index 457fc2ee17..c34d6541a1 100644 --- a/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java +++ b/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java @@ -1,6 +1,8 @@ package net.osmand.plus.onlinerouting; +import android.app.Activity; import android.content.Context; +import android.content.DialogInterface; import android.os.Build; import android.os.Bundle; import android.view.LayoutInflater; @@ -12,8 +14,10 @@ import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.TextView; +import androidx.activity.OnBackPressedCallback; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.appcompat.app.AlertDialog; import androidx.appcompat.widget.Toolbar; import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentManager; @@ -74,6 +78,7 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { private ApplicationMode appMode; private OnlineRoutingEngineObject engine; + private OnlineRoutingEngineObject initEngine; private ExampleLocation selectedLocation; private String editedEngineKey; @@ -125,11 +130,20 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { mapActivity = getMapActivity(); helper = app.getOnlineRoutingHelper(); engine = new OnlineRoutingEngineObject(); + initEngine = new OnlineRoutingEngineObject(); if (savedInstanceState != null) { restoreState(savedInstanceState); } else { initState(); } + requireMyActivity().getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) { + public void handleOnBackPressed() { + MapActivity mapActivity = getMapActivity(); + if (mapActivity != null) { + showExitDialog(); + } + } + }); } @Nullable @@ -143,13 +157,14 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { scrollView = (ViewGroup) segmentsContainer.getParent(); onScroll = new ViewTreeObserver.OnScrollChangedListener() { int pastY = 0; + @Override public void onScrollChanged() { int y = scrollView.getScrollY(); if (pastY != y) { pastY = y; - View vieww = view.findFocus(); - AndroidUtils.hideSoftKeyboard(requireActivity(), vieww); + View focus = view.findFocus(); + AndroidUtils.hideSoftKeyboard(requireActivity(), focus); } } }; @@ -166,6 +181,7 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { setupExampleCard(); setupResultsContainer(); addSpaceSegment(); + engine.cloneIn(initEngine); setupButtons(); @@ -345,7 +361,7 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { navigationIcon.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { - dismiss(); + showExitDialog(); } }); TextView title = toolbar.findViewById(R.id.toolbar_title); @@ -415,7 +431,7 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { cancelButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - dismiss(); + showExitDialog(); } }); @@ -571,10 +587,41 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { private void dismiss() { FragmentActivity activity = getActivity(); if (activity != null) { - activity.onBackPressed(); + FragmentManager fragmentManager = activity.getSupportFragmentManager(); + if (!fragmentManager.isStateSaved()) { + fragmentManager.popBackStack(); + } } } + public void showExitDialog() { + View focus = view.findFocus(); + AndroidUtils.hideSoftKeyboard(requireMyActivity(), focus); + + if (!engine.equals(initEngine)) { + AlertDialog.Builder dismissDialog = createWarningDialog(getActivity(), + R.string.shared_string_dismiss, R.string.exit_without_saving, R.string.shared_string_cancel); + dismissDialog.setPositiveButton(R.string.shared_string_exit, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + dismiss(); + } + }); + dismissDialog.show(); + } else { + dismiss(); + } + } + + private AlertDialog.Builder createWarningDialog(Activity activity, int title, int message, int negButton) { + Context themedContext = UiUtilities.getThemedContext(activity, isNightMode()); + AlertDialog.Builder warningDialog = new AlertDialog.Builder(themedContext); + warningDialog.setTitle(getString(title)); + warningDialog.setMessage(getString(message)); + warningDialog.setNegativeButton(negButton, null); + return warningDialog; + } + private boolean isNightMode() { return !app.getSettings().isLightContentForMode(appMode); } @@ -635,5 +682,28 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { } return customServerUrl; } + + public void cloneIn(OnlineRoutingEngineObject clone) { + clone.customName = customName; + clone.type = type; + clone.customServerUrl = customServerUrl; + clone.vehicleType = vehicleType; + clone.customVehicleKey = customVehicleKey; + clone.apiKey = apiKey; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + + OnlineRoutingEngineObject engine = (OnlineRoutingEngineObject) obj; + if (customName != engine.customName) return false; + if (type != engine.type) return false; + if (customServerUrl != engine.customServerUrl) return false; + if (vehicleType != engine.vehicleType) return false; + if (customVehicleKey != engine.customVehicleKey) return false; + return apiKey == engine.apiKey; + } } } From f0d54c62178765ba7f2e651a57e1364863a884d5 Mon Sep 17 00:00:00 2001 From: jensMF Date: Sat, 16 Jan 2021 01:15:49 +0100 Subject: [PATCH 06/11] fixed xml schema by changing the order of wpt rte and trk and adding the osmand namespace to the route and types extensions --- .../main/java/net/osmand/GPXUtilities.java | 39 +++++++++---------- .../net/osmand/binary/StringBundleWriter.java | 2 +- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/GPXUtilities.java b/OsmAnd-java/src/main/java/net/osmand/GPXUtilities.java index bee9fa2b19..ede3b6f8cf 100644 --- a/OsmAnd-java/src/main/java/net/osmand/GPXUtilities.java +++ b/OsmAnd-java/src/main/java/net/osmand/GPXUtilities.java @@ -1822,6 +1822,25 @@ public class GPXUtilities { } serializer.endTag(null, "metadata"); + for (WptPt l : file.points) { + serializer.startTag(null, "wpt"); //$NON-NLS-1$ + writeWpt(format, serializer, l); + serializer.endTag(null, "wpt"); //$NON-NLS-1$ + } + + for (Route track : file.routes) { + serializer.startTag(null, "rte"); //$NON-NLS-1$ + writeNotNullText(serializer, "name", track.name); + writeNotNullText(serializer, "desc", track.desc); + + for (WptPt p : track.points) { + serializer.startTag(null, "rtept"); //$NON-NLS-1$ + writeWpt(format, serializer, p); + serializer.endTag(null, "rtept"); //$NON-NLS-1$ + } + writeExtensions(serializer, track); + serializer.endTag(null, "rte"); //$NON-NLS-1$ + } for (Track track : file.tracks) { if (!track.generalTrack) { @@ -1844,26 +1863,6 @@ public class GPXUtilities { } } - for (Route track : file.routes) { - serializer.startTag(null, "rte"); //$NON-NLS-1$ - writeNotNullText(serializer, "name", track.name); - writeNotNullText(serializer, "desc", track.desc); - - for (WptPt p : track.points) { - serializer.startTag(null, "rtept"); //$NON-NLS-1$ - writeWpt(format, serializer, p); - serializer.endTag(null, "rtept"); //$NON-NLS-1$ - } - writeExtensions(serializer, track); - serializer.endTag(null, "rte"); //$NON-NLS-1$ - } - - for (WptPt l : file.points) { - serializer.startTag(null, "wpt"); //$NON-NLS-1$ - writeWpt(format, serializer, l); - serializer.endTag(null, "wpt"); //$NON-NLS-1$ - } - writeExtensions(serializer, file); serializer.endTag(null, "gpx"); //$NON-NLS-1$ diff --git a/OsmAnd-java/src/main/java/net/osmand/binary/StringBundleWriter.java b/OsmAnd-java/src/main/java/net/osmand/binary/StringBundleWriter.java index 2f607aef3a..d3c151c12a 100644 --- a/OsmAnd-java/src/main/java/net/osmand/binary/StringBundleWriter.java +++ b/OsmAnd-java/src/main/java/net/osmand/binary/StringBundleWriter.java @@ -20,7 +20,7 @@ public abstract class StringBundleWriter { public void writeBundle() { for (Entry> entry : bundle.getMap().entrySet()) { - writeItem(entry.getKey(), entry.getValue()); + writeItem("osmand:" + entry.getKey(), entry.getValue()); } } } From f24ad18e5afa11d57f8b2c1dc82bd8767551aa73 Mon Sep 17 00:00:00 2001 From: Skalii Date: Sun, 17 Jan 2021 14:36:16 +0200 Subject: [PATCH 07/11] Show "Save/Cancel" buttons above keyboards; fix close keyboard on scrolling --- .../OnlineRoutingEngineFragment.java | 99 +++++++++++++++---- 1 file changed, 80 insertions(+), 19 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java b/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java index c34d6541a1..d0b8a4db7b 100644 --- a/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java +++ b/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java @@ -1,17 +1,21 @@ package net.osmand.plus.onlinerouting; +import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; import android.content.DialogInterface; +import android.graphics.Rect; import android.os.Build; import android.os.Bundle; import android.view.LayoutInflater; +import android.view.MotionEvent; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.widget.FrameLayout; import android.widget.ImageView; +import android.widget.ScrollView; import android.widget.TextView; import androidx.activity.OnBackPressedCallback; @@ -66,14 +70,15 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { private View view; private ViewGroup segmentsContainer; - private ViewGroup scrollView; private OnlineRoutingCard nameCard; private OnlineRoutingCard typeCard; private OnlineRoutingCard vehicleCard; private OnlineRoutingCard apiKeyCard; private OnlineRoutingCard exampleCard; private View testResultsContainer; - private ViewTreeObserver.OnScrollChangedListener onScroll; + private ScrollView scrollView; + private ViewTreeObserver.OnGlobalLayoutListener onGlobalLayout; + private boolean isKeyboardShown = false; private ApplicationMode appMode; @@ -146,6 +151,7 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { }); } + @SuppressLint("ClickableViewAccessibility") @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @@ -154,21 +160,7 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { view = getInflater().inflate( R.layout.online_routing_engine_fragment, container, false); segmentsContainer = (ViewGroup) view.findViewById(R.id.segments_container); - scrollView = (ViewGroup) segmentsContainer.getParent(); - onScroll = new ViewTreeObserver.OnScrollChangedListener() { - int pastY = 0; - - @Override - public void onScrollChanged() { - int y = scrollView.getScrollY(); - if (pastY != y) { - pastY = y; - View focus = view.findFocus(); - AndroidUtils.hideSoftKeyboard(requireActivity(), focus); - } - } - }; - scrollView.getViewTreeObserver().addOnScrollChangedListener(onScroll); + scrollView = (ScrollView) segmentsContainer.getParent(); if (Build.VERSION.SDK_INT >= 21) { AndroidUtils.addStatusBarPadding21v(getContext(), view); } @@ -186,13 +178,82 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { setupButtons(); updateCardViews(nameCard, typeCard, vehicleCard, exampleCard); - return view; + + scrollView.setOnTouchListener(new View.OnTouchListener() { + int scrollViewY = 0; + @Override + public boolean onTouch(View v, MotionEvent event) { + int y = scrollView.getScrollY(); + if (isKeyboardShown && scrollViewY != y) { + scrollViewY = y; + View focus = getActivity().getCurrentFocus(); + if (focus != null) { + AndroidUtils.hideSoftKeyboard(requireActivity(), focus); + focus.clearFocus(); + } + } + return false; + } + }); + + onGlobalLayout = new ViewTreeObserver.OnGlobalLayoutListener() { + private int layoutHeightPrevious; + private int layoutHeightMin; + + @Override + public void onGlobalLayout() { + + final ViewTreeObserver.OnGlobalLayoutListener listener = this; + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { + view.getViewTreeObserver().removeOnGlobalLayoutListener(this); + } else { + view.getViewTreeObserver().removeGlobalOnLayoutListener(this); + } + + Rect visibleDisplayFrame = new Rect(); + view.getWindowVisibleDisplayFrame(visibleDisplayFrame); + int layoutHeight = visibleDisplayFrame.bottom; + + if (layoutHeight < layoutHeightPrevious) { + isKeyboardShown = true; + layoutHeightMin = layoutHeight; + } else { + isKeyboardShown = layoutHeight == layoutHeightMin; + } + + if (layoutHeight != layoutHeightPrevious) { + FrameLayout.LayoutParams rootViewLayout = (FrameLayout.LayoutParams) view.getLayoutParams(); + rootViewLayout.height = layoutHeight; + view.requestLayout(); + layoutHeightPrevious = layoutHeight; + } + + view.post(new Runnable() { + @Override + public void run() { + view.getViewTreeObserver().addOnGlobalLayoutListener(listener); + } + }); + + } + }; + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { + view.getViewTreeObserver().addOnGlobalLayoutListener(onGlobalLayout); + } + + return view; } @Override public void onDestroyView() { super.onDestroyView(); - scrollView.getViewTreeObserver().removeOnScrollChangedListener(onScroll); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { + view.getViewTreeObserver().removeOnGlobalLayoutListener(onGlobalLayout); + } else { + view.getViewTreeObserver().removeGlobalOnLayoutListener(onGlobalLayout); + } } private void setupNameCard() { From 6292ac5b8509c4c1f3e82668dfc5add9a21167ad Mon Sep 17 00:00:00 2001 From: Skalii Date: Mon, 18 Jan 2021 04:38:12 +0200 Subject: [PATCH 08/11] fix used profile color as active color in Textfields; fix equals() in OnlineRoutingEngineObject; fix save\restore initEngine after screen rotation; fix descrease padding below scroll buttons in "Vehicle" block if VehicleType.CUSTOM was saved; --- .../plus/onlinerouting/OnlineRoutingCard.java | 11 ++-- .../OnlineRoutingEngineFragment.java | 54 +++++++++++++------ 2 files changed, 44 insertions(+), 21 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingCard.java b/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingCard.java index 0ac677a4ae..888216abb3 100644 --- a/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingCard.java +++ b/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingCard.java @@ -10,6 +10,7 @@ import android.widget.EditText; import android.widget.TextView; import androidx.annotation.NonNull; +import androidx.core.content.ContextCompat; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -24,6 +25,7 @@ import net.osmand.plus.mapcontextmenu.other.HorizontalSelectionAdapter; import net.osmand.plus.mapcontextmenu.other.HorizontalSelectionAdapter.HorizontalSelectionAdapterListener; import net.osmand.plus.mapcontextmenu.other.HorizontalSelectionAdapter.HorizontalSelectionItem; import net.osmand.plus.routepreparationmenu.cards.BaseCard; +import net.osmand.plus.settings.backend.ApplicationMode; import net.osmand.plus.widgets.OsmandTextFieldBoxes; import java.util.List; @@ -43,10 +45,12 @@ public class OnlineRoutingCard extends BaseCard { private View bottomDivider; private View button; private OnTextChangedListener onTextChangedListener; + private ApplicationMode appMode; - public OnlineRoutingCard(@NonNull MapActivity mapActivity, boolean nightMode) { + public OnlineRoutingCard(@NonNull MapActivity mapActivity, boolean nightMode, ApplicationMode appMode) { super(mapActivity); this.nightMode = nightMode; + this.appMode = appMode; } @Override @@ -68,9 +72,8 @@ public class OnlineRoutingCard extends BaseCard { bottomDivider = view.findViewById(R.id.bottom_divider); button = view.findViewById(R.id.button); - textFieldBoxes.setPrimaryColor(nightMode - ? view.getContext().getResources().getColor(R.color.active_color_primary_dark) - : view.getContext().getResources().getColor(R.color.active_color_primary_light)); + int activeColor = ContextCompat.getColor(app, appMode.getIconColorInfo().getColor(nightMode)); + textFieldBoxes.setPrimaryColor(activeColor); editText.addTextChangedListener(new TextWatcher() { @Override diff --git a/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java b/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java index d0b8a4db7b..8c457ebbac 100644 --- a/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java +++ b/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java @@ -60,6 +60,12 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { private static final String ENGINE_VEHICLE_TYPE_KEY = "engine_vehicle_type"; private static final String ENGINE_CUSTOM_VEHICLE_KEY = "engine_custom_vehicle"; private static final String ENGINE_API_KEY_KEY = "engine_api_key"; + private static final String INIT_ENGINE_NAME_KEY = "init_engine_name"; + private static final String INIT_ENGINE_SERVER_KEY = "init_engine_server"; + private static final String INIT_ENGINE_SERVER_URL_KEY = "init_engine_server_url"; + private static final String INIT_ENGINE_VEHICLE_TYPE_KEY = "init_engine_vehicle_type"; + private static final String INIT_ENGINE_CUSTOM_VEHICLE_KEY = "init_engine_custom_vehicle"; + private static final String INIT_ENGINE_API_KEY_KEY = "init_engine_api_key"; private static final String EXAMPLE_LOCATION_KEY = "example_location"; private static final String APP_MODE_KEY = "app_mode"; private static final String EDITED_ENGINE_KEY = "edited_engine_key"; @@ -173,7 +179,6 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { setupExampleCard(); setupResultsContainer(); addSpaceSegment(); - engine.cloneIn(initEngine); setupButtons(); @@ -257,7 +262,7 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { } private void setupNameCard() { - nameCard = new OnlineRoutingCard(mapActivity, isNightMode()); + nameCard = new OnlineRoutingCard(mapActivity, isNightMode(), appMode); nameCard.build(mapActivity); nameCard.setDescription(getString(R.string.select_nav_profile_dialog_message)); nameCard.setEditedText(engine.getName(app)); @@ -275,7 +280,7 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { } private void setupTypeCard() { - typeCard = new OnlineRoutingCard(mapActivity, isNightMode()); + typeCard = new OnlineRoutingCard(mapActivity, isNightMode(), appMode); typeCard.build(mapActivity); typeCard.setHeaderTitle(getString(R.string.shared_string_type)); List serverItems = new ArrayList<>(); @@ -310,7 +315,7 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { } private void setupVehicleCard() { - vehicleCard = new OnlineRoutingCard(mapActivity, isNightMode()); + vehicleCard = new OnlineRoutingCard(mapActivity, isNightMode(), appMode); vehicleCard.build(mapActivity); vehicleCard.setHeaderTitle(getString(R.string.shared_string_vehicle)); List vehicleItems = new ArrayList<>(); @@ -322,20 +327,20 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { @Override public boolean processResult(HorizontalSelectionItem result) { VehicleType vehicle = (VehicleType) result.getObject(); + vehicleCard.updateBottomMarginSelectionMenu(vehicle != VehicleType.CUSTOM ? 0 + : getResources().getDimensionPixelSize(R.dimen.content_padding) + ); if (engine.vehicleType != vehicle) { engine.vehicleType = vehicle; updateCardViews(nameCard, vehicleCard, exampleCard); - if (vehicle == VehicleType.CUSTOM) { - vehicleCard.updateBottomMarginSelectionMenu((int) getResources().getDimension(R.dimen.content_padding)); - } else { - vehicleCard.updateBottomMarginSelectionMenu(0); - } return true; } return false; } }); - vehicleCard.updateBottomMarginSelectionMenu(0); + vehicleCard.updateBottomMarginSelectionMenu(engine.vehicleType != VehicleType.CUSTOM ? 0 + : getResources().getDimensionPixelSize(R.dimen.content_padding) + ); vehicleCard.setFieldBoxLabelText(getString(R.string.shared_string_custom)); vehicleCard.setOnTextChangedListener(new OnTextChangedListener() { @Override @@ -353,7 +358,7 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { } private void setupApiKeyCard() { - apiKeyCard = new OnlineRoutingCard(mapActivity, isNightMode()); + apiKeyCard = new OnlineRoutingCard(mapActivity, isNightMode(), appMode); apiKeyCard.build(mapActivity); apiKeyCard.setHeaderTitle(getString(R.string.shared_string_api_key)); apiKeyCard.setFieldBoxLabelText(getString(R.string.keep_it_empty_if_not)); @@ -370,7 +375,7 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { } private void setupExampleCard() { - exampleCard = new OnlineRoutingCard(mapActivity, isNightMode()); + exampleCard = new OnlineRoutingCard(mapActivity, isNightMode(), appMode); exampleCard.build(mapActivity); exampleCard.setHeaderTitle(getString(R.string.shared_string_example)); List locationItems = new ArrayList<>(); @@ -603,6 +608,12 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { outState.putString(ENGINE_VEHICLE_TYPE_KEY, engine.vehicleType.name()); outState.putString(ENGINE_CUSTOM_VEHICLE_KEY, engine.customVehicleKey); outState.putString(ENGINE_API_KEY_KEY, engine.apiKey); + outState.putString(INIT_ENGINE_NAME_KEY, initEngine.customName); + outState.putString(INIT_ENGINE_SERVER_KEY, initEngine.type.name()); + outState.putString(INIT_ENGINE_SERVER_URL_KEY, initEngine.customServerUrl); + outState.putString(INIT_ENGINE_VEHICLE_TYPE_KEY, initEngine.vehicleType.name()); + outState.putString(INIT_ENGINE_CUSTOM_VEHICLE_KEY, initEngine.customVehicleKey); + outState.putString(INIT_ENGINE_API_KEY_KEY, initEngine.apiKey); outState.putString(EXAMPLE_LOCATION_KEY, selectedLocation.name()); if (appMode != null) { outState.putString(APP_MODE_KEY, appMode.getStringKey()); @@ -617,6 +628,12 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { engine.vehicleType = VehicleType.valueOf(savedState.getString(ENGINE_VEHICLE_TYPE_KEY)); engine.customVehicleKey = savedState.getString(ENGINE_CUSTOM_VEHICLE_KEY); engine.apiKey = savedState.getString(ENGINE_API_KEY_KEY); + initEngine.customName = savedState.getString(INIT_ENGINE_NAME_KEY); + initEngine.type = EngineType.valueOf(savedState.getString(INIT_ENGINE_SERVER_KEY)); + initEngine.customServerUrl = savedState.getString(INIT_ENGINE_SERVER_URL_KEY); + initEngine.vehicleType = VehicleType.valueOf(savedState.getString(INIT_ENGINE_VEHICLE_TYPE_KEY)); + initEngine.customVehicleKey = savedState.getString(INIT_ENGINE_CUSTOM_VEHICLE_KEY); + initEngine.apiKey = savedState.getString(INIT_ENGINE_API_KEY_KEY); selectedLocation = ExampleLocation.valueOf(savedState.getString(EXAMPLE_LOCATION_KEY)); appMode = ApplicationMode.valueOfStringKey(savedState.getString(APP_MODE_KEY), null); editedEngineKey = savedState.getString(EDITED_ENGINE_KEY); @@ -643,6 +660,7 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { engine.apiKey = editedEngine.getParameter(EngineParameter.API_KEY); } } + engine.cloneIn(initEngine); } private void dismiss() { @@ -658,7 +676,9 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { public void showExitDialog() { View focus = view.findFocus(); AndroidUtils.hideSoftKeyboard(requireMyActivity(), focus); - + if (engine.customName != null && initEngine.customName == null) { + initEngine.customName = initEngine.getName(app); + } if (!engine.equals(initEngine)) { AlertDialog.Builder dismissDialog = createWarningDialog(getActivity(), R.string.shared_string_dismiss, R.string.exit_without_saving, R.string.shared_string_cancel); @@ -759,12 +779,12 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { if (obj == null || getClass() != obj.getClass()) return false; OnlineRoutingEngineObject engine = (OnlineRoutingEngineObject) obj; - if (customName != engine.customName) return false; + if (!Algorithms.stringsEqual(customName, engine.customName)) return false; if (type != engine.type) return false; - if (customServerUrl != engine.customServerUrl) return false; + if (!Algorithms.stringsEqual(getBaseUrl(), engine.getBaseUrl())) return false; if (vehicleType != engine.vehicleType) return false; - if (customVehicleKey != engine.customVehicleKey) return false; - return apiKey == engine.apiKey; + if (!Algorithms.stringsEqual(getVehicleKey(), engine.getVehicleKey())) return false; + return Algorithms.isEmpty(apiKey) ? Algorithms.isEmpty(engine.apiKey) : Algorithms.stringsEqual(apiKey, engine.apiKey); } } } From 47ef53fad7897250d2a174c5af500978c2c6d2dc Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Mon, 18 Jan 2021 07:48:37 +0200 Subject: [PATCH 09/11] Minor fixes --- .../OnlineRoutingEngineFragment.java | 114 +++++++++--------- 1 file changed, 54 insertions(+), 60 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java b/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java index 8c457ebbac..997b7fb34c 100644 --- a/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java +++ b/OsmAnd/src/net/osmand/plus/onlinerouting/OnlineRoutingEngineFragment.java @@ -13,6 +13,7 @@ import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.ViewTreeObserver; +import android.view.ViewTreeObserver.OnGlobalLayoutListener; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.ScrollView; @@ -83,7 +84,7 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { private OnlineRoutingCard exampleCard; private View testResultsContainer; private ScrollView scrollView; - private ViewTreeObserver.OnGlobalLayoutListener onGlobalLayout; + private OnGlobalLayoutListener onGlobalLayout; private boolean isKeyboardShown = false; private ApplicationMode appMode; @@ -161,8 +162,8 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, - @Nullable ViewGroup container, - @Nullable Bundle savedInstanceState) { + @Nullable ViewGroup container, + @Nullable Bundle savedInstanceState) { view = getInflater().inflate( R.layout.online_routing_engine_fragment, container, false); segmentsContainer = (ViewGroup) view.findViewById(R.id.segments_container); @@ -186,14 +187,15 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { scrollView.setOnTouchListener(new View.OnTouchListener() { int scrollViewY = 0; + @Override public boolean onTouch(View v, MotionEvent event) { int y = scrollView.getScrollY(); if (isKeyboardShown && scrollViewY != y) { scrollViewY = y; - View focus = getActivity().getCurrentFocus(); + View focus = mapActivity.getCurrentFocus(); if (focus != null) { - AndroidUtils.hideSoftKeyboard(requireActivity(), focus); + AndroidUtils.hideSoftKeyboard(mapActivity, focus); focus.clearFocus(); } } @@ -206,59 +208,56 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { private int layoutHeightMin; @Override - public void onGlobalLayout() { + public void onGlobalLayout() { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { + view.getViewTreeObserver().removeOnGlobalLayoutListener(this); + } else { + view.getViewTreeObserver().removeGlobalOnLayoutListener(this); + } - final ViewTreeObserver.OnGlobalLayoutListener listener = this; + Rect visibleDisplayFrame = new Rect(); + view.getWindowVisibleDisplayFrame(visibleDisplayFrame); + int layoutHeight = visibleDisplayFrame.bottom; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { - view.getViewTreeObserver().removeOnGlobalLayoutListener(this); - } else { - view.getViewTreeObserver().removeGlobalOnLayoutListener(this); - } - - Rect visibleDisplayFrame = new Rect(); - view.getWindowVisibleDisplayFrame(visibleDisplayFrame); - int layoutHeight = visibleDisplayFrame.bottom; - - if (layoutHeight < layoutHeightPrevious) { + if (layoutHeight < layoutHeightPrevious) { isKeyboardShown = true; layoutHeightMin = layoutHeight; } else { - isKeyboardShown = layoutHeight == layoutHeightMin; + isKeyboardShown = layoutHeight == layoutHeightMin; } if (layoutHeight != layoutHeightPrevious) { - FrameLayout.LayoutParams rootViewLayout = (FrameLayout.LayoutParams) view.getLayoutParams(); - rootViewLayout.height = layoutHeight; - view.requestLayout(); - layoutHeightPrevious = layoutHeight; - } + FrameLayout.LayoutParams rootViewLayout = (FrameLayout.LayoutParams) view.getLayoutParams(); + rootViewLayout.height = layoutHeight; + view.requestLayout(); + layoutHeightPrevious = layoutHeight; + } - view.post(new Runnable() { - @Override - public void run() { - view.getViewTreeObserver().addOnGlobalLayoutListener(listener); - } - }); + view.post(new Runnable() { + @Override + public void run() { + view.getViewTreeObserver().addOnGlobalLayoutListener(onGlobalLayout); + } + }); - } - }; + } + }; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { - view.getViewTreeObserver().addOnGlobalLayoutListener(onGlobalLayout); - } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { + view.getViewTreeObserver().addOnGlobalLayoutListener(onGlobalLayout); + } - return view; + return view; } @Override public void onDestroyView() { super.onDestroyView(); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { - view.getViewTreeObserver().removeOnGlobalLayoutListener(onGlobalLayout); - } else { - view.getViewTreeObserver().removeGlobalOnLayoutListener(onGlobalLayout); - } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { + view.getViewTreeObserver().removeOnGlobalLayoutListener(onGlobalLayout); + } else { + view.getViewTreeObserver().removeGlobalOnLayoutListener(onGlobalLayout); + } } private void setupNameCard() { @@ -327,9 +326,6 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { @Override public boolean processResult(HorizontalSelectionItem result) { VehicleType vehicle = (VehicleType) result.getObject(); - vehicleCard.updateBottomMarginSelectionMenu(vehicle != VehicleType.CUSTOM ? 0 - : getResources().getDimensionPixelSize(R.dimen.content_padding) - ); if (engine.vehicleType != vehicle) { engine.vehicleType = vehicle; updateCardViews(nameCard, vehicleCard, exampleCard); @@ -338,9 +334,6 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { return false; } }); - vehicleCard.updateBottomMarginSelectionMenu(engine.vehicleType != VehicleType.CUSTOM ? 0 - : getResources().getDimensionPixelSize(R.dimen.content_padding) - ); vehicleCard.setFieldBoxLabelText(getString(R.string.shared_string_custom)); vehicleCard.setOnTextChangedListener(new OnTextChangedListener() { @Override @@ -482,7 +475,8 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { } else { vehicleCard.hideFieldBox(); } - + int contentPadding = getResources().getDimensionPixelSize(R.dimen.content_padding); + vehicleCard.updateBottomMarginSelectionMenu(engine.vehicleType != VehicleType.CUSTOM ? 0 : contentPadding); } else if (exampleCard.equals(card)) { exampleCard.setEditedText(getTestUrl()); } @@ -675,12 +669,12 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { public void showExitDialog() { View focus = view.findFocus(); - AndroidUtils.hideSoftKeyboard(requireMyActivity(), focus); + AndroidUtils.hideSoftKeyboard(mapActivity, focus); if (engine.customName != null && initEngine.customName == null) { initEngine.customName = initEngine.getName(app); } if (!engine.equals(initEngine)) { - AlertDialog.Builder dismissDialog = createWarningDialog(getActivity(), + AlertDialog.Builder dismissDialog = createWarningDialog(mapActivity, R.string.shared_string_dismiss, R.string.exit_without_saving, R.string.shared_string_cancel); dismissDialog.setPositiveButton(R.string.shared_string_exit, new DialogInterface.OnClickListener() { @Override @@ -694,14 +688,14 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { } } - private AlertDialog.Builder createWarningDialog(Activity activity, int title, int message, int negButton) { - Context themedContext = UiUtilities.getThemedContext(activity, isNightMode()); - AlertDialog.Builder warningDialog = new AlertDialog.Builder(themedContext); - warningDialog.setTitle(getString(title)); - warningDialog.setMessage(getString(message)); - warningDialog.setNegativeButton(negButton, null); - return warningDialog; - } + private AlertDialog.Builder createWarningDialog(Activity activity, int title, int message, int negButton) { + Context themedContext = UiUtilities.getThemedContext(activity, isNightMode()); + AlertDialog.Builder warningDialog = new AlertDialog.Builder(themedContext); + warningDialog.setTitle(getString(title)); + warningDialog.setMessage(getString(message)); + warningDialog.setNegativeButton(negButton, null); + return warningDialog; + } private boolean isNightMode() { return !app.getSettings().isLightContentForMode(appMode); @@ -722,8 +716,8 @@ public class OnlineRoutingEngineFragment extends BaseOsmAndFragment { } public static void showInstance(@NonNull FragmentActivity activity, - @NonNull ApplicationMode appMode, - String editedEngineKey) { + @NonNull ApplicationMode appMode, + String editedEngineKey) { FragmentManager fm = activity.getSupportFragmentManager(); if (!fm.isStateSaved() && fm.findFragmentByTag(OnlineRoutingEngineFragment.TAG) == null) { OnlineRoutingEngineFragment fragment = new OnlineRoutingEngineFragment(); From 8dceee3eb08ce279d0c508c4351e6a649f48845f Mon Sep 17 00:00:00 2001 From: max-klaus Date: Mon, 18 Jan 2021 09:47:08 +0300 Subject: [PATCH 10/11] Quick fix android-lib --- OsmAnd/build.gradle.lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/build.gradle.lib b/OsmAnd/build.gradle.lib index 6b0f4da990..1f731106fb 100644 --- a/OsmAnd/build.gradle.lib +++ b/OsmAnd/build.gradle.lib @@ -38,7 +38,7 @@ android { jni.srcDirs = [] jniLibs.srcDirs = ["libs"] aidl.srcDirs = ["src"] - java.srcDirs = ["src", "src-google"] + java.srcDirs = ["src", "src-gms", "src-google"] resources.srcDirs = ["src"] renderscript.srcDirs = ["src"] res.srcDirs = ["res"] From df264356c1a5b69ef458d48616e2e18f00acb2b0 Mon Sep 17 00:00:00 2001 From: max-klaus Date: Mon, 18 Jan 2021 09:51:39 +0300 Subject: [PATCH 11/11] Quick fix android-lib (added gms dependency) --- OsmAnd/build.gradle.lib | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OsmAnd/build.gradle.lib b/OsmAnd/build.gradle.lib index 1f731106fb..f4f9c019ed 100644 --- a/OsmAnd/build.gradle.lib +++ b/OsmAnd/build.gradle.lib @@ -409,6 +409,7 @@ dependencies { exclude group: "com.fasterxml.jackson.core" } implementation 'com.jaredrummler:colorpicker:1.1.0' - implementation 'org.bouncycastle:bcpkix-jdk15on:1.56' + + implementation 'com.google.android.gms:play-services-location:17.1.0' }