-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
58 changed files
with
2,778 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Submodule gn_mobile_core
updated
9 files
Submodule gn_mobile_maps
updated
5 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
BIN
+102 Bytes
(100%)
occtax/src/debug/res/mipmap-xxxhdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
occtax/src/main/java/fr/geonature/occtax/input/CountingMetadata.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
package fr.geonature.occtax.input | ||
|
||
import android.os.Parcel | ||
import android.os.Parcelable | ||
import java.util.SortedMap | ||
import java.util.TreeMap | ||
|
||
/** | ||
* Counting metadata. | ||
* | ||
* @author [S. Grimault](mailto:[email protected]) | ||
*/ | ||
class CountingMetadata() : Parcelable { | ||
|
||
var index: Int = 0 | ||
internal set | ||
|
||
val properties: SortedMap<String, PropertyValue> = TreeMap<String, PropertyValue>(Comparator { o1, o2 -> | ||
val i1 = defaultMnemonicOrder.indexOfFirst { it == o1 } | ||
val i2 = defaultMnemonicOrder.indexOfFirst { it == o2 } | ||
|
||
when { | ||
i1 == -1 -> 1 | ||
i2 == -1 -> -1 | ||
else -> i1 - i2 | ||
} | ||
}) | ||
var min: Int = 0 | ||
var max: Int = 0 | ||
|
||
constructor(source: Parcel) : this() { | ||
index = source.readInt() | ||
(source.createTypedArrayList(PropertyValue.CREATOR) | ||
?: emptyList<PropertyValue>()) | ||
.forEach { | ||
this.properties[it.code] = it | ||
} | ||
min = source.readInt() | ||
max = source.readInt() | ||
} | ||
|
||
override fun describeContents(): Int { | ||
return 0 | ||
} | ||
|
||
override fun writeToParcel(dest: Parcel?, | ||
flags: Int) { | ||
dest?.also { | ||
it.writeInt(index) | ||
it.writeTypedList(this.properties.values.toList()) | ||
it.writeInt(min) | ||
it.writeInt(max) | ||
} | ||
} | ||
|
||
override fun equals(other: Any?): Boolean { | ||
if (this === other) return true | ||
if (other !is CountingMetadata) return false | ||
|
||
if (index != other.index) return false | ||
if (properties != other.properties) return false | ||
if (min != other.min) return false | ||
if (max != other.max) return false | ||
|
||
return true | ||
} | ||
|
||
override fun hashCode(): Int { | ||
var result = index | ||
result = 31 * result + properties.hashCode() | ||
result = 31 * result + min | ||
result = 31 * result + max | ||
|
||
return result | ||
} | ||
|
||
fun isEmpty(): Boolean { | ||
return properties.filterNot { it.value.isEmpty() }.isEmpty() && min == 0 && max == 0 | ||
} | ||
|
||
companion object { | ||
|
||
private val defaultMnemonicOrder = arrayOf("STADE_VIE", | ||
"SEXE", | ||
"OBJ_DENBR", | ||
"TYP_DENBR") | ||
|
||
@JvmField | ||
val CREATOR: Parcelable.Creator<CountingMetadata> = object : Parcelable.Creator<CountingMetadata> { | ||
|
||
override fun createFromParcel(source: Parcel): CountingMetadata { | ||
return CountingMetadata(source) | ||
} | ||
|
||
override fun newArray(size: Int): Array<CountingMetadata?> { | ||
return arrayOfNulls(size) | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.