Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ endif()
set(OMIM_ROOT ${CMAKE_SOURCE_DIR})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${OMIM_ROOT}/cmake")

set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})

include(OmimPlatform)
include(OmimOptions)
include(OmimConfig)
Expand Down
5 changes: 3 additions & 2 deletions android/app/src/main/cpp/app/organicmaps/Framework.cpp

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[clang-format] reported by reviewdog 🐶

JNIEXPORT void JNICALL
Java_app_organicmaps_Framework_nativeAddRoutePoint(JNIEnv * env, jclass, jstring title,
jstring subtitle, jobject markType,
jint intermediateIndex,
jboolean isMyPosition,
jdouble lat, jdouble lon,
jboolean reorderIntermediatePoints)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can it help to remove unused parameters when formatting functions?

Original file line number Diff line number Diff line change
Expand Up @@ -1458,7 +1458,8 @@ Java_app_organicmaps_Framework_nativeAddRoutePoint(JNIEnv * env, jclass, jstring
jstring subtitle, jobject markType,
jint intermediateIndex,
jboolean isMyPosition,
jdouble lat, jdouble lon)
jdouble lat, jdouble lon,
jboolean reorderIntermediatePoints)
{
RouteMarkData data;
data.m_title = jni::ToNativeString(env, title);
Expand All @@ -1468,7 +1469,7 @@ Java_app_organicmaps_Framework_nativeAddRoutePoint(JNIEnv * env, jclass, jstring
data.m_isMyPosition = static_cast<bool>(isMyPosition);
data.m_position = m2::PointD(mercator::FromLatLon(lat, lon));

frm()->GetRoutingManager().AddRoutePoint(std::move(data));
frm()->GetRoutingManager().AddRoutePoint(std::move(data), reorderIntermediatePoints);
}

JNIEXPORT void JNICALL
Expand Down
10 changes: 8 additions & 2 deletions android/app/src/main/java/app/organicmaps/Framework.java
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,21 @@ public static Date getDataVersion()
public static native void nativeShowCountry(String countryId, boolean zoomToDownloadButton);

public static void addRoutePoint(RouteMarkData point)
{
addRoutePoint(point, true);
}

public static void addRoutePoint(RouteMarkData point, boolean reorderIntermediatePoints)
{
Framework.nativeAddRoutePoint(point.mTitle, point.mSubtitle, point.mPointType,
point.mIntermediateIndex, point.mIsMyPosition,
point.mLat, point.mLon);
point.mLat, point.mLon, reorderIntermediatePoints);
}

public static native void nativeAddRoutePoint(String title, String subtitle, @NonNull RouteMarkType markType,
int intermediateIndex, boolean isMyPosition,
double lat, double lon);
double lat, double lon,
boolean reorderIntermediatePoints);

public static native void nativeRemoveRoutePoints();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ public enum MetadataType
FMD_WEBSITE_MENU(46),
FMD_SELF_SERVICE(47),
FMD_OUTDOOR_SEATING(48),
FMD_NETWORK(49);
FMD_NETWORK(49),
FMD_MAX_POWER(50);
private final int mMetaType;

MetadataType(int metadataType)
Expand All @@ -76,7 +77,7 @@ public enum MetadataType
}

