Skip to content

Commit

Permalink
Merge branch 'master' into fix_#19505
Browse files Browse the repository at this point in the history
  • Loading branch information
Chumva committed Feb 26, 2025
2 parents 0eacc3e + d0c9cee commit 20b3528
Show file tree
Hide file tree
Showing 257 changed files with 6,742 additions and 4,003 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ poi_types.xml
*.map_styles_presets.xml
routing*.xml
rendering_types.xml
activities.json
countries.reginfo
regions.ocbf
h_*.png
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public List<String> prepareStreetName(String s, boolean addCommonWords) {
List<String> ls = new ArrayList<String>();
int beginning = 0;
for (int i = 1; i < s.length(); i++) {
if (Character.isWhitespace(s.charAt(i))) {
if (Character.isWhitespace(s.charAt(i)) || s.charAt(i) == '-') {
addWord(ls, s.substring(beginning, i), addCommonWords);
beginning = i + 1;
} else if (s.charAt(i) == '(') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ public class HeightDataLoader {
public static final int ZOOM_TO_LOAD_TILES_SHIFT_L = ZOOM_TO_LOAD_TILES + 1;
public static final int ZOOM_TO_LOAD_TILES_SHIFT_R = 31 - ZOOM_TO_LOAD_TILES;

public interface InterfaceIsCancelled {
public interface Cancellable {
boolean isCancelled();
}

public interface InterfaceCancellableCallback<T> {
boolean callback(T object, InterfaceIsCancelled canceller);
public interface CancellableCallback<T> {
boolean callback(T object, Cancellable canceller);
}

private final static Log log = PlatformUtil.getLog(HeightDataLoader.class);
Expand All @@ -50,7 +50,7 @@ public HeightDataLoader(BinaryMapIndexReader[] readers) {
}
}

public List<WptPt> loadHeightDataAsWaypoints(long osmId, QuadRect bbox31, InterfaceIsCancelled canceller) {
public List<WptPt> loadHeightDataAsWaypoints(long osmId, QuadRect bbox31, Cancellable canceller) {
Map<Long, RouteDataObject> results = new HashMap<>();
ResultMatcher<RouteDataObject> matcher = new ResultMatcher<>() {
@Override
Expand Down
12 changes: 8 additions & 4 deletions OsmAnd-java/src/main/java/net/osmand/wiki/WikiCoreHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.osmand.data.Amenity;
import net.osmand.data.QuadRect;
import net.osmand.osm.io.NetworkUtils;
import net.osmand.shared.data.KQuadRect;
import net.osmand.util.Algorithms;

import org.apache.commons.logging.Log;
Expand Down Expand Up @@ -46,12 +47,12 @@ public class WikiCoreHelper {
private static final List<String> IMAGE_EXTENSIONS = new ArrayList<>(Arrays.asList(".jpeg", ".jpg", ".png", ".gif"));


public static List<OsmandApiFeatureData> getExploreImageList(QuadRect mapRect, int zoom, String lang) {
public static List<OsmandApiFeatureData> getExploreImageList(KQuadRect mapRect, int zoom, String lang) {
List<OsmandApiFeatureData> wikiImages = new ArrayList<>();
StringBuilder url = new StringBuilder();
String baseApiActionUrl = OSMAND_SEARCH_ENDPOINT + GET_WIKI_DATA_ACTION;
String northWest = String.format(Locale.US, "%f,%f", mapRect.top, mapRect.left);
String southEast = String.format(Locale.US, "%f,%f", mapRect.bottom, mapRect.right);
String northWest = String.format(Locale.US, "%f,%f", mapRect.getTop(), mapRect.getLeft());
String southEast = String.format(Locale.US, "%f,%f", mapRect.getBottom(), mapRect.getRight());
url.append(baseApiActionUrl);
try {
url.append(String.format(Locale.US, "northWest=%s", URLEncoder.encode(northWest, "UTF-8")));
Expand All @@ -62,11 +63,12 @@ public static List<OsmandApiFeatureData> getExploreImageList(QuadRect mapRect, i
url.append("&");
url.append(String.format(Locale.US, "lang=%s", lang));
url.append("&");
url.append(String.format(Locale.US, "filters=%s", "tourism%2Cleisure%2Centertainment"));
url.append(String.format(Locale.US, "filters="));

} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
LOG.debug("Download images " + url.toString());
getNearbyImagesOsmAndAPIRequest(url.toString(), wikiImages);
return wikiImages;
}
Expand Down Expand Up @@ -336,6 +338,8 @@ public static class WikiDataProperties {
private String wikiLang;
public String wikiDesc;
public Long osmid;

public Double elo;
private String osmtype;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
Expand Down Expand Up @@ -66,7 +67,7 @@ public static Iterable<Object[]> data() throws IOException {

}

// @Ignore
@Ignore
@Test(timeout = TIMEOUT)
public void testRouting() throws Exception {
NativeLibrary nativeLibrary = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ class KQuadRect {
return contains(box.left, box.top, box.right, box.bottom)
}

fun contains(point: KLatLon): Boolean {
return point.longitude in left..right && point.latitude in bottom..top
}

companion object {
fun intersects(a: KQuadRect, b: KQuadRect): Boolean {
return kotlin.math.min(a.left, a.right) <= kotlin.math.max(b.left, b.right)
Expand Down Expand Up @@ -109,6 +113,24 @@ class KQuadRect {
return left == 0.0 && right == 0.0 && top == 0.0 && bottom == 0.0
}

override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is KQuadRect) return false

return left == other.left &&
right == other.right &&
top == other.top &&
bottom == other.bottom
}

override fun hashCode(): Int {
var result = left.hashCode()
result = 31 * result + right.hashCode()
result = 31 * result + top.hashCode()
result = 31 * result + bottom.hashCode()
return result
}

override fun toString(): String {
return "[${left.toFloat()},${top.toFloat()} - ${right.toFloat()},${bottom.toFloat()}]"
}
Expand Down
1 change: 1 addition & 0 deletions OsmAnd/assets/article_style.css
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ body {
font-family: sans-serif;
background-color: #17191a;
background-color: var(--background-color-night);
color: var(--main-text-color-night);
}

.nav-bar {
Expand Down
19 changes: 19 additions & 0 deletions OsmAnd/res/drawable/ic_action_location_animation.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M6.379,10.4473L5.3333,7.8333L1.1554,6.0657C1.0529,6.0223 0.9427,6 0.8314,6C0.3722,6 0,6.3782 0,6.8374C0,6.944 0.0204,7.0509 0.06,7.1499L2.0001,12L0.06,16.8501C0.0204,16.9491 0,17.056 0,17.1626C-0,17.6218 0.3722,18 0.8314,18C0.9427,18 1.0529,17.9777 1.1554,17.9343L5.3333,16.1667L6.379,13.5527L2.9533,15.002L3.857,12.7428C4.0477,12.266 4.0477,11.734 3.857,11.2572L2.9533,8.998L6.379,10.4473Z"
android:strokeAlpha="0.4"
android:fillColor="#ffffff"
android:fillAlpha="0.4"/>
<path
android:pathData="M11.379,10.4473L10.3333,7.8333L6.1554,6.0657C6.0529,6.0223 5.9427,6 5.8314,6C5.3722,6 5,6.3782 5,6.8374C5,6.944 5.0204,7.0509 5.06,7.1499L7.0001,12L5.06,16.8501C5.0204,16.9491 5,17.056 5,17.1626C5,17.6218 5.3722,18 5.8314,18C5.9427,18 6.0529,17.9777 6.1554,17.9343L10.3333,16.1667L11.379,13.5527L7.9533,15.002L8.857,12.7428C9.0478,12.266 9.0478,11.734 8.857,11.2572L7.9533,8.998L11.379,10.4473Z"
android:strokeAlpha="0.8"
android:fillColor="#ffffff"
android:fillAlpha="0.8"/>
<path
android:pathData="M11.9999,12L10.0599,7.1499C10.0202,7.0509 9.9999,6.944 9.9999,6.8374C9.9999,6.3782 10.3721,6 10.8313,6C10.9426,6 11.0528,6.0223 11.1553,6.0657L23.5395,11.3052C23.8186,11.4233 23.9999,11.6969 23.9999,12C23.9999,12.3031 23.8186,12.5767 23.5395,12.6948L11.1553,17.9343C11.0528,17.9777 10.9426,18 10.8313,18C10.3721,18 9.9999,17.6218 9.9999,17.1626C9.9999,17.056 10.0202,16.9491 10.0599,16.8501L11.9999,12Z"
android:fillColor="#ffffff"/>
</vector>
21 changes: 21 additions & 0 deletions OsmAnd/res/drawable/ic_action_location_no_animation.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M15.5,18C14.1193,18 13,16.8807 13,15.5V8.5C13,6.0147 10.9853,4 8.5,4C6.0147,4 4,6.0147 4,8.5V18C4,18.5523 4.4477,19 5,19C5.5523,19 6,18.5523 6,18V8.5C6,7.1193 7.1193,6 8.5,6C9.8807,6 11,7.1193 11,8.5V15.5C11,17.9853 13.0147,20 15.5,20C17.9853,20 20,17.9853 20,15.5V11.0001C20,10.4478 19.5523,10.0001 19,10.0001C18.4477,10.0001 18,10.4478 18,11.0001V15.5C18,16.8807 16.8807,18 15.5,18Z"
android:strokeAlpha="0.4"
android:fillColor="#ffffff"
android:fillType="evenOdd"
android:fillAlpha="0.4"/>
<path
android:pathData="M19,10L17.1708,10.9146C17.0585,10.9708 16.9346,11.0001 16.809,11.0001C16.3622,11.0001 16,10.6379 16,10.1911V10.1667C16,10.0566 16.0218,9.9477 16.0641,9.8461L18.3074,4.4623C18.424,4.1824 18.6975,4 19.0008,4C19.3033,4 19.5762,4.1814 19.6934,4.4602L21.9318,9.7877C21.9768,9.8949 22,10.0099 22,10.1262V10.191C22,10.6378 21.6378,11 21.191,11C21.0654,11 20.9415,10.9708 20.8292,10.9146L19,10Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M12,10L13.8292,9.0854C13.9415,9.0292 14.0654,8.9999 14.191,8.9999C14.6378,8.9999 15,9.3621 15,9.809V9.8333C15,9.9433 14.9782,10.0523 14.9359,10.1539L12.6926,15.5377C12.576,15.8177 12.3025,16 11.9992,16C11.6967,16 11.4238,15.8186 11.3066,15.5398L9.0682,10.2123C9.0232,10.1051 9,9.9901 9,9.8738V9.809C9,9.3622 9.3622,9 9.809,9C9.9346,9 10.0585,9.0292 10.1708,9.0854L12,10Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M3.1708,19.9146L5,19L6.8292,19.9146C6.9415,19.9708 7.0654,20 7.1909,20C7.6378,20 8,19.6378 8,19.191V19.1262C8,19.0099 7.9768,18.8949 7.9318,18.7877L5.6934,13.4602C5.5762,13.1814 5.3033,13 5.0008,13C4.6975,13 4.424,13.1823 4.3074,13.4623L2.0641,18.8461C2.0218,18.9477 2,19.0566 2,19.1667V19.1911C2,19.6379 2.3622,20.0001 2.809,20.0001C2.9346,20.0001 3.0585,19.9708 3.1708,19.9146Z"
android:fillColor="#ffffff"/>
</vector>
151 changes: 82 additions & 69 deletions OsmAnd/res/layout-v26/simple_map_widget_large.xml
Original file line number Diff line number Diff line change
@@ -1,91 +1,104 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/widget_bg"
android:layout_width="match_parent"
android:layout_height="@dimen/simple_widget_large_height"
android:orientation="vertical"
android:paddingHorizontal="16dp"
android:paddingTop="6dp"
android:paddingBottom="3dp">
android:layout_height="@dimen/simple_widget_large_height">

<LinearLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:orientation="vertical"
android:paddingHorizontal="16dp"
android:paddingTop="6dp"
android:paddingBottom="3dp">

<LinearLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="17dp"
android:gravity="bottom"
android:layoutDirection="rtl"
android:orientation="horizontal">
android:layout_height="match_parent"
android:orientation="vertical">

<TextView
android:id="@+id/widget_text_small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="bottom|end"
android:includeFontPadding="false"
android:letterSpacing="0.06"
android:lineSpacingExtra="-2sp"
android:maxLines="1"
android:textAllCaps="true"
android:textColor="@color/text_color_secondary_light"
android:textSize="@dimen/simple_widget_description_text_size"
tools:text="Unit" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="17dp"
android:gravity="bottom"
android:layoutDirection="rtl"
android:orientation="horizontal">

<TextView
android:id="@+id/widget_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="bottom|start"
android:layout_marginStart="3dp"
android:layout_weight="1"
android:ellipsize="end"
android:includeFontPadding="false"
android:letterSpacing="0.06"
android:lineSpacingExtra="-2sp"
android:maxLines="1"
android:textAllCaps="true"
android:textColor="@color/text_color_secondary_light"
android:textSize="@dimen/simple_widget_description_text_size"
tools:text="Widget name" />
<TextView
android:id="@+id/widget_text_small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="bottom|end"
android:includeFontPadding="false"
android:letterSpacing="0.06"
android:lineSpacingExtra="-2sp"
android:maxLines="1"
android:textAllCaps="true"
android:textColor="@color/text_color_secondary_light"
android:textSize="@dimen/simple_widget_description_text_size"
tools:text="Unit" />

</LinearLayout>
<TextView
android:id="@+id/widget_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="3dp"
android:layout_weight="1"
android:ellipsize="end"
android:gravity="bottom|start"
android:includeFontPadding="false"
android:letterSpacing="0.06"
android:lineSpacingExtra="-2sp"
android:maxLines="1"
android:textAllCaps="true"
android:textColor="@color/text_color_secondary_light"
android:textSize="@dimen/simple_widget_description_text_size"
tools:text="Widget name" />

<FrameLayout
android:layout_width="match_parent"
android:layout_height="70dp">
</LinearLayout>

<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/widget_icon"
android:layout_width="@dimen/map_widget_icon"
android:layout_height="@dimen/map_widget_icon"
android:layout_gravity="start|center_vertical"
android:gravity="center"
app:srcCompat="@drawable/ic_action_remove_dark" />

<TextView
android:id="@+id/widget_text"
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoSizeMaxTextSize="@dimen/simple_widget_value_large_size"
android:autoSizeMinTextSize="@dimen/simple_widget_value_minimum_size"
android:autoSizeStepGranularity="2sp"
android:autoSizeTextType="uniform"
android:ellipsize="none"
android:gravity="center_vertical|start"
android:includeFontPadding="false"
android:letterSpacing="0.04"
android:maxLines="1"
android:textColor="@color/text_color_primary_light"
android:textSize="@dimen/simple_widget_value_large_size" />
android:layout_height="70dp">

<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/widget_icon"
android:layout_width="@dimen/map_widget_icon"
android:layout_height="@dimen/map_widget_icon"
android:layout_gravity="start|center_vertical"
android:gravity="center"
app:srcCompat="@drawable/ic_action_remove_dark" />

</FrameLayout>
<TextView
android:id="@+id/widget_text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoSizeMaxTextSize="@dimen/simple_widget_value_large_size"
android:autoSizeMinTextSize="@dimen/simple_widget_value_minimum_size"
android:autoSizeStepGranularity="2sp"
android:autoSizeTextType="uniform"
android:ellipsize="none"
android:gravity="center_vertical|start"
android:includeFontPadding="false"
android:letterSpacing="0.04"
android:maxLines="1"
android:textColor="@color/text_color_primary_light"
android:textSize="@dimen/simple_widget_value_large_size" />

</FrameLayout>

</LinearLayout>

</LinearLayout>

</LinearLayout>
<View
android:id="@+id/bottom_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_gravity="bottom"
android:visibility="invisible" />

</FrameLayout>
Loading

0 comments on commit 20b3528

Please sign in to comment.