Skip to content

Commit

Permalink
Merge branch 'release/0.3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
sgrimault committed Jun 7, 2020
2 parents 5441bda + 12f9c6a commit 48f5b7d
Show file tree
Hide file tree
Showing 112 changed files with 1,530 additions and 726 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.61'
ext.kotlin_version = '1.3.72'

repositories {
google()
Expand All @@ -12,7 +12,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.6.1'
classpath 'com.android.tools.build:gradle:4.0.0'
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
Submodule gn_mobile_core updated 183 files
2 changes: 1 addition & 1 deletion gn_mobile_maps
3 changes: 1 addition & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
android.enableJetifier=true
android.useAndroidX=true
kotlin.code.style=official
android.enableUnitTestBinaryResources=true
kotlin.code.style=official
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Feb 26 21:54:13 CET 2020
#Mon Jun 01 15:04:01 CEST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
20 changes: 10 additions & 10 deletions occtax/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

version = "0.3.0"
version = "0.3.1"

android {
compileSdkVersion 28
compileSdkVersion 29

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand All @@ -15,7 +15,7 @@ android {
defaultConfig {
applicationId "fr.geonature.occtax"
minSdkVersion 21
targetSdkVersion 28
targetSdkVersion 29
versionCode updateVersionCode(module.name)
versionName version
buildConfigField "String", "BUILD_DATE", "\"" + new Date().getTime() + "\""
Expand All @@ -38,7 +38,7 @@ android {

flavorDimensions "version"
productFlavors {
pnx {
generic {
}
pne {
}
Expand All @@ -61,21 +61,21 @@ dependencies {
implementation project(':maps')

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.4'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.0'

implementation 'androidx.core:core-ktx:1.3.0-alpha01'
implementation 'androidx.core:core-ktx:1.4.0-alpha01'
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0"
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.recyclerview:recyclerview:1.2.0-alpha03'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.preference:preference:1.1.0'
implementation 'androidx.preference:preference:1.1.1'
implementation 'com.l4digital.fastscroll:fastscroll:2.0.1'

testImplementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.13'
testImplementation 'androidx.test:core:1.2.0'
testImplementation 'org.robolectric:robolectric:4.3'
testImplementation 'org.robolectric:robolectric:4.3.1'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
2 changes: 1 addition & 1 deletion occtax/src/debug/res/drawable/ic_launcher_background.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
android:fillColor="#000000"
android:pathData="M55,26V25h53v1z" />
<path
android:fillAlpha="0.4"
android:fillAlpha="1.0"
android:fillColor="@color/accent"
android:pathData="M54,25V0h54v25z" />
<path
Expand Down
Binary file modified occtax/src/debug/res/mipmap-hdpi/ic_launcher.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 occtax/src/debug/res/mipmap-hdpi/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.
Binary file modified occtax/src/debug/res/mipmap-mdpi/ic_launcher.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 occtax/src/debug/res/mipmap-mdpi/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.
Binary file modified occtax/src/debug/res/mipmap-xhdpi/ic_launcher.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 occtax/src/debug/res/mipmap-xhdpi/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.
Binary file modified occtax/src/debug/res/mipmap-xxhdpi/ic_launcher.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 occtax/src/debug/res/mipmap-xxhdpi/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.
Binary file modified occtax/src/debug/res/mipmap-xxxhdpi/ic_launcher.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 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.
4 changes: 2 additions & 2 deletions occtax/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
android:screenOrientation="portrait"
tools:ignore="LockedOrientationActivity" />
<activity
android:name=".ui.input.taxa.TaxonomyFilterActivity"
android:label="@string/activity_taxonomy_title" />
android:name=".ui.input.taxa.TaxaFilterActivity"
android:label="@string/activity_taxa_filter_title" />
<activity android:name=".ui.input.counting.EditCountingMetadataActivity" />

</application>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import android.util.JsonToken
import fr.geonature.commons.data.Taxon
import fr.geonature.commons.data.Taxonomy
import fr.geonature.commons.input.io.InputJsonReader
import fr.geonature.commons.util.IsoDateUtils
import fr.geonature.commons.util.toDate
import fr.geonature.maps.jts.geojson.io.GeoJsonReader
import fr.geonature.occtax.input.CountingMetadata
import fr.geonature.occtax.input.Input
Expand Down Expand Up @@ -68,7 +68,7 @@ class OnInputJsonReaderListenerImpl : InputJsonReader.OnInputJsonReaderListener<

while (reader.hasNext()) {
when (reader.nextName()) {
"date_min" -> input.date = IsoDateUtils.toDate(reader.nextString()) ?: Date()
"date_min" -> input.date = toDate(reader.nextString()) ?: Date()
"id_dataset" -> {
if (reader.peek() != JsonToken.NULL) {
input.datasetId = reader.nextLong()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import android.text.TextUtils
import android.util.JsonWriter
import fr.geonature.commons.input.AbstractInputTaxon
import fr.geonature.commons.input.io.InputJsonWriter
import fr.geonature.commons.util.IsoDateUtils
import fr.geonature.commons.util.toIsoDateString
import fr.geonature.maps.jts.geojson.io.GeoJsonWriter
import fr.geonature.occtax.input.CountingMetadata
import fr.geonature.occtax.input.Input
Expand Down Expand Up @@ -132,7 +132,7 @@ class OnInputJsonWriterListenerImpl : InputJsonWriter.OnInputJsonWriterListener<
writer: JsonWriter,
input: Input
) {
val dateToIsoString = IsoDateUtils.toIsoDateString(input.date)
val dateToIsoString = input.date.toIsoDateString()
writer.name("date_min")
.value(dateToIsoString)
writer.name("date_max")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import fr.geonature.maps.settings.MapSettings
*/
data class AppSettings(var mapSettings: MapSettings? = null) : IAppSettings {

private constructor(source: Parcel) : this(source.readParcelable(MapSettings::class.java.classLoader) as MapSettings)
private constructor(source: Parcel) : this(source.readParcelable(MapSettings::class.java.classLoader) as MapSettings?)

override fun describeContents(): Int {
return 0
Expand Down
44 changes: 22 additions & 22 deletions occtax/src/main/java/fr/geonature/occtax/ui/home/HomeFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import fr.geonature.commons.util.PermissionUtils
import fr.geonature.commons.util.PermissionUtils.checkPermissions
import fr.geonature.commons.util.PermissionUtils.checkSelfPermissions
import fr.geonature.commons.util.PermissionUtils.requestPermissions
import fr.geonature.commons.util.observeOnce
import fr.geonature.occtax.R
import fr.geonature.occtax.input.Input
import fr.geonature.occtax.input.InputViewModel
Expand Down Expand Up @@ -368,28 +369,27 @@ class HomeFragment : Fragment() {
}

private fun loadAppSettings() {
appSettingsViewModel?.getAppSettings<AppSettings>()
?.observe(this,
Observer {
if (it?.mapSettings == null) {
fab?.hide()
adapter.clear()
activity?.invalidateOptionsMenu()

makeSnackbar(
getString(
if (it == null) R.string.snackbar_settings_not_found else R.string.snackbar_settings_map_invalid,
appSettingsViewModel?.getAppSettingsFilename()
)
)?.show()
} else {
appSettings = it
fab?.show()
activity?.invalidateOptionsMenu()

loadInputs()
}
})
appSettingsViewModel?.loadAppSettings()
?.observeOnce(this) {
if (it?.mapSettings == null) {
fab?.hide()
adapter.clear()
activity?.invalidateOptionsMenu()

makeSnackbar(
getString(
if (it == null) R.string.snackbar_settings_not_found else R.string.snackbar_settings_map_invalid,
appSettingsViewModel?.getAppSettingsFilename()
)
)?.show()
} else {
appSettings = it
fab?.show()
activity?.invalidateOptionsMenu()

loadInputs()
}
}
}

private fun loadInputs() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,17 @@ class CountingFragment : Fragment(),
val countingMetadata =
data.getParcelableExtra<CountingMetadata>(EditCountingMetadataActivity.EXTRA_COUNTING_METADATA)

if (countingMetadata == null) {
Toast.makeText(
context,
R.string.counting_toast_empty,
Toast.LENGTH_LONG
)
.show()

return
}

if (countingMetadata.isEmpty()) {
(input?.getCurrentSelectedInputTaxon() as InputTaxon?)?.deleteCountingMetadata(
countingMetadata.index
Expand Down Expand Up @@ -210,7 +221,9 @@ class CountingFragment : Fragment(),
?: emptyList()
)

if ((input?.getCurrentSelectedInputTaxon() as InputTaxon?)?.getCounting()?.isEmpty() == true) {
if ((input?.getCurrentSelectedInputTaxon() as InputTaxon?)?.getCounting()
?.isEmpty() == true
) {
val context = context ?: return
startActivityForResult(
EditCountingMetadataActivity.newIntent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,19 @@ class EditCountingMetadataActivity : AppCompatActivity(),
.replace(
android.R.id.content,
EditCountingMetadataFragment.newInstance(
intent.getParcelableExtra(EXTRA_TAXONOMY),
intent.getParcelableExtra(EXTRA_TAXONOMY) ?: Taxonomy(
Taxonomy.ANY,
Taxonomy.ANY
),
countingMetadata
)
)
.commit()
}
}

override fun onOptionsItemSelected(item: MenuItem?): Boolean {
return when (item?.itemId) {
override fun onOptionsItemSelected(item: MenuItem): Boolean {
return when (item.itemId) {
android.R.id.home -> {
sendResult()
finish()
Expand Down
Loading

0 comments on commit 48f5b7d

Please sign in to comment.