@NonNull
public static MetadataType fromInt(@IntRange(from = 1, to = 49) int metaType)
public static MetadataType fromInt(@IntRange(from = 1, to = 50) int metaType)
{
for (MetadataType type : values())
if (type.mMetaType == metaType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,42 +141,9 @@ else if (buttonId == R.id.btn__plan)
// Secondly, add the starting point.
Framework.addRoutePoint(newRoutePoints.get(0));

// And then, add all intermediate points.
// And then, add all intermediate points (with no reordering).
for (int pos = 1; pos < newRoutePoints.size() - 1; pos++)
Framework.addRoutePoint(newRoutePoints.get(pos));

// Intermediate route points are added sorted by distance.
// We have to make sure that they follow the requested order.
RouteMarkData[] finalRoutePoints = Framework.nativeGetRoutePoints();

for (int first = 1; first < newRoutePoints.size() - 1; first++)
{
int secondIndex = -1;

for (int second = first; second < newRoutePoints.size() - 1; second++)
{
if (finalRoutePoints[first].equals(newRoutePoints.get(second)))
{
secondIndex = second;
break;
}
}

if (secondIndex < 0)
{
// Something went bad. Intermediate point not found in the route points.
break;
}

if (first != secondIndex)
{
// Intermediate point needs to be moved.
Framework.nativeMoveRoutePoint(secondIndex, first);

// Refresh final route points.
finalRoutePoints = Framework.nativeGetRoutePoints();
}
}
Framework.addRoutePoint(newRoutePoints.get(pos), false);

// Launch route planning.
RoutingController.get().launchPlanning();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,8 @@ private static void addRoutePoint(@NonNull RouteMarkType type, @NonNull MapObjec
Framework.nativeAddRoutePoint(description.first /* title */, description.second /* subtitle */,
type, 0 /* intermediateIndex */,
point.isMyPosition(),
point.getLat(), point.getLon());
point.getLat(), point.getLon(),
true /* reorderIntermediatePoints */);
}

@NonNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ private void init3dModePrefsCallbacks()
pref.setOnPreferenceChangeListener((preference, newValue) -> {
Framework.Params3dMode current = new Framework.Params3dMode();
Framework.nativeGet3dMode(current);
Framework.nativeSet3dMode(current.enabled, (Boolean)newValue);
Framework.nativeSet3dMode(current.enabled, (Boolean) newValue);
return true;
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,19 @@ public void run()
// Cancel old checker
UiThread.cancelDelayedTasks(mAutoThemeChecker);

String theme;
if (navAuto || ThemeUtils.isAutoTheme(mContext))
{
UiThread.runLater(mAutoThemeChecker, CHECK_INTERVAL_MS);
setThemeAndMapStyle(calcAutoTheme());
theme = calcAutoTheme();
}
else
{
// Happens when exiting the Navigation mode. Should restore the light.
theme = mContext.getResources().getString(R.string.theme_default);
}

setThemeAndMapStyle(theme);
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ public class PlacePageView extends Fragment implements View.OnClickListener,
private TextView mTvOutdoorSeating;
private View mEntrance;
private TextView mTvEntrance;
private View mMaxPower;
private TextView mTvMaxPower;
private View mEditPlace;
private View mAddOrganisation;
private View mAddPlace;
Expand Down Expand Up @@ -276,6 +278,8 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
mTvCuisine = mFrame.findViewById(R.id.tv__place_cuisine);
mEntrance = mFrame.findViewById(R.id.ll__place_entrance);
mTvEntrance = mEntrance.findViewById(R.id.tv__place_entrance);
mMaxPower = mFrame.findViewById(R.id.ll__place_max_power);
mTvMaxPower = mFrame.findViewById(R.id.tv__place_max_power);
mEditPlace = mFrame.findViewById(R.id.ll__place_editor);
mEditPlace.setOnClickListener(this);
mAddOrganisation = mFrame.findViewById(R.id.ll__add_organisation);
Expand All @@ -294,6 +298,7 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
mDriveThrough.setOnLongClickListener(this);
mSelfService.setOnLongClickListener(this);
mOutdoorSeating.setOnLongClickListener(this);
mMaxPower.setOnLongClickListener(this);

mDownloaderIcon = new DownloaderStatusIcon(mPreview.findViewById(R.id.downloader_status_frame));

Expand Down Expand Up @@ -469,6 +474,9 @@ private void refreshDetails()
final String outdoorSeating = mMapObject.getMetadata(Metadata.MetadataType.FMD_OUTDOOR_SEATING);
refreshMetadataOrHide(outdoorSeating.equals("yes") ? getString(R.string.outdoor_seating) : "", mOutdoorSeating, mTvOutdoorSeating);

final String maxPower = mMapObject.getMetadata(Metadata.MetadataType.FMD_MAX_POWER);
refreshMetadataOrHide(!TextUtils.isEmpty(maxPower) ? getString(R.string.maximum_value, maxPower) : "", mMaxPower, mTvMaxPower);

// showTaxiOffer(mapObject);

if (RoutingController.get().isNavigating() || RoutingController.get().isPlanning())
Expand Down Expand Up @@ -668,6 +676,8 @@ else if (id == R.id.ll__place_drive_through)
items.add(mTvDriveThrough.getText().toString());
else if (id == R.id.ll__place_outdoor_seating)
items.add(mTvOutdoorSeating.getText().toString());
else if (id == R.id.ll__place_max_power)
items.add(mTvMaxPower.getText().toString());

final Context context = requireContext();
if (items.size() == 1)
Expand Down
9 changes: 9 additions & 0 deletions android/app/src/main/res/drawable/ic_max_power_white.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="28dp"
android:height="28dp"
android:viewportWidth="28"
android:viewportHeight="28">
<path
android:pathData="M17.254,1.536 L6.746,15.864A0.211,0.211 63.127,0 0,6.917 16.2h5.167a0.345,0.345 50.342,0 1,0.339 0.409l-1.845,9.781a0.095,0.095 23.469,0 0,0.169 0.073L21.254,12.136A0.211,0.211 63.127,0 0,21.083 11.8h-5.167a0.345,0.345 50.342,0 1,-0.339 -0.409l1.845,-9.781a0.095,0.095 23.469,0 0,-0.169 -0.073z"
android:fillColor="#fff"/>
</vector>
2 changes: 2 additions & 0 deletions android/app/src/main/res/layout/place_page_details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@

<include layout="@layout/place_page_outdoor_seating"/>

<include layout="@layout/place_page_max_power"/>

<!-- ToDo: Address is missing compared with iOS. It's shown in title but anyway .. -->

<include layout="@layout/place_page_latlon"/>
Expand Down
20 changes: 20 additions & 0 deletions android/app/src/main/res/layout/place_page_max_power.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/ll__place_max_power"
style="@style/PlacePageItemFrame"
tools:background="#4000FFFF"
tools:visibility="visible">

<ImageView
android:id="@+id/iv__place_max_power"
style="@style/PlacePageMetadataIcon"
app:srcCompat="@drawable/ic_max_power_white" />

<TextView
android:id="@+id/tv__place_max_power"
style="@style/PlacePageMetadataText"
tools:text="Maximum power" />
</LinearLayout>
2 changes: 2 additions & 0 deletions android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,8 @@
<string name="select_option">Select option</string>
<!-- To indicate if restaurant or other place has outdoor seating -->
<string name="outdoor_seating">Outdoor seating</string>
<!-- To indicate a maximum value -->
<string name="maximum_value">Maximum: %s</string>
<!-- Disclaimer summary shown when Power Saving Mode is enabled -->
<string name="power_save_dialog_summary">For the most accurate navigation, we recommend disabling power saving mode in phone\'s battery settings.</string>
<!-- Prompt to start recording a track. -->
Expand Down
2 changes: 0 additions & 2 deletions cmake/OmimConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ set(3PARTY_INCLUDE_DIRS "${OMIM_ROOT}/3party/boost")
set(OMIM_DATA_DIR "${OMIM_ROOT}/data")
set(OMIM_USER_RESOURCES_DIR "${OMIM_ROOT}/data")

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

# GCC 10.0 is required to support <charconv> header inclusion in base/string_utils.hpp
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0)
message(FATAL_ERROR "Minimum supported g++ version is 10.0, yours is ${CMAKE_CXX_COMPILER_VERSION}")
Expand Down
Loading
Loading