Skip to content

Commit

Permalink
Merge branch 'release/1.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
sgrimault committed Sep 13, 2020
2 parents 666cfd8 + 55cacdf commit 146f214
Show file tree
Hide file tree
Showing 43 changed files with 874 additions and 374 deletions.
11 changes: 10 additions & 1 deletion .idea/codeStyles/Project.xml

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

134 changes: 132 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Installation documentation (French) : https://github.com/PnX-SI/gn_mobile_occtax

## Launcher icons

| Name | Flavor | Launcher icon |
| -------------------------------------------------------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------- |
| Name | Flavor | Launcher icon |
| -------------------------------------------------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------- |
| Default | _generic_ | ![PNX](https://raw.githubusercontent.com/PnX-SI/gn_mobile_occtax/develop/occtax/src/main/res/mipmap-xhdpi/ic_launcher.png) |
| [Parc National des Cévennes](http://www.cevennes-parcnational.fr) | _pnc_ | ![PNC](https://raw.githubusercontent.com/PnX-SI/gn_mobile_occtax/develop/occtax/src/pnc/res/mipmap-xhdpi/ic_launcher.png) |
| [Parc National des Écrins](http://www.ecrins-parcnational.fr) | _pne_ | ![PNE](https://raw.githubusercontent.com/PnX-SI/gn_mobile_occtax/develop/occtax/src/pne/res/mipmap-xhdpi/ic_launcher.png) |
Expand Down Expand Up @@ -49,6 +49,136 @@ Example:
| --------------------------- | ------- | ------------------------------------------------------------------------------ | ------------- |
| `area_observation_duration` | ☐ | Area observation duration period (in days) | 365 |
| `map` | ☐ | Maps settings (cf. https://github.com/PnX-SI/gn_mobile_maps/tree/develop/maps) | |
| `nomenclature` | ☐ | Nomemclature settings | |
| `nomenclature/information` | ☐ | Information settings (as array) | |
| `nomenclature/counting` | ☐ | Counting settings (as array) | |

#### Nomenclature settings

All these settings may be not defined and the default values will be used instead:

**Information settings**

| Nomemclature | Label | Visible by default | Editable |
| ---------------- | -------------------------------- | ------------------ | -------- |
| METH_OBS | Observation methods | `true` | `true` |
| ETA_BIO | Biological state of observation | `true` | `true` |
| METH_DETERMIN | Determination method | `false` | `true` |
| DETERMINER | Determiner | `false` | `true` |
| STATUT_BIO | Biological status | `false` | `true` |
| OCC_COMPORTEMENT | Behavior of observed occurrences | `false` | `true` |
| NATURALITE | Level of naturalness | `false` | `true` |
| PREUVE_EXIST | Proof of existence | `false` | `true` |
| COMMENT | Comment | `false` | `true` |

**Counting settings**

| Nomemclature | Label | Visible by default | Editable |
| ------------ | -------------------------- | ------------------ | -------- |
| STADE_VIE | Life stage | `true` | `true` |
| SEXE | Sex | `true` | `true` |
| OBJ_DENBR | Purpose of the enumeration | `true` | `true` |
| TYP_DENBR | Type of enumeration | `true` | `true` |
| MIN | Min | `true` | `true` |
| MAX | Max | `true` | `true` |

**Note:** Any unknown nomenclature attribute added will be simply ignored at startup.

You can override these default settings by adding a property for each nomenclature settings, e.g:

```json
{
"nomenclature": {
"information": [
"METH_OBS",
{
"key": "ETA_BIO"
},
{
"key": "METH_DETERMIN",
"visible": true,
"default": true
},
{
"key": "STATUT_BIO",
"visible": true,
"default": false
},
{
"key": "OCC_COMPORTEMENT",
"visible": true,
"default": false
},
{
"key": "NATURALITE",
"visible": true,
"default": false
},
{
"key": "PREUVE_EXIST",
"visible": true,
"default": false
}
],
"counting": ["STADE_VIE", "SEXE", "OBJ_DENBR", "TYP_DENBR"]
}
}
```

Each property may be a simple string representing the nomenclature attribute to show or an object with the following properties:

| Property | Description | Mandatory |
| --------- | --------------------------------------------------------------------- | --------- |
| `key` | The nomenclature attribute | ☑ |
| `visible` | If this attribute is visible (thus editable) or not (default: `true`) | ☐ |
| `default` | If this attribute is shown by default (default: `true`) | ☐ |

**Example:**

- `"METH_OBS"` has the same meaning like

```json
{
"key": "METH_OBS"
}
```

or

```json
{
"key": "METH_OBS",
"visible": true
}
```

or

```json
{
"key": "METH_OBS",
"default": true
}
```

or

```json
{
"key": "METH_OBS",
"visible": true,
"default": true
}
```

- An omitted property (e.g. `METH_OBS`) has the same meaning like

```json
{
"key": "METH_OBS",
"visible": false
}
```

## Upgrade git sub modules

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
classpath 'com.android.tools.build:gradle:4.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jlleitschuh.gradle:ktlint-gradle:9.1.1"
// NOTE: Do not place application dependencies here; they belong
Expand Down
2 changes: 1 addition & 1 deletion gn_mobile_core
2 changes: 1 addition & 1 deletion gn_mobile_occtax.iml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="gn_mobile_occtax" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<module external.linked.project.id="gn_mobile_occtax" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
Expand Down
2 changes: 1 addition & 1 deletion occtax/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

version = "1.0.0"
version = "1.1.0"

android {
compileSdkVersion 29
Expand Down
4 changes: 3 additions & 1 deletion occtax/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
package="fr.geonature.occtax"
android:sharedUserId="@string/sharedUserId">

<uses-permission android:name="android.permission.VIBRATE"/>

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
Expand All @@ -16,7 +18,7 @@

<activity
android:name=".ui.home.HomeActivity"
android:label="@string/activity_main_title">
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand Down
20 changes: 18 additions & 2 deletions occtax/src/main/java/fr/geonature/occtax/input/CountingMetadata.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class CountingMetadata() : Parcelable {
internal set

val properties: SortedMap<String, PropertyValue> =
TreeMap<String, PropertyValue>(Comparator { o1, o2 ->
TreeMap<String, PropertyValue> { o1, o2 ->
val i1 = defaultMnemonic.indexOfFirst { it.first == o1 }
val i2 = defaultMnemonic.indexOfFirst { it.first == o2 }

Expand All @@ -25,9 +25,19 @@ class CountingMetadata() : Parcelable {
i2 == -1 -> -1
else -> i1 - i2
}
})
}
var min: Int = 1
get() = field.coerceAtLeast(0)
set(value) {
field = value.coerceAtLeast(0)
if (field > max) max = field
}
var max: Int = 1
get() = field.coerceAtLeast(0)
set(value) {
field = value.coerceAtLeast(0)
if (field < min) min = field
}

constructor(source: Parcel) : this() {
index = source.readInt()
Expand Down Expand Up @@ -84,6 +94,12 @@ class CountingMetadata() : Parcelable {

companion object {

/**
* default properties as pair:
*
* * first value: mnemonic code from nomenclature type
* * second value: the corresponding view type
*/
val defaultMnemonic = arrayOf(
Pair(
"STADE_VIE",
Expand Down
6 changes: 1 addition & 5 deletions occtax/src/main/java/fr/geonature/occtax/input/Input.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import android.os.Parcel
import android.os.Parcelable
import fr.geonature.commons.input.AbstractInput
import fr.geonature.commons.input.AbstractInputTaxon
import org.locationtech.jts.geom.Geometry
import java.util.SortedMap
import java.util.TreeMap
import org.locationtech.jts.geom.Geometry

/**
* Describes a current input.
Expand Down Expand Up @@ -86,10 +86,6 @@ class Input : AbstractInput {
companion object {

val defaultPropertiesMnemonic = arrayOf(
Pair(
"TECHNIQUE_OBS",
NomenclatureTypeViewType.NOMENCLATURE_TYPE
),
Pair(
"TYP_GRP",
NomenclatureTypeViewType.NOMENCLATURE_TYPE
Expand Down
52 changes: 36 additions & 16 deletions occtax/src/main/java/fr/geonature/occtax/input/InputTaxon.kt
Original file line number Diff line number Diff line change
Expand Up @@ -96,38 +96,58 @@ class InputTaxon : AbstractInputTaxon {

companion object {

/**
* default properties as triple:
*
* * first value: mnemonic code from nomenclature type
* * second value: the corresponding view type
* * third value: if this property is visible by default
*/
val defaultPropertiesMnemonic = arrayOf(
Pair(
Triple(
"METH_OBS",
NomenclatureTypeViewType.NOMENCLATURE_TYPE
NomenclatureTypeViewType.NOMENCLATURE_TYPE,
true
),
Pair(
Triple(
"ETA_BIO",
NomenclatureTypeViewType.NOMENCLATURE_TYPE
NomenclatureTypeViewType.NOMENCLATURE_TYPE,
true
),
Pair(
Triple(
"METH_DETERMIN",
NomenclatureTypeViewType.NOMENCLATURE_TYPE
NomenclatureTypeViewType.NOMENCLATURE_TYPE,
false
),
Pair(
Triple(
"DETERMINER",
NomenclatureTypeViewType.TEXT_SIMPLE
NomenclatureTypeViewType.TEXT_SIMPLE,
false
),
Pair(
Triple(
"STATUT_BIO",
NomenclatureTypeViewType.NOMENCLATURE_TYPE
NomenclatureTypeViewType.NOMENCLATURE_TYPE,
false
),
Pair(
Triple(
"OCC_COMPORTEMENT",
NomenclatureTypeViewType.NOMENCLATURE_TYPE,
false
),
Triple(
"NATURALITE",
NomenclatureTypeViewType.NOMENCLATURE_TYPE
NomenclatureTypeViewType.NOMENCLATURE_TYPE,
false
),
Pair(
Triple(
"PREUVE_EXIST",
NomenclatureTypeViewType.NOMENCLATURE_TYPE
NomenclatureTypeViewType.NOMENCLATURE_TYPE,
false
),
Pair(
Triple(
"COMMENT",
NomenclatureTypeViewType.TEXT_MULTIPLE
NomenclatureTypeViewType.TEXT_MULTIPLE,
false
)
)

Expand Down
Loading

0 comments on commit 146f214

Please sign in to comment.