Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data #21856

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
4 changes: 3 additions & 1 deletion OsmAnd/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" tools:ignore="ScopedStorage" />
<uses-permission android:name="android.permission.STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
Expand Down Expand Up @@ -100,7 +102,7 @@

<provider
android:name="androidx.core.content.FileProvider"
android:authorities="net.osmand.plus.fileprovider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true" >
<meta-data
Expand Down
8 changes: 8 additions & 0 deletions OsmAnd/build-common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,13 @@ tasks.register('downloadWorldMiniBasemapAnt') {
}
}

tasks.register('gironde', Copy) {
from("../../resources/data") {
include "France_new-aquitaine_gironde_europe.obf"
}
into "assets"
}

tasks.register('collectVoiceAssets', Sync) {
from "../../resources/voice"
into "assets/voice"
Expand Down Expand Up @@ -303,6 +310,7 @@ tasks.register('collectExternalResources') {
copyPoiCategories,
copyRouteActivities,
downloadWorldMiniBasemap,
gironde,
collectTestResources,
copy3DModels
}
Expand Down
1 change: 1 addition & 0 deletions OsmAnd/build-library.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ android {
osmandTask.dependsOn(copy3DModels)
osmandTask.dependsOn(collectVoiceAssets)
osmandTask.dependsOn(downloadWorldMiniBasemap)
osmandTask.dependsOn(gironde)
}
def mapSourceSetPathsName= "map${taskName}SourceSetPaths"
tasks.named(mapSourceSetPathsName).configure { osmandTask ->
Expand Down
11 changes: 11 additions & 0 deletions OsmAnd/res/drawable/bi.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="20dp"
android:viewportWidth="20"
android:viewportHeight="20">
<path
android:pathData="M0.441,0.282h19.275v18.903h-19.275z"
android:strokeWidth="0.2"
android:fillColor="#457CEA"
android:strokeColor="#000000"/>
</vector>
11 changes: 11 additions & 0 deletions OsmAnd/res/drawable/bouche_eau_de_mer.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="20dp"
android:viewportWidth="20"
android:viewportHeight="20">
<path
android:pathData="M0,0h20v20h-20z"
android:strokeWidth="0.2"
android:fillColor="#24CA1C"
android:strokeColor="#000000"/>
</vector>
Binary file added OsmAnd/res/drawable/logo_sdis33.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="135"
android:endColor="#EAEAEA"
android:centerColor="#EAEAEA"
android:startColor="#EAEAEA"
android:type="linear" />
</shape>
11 changes: 11 additions & 0 deletions OsmAnd/res/drawable/pena.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="20dp"
android:viewportWidth="20"
android:viewportHeight="20">
<path
android:pathData="M10,0L20,20L0,20L10,0Z"
android:strokeWidth="0.2"
android:fillColor="#457CEA"
android:strokeColor="#000000"/>
</vector>
11 changes: 11 additions & 0 deletions OsmAnd/res/drawable/per.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="40dp"
android:height="20dp"
android:viewportWidth="40"
android:viewportHeight="20">
<path
android:pathData="M0,10a20,10 0,1 0,40 0a20,10 0,1 0,-40 0z"
android:strokeWidth="0.4"
android:fillColor="#FFF200"
android:strokeColor="#000000"/>
</vector>
11 changes: 11 additions & 0 deletions OsmAnd/res/drawable/pi_100_mm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="20dp"
android:viewportWidth="20"
android:viewportHeight="20">
<path
android:pathData="M0,10a10,10 0,1 0,20 0a10,10 0,1 0,-20 0z"
android:strokeWidth="0.2"
android:fillColor="#457CEA"
android:strokeColor="#000000"/>
</vector>
16 changes: 16 additions & 0 deletions OsmAnd/res/drawable/pi_150_mm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="38dp"
android:height="20dp"
android:viewportWidth="38"
android:viewportHeight="20">
<path
android:pathData="M0.128,9.953a9.425,9.425 0,1 0,18.85 0a9.425,9.425 0,1 0,-18.85 0z"
android:strokeWidth="0.2"
android:fillColor="#457CEA"
android:strokeColor="#000000"/>
<path
android:pathData="M19.008,9.967a9.425,9.425 0,1 0,18.85 0a9.425,9.425 0,1 0,-18.85 0z"
android:strokeWidth="0.2"
android:fillColor="#457CEA"
android:strokeColor="#000000"/>
</vector>
16 changes: 16 additions & 0 deletions OsmAnd/res/drawable/pi_80_mm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="20dp"
android:viewportWidth="20"
android:viewportHeight="20">
<path
android:pathData="M0,10a10,10 0,1 0,20 0a10,10 0,1 0,-20 0z"
android:strokeWidth="0.2"
android:fillColor="#FFFFFF"
android:strokeColor="#000000"/>
<path
android:pathData="M20,10C20,12.77 18.874,15.277 17.054,17.088L10,10.114L2.946,17.088C1.126,15.277 0,12.77 0,10C0,7.247 1.112,4.754 2.912,2.945L10,10.114L17.088,2.945C18.888,4.754 20,7.247 20,10Z"
android:strokeWidth="0.2"
android:fillColor="#457CEA"
android:strokeColor="#000000"/>
</vector>
47 changes: 47 additions & 0 deletions OsmAnd/res/layout/main_menu_drawer_sdis_header.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/main_menu_drawer_sdis_header_background"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="16dp"
android:paddingTop="16dp"
android:paddingRight="16dp"
android:paddingBottom="16dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark"
android:foreground="?android:attr/selectableItemBackground"
>

<ImageView
android:id="@+id/imageView"
android:layout_width="62dp"
android:layout_height="80dp"
android:contentDescription=""
android:paddingTop="0dp"
app:srcCompat="@drawable/logo_sdis33" />

<LinearLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="12dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/bottom_sheet_exit_button_margin"
android:text="@string/app_name_osmand"
android:textColor="@color/ctx_menu_controller_disabled_text_color_light"
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />

<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/backup_warning"
android:text="SDIS33"/>

</LinearLayout>
</LinearLayout>
Binary file modified OsmAnd/res/mipmap-hdpi/adaptive_icon_osmand_background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified OsmAnd/res/mipmap-mdpi/adaptive_icon_osmand_background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified OsmAnd/res/mipmap-xhdpi/adaptive_icon_osmand_background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified OsmAnd/res/mipmap-xxhdpi/adaptive_icon_osmand_background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified OsmAnd/res/mipmap-xxxhdpi/adaptive_icon_osmand_background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions OsmAnd/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
- For wording and consistency, please note https://docs.osmand.net/docs/technical/contributions/translating-osmand
Thx - Hardy
-->
<string name="shared_string_navigation_firehouse">Naviguer vers caserne</string>
<string name="shared_string_navigation_hospital">Naviguer vers urgence</string>
<string name="shared_string_measure_distance">Mesurer une distance</string>
<string name="ais_load_data">Load AIS data from file</string>
<string name="ais_address_settings">IP address settings</string>
<string name="ais_address_settings_description">Choose NMEA protocol (UDP/TCP) and define addresses</string>
Expand Down
65 changes: 65 additions & 0 deletions OsmAnd/src/net/osmand/plus/OsmandApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.AssetManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.provider.Settings;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.accessibility.AccessibilityManager;
Expand Down Expand Up @@ -296,6 +300,9 @@ public void onStop(@NonNull LifecycleOwner owner) {

SearchUICore.setDebugMode(PluginsHelper.isDevelopment());
BackupHelper.DEBUG = true;//PluginsHelper.isDevelopment();

retrievePerPdf();

}

public boolean isPlusVersionInApp() {
Expand Down Expand Up @@ -1139,6 +1146,64 @@ public void logMapDownloadEvent(@NonNull String event, @NonNull IndexItem item,
}
}

private void getMyFiles(File dir) {
SharedPreferences perPref= getSharedPreferences("SDIS_per_pdf_path", Context.MODE_PRIVATE); //Creation de l'annuaire
SharedPreferences.Editor editor = perPref.edit();

File[] files = dir.listFiles();

if (files!=null){
for (File file : files) {
if (file.isDirectory()) {
getMyFiles(file);
} else {
try {
if(file.getName().indexOf("_",2) !=-1) {
System.out.println("file izi : " + file.getName());
String pdfName = file.getName().substring(0, file.getName().indexOf("_", file.getName().indexOf("_")+1));
pdfName = pdfName.replace("_", " ");
//if(pdfName.charAt(pdfName.length() - 1) == ('F')){ //On retire le F de certain per
// pdfName=pdfName.substring(0, pdfName.length() - 1);
//}
editor.putString(pdfName.toUpperCase(), file.getAbsolutePath()); //On renseigne le code du batiment avec le chemin d'acces de son pdf
editor.apply();
}
} catch ( Exception e ) {
System.err.println(e);
}
}
}
}
}

public void retrievePerPdf(){ //Recuperation de tous les PDF de la carte SD situé dans le dossier Ressources operationnelles

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { //Si c'est une version d'android recente on s'assure d'avoir les droits d'écriture
if (!Environment.isExternalStorageManager()) {
try { //Obtention des droits
Uri uri = Uri.parse("package:" + BuildConfig.APPLICATION_ID);
Intent intent = new Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION, uri);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
android.os.Process.killProcess(android.os.Process.myPid());

} catch (Exception ex){
android.os.Process.killProcess(android.os.Process.myPid());
}
}
}

File[] externalDirs = getExternalFilesDirs(null);
String sdCardPath = null;
if (externalDirs.length > 1) { //Recuperation du chemin d'acces du stockage externe
sdCardPath = externalDirs[1].getAbsolutePath();
String fileName = sdCardPath.substring(0,sdCardPath.lastIndexOf("/Android"));
File rootDir = new File(fileName + "/Ressources operationnelles/Documents ER");
getMyFiles(rootDir);
}
}

public MapViewTrackingUtilities getMapViewTrackingUtilities() {
return mapViewTrackingUtilities;
}
Expand Down
Loading