├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── drawable-hdpi │ │ │ │ ├── ic_search.png │ │ │ │ ├── ic_forward.png │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_location.png │ │ │ │ ├── ic_offline.png │ │ │ │ ├── ic_backwards.png │ │ │ │ ├── ic_event_error.png │ │ │ │ ├── ic_from_server.png │ │ │ │ ├── ic_close_dialog.png │ │ │ │ ├── ic_search_device.png │ │ │ │ ├── ic_search_device_white.png │ │ │ │ └── textfield_background.9.png │ │ │ ├── drawable-mdpi │ │ │ │ ├── ic_search.png │ │ │ │ ├── ic_forward.png │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_location.png │ │ │ │ ├── ic_offline.png │ │ │ │ ├── ic_backwards.png │ │ │ │ ├── ic_event_error.png │ │ │ │ ├── ic_from_server.png │ │ │ │ ├── ic_close_dialog.png │ │ │ │ ├── ic_search_device.png │ │ │ │ ├── ic_search_device_white.png │ │ │ │ ├── textfield_background.9.png │ │ │ │ └── white_selector.xml │ │ │ ├── drawable-xhdpi │ │ │ │ ├── ic_forward.png │ │ │ │ ├── ic_offline.png │ │ │ │ ├── ic_search.png │ │ │ │ ├── ic_backwards.png │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_location.png │ │ │ │ ├── ic_close_dialog.png │ │ │ │ ├── ic_event_error.png │ │ │ │ ├── ic_from_server.png │ │ │ │ ├── ic_search_device.png │ │ │ │ ├── ic_search_device_white.png │ │ │ │ ├── textfield_background.9.png │ │ │ │ └── ic_dialog_alert_holo_light.png │ │ │ ├── drawable-xxhdpi │ │ │ │ ├── ic_search.png │ │ │ │ ├── ic_backwards.png │ │ │ │ ├── ic_forward.png │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_location.png │ │ │ │ ├── ic_offline.png │ │ │ │ ├── ic_event_error.png │ │ │ │ ├── ic_from_server.png │ │ │ │ ├── ic_close_dialog.png │ │ │ │ ├── ic_search_device.png │ │ │ │ ├── spinner_triangle.png │ │ │ │ ├── ic_search_device_white.png │ │ │ │ └── textfield_background.9.png │ │ │ ├── xml │ │ │ │ └── searchable.xml │ │ │ ├── menu │ │ │ │ ├── long_click_event_menu.xml │ │ │ │ ├── menu_online_search_result.xml │ │ │ │ ├── menu_online_search.xml │ │ │ │ ├── menu_local_search.xml │ │ │ │ └── menu_select_program.xml │ │ │ ├── drawable │ │ │ │ ├── ic_warning_black_24dp.xml │ │ │ │ ├── white_selector.xml │ │ │ │ ├── transparent_selector.xml │ │ │ │ ├── rounded_corner.xml │ │ │ │ └── button_light_blue_selector.xml │ │ │ ├── layout │ │ │ │ ├── activity_local_search.xml │ │ │ │ ├── activity_holder.xml │ │ │ │ ├── fragmentdialog_createtei_header.xml │ │ │ │ ├── activity_main.xml │ │ │ │ ├── fragment_programoverview.xml │ │ │ │ ├── fragment_local_search_results.xml │ │ │ │ ├── fragment_trackedentityinstanceprofile.xml │ │ │ │ ├── fragmentdialog_querytei_header.xml │ │ │ │ ├── fragment_enrollment.xml │ │ │ │ ├── keyvalueview.xml │ │ │ │ ├── listview_column_names_item.xml │ │ │ │ ├── fragment_upcomingevents_header.xml │ │ │ │ ├── fragment_register_event.xml │ │ │ │ ├── listview_upcomingevent_item.xml │ │ │ │ └── fragment_select_program_header.xml │ │ │ ├── values │ │ │ │ ├── dimens.xml~ │ │ │ │ ├── colors.xml~ │ │ │ │ ├── strings.xml~ │ │ │ │ ├── colors.xml │ │ │ │ ├── dimens.xml │ │ │ │ ├── donottranslate.xml │ │ │ │ └── strings.xml │ │ │ ├── anim │ │ │ │ ├── decelerate_quint.xml │ │ │ │ ├── open_enter.xml │ │ │ │ └── open_exit.xml │ │ │ └── values-w820dp │ │ │ │ └── dimens.xml │ │ └── java │ │ │ └── org │ │ │ └── hisp │ │ │ └── dhis │ │ │ └── android │ │ │ └── trackercapture │ │ │ ├── fragments │ │ │ ├── selectprogram │ │ │ │ ├── dialogs │ │ │ │ │ ├── Action.java │ │ │ │ │ ├── QueryTrackedEntityInstancesDialogFragmentForm.java │ │ │ │ │ └── QueryTrackedEntityInstancesDialogFragmentQuery.java │ │ │ │ └── IEnroller.java │ │ │ ├── search │ │ │ │ ├── LocalSearchResultFragmentForm.java │ │ │ │ ├── OnlineSearchFragmentForm.java │ │ │ │ ├── LocalSearchFragmentForm.java │ │ │ │ ├── OnlineSearchFragmentQuery.java │ │ │ │ └── LocalSearchFragmentFormQuery.java │ │ │ ├── enrollmentdate │ │ │ │ ├── EnrollmentDateFragmentForm.java │ │ │ │ └── EnrollmentDateFragmentQuery.java │ │ │ ├── programoverview │ │ │ │ ├── KeyValueView.java │ │ │ │ └── registerrelationshipdialogfragment │ │ │ │ │ └── RegisterRelationshipDialogFragmentForm.java │ │ │ ├── settings │ │ │ │ └── SettingsFragment.java │ │ │ ├── trackedentityinstanceprofile │ │ │ │ └── TrackedEntityInstanceProfileFragmentForm.java │ │ │ ├── enrollment │ │ │ │ └── EnrollmentDataEntryFragmentForm.java │ │ │ └── trackedentityinstance │ │ │ │ └── TrackedEntityInstanceDataEntryFragmentForm.java │ │ │ ├── export │ │ │ ├── DBProvider.java │ │ │ ├── TrackerExportService.java │ │ │ └── TrackerExportResponse.java │ │ │ ├── ui │ │ │ ├── rows │ │ │ │ ├── upcomingevents │ │ │ │ │ ├── EventRowType.java │ │ │ │ │ ├── UpcomingEventsColumnNamesRow.java │ │ │ │ │ └── UpcomingEventItemRow.java │ │ │ │ └── programoverview │ │ │ │ │ ├── ProgramStageRow.java │ │ │ │ │ ├── OnProgramStageEventClick.java │ │ │ │ │ └── SearchRelativeTrackedEntityInstanceItemRow.java │ │ │ ├── DownloadEventSnackbar.java │ │ │ └── adapters │ │ │ │ ├── ProgramStageAdapter.java │ │ │ │ ├── UpcomingEventAdapter.java │ │ │ │ ├── ProgramAdapter.java │ │ │ │ └── RelationshipTypeAdapter.java │ │ │ └── TrackerCaptureApplication.java │ └── androidTest │ │ └── java │ │ └── org │ │ └── hisp │ │ └── dhis │ │ └── android │ │ └── trackercapture │ │ └── ApplicationTest.java ├── proguard-rules.pro └── build.gradle ├── .gitmodules ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── settings.gradle ├── generate_last_commit.sh ├── .gitignore ├── gradle.properties ├── README.md ├── LICENSE └── gradlew.bat /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "sdk"] 2 | path = sdk 3 | url = https://github.com/dhis2/dhis2-android-sdk 4 | branch = tracker-capture 5 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-hdpi/ic_search.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-mdpi/ic_search.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_forward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-hdpi/ic_forward.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-hdpi/ic_location.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_offline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-hdpi/ic_offline.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_forward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-mdpi/ic_forward.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-mdpi/ic_location.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_offline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-mdpi/ic_offline.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_forward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-xhdpi/ic_forward.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_offline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-xhdpi/ic_offline.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-xhdpi/ic_search.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-xxhdpi/ic_search.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_backwards.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-hdpi/ic_backwards.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_event_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-hdpi/ic_event_error.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_from_server.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-hdpi/ic_from_server.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_backwards.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-mdpi/ic_backwards.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_event_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-mdpi/ic_event_error.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_from_server.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-mdpi/ic_from_server.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_backwards.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-xhdpi/ic_backwards.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-xhdpi/ic_location.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_backwards.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-xxhdpi/ic_backwards.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_forward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-xxhdpi/ic_forward.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-xxhdpi/ic_location.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_offline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-xxhdpi/ic_offline.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_close_dialog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-hdpi/ic_close_dialog.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_search_device.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-hdpi/ic_search_device.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_close_dialog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-mdpi/ic_close_dialog.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_search_device.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-mdpi/ic_search_device.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_close_dialog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-xhdpi/ic_close_dialog.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_event_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-xhdpi/ic_event_error.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_from_server.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-xhdpi/ic_from_server.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_event_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-xxhdpi/ic_event_error.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_from_server.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-xxhdpi/ic_from_server.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_search_device.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-xhdpi/ic_search_device.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_close_dialog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-xxhdpi/ic_close_dialog.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_search_device.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-xxhdpi/ic_search_device.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/spinner_triangle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-xxhdpi/spinner_triangle.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_search_device_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-hdpi/ic_search_device_white.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/textfield_background.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-hdpi/textfield_background.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_search_device_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-mdpi/ic_search_device_white.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/textfield_background.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-mdpi/textfield_background.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_search_device_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-xhdpi/ic_search_device_white.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/textfield_background.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-xhdpi/textfield_background.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_search_device_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-xxhdpi/ic_search_device_white.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/textfield_background.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-xxhdpi/textfield_background.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_dialog_alert_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhis2/dhis2-android-trackercapture/HEAD/app/src/main/res/drawable-xhdpi/ic_dialog_alert_holo_light.png -------------------------------------------------------------------------------- /app/src/main/java/org/hisp/dhis/android/trackercapture/fragments/selectprogram/dialogs/Action.java: -------------------------------------------------------------------------------- 1 | package org.hisp.dhis.android.trackercapture.fragments.selectprogram.dialogs; 2 | 3 | 4 | public enum Action { QUERY, CREATE } 5 | -------------------------------------------------------------------------------- /app/src/main/res/xml/searchable.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':core', ':ui', ':utils' 2 | project(':core').projectDir = new File(settingsDir, 'sdk/core') 3 | project(':ui').projectDir = new File(settingsDir, 'sdk/ui') 4 | project(':utils').projectDir = new File(settingsDir, 'sdk/utils') -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Jul 11 09:14:23 CEST 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/java/org/hisp/dhis/android/trackercapture/export/DBProvider.java: -------------------------------------------------------------------------------- 1 | package org.hisp.dhis.android.trackercapture.export; 2 | 3 | import android.support.v4.content.FileProvider; 4 | 5 | public class DBProvider extends FileProvider { 6 | public DBProvider(){ 7 | super(); 8 | } 9 | } -------------------------------------------------------------------------------- /generate_last_commit.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | gitPath=$(git rev-parse --show-toplevel) 3 | filePath="${gitPath}/app/src/main/res/raw/lastcommit.txt" 4 | echo "Last commit path $filePath" 5 | commit=$(git log -1 HEAD --format=%H) 6 | echo "Saving last commit: ${commit}" 7 | echo ${commit} > $filePath 8 | echo "Done." 9 | -------------------------------------------------------------------------------- /app/src/main/res/menu/long_click_event_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #Eclipse 2 | .project 3 | .classpath 4 | .settings 5 | 6 | #IntelliJ IDEA 7 | .idea 8 | *.iml 9 | *.ipr 10 | *.iws 11 | out 12 | 13 | #Ant 14 | build.xml 15 | local.properties 16 | proguard.cfg 17 | #Gradle 18 | .gradle 19 | build 20 | 21 | #OSX 22 | .DS_Store 23 | 24 | #Windows 25 | *.db 26 | 27 | #Android 28 | *.apk 29 | fabric.properties 30 | 31 | # last commit file 32 | app/src/main/res/raw/lastcommit.txt -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_warning_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_online_search_result.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_online_search.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_local_search.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml~: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | 56dp 7 | 40dp 8 | 12dp 9 | 10 | 300 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml~: -------------------------------------------------------------------------------- 1 | 2 | 3 | #00000000 4 | #E1F5FE 5 | 6 | #B0BEC5 7 | #FF1F70C3 8 | #FF1D5288 9 | 10 | #FF1f70c3 11 | #ff333333 12 | 13 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /home/yojimbo/opt/android-sdk-linux/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_holder.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 14 | 15 | 19 | 20 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml~: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DHIS 2 Tracker Capture 5 | Hello world! 6 | Settings 7 | Register new event 8 | Registered events 9 | New event 10 | 11 | 12 | 13 | Username or password has changed. Please log out and sign in again. \nNote! Event will be lost 14 | Slow connection. Please, try to synchronize later 15 | 40x application level error. 16 | 50x server error. Please, try to synchronize later. 17 | Unknown error 18 | 19 | 20 | 21 | Search 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/java/org/hisp/dhis/android/trackercapture/export/TrackerExportService.java: -------------------------------------------------------------------------------- 1 | package org.hisp.dhis.android.trackercapture.export; 2 | 3 | import com.raizlabs.android.dbflow.config.FlowManager; 4 | import com.raizlabs.android.dbflow.sql.language.Select; 5 | 6 | import org.hisp.dhis.android.sdk.export.ExportService; 7 | import org.hisp.dhis.android.sdk.persistence.models.Enrollment; 8 | import org.hisp.dhis.android.sdk.persistence.models.Event; 9 | import org.hisp.dhis.android.sdk.persistence.models.TrackedEntityInstance; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * Created by thomaslindsjorn on 08/09/16. 15 | */ 16 | public class TrackerExportService extends ExportService { 17 | 18 | @Override 19 | public TrackerExportResponse getResponseObject() { 20 | FlowManager.init(this); 21 | List trackedEntityInstances = new Select().from(TrackedEntityInstance.class).queryList(); 22 | List enrollments = new Select().from(Enrollment.class).queryList(); 23 | List events = new Select().from(Event.class).queryList(); 24 | FlowManager.destroy(); 25 | return TrackerExportResponse.build(trackedEntityInstances, enrollments, events); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/java/org/hisp/dhis/android/trackercapture/fragments/search/LocalSearchResultFragmentForm.java: -------------------------------------------------------------------------------- 1 | package org.hisp.dhis.android.trackercapture.fragments.search; 2 | 3 | import org.hisp.dhis.android.sdk.ui.adapters.rows.events.EventRow; 4 | import org.hisp.dhis.android.sdk.ui.adapters.rows.events.TrackedEntityInstanceDynamicColumnRows; 5 | 6 | import java.util.List; 7 | 8 | public class LocalSearchResultFragmentForm { 9 | 10 | private List eventRowList; 11 | private String programId; 12 | private String orgUnitId; 13 | private TrackedEntityInstanceDynamicColumnRows columnNames; 14 | 15 | public LocalSearchResultFragmentForm(){} 16 | 17 | public List getEventRowList() { 18 | return eventRowList; 19 | } 20 | 21 | public void setEventRowList(List eventRowList) { 22 | this.eventRowList = eventRowList; 23 | } 24 | 25 | public String getOrgUnitId() { 26 | return orgUnitId; 27 | } 28 | 29 | public void setOrgUnitId(String orgUnitId) { 30 | this.orgUnitId = orgUnitId; 31 | } 32 | 33 | public String getProgramId() { 34 | return programId; 35 | } 36 | 37 | public void setProgramId(String programId) { 38 | this.programId = programId; 39 | } 40 | 41 | public TrackedEntityInstanceDynamicColumnRows getColumnNames() { 42 | return columnNames; 43 | } 44 | 45 | public void setColumnNames(TrackedEntityInstanceDynamicColumnRows columnNames) { 46 | this.columnNames = columnNames; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # This project is now DEPRECATED 2 | The app is not supported anymore so there won't be new versions in the future. Moreover, any pending or future bug won't be fixed. 3 | 4 | # dhis2-android-trackercapture 5 | Android application for DHIS 2 for tracking of persons and things. 6 | 7 | Get the APK from the release page: 8 | 9 | https://github.com/dhis2/dhis2-android-trackercapture/releases 10 | 11 | # Testing 12 | If you want to try the application out with a demo database, you can use the following: 13 | - Server: https://play.dhis2.org/demo 14 | - Username: android 15 | - Password: Android123 16 | 17 | # How to Download and Set up the development environment in Android Studio 18 | 19 | To successfully build and run this project, the dhis2-android-sdk is required. 20 | 21 | The dhis2-android-sdk project https://github.com/dhis2/dhis2-android-sdk folder should be in a subfolder named sdk inside dhis2-android-trackercapture. It is configured as a git submodule, so it will be automatically included when cloned using --recursive. 22 | 23 | Currently, the compatibility is guaranteed with 2.27, 2.28 and 2.29 servers, use develop branch in dhis2-android-trackercapture and tracker-capture branch in dhis2-android-sdk repositories. 24 | 25 | When cloning from zero, it's strongly recommended to do it as follows: 26 | 27 | ``` 28 | git clone --recursive -b develop git@github.com:dhis2/dhis2-android-trackercapture.git 29 | cd dhis2-android-trackercapture/sdk 30 | git checkout tracker-capture 31 | ``` 32 | 33 | Then open Android Studio, select "Open an existing Android Studio project", and select the build.gradle in dhis2-android-trackercapture/ 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, University of Oslo 3 | * * All rights reserved. 4 | * * 5 | * * Redistribution and use in source and binary forms, with or without 6 | * * modification, are permitted provided that the following conditions are met: 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * * list of conditions and the following disclaimer. 9 | * * 10 | * * Redistributions in binary form must reproduce the above copyright notice, 11 | * * this list of conditions and the following disclaimer in the documentation 12 | * * and/or other materials provided with the distribution. 13 | * * Neither the name of the HISP project nor the names of its contributors may 14 | * * be used to endorse or promote products derived from this software without 15 | * * specific prior written permission. 16 | * * 17 | * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | * * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 24 | * * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/res/values/donottranslate.xml: -------------------------------------------------------------------------------- 1 | 2 | 30 | 31 | DHIS 2 Tracker Capture 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/anim/decelerate_quint.xml: -------------------------------------------------------------------------------- 1 | 2 | 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/java/org/hisp/dhis/android/trackercapture/export/TrackerExportResponse.java: -------------------------------------------------------------------------------- 1 | package org.hisp.dhis.android.trackercapture.export; 2 | 3 | import org.hisp.dhis.android.sdk.export.ExportResponse; 4 | import org.hisp.dhis.android.sdk.persistence.models.Enrollment; 5 | import org.hisp.dhis.android.sdk.persistence.models.Event; 6 | import org.hisp.dhis.android.sdk.persistence.models.TrackedEntityInstance; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * Created by thomaslindsjorn on 08/09/16. 12 | */ 13 | public class TrackerExportResponse extends ExportResponse { 14 | List trackedEntityInstances; 15 | List enrollments; 16 | List events; 17 | 18 | private TrackerExportResponse(List trackedEntityInstances, List enrollments, List events) { 19 | this.trackedEntityInstances = trackedEntityInstances; 20 | this.enrollments = enrollments; 21 | this.events = events; 22 | } 23 | 24 | public List getTrackedEntityInstances() { 25 | return trackedEntityInstances; 26 | } 27 | 28 | public void setTrackedEntityInstances(List trackedEntityInstances) { 29 | this.trackedEntityInstances = trackedEntityInstances; 30 | } 31 | 32 | public List getEnrollments() { 33 | return enrollments; 34 | } 35 | 36 | public void setEnrollments(List enrollments) { 37 | this.enrollments = enrollments; 38 | } 39 | 40 | public List getEvents() { 41 | return events; 42 | } 43 | 44 | public void setEvents(List events) { 45 | this.events = events; 46 | } 47 | 48 | public static TrackerExportResponse build(List trackedEntityInstances, List enrollments, List events) { 49 | return new TrackerExportResponse(trackedEntityInstances, enrollments, events); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/src/main/java/org/hisp/dhis/android/trackercapture/ui/rows/upcomingevents/EventRowType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, University of Oslo 3 | * * All rights reserved. 4 | * * 5 | * * Redistribution and use in source and binary forms, with or without 6 | * * modification, are permitted provided that the following conditions are met: 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * * list of conditions and the following disclaimer. 9 | * * 10 | * * Redistributions in binary form must reproduce the above copyright notice, 11 | * * this list of conditions and the following disclaimer in the documentation 12 | * * and/or other materials provided with the distribution. 13 | * * Neither the name of the HISP project nor the names of its contributors may 14 | * * be used to endorse or promote products derived from this software without 15 | * * specific prior written permission. 16 | * * 17 | * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | * * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 24 | * * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | package org.hisp.dhis.android.trackercapture.ui.rows.upcomingevents; 31 | 32 | /** 33 | * Created by araz on 03.04.2015. 34 | */ 35 | public enum EventRowType { 36 | COLUMN_NAMES_ROW, 37 | EVENT_ITEM_ROW 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_local_search.xml: -------------------------------------------------------------------------------- 1 | 29 | 30 | 32 | 33 | 38 | 39 | -------------------------------------------------------------------------------- /app/src/main/res/anim/open_enter.xml: -------------------------------------------------------------------------------- 1 | 2 | 30 | 31 | 34 | 39 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 29 | 30 | 31 | 34 | 64dp 35 | 36 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/white_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/white_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/transparent_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/androidTest/java/org/hisp/dhis/android/trackercapture/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, University of Oslo 3 | * * All rights reserved. 4 | * * 5 | * * Redistribution and use in source and binary forms, with or without 6 | * * modification, are permitted provided that the following conditions are met: 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * * list of conditions and the following disclaimer. 9 | * * 10 | * * Redistributions in binary form must reproduce the above copyright notice, 11 | * * this list of conditions and the following disclaimer in the documentation 12 | * * and/or other materials provided with the distribution. 13 | * * Neither the name of the HISP project nor the names of its contributors may 14 | * * be used to endorse or promote products derived from this software without 15 | * * specific prior written permission. 16 | * * 17 | * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | * * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 24 | * * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | package org.hisp.dhis.android.trackercapture; 31 | 32 | import android.app.Application; 33 | import android.test.ApplicationTestCase; 34 | 35 | /** 36 | * Testing Fundamentals 37 | */ 38 | public class ApplicationTest extends ApplicationTestCase { 39 | public ApplicationTest() { 40 | super(Application.class); 41 | } 42 | } -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_select_program.xml: -------------------------------------------------------------------------------- 1 | 29 | 30 | 32 | 33 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /app/src/main/java/org/hisp/dhis/android/trackercapture/fragments/selectprogram/IEnroller.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, University of Oslo 3 | * * All rights reserved. 4 | * * 5 | * * Redistribution and use in source and binary forms, with or without 6 | * * modification, are permitted provided that the following conditions are met: 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * * list of conditions and the following disclaimer. 9 | * * 10 | * * Redistributions in binary form must reproduce the above copyright notice, 11 | * * this list of conditions and the following disclaimer in the documentation 12 | * * and/or other materials provided with the distribution. 13 | * * Neither the name of the HISP project nor the names of its contributors may 14 | * * be used to endorse or promote products derived from this software without 15 | * * specific prior written permission. 16 | * * 17 | * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | * * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 24 | * * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | package org.hisp.dhis.android.trackercapture.fragments.selectprogram; 31 | 32 | import org.hisp.dhis.android.sdk.persistence.models.TrackedEntityInstance; 33 | import org.joda.time.DateTime; 34 | 35 | /** 36 | * Interface to be implemented to be used by {@link EnrollmentDateSetterHelper} for triggering 37 | * enrollment creation 38 | */ 39 | public interface IEnroller { 40 | void showEnrollmentFragment(TrackedEntityInstance trackedEntityInstance, DateTime enrollmentDate, DateTime incidentDate); 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/java/org/hisp/dhis/android/trackercapture/ui/rows/programoverview/ProgramStageRow.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, University of Oslo 3 | * * All rights reserved. 4 | * * 5 | * * Redistribution and use in source and binary forms, with or without 6 | * * modification, are permitted provided that the following conditions are met: 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * * list of conditions and the following disclaimer. 9 | * * 10 | * * Redistributions in binary form must reproduce the above copyright notice, 11 | * * this list of conditions and the following disclaimer in the documentation 12 | * * and/or other materials provided with the distribution. 13 | * * Neither the name of the HISP project nor the names of its contributors may 14 | * * be used to endorse or promote products derived from this software without 15 | * * specific prior written permission. 16 | * * 17 | * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | * * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 24 | * * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | package org.hisp.dhis.android.trackercapture.ui.rows.programoverview; 31 | 32 | import android.view.LayoutInflater; 33 | import android.view.View; 34 | import android.view.ViewGroup; 35 | 36 | /** 37 | * @author Simen Skogly Russnes on 13.05.15. 38 | */ 39 | public interface ProgramStageRow { 40 | public View getView(LayoutInflater inflater, View convertView, ViewGroup container); 41 | public boolean hasFailed(); 42 | public void setHasFailed(boolean hasFailed); 43 | public void setSynchronized(boolean isSynchronized); 44 | public boolean isSynchronized(); 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragmentdialog_createtei_header.xml: -------------------------------------------------------------------------------- 1 | 29 | 30 | 35 | 36 | 43 | 44 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/rounded_corner.xml: -------------------------------------------------------------------------------- 1 | 2 | 30 | 33 | 34 | 35 | 37 | 38 | 39 | 40 | 43 | 44 | 45 | 46 | 51 | 52 | 53 | 54 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 29 | 30 | 36 | 37 | 44 | 45 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /app/src/main/java/org/hisp/dhis/android/trackercapture/TrackerCaptureApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, University of Oslo 3 | * * All rights reserved. 4 | * * 5 | * * Redistribution and use in source and binary forms, with or without 6 | * * modification, are permitted provided that the following conditions are met: 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * * list of conditions and the following disclaimer. 9 | * * 10 | * * Redistributions in binary form must reproduce the above copyright notice, 11 | * * this list of conditions and the following disclaimer in the documentation 12 | * * and/or other materials provided with the distribution. 13 | * * Neither the name of the HISP project nor the names of its contributors may 14 | * * be used to endorse or promote products derived from this software without 15 | * * specific prior written permission. 16 | * * 17 | * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | * * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 24 | * * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | package org.hisp.dhis.android.trackercapture; 31 | 32 | import android.app.Activity; 33 | 34 | import org.hisp.dhis.android.sdk.persistence.Dhis2Application; 35 | 36 | /** 37 | * @author Simen Skogly Russnes on 02.03.15. 38 | */ 39 | public class TrackerCaptureApplication extends Dhis2Application { 40 | 41 | @Override 42 | public void onCreate() { 43 | super.onCreate(); 44 | 45 | // if (LeakCanary.isInAnalyzerProcess(this)) { 46 | // // This process is dedicated to LeakCanary for heap analysis. 47 | // // You should not init your app in this process. 48 | // return; 49 | // } 50 | // 51 | // LeakCanary.install(this); 52 | } 53 | 54 | @Override 55 | public Class getMainActivity() { 56 | return new MainActivity().getClass(); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_programoverview.xml: -------------------------------------------------------------------------------- 1 | 2 | 30 | 31 | 32 | 33 | 34 | 38 | 39 | 43 | 44 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /app/src/main/java/org/hisp/dhis/android/trackercapture/fragments/enrollmentdate/EnrollmentDateFragmentForm.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, University of Oslo 3 | * * All rights reserved. 4 | * * 5 | * * Redistribution and use in source and binary forms, with or without 6 | * * modification, are permitted provided that the following conditions are met: 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * * list of conditions and the following disclaimer. 9 | * * 10 | * * Redistributions in binary form must reproduce the above copyright notice, 11 | * * this list of conditions and the following disclaimer in the documentation 12 | * * and/or other materials provided with the distribution. 13 | * * Neither the name of the HISP project nor the names of its contributors may 14 | * * be used to endorse or promote products derived from this software without 15 | * * specific prior written permission. 16 | * * 17 | * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | * * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 24 | * * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | package org.hisp.dhis.android.trackercapture.fragments.enrollmentdate; 31 | 32 | import org.hisp.dhis.android.sdk.persistence.models.Enrollment; 33 | import org.hisp.dhis.android.sdk.ui.adapters.rows.dataentry.Row; 34 | 35 | import java.util.List; 36 | 37 | /** 38 | * Created by erling on 9/15/15. 39 | */ 40 | public class EnrollmentDateFragmentForm 41 | { 42 | private Enrollment enrollment; 43 | private List dataEntryRows; 44 | 45 | public Enrollment getEnrollment() { 46 | return enrollment; 47 | } 48 | 49 | public void setEnrollment(Enrollment enrollment) { 50 | this.enrollment = enrollment; 51 | } 52 | 53 | public List getDataEntryRows() { 54 | return dataEntryRows; 55 | } 56 | 57 | public void setDataEntryRows(List dataEntryRows) { 58 | this.dataEntryRows = dataEntryRows; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_local_search_results.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 23 | 24 | 29 | 34 | 35 | 43 | 44 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /app/src/main/res/anim/open_exit.xml: -------------------------------------------------------------------------------- 1 | 2 | 30 | 31 | 39 | 44 | 53 | -------------------------------------------------------------------------------- /app/src/main/java/org/hisp/dhis/android/trackercapture/fragments/search/OnlineSearchFragmentForm.java: -------------------------------------------------------------------------------- 1 | package org.hisp.dhis.android.trackercapture.fragments.search; 2 | 3 | import org.hisp.dhis.android.sdk.persistence.models.DataValue; 4 | import org.hisp.dhis.android.sdk.persistence.models.TrackedEntityAttribute; 5 | import org.hisp.dhis.android.sdk.persistence.models.TrackedEntityAttributeValue; 6 | import org.hisp.dhis.android.sdk.ui.adapters.rows.dataentry.Row; 7 | 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | public class OnlineSearchFragmentForm { 12 | 13 | private String organisationUnit; 14 | private String program; 15 | private String queryString; 16 | private Map attributeValues; 17 | private List trackedEntityAttributes; 18 | private List trackedEntityAttributeValues; 19 | private List dataEntryRows; 20 | 21 | public String getOrganisationUnit() { 22 | return organisationUnit; 23 | } 24 | 25 | public void setOrganisationUnit(String organisationUnit) { 26 | this.organisationUnit = organisationUnit; 27 | } 28 | 29 | public Map getAttributeValues() { 30 | return attributeValues; 31 | } 32 | 33 | public void setAttributeValues(Map attributeValues) { 34 | this.attributeValues = attributeValues; 35 | } 36 | 37 | public List getTrackedEntityAttributes() { 38 | return trackedEntityAttributes; 39 | } 40 | 41 | public void setTrackedEntityAttributes(List trackedEntityAttributes) { 42 | this.trackedEntityAttributes = trackedEntityAttributes; 43 | } 44 | 45 | public List getDataEntryRows() { 46 | return dataEntryRows; 47 | } 48 | 49 | public void setDataEntryRows(List dataEntryRows) { 50 | this.dataEntryRows = dataEntryRows; 51 | } 52 | 53 | public List getTrackedEntityAttributeValues() { 54 | return trackedEntityAttributeValues; 55 | } 56 | 57 | public void setTrackedEntityAttributeValues(List trackedEntityAttributeValues) { 58 | this.trackedEntityAttributeValues = trackedEntityAttributeValues; 59 | } 60 | 61 | public String getProgram() { 62 | return program; 63 | } 64 | 65 | public void setProgram(String program) { 66 | this.program = program; 67 | } 68 | 69 | public String getQueryString() { 70 | return queryString; 71 | } 72 | 73 | public void setQueryString(String queryString) { 74 | this.queryString = queryString; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/button_light_blue_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_trackedentityinstanceprofile.xml: -------------------------------------------------------------------------------- 1 | 2 | 30 | 31 | 34 | 35 | 44 | 45 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /app/src/main/java/org/hisp/dhis/android/trackercapture/fragments/search/LocalSearchFragmentForm.java: -------------------------------------------------------------------------------- 1 | package org.hisp.dhis.android.trackercapture.fragments.search; 2 | 3 | import org.hisp.dhis.android.sdk.persistence.models.DataValue; 4 | import org.hisp.dhis.android.sdk.persistence.models.TrackedEntityAttribute; 5 | import org.hisp.dhis.android.sdk.persistence.models.TrackedEntityAttributeValue; 6 | import org.hisp.dhis.android.sdk.ui.adapters.rows.dataentry.Row; 7 | 8 | import java.util.HashMap; 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | public class LocalSearchFragmentForm { 13 | private String organisationUnitId; 14 | private String program; 15 | private String queryString; 16 | private HashMap attributeValues; 17 | private List trackedEntityAttributes; 18 | private List trackedEntityAttributeValues; 19 | private List dataEntryRows; 20 | 21 | public String getOrganisationUnitId() { 22 | return organisationUnitId; 23 | } 24 | 25 | public void setOrganisationUnitId(String organisationUnitId) { 26 | this.organisationUnitId = organisationUnitId; 27 | } 28 | 29 | public HashMap getAttributeValues() { 30 | return attributeValues; 31 | } 32 | 33 | public void setAttributeValues(HashMap attributeValues) { 34 | this.attributeValues = attributeValues; 35 | } 36 | 37 | public List getTrackedEntityAttributes() { 38 | return trackedEntityAttributes; 39 | } 40 | 41 | public void setTrackedEntityAttributes(List trackedEntityAttributes) { 42 | this.trackedEntityAttributes = trackedEntityAttributes; 43 | } 44 | 45 | public List getDataEntryRows() { 46 | return dataEntryRows; 47 | } 48 | 49 | public void setDataEntryRows(List dataEntryRows) { 50 | this.dataEntryRows = dataEntryRows; 51 | } 52 | 53 | public List getTrackedEntityAttributeValues() { 54 | return trackedEntityAttributeValues; 55 | } 56 | 57 | public void setTrackedEntityAttributeValues(List trackedEntityAttributeValues) { 58 | this.trackedEntityAttributeValues = trackedEntityAttributeValues; 59 | } 60 | 61 | public String getProgram() { 62 | return program; 63 | } 64 | 65 | public void setProgram(String program) { 66 | this.program = program; 67 | } 68 | 69 | public String getQueryString() { 70 | return queryString; 71 | } 72 | 73 | public void setQueryString(String queryString) { 74 | this.queryString = queryString; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /app/src/main/java/org/hisp/dhis/android/trackercapture/fragments/programoverview/KeyValueView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, University of Oslo 3 | * * All rights reserved. 4 | * * 5 | * * Redistribution and use in source and binary forms, with or without 6 | * * modification, are permitted provided that the following conditions are met: 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * * list of conditions and the following disclaimer. 9 | * * 10 | * * Redistributions in binary form must reproduce the above copyright notice, 11 | * * this list of conditions and the following disclaimer in the documentation 12 | * * and/or other materials provided with the distribution. 13 | * * Neither the name of the HISP project nor the names of its contributors may 14 | * * be used to endorse or promote products derived from this software without 15 | * * specific prior written permission. 16 | * * 17 | * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | * * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 24 | * * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | package org.hisp.dhis.android.trackercapture.fragments.programoverview; 31 | 32 | import android.view.LayoutInflater; 33 | import android.view.View; 34 | import android.view.ViewGroup; 35 | import android.widget.TextView; 36 | 37 | import org.hisp.dhis.android.trackercapture.R; 38 | 39 | public class KeyValueView { 40 | 41 | private String mLabel; 42 | private String mValue; 43 | 44 | public KeyValueView(String label, String value) { 45 | mLabel = label; 46 | mValue = value; 47 | } 48 | 49 | public View getView(LayoutInflater inflater, ViewGroup container) { 50 | View root = inflater.inflate( 51 | R.layout.keyvalueview, container, false); 52 | TextView label = (TextView) root.findViewById(R.id.label); 53 | TextView value = (TextView) root.findViewById(R.id.value); 54 | 55 | label.setText(mLabel); 56 | value.setText(mValue); 57 | return root; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragmentdialog_querytei_header.xml: -------------------------------------------------------------------------------- 1 | 29 | 30 | 35 | 36 | 42 | 43 | 50 | 51 | -------------------------------------------------------------------------------- /app/src/main/java/org/hisp/dhis/android/trackercapture/ui/DownloadEventSnackbar.java: -------------------------------------------------------------------------------- 1 | package org.hisp.dhis.android.trackercapture.ui; 2 | 3 | import android.support.design.widget.Snackbar; 4 | import android.view.View; 5 | 6 | import org.hisp.dhis.android.sdk.events.OnTeiDownloadedEvent; 7 | import org.hisp.dhis.android.trackercapture.R; 8 | import org.hisp.dhis.android.trackercapture.fragments.selectprogram.SelectProgramFragment; 9 | 10 | public class DownloadEventSnackbar { 11 | 12 | private final SelectProgramFragment selectProgramFragment; 13 | private boolean errorHasOccured; 14 | private Snackbar snackbar; 15 | 16 | public DownloadEventSnackbar(SelectProgramFragment selectProgramFragment) { 17 | this.selectProgramFragment = selectProgramFragment; 18 | } 19 | 20 | public void show(OnTeiDownloadedEvent downloadEvent) { 21 | switch (downloadEvent.getEventType()) { 22 | case START: // new download cycle. reset snackbar 23 | snackbar.dismiss(); 24 | snackbar = null; 25 | errorHasOccured = false; 26 | case ERROR: 27 | errorHasOccured = true; 28 | case END: 29 | if (errorHasOccured) { 30 | downloadEvent.setErrorHasOccured(true); 31 | showSnackbar(downloadEvent.getUserFriendlyMessage(selectProgramFragment.getContext()), downloadEvent.getMessageDuration()); 32 | snackbar.setAction(selectProgramFragment.getContext().getString(R.string.retry), new View.OnClickListener() { 33 | @Override 34 | public void onClick(View v) { 35 | selectProgramFragment.showOnlineSearchFragment(); 36 | } 37 | }); 38 | return; 39 | } 40 | default: 41 | showSnackbar(downloadEvent.getUserFriendlyMessage(selectProgramFragment.getContext()), downloadEvent.getMessageDuration()); 42 | } 43 | } 44 | 45 | private void showSnackbar(String message, int duration) { 46 | if (selectProgramFragment.getView() == null) { 47 | return; 48 | } 49 | 50 | if (snackbar == null) { 51 | snackbar = Snackbar.make(selectProgramFragment.getView(), message, duration); 52 | snackbar.setCallback(new Snackbar.Callback() { 53 | @Override 54 | public void onDismissed(Snackbar snackbar, int event) { 55 | super.onDismissed(snackbar, event); 56 | DownloadEventSnackbar.this.snackbar = null; 57 | } 58 | }); 59 | snackbar.show(); 60 | } else { 61 | snackbar.setText(message); 62 | snackbar.setDuration(duration); 63 | if (!snackbar.isShown()) { 64 | snackbar.show(); 65 | } 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_enrollment.xml: -------------------------------------------------------------------------------- 1 | 2 | 30 | 31 | 33 | 34 | 38 | 39 | 45 | 46 | 51 | 52 | 53 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /app/src/main/java/org/hisp/dhis/android/trackercapture/fragments/programoverview/registerrelationshipdialogfragment/RegisterRelationshipDialogFragmentForm.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, University of Oslo 3 | * * All rights reserved. 4 | * * 5 | * * Redistribution and use in source and binary forms, with or without 6 | * * modification, are permitted provided that the following conditions are met: 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * * list of conditions and the following disclaimer. 9 | * * 10 | * * Redistributions in binary form must reproduce the above copyright notice, 11 | * * this list of conditions and the following disclaimer in the documentation 12 | * * and/or other materials provided with the distribution. 13 | * * Neither the name of the HISP project nor the names of its contributors may 14 | * * be used to endorse or promote products derived from this software without 15 | * * specific prior written permission. 16 | * * 17 | * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | * * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 24 | * * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | package org.hisp.dhis.android.trackercapture.fragments.programoverview.registerrelationshipdialogfragment; 31 | 32 | import org.hisp.dhis.android.sdk.persistence.models.Enrollment; 33 | import org.hisp.dhis.android.sdk.persistence.models.TrackedEntityInstance; 34 | import org.hisp.dhis.android.sdk.ui.adapters.rows.events.EventRow; 35 | 36 | import java.util.List; 37 | 38 | /** 39 | * Created by Simen S. Russnes on 9/7/15. 40 | */ 41 | class RegisterRelationshipDialogFragmentForm 42 | { 43 | TrackedEntityInstance trackedEntityInstance; 44 | Enrollment enrollment; 45 | List rows; 46 | private String queryString; 47 | 48 | public TrackedEntityInstance getTrackedEntityInstance() { 49 | return trackedEntityInstance; 50 | } 51 | 52 | public void setTrackedEntityInstance(TrackedEntityInstance trackedEntityInstance) { 53 | this.trackedEntityInstance = trackedEntityInstance; 54 | } 55 | 56 | public List getRows() { 57 | return rows; 58 | } 59 | 60 | public void setRows(List rows) { 61 | this.rows = rows; 62 | } 63 | 64 | public String getQueryString() { 65 | return queryString; 66 | } 67 | 68 | public void setQueryString(String queryString) { 69 | this.queryString = queryString; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /app/src/main/res/layout/keyvalueview.xml: -------------------------------------------------------------------------------- 1 | 29 | 30 | 38 | 39 | 49 | 50 | 62 | 63 | -------------------------------------------------------------------------------- /app/src/main/java/org/hisp/dhis/android/trackercapture/fragments/search/OnlineSearchFragmentQuery.java: -------------------------------------------------------------------------------- 1 | package org.hisp.dhis.android.trackercapture.fragments.search; 2 | 3 | import android.content.Context; 4 | import android.util.Log; 5 | 6 | import org.hisp.dhis.android.sdk.controllers.metadata.MetaDataController; 7 | import org.hisp.dhis.android.sdk.persistence.loaders.Query; 8 | import org.hisp.dhis.android.sdk.persistence.models.Program; 9 | import org.hisp.dhis.android.sdk.persistence.models.ProgramTrackedEntityAttribute; 10 | import org.hisp.dhis.android.sdk.persistence.models.TrackedEntityAttribute; 11 | import org.hisp.dhis.android.sdk.persistence.models.TrackedEntityAttributeValue; 12 | import org.hisp.dhis.android.sdk.ui.adapters.rows.dataentry.DataEntryRowFactory; 13 | import org.hisp.dhis.android.sdk.ui.adapters.rows.dataentry.Row; 14 | 15 | import java.util.ArrayList; 16 | import java.util.List; 17 | 18 | 19 | public class OnlineSearchFragmentQuery implements Query { 20 | public static final String TAG = OnlineSearchFragmentQuery.class.getSimpleName(); 21 | private String orgUnit; 22 | private String programId; 23 | 24 | public OnlineSearchFragmentQuery(String orgUnit, String programId) { 25 | this.programId = programId; 26 | this.orgUnit = orgUnit; 27 | } 28 | 29 | @Override 30 | public OnlineSearchFragmentForm query(Context context) { 31 | OnlineSearchFragmentForm form = new OnlineSearchFragmentForm(); 32 | form.setOrganisationUnit(orgUnit); 33 | form.setProgram(programId); 34 | 35 | Log.d(TAG, orgUnit + programId); 36 | 37 | Program program = MetaDataController.getProgram(programId); 38 | if (program == null || orgUnit == null) { 39 | return form; 40 | } 41 | List programAttrs = 42 | program.getProgramTrackedEntityAttributes(); 43 | List values = new ArrayList<>(); 44 | List dataEntryRows = new ArrayList<>(); 45 | for (ProgramTrackedEntityAttribute ptea : programAttrs) { 46 | TrackedEntityAttribute trackedEntityAttribute = ptea.getTrackedEntityAttribute(); 47 | TrackedEntityAttributeValue value = new TrackedEntityAttributeValue(); 48 | value.setTrackedEntityAttributeId(trackedEntityAttribute.getUid()); 49 | values.add(value); 50 | 51 | if (ptea.getMandatory()) { 52 | ptea.setMandatory( 53 | !ptea.getMandatory()); // HACK to skip mandatory fields in search form 54 | } 55 | 56 | boolean isRadioButton = program.getDataEntryMethod(); 57 | if(!isRadioButton){ 58 | isRadioButton = ptea.isRenderOptionsAsRadio(); 59 | } 60 | Row row = DataEntryRowFactory.createDataEntryView(ptea.getMandatory(), 61 | ptea.getAllowFutureDate(), trackedEntityAttribute.getOptionSet(), 62 | trackedEntityAttribute.getName(), value, trackedEntityAttribute.getValueType(), 63 | true, false, isRadioButton); 64 | dataEntryRows.add(row); 65 | } 66 | form.setTrackedEntityAttributeValues(values); 67 | form.setDataEntryRows(dataEntryRows); 68 | return form; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /app/src/main/java/org/hisp/dhis/android/trackercapture/ui/adapters/ProgramStageAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, University of Oslo 3 | * * All rights reserved. 4 | * * 5 | * * Redistribution and use in source and binary forms, with or without 6 | * * modification, are permitted provided that the following conditions are met: 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * * list of conditions and the following disclaimer. 9 | * * 10 | * * Redistributions in binary form must reproduce the above copyright notice, 11 | * * this list of conditions and the following disclaimer in the documentation 12 | * * and/or other materials provided with the distribution. 13 | * * Neither the name of the HISP project nor the names of its contributors may 14 | * * be used to endorse or promote products derived from this software without 15 | * * specific prior written permission. 16 | * * 17 | * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | * * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 24 | * * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | package org.hisp.dhis.android.trackercapture.ui.adapters; 31 | 32 | import android.view.LayoutInflater; 33 | import android.view.View; 34 | import android.view.ViewGroup; 35 | 36 | import org.hisp.dhis.android.sdk.ui.adapters.AbsAdapter; 37 | import org.hisp.dhis.android.trackercapture.ui.rows.programoverview.ProgramStageRow; 38 | 39 | import java.util.List; 40 | 41 | /** 42 | * Adapter to show list of attribute name and attribute value horizontally 43 | */ 44 | public final class ProgramStageAdapter extends AbsAdapter { 45 | 46 | private static final String CLASS_TAG = ProgramStageAdapter.class.getSimpleName(); 47 | 48 | public ProgramStageAdapter(LayoutInflater inflater) { 49 | super(inflater); 50 | } 51 | 52 | @Override 53 | public View getView(int position, View convertView, ViewGroup parent) { 54 | if (getData() != null) { 55 | ProgramStageRow attributeRow = getData().get(position); 56 | View view = attributeRow.getView(getInflater(), convertView, parent); 57 | /*view.setLayoutParams(new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT, 58 | AbsListView.LayoutParams.WRAP_CONTENT));*/ 59 | view.setId(position); 60 | return view; 61 | } else { 62 | return null; 63 | } 64 | } 65 | 66 | @Override 67 | public void swapData(List data) { 68 | boolean notifyAdapter = mData != data; 69 | mData = data; 70 | if (notifyAdapter) { 71 | notifyDataSetChanged(); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, University of Oslo 3 | * * All rights reserved. 4 | * * 5 | * * Redistribution and use in source and binary forms, with or without 6 | * * modification, are permitted provided that the following conditions are met: 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * * list of conditions and the following disclaimer. 9 | * * 10 | * * Redistributions in binary form must reproduce the above copyright notice, 11 | * * this list of conditions and the following disclaimer in the documentation 12 | * * and/or other materials provided with the distribution. 13 | * * Neither the name of the HISP project nor the names of its contributors may 14 | * * be used to endorse or promote products derived from this software without 15 | * * specific prior written permission. 16 | * * 17 | * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | * * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 24 | * * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | apply plugin: 'com.android.application' 31 | apply plugin: 'io.fabric' 32 | apply plugin: 'jacoco-android' 33 | 34 | android { 35 | 36 | compileSdkVersion rootProject.ext.compileSdkVersion 37 | 38 | defaultConfig { 39 | minSdkVersion rootProject.ext.minSdkVersion 40 | targetSdkVersion rootProject.ext.targetSdkVersion 41 | versionCode rootProject.ext.versionCode 42 | versionName rootProject.ext.versionName 43 | applicationId rootProject.ext.configuration.applicationId 44 | multiDexEnabled true 45 | } 46 | 47 | buildTypes { 48 | release { 49 | minifyEnabled false 50 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 51 | } 52 | debug { 53 | testCoverageEnabled true 54 | } 55 | } 56 | 57 | lintOptions { 58 | disable 'RtlSymmetry', 'RtlHardcoded' 59 | abortOnError false 60 | } 61 | 62 | packagingOptions { 63 | exclude 'META-INF/DEPENDENCIES.txt' 64 | exclude 'META-INF/LICENSE.txt' 65 | exclude 'META-INF/NOTICE.txt' 66 | exclude 'META-INF/NOTICE' 67 | exclude 'META-INF/LICENSE' 68 | exclude 'META-INF/DEPENDENCIES' 69 | exclude 'META-INF/notice.txt' 70 | exclude 'META-INF/license.txt' 71 | exclude 'META-INF/dependencies.txt' 72 | exclude 'META-INF/LGPL2.1' 73 | } 74 | buildToolsVersion '27.0.3' 75 | } 76 | 77 | dependencies { 78 | compile project(':core') 79 | compile project(':ui') 80 | 81 | 82 | compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') { 83 | transitive = true; 84 | } 85 | 86 | compile 'com.android.support:multidex:1.0.2' 87 | } 88 | -------------------------------------------------------------------------------- /app/src/main/java/org/hisp/dhis/android/trackercapture/ui/adapters/UpcomingEventAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, University of Oslo 3 | * * All rights reserved. 4 | * * 5 | * * Redistribution and use in source and binary forms, with or without 6 | * * modification, are permitted provided that the following conditions are met: 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * * list of conditions and the following disclaimer. 9 | * * 10 | * * Redistributions in binary form must reproduce the above copyright notice, 11 | * * this list of conditions and the following disclaimer in the documentation 12 | * * and/or other materials provided with the distribution. 13 | * * Neither the name of the HISP project nor the names of its contributors may 14 | * * be used to endorse or promote products derived from this software without 15 | * * specific prior written permission. 16 | * * 17 | * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | * * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 24 | * * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | package org.hisp.dhis.android.trackercapture.ui.adapters; 31 | 32 | import android.view.LayoutInflater; 33 | import android.view.View; 34 | import android.view.ViewGroup; 35 | 36 | import org.hisp.dhis.android.sdk.ui.adapters.AbsAdapter; 37 | import org.hisp.dhis.android.sdk.ui.adapters.rows.events.EventRow; 38 | import org.hisp.dhis.android.trackercapture.ui.rows.upcomingevents.EventRowType; 39 | 40 | public class UpcomingEventAdapter extends AbsAdapter { 41 | 42 | public UpcomingEventAdapter(LayoutInflater inflater) { 43 | super(inflater); 44 | } 45 | 46 | @Override 47 | public long getItemId(int position) { 48 | if (getData() != null) { 49 | return getData().get(position).getId(); 50 | } else { 51 | return -1; 52 | } 53 | } 54 | 55 | @Override 56 | public View getView(int position, View convertView, ViewGroup parent) { 57 | if (getData() != null) { 58 | return getData().get(position).getView(getInflater(), convertView, parent); 59 | } else { 60 | return null; 61 | } 62 | } 63 | 64 | @Override 65 | public boolean areAllItemsEnabled() { 66 | return false; 67 | } 68 | 69 | @Override 70 | public boolean isEnabled(int position) { 71 | return getData() != null && getData().get(position).isEnabled(); 72 | } 73 | 74 | @Override 75 | public int getViewTypeCount() { 76 | return EventRowType.values().length; 77 | } 78 | 79 | @Override 80 | public int getItemViewType(int position) { 81 | if (getData() != null) { 82 | return getData().get(position).getViewType(); 83 | } else { 84 | return 0; 85 | } 86 | } 87 | } 88 | 89 | -------------------------------------------------------------------------------- /app/src/main/java/org/hisp/dhis/android/trackercapture/ui/rows/programoverview/OnProgramStageEventClick.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, University of Oslo 3 | * * All rights reserved. 4 | * * 5 | * * Redistribution and use in source and binary forms, with or without 6 | * * modification, are permitted provided that the following conditions are met: 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * * list of conditions and the following disclaimer. 9 | * * 10 | * * Redistributions in binary form must reproduce the above copyright notice, 11 | * * this list of conditions and the following disclaimer in the documentation 12 | * * and/or other materials provided with the distribution. 13 | * * Neither the name of the HISP project nor the names of its contributors may 14 | * * be used to endorse or promote products derived from this software without 15 | * * specific prior written permission. 16 | * * 17 | * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | * * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 24 | * * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | package org.hisp.dhis.android.trackercapture.ui.rows.programoverview; 31 | 32 | import android.view.View; 33 | import android.widget.ImageButton; 34 | 35 | import org.hisp.dhis.android.sdk.events.OnRowClick; 36 | import org.hisp.dhis.android.sdk.persistence.models.Event; 37 | 38 | /** 39 | * Created by erling on 5/28/15. 40 | */ 41 | public class OnProgramStageEventClick extends OnRowClick 42 | { 43 | private final Event event; 44 | private final ImageButton hasFailedButton; 45 | private final boolean hasPressedFailedButton; 46 | private final String errorMessage; 47 | private final boolean isLongPressed; 48 | private final View view; 49 | 50 | public OnProgramStageEventClick(Event event, ImageButton hasFailedButton, 51 | boolean hasPressedFailedButton, String errorMessage, ITEM_STATUS status, 52 | boolean isLongPressed, View view) 53 | { 54 | super(status, event); 55 | this.event = event; 56 | this.hasFailedButton = hasFailedButton; 57 | this.hasPressedFailedButton = hasPressedFailedButton; 58 | this.errorMessage = errorMessage; 59 | this.isLongPressed = isLongPressed; 60 | this.view = view; 61 | } 62 | public boolean isHasPressedFailedButton() { 63 | return hasPressedFailedButton; 64 | } 65 | 66 | public ImageButton getHasFailedButton() { 67 | return hasFailedButton; 68 | } 69 | 70 | public Event getEvent() { 71 | return event; 72 | } 73 | public String getErrorMessage() { 74 | return errorMessage; 75 | } 76 | 77 | public boolean isLongPressed() { 78 | return isLongPressed; 79 | } 80 | 81 | public View getView() { 82 | return view; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /app/src/main/java/org/hisp/dhis/android/trackercapture/fragments/search/LocalSearchFragmentFormQuery.java: -------------------------------------------------------------------------------- 1 | package org.hisp.dhis.android.trackercapture.fragments.search; 2 | 3 | import android.content.Context; 4 | import android.util.Log; 5 | 6 | import org.hisp.dhis.android.sdk.controllers.GpsController; 7 | import org.hisp.dhis.android.sdk.controllers.metadata.MetaDataController; 8 | import org.hisp.dhis.android.sdk.persistence.loaders.Query; 9 | import org.hisp.dhis.android.sdk.persistence.models.Program; 10 | import org.hisp.dhis.android.sdk.persistence.models.ProgramTrackedEntityAttribute; 11 | import org.hisp.dhis.android.sdk.persistence.models.TrackedEntityAttribute; 12 | import org.hisp.dhis.android.sdk.persistence.models.TrackedEntityAttributeValue; 13 | import org.hisp.dhis.android.sdk.ui.adapters.rows.dataentry.DataEntryRowFactory; 14 | import org.hisp.dhis.android.sdk.ui.adapters.rows.dataentry.Row; 15 | import org.hisp.dhis.android.sdk.utils.api.ValueType; 16 | 17 | import java.util.ArrayList; 18 | import java.util.List; 19 | 20 | public class LocalSearchFragmentFormQuery implements Query { 21 | private String TAG = this.getClass().getSimpleName(); 22 | private String orgUnitId; 23 | private String programId; 24 | 25 | public LocalSearchFragmentFormQuery(String orgUnitId, String programId) { 26 | this.orgUnitId = orgUnitId; 27 | this.programId = programId; 28 | } 29 | 30 | @Override 31 | public LocalSearchFragmentForm query(Context context) { 32 | LocalSearchFragmentForm form = new LocalSearchFragmentForm(); 33 | form.setOrganisationUnitId(orgUnitId); 34 | form.setProgram(programId); 35 | 36 | Log.d(TAG, orgUnitId + programId); 37 | 38 | Program program = MetaDataController.getProgram(programId); 39 | if (program == null || orgUnitId == null) { 40 | return form; 41 | } 42 | List programAttrs = 43 | program.getProgramTrackedEntityAttributes(); 44 | List values = new ArrayList<>(); 45 | List dataEntryRows = new ArrayList<>(); 46 | for (ProgramTrackedEntityAttribute ptea : programAttrs) { 47 | TrackedEntityAttribute trackedEntityAttribute = ptea.getTrackedEntityAttribute(); 48 | TrackedEntityAttributeValue value = new TrackedEntityAttributeValue(); 49 | value.setTrackedEntityAttributeId(trackedEntityAttribute.getUid()); 50 | values.add(value); 51 | 52 | if (ptea.getMandatory()) { 53 | ptea.setMandatory( 54 | !ptea.getMandatory()); // HACK to skip mandatory fields in search form 55 | } 56 | if (ValueType.COORDINATE.equals(ptea.getTrackedEntityAttribute().getValueType())) { 57 | GpsController.activateGps(context); 58 | } 59 | boolean isRadioButton = program.getDataEntryMethod(); 60 | if(!isRadioButton){ 61 | isRadioButton = ptea.isRenderOptionsAsRadio(); 62 | } 63 | Row row = DataEntryRowFactory.createDataEntryView(ptea.getMandatory(), 64 | ptea.getAllowFutureDate(), trackedEntityAttribute.getOptionSet(), 65 | trackedEntityAttribute.getName(), value, trackedEntityAttribute.getValueType(), 66 | true, false, isRadioButton); 67 | dataEntryRows.add(row); 68 | } 69 | form.setTrackedEntityAttributeValues(values); 70 | form.setDataEntryRows(dataEntryRows); 71 | return form; 72 | 73 | 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /app/src/main/java/org/hisp/dhis/android/trackercapture/fragments/enrollmentdate/EnrollmentDateFragmentQuery.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, University of Oslo 3 | * * All rights reserved. 4 | * * 5 | * * Redistribution and use in source and binary forms, with or without 6 | * * modification, are permitted provided that the following conditions are met: 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * * list of conditions and the following disclaimer. 9 | * * 10 | * * Redistributions in binary form must reproduce the above copyright notice, 11 | * * this list of conditions and the following disclaimer in the documentation 12 | * * and/or other materials provided with the distribution. 13 | * * Neither the name of the HISP project nor the names of its contributors may 14 | * * be used to endorse or promote products derived from this software without 15 | * * specific prior written permission. 16 | * * 17 | * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | * * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 24 | * * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | package org.hisp.dhis.android.trackercapture.fragments.enrollmentdate; 31 | 32 | import android.content.Context; 33 | 34 | import org.hisp.dhis.android.sdk.controllers.tracker.TrackerController; 35 | import org.hisp.dhis.android.sdk.persistence.loaders.Query; 36 | import org.hisp.dhis.android.sdk.persistence.models.Enrollment; 37 | import org.hisp.dhis.android.sdk.ui.adapters.rows.dataentry.EnrollmentDatePickerRow; 38 | import org.hisp.dhis.android.sdk.ui.adapters.rows.dataentry.IncidentDatePickerRow; 39 | import org.hisp.dhis.android.sdk.ui.adapters.rows.dataentry.Row; 40 | 41 | import java.util.ArrayList; 42 | import java.util.List; 43 | 44 | public class EnrollmentDateFragmentQuery implements Query { 45 | private final long enrollmentId; 46 | 47 | public EnrollmentDateFragmentQuery(long enrollmentId) { 48 | this.enrollmentId = enrollmentId; 49 | } 50 | 51 | @Override 52 | public EnrollmentDateFragmentForm query(Context context) { 53 | //should return two enrollmentdatepickerrows when developed (enrollment date & incident date) 54 | EnrollmentDateFragmentForm fragmentForm = new EnrollmentDateFragmentForm(); 55 | 56 | Enrollment enrollment = TrackerController.getEnrollment(enrollmentId); 57 | if (enrollment == null) 58 | return fragmentForm; 59 | 60 | List dataEntryRows = new ArrayList<>(); 61 | dataEntryRows.add(new EnrollmentDatePickerRow(enrollment.getProgram().getEnrollmentDateLabel(), enrollment, false)); 62 | 63 | if (enrollment.getProgram().getDisplayIncidentDate()) { 64 | dataEntryRows.add(new IncidentDatePickerRow(enrollment.getProgram().getIncidentDateLabel(), enrollment, true)); 65 | } 66 | 67 | fragmentForm.setEnrollment(enrollment); 68 | fragmentForm.setDataEntryRows(dataEntryRows); 69 | 70 | return fragmentForm; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /app/src/main/res/layout/listview_column_names_item.xml: -------------------------------------------------------------------------------- 1 | 29 | 30 | 37 | 38 | 46 | 47 | 51 | 52 | 56 | 57 | 63 | 64 | 65 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /app/src/main/java/org/hisp/dhis/android/trackercapture/ui/adapters/ProgramAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, University of Oslo 3 | * * All rights reserved. 4 | * * 5 | * * Redistribution and use in source and binary forms, with or without 6 | * * modification, are permitted provided that the following conditions are met: 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * * list of conditions and the following disclaimer. 9 | * * 10 | * * Redistributions in binary form must reproduce the above copyright notice, 11 | * * this list of conditions and the following disclaimer in the documentation 12 | * * and/or other materials provided with the distribution. 13 | * * Neither the name of the HISP project nor the names of its contributors may 14 | * * be used to endorse or promote products derived from this software without 15 | * * specific prior written permission. 16 | * * 17 | * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | * * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 24 | * * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | package org.hisp.dhis.android.trackercapture.ui.adapters; 31 | 32 | import android.view.LayoutInflater; 33 | import android.view.View; 34 | import android.view.ViewGroup; 35 | import android.widget.TextView; 36 | 37 | import org.hisp.dhis.android.sdk.R; 38 | import org.hisp.dhis.android.sdk.persistence.models.Program; 39 | import org.hisp.dhis.android.sdk.ui.adapters.AbsAdapter; 40 | 41 | import java.util.List; 42 | 43 | public final class ProgramAdapter extends AbsAdapter { 44 | private static final String DROPDOWN = "dropDown"; 45 | private static final String NON_DROPDOWN = "nonDropDown"; 46 | /** 47 | * Copy of original mData because some rows may be removed if they are hidden by program rules 48 | */ 49 | 50 | public ProgramAdapter(LayoutInflater inflater) { 51 | super(inflater); 52 | } 53 | 54 | @Override 55 | public View getDropDownView(int position, View view, ViewGroup parent) { 56 | if (view == null || !view.getTag().toString().equals(DROPDOWN)) { 57 | view = getInflater().inflate(R.layout.toolbar_spinner_item_dropdown, parent, false); 58 | view.setTag(DROPDOWN); 59 | } 60 | 61 | TextView textView = (TextView) view.findViewById(android.R.id.text1); 62 | textView.setText(getData().get(position).getName()); 63 | 64 | return view; 65 | } 66 | 67 | @Override 68 | public View getView(int position, View view, ViewGroup parent) { 69 | if (view == null || !view.getTag().toString().equals(NON_DROPDOWN)) { 70 | view = getInflater().inflate(R.layout. 71 | toolbar_spinner_item_actionbar, parent, false); 72 | view.setTag(NON_DROPDOWN); 73 | } 74 | 75 | TextView textView = (TextView) view.findViewById(android.R.id.text1); 76 | textView.setText(getData().get(position).getName()); 77 | return view; 78 | } 79 | 80 | @Override 81 | public void swapData(List data) { 82 | boolean notifyAdapter = mData != data; 83 | mData = data; 84 | 85 | if (notifyAdapter) { 86 | notifyDataSetChanged(); 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_upcomingevents_header.xml: -------------------------------------------------------------------------------- 1 | 29 | 30 | 35 | 36 | 42 | 43 | 49 | 50 | 56 | 57 | 63 | 64 | 65 | 66 | 72 | 73 | 81 | 82 | -------------------------------------------------------------------------------- /app/src/main/java/org/hisp/dhis/android/trackercapture/fragments/settings/SettingsFragment.java: -------------------------------------------------------------------------------- 1 | package org.hisp.dhis.android.trackercapture.fragments.settings; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.content.SharedPreferences; 6 | import android.os.Bundle; 7 | import android.preference.PreferenceManager; 8 | import android.view.View; 9 | import android.widget.CompoundButton; 10 | import android.widget.Toast; 11 | 12 | import com.squareup.otto.Subscribe; 13 | 14 | import org.hisp.dhis.android.sdk.events.LoadingMessageEvent; 15 | import org.hisp.dhis.android.sdk.events.UiEvent; 16 | import org.hisp.dhis.android.sdk.ui.views.FontButton; 17 | import org.hisp.dhis.android.sdk.ui.views.FontCheckBox; 18 | import org.hisp.dhis.android.trackercapture.R; 19 | import org.hisp.dhis.android.trackercapture.export.ExportData; 20 | 21 | import java.io.IOException; 22 | 23 | public class SettingsFragment extends 24 | org.hisp.dhis.android.sdk.ui.fragments.settings.SettingsFragment{ 25 | 26 | private FontButton exportDataButton; 27 | 28 | @Override 29 | public void onViewCreated(View view, Bundle savedInstanceState) { 30 | exportDataButton = (FontButton) view.findViewById(R.id.settings_export_data); 31 | exportDataButton.setOnClickListener(new View.OnClickListener() { 32 | @Override 33 | public void onClick(View v) { 34 | onExportDataClick(); 35 | } 36 | }); 37 | FontCheckBox fontCheckBox = (FontCheckBox) view.findViewById( 38 | R.id.checkbox_developers_options); 39 | 40 | Context context = getActivity().getApplicationContext(); 41 | SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences( 42 | context); 43 | fontCheckBox.setChecked(sharedPreferences.getBoolean( 44 | getActivity().getApplicationContext().getResources().getString( 45 | R.string.developer_option_key), false)); 46 | toggleOptions(fontCheckBox.isChecked()); 47 | fontCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { 48 | @Override 49 | public void onCheckedChanged(CompoundButton compoundButton, boolean value) { 50 | SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences( 51 | getActivity().getApplicationContext()); 52 | SharedPreferences.Editor prefEditor = 53 | sharedPref.edit(); // Get preference in editor mode 54 | prefEditor.putBoolean( 55 | getActivity().getApplicationContext().getResources().getString( 56 | org.hisp.dhis.android.sdk.R.string.developer_option_key), value); 57 | prefEditor.commit(); 58 | toggleOptions(value); 59 | } 60 | }); 61 | } 62 | 63 | private void toggleOptions(boolean value) { 64 | if (value) { 65 | exportDataButton.setVisibility(View.VISIBLE); 66 | } else { 67 | exportDataButton.setVisibility(View.INVISIBLE); 68 | } 69 | } 70 | 71 | public void onExportDataClick() { 72 | ExportData exportData = new ExportData(); 73 | Intent emailIntent = null; 74 | try { 75 | emailIntent = exportData.dumpAndSendToAIntent(getActivity()); 76 | } catch (IOException e) { 77 | Toast.makeText(getContext(), org.hisp.dhis.android.sdk.R.string.error_exporting_data, Toast.LENGTH_LONG).show(); 78 | } 79 | if (emailIntent != null) { 80 | startActivity(emailIntent); 81 | } 82 | } 83 | 84 | 85 | @Subscribe 86 | public void onSynchronizationFinishedEvent(final UiEvent event) 87 | { 88 | super.onSynchronizationFinishedEvent(event); 89 | } 90 | 91 | @Subscribe 92 | public void onLoadingMessageEvent(final LoadingMessageEvent event) { 93 | super.onLoadingMessageEvent(event); 94 | } 95 | } -------------------------------------------------------------------------------- /app/src/main/java/org/hisp/dhis/android/trackercapture/ui/adapters/RelationshipTypeAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, University of Oslo 3 | * * All rights reserved. 4 | * * 5 | * * Redistribution and use in source and binary forms, with or without 6 | * * modification, are permitted provided that the following conditions are met: 7 | * * Redistributions of source code must retain the above copyright notice, this 8 | * * list of conditions and the following disclaimer. 9 | * * 10 | * * Redistributions in binary form must reproduce the above copyright notice, 11 | * * this list of conditions and the following disclaimer in the documentation 12 | * * and/or other materials provided with the distribution. 13 | * * Neither the name of the HISP project nor the names of its contributors may 14 | * * be used to endorse or promote products derived from this software without 15 | * * specific prior written permission. 16 | * * 17 | * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | * * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | * * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 21 | * * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | * * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 24 | * * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | */ 29 | 30 | package org.hisp.dhis.android.trackercapture.ui.adapters; 31 | 32 | import android.view.LayoutInflater; 33 | import android.view.View; 34 | import android.view.ViewGroup; 35 | import android.widget.TextView; 36 | 37 | import org.hisp.dhis.android.sdk.R; 38 | import org.hisp.dhis.android.sdk.persistence.models.Program; 39 | import org.hisp.dhis.android.sdk.ui.adapters.AbsAdapter; 40 | 41 | import java.util.List; 42 | 43 | public final class RelationshipTypeAdapter extends AbsAdapter { 44 | private static final String DROPDOWN = "dropDown"; 45 | private static final String NON_DROPDOWN = "nonDropDown"; 46 | 47 | private String relationshipType; 48 | /** 49 | * Copy of original mData because some rows may be removed if they are hidden by program rules 50 | */ 51 | 52 | public RelationshipTypeAdapter(LayoutInflater inflater) { 53 | super(inflater); 54 | } 55 | 56 | @Override 57 | public View getDropDownView(int position, View view, ViewGroup parent) { 58 | if (view == null || !view.getTag().toString().equals(DROPDOWN)) { 59 | view = getInflater().inflate(R.layout.toolbar_spinner_item_dropdown, parent, false); 60 | view.setTag(DROPDOWN); 61 | } 62 | 63 | TextView textView = (TextView) view.findViewById(android.R.id.text1); 64 | textView.setText(getData().get(position)); 65 | 66 | return view; 67 | } 68 | 69 | @Override 70 | public View getView(int position, View view, ViewGroup parent) { 71 | if (view == null || !view.getTag().toString().equals(NON_DROPDOWN)) { 72 | view = getInflater().inflate(R.layout. 73 | toolbar_spinner_item_darktext, parent, false); 74 | view.setTag(NON_DROPDOWN); 75 | } 76 | 77 | TextView textView = (TextView) view.findViewById(android.R.id.text1); 78 | textView.setText(getData().get(position)); 79 | return view; 80 | } 81 | 82 | public void swapData(List data, String relationshipType) { 83 | this.relationshipType = relationshipType; 84 | super.swapData(data); 85 | } 86 | 87 | public String getRelationshipType() { 88 | return relationshipType; 89 | } 90 | 91 | public void setRelationshipType(String relationshipType) { 92 | this.relationshipType = relationshipType; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_register_event.xml: -------------------------------------------------------------------------------- 1 | 2 | 30 | 31 | 33 | 34 | 38 | 39 | 45 | 46 | 50 | 51 | 52 | 53 | 63 | 64 | 65 | 66 | 76 | 77 | 78 | 79 |