Skip to content

Commit

Permalink
Merge branch 'release/0.8.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
sgrimault committed Sep 19, 2024
2 parents f12e381 + 430e2ed commit bcbc6ca
Show file tree
Hide file tree
Showing 133 changed files with 4,494 additions and 1,803 deletions.
5 changes: 0 additions & 5 deletions .gitmodules

This file was deleted.

2 changes: 0 additions & 2 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/deploymentTargetSelector.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# gn_mobile_maps

Android Map library based on [osmdroid](http://osmdroid.github.io/osmdroid/index.html).
Small Android Map library based on [osmdroid](http://osmdroid.github.io/osmdroid/index.html).
* `maps`: The library itself
* `mountpoint`: Manage all available internal and external mount points on device
* `app`: Demo app

## Upgrade git sub modules
See [settings documentation](/maps).

Do **NOT** modify directly any git sub modules (e.g. `mountpoint`).
Any changes should be made from each underlying git repository:
## Full Build

* `mountpoint`: [gn_mobile_core](https://github.com/PnX-SI/gn_mobile_core) git repository
A full build can be executed with the following command:

```bash
./upgrade_submodules.sh
```
./gradlew clean assembleDebug
```
43 changes: 26 additions & 17 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
plugins {
id 'com.android.application'
id 'dagger.hilt.android.plugin'
id 'kotlin-android'
id 'kotlin-kapt'
id 'org.jetbrains.kotlin.android'
}

version = "0.7.0"
version = "0.8.0"

android {
compileSdkVersion 33

compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
jvmTarget = JavaVersion.VERSION_17.toString()
}

defaultConfig {
applicationId "fr.geonature.maps.sample"
compileSdk 34
minSdkVersion 21
targetSdkVersion 33
targetSdkVersion 34
versionCode updateVersionCode(project.name)
versionName version
buildConfigField "String", "BUILD_DATE", "\"" + new Date().getTime() + "\""
Expand All @@ -34,6 +36,7 @@ android {
versionNameSuffix ".${defaultConfig.versionCode}-DEV"
}
release {
debuggable false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
Expand All @@ -45,6 +48,9 @@ android {
}
}
namespace 'fr.geonature.maps.sample'
buildFeatures {
buildConfig true
}
}

dependencies {
Expand All @@ -53,21 +59,24 @@ dependencies {
implementation project(':mountpoint')
implementation project(':maps')

implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'androidx.preference:preference-ktx:1.2.1'
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation 'androidx.work:work-runtime-ktx:2.9.1'
implementation 'com.google.android.material:material:1.12.0'

implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.preference:preference-ktx:1.2.0'
implementation 'androidx.recyclerview:recyclerview:1.3.0'
implementation 'com.google.android.material:material:1.8.0'
// Hilt dependencies
implementation "androidx.hilt:hilt-work:$androidx_hilt_version"
implementation "com.google.dagger:hilt-android:$hilt_version"
kapt "androidx.hilt:hilt-compiler:$androidx_hilt_version"
kapt "com.google.dagger:hilt-android-compiler:$hilt_version"

// Logging
implementation 'org.tinylog:tinylog-api-kotlin:2.4.1'
runtimeOnly 'org.tinylog:tinylog-impl:2.4.1'
implementation "org.tinylog:tinylog-api-kotlin:$tinylog_version"
runtimeOnly "org.tinylog:tinylog-impl:$tinylog_version"

// Testing dependencies
testImplementation 'androidx.test:core:1.5.0'
testImplementation 'androidx.test:core:1.6.1'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-core:4.5.1'
testImplementation 'org.robolectric:robolectric:4.8.1'
testImplementation 'org.robolectric:robolectric:4.13'
}
29 changes: 18 additions & 11 deletions app/src/main/java/fr/geonature/maps/sample/MainApplication.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package fr.geonature.maps.sample

import android.app.Application
import fr.geonature.mountpoint.model.MountPoint
import fr.geonature.mountpoint.util.FileUtils
import android.os.Environment
import dagger.hilt.android.HiltAndroidApp
import fr.geonature.mountpoint.util.FileUtils.getRelativeSharedPath
import fr.geonature.mountpoint.util.MountPointUtils
import fr.geonature.mountpoint.util.getFile
import org.tinylog.Logger
import java.io.File
import kotlin.system.exitProcess
Expand All @@ -13,6 +15,7 @@ import kotlin.system.exitProcess
*
* @author S. Grimault
*/
@HiltAndroidApp
class MainApplication : Application() {

override fun onCreate() {
Expand All @@ -29,23 +32,27 @@ class MainApplication : Application() {
}

private fun configureLogger() {
val directoryForLogs: File = FileUtils.getFile(
FileUtils.getRootFolder(
this,
MountPoint.StorageType.INTERNAL,
),
"logs"
)
.also { it.mkdirs() }
val directoryForLogs: File = Environment.getExternalStorageDirectory()
.getFile(
getRelativeSharedPath(applicationContext.packageName),
"logs"
)
.also {
it.mkdirs()
}

System.setProperty(
"tinylog.directory",
directoryForLogs.absolutePath
)
System.setProperty(
"tinylog.level",
if (BuildConfig.DEBUG) "debug" else "info"
)

Thread.setDefaultUncaughtExceptionHandler(TinylogUncaughtExceptionHandler())

Logger.info { "starting ${BuildConfig.APPLICATION_ID}..." }
Logger.info { "starting ${BuildConfig.APPLICATION_ID} (version ${BuildConfig.VERSION_NAME})..." }
Logger.info { "logs directory: '$directoryForLogs'" }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import fr.geonature.maps.sample.R
import fr.geonature.maps.sample.ui.map.MapActivity
import fr.geonature.maps.settings.io.MapSettingsReader
import fr.geonature.mountpoint.util.FileUtils
import fr.geonature.mountpoint.util.getFile
import org.tinylog.kotlin.Logger
import java.io.InputStreamReader

Expand All @@ -35,13 +36,13 @@ class HomeActivity : AppCompatActivity(), HomeListFragment.OnHomeListFragmentLis
.commit()
}

val osmdroidFile = FileUtils.getFile(
FileUtils.getExternalStorageDirectory(application),
"osmdroid"
)
val osmdroidFile = FileUtils.getExternalStorageDirectory(application)
.getFile("osmdroid")

Logger.debug {
"${osmdroidFile.absolutePath}: (exists: ${osmdroidFile.exists()}, ${
"${osmdroidFile.absolutePath}: (exists: ${osmdroidFile.exists()}${
if (osmdroidFile.exists()) "," else ""
}${
if (osmdroidFile.canRead()) "r" else ""
}${
if (osmdroidFile.canWrite()) "w" else ""
Expand All @@ -60,6 +61,7 @@ class HomeActivity : AppCompatActivity(), HomeListFragment.OnHomeListFragmentLis
)
.show()
}

RESULT_OK -> {
val uri = result.data?.data

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import androidx.recyclerview.widget.RecyclerView
import fr.geonature.maps.sample.R
import fr.geonature.maps.settings.LayerSettings
import fr.geonature.maps.settings.MapSettings
import fr.geonature.maps.ui.widget.EditFeatureButton

/**
* A fragment representing a list of [MenuItem].
Expand Down Expand Up @@ -75,24 +76,25 @@ class HomeListFragment : Fragment() {
listOf(
MenuItem(
getString(R.string.home_menu_entry_default),
MapSettings.Builder.newInstance()
MapSettings.Builder()
.minZoomLevel(3.0)
.zoom(6.0)
.editMode(EditFeatureButton.EditMode.SINGLE)
.addLayer(
LayerSettings.Builder.newInstance()
.label("IGN : plan v2")
.addSource("https://wxs.ign.fr/cartes/geoportail/wmts?REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&STYLE=normal&TILEMATRIXSET=PM&FORMAT=image/png&LAYER=GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2")
.label("IGN: plan v2")
.addSource("https://wxs.ign.fr/essentiels/geoportail/wmts?REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&STYLE=normal&TILEMATRIXSET=PM&FORMAT=image/png&LAYER=GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2")
.build()
)
.addLayer(
LayerSettings.Builder.newInstance()
.label("IGN : ortho")
.label("IGN: ortho")
.addSource("https://wxs.ign.fr/ortho/geoportail/wmts?REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&STYLE=normal&TILEMATRIXSET=PM&FORMAT=image/jpeg&LAYER=ORTHOIMAGERY.ORTHOPHOTOS")
.build()
)
.addLayer(
LayerSettings.Builder.newInstance()
.label("IGN : cadastre")
.label("IGN: cadastral")
.addSource("https://wxs.ign.fr/parcellaire/geoportail/wmts?REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&STYLE=normal&TILEMATRIXSET=PM&FORMAT=image/png&LAYER=CADASTRALPARCELS.PARCELS")
.build()
)
Expand Down
Loading

0 comments on commit bcbc6ca

Please sign in to comment.