Wlo-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- 141 discussions
18 Feb '14
See <http://ci.codelutin.com/jenkins/job/wlo-ci/fr.ifremer$wlo/1/>
------------------------------------------
<===[JENKINS REMOTING CAPACITY]===> channel started
log4j:WARN No appenders could be found for logger (org.apache.commons.beanutils.converters.BooleanConverter).
log4j:WARN Please initialize the log4j system properly.
Executing Maven: -B -f <http://ci.codelutin.com/jenkins/job/wlo-ci/fr.ifremer$wlo/ws/pom.xml> -s /var/local/forge/data/codelutin.com/maven/settings.xml -e -U clean verify
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building WLO 0.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ wlo ---
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (check-project-files) @ wlo ---
[INFO]
[INFO] --- android-maven-plugin:3.8.2:generate-sources (default-generate-sources) @ wlo ---
[DEBUG] Expanding: /var/local/forge/data/codelutin.com/maven/repository/android/support/compatibility-v7-appcompat/19.0.1/compatibility-v7-appcompat-19.0.1.apklib into <http://ci.codelutin.com/jenkins/job/wlo-ci/fr.ifremer$wlo/ws/target/unpacke…>
[DEBUG] expand complete
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] Manifest merging disabled. Using project manifest only
[ERROR] Error when generating sources.
org.apache.maven.plugin.MojoExecutionException: No Android SDK path could be found. You may configure it in the plugin configuration section in the pom file using <sdk><path>...</path></sdk> or <properties><android.sdk.path>...</android.sdk.path></properties> or on command-line using -Dandroid.sdk.path=... or by setting environment variable ANDROID_HOME
at com.jayway.maven.plugins.android.AbstractAndroidMojo.getAndroidHomeOrThrow(AbstractAndroidMojo.java:1176)
at com.jayway.maven.plugins.android.AbstractAndroidMojo.getAndroidSdk(AbstractAndroidMojo.java:1129)
at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.generateR(GenerateSourcesMojo.java:481)
at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.execute(GenerateSourcesMojo.java:216)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
at org.jvnet.hudson.maven3.launcher.Maven31Launcher.main(Maven31Launcher.java:132)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
at jenkins.maven3.agent.Maven31Main.launch(Maven31Main.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:134)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:69)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:328)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
[JENKINS] Archiving disabled
1
4
See <http://ci.codelutin.com/jenkins/job/wlo-ci/1/>
------------------------------------------
[...truncated 57 lines...]
A src/fr/ifremer/wlo/models/referentials/imports/VesselRowModel.java
A src/fr/ifremer/wlo/models/referentials/imports/GenderRowModel.java
A src/fr/ifremer/wlo/models/referentials/imports/MensurationRowModel.java
A src/fr/ifremer/wlo/models/referentials/imports/MetierRowModel.java
A src/fr/ifremer/wlo/models/referentials/Maturity.java
AU src/fr/ifremer/wlo/models/ContextModel.java
A src/fr/ifremer/wlo/models/CategoryWeightModel.java
AU src/fr/ifremer/wlo/models/MeasurementModel.java
A src/fr/ifremer/wlo/models/MetierModel.java
A src/fr/ifremer/wlo/models/CommercialSpeciesModel.java
A src/fr/ifremer/wlo/models/LocationModel.java
AU src/fr/ifremer/wlo/models/MeasurementsModel.java
A src/fr/ifremer/wlo/models/BaseModel.java
A src/fr/ifremer/wlo/models/ScientificSpeciesModel.java
A src/fr/ifremer/wlo/CommercialSpeciesActivity.java
A src/fr/ifremer/wlo/measurement
AU src/fr/ifremer/wlo/measurement/MeasurementActivity.java
AU src/fr/ifremer/wlo/measurement/GraphFragment.java
AU src/fr/ifremer/wlo/measurement/LogsFragment.java
AU src/fr/ifremer/wlo/measurement/TableAdapter.java
AU src/fr/ifremer/wlo/measurement/MeasurementsDisplayerFragment.java
AU src/fr/ifremer/wlo/measurement/TableFragment.java
AU src/fr/ifremer/wlo/measurement/GraphActivity.java
A src/fr/ifremer/wlo/WloBaseListActivity.java
AU src/fr/ifremer/wlo/BigFinCommunicationService.java
AU src/fr/ifremer/wlo/DeviceListActivity.java
A src/fr/ifremer/wlo/LocationsActivity.java
A src/fr/ifremer/wlo/WloBaseActivity.java
A src/fr/ifremer/wlo/LocationFormActivity.java
A src/fr/ifremer/wlo/ScientificSpeciesActivity.java
A src/fr/ifremer/wlo/WloModelEditionActivity.java
A src/fr/ifremer/wlo/utils
A src/fr/ifremer/wlo/utils/DatePickerFragment.java
A src/fr/ifremer/wlo/utils/TimePickerFragment.java
A src/fr/ifremer/wlo/utils/AbstractDateTimePickerFragment.java
A src/fr/ifremer/wlo/utils/WloAutoCompleteTextViewWithFavorites.java
A src/fr/ifremer/wlo/utils/filechooser
A src/fr/ifremer/wlo/utils/filechooser/FileDialog.java
A src/fr/ifremer/wlo/utils/filechooser/SelectionMode.java
A src/fr/ifremer/wlo/utils/WloAutoCompleteTextView.java
A src/fr/ifremer/wlo/utils/BigFinFeedReaderRecord.java
A src/fr/ifremer/wlo/utils/BaseModelArrayAdapter.java
A src/fr/ifremer/wlo/utils/WloItemListViewBinder.java
A src/fr/ifremer/wlo/utils/BaseTextWatcher.java
AU src/fr/ifremer/wlo/utils/UIUtils.java
A src/fr/ifremer/wlo/preferences
A src/fr/ifremer/wlo/preferences/StringPreference.java
A src/fr/ifremer/wlo/preferences/WloMultiSelectListPreference.java
A src/fr/ifremer/wlo/preferences/MultiSelectItemPreference.java
A src/fr/ifremer/wlo/preferences/ListItemPreference.java
A src/fr/ifremer/wlo/preferences/SettingsActivity.java
AU src/fr/ifremer/wlo/ContextsActivity.java
A src/fr/ifremer/wlo/storage
AU src/fr/ifremer/wlo/storage/WloSqlOpenHelper.java
A src/fr/ifremer/wlo/storage/StorageUtils.java
A src/fr/ifremer/wlo/storage/DataCache.java
A src/fr/ifremer/wlo/MetiersActivity.java
A src/fr/ifremer/wlo/ContextFormActivity.java
A src/fr/ifremer/wlo/MetierFormActivity.java
A src/fr/ifremer/wlo/WeightsActivity.java
A src/fr/ifremer/wlo/CommercialSpeciesFormActivity.java
A src/fr/ifremer/wlo/ScientificSpeciesFormActivity.java
A res
A res/values
AU res/values/style.xml
A res/values/arrays.xml
A res/values/colors.xml
AU res/values/strings.xml
A res/xml
A res/xml/preferences.xml
A res/drawable
A res/drawable/favorite_toggle.xml
AU res/drawable/file.png
AU res/drawable/weight.png
AU res/drawable/app_icon.png
AU res/drawable/border_bottom.9.png
AU res/drawable/icon.png
AU res/drawable/tab_bg_selector.xml
AU res/drawable/folder.png
AU res/drawable/wlo_ico.png
A res/drawable-hdpi
AU res/drawable-hdpi/ic_drawer.png
AU res/drawable-hdpi/drawer_shadow.9.png
A res/drawable-xxhdpi
AU res/drawable-xxhdpi/ic_drawer.png
AU res/drawable-xxhdpi/drawer_shadow.9.png
A res/menu
A res/menu/form_menu.xml
A res/menu/weight_menu.xml
AU res/menu/model_list_menu.xml
A res/values-fr
A res/values-fr/arrays.xml
A res/values-fr/strings.xml
A res/drawable-mdpi
AU res/drawable-mdpi/ic_drawer.png
AU res/drawable-mdpi/drawer_shadow.9.png
A res/drawable-xhdpi
AU res/drawable-xhdpi/ic_drawer.png
AU res/drawable-xhdpi/drawer_shadow.9.png
A res/layout
A res/layout/location_list_item.xml
AU res/layout/measurement_table_row.xml
A res/layout/vessel_form.xml
AU res/layout/message.xml
AU res/layout/main.xml
A res/layout/file_dialog_row.xml
AU res/layout/measurement.xml
AU res/layout/measurement_graph_fragment.xml
A res/layout/location_form.xml
AU res/layout/measurement_logs_fragment.xml
AU res/layout/device_name.xml
AU res/layout/measurement_logs_row.xml
AU res/layout/tabs_bg.xml
A res/layout/file_dialog_main.xml
AU res/layout/measurement_graph.xml
A res/layout/context_form.xml
A res/layout/metier_form.xml
A res/layout/commercial_species_form.xml
A res/layout/vessel_list_item.xml
A res/layout/weights.xml
AU res/layout/custom_title.xml
A res/layout/autocomplete_text_view_with_favorites.xml
A res/layout/scientific_species_form.xml
AU res/layout/measurement_table_fragment.xml
AU pom.xml
AU README.txt
U .
At revision 48
Parsing POMs
Discovered a new module fr.ifremer:wlo WLO
Modules changed, recalculating dependency graph
[trunk] $ /opt/jdk7/bin/java -Dsettings.security=/var/local/forge/data/codelutin.com/maven/settings-security.xml -Djava.awt.headless=true -cp /var/local/forge/data/codelutin.com/jenkins/plugins/maven-plugin/WEB-INF/lib/maven31-agent-1.4.jar:/opt/maven3/boot/plexus-classworlds-2.5.1.jar:/opt/maven3/conf/logging jenkins.maven3.agent.Maven31Main /opt/maven3 /var/local/forge/exec/tomcat-codelutin.com/webapps/jenkins/WEB-INF/lib/remoting-2.33.jar /var/local/forge/data/codelutin.com/jenkins/plugins/maven-plugin/WEB-INF/lib/maven31-interceptor-1.4.jar /var/local/forge/data/codelutin.com/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.4.jar 39476
<===[JENKINS REMOTING CAPACITY]===> channel started
log4j:WARN No appenders could be found for logger (org.apache.commons.beanutils.converters.BooleanConverter).
log4j:WARN Please initialize the log4j system properly.
Executing Maven: -B -f <http://ci.codelutin.com/jenkins/job/wlo-ci/ws/trunk/pom.xml> -s /var/local/forge/data/codelutin.com/maven/settings.xml -e -U clean verify
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building WLO 0.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ wlo ---
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (check-project-files) @ wlo ---
[INFO]
[INFO] --- android-maven-plugin:3.8.2:generate-sources (default-generate-sources) @ wlo ---
[DEBUG] Expanding: /var/local/forge/data/codelutin.com/maven/repository/android/support/compatibility-v7-appcompat/19.0.1/compatibility-v7-appcompat-19.0.1.apklib into <http://ci.codelutin.com/jenkins/job/wlo-ci/ws/trunk/target/unpacked-libs/an…>
[DEBUG] expand complete
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] Manifest merging disabled. Using project manifest only
[ERROR] Error when generating sources.
org.apache.maven.plugin.MojoExecutionException: No Android SDK path could be found. You may configure it in the plugin configuration section in the pom file using <sdk><path>...</path></sdk> or <properties><android.sdk.path>...</android.sdk.path></properties> or on command-line using -Dandroid.sdk.path=... or by setting environment variable ANDROID_HOME
at com.jayway.maven.plugins.android.AbstractAndroidMojo.getAndroidHomeOrThrow(AbstractAndroidMojo.java:1176)
at com.jayway.maven.plugins.android.AbstractAndroidMojo.getAndroidSdk(AbstractAndroidMojo.java:1129)
at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.generateR(GenerateSourcesMojo.java:481)
at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.execute(GenerateSourcesMojo.java:216)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
at org.jvnet.hudson.maven3.launcher.Maven31Launcher.main(Maven31Launcher.java:132)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
at jenkins.maven3.agent.Maven31Main.launch(Maven31Main.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:134)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:69)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:328)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.735s
[INFO] Finished at: Fri Feb 14 19:20:28 CET 2014
[INFO] Final Memory: 18M/309M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.2:generate-sources (default-generate-sources) on project wlo: No Android SDK path could be found. You may configure it in the plugin configuration section in the pom file using <sdk><path>...</path></sdk> or <properties><android.sdk.path>...</android.sdk.path></properties> or on command-line using -Dandroid.sdk.path=... or by setting environment variable ANDROID_HOME -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.2:generate-sources (default-generate-sources) on project wlo: No Android SDK path could be found. You may configure it in the plugin configuration section in the pom file using <sdk><path>...</path></sdk> or <properties><android.sdk.path>...</android.sdk.path></properties> or on command-line using -Dandroid.sdk.path=... or by setting environment variable ANDROID_HOME
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
at org.jvnet.hudson.maven3.launcher.Maven31Launcher.main(Maven31Launcher.java:132)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
at jenkins.maven3.agent.Maven31Main.launch(Maven31Main.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:134)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:69)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:328)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.apache.maven.plugin.MojoExecutionException: No Android SDK path could be found. You may configure it in the plugin configuration section in the pom file using <sdk><path>...</path></sdk> or <properties><android.sdk.path>...</android.sdk.path></properties> or on command-line using -Dandroid.sdk.path=... or by setting environment variable ANDROID_HOME
at com.jayway.maven.plugins.android.AbstractAndroidMojo.getAndroidHomeOrThrow(AbstractAndroidMojo.java:1176)
at com.jayway.maven.plugins.android.AbstractAndroidMojo.getAndroidSdk(AbstractAndroidMojo.java:1129)
at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.generateR(GenerateSourcesMojo.java:481)
at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.execute(GenerateSourcesMojo.java:216)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 30 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Sending e-mails to: wlo-commits(a)list.forge.codelutin.com
channel stopped
1
4
r49 - in trunk: res/layout res/values res/values-fr res/xml src/fr/ifremer/wlo src/fr/ifremer/wlo/measurement src/fr/ifremer/wlo/models src/fr/ifremer/wlo/storage src/fr/ifremer/wlo/utils
by kmorin@users.forge.codelutin.com 17 Feb '14
by kmorin@users.forge.codelutin.com 17 Feb '14
17 Feb '14
Author: kmorin
Date: 2014-02-17 14:32:31 +0100 (Mon, 17 Feb 2014)
New Revision: 49
Url: http://forge.codelutin.com/projects/wlo/repository/revisions/49
Log:
refs #4264 Recevoir les mesures de l'ichtyom?\195?\168tre
fixes #4192 [SAISIE] ?\195?\137cran des poids [niveau 5 ?\195?\160 7]
Added:
trunk/res/layout/vertical_separator.xml
Modified:
trunk/res/layout/weights.xml
trunk/res/values-fr/strings.xml
trunk/res/values/strings.xml
trunk/res/xml/preferences.xml
trunk/src/fr/ifremer/wlo/WeightsActivity.java
trunk/src/fr/ifremer/wlo/measurement/MeasurementActivity.java
trunk/src/fr/ifremer/wlo/models/CategoryWeightModel.java
trunk/src/fr/ifremer/wlo/models/ScientificSpeciesModel.java
trunk/src/fr/ifremer/wlo/storage/WloSqlOpenHelper.java
trunk/src/fr/ifremer/wlo/utils/WloAutoCompleteTextView.java
Added: trunk/res/layout/vertical_separator.xml
===================================================================
--- trunk/res/layout/vertical_separator.xml (rev 0)
+++ trunk/res/layout/vertical_separator.xml 2014-02-17 13:32:31 UTC (rev 49)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<View xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="2dip"
+ android:layout_marginTop="5dip"
+ android:layout_marginBottom="5dip"
+ android:background="@android:color/darker_gray"/>
\ No newline at end of file
Modified: trunk/res/layout/weights.xml
===================================================================
--- trunk/res/layout/weights.xml 2014-02-14 14:49:07 UTC (rev 48)
+++ trunk/res/layout/weights.xml 2014-02-17 13:32:31 UTC (rev 49)
@@ -10,19 +10,11 @@
android:layout_weight="1"
android:fillViewport="true">
- <LinearLayout android:orientation="vertical"
+ <LinearLayout android:id="@+id/container"
+ android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
- <TextView android:text="@string/commercial_species_total_unloaded_weight"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"/>
-
- <EditText android:id="@+id/total_unloaded_weight"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:inputType="numberDecimal"/>
-
</LinearLayout>
</ScrollView>
Modified: trunk/res/values/strings.xml
===================================================================
--- trunk/res/values/strings.xml 2014-02-14 14:49:07 UTC (rev 48)
+++ trunk/res/values/strings.xml 2014-02-17 13:32:31 UTC (rev 49)
@@ -171,6 +171,8 @@
<!-- Weights -->
<string name="weights_title">Weights</string>
<string name="commercial_species_total_unloaded_weight">Total unloaded weight</string>
+ <string name="scientific_species_sample_weight">Sample weight</string>
+ <string name="scientific_species_categories">Weights per category</string>
<!--File chooser-->
<string name="file_chooser_location">Location</string>
Modified: trunk/res/values-fr/strings.xml
===================================================================
--- trunk/res/values-fr/strings.xml 2014-02-14 14:49:07 UTC (rev 48)
+++ trunk/res/values-fr/strings.xml 2014-02-17 13:32:31 UTC (rev 49)
@@ -164,6 +164,8 @@
<!-- Weights -->
<string name="weights_title">Poids</string>
<string name="commercial_species_total_unloaded_weight">Poids total débarqué</string>
+ <string name="scientific_species_sample_weight">Poids d\'échantillon</string>
+ <string name="scientific_species_categories">Poids par catégorie</string>
<!--File chooser-->
<string name="file_chooser_location">Emplacement</string>
Modified: trunk/res/xml/preferences.xml
===================================================================
--- trunk/res/xml/preferences.xml 2014-02-14 14:49:07 UTC (rev 48)
+++ trunk/res/xml/preferences.xml 2014-02-17 13:32:31 UTC (rev 49)
@@ -16,7 +16,7 @@
android:title="@string/preferences_weight_unit"
android:entries="@array/preferences_weight_unit_entries"
android:entryValues="@array/preferences_weight_unit_values"
- android:defaultValue="0"/>
+ android:defaultValue="1"/>
<ListPreference android:key="preferences_date_format"
android:title="@string/preferences_date_format"
Modified: trunk/src/fr/ifremer/wlo/WeightsActivity.java
===================================================================
--- trunk/src/fr/ifremer/wlo/WeightsActivity.java 2014-02-14 14:49:07 UTC (rev 48)
+++ trunk/src/fr/ifremer/wlo/WeightsActivity.java 2014-02-17 13:32:31 UTC (rev 49)
@@ -1,19 +1,31 @@
package fr.ifremer.wlo;
import android.content.Intent;
+import android.content.SharedPreferences;
+import android.database.Cursor;
+import android.graphics.Typeface;
import android.os.Bundle;
+import android.preference.PreferenceManager;
+import android.text.InputType;
+import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
-import com.google.common.collect.Multimap;
-import fr.ifremer.wlo.models.BaseModel;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+import com.google.common.base.Function;
+import fr.ifremer.wlo.models.CategoryWeightModel;
import fr.ifremer.wlo.models.CommercialSpeciesModel;
+import fr.ifremer.wlo.models.ScientificSpeciesModel;
+import fr.ifremer.wlo.preferences.ListItemPreference;
+import fr.ifremer.wlo.preferences.StringPreference;
+import fr.ifremer.wlo.storage.DataCache;
import fr.ifremer.wlo.storage.WloSqlOpenHelper;
import fr.ifremer.wlo.utils.BaseTextWatcher;
import org.apache.commons.lang3.StringUtils;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Collection;
+import java.util.ArrayList;
+import java.util.List;
/**
* @author Kevin Morin (Code Lutin)
@@ -25,32 +37,131 @@
public static final String INTENT_COMMERCIAL_SPECIES = "commercialSpecies";
+ protected LinearLayout container;
+
protected CommercialSpeciesModel commercialSpeciesModel;
+ protected List<ScientificSpeciesModel> scientficSpeciesModels;
+
+ protected List<CategoryWeightModel> categoryWeightModels = new ArrayList<>();
+
+ protected int weightUnit;
+
+ protected String weightUnitLabel;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ container = (LinearLayout) findViewById(R.id.container);
+
+ SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
+ String weightUnitString = sharedPref.getString(ListItemPreference.WEIGHT_UNIT.getKey(), "1");
+ weightUnit = Integer.parseInt(weightUnitString);
+ switch (weightUnit) {
+ case 1000:
+ weightUnitLabel = "kg";
+ break;
+ default:
+ weightUnitLabel = "g";
+ break;
+ }
+
commercialSpeciesModel = (CommercialSpeciesModel) getIntent().getSerializableExtra(INTENT_COMMERCIAL_SPECIES);
getSupportActionBar().setSubtitle(commercialSpeciesModel.toString(this));
- final EditText totalUnloadedWeightText = (EditText) findViewById(R.id.total_unloaded_weight);
- Log.d(TAG, "TotalUnloadedWeight " + commercialSpeciesModel.getTotalUnloadedWeight());
- totalUnloadedWeightText.setText(String.valueOf(commercialSpeciesModel.getTotalUnloadedWeight()));
- totalUnloadedWeightText.addTextChangedListener(new BaseTextWatcher() {
+ // create total unloaded weight label
+ createWeightLabel(getString(R.string.commercial_species_total_unloaded_weight));
+
+ // create total unloaded weight field
+ createEditText(commercialSpeciesModel.getTotalUnloadedWeight(), new Function<Integer, Void>() {
@Override
- public void onTextChanged(CharSequence s, int start, int before, int count) {
- Integer newValue = null;
- Log.d(TAG, "onTextChanged " + s);
- if (StringUtils.isNotEmpty(s)) {
- newValue = Integer.parseInt(s.toString());
- }
- Log.d(TAG, "TotalUnloadedWeight " + newValue);
- commercialSpeciesModel.setTotalUnloadedWeight(newValue);
- totalUnloadedWeightText.setSelection(start + count);
+ public Void apply(Integer input) {
+ commercialSpeciesModel.setTotalUnloadedWeight(input);
+ return null;
}
+ });
+ // get all scientific species
+ WloSqlOpenHelper woh = new WloSqlOpenHelper(this);
+ Cursor allScientificSpeciesCursor = woh.getAllScientificSpecies(commercialSpeciesModel.getId());
+ scientficSpeciesModels = WloSqlOpenHelper.transformCursorIntoCollection(allScientificSpeciesCursor,
+ new Function<Cursor, ScientificSpeciesModel>() {
+ @Override
+ public ScientificSpeciesModel apply(Cursor input) {
+ ScientificSpeciesModel scientificSpeciesModel =
+ new ScientificSpeciesModel(WeightsActivity.this, input);
+ scientificSpeciesModel.setParent(commercialSpeciesModel);
+ return scientificSpeciesModel;
+ }
});
+
+ for (final ScientificSpeciesModel scientificSpecies : scientficSpeciesModels) {
+
+ // add separator
+ getLayoutInflater().inflate(R.layout.vertical_separator, container);
+
+ // add label
+ TextView labelView = new TextView(this);
+ labelView.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
+ labelView.setTextAppearance(this, android.R.style.TextAppearance_Large);
+ labelView.setText(scientificSpecies.toString(this));
+ container.addView(labelView);
+
+ // add label
+ createWeightLabel(getString(R.string.scientific_species_sample_weight));
+
+ // create the sample weight field
+ createEditText(scientificSpecies.getSampleWeight(), new Function<Integer, Void>() {
+ @Override
+ public Void apply(Integer input) {
+ scientificSpecies.setSampleWeight(input);
+ return null;
+ }
+ });
+
+ // weight per category
+ TextView weightByCategoryView = new TextView(this);
+ weightByCategoryView.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
+ weightByCategoryView.setTextAppearance(this, android.R.style.TextAppearance_Medium);
+ weightByCategoryView.setText(R.string.scientific_species_categories);
+ container.addView(weightByCategoryView);
+
+ // get all the category weights
+ Cursor categoryWeighs = woh.getAllCategoryWeigths(scientificSpecies.getId());
+ categoryWeightModels = WloSqlOpenHelper.transformCursorIntoCollection(categoryWeighs,
+ new Function<Cursor, CategoryWeightModel>() {
+ @Override
+ public CategoryWeightModel apply(Cursor input) {
+ CategoryWeightModel result = new CategoryWeightModel(input);
+ result.setParent(scientificSpecies);
+ return result;
+ }
+ });
+
+ for (final CategoryWeightModel categoryWeightModel : categoryWeightModels) {
+
+ // create the weight field
+ String category1Id = categoryWeightModel.getCategory1();
+ String category2Id = categoryWeightModel.getCategory2();
+ String category3Id = categoryWeightModel.getCategory3();
+ String label = (category1Id != null ? DataCache.getGenderById(this, category1Id).getLabel() : "NA") + ", " +
+ (category2Id != null ? DataCache.getMaturityById(this, category2Id).getLabel() : "NA") + ", " +
+ (category3Id != null ? DataCache.getAgeById(this, category3Id).getLabel() : "NA");
+
+ // add label
+ createWeightLabel(label);
+
+ createEditText(categoryWeightModel.getWeight(), new Function<Integer, Void>() {
+ @Override
+ public Void apply(Integer input) {
+ categoryWeightModel.setWeight(input);
+ return null;
+ }
+ });
+ }
+ }
+ woh.close();
}
@Override
@@ -63,6 +174,13 @@
return ScientificSpeciesActivity.class;
}
+ @Override
+ public Intent getSupportParentActivityIntent() {
+ Intent intent = super.getSupportParentActivityIntent();
+ intent.putExtra(ScientificSpeciesActivity.INTENT_EXTRA_PARENT_MODEL, commercialSpeciesModel);
+ return intent;
+ }
+
public void validate(View view) {
saveModel();
finish();
@@ -70,9 +188,56 @@
/* Protected methods */
+ protected TextView createWeightLabel(String label) {
+ TextView textView = new TextView(this);
+ textView.setText(label + " (" + weightUnitLabel + ")");
+ container.addView(textView);
+ return textView;
+ }
+
+ protected TextWatcher getTextWatcher(final EditText editText, final Function<Integer, Void> setWeightFunction) {
+ return new BaseTextWatcher() {
+ @Override
+ public void onTextChanged(CharSequence s, int start, int before, int count) {
+ Integer newValue = null;
+ if (StringUtils.isNotEmpty(s)) {
+ newValue = Integer.parseInt(s.toString());
+ }
+ setWeightFunction.apply(newValue);
+ editText.setSelection(start + count);
+ }
+ };
+ }
+
+ protected EditText createEditText(Integer value, Function<Integer, Void> setWeightFunction) {
+ final EditText editText = new EditText(this);
+
+ int inputType = InputType.TYPE_CLASS_NUMBER;
+ String textValue;
+
+ if (weightUnit > 1) {
+ inputType |= InputType.TYPE_NUMBER_FLAG_DECIMAL;
+ }
+
+ if (weightUnit > 1 && value != null) {
+ float floatValue = (float) value / weightUnit;
+ textValue = String.format("%.3f", floatValue);
+
+ } else {
+ textValue = String.valueOf(value);
+ }
+ editText.setInputType(inputType);
+ editText.setText(textValue);
+ editText.addTextChangedListener(getTextWatcher(editText, setWeightFunction));
+ container.addView(editText);
+
+ return editText;
+ }
+
protected void saveModel() {
WloSqlOpenHelper woh = new WloSqlOpenHelper(this);
- Log.d(TAG, "TotalUnloadedWeight " + commercialSpeciesModel.getTotalUnloadedWeight());
+ woh.saveData(categoryWeightModels);
+ woh.saveData(scientficSpeciesModels);
woh.saveData(commercialSpeciesModel);
woh.close();
}
Modified: trunk/src/fr/ifremer/wlo/measurement/MeasurementActivity.java
===================================================================
--- trunk/src/fr/ifremer/wlo/measurement/MeasurementActivity.java 2014-02-14 14:49:07 UTC (rev 48)
+++ trunk/src/fr/ifremer/wlo/measurement/MeasurementActivity.java 2014-02-17 13:32:31 UTC (rev 49)
@@ -35,6 +35,7 @@
import android.os.Message;
import android.os.Messenger;
import android.os.Vibrator;
+import android.speech.tts.TextToSpeech;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.widget.DrawerLayout;
import android.text.Editable;
@@ -63,25 +64,20 @@
import fr.ifremer.wlo.VesselFormActivity;
import fr.ifremer.wlo.WloBaseActivity;
import fr.ifremer.wlo.WloModelEditionActivity;
-import fr.ifremer.wlo.models.referentials.Age;
-import fr.ifremer.wlo.models.referentials.Maturity;
+import fr.ifremer.wlo.models.CategoryWeightModel;
import fr.ifremer.wlo.models.referentials.Mensuration;
import fr.ifremer.wlo.storage.DataCache;
import fr.ifremer.wlo.models.BaseModel;
import fr.ifremer.wlo.models.CommercialSpeciesModel;
-import fr.ifremer.wlo.models.LocationModel;
import fr.ifremer.wlo.models.MeasurementModel;
import fr.ifremer.wlo.models.MeasurementsModel;
import fr.ifremer.wlo.models.MetierModel;
import fr.ifremer.wlo.models.ScientificSpeciesModel;
import fr.ifremer.wlo.models.VesselModel;
-import fr.ifremer.wlo.models.referentials.Gender;
import fr.ifremer.wlo.storage.WloSqlOpenHelper;
-import fr.ifremer.wlo.utils.BaseModelArrayAdapter;
import fr.ifremer.wlo.utils.BaseTextWatcher;
import fr.ifremer.wlo.utils.BigFinFeedReaderRecord;
import fr.ifremer.wlo.utils.UIUtils;
-import org.apache.commons.lang3.ObjectUtils;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
@@ -95,7 +91,7 @@
* @author kmorin <kmorin(a)codelutin.com>
* @since 0.1
*/
-public class MeasurementActivity extends WloBaseActivity implements AdapterView.OnItemSelectedListener {
+public class MeasurementActivity extends WloBaseActivity implements AdapterView.OnItemSelectedListener, TextToSpeech.OnInitListener {
private static final String TAG = "MeasurementActivity";
@@ -106,6 +102,8 @@
protected static final String TABLE_TAB = "table";
protected static final String LOGS_TAB = "logs";
+ protected static final int CHECK_TTS_REQUEST_CODE = 42;
+
protected WloSqlOpenHelper soh = new WloSqlOpenHelper(this);
protected TabHost tabs;
@@ -124,6 +122,9 @@
protected ListView mDrawerList;
+ protected TextToSpeech textToSpeech;
+ protected boolean useTextToSpeech = false;
+
@Override
protected Integer getContentView() {
return R.layout.measurement;
@@ -289,22 +290,33 @@
BigFinFeedReaderRecord record = (BigFinFeedReaderRecord) msg.obj;
if (record != null && record.getLength() != null) {
- final ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, ToneGenerator.MAX_VOLUME);
- tg.startTone(ToneGenerator.TONE_PROP_BEEP);
+ int size = Math.round(record.getLength());
+ measurement.setSize(size);
+ MeasurementModel savedMeasurement = addMeasurement();
+
+ if (useTextToSpeech) {
+ String formattedSize = UIUtils.getFormattedSize(savedMeasurement.getSize(), measurements.getPrecision());
+ textToSpeech.speak(formattedSize, TextToSpeech.QUEUE_ADD, null);
+
+ } else {
+ ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, ToneGenerator.MAX_VOLUME);
+ tg.startTone(ToneGenerator.TONE_PROP_BEEP);
+ }
+
// Get instance of Vibrator from current Context
Vibrator v = (Vibrator) getSystemService(VIBRATOR_SERVICE);
// Vibrate for 300 milliseconds
v.vibrate(300);
-
- int size = Math.round(record.getLength());
- measurement.setSize(size);
- addMeasurement(null);
}
break;
}
}
});
+
+ Intent checkIntent = new Intent();
+ checkIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);
+ startActivityForResult(checkIntent, CHECK_TTS_REQUEST_CODE);
}
@Override
@@ -317,7 +329,15 @@
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
- if (resultCode == RESULT_OK) {
+
+ if (requestCode == CHECK_TTS_REQUEST_CODE && resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) {
+ // Succès, au moins un moteur de TTS à été trouvé, on l'instancie
+ textToSpeech = new TextToSpeech(this, this);
+ if (textToSpeech.isLanguageAvailable(Locale.FRANCE) == TextToSpeech.LANG_COUNTRY_AVAILABLE) {
+ textToSpeech.setLanguage(Locale.FRANCE);
+ }
+
+ } else if (resultCode == RESULT_OK) {
switch (requestCode) {
case 1:
vessel = (VesselModel) data.getSerializableExtra(WloModelEditionActivity.INTENT_EXTRA_MODEL);
@@ -359,6 +379,7 @@
protected void onDestroy() {
super.onDestroy();
soh.close();
+ textToSpeech.shutdown();
}
@Override
@@ -398,6 +419,11 @@
}
}
+ @Override
+ public void onInit(int status) {
+ useTextToSpeech = status == TextToSpeech.SUCCESS;
+ }
+
/* Public methods */
public void incSize(View source) {
@@ -409,20 +435,40 @@
}
public void addMeasurement(View source) {
+ addMeasurement();
+ }
+
+ /* Protected methods */
+
+ protected MeasurementModel addMeasurement() {
measurement.setDate(Calendar.getInstance());
measurement.roundSize(measurements.getPrecision());
- soh.saveData(measurement);
- measurements.addMeasurement(measurement);
Integer size = measurement.getSize();
String cat1 = measurement.getCategory1();
String cat2 = measurement.getCategory2();
String cat3 = measurement.getCategory3();
+
+ Cursor categoryWeightModelCursor = soh.getCategoryWeight(scientificSpecies.getId(), cat1, cat2, cat3);
+ if (categoryWeightModelCursor.getCount() == 0) {
+ CategoryWeightModel categoryWeightModel = new CategoryWeightModel();
+ categoryWeightModel.setCategory1(cat1);
+ categoryWeightModel.setCategory2(cat2);
+ categoryWeightModel.setCategory3(cat3);
+ categoryWeightModel.setParent(scientificSpecies);
+ soh.saveData(categoryWeightModel);
+ }
+
+ soh.saveData(measurement);
+ measurements.addMeasurement(measurement);
+
+ MeasurementModel result = measurement;
+
initFishMeasurement(size, cat1, cat2, cat3);
+
+ return result;
}
- /* Protected methods */
-
protected void initFishMeasurement(Integer size, String cat1, String cat2, String cat3) {
measurement = new MeasurementModel();
measurement.addPropertyChangeListener(new PropertyChangeListener() {
Modified: trunk/src/fr/ifremer/wlo/models/CategoryWeightModel.java
===================================================================
--- trunk/src/fr/ifremer/wlo/models/CategoryWeightModel.java 2014-02-14 14:49:07 UTC (rev 48)
+++ trunk/src/fr/ifremer/wlo/models/CategoryWeightModel.java 2014-02-17 13:32:31 UTC (rev 49)
@@ -36,7 +36,7 @@
protected String category1;
protected String category2;
protected String category3;
- protected int weight;
+ protected Integer weight;
public CategoryWeightModel() {
}
@@ -78,11 +78,11 @@
firePropertyChange(COLUMN_CATEGORY_3, oldValue, category3);
}
- public int getWeight() {
+ public Integer getWeight() {
return weight;
}
- public void setWeight(int weight) {
+ public void setWeight(Integer weight) {
Object oldValue = this.weight;
this.weight = weight;
firePropertyChange(COLUMN_WEIGHT, oldValue, weight);
Modified: trunk/src/fr/ifremer/wlo/models/ScientificSpeciesModel.java
===================================================================
--- trunk/src/fr/ifremer/wlo/models/ScientificSpeciesModel.java 2014-02-14 14:49:07 UTC (rev 48)
+++ trunk/src/fr/ifremer/wlo/models/ScientificSpeciesModel.java 2014-02-17 13:32:31 UTC (rev 49)
@@ -58,7 +58,7 @@
protected ScientificSpecies name;
protected boolean takingActivation;
protected String comment;
- protected int sampleWeight;
+ protected Integer sampleWeight;
public ScientificSpeciesModel() {
}
@@ -102,11 +102,11 @@
firePropertyChange(COLUMN_COMMENT, oldValue, comment);
}
- public int getSampleWeight() {
+ public Integer getSampleWeight() {
return sampleWeight;
}
- public void setSampleWeight(int sampleWeight) {
+ public void setSampleWeight(Integer sampleWeight) {
Object oldValue = this.sampleWeight;
this.sampleWeight = sampleWeight;
firePropertyChange(COLUMN_SAMPLE_WEIGHT, oldValue, sampleWeight);
Modified: trunk/src/fr/ifremer/wlo/storage/WloSqlOpenHelper.java
===================================================================
--- trunk/src/fr/ifremer/wlo/storage/WloSqlOpenHelper.java 2014-02-14 14:49:07 UTC (rev 48)
+++ trunk/src/fr/ifremer/wlo/storage/WloSqlOpenHelper.java 2014-02-17 13:32:31 UTC (rev 49)
@@ -67,7 +67,7 @@
private static final String TAG = "WloOpenHelper";
public static final String DATABASE_NAME = "wlo.db";
- public static final int DATABASE_VERSION = 15;
+ public static final int DATABASE_VERSION = 16;
public static final String TEXT_TYPE = " TEXT";
public static final String BIGINT_TYPE = " BIGINT";
@@ -532,6 +532,22 @@
return cursor;
}
+ public Cursor getCategoryWeight(String scientificSpeciesId, String category1Id,
+ String category2Id, String category3Id) {
+ SQLiteDatabase db = getReadableDatabase();
+ String cat1Condition = category1Id == null ? " IS NULL" : " = '" + category1Id + "'";
+ String cat2Condition = category2Id == null ? " IS NULL" : " = '" + category2Id + "'";
+ String cat3Condition = category3Id == null ? " IS NULL" : " = '" + category3Id + "'";
+ Cursor cursor = db.query(CategoryWeightModel.TABLE_NAME, CategoryWeightModel.ALL_COLUMNS,
+ CategoryWeightModel.COLUMN_SCIENTIFIC_SPECIES_ID + " = ? AND " +
+ CategoryWeightModel.COLUMN_CATEGORY_1 + cat1Condition + " AND " +
+ CategoryWeightModel.COLUMN_CATEGORY_2 + cat2Condition + " AND " +
+ CategoryWeightModel.COLUMN_CATEGORY_3 + cat3Condition,
+ new String[]{ scientificSpeciesId },
+ null, null, null);
+ return cursor;
+ }
+
// Referentials
public Cursor getAllRefAges() {
Modified: trunk/src/fr/ifremer/wlo/utils/WloAutoCompleteTextView.java
===================================================================
--- trunk/src/fr/ifremer/wlo/utils/WloAutoCompleteTextView.java 2014-02-14 14:49:07 UTC (rev 48)
+++ trunk/src/fr/ifremer/wlo/utils/WloAutoCompleteTextView.java 2014-02-17 13:32:31 UTC (rev 49)
@@ -28,6 +28,7 @@
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
+import android.view.inputmethod.EditorInfo;
import android.widget.AdapterView;
import android.widget.AutoCompleteTextView;
@@ -80,6 +81,7 @@
}
}
});
+ setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
}
@Override
1
0
r48 - in trunk: . res/layout src/fr/ifremer/wlo src/fr/ifremer/wlo/measurement src/fr/ifremer/wlo/utils
by kmorin@users.forge.codelutin.com 14 Feb '14
by kmorin@users.forge.codelutin.com 14 Feb '14
14 Feb '14
Author: kmorin
Date: 2014-02-14 15:49:07 +0100 (Fri, 14 Feb 2014)
New Revision: 48
Url: http://forge.codelutin.com/projects/wlo/repository/revisions/48
Log:
fixes #4264 Recevoir les mesures de l'ichtyom?\195?\168tre
Added:
trunk/src/fr/ifremer/wlo/utils/BigFinFeedReaderRecord.java
Modified:
trunk/AndroidManifest.xml
trunk/res/layout/measurement.xml
trunk/src/fr/ifremer/wlo/BigFinCommunicationService.java
trunk/src/fr/ifremer/wlo/DeviceListActivity.java
trunk/src/fr/ifremer/wlo/MainActivity.java
trunk/src/fr/ifremer/wlo/measurement/MeasurementActivity.java
Modified: trunk/AndroidManifest.xml
===================================================================
--- trunk/AndroidManifest.xml 2014-02-13 21:28:40 UTC (rev 47)
+++ trunk/AndroidManifest.xml 2014-02-14 14:49:07 UTC (rev 48)
@@ -23,6 +23,7 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH" />
+ <uses-permission android:name="android.permission.VIBRATE"/>
<application android:label="@string/app_name"
android:icon="@drawable/wlo_ico"
Modified: trunk/res/layout/measurement.xml
===================================================================
--- trunk/res/layout/measurement.xml 2014-02-13 21:28:40 UTC (rev 47)
+++ trunk/res/layout/measurement.xml 2014-02-14 14:49:07 UTC (rev 48)
@@ -4,7 +4,8 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_height="match_parent"
+ android:keepScreenOn="true">
<LinearLayout android:orientation="horizontal"
android:layout_width="match_parent"
Modified: trunk/src/fr/ifremer/wlo/BigFinCommunicationService.java
===================================================================
--- trunk/src/fr/ifremer/wlo/BigFinCommunicationService.java 2014-02-13 21:28:40 UTC (rev 47)
+++ trunk/src/fr/ifremer/wlo/BigFinCommunicationService.java 2014-02-14 14:49:07 UTC (rev 48)
@@ -58,6 +58,7 @@
import android.support.v4.app.TaskStackBuilder;
import android.util.Log;
import com.google.common.collect.Lists;
+import fr.ifremer.wlo.utils.BigFinFeedReaderRecord;
import java.io.IOException;
import java.io.InputStream;
@@ -552,17 +553,48 @@
while (true) {
try {
// Read from the InputStream
- bytes = mmInStream.read(buffer);
+// bytes = mmInStream.read(buffer);
- Log.d(TAG, "received " + new String(buffer, 0, bytes));
+// Log.d(TAG, "received " + new String(buffer, 0, bytes));
+ String result = "";
+
+ // wait until got a @
+
+ boolean complete = false;
+ while (!complete) {
+ while (mmInStream.available() > 0) {
+// if (stop) {
+// break;
+// }
+ int c = mmInStream.read();
+ if (c == '@') {
+ complete = true;
+ } else {
+ result += (char) c;
+ }
+ }
+ }
+
+// int atSignIndex = result.indexOf('@');
+// result = result.substring(0, atSignIndex);
+
+ int lastComma = result.lastIndexOf(',');
+ result = result.substring(0, lastComma);
+
+ lastComma = result.lastIndexOf(',') + 1;
+ String record = result.substring(0, lastComma);
+
+ String crc = result.substring(lastComma);
+
+ Log.d(TAG, String.format("Record: %s / %s", record, crc));
+ BigFinFeedReaderRecord readerRecord = new BigFinFeedReaderRecord(record, crc);
+
// Send the obtained bytes to the UI Activity
+ sendMessage(MESSAGE_READ, -1, -1, readerRecord);
- sendMessage(MESSAGE_READ, bytes, -1, buffer);
-
} catch (IOException e) {
Log.e(TAG, "disconnected", e);
connectionLost();
- break;
}
}
}
Modified: trunk/src/fr/ifremer/wlo/DeviceListActivity.java
===================================================================
--- trunk/src/fr/ifremer/wlo/DeviceListActivity.java 2014-02-13 21:28:40 UTC (rev 47)
+++ trunk/src/fr/ifremer/wlo/DeviceListActivity.java 2014-02-14 14:49:07 UTC (rev 48)
@@ -19,8 +19,8 @@
/*
* #%L
* WLO
- * $Id:$
- * $HeadURL:$
+ * $Id$
+ * $HeadURL$
* %%
* Copyright (C) 2013 - 2014 Ifremer
* %%
@@ -62,6 +62,7 @@
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
+import fr.ifremer.wlo.utils.BigFinFeedReaderRecord;
import java.util.Set;
@@ -323,10 +324,9 @@
break;
case BigFinCommunicationService.MESSAGE_READ:
- byte[] readBuf = (byte[]) msg.obj;
+ BigFinFeedReaderRecord record = (BigFinFeedReaderRecord) msg.obj;
// construct a string from the valid bytes in the buffer
- String readMessage = new String(readBuf, 0, msg.arg1);
- Log.d(TAG, "read " + readMessage);
+ Log.d(TAG, "read " + record.getLength());
break;
case BigFinCommunicationService.MESSAGE_DEVICE_NAME:
Modified: trunk/src/fr/ifremer/wlo/MainActivity.java
===================================================================
--- trunk/src/fr/ifremer/wlo/MainActivity.java 2014-02-13 21:28:40 UTC (rev 47)
+++ trunk/src/fr/ifremer/wlo/MainActivity.java 2014-02-14 14:49:07 UTC (rev 48)
@@ -41,6 +41,7 @@
import fr.ifremer.wlo.preferences.SettingsActivity;
import fr.ifremer.wlo.storage.DataCache;
import fr.ifremer.wlo.storage.WloSqlOpenHelper;
+import fr.ifremer.wlo.utils.BigFinFeedReaderRecord;
import java.io.IOException;
Modified: trunk/src/fr/ifremer/wlo/measurement/MeasurementActivity.java
===================================================================
--- trunk/src/fr/ifremer/wlo/measurement/MeasurementActivity.java 2014-02-13 21:28:40 UTC (rev 47)
+++ trunk/src/fr/ifremer/wlo/measurement/MeasurementActivity.java 2014-02-14 14:49:07 UTC (rev 48)
@@ -28,7 +28,13 @@
import android.content.Intent;
import android.content.res.Configuration;
import android.database.Cursor;
+import android.media.AudioManager;
+import android.media.ToneGenerator;
import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.os.Messenger;
+import android.os.Vibrator;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.widget.DrawerLayout;
import android.text.Editable;
@@ -47,6 +53,7 @@
import android.widget.TextView;
import com.google.common.base.Function;
import com.google.common.collect.Lists;
+import fr.ifremer.wlo.BigFinCommunicationService;
import fr.ifremer.wlo.CommercialSpeciesFormActivity;
import fr.ifremer.wlo.MainActivity;
import fr.ifremer.wlo.MetierFormActivity;
@@ -72,6 +79,7 @@
import fr.ifremer.wlo.storage.WloSqlOpenHelper;
import fr.ifremer.wlo.utils.BaseModelArrayAdapter;
import fr.ifremer.wlo.utils.BaseTextWatcher;
+import fr.ifremer.wlo.utils.BigFinFeedReaderRecord;
import fr.ifremer.wlo.utils.UIUtils;
import org.apache.commons.lang3.ObjectUtils;
@@ -272,6 +280,31 @@
commercialSpecies.getPrecision());
actionBar.setSubtitle(vessel.toString(this) + " / " +
metier.toString(this));
+
+ mMessenger = new Messenger(new Handler() {
+ @Override
+ public void handleMessage(Message msg) {
+ switch (msg.what) {
+ case BigFinCommunicationService.MESSAGE_READ:
+ BigFinFeedReaderRecord record = (BigFinFeedReaderRecord) msg.obj;
+
+ if (record != null && record.getLength() != null) {
+ final ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, ToneGenerator.MAX_VOLUME);
+ tg.startTone(ToneGenerator.TONE_PROP_BEEP);
+
+ // Get instance of Vibrator from current Context
+ Vibrator v = (Vibrator) getSystemService(VIBRATOR_SERVICE);
+ // Vibrate for 300 milliseconds
+ v.vibrate(300);
+
+ int size = Math.round(record.getLength());
+ measurement.setSize(size);
+ addMeasurement(null);
+ }
+ break;
+ }
+ }
+ });
}
@Override
Added: trunk/src/fr/ifremer/wlo/utils/BigFinFeedReaderRecord.java
===================================================================
--- trunk/src/fr/ifremer/wlo/utils/BigFinFeedReaderRecord.java (rev 0)
+++ trunk/src/fr/ifremer/wlo/utils/BigFinFeedReaderRecord.java 2014-02-14 14:49:07 UTC (rev 48)
@@ -0,0 +1,166 @@
+package fr.ifremer.wlo.utils;
+
+/*
+ * #%L
+ * Tutti :: Ichtyometer API
+ * $Id: FeedReaderRecord.java 1574 2014-02-06 17:34:03Z tchemit $
+ * $HeadURL: http://svn.forge.codelutin.com/svn/tutti/trunk/tutti-ichtyometer/src/main/j… $
+ * %%
+ * Copyright (C) 2012 - 2014 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import android.util.Log;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * Record_id,length(mm),weight(g),species,cruise,station,pan,Dt,sz class,gender,text,
+ * <p/>
+ * Created on 1/24/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 3.1
+ */
+public class BigFinFeedReaderRecord {
+
+ /** Logger. */
+ private static final String TAG = "BigFinFeedReaderRecord";
+
+ /**
+ * Incoming raw record.
+ */
+ protected final String record;
+
+ /**
+ * Incoming crc.
+ */
+ protected final String crc;
+
+ /**
+ * Our computed crc.
+ */
+ protected final String computedCrc;
+
+ /**
+ * Extracted length (the first data of the record).
+ */
+ protected final Float length;
+
+ /**
+ * Computed valid flag (if crc == computedCrc and length != null).
+ */
+ protected final boolean valid;
+
+ public BigFinFeedReaderRecord(String record, String crc) {
+ this.record = record;
+ this.crc = crc;
+ this.computedCrc = computeCRC(record);
+ this.length = computeLength(record);
+
+ //FIXME Uncomment when computedCrc will be ok
+ this.valid = length != null; /*&& crc.equals(computedCrc);*/
+ }
+
+ public boolean isValid() {
+ return valid;
+ }
+
+ public String getRecord() {
+ return record;
+ }
+
+ public String getCrc() {
+ return crc;
+ }
+
+ public String getComputedCrc() {
+ return computedCrc;
+ }
+
+ public Float getLength() {
+ return length;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this)
+ .append("record", record)
+ .append("crc", crc)
+ .append("computedCrc", computedCrc)
+ .append("valid", valid)
+ .append("length", length)
+ .toString();
+ }
+
+ public static String computeCRC(String record) {
+
+ // use long because int are signed and add doesn't work correctly
+ long checksum = 0;
+
+ // to keep using 4 octets (32bites)
+ long mask = 0b0000000000000000000000000000000011111111111111111111111111111111L;
+
+ for (int i = 0, recordLength = record.length(); i < recordLength; i++) {
+
+ // keep only the first 32 bites
+ checksum = checksum & mask;
+
+ // get msb bite value
+ long msb = checksum >> 31;
+
+ Log.d(TAG, String.format("i=%4d char=%s(int:%3d) incoming checksum=%10d msb=%d bits=%33s", i, record.charAt(i), (int) record.charAt(i), checksum, msb, Long.toBinaryString(checksum)));
+
+ // logical shift left
+ checksum <<= 1;
+ Log.d(TAG, String.format("After lef shift : %33s", Long.toBinaryString(checksum)));
+
+ // rotates msb to lsb
+ checksum += msb;
+ Log.d(TAG, String.format("After add smb : %33s", Long.toBinaryString(checksum)));
+
+ // add new caracter
+ checksum += record.charAt(i);
+ Log.d(TAG, String.format("After add car : %33s", Long.toBinaryString(checksum)));
+ }
+
+ // get a hexadecimal on 32bites -> 8 hexadecimal caracters
+ String hex = Long.toHexString(checksum).toUpperCase();
+ Log.d(TAG, "checksum= " + checksum);
+ return hex;
+ }
+
+ protected Float computeLength(String record) {
+ Float length;
+ try {
+ String[] cells = record.split("\\s*,\\s*");
+ // first cell is the record number, second one is the length
+ String lengthCell = cells[1];
+ // remove any spaces
+ lengthCell = lengthCell.replaceAll("\\s*", "");
+
+ // remove any starting 0
+ lengthCell = lengthCell.replaceAll("^0*", "");
+
+ length = Float.valueOf(lengthCell) * 10;
+
+ } catch (Exception e) {
+ Log.e(TAG, "Could not get length from " + record, e);
+ length = null;
+ }
+ return length;
+ }
+}
1
0
r47 - in trunk: . res/drawable res/layout res/menu res/values res/values-fr src/fr/ifremer/wlo src/fr/ifremer/wlo/models src/fr/ifremer/wlo/preferences src/fr/ifremer/wlo/storage src/fr/ifremer/wlo/utils
by kmorin@users.forge.codelutin.com 13 Feb '14
by kmorin@users.forge.codelutin.com 13 Feb '14
13 Feb '14
Author: kmorin
Date: 2014-02-13 22:28:40 +0100 (Thu, 13 Feb 2014)
New Revision: 47
Url: http://forge.codelutin.com/projects/wlo/repository/revisions/47
Log:
refs #4192 [SAISIE] ?\195?\137cran des poids [niveau 5 ?\195?\160 7]
Added:
trunk/proguard.cfg
trunk/res/drawable/weight.png
trunk/res/layout/weights.xml
trunk/res/menu/weight_menu.xml
trunk/src/fr/ifremer/wlo/WeightsActivity.java
trunk/src/fr/ifremer/wlo/models/CategoryWeightModel.java
Modified:
trunk/AndroidManifest.xml
trunk/pom.xml
trunk/res/values-fr/strings.xml
trunk/res/values/strings.xml
trunk/src/fr/ifremer/wlo/ScientificSpeciesActivity.java
trunk/src/fr/ifremer/wlo/models/CommercialSpeciesModel.java
trunk/src/fr/ifremer/wlo/models/ScientificSpeciesModel.java
trunk/src/fr/ifremer/wlo/preferences/WloMultiSelectListPreference.java
trunk/src/fr/ifremer/wlo/storage/WloSqlOpenHelper.java
trunk/src/fr/ifremer/wlo/utils/WloAutoCompleteTextViewWithFavorites.java
Modified: trunk/AndroidManifest.xml
===================================================================
--- trunk/AndroidManifest.xml 2014-02-04 18:31:27 UTC (rev 46)
+++ trunk/AndroidManifest.xml 2014-02-13 21:28:40 UTC (rev 47)
@@ -108,6 +108,10 @@
android:noHistory="true"
android:configChanges="orientation|screenSize|keyboardHidden"/>
+ <activity android:name=".WeightsActivity"
+ android:label="@string/weights_title"
+ android:configChanges="orientation|screenSize|keyboardHidden"/>
+
<activity android:name=".preferences.SettingsActivity"
android:label="@string/main_settings"
android:configChanges="orientation|screenSize|keyboardHidden"/>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-02-04 18:31:27 UTC (rev 46)
+++ trunk/pom.xml 2014-02-13 21:28:40 UTC (rev 47)
@@ -254,6 +254,10 @@
<!--<path>${env.ANDROID_HOME}</path>-->
<platform>15</platform>
</sdk>
+ <extractDuplicates>true</extractDuplicates>
+ <!--<sign>-->
+ <!--<debug>false</debug>-->
+ <!--</sign>-->
<!--<device>emulator</device>-->
<device>usb</device>
<zipalign>
@@ -266,7 +270,9 @@
${project.build.directory}/${project.artifactId}-${project.version}-aligned.apk
</outputApk>
</zipalign>
- <extractDuplicates>true</extractDuplicates>
+ <proguard>
+ <skip>true</skip> <!-- android.proguard.skip -->
+ </proguard>
</configuration>
<extensions>true</extensions>
</plugin>
Added: trunk/proguard.cfg
===================================================================
--- trunk/proguard.cfg (rev 0)
+++ trunk/proguard.cfg 2014-02-13 21:28:40 UTC (rev 47)
@@ -0,0 +1,10 @@
+-dontoptimize
+-dontobfuscate
+-dontwarn javax.annotation.**
+-dontwarn javax.inject.**
+-dontwarn sun.misc.Unsafe
+-dontwarn com.google.common.collect.MinMaxPriorityQueue
+
+-keepclasseswithmembers public class * {
+ public static void main(java.lang.String[]);
+}
\ No newline at end of file
Added: trunk/res/drawable/weight.png
===================================================================
(Binary files differ)
Property changes on: trunk/res/drawable/weight.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/res/layout/weights.xml
===================================================================
--- trunk/res/layout/weights.xml (rev 0)
+++ trunk/res/layout/weights.xml 2014-02-13 21:28:40 UTC (rev 47)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <ScrollView android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:fillViewport="true">
+
+ <LinearLayout android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <TextView android:text="@string/commercial_species_total_unloaded_weight"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"/>
+
+ <EditText android:id="@+id/total_unloaded_weight"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:inputType="numberDecimal"/>
+
+ </LinearLayout>
+
+ </ScrollView>
+
+ <LinearLayout android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="bottom">
+
+ <Button android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="@android:string/cancel"
+ android:onClick="cancel" />
+
+ <Button android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="@android:string/ok"
+ android:onClick="validate" />
+
+ </LinearLayout>
+
+</LinearLayout>
\ No newline at end of file
Added: trunk/res/menu/weight_menu.xml
===================================================================
--- trunk/res/menu/weight_menu.xml (rev 0)
+++ trunk/res/menu/weight_menu.xml 2014-02-13 21:28:40 UTC (rev 47)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:wlo="http://schemas.android.com/apk/res-auto">
+
+ <item android:id="@+id/weights"
+ android:icon="@drawable/weight"
+ wlo:showAsAction="always" />
+
+</menu>
\ No newline at end of file
Modified: trunk/res/values/strings.xml
===================================================================
--- trunk/res/values/strings.xml 2014-02-04 18:31:27 UTC (rev 46)
+++ trunk/res/values/strings.xml 2014-02-13 21:28:40 UTC (rev 47)
@@ -168,6 +168,10 @@
<string name="exit_form_confirmation">Do you want to save the form before leaving?</string>
+ <!-- Weights -->
+ <string name="weights_title">Weights</string>
+ <string name="commercial_species_total_unloaded_weight">Total unloaded weight</string>
+
<!--File chooser-->
<string name="file_chooser_location">Location</string>
<string name="file_chooser_cant_read_folder">folder can\'t be read!</string>
Modified: trunk/res/values-fr/strings.xml
===================================================================
--- trunk/res/values-fr/strings.xml 2014-02-04 18:31:27 UTC (rev 46)
+++ trunk/res/values-fr/strings.xml 2014-02-13 21:28:40 UTC (rev 47)
@@ -161,6 +161,10 @@
<string name="exit_form_confirmation">Voulez-vous sauvegarder les données avant de quitter le formulaire ?</string>
+ <!-- Weights -->
+ <string name="weights_title">Poids</string>
+ <string name="commercial_species_total_unloaded_weight">Poids total débarqué</string>
+
<!--File chooser-->
<string name="file_chooser_location">Emplacement</string>
<string name="file_chooser_cant_read_folder">Le dossier est illisible !</string>
Modified: trunk/src/fr/ifremer/wlo/ScientificSpeciesActivity.java
===================================================================
--- trunk/src/fr/ifremer/wlo/ScientificSpeciesActivity.java 2014-02-04 18:31:27 UTC (rev 46)
+++ trunk/src/fr/ifremer/wlo/ScientificSpeciesActivity.java 2014-02-13 21:28:40 UTC (rev 47)
@@ -30,6 +30,7 @@
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
+import android.view.MenuItem;
import android.view.View;
import android.widget.ListView;
import com.google.common.collect.Maps;
@@ -58,10 +59,11 @@
@Override
public boolean onCreateOptionsMenu(Menu menu) {
CommercialSpeciesModel parent = (CommercialSpeciesModel) parentModel;
+ MenuInflater inflater = getMenuInflater();
if (parent.isSpeciesMix() || adapter.getCount() == 0) {
- MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.model_list_menu, menu);
}
+ inflater.inflate(R.menu.weight_menu, menu);
return true;
}
@@ -77,6 +79,18 @@
}
@Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.weights:
+ Intent intent = new Intent(this, WeightsActivity.class);
+ intent.putExtra(WeightsActivity.INTENT_COMMERCIAL_SPECIES, parentModel);
+ startActivity(intent);
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
+ }
+
+ @Override
protected Class<? extends WloModelEditionActivity> getEditionActivity() {
return ScientificSpeciesFormActivity.class;
}
Added: trunk/src/fr/ifremer/wlo/WeightsActivity.java
===================================================================
--- trunk/src/fr/ifremer/wlo/WeightsActivity.java (rev 0)
+++ trunk/src/fr/ifremer/wlo/WeightsActivity.java 2014-02-13 21:28:40 UTC (rev 47)
@@ -0,0 +1,80 @@
+package fr.ifremer.wlo;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.widget.EditText;
+import com.google.common.collect.Multimap;
+import fr.ifremer.wlo.models.BaseModel;
+import fr.ifremer.wlo.models.CommercialSpeciesModel;
+import fr.ifremer.wlo.storage.WloSqlOpenHelper;
+import fr.ifremer.wlo.utils.BaseTextWatcher;
+import org.apache.commons.lang3.StringUtils;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Collection;
+
+/**
+ * @author Kevin Morin (Code Lutin)
+ * @since x.x
+ */
+public class WeightsActivity extends WloBaseActivity {
+
+ private static final String TAG = "WeightsActivity";
+
+ public static final String INTENT_COMMERCIAL_SPECIES = "commercialSpecies";
+
+ protected CommercialSpeciesModel commercialSpeciesModel;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ commercialSpeciesModel = (CommercialSpeciesModel) getIntent().getSerializableExtra(INTENT_COMMERCIAL_SPECIES);
+ getSupportActionBar().setSubtitle(commercialSpeciesModel.toString(this));
+
+ final EditText totalUnloadedWeightText = (EditText) findViewById(R.id.total_unloaded_weight);
+ Log.d(TAG, "TotalUnloadedWeight " + commercialSpeciesModel.getTotalUnloadedWeight());
+ totalUnloadedWeightText.setText(String.valueOf(commercialSpeciesModel.getTotalUnloadedWeight()));
+ totalUnloadedWeightText.addTextChangedListener(new BaseTextWatcher() {
+ @Override
+ public void onTextChanged(CharSequence s, int start, int before, int count) {
+ Integer newValue = null;
+ Log.d(TAG, "onTextChanged " + s);
+ if (StringUtils.isNotEmpty(s)) {
+ newValue = Integer.parseInt(s.toString());
+ }
+ Log.d(TAG, "TotalUnloadedWeight " + newValue);
+ commercialSpeciesModel.setTotalUnloadedWeight(newValue);
+ totalUnloadedWeightText.setSelection(start + count);
+ }
+
+ });
+ }
+
+ @Override
+ protected Integer getContentView() {
+ return R.layout.weights;
+ }
+
+ @Override
+ protected Class<? extends WloBaseActivity> getUpActivity() {
+ return ScientificSpeciesActivity.class;
+ }
+
+ public void validate(View view) {
+ saveModel();
+ finish();
+ }
+
+ /* Protected methods */
+
+ protected void saveModel() {
+ WloSqlOpenHelper woh = new WloSqlOpenHelper(this);
+ Log.d(TAG, "TotalUnloadedWeight " + commercialSpeciesModel.getTotalUnloadedWeight());
+ woh.saveData(commercialSpeciesModel);
+ woh.close();
+ }
+
+}
Added: trunk/src/fr/ifremer/wlo/models/CategoryWeightModel.java
===================================================================
--- trunk/src/fr/ifremer/wlo/models/CategoryWeightModel.java (rev 0)
+++ trunk/src/fr/ifremer/wlo/models/CategoryWeightModel.java 2014-02-13 21:28:40 UTC (rev 47)
@@ -0,0 +1,102 @@
+package fr.ifremer.wlo.models;
+
+import android.content.ContentValues;
+import android.content.Context;
+import android.database.Cursor;
+import fr.ifremer.wlo.utils.UIUtils;
+
+/**
+ * @author Kevin Morin (Code Lutin)
+ * @since 0.2
+ */
+public class CategoryWeightModel extends HierarchicalModel<ScientificSpeciesModel> {
+
+ private static final String TAG = "CategoryWeightModel";
+
+ public static final String TABLE_NAME = "category_weights";
+ public static final String COLUMN_CATEGORY_1 = "category1";
+ public static final String COLUMN_CATEGORY_2 = "category2";
+ public static final String COLUMN_CATEGORY_3 = "category3";
+ public static final String COLUMN_WEIGHT = "weight";
+ public static final String COLUMN_SCIENTIFIC_SPECIES_ID = "scientificSpeciesId";
+ public static final String[] ALL_COLUMNS = new String[] {
+ _ID,
+ COLUMN_CATEGORY_1,
+ COLUMN_CATEGORY_2,
+ COLUMN_CATEGORY_3,
+ COLUMN_WEIGHT,
+ COLUMN_SCIENTIFIC_SPECIES_ID
+ };
+
+ @Override
+ public String getTableName() {
+ return TABLE_NAME;
+ }
+
+ protected String category1;
+ protected String category2;
+ protected String category3;
+ protected int weight;
+
+ public CategoryWeightModel() {
+ }
+
+ public CategoryWeightModel(Cursor cursor) {
+ super(cursor);
+ category1 = cursor.getString(1);
+ category2 = cursor.getString(2);
+ category3 = cursor.getString(3);
+ weight = cursor.getInt(4);
+ }
+ public String getCategory1() {
+ return category1;
+ }
+
+ public void setCategory1(String category1) {
+ Object oldValue = this.category1;
+ this.category1 = category1;
+ firePropertyChange(COLUMN_CATEGORY_1, oldValue, category1);
+ }
+
+ public String getCategory2() {
+ return category2;
+ }
+
+ public void setCategory2(String category2) {
+ Object oldValue = this.category2;
+ this.category2 = category2;
+ firePropertyChange(COLUMN_CATEGORY_2, oldValue, category2);
+ }
+
+ public String getCategory3() {
+ return category3;
+ }
+
+ public void setCategory3(String category3) {
+ Object oldValue = this.category3;
+ this.category3 = category3;
+ firePropertyChange(COLUMN_CATEGORY_3, oldValue, category3);
+ }
+
+ public int getWeight() {
+ return weight;
+ }
+
+ public void setWeight(int weight) {
+ Object oldValue = this.weight;
+ this.weight = weight;
+ firePropertyChange(COLUMN_WEIGHT, oldValue, weight);
+ }
+
+ @Override
+ public ContentValues convertIntoContentValues() {
+ ContentValues value = super.convertIntoContentValues();
+ putValue(value, COLUMN_CATEGORY_1, category1);
+ putValue(value, COLUMN_CATEGORY_2, category2);
+ putValue(value, COLUMN_CATEGORY_3, category3);
+ putValue(value, COLUMN_WEIGHT, weight);
+ putValue(value, COLUMN_SCIENTIFIC_SPECIES_ID, getParentId());
+ return value;
+ }
+
+}
Modified: trunk/src/fr/ifremer/wlo/models/CommercialSpeciesModel.java
===================================================================
--- trunk/src/fr/ifremer/wlo/models/CommercialSpeciesModel.java 2014-02-04 18:31:27 UTC (rev 46)
+++ trunk/src/fr/ifremer/wlo/models/CommercialSpeciesModel.java 2014-02-13 21:28:40 UTC (rev 47)
@@ -54,6 +54,7 @@
public static final String COLUMN_STATE = "state";
public static final String COLUMN_PRESENTATION = "presentation";
public static final String COLUMN_COMMENT = "comment";
+ public static final String COLUMN_TOTAL_UNLOADED_WEIGHT = "totalUnloadedWeight";
public static final String COLUMN_METIER_ID = "metierId";
public static final String[] ALL_COLUMNS = new String[] {
_ID,
@@ -65,6 +66,7 @@
COLUMN_STATE,
COLUMN_PRESENTATION,
COLUMN_COMMENT,
+ COLUMN_TOTAL_UNLOADED_WEIGHT,
COLUMN_METIER_ID
};
@@ -76,6 +78,7 @@
protected State state;
protected Presentation presentation;
protected String comment;
+ protected Integer totalUnloadedWeight;
public CommercialSpeciesModel() {
}
@@ -96,6 +99,7 @@
String presentationId = cursor.getString(7);
presentation = DataCache.getPresentationById(context, presentationId);
comment = cursor.getString(8);
+ totalUnloadedWeight = cursor.getInt(9);
}
public CommercialSpecies getFaoCode() {
@@ -179,6 +183,16 @@
firePropertyChange(COLUMN_COMMENT, oldValue, comment);
}
+ public Integer getTotalUnloadedWeight() {
+ return totalUnloadedWeight;
+ }
+
+ public void setTotalUnloadedWeight(Integer totalUnloadedWeight) {
+ Object oldValue = this.totalUnloadedWeight;
+ this.totalUnloadedWeight = totalUnloadedWeight;
+ firePropertyChange(COLUMN_TOTAL_UNLOADED_WEIGHT, oldValue, totalUnloadedWeight);
+ }
+
@Override
public String getTableName() {
return TABLE_NAME;
@@ -200,6 +214,7 @@
putValue(value, COLUMN_STATE, state != null ? state.getId() : null);
putValue(value, COLUMN_PRESENTATION, presentation != null ? presentation.getId() : null);
putValue(value, COLUMN_COMMENT, comment);
+ putValue(value, COLUMN_TOTAL_UNLOADED_WEIGHT, totalUnloadedWeight);
putValue(value, COLUMN_METIER_ID, getParentId());
return value;
}
Modified: trunk/src/fr/ifremer/wlo/models/ScientificSpeciesModel.java
===================================================================
--- trunk/src/fr/ifremer/wlo/models/ScientificSpeciesModel.java 2014-02-04 18:31:27 UTC (rev 46)
+++ trunk/src/fr/ifremer/wlo/models/ScientificSpeciesModel.java 2014-02-13 21:28:40 UTC (rev 47)
@@ -44,18 +44,21 @@
public static final String COLUMN_NAME = "name";
public static final String COLUMN_TAKING_ACTIVATION = "takingActivation";
public static final String COLUMN_COMMENT = "comment";
+ public static final String COLUMN_SAMPLE_WEIGHT = "sampleWeight";
public static final String COLUMN_COMMERCIAL_SPECIES_ID = "commercialSpeciesId";
public static final String[] ALL_COLUMNS = new String[] {
_ID,
COLUMN_NAME,
COLUMN_TAKING_ACTIVATION,
COLUMN_COMMENT,
+ COLUMN_SAMPLE_WEIGHT,
COLUMN_COMMERCIAL_SPECIES_ID
};
protected ScientificSpecies name;
protected boolean takingActivation;
protected String comment;
+ protected int sampleWeight;
public ScientificSpeciesModel() {
}
@@ -66,6 +69,7 @@
name = DataCache.getScientificSpeciesById(context, nameId);
takingActivation = cursor.getShort(2) > 0;
comment = cursor.getString(3);
+ sampleWeight = cursor.getInt(4);
}
public ScientificSpecies getName() {
@@ -98,6 +102,16 @@
firePropertyChange(COLUMN_COMMENT, oldValue, comment);
}
+ public int getSampleWeight() {
+ return sampleWeight;
+ }
+
+ public void setSampleWeight(int sampleWeight) {
+ Object oldValue = this.sampleWeight;
+ this.sampleWeight = sampleWeight;
+ firePropertyChange(COLUMN_SAMPLE_WEIGHT, oldValue, sampleWeight);
+ }
+
@Override
public String getTableName() {
return TABLE_NAME;
@@ -114,6 +128,7 @@
putValue(value, COLUMN_NAME, name != null ? name.getId() : null);
putValue(value, COLUMN_TAKING_ACTIVATION, takingActivation ? 1 : 0);
putValue(value, COLUMN_COMMENT, comment);
+ putValue(value, COLUMN_SAMPLE_WEIGHT, sampleWeight);
putValue(value, COLUMN_COMMERCIAL_SPECIES_ID, getParentId());
return value;
}
Modified: trunk/src/fr/ifremer/wlo/preferences/WloMultiSelectListPreference.java
===================================================================
--- trunk/src/fr/ifremer/wlo/preferences/WloMultiSelectListPreference.java 2014-02-04 18:31:27 UTC (rev 46)
+++ trunk/src/fr/ifremer/wlo/preferences/WloMultiSelectListPreference.java 2014-02-13 21:28:40 UTC (rev 47)
@@ -1,5 +1,29 @@
package fr.ifremer.wlo.preferences;
+/*
+ * #%L
+ * WLO
+ * $Id:$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2013 - 2014 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.MultiSelectListPreference;
Modified: trunk/src/fr/ifremer/wlo/storage/WloSqlOpenHelper.java
===================================================================
--- trunk/src/fr/ifremer/wlo/storage/WloSqlOpenHelper.java 2014-02-04 18:31:27 UTC (rev 46)
+++ trunk/src/fr/ifremer/wlo/storage/WloSqlOpenHelper.java 2014-02-13 21:28:40 UTC (rev 47)
@@ -33,6 +33,7 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import fr.ifremer.wlo.models.BaseModel;
+import fr.ifremer.wlo.models.CategoryWeightModel;
import fr.ifremer.wlo.models.CommercialSpeciesModel;
import fr.ifremer.wlo.models.ContextModel;
import fr.ifremer.wlo.models.LocationModel;
@@ -66,7 +67,7 @@
private static final String TAG = "WloOpenHelper";
public static final String DATABASE_NAME = "wlo.db";
- public static final int DATABASE_VERSION = 14;
+ public static final int DATABASE_VERSION = 15;
public static final String TEXT_TYPE = " TEXT";
public static final String BIGINT_TYPE = " BIGINT";
@@ -154,6 +155,7 @@
CommercialSpeciesModel.COLUMN_STATE + TEXT_TYPE + COMMA_SEP +
CommercialSpeciesModel.COLUMN_PRESENTATION + TEXT_TYPE + COMMA_SEP +
CommercialSpeciesModel.COLUMN_COMMENT + TEXT_TYPE + COMMA_SEP +
+ CommercialSpeciesModel.COLUMN_TOTAL_UNLOADED_WEIGHT + BIGINT_TYPE + COMMA_SEP +
CommercialSpeciesModel.COLUMN_METIER_ID + TEXT_TYPE + NOT_NULL + COMMA_SEP +
"FOREIGN KEY(" + CommercialSpeciesModel.COLUMN_METIER_ID + ") REFERENCES " +
MetierModel.TABLE_NAME + "(" + MetierModel._ID + ") ON DELETE CASCADE" + COMMA_SEP +
@@ -177,6 +179,7 @@
ScientificSpeciesModel.COLUMN_NAME + TEXT_TYPE + COMMA_SEP +
ScientificSpeciesModel.COLUMN_TAKING_ACTIVATION + BYTE_TYPE + COMMA_SEP +
ScientificSpeciesModel.COLUMN_COMMENT + TEXT_TYPE + COMMA_SEP +
+ ScientificSpeciesModel.COLUMN_SAMPLE_WEIGHT + BIGINT_TYPE + COMMA_SEP +
ScientificSpeciesModel.COLUMN_COMMERCIAL_SPECIES_ID + TEXT_TYPE + NOT_NULL + COMMA_SEP +
"FOREIGN KEY(" + ScientificSpeciesModel.COLUMN_COMMERCIAL_SPECIES_ID + ") REFERENCES " +
CommercialSpeciesModel.TABLE_NAME + "(" + CommercialSpeciesModel._ID + ") ON DELETE CASCADE" + COMMA_SEP +
@@ -204,7 +207,22 @@
protected static final String SQL_DELETE_MEASUREMENTS =
"DROP TABLE IF EXISTS " + MeasurementModel.TABLE_NAME;
+ // CATEGORY WEIGHTS
+ protected static final String SQL_CREATE_CATEGORY_WEIGHTS =
+ "CREATE TABLE " + CategoryWeightModel.TABLE_NAME + " (" +
+ CategoryWeightModel._ID + TEXT_TYPE + " PRIMARY KEY" + COMMA_SEP +
+ CategoryWeightModel.COLUMN_CATEGORY_1 + TEXT_TYPE + COMMA_SEP +
+ CategoryWeightModel.COLUMN_CATEGORY_2 + TEXT_TYPE + COMMA_SEP +
+ CategoryWeightModel.COLUMN_CATEGORY_3 + TEXT_TYPE + COMMA_SEP +
+ CategoryWeightModel.COLUMN_WEIGHT + BIGINT_TYPE + COMMA_SEP +
+ CategoryWeightModel.COLUMN_SCIENTIFIC_SPECIES_ID + TEXT_TYPE + NOT_NULL + COMMA_SEP +
+ "FOREIGN KEY(" + CategoryWeightModel.COLUMN_SCIENTIFIC_SPECIES_ID + ") REFERENCES " +
+ ScientificSpeciesModel.TABLE_NAME + "(" + ScientificSpeciesModel._ID + ") ON DELETE CASCADE" +
+ " )";
+ protected static final String SQL_DELETE_CATEGORY_WEIGHTS =
+ "DROP TABLE IF EXISTS " + CategoryWeightModel.TABLE_NAME;
+
// Referentials
// Ages
@@ -370,12 +388,14 @@
db.execSQL(SQL_CREATE_COMMERCIAL_SPECIES);
db.execSQL(SQL_CREATE_SCIENTIFIC_SPECIES);
db.execSQL(SQL_CREATE_MEASUREMENTS);
+ db.execSQL(SQL_CREATE_CATEGORY_WEIGHTS);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
//TODO kmorin 20131129 migrate data before droping the table
// models
+ db.execSQL(SQL_DELETE_CATEGORY_WEIGHTS);
db.execSQL(SQL_DELETE_MEASUREMENTS);
db.execSQL(SQL_DELETE_SCIENTIFIC_SPECIES);
db.execSQL(SQL_DELETE_COMMERCIAL_SPECIES);
@@ -502,6 +522,16 @@
}
}
+ // CATEGORY WEIGHTS
+
+ public Cursor getAllCategoryWeigths(String scientificSpeciesId) {
+ SQLiteDatabase db = getReadableDatabase();
+ Cursor cursor = db.query(CategoryWeightModel.TABLE_NAME, CategoryWeightModel.ALL_COLUMNS,
+ CategoryWeightModel.COLUMN_SCIENTIFIC_SPECIES_ID + " = ?", new String[]{ scientificSpeciesId },
+ null, null, null);
+ return cursor;
+ }
+
// Referentials
public Cursor getAllRefAges() {
@@ -581,25 +611,6 @@
return cursor;
}
- //TODO remove when tests are over
- public void clearReferentials() {
- SQLiteDatabase db = getWritableDatabase();
- db.beginTransaction();
- db.delete(Age.TABLE_NAME, null, null);
- db.delete(CommercialSpecies.TABLE_NAME, null, null);
- db.delete(Gender.TABLE_NAME, null, null);
- db.delete(Location.TABLE_NAME, null, null);
- db.delete(Maturity.TABLE_NAME, null, null);
- db.delete(Mensuration.TABLE_NAME, null, null);
- db.delete(Metier.TABLE_NAME, null, null);
- db.delete(Presentation.TABLE_NAME, null, null);
- db.delete(ScientificSpecies.TABLE_NAME, null, null);
- db.delete(State.TABLE_NAME, null, null);
- db.delete(Vessel.TABLE_NAME, null, null);
- db.setTransactionSuccessful();
- db.endTransaction();
- }
-
public <M extends BaseModel> void saveData(M model) {
saveData(Lists.newArrayList(model));
}
Modified: trunk/src/fr/ifremer/wlo/utils/WloAutoCompleteTextViewWithFavorites.java
===================================================================
--- trunk/src/fr/ifremer/wlo/utils/WloAutoCompleteTextViewWithFavorites.java 2014-02-04 18:31:27 UTC (rev 46)
+++ trunk/src/fr/ifremer/wlo/utils/WloAutoCompleteTextViewWithFavorites.java 2014-02-13 21:28:40 UTC (rev 47)
@@ -1,5 +1,29 @@
package fr.ifremer.wlo.utils;
+/*
+ * #%L
+ * WLO
+ * $Id:$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2013 - 2014 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
1
0
r46 - in trunk: res/layout res/values res/values-fr src/fr/ifremer/wlo/measurement src/fr/ifremer/wlo/utils
by kmorin@users.forge.codelutin.com 04 Feb '14
by kmorin@users.forge.codelutin.com 04 Feb '14
04 Feb '14
Author: kmorin
Date: 2014-02-04 19:31:27 +0100 (Tue, 04 Feb 2014)
New Revision: 46
Url: http://forge.codelutin.com/projects/wlo/repository/revisions/46
Log:
fixes #4186 Les lignes du tableau des nombres par taille ne prennent pas tout la largeur
Added:
trunk/res/values/colors.xml
Modified:
trunk/res/layout/main.xml
trunk/res/layout/measurement.xml
trunk/res/layout/measurement_table_fragment.xml
trunk/res/layout/measurement_table_row.xml
trunk/res/values-fr/strings.xml
trunk/res/values/strings.xml
trunk/src/fr/ifremer/wlo/measurement/LogsFragment.java
trunk/src/fr/ifremer/wlo/measurement/TableAdapter.java
trunk/src/fr/ifremer/wlo/utils/BaseModelArrayAdapter.java
Modified: trunk/res/layout/main.xml
===================================================================
--- trunk/res/layout/main.xml 2014-02-04 14:27:37 UTC (rev 45)
+++ trunk/res/layout/main.xml 2014-02-04 18:31:27 UTC (rev 46)
@@ -5,6 +5,11 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
+ <ImageView android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:src="@drawable/wlo_ico"
+ android:layout_weight="1"/>
+
<TextView style="@style/MainTitle"
android:text="@string/app_name"
android:layout_weight="1"/>
Modified: trunk/res/layout/measurement.xml
===================================================================
--- trunk/res/layout/measurement.xml 2014-02-04 14:27:37 UTC (rev 45)
+++ trunk/res/layout/measurement.xml 2014-02-04 18:31:27 UTC (rev 46)
@@ -163,6 +163,6 @@
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
- android:background="@android:color/holo_blue_dark"/>
+ android:background="@color/dark_gray"/>
</android.support.v4.widget.DrawerLayout>
\ No newline at end of file
Modified: trunk/res/layout/measurement_table_fragment.xml
===================================================================
--- trunk/res/layout/measurement_table_fragment.xml 2014-02-04 14:27:37 UTC (rev 45)
+++ trunk/res/layout/measurement_table_fragment.xml 2014-02-04 18:31:27 UTC (rev 46)
@@ -1,12 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
<ListView android:id="@+id/table_content"
- android:layout_width="wrap_content"
+ android:layout_width="match_parent"
android:layout_height="match_parent"/>
-</LinearLayout>
\ No newline at end of file
+</FrameLayout>
\ No newline at end of file
Modified: trunk/res/layout/measurement_table_row.xml
===================================================================
--- trunk/res/layout/measurement_table_row.xml 2014-02-04 14:27:37 UTC (rev 45)
+++ trunk/res/layout/measurement_table_row.xml 2014-02-04 18:31:27 UTC (rev 46)
@@ -10,19 +10,23 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
- android:gravity="center_vertical"
- android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
- android:paddingRight="?android:attr/listPreferredItemPaddingRight"
+ android:gravity="center_vertical|right"
+ android:paddingLeft="20dp"
+ android:paddingRight="20dp"
android:minHeight="?android:attr/listPreferredItemHeightSmall"/>
+ <View android:layout_height="match_parent"
+ android:layout_width="2px"
+ android:background="@color/dark_gray"/>
+
<TextView android:id="@+id/table_nb"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
- android:gravity="center_vertical"
- android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
- android:paddingRight="?android:attr/listPreferredItemPaddingRight"
+ android:gravity="center_vertical|right"
+ android:paddingLeft="20dp"
+ android:paddingRight="20dp"
android:minHeight="?android:attr/listPreferredItemHeightSmall"/>
</LinearLayout>
\ No newline at end of file
Added: trunk/res/values/colors.xml
===================================================================
--- trunk/res/values/colors.xml (rev 0)
+++ trunk/res/values/colors.xml 2014-02-04 18:31:27 UTC (rev 46)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <color name="gray">#404040</color>
+ <color name="dark_gray">#202020</color>
+</resources>
\ No newline at end of file
Modified: trunk/res/values/strings.xml
===================================================================
--- trunk/res/values/strings.xml 2014-02-04 14:27:37 UTC (rev 45)
+++ trunk/res/values/strings.xml 2014-02-04 18:31:27 UTC (rev 46)
@@ -15,8 +15,9 @@
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="app_name">WLO</string>
+ <string name="app_name">Wild Life Observations</string>
+
<!-- Common -->
<string name="yes">Yes</string>
<string name="no">No</string>
Modified: trunk/res/values-fr/strings.xml
===================================================================
--- trunk/res/values-fr/strings.xml 2014-02-04 14:27:37 UTC (rev 45)
+++ trunk/res/values-fr/strings.xml 2014-02-04 18:31:27 UTC (rev 46)
@@ -15,7 +15,6 @@
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="app_name">WLO</string>
<!-- Common -->
<string name="yes">Oui</string>
Modified: trunk/src/fr/ifremer/wlo/measurement/LogsFragment.java
===================================================================
--- trunk/src/fr/ifremer/wlo/measurement/LogsFragment.java 2014-02-04 14:27:37 UTC (rev 45)
+++ trunk/src/fr/ifremer/wlo/measurement/LogsFragment.java 2014-02-04 18:31:27 UTC (rev 46)
@@ -97,7 +97,20 @@
result += StringUtils.join(cats, " - ");
return result;
}
- });
+ }) {
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ View result = super.getView(position, convertView, parent);
+ int color;
+ if (position % 2 == 0) {
+ color = R.color.dark_gray;
+ } else {
+ color = android.R.color.black;
+ }
+ result.setBackgroundResource(color);
+ return result;
+ }
+ };
dialogBuilder = new AlertDialog.Builder(activity)
.setTitle(R.string.input_deletion_confirmation_title)
Modified: trunk/src/fr/ifremer/wlo/measurement/TableAdapter.java
===================================================================
--- trunk/src/fr/ifremer/wlo/measurement/TableAdapter.java 2014-02-04 14:27:37 UTC (rev 45)
+++ trunk/src/fr/ifremer/wlo/measurement/TableAdapter.java 2014-02-04 18:31:27 UTC (rev 46)
@@ -3,8 +3,8 @@
/*
* #%L
* WLO
- * $Id:$
- * $HeadURL:$
+ * $Id$
+ * $HeadURL$
* %%
* Copyright (C) 2013 - 2014 Ifremer
* %%
@@ -28,6 +28,8 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.view.ViewParent;
+import android.widget.AbsListView;
import android.widget.BaseAdapter;
import android.widget.TextView;
import fr.ifremer.wlo.R;
@@ -79,8 +81,7 @@
if (convertView == null) {
convertView = LayoutInflater.from(context)
- .inflate(R.layout.measurement_table_row, parent, false);
-// convertView.setLayoutParams(new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT, AbsListView.LayoutParams.WRAP_CONTENT));
+ .inflate(R.layout.measurement_table_row, null);
viewHolder = new ViewHolder();
viewHolder.sizeText = (TextView) convertView.findViewById(R.id.table_size);
@@ -97,7 +98,7 @@
int color;
if (position % 2 == 0) {
- color = android.R.color.holo_blue_dark;
+ color = R.color.gray;
} else {
color = android.R.color.black;
}
Modified: trunk/src/fr/ifremer/wlo/utils/BaseModelArrayAdapter.java
===================================================================
--- trunk/src/fr/ifremer/wlo/utils/BaseModelArrayAdapter.java 2014-02-04 14:27:37 UTC (rev 45)
+++ trunk/src/fr/ifremer/wlo/utils/BaseModelArrayAdapter.java 2014-02-04 18:31:27 UTC (rev 46)
@@ -155,7 +155,7 @@
TextView text;
if (convertView == null) {
- view = mInflater.inflate(resource, parent, false);
+ view = mInflater.inflate(resource, null);
} else {
view = convertView;
}
1
0
Author: kmorin
Date: 2014-02-04 15:27:37 +0100 (Tue, 04 Feb 2014)
New Revision: 45
Url: http://forge.codelutin.com/projects/wlo/repository/revisions/45
Log:
fixes #4307 esp?\195?\169ce fao : arret application quand saisie d'une cat?\195?\169gorie terrain au clavier num?\195?\169rique
Modified:
trunk/src/fr/ifremer/wlo/CommercialSpeciesFormActivity.java
Modified: trunk/src/fr/ifremer/wlo/CommercialSpeciesFormActivity.java
===================================================================
--- trunk/src/fr/ifremer/wlo/CommercialSpeciesFormActivity.java 2014-02-04 13:59:04 UTC (rev 44)
+++ trunk/src/fr/ifremer/wlo/CommercialSpeciesFormActivity.java 2014-02-04 14:27:37 UTC (rev 45)
@@ -130,6 +130,8 @@
precisionSpinner.setSelection(model.getPrecision().ordinal());
Set<String> sortCategories = DataCache.getAllSortCategories(this);
+ sortCategories.remove("");
+ initEditText(R.id.commercial_species_form_sortCategory, CommercialSpeciesModel.COLUMN_SORT_CATEGORY);
initAutoCompleteTextView(R.id.commercial_species_form_sortCategory, CommercialSpeciesModel.COLUMN_SORT_CATEGORY, sortCategories);
List<State> states = Lists.newArrayList(DataCache.getAllStates(this));
1
0
04 Feb '14
Author: kmorin
Date: 2014-02-04 14:59:04 +0100 (Tue, 04 Feb 2014)
New Revision: 44
Url: http://forge.codelutin.com/projects/wlo/repository/revisions/44
Log:
fixes #4315 Les dates dans les formulaires ne sont plus affich?\195?\169es tant qu'on ne d?\195?\169finit pas de format dans la configuration
fixes #4308 L'?\195?\169cran des mensuration ne s'affiche pas apr?\195?\168s saisie de l'esp?\195?\168ce scientifique
Modified:
trunk/src/fr/ifremer/wlo/measurement/MeasurementActivity.java
trunk/src/fr/ifremer/wlo/utils/BaseModelArrayAdapter.java
trunk/src/fr/ifremer/wlo/utils/UIUtils.java
Modified: trunk/src/fr/ifremer/wlo/measurement/MeasurementActivity.java
===================================================================
--- trunk/src/fr/ifremer/wlo/measurement/MeasurementActivity.java 2014-01-30 17:54:19 UTC (rev 43)
+++ trunk/src/fr/ifremer/wlo/measurement/MeasurementActivity.java 2014-02-04 13:59:04 UTC (rev 44)
@@ -70,6 +70,7 @@
import fr.ifremer.wlo.models.VesselModel;
import fr.ifremer.wlo.models.referentials.Gender;
import fr.ifremer.wlo.storage.WloSqlOpenHelper;
+import fr.ifremer.wlo.utils.BaseModelArrayAdapter;
import fr.ifremer.wlo.utils.BaseTextWatcher;
import fr.ifremer.wlo.utils.UIUtils;
import org.apache.commons.lang3.ObjectUtils;
@@ -222,23 +223,23 @@
Spinner genderSpinner = (Spinner) findViewById(R.id.gender_spinner);
genderSpinner.setOnItemSelectedListener(this);
- List<Gender> genders = Lists.newArrayList(DataCache.getAllGenders(this));
- genders.add(0, null);
- ArrayAdapter<Gender> gendersAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, genders);
+ List genders = Lists.newArrayList(DataCache.getAllGenders(this));
+ genders.add(0, "");
+ ArrayAdapter gendersAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, genders);
genderSpinner.setAdapter(gendersAdapter);
Spinner maturitySpinner = (Spinner) findViewById(R.id.maturity_spinner);
maturitySpinner.setOnItemSelectedListener(this);
- List<Maturity> maturities = Lists.newArrayList(DataCache.getAllMaturities(this));
- maturities.add(0, null);
- ArrayAdapter<Maturity> maturitiesAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, maturities);
+ List maturities = Lists.newArrayList(DataCache.getAllMaturities(this));
+ maturities.add(0, "");
+ ArrayAdapter maturitiesAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, maturities);
maturitySpinner.setAdapter(maturitiesAdapter);
Spinner ageSpinner = (Spinner) findViewById(R.id.age_spinner);
ageSpinner.setOnItemSelectedListener(this);
- List<Age> ages = Lists.newArrayList(DataCache.getAllAges(this));
- ages.add(0, null);
- ArrayAdapter<Age> agesAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, ages);
+ List ages = Lists.newArrayList(DataCache.getAllAges(this));
+ ages.add(0, "");
+ ArrayAdapter agesAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, ages);
ageSpinner.setAdapter(agesAdapter);
initFishMeasurement(10 * measurements.getPrecision().getUnitDivider(), null, null, null);
@@ -329,8 +330,13 @@
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
- BaseModel selected = (BaseModel) adapterView.getItemAtPosition(i);
- String id = selected != null ? selected.getId() : null;
+ String id;
+ if (i == 0) {
+ id = null;
+ } else {
+ BaseModel selected = (BaseModel) adapterView.getItemAtPosition(i);
+ id = selected != null ? selected.getId() : null;
+ }
switch(adapterView.getId()) {
case R.id.gender_spinner:
measurement.setCategory1(id);
@@ -346,6 +352,17 @@
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
+ switch(adapterView.getId()) {
+ case R.id.gender_spinner:
+ measurement.setCategory1(null);
+ break;
+ case R.id.maturity_spinner:
+ measurement.setCategory2(null);
+ break;
+ case R.id.age_spinner:
+ measurement.setCategory3(null);
+ break;
+ }
}
/* Public methods */
Modified: trunk/src/fr/ifremer/wlo/utils/BaseModelArrayAdapter.java
===================================================================
--- trunk/src/fr/ifremer/wlo/utils/BaseModelArrayAdapter.java 2014-01-30 17:54:19 UTC (rev 43)
+++ trunk/src/fr/ifremer/wlo/utils/BaseModelArrayAdapter.java 2014-02-04 13:59:04 UTC (rev 44)
@@ -176,7 +176,9 @@
M item = getItem(position);
String s;
- if (toStringFunction != null) {
+ if (item == null) {
+ s = "";
+ } else if (toStringFunction != null) {
s = toStringFunction.apply(item);
} else {
s = item.toString(getContext());
Modified: trunk/src/fr/ifremer/wlo/utils/UIUtils.java
===================================================================
--- trunk/src/fr/ifremer/wlo/utils/UIUtils.java 2014-01-30 17:54:19 UTC (rev 43)
+++ trunk/src/fr/ifremer/wlo/utils/UIUtils.java 2014-02-04 13:59:04 UTC (rev 44)
@@ -3,8 +3,8 @@
/*
* #%L
* WLO
- * $Id:$
- * $HeadURL:$
+ * $Id$
+ * $HeadURL$
* %%
* Copyright (C) 2013 - 2014 Ifremer
* %%
@@ -108,7 +108,8 @@
public static String getDateFormat(Context context) {
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(context);
- String dateFormat = sharedPref.getString(ListItemPreference.DATE_FORMAT.getKey(), "");
+ String defaultFormat = context.getResources().getStringArray(ListItemPreference.DATE_FORMAT.getValuesArrayId())[0];
+ String dateFormat = sharedPref.getString(ListItemPreference.DATE_FORMAT.getKey(), defaultFormat);
return dateFormat;
}
1
0
r43 - in trunk: . res/layout src/fr/ifremer/wlo src/fr/ifremer/wlo/measurement src/fr/ifremer/wlo/models src/fr/ifremer/wlo/models/referentials/imports
by kmorin@users.forge.codelutin.com 30 Jan '14
by kmorin@users.forge.codelutin.com 30 Jan '14
30 Jan '14
Author: kmorin
Date: 2014-01-30 18:54:19 +0100 (Thu, 30 Jan 2014)
New Revision: 43
Url: http://forge.codelutin.com/projects/wlo/repository/revisions/43
Log:
fixes #4240 plantage si je veux saisir une taille via le clavier num?\195?\169rique (et pas avec les + et-)
Removed:
trunk/src/fr/ifremer/wlo/Home.java
Modified:
trunk/AndroidManifest.xml
trunk/res/layout/measurement.xml
trunk/src/fr/ifremer/wlo/MainActivity.java
trunk/src/fr/ifremer/wlo/measurement/MeasurementActivity.java
trunk/src/fr/ifremer/wlo/models/BaseModel.java
trunk/src/fr/ifremer/wlo/models/MeasurementModel.java
trunk/src/fr/ifremer/wlo/models/referentials/imports/ImportUtil.java
Modified: trunk/AndroidManifest.xml
===================================================================
--- trunk/AndroidManifest.xml 2014-01-30 13:59:11 UTC (rev 42)
+++ trunk/AndroidManifest.xml 2014-01-30 17:54:19 UTC (rev 43)
@@ -33,7 +33,7 @@
<activity android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="orientation|screenSize|keyboardHidden"
- android:launchMode="singleInstance">
+ android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
Modified: trunk/res/layout/measurement.xml
===================================================================
--- trunk/res/layout/measurement.xml 2014-01-30 13:59:11 UTC (rev 42)
+++ trunk/res/layout/measurement.xml 2014-01-30 17:54:19 UTC (rev 43)
@@ -73,7 +73,8 @@
</LinearLayout>
- <Button android:text="@android:string/ok"
+ <Button android:id="@+id/measurement_add_button"
+ android:text="@android:string/ok"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="addMeasurement"/>
Deleted: trunk/src/fr/ifremer/wlo/Home.java
===================================================================
--- trunk/src/fr/ifremer/wlo/Home.java 2014-01-30 13:59:11 UTC (rev 42)
+++ trunk/src/fr/ifremer/wlo/Home.java 2014-01-30 17:54:19 UTC (rev 43)
@@ -1,342 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package fr.ifremer.wlo;
-
-/*
- * #%L
- * WLO
- * $Id:$
- * $HeadURL:$
- * %%
- * Copyright (C) 2013 - 2014 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import android.app.ActionBar;
-import android.app.Activity;
-import android.bluetooth.BluetoothAdapter;
-import android.bluetooth.BluetoothDevice;
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.speech.tts.TextToSpeech;
-import android.util.Log;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
-import android.widget.ArrayAdapter;
-import android.widget.ListView;
-import android.widget.Toast;
-import fr.ifremer.wlo.measurement.MeasurementActivity;
-
-/**
- * This is the main Activity that displays the current chat location.
- */
-public class Home extends Activity implements TextToSpeech.OnInitListener {
-
- // Debugging
- private static final String TAG = "Home";
-
- // Message types sent from the BluetoothChatService Handler
- public static final int MESSAGE_STATE_CHANGE = 1;
- public static final int MESSAGE_READ = 2;
- public static final int MESSAGE_WRITE = 3;
- public static final int MESSAGE_DEVICE_NAME = 4;
- public static final int MESSAGE_TOAST = 5;
-
- // Key names received from the BluetoothChatService Handler
- public static final String DEVICE_NAME = "device_name";
- public static final String TOAST = "toast";
-
- // Intent request codes
- protected static final int REQUEST_CONNECT_DEVICE = 1;
- protected static final int REQUEST_ENABLE_BT = 2;
- protected static final int REQUEST_CHECK_TTS = 3;
-
- // Layout Views
- protected ListView mConversationView;
-
- // Name of the connected device
- protected String mConnectedDeviceName = null;
- // Array adapter for the conversation thread
- protected ArrayAdapter<String> mConversationArrayAdapter;
- // Local Bluetooth adapter
- protected BluetoothAdapter mBluetoothAdapter = null;
- // Member object for the chat services
- protected BigFinCommunicationService mBFCommunicationService = null;
-
-// protected TextToSpeech mTts;
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- // Set up the window layout
-// setContentView(R.layout.home);
-
- // Get local Bluetooth adapter
- mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
-
- // If the adapter is null, then Bluetooth is not supported
- if (mBluetoothAdapter == null) {
- Toast.makeText(this, "Bluetooth is not available", Toast.LENGTH_LONG).show();
- finish();
- return;
- }
- }
-
- @Override
- public void onStart() {
- super.onStart();
-
- // If BT is not on, request that it be enabled.
- // setupChat() will then be called during onActivityResult
- if (!mBluetoothAdapter.isEnabled()) {
- Intent enableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
- startActivityForResult(enableIntent, REQUEST_ENABLE_BT);
-
- // Otherwise, setup the chat location
- } else {
-// Intent checkIntent = new Intent();
-// checkIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);
-// startActivityForResult(checkIntent, REQUEST_CHECK_TTS);
- setupChat();
- }
- }
-
- @Override
- public synchronized void onResume() {
- super.onResume();
-
- // Performing this check in onResume() covers the case in which BT was
- // not enabled during onStart(), so we were paused to enable it...
- // onResume() will be called when ACTION_REQUEST_ENABLE activity returns.
- if (mBFCommunicationService != null) {
- // Only if the state is STATE_NONE, do we know that we haven't started already
-// if (mBFCommunicationService.getState() == BigFinCommunicationService.STATE_NONE) {
- // Start the Bluetooth chat services
-// mBFCommunicationService.start();
- selectDevice();
-// }
- }
- }
-
- protected void selectDevice() {
- // Launch the DeviceListActivity to see devices and do scan
- Intent serverIntent = new Intent(this, DeviceListActivity.class);
- startActivityForResult(serverIntent, REQUEST_CONNECT_DEVICE);
- }
-
- private void setupChat() {
- Log.d(TAG, "setupChat()");
-
- // Initialize the array adapter for the conversation thread
- mConversationArrayAdapter = new ArrayAdapter<String>(this, R.layout.message);
-// mConversationView = (ListView) findViewById(R.id.in);
- mConversationView.setAdapter(mConversationArrayAdapter);
-
- // Initialize the BluetoothChatService to perform bluetooth connections
-// mBFCommunicationService = new BigFinCommunicationService(this, mHandler);
-
- }
-
- @Override
- public void onStop() {
- super.onStop();
-// mTts.shutdown();
- }
-
- @Override
- public void onDestroy() {
- super.onDestroy();
- // Stop the Bluetooth chat services
-// if (mBFCommunicationService != null) mBFCommunicationService.stop();
- }
-
- protected final void setStatus(int resId) {
- final ActionBar actionBar = getActionBar();
- if (actionBar != null) {
- actionBar.setSubtitle(resId);
- }
- }
-
- protected final void setStatus(CharSequence subTitle) {
- final ActionBar actionBar = getActionBar();
- if (actionBar != null) {
- actionBar.setSubtitle(subTitle);
- }
- }
-
- // The Handler that gets information back from the BluetoothChatService
- protected final Handler mHandler = new Handler() {
-
- @Override
- public void handleMessage(Message msg) {
- switch (msg.what) {
- case MESSAGE_STATE_CHANGE:
- Log.d(TAG, "MESSAGE_STATE_CHANGE: " + msg.arg1);
- switch (msg.arg1) {
- case BigFinCommunicationService.STATE_CONNECTED:
-// setStatus(getString(R.string.title_connected_to, mConnectedDeviceName));
- mConversationArrayAdapter.clear();
- mBFCommunicationService.write("a".getBytes());
- mBFCommunicationService.write("b".getBytes());
-
- Intent intent = new Intent(Home.this, MeasurementActivity.class);
- startActivity(intent);
-
- break;
-
- case BigFinCommunicationService.STATE_CONNECTING:
-// setStatus(R.string.title_connecting);
-
- break;
-
- case BigFinCommunicationService.STATE_LISTEN:
- case BigFinCommunicationService.STATE_NONE:
-// setStatus(R.string.title_not_connected);
- break;
- }
- break;
-
- case MESSAGE_WRITE:
- byte[] writeBuf = (byte[]) msg.obj;
- // construct a string from the buffer
- String writeMessage = new String(writeBuf);
-// mConversationArrayAdapter.add("Me: " + writeMessage);
- break;
-
- case MESSAGE_READ:
- byte[] readBuf = (byte[]) msg.obj;
- // construct a string from the valid bytes in the buffer
- String readMessage = new String(readBuf, 0, msg.arg1);
- mConversationArrayAdapter.add(readMessage);
-// mTts.speak(readMessage, TextToSpeech.QUEUE_ADD, null);
- break;
-
- case MESSAGE_DEVICE_NAME:
- // save the connected device's name
- mConnectedDeviceName = msg.getData().getString(DEVICE_NAME);
- Toast.makeText(getApplicationContext(), "Connected to "
- + mConnectedDeviceName, Toast.LENGTH_SHORT).show();
- break;
-
- case MESSAGE_TOAST:
- Toast.makeText(getApplicationContext(), msg.getData().getString(TOAST),
- Toast.LENGTH_SHORT).show();
- break;
- }
- }
- };
-
- public void onActivityResult(int requestCode, int resultCode, Intent data) {
-
- switch (requestCode) {
- case REQUEST_CONNECT_DEVICE:
- // When DeviceListActivity returns with a device to connect
- if (resultCode == Activity.RESULT_OK) {
- connectDevice(data);
- }
- break;
-
- case REQUEST_ENABLE_BT:
- // When the request to enable Bluetooth returns
- if (resultCode == Activity.RESULT_OK) {
- // Bluetooth is now enabled, so set up a chat location
- setupChat();
-
- } else {
- // User did not enable Bluetooth or an error occurred
- Log.d(TAG, "BT not enabled");
-// Toast.makeText(this, R.string.bt_not_enabled_leaving, Toast.LENGTH_SHORT).show();
- finish();
- }
- break;
-
- case REQUEST_CHECK_TTS:
- if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) {
- // Succès, au moins un moteur de TTS à été trouvé, on l'instancie
-// mTts = new TextToSpeech(this, this);
-
- } else {
- // Echec, aucun moteur n'a été trouvé, on propose à l'utilisateur d'en installer un depuis le Market
- Intent installIntent = new Intent();
- installIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
- startActivity(installIntent);
- }
- break;
- }
-
- }
-
- protected void connectDevice(Intent data) {
- // Get the device MAC address
- String address = data.getExtras()
- .getString(DeviceListActivity.EXTRA_DEVICE_ADDRESS);
- // Get the BluetoothDevice object
- BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(address);
- // Attempt to connect to the device
- mBFCommunicationService.connect(device);
-
- Intent intent = new Intent(this, MeasurementActivity.class);
- startActivity(intent);
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- MenuInflater inflater = getMenuInflater();
-// inflater.inflate(R.menu.option_menu, menu);
- return true;
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
-// switch (item.getItemId()) {
-// case R.id.connect_scan:
-// selectDevice();
-// return true;
-// case R.id.disconnect:
-//// mBFCommunicationService.start();
-// return true;
-// }
- return false;
- }
-
- @Override
- public void onInit(int status) {
- if (status == TextToSpeech.SUCCESS) {
-// if (mTts.isLanguageAvailable(Locale.FRANCE) == TextToSpeech.LANG_COUNTRY_AVAILABLE) {
-// mTts.setLanguage(Locale.FRANCE);
-// }
- }
- }
-}
Modified: trunk/src/fr/ifremer/wlo/MainActivity.java
===================================================================
--- trunk/src/fr/ifremer/wlo/MainActivity.java 2014-01-30 13:59:11 UTC (rev 42)
+++ trunk/src/fr/ifremer/wlo/MainActivity.java 2014-01-30 17:54:19 UTC (rev 43)
@@ -3,8 +3,8 @@
/*
* #%L
* WLO
- * $Id:$
- * $HeadURL:$
+ * $Id$
+ * $HeadURL$
* %%
* Copyright (C) 2013 - 2014 Ifremer
* %%
@@ -162,7 +162,8 @@
}
dialog.setProgress(11);
- } catch (IOException e) {
+ } catch (IOException | RuntimeException e) {
+ //TODO kmorin 20140130 show error to the user
Log.e(TAG, "error on initial import", e);
} finally {
Modified: trunk/src/fr/ifremer/wlo/measurement/MeasurementActivity.java
===================================================================
--- trunk/src/fr/ifremer/wlo/measurement/MeasurementActivity.java 2014-01-30 13:59:11 UTC (rev 42)
+++ trunk/src/fr/ifremer/wlo/measurement/MeasurementActivity.java 2014-01-30 17:54:19 UTC (rev 43)
@@ -39,6 +39,7 @@
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
+import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.Spinner;
@@ -102,6 +103,7 @@
protected EditText sizeText;
protected ActionBarDrawerToggle mDrawerToggle;
protected TextView observedNumberText;
+ protected Button validateButton;
protected MeasurementModel measurement;
protected MeasurementsModel measurements;
@@ -111,7 +113,7 @@
protected MetierModel metier;
protected VesselModel vessel;
- ListView mDrawerList;
+ protected ListView mDrawerList;
@Override
protected Integer getContentView() {
@@ -178,6 +180,8 @@
setupTab(R.id.table, TABLE_TAB, R.string.table_tab);
setupTab(R.id.logs, LOGS_TAB, R.string.logs_tab);
+ validateButton = (Button) findViewById(R.id.measurement_add_button);
+
sizeText = (EditText) findViewById(R.id.size);
int inputType = InputType.TYPE_CLASS_NUMBER;
if (measurements.getPrecision().isDecimal()) {
@@ -192,18 +196,23 @@
@Override
public void afterTextChanged(Editable s) {
- Mensuration.Precision precision = measurements.getPrecision();
- int multiplier = precision.getUnitDivider();
- try {
- NumberFormat format = NumberFormat.getInstance(Locale.US);
- Number number = format.parse(s.toString());
- double d = number.doubleValue();
- int size = (int)(d * multiplier);
- measurement.setSize(size);
+ if (s.toString().isEmpty()) {
+ measurement.setSize(null);
- } catch (ParseException e) {
- Log.e(TAG, "ParseException ", e);
- measurement.setSize(null);
+ } else {
+ Mensuration.Precision precision = measurements.getPrecision();
+ int multiplier = precision.getUnitDivider();
+ try {
+ NumberFormat format = NumberFormat.getInstance(Locale.US);
+ Number number = format.parse(s.toString());
+ double d = number.doubleValue();
+ int size = (int)(d * multiplier);
+ measurement.setSize(size);
+
+ } catch (ParseException e) {
+ Log.e(TAG, "ParseException " + e.getMessage());
+ measurement.setSize(null);
+ }
}
}
});
@@ -377,6 +386,9 @@
String text = null;
if (newValue != null) {
text = UIUtils.getFormattedSize((Integer) newValue, measurements.getPrecision());
+ validateButton.setEnabled(true);
+ } else {
+ validateButton.setEnabled(false);
}
sizeText.setText(text);
break;
Modified: trunk/src/fr/ifremer/wlo/models/BaseModel.java
===================================================================
--- trunk/src/fr/ifremer/wlo/models/BaseModel.java 2014-01-30 13:59:11 UTC (rev 42)
+++ trunk/src/fr/ifremer/wlo/models/BaseModel.java 2014-01-30 17:54:19 UTC (rev 43)
@@ -118,9 +118,9 @@
}
public void firePropertyChange(String property, Object oldValue, Object newValue) {
- Log.d(TAG, "fire " + property + " " + oldValue + " " + newValue);
- Log.d(TAG, "equals ? " + ObjectUtils.equals(oldValue, newValue));
- changeSupport.firePropertyChange(property, oldValue, newValue);
+ if (ObjectUtils.notEqual(oldValue, newValue)) {
+ changeSupport.firePropertyChange(property, oldValue, newValue);
+ }
}
public Set<String> getRequiredFields() {
Modified: trunk/src/fr/ifremer/wlo/models/MeasurementModel.java
===================================================================
--- trunk/src/fr/ifremer/wlo/models/MeasurementModel.java 2014-01-30 13:59:11 UTC (rev 42)
+++ trunk/src/fr/ifremer/wlo/models/MeasurementModel.java 2014-01-30 17:54:19 UTC (rev 43)
@@ -35,6 +35,7 @@
import fr.ifremer.wlo.models.referentials.Mensuration;
import fr.ifremer.wlo.storage.DataCache;
import fr.ifremer.wlo.utils.UIUtils;
+import org.apache.commons.lang3.ObjectUtils;
import java.util.Calendar;
@@ -93,7 +94,6 @@
public void setSize(Integer size) {
Integer oldValue = this.size;
this.size = size;
- Log.d(TAG, size + " " + oldValue + " " + size.equals(oldValue));
firePropertyChange(COLUMN_SIZE, oldValue, size);
}
Modified: trunk/src/fr/ifremer/wlo/models/referentials/imports/ImportUtil.java
===================================================================
--- trunk/src/fr/ifremer/wlo/models/referentials/imports/ImportUtil.java 2014-01-30 13:59:11 UTC (rev 42)
+++ trunk/src/fr/ifremer/wlo/models/referentials/imports/ImportUtil.java 2014-01-30 17:54:19 UTC (rev 43)
@@ -27,6 +27,7 @@
import android.app.AlertDialog;
import android.content.Context;
import android.util.Log;
+import com.csvreader.CsvReader;
import com.google.common.base.Function;
import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
@@ -38,12 +39,16 @@
import fr.ifremer.wlo.storage.DataCache;
import fr.ifremer.wlo.storage.WloSqlOpenHelper;
import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.io.IOUtils;
import org.nuiton.csv.Import;
import org.nuiton.csv.ImportModel;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
+import java.io.IOException;
import java.io.InputStream;
+import java.io.StringWriter;
+import java.nio.charset.Charset;
import java.util.Collection;
/**
@@ -235,8 +240,8 @@
protected static <M extends BaseModel> int importData(Context context, ImportModel<M> importModel,
InputStream inputStream, final Collection<M> actualReferential) {
Preconditions.checkNotNull(actualReferential);
- Import<M> importer = Import.newImport(importModel, inputStream);
- Collection<M> models = Lists.newArrayList(importer.iterator());
+ Import<M> importer = null;
+ Collection<M> models = null;
try {
importer = Import.newImport(importModel, inputStream);
1
0
Author: kmorin
Date: 2014-01-30 14:59:11 +0100 (Thu, 30 Jan 2014)
New Revision: 42
Url: http://forge.codelutin.com/projects/wlo/repository/revisions/42
Log:
fixes #4206 G?\195?\169rer le changement d'orientation
Modified:
trunk/AndroidManifest.xml
trunk/src/fr/ifremer/wlo/ScientificSpeciesActivity.java
trunk/src/fr/ifremer/wlo/WloBaseListActivity.java
Modified: trunk/AndroidManifest.xml
===================================================================
--- trunk/AndroidManifest.xml 2014-01-30 10:34:36 UTC (rev 41)
+++ trunk/AndroidManifest.xml 2014-01-30 13:59:11 UTC (rev 42)
@@ -30,28 +30,9 @@
<service android:name=".BigFinCommunicationService" />
- <!--<activity android:name=".Home"-->
- <!--android:label="@string/app_name"-->
- <!--android:configChanges="orientation|keyboardHidden">-->
- <!--<intent-filter>-->
- <!--<action android:name="android.intent.action.MAIN" />-->
- <!--<category android:name="android.intent.category.LAUNCHER" />-->
- <!--</intent-filter>-->
- <!--</activity>-->
-
- <activity android:name=".measurement.MeasurementActivity"
- android:label="@string/measurement_title"
- android:configChanges="orientation|keyboardHidden"
- android:screenOrientation="landscape"/>
-
- <activity android:name=".measurement.GraphActivity"
- android:label="@string/app_name"
- android:configChanges="orientation|keyboardHidden"
- android:screenOrientation="landscape"/>
-
<activity android:name=".MainActivity"
android:label="@string/app_name"
- android:configChanges="orientation|keyboardHidden"
+ android:configChanges="orientation|screenSize|keyboardHidden"
android:launchMode="singleInstance">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
@@ -59,70 +40,80 @@
</intent-filter>
</activity>
+ <activity android:name=".measurement.MeasurementActivity"
+ android:label="@string/measurement_title"
+ android:configChanges="orientation|screenSize|keyboardHidden"
+ android:screenOrientation="landscape"/>
+
+ <activity android:name=".measurement.GraphActivity"
+ android:label="@string/app_name"
+ android:configChanges="orientation|screenSize|keyboardHidden"
+ android:screenOrientation="landscape"/>
+
<activity android:name=".DeviceListActivity"
android:label="@string/devices_title"
- android:configChanges="orientation|keyboardHidden" />
+ android:configChanges="orientation|screenSize|keyboardHidden" />
<activity android:name=".ContextsActivity"
android:label="@string/contexts_title"
- android:configChanges="orientation|keyboardHidden"/>
+ android:configChanges="orientation|screenSize|keyboardHidden"/>
<activity android:name=".ContextFormActivity"
android:label="@string/new_context_title"
android:noHistory="true"
- android:configChanges="orientation|keyboardHidden"/>
+ android:configChanges="orientation|screenSize|keyboardHidden"/>
<activity android:name=".LocationsActivity"
android:label="@string/locations_title"
- android:configChanges="orientation|keyboardHidden"/>
+ android:configChanges="orientation|screenSize|keyboardHidden"/>
<activity android:name=".LocationFormActivity"
android:label="@string/new_location_title"
android:noHistory="true"
- android:configChanges="orientation|keyboardHidden"/>
+ android:configChanges="orientation|screenSize|keyboardHidden"/>
<activity android:name=".VesselsActivity"
android:label="@string/vessels_title"
- android:configChanges="orientation|keyboardHidden"/>
+ android:configChanges="orientation|screenSize|keyboardHidden"/>
<activity android:name=".VesselFormActivity"
android:label="@string/new_vessel_title"
android:noHistory="true"
- android:configChanges="orientation|keyboardHidden"/>
+ android:configChanges="orientation|screenSize|keyboardHidden"/>
<activity android:name=".MetiersActivity"
android:label="@string/metiers_title"
- android:configChanges="orientation|keyboardHidden"/>
+ android:configChanges="orientation|screenSize|keyboardHidden"/>
<activity android:name=".MetierFormActivity"
android:label="@string/new_metier_title"
android:noHistory="true"
- android:configChanges="orientation|keyboardHidden"/>
+ android:configChanges="orientation|screenSize|keyboardHidden"/>
<activity android:name=".CommercialSpeciesActivity"
android:label="@string/commercial_species_title"
- android:configChanges="orientation|keyboardHidden"/>
+ android:configChanges="orientation|screenSize|keyboardHidden"/>
<activity android:name=".CommercialSpeciesFormActivity"
android:label="@string/new_commercial_species_title"
android:noHistory="true"
- android:configChanges="orientation|keyboardHidden"/>
+ android:configChanges="orientation|screenSize|keyboardHidden"/>
<activity android:name=".ScientificSpeciesActivity"
android:label="@string/scientific_species_title"
- android:configChanges="orientation|keyboardHidden"/>
+ android:configChanges="orientation|screenSize|keyboardHidden"/>
<activity android:name=".ScientificSpeciesFormActivity"
android:label="@string/new_scientific_species_title"
android:noHistory="true"
- android:configChanges="orientation|keyboardHidden"/>
+ android:configChanges="orientation|screenSize|keyboardHidden"/>
<activity android:name=".preferences.SettingsActivity"
android:label="@string/main_settings"
- android:configChanges="orientation|keyboardHidden"/>
+ android:configChanges="orientation|screenSize|keyboardHidden"/>
<activity android:name=".utils.filechooser.FileDialog"
- android:configChanges="orientation|keyboardHidden"/>
+ android:configChanges="orientation|screenSize|keyboardHidden"/>
</application>
</manifest>
Modified: trunk/src/fr/ifremer/wlo/ScientificSpeciesActivity.java
===================================================================
--- trunk/src/fr/ifremer/wlo/ScientificSpeciesActivity.java 2014-01-30 10:34:36 UTC (rev 41)
+++ trunk/src/fr/ifremer/wlo/ScientificSpeciesActivity.java 2014-01-30 13:59:11 UTC (rev 42)
@@ -58,8 +58,7 @@
@Override
public boolean onCreateOptionsMenu(Menu menu) {
CommercialSpeciesModel parent = (CommercialSpeciesModel) parentModel;
- //TODO handle npe
- if (parent == null || parent.isSpeciesMix() || adapter.getCount() == 0) {
+ if (parent.isSpeciesMix() || adapter.getCount() == 0) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.model_list_menu, menu);
}
Modified: trunk/src/fr/ifremer/wlo/WloBaseListActivity.java
===================================================================
--- trunk/src/fr/ifremer/wlo/WloBaseListActivity.java 2014-01-30 10:34:36 UTC (rev 41)
+++ trunk/src/fr/ifremer/wlo/WloBaseListActivity.java 2014-01-30 13:59:11 UTC (rev 42)
@@ -42,6 +42,7 @@
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
+import android.content.res.Configuration;
import android.database.Cursor;
import android.os.Bundle;
import android.os.Handler;
@@ -310,7 +311,8 @@
@Override
public Intent getSupportParentActivityIntent() {
Intent intent = super.getSupportParentActivityIntent();
- if (intent != null && parentModel != null && HierarchicalModel.class.isAssignableFrom(parentModel.getClass())) {
+ if (intent != null && parentModel != null
+ && HierarchicalModel.class.isAssignableFrom(parentModel.getClass())) {
HierarchicalModel hParentModel = (HierarchicalModel) parentModel;
intent.putExtra(WloBaseListActivity.INTENT_EXTRA_PARENT_MODEL, hParentModel.getParent());
}
1
0