From bfdf876dabbd4bba0d3821ad03f3ee9c922c5ded Mon Sep 17 00:00:00 2001
From: Peter
Date: Fri, 21 Jul 2023 14:43:45 +0300
Subject: [PATCH] Added dark scheme tiles support
1. Added dark scheme tiles support.
2. Added corresponding fields in settings.
3. Added ranslations for settings (!!! Review all langs, please !!!)
---
res/ar.txt | 3 ++-
res/en.txt | 5 +++--
res/fr.txt | 3 ++-
res/ru.txt | 3 ++-
src/mahomaps/MahoMapsApp.java | 2 +-
src/mahomaps/api/YmapsApiBase.java | 6 +++---
src/mahomaps/map/TilesProvider.java | 4 +++-
src/mahomaps/screens/SettingsScreen.java | 2 +-
8 files changed, 17 insertions(+), 11 deletions(-)
mode change 100644 => 100755 res/ar.txt
mode change 100644 => 100755 res/en.txt
mode change 100644 => 100755 res/fr.txt
mode change 100644 => 100755 res/ru.txt
mode change 100644 => 100755 src/mahomaps/MahoMapsApp.java
mode change 100644 => 100755 src/mahomaps/api/YmapsApiBase.java
mode change 100644 => 100755 src/mahomaps/map/TilesProvider.java
mode change 100644 => 100755 src/mahomaps/screens/SettingsScreen.java
diff --git a/res/ar.txt b/res/ar.txt
old mode 100644
new mode 100755
index 85afd28..cfcfa4e
--- a/res/ar.txt
+++ b/res/ar.txt
@@ -164,4 +164,5 @@
الإحداثيات
ساعات العمل
الموقع الإلكتروني
-الهاتف
\ No newline at end of file
+الهاتف
+مخطط ، موضوع مظلم
\ No newline at end of file
diff --git a/res/en.txt b/res/en.txt
old mode 100644
new mode 100755
index 819c957..444d919
--- a/res/en.txt
+++ b/res/en.txt
@@ -53,7 +53,7 @@ Debug info
Save tiles
File system
Download tiles
-Scheme, bright pallete
+Scheme, light theme
Control buttons size (restart needed)
Auto
Tiles & search language (restart needed)
@@ -164,4 +164,5 @@ Description
Coords
Opening hours
Website
-Phone
\ No newline at end of file
+Phone
+Scheme, dark theme
\ No newline at end of file
diff --git a/res/fr.txt b/res/fr.txt
old mode 100644
new mode 100755
index 2ee1b8f..296da6e
--- a/res/fr.txt
+++ b/res/fr.txt
@@ -164,4 +164,5 @@ Description
Coordonnées
Mode de fonctionnement
Site Internet
-Téléphone
\ No newline at end of file
+Téléphone
+Schéma, palette sombre
\ No newline at end of file
diff --git a/res/ru.txt b/res/ru.txt
old mode 100644
new mode 100755
index 39ed2ba..eceea80
--- a/res/ru.txt
+++ b/res/ru.txt
@@ -164,4 +164,5 @@ J2ME клиент растровых Яндекс.Карт.
Координаты
Режим работы
Сайт
-Телефон
\ No newline at end of file
+Телефон
+Схема, темная палитра
\ No newline at end of file
diff --git a/src/mahomaps/MahoMapsApp.java b/src/mahomaps/MahoMapsApp.java
old mode 100644
new mode 100755
index 92e6626..5315647
--- a/src/mahomaps/MahoMapsApp.java
+++ b/src/mahomaps/MahoMapsApp.java
@@ -309,7 +309,7 @@ public static void LoadLocale(String name) {
text = splitFull(getStringFromJAR("/" + name + ".txt"), '\n');
if (text == null)
throw new RuntimeException("Lang is not loaded");
- if (text.length != 167)
+ if (text.length != 168)
throw new RuntimeException("Lang is outdated");
for (int i = 0; i < text.length; i++) {
if (text[i].endsWith("\r")) {
diff --git a/src/mahomaps/api/YmapsApiBase.java b/src/mahomaps/api/YmapsApiBase.java
old mode 100644
new mode 100755
index c8dcff4..5122fad
--- a/src/mahomaps/api/YmapsApiBase.java
+++ b/src/mahomaps/api/YmapsApiBase.java
@@ -1,5 +1,6 @@
package mahomaps.api;
+import cc.nnproject.json.*;
import java.io.ByteArrayOutputStream;
import java.io.EOFException;
import java.io.IOException;
@@ -7,14 +8,13 @@
import java.io.InputStreamReader;
import java.util.Enumeration;
import java.util.Hashtable;
-
import javax.microedition.io.Connector;
import javax.microedition.io.HttpConnection;
-
-import cc.nnproject.json.*;
import mahomaps.MahoMapsApp;
import mahomaps.Settings;
+
+
public abstract class YmapsApiBase {
private final String tokenMark = "token\":\"";
diff --git a/src/mahomaps/map/TilesProvider.java b/src/mahomaps/map/TilesProvider.java
old mode 100644
new mode 100755
index 6198dbf..81547be
--- a/src/mahomaps/map/TilesProvider.java
+++ b/src/mahomaps/map/TilesProvider.java
@@ -56,8 +56,10 @@ public class TilesProvider implements Runnable {
private Thread cacheTh;
public static final String[] tilesUrls = new String[] {
- // scheme
+ // scheme light
"https://core-renderer-tiles.maps.yandex.net/tiles?l=map&lang=",
+ // scheme dark
+ "https://core-renderer-tiles.maps.yandex.net/tiles?l=map&theme=dark&lang=",
// sat
"https://core-sat.maps.yandex.net/tiles?l=sat&lang=",
// hybrid
diff --git a/src/mahomaps/screens/SettingsScreen.java b/src/mahomaps/screens/SettingsScreen.java
old mode 100644
new mode 100755
index e55f791..58c77c7
--- a/src/mahomaps/screens/SettingsScreen.java
+++ b/src/mahomaps/screens/SettingsScreen.java
@@ -29,7 +29,7 @@ public class SettingsScreen extends Form implements CommandListener {
private ChoiceGroup download = new ChoiceGroup(MahoMapsApp.text[54], Choice.MULTIPLE,
new String[] { MahoMapsApp.text[17] }, null);
private ChoiceGroup map = new ChoiceGroup(MahoMapsApp.text[153], Choice.EXCLUSIVE,
- new String[] { MahoMapsApp.text[55], MahoMapsApp.text[154], MahoMapsApp.text[155] }, null);
+ new String[] { MahoMapsApp.text[55], MahoMapsApp.text[167], MahoMapsApp.text[154], MahoMapsApp.text[155] }, null);
private ChoiceGroup proxyUsage = new ChoiceGroup(MahoMapsApp.text[19], Choice.MULTIPLE,
new String[] { MahoMapsApp.text[156], MahoMapsApp.text[157], }, null);
private TextField proxyServer = new TextField(MahoMapsApp.text[158], "", 256, TextField.URL);