--------------------------------------------------------------------------------
/.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 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_online_search.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
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 extends Activity> 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 |
86 |
87 |
88 |
89 |
90 |
91 |
96 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/app/src/main/java/org/hisp/dhis/android/trackercapture/ui/rows/upcomingevents/UpcomingEventsColumnNamesRow.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 | 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.ui.adapters.rows.events.EventRow;
38 | import org.hisp.dhis.android.trackercapture.R;
39 |
40 | /**
41 | * Created by araz on 03.04.2015.
42 | */
43 | public class UpcomingEventsColumnNamesRow implements EventRow {
44 | private String mTitle;
45 | private String mFirstItem;
46 | private String mSecondItem;
47 |
48 | @Override
49 | public View getView(LayoutInflater inflater, View convertView, ViewGroup container) {
50 | View view;
51 | ViewHolder holder;
52 |
53 | if (convertView == null) {
54 | view = inflater.inflate(R.layout.listview_upcomingevents_column_names_item, container, false);
55 | holder = new ViewHolder(
56 | (TextView) view.findViewById(R.id.title_column_name),
57 | (TextView) view.findViewById(R.id.first_column_name),
58 | (TextView) view.findViewById(R.id.second_column_name)
59 | );
60 | view.setTag(holder);
61 | } else {
62 | view = convertView;
63 | holder = (ViewHolder) view.getTag();
64 | }
65 | holder.title.setText(mTitle);
66 | holder.firstItem.setText(mFirstItem);
67 | holder.secondItem.setText(mSecondItem);
68 |
69 | return view;
70 | }
71 |
72 | @Override
73 | public int getViewType() {
74 | return EventRowType.COLUMN_NAMES_ROW.ordinal();
75 | }
76 |
77 | @Override
78 | public long getId() {
79 | return -1;
80 | }
81 |
82 | @Override
83 | public boolean isEnabled() {
84 | return false;
85 | }
86 |
87 | public void setTitle(String mTitle) {
88 | this.mTitle = mTitle;
89 | }
90 |
91 | public void setSecondItem(String secondItem) {
92 | this.mSecondItem = secondItem;
93 | }
94 |
95 | public void setFirstItem(String firstItem) {
96 | this.mFirstItem = firstItem;
97 | }
98 |
99 | private static class ViewHolder {
100 | public final TextView title;
101 | public final TextView firstItem;
102 | public final TextView secondItem;
103 |
104 |
105 | private ViewHolder(TextView title, TextView firstItem,
106 | TextView secondItem) {
107 | this.title = title;
108 | this.firstItem = firstItem;
109 | this.secondItem = secondItem;
110 | }
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/app/src/main/java/org/hisp/dhis/android/trackercapture/fragments/selectprogram/dialogs/QueryTrackedEntityInstancesDialogFragmentForm.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.dialogs;
31 |
32 | import org.hisp.dhis.android.sdk.persistence.models.DataValue;
33 | import org.hisp.dhis.android.sdk.persistence.models.TrackedEntityAttribute;
34 | import org.hisp.dhis.android.sdk.persistence.models.TrackedEntityAttributeValue;
35 | import org.hisp.dhis.android.sdk.ui.adapters.rows.dataentry.Row;
36 |
37 | import java.util.List;
38 | import java.util.Map;
39 |
40 | /**
41 | * Created by Simen S. Russnes on 9/7/15.
42 | */
43 | class QueryTrackedEntityInstancesDialogFragmentForm
44 | {
45 | private String organisationUnit;
46 | private String program;
47 | private String queryString;
48 | private Map attributeValues;
49 | private List trackedEntityAttributes;
50 | private List trackedEntityAttributeValues;
51 | private List dataEntryRows;
52 |
53 | public String getOrganisationUnit() {
54 | return organisationUnit;
55 | }
56 |
57 | public void setOrganisationUnit(String organisationUnit) {
58 | this.organisationUnit = organisationUnit;
59 | }
60 |
61 | public Map getAttributeValues() {
62 | return attributeValues;
63 | }
64 |
65 | public void setAttributeValues(Map attributeValues) {
66 | this.attributeValues = attributeValues;
67 | }
68 |
69 | public List getTrackedEntityAttributes() {
70 | return trackedEntityAttributes;
71 | }
72 |
73 | public void setTrackedEntityAttributes(List trackedEntityAttributes) {
74 | this.trackedEntityAttributes = trackedEntityAttributes;
75 | }
76 |
77 | public List getDataEntryRows() {
78 | return dataEntryRows;
79 | }
80 |
81 | public void setDataEntryRows(List dataEntryRows) {
82 | this.dataEntryRows = dataEntryRows;
83 | }
84 |
85 | public List getTrackedEntityAttributeValues() {
86 | return trackedEntityAttributeValues;
87 | }
88 |
89 | public void setTrackedEntityAttributeValues(List trackedEntityAttributeValues) {
90 | this.trackedEntityAttributeValues = trackedEntityAttributeValues;
91 | }
92 |
93 | public String getProgram() {
94 | return program;
95 | }
96 |
97 | public void setProgram(String program) {
98 | this.program = program;
99 | }
100 |
101 | public String getQueryString() {
102 | return queryString;
103 | }
104 |
105 | public void setQueryString(String queryString) {
106 | this.queryString = queryString;
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/listview_upcomingevent_item.xml:
--------------------------------------------------------------------------------
1 |
29 |
30 |
37 |
38 |
50 |
51 |
55 |
56 |
68 |
69 |
73 |
74 |
86 |
87 |
91 |
92 |
104 |
105 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_select_program_header.xml:
--------------------------------------------------------------------------------
1 |
29 |
30 |
35 |
36 |
42 |
43 |
49 |
54 |
55 |
61 |
62 |
68 |
69 |
75 |
81 |
82 |
83 |
84 |
85 |
86 |
94 |
98 |
--------------------------------------------------------------------------------
/app/src/main/java/org/hisp/dhis/android/trackercapture/ui/rows/programoverview/SearchRelativeTrackedEntityInstanceItemRow.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.content.Context;
33 | import android.view.LayoutInflater;
34 | import android.view.View;
35 | import android.view.ViewGroup;
36 | import android.widget.LinearLayout;
37 | import android.widget.TextView;
38 |
39 | import org.hisp.dhis.android.trackercapture.R;
40 | import org.hisp.dhis.android.sdk.ui.adapters.rows.events.TrackedEntityInstanceItemRow;
41 |
42 | /**
43 | * Created by erling on 5/11/15.
44 | */
45 | public class SearchRelativeTrackedEntityInstanceItemRow extends TrackedEntityInstanceItemRow
46 | {
47 |
48 | private String mFourthItem;
49 |
50 | public SearchRelativeTrackedEntityInstanceItemRow(Context context)
51 | {
52 | super(context);
53 | }
54 |
55 | @Override
56 | public View getView(LayoutInflater inflater, View convertView, ViewGroup container) {
57 | View view;
58 | ViewHolder holder;
59 |
60 | if (convertView == null) {
61 | view = inflater.inflate(org.hisp.dhis.android.sdk.R.layout.listview_trackedentityinstance_item, container, false);
62 | holder = new ViewHolder(
63 | (TextView) view.findViewById(R.id.first_event_item),
64 | (TextView) view.findViewById(R.id.second_event_item),
65 | (TextView) view.findViewById(R.id.third_event_item),
66 | (TextView) view.findViewById(R.id.status_text_view)
67 | );
68 | view.setTag(holder);
69 | } else {
70 | view = convertView;
71 | holder = (ViewHolder) view.getTag();
72 | }
73 | if(columns.size()>=1 && columns.get(0)!=null)
74 | holder.firstItem.setText(columns.get(0));
75 | if(columns.size()>=2 == (columns.get(1)!=null))
76 | holder.secondItem.setText(columns.get(1));
77 | if(columns.size()>=3 && columns.get(2)!=null)
78 | holder.thirdItem.setText(columns.get(2));
79 | if(columns.size()>=4 && columns.get(3)!=null)
80 | holder.fourthItem.setText(columns.get(3));
81 |
82 | return view;
83 | }
84 |
85 | public String getmFourthItem() {
86 | return mFourthItem;
87 | }
88 |
89 | public void setFourthItem(String mFourthItem) {
90 | this.mFourthItem = mFourthItem;
91 | }
92 |
93 | private static class ViewHolder {
94 | public final TextView firstItem;
95 | public final TextView secondItem;
96 | public final TextView thirdItem;
97 | public final TextView fourthItem;
98 |
99 | private ViewHolder(TextView firstItem,
100 | TextView secondItem,
101 | TextView thirdItem,
102 | TextView fourthItem) {
103 | this.firstItem = firstItem;
104 | this.secondItem = secondItem;
105 | this.thirdItem = thirdItem;
106 | this.fourthItem = fourthItem;
107 | }
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/app/src/main/java/org/hisp/dhis/android/trackercapture/fragments/trackedentityinstanceprofile/TrackedEntityInstanceProfileFragmentForm.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.trackedentityinstanceprofile;
31 |
32 | import org.hisp.dhis.android.sdk.persistence.models.Enrollment;
33 | import org.hisp.dhis.android.sdk.persistence.models.Program;
34 | import org.hisp.dhis.android.sdk.persistence.models.TrackedEntityAttributeValue;
35 | import org.hisp.dhis.android.sdk.persistence.models.TrackedEntityInstance;
36 | import org.hisp.dhis.android.sdk.ui.adapters.rows.dataentry.DataEntryRow;
37 | import org.hisp.dhis.android.sdk.ui.adapters.rows.dataentry.Row;
38 |
39 | import java.util.List;
40 | import java.util.Map;
41 |
42 | /**
43 | * Created by erling on 5/18/15.
44 | */
45 | public class TrackedEntityInstanceProfileFragmentForm
46 | {
47 | private Enrollment mEnrollment;
48 | private Program mProgram;
49 | private TrackedEntityInstance mTrackedEntityInstance;
50 | private List mDataEntryRows;
51 | private List trackedEntityAttributeValues;
52 | //for the program rules:
53 | private Map trackedEntityAttributeValueMap; //value storage
54 | private boolean outOfTrackedEntityAttributeGeneratedValues; //?
55 |
56 | public List getTrackedEntityAttributeValues() {
57 | return trackedEntityAttributeValues;
58 | }
59 |
60 | public void setTrackedEntityAttributeValues(List trackedEntityAttributeValues) {
61 | this.trackedEntityAttributeValues = trackedEntityAttributeValues;
62 | }
63 |
64 | public Enrollment getEnrollment() {
65 | return mEnrollment;
66 | }
67 |
68 | public void setEnrollment(Enrollment mEnrollment) {
69 | this.mEnrollment = mEnrollment;
70 | }
71 |
72 | public Program getProgram() {
73 | return mProgram;
74 | }
75 |
76 | public void setProgram(Program mProgram) {
77 | this.mProgram = mProgram;
78 | }
79 |
80 | public TrackedEntityInstance getTrackedEntityInstance() {
81 | return mTrackedEntityInstance;
82 | }
83 |
84 | public void setTrackedEntityInstance(TrackedEntityInstance mTrackedEntityInstance) {
85 | this.mTrackedEntityInstance = mTrackedEntityInstance;
86 | }
87 |
88 | public List getDataEntryRows() {
89 | return mDataEntryRows;
90 | }
91 |
92 | public void setDataEntryRows(List mDataEntryRows) {
93 | this.mDataEntryRows = mDataEntryRows;
94 | }
95 | public Map getTrackedEntityAttributeValueMap() {
96 | return trackedEntityAttributeValueMap;
97 | }
98 |
99 | public void setTrackedEntityAttributeValueMap(Map trackedEntityAttributeValueMap) {
100 | this.trackedEntityAttributeValueMap = trackedEntityAttributeValueMap;
101 | }
102 |
103 | public void setOutOfTrackedEntityAttributeGeneratedValues(boolean outOfTrackedEntityAttributeGeneratedValues) {
104 | this.outOfTrackedEntityAttributeGeneratedValues = outOfTrackedEntityAttributeGeneratedValues;
105 | }
106 |
107 | public boolean isOutOfTrackedEntityAttributeGeneratedValues() {
108 | return outOfTrackedEntityAttributeGeneratedValues;
109 | }
110 |
111 | }
112 |
--------------------------------------------------------------------------------
/app/src/main/java/org/hisp/dhis/android/trackercapture/ui/rows/upcomingevents/UpcomingEventItemRow.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 | 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.ui.adapters.rows.events.EventRow;
38 | import org.hisp.dhis.android.trackercapture.R;
39 |
40 | /**
41 | * Created by araz on 03.04.2015.
42 | */
43 | public final class UpcomingEventItemRow implements EventRow {
44 | private long mEventId;
45 | private String mFirstItem;
46 | private String mSecondItem;
47 | private String mEventName;
48 | private String mDueDate;
49 |
50 | @Override
51 | public View getView(LayoutInflater inflater, View convertView, ViewGroup container) {
52 | View view;
53 | ViewHolder holder;
54 |
55 | //initResources(inflater.getContext());
56 |
57 | if (convertView == null) {
58 | view = inflater.inflate(R.layout.listview_upcomingevent_item, container, false);
59 | holder = new ViewHolder(
60 | (TextView) view.findViewById(R.id.first_event_item),
61 | (TextView) view.findViewById(R.id.second_event_item),
62 | (TextView) view.findViewById(R.id.eventname),
63 | (TextView) view.findViewById(R.id.duedate)
64 | );
65 | view.setTag(holder);
66 | } else {
67 | view = convertView;
68 | holder = (ViewHolder) view.getTag();
69 | }
70 |
71 | holder.firstItem.setText(mFirstItem);
72 | holder.secondItem.setText(mSecondItem);
73 | holder.eventName.setText(mEventName);
74 | holder.dueDate.setText(mDueDate);
75 |
76 | return view;
77 | }
78 |
79 | @Override
80 | public int getViewType() {
81 | return EventRowType.EVENT_ITEM_ROW.ordinal();
82 | }
83 |
84 | @Override
85 | public long getId() {
86 | return mEventId;
87 | }
88 |
89 | @Override
90 | public boolean isEnabled() {
91 | return true;
92 | }
93 |
94 | public void setEventId(long eventId) {
95 | mEventId = eventId;
96 | }
97 |
98 | public void setDueDate(String dueDate) {
99 | mDueDate = dueDate;
100 | }
101 |
102 | public void setSecondItem(String secondItem) {
103 | this.mSecondItem = secondItem;
104 | }
105 |
106 | public void setEventName(String eventName) {
107 | this.mEventName = eventName;
108 | }
109 |
110 | public void setFirstItem(String firstItem) {
111 | this.mFirstItem = firstItem;
112 | }
113 |
114 |
115 | private static class ViewHolder {
116 | public final TextView firstItem;
117 | public final TextView secondItem;
118 | public final TextView eventName;
119 | public final TextView dueDate;
120 |
121 | private ViewHolder(TextView firstItem,
122 | TextView secondItem,
123 | TextView dueDate,
124 | TextView eventName) {
125 | this.firstItem = firstItem;
126 | this.secondItem = secondItem;
127 | this.dueDate = dueDate;
128 | this.eventName = eventName;
129 | }
130 | }
131 | }
132 |
--------------------------------------------------------------------------------
/app/src/main/java/org/hisp/dhis/android/trackercapture/fragments/enrollment/EnrollmentDataEntryFragmentForm.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.enrollment;
31 |
32 | import org.hisp.dhis.android.sdk.persistence.models.Enrollment;
33 | import org.hisp.dhis.android.sdk.persistence.models.OrganisationUnit;
34 | import org.hisp.dhis.android.sdk.persistence.models.Program;
35 | import org.hisp.dhis.android.sdk.persistence.models.TrackedEntityAttributeValue;
36 | import org.hisp.dhis.android.sdk.persistence.models.TrackedEntityInstance;
37 | import org.hisp.dhis.android.sdk.ui.adapters.rows.dataentry.IndicatorRow;
38 | import org.hisp.dhis.android.sdk.ui.adapters.rows.dataentry.Row;
39 |
40 | import java.util.List;
41 | import java.util.Map;
42 |
43 | class EnrollmentDataEntryFragmentForm
44 | {
45 | private Enrollment enrollment;
46 | private Program program;
47 | private TrackedEntityInstance trackedEntityInstance;
48 | private OrganisationUnit organisationUnit;
49 |
50 | private Map trackedEntityAttributeValueMap;
51 | private Map dataElementNames;
52 | private List indicatorRows;
53 | private List dataEntryRows;
54 | private boolean outOfTrackedEntityAttributeGeneratedValues;
55 |
56 | public List getDataEntryRows() {
57 | return dataEntryRows;
58 | }
59 |
60 | public void setDataEntryRows(List dataEntryRows) {
61 | this.dataEntryRows = dataEntryRows;
62 | }
63 |
64 | public Enrollment getEnrollment() {
65 | return enrollment;
66 | }
67 |
68 | public Program getProgram() {
69 | return program;
70 | }
71 |
72 | public void setProgram(Program program) {
73 | this.program = program;
74 | }
75 |
76 | public OrganisationUnit getOrganisationUnit() {
77 | return organisationUnit;
78 | }
79 |
80 | public void setOrganisationUnit(OrganisationUnit organisationUnit) {
81 | this.organisationUnit = organisationUnit;
82 | }
83 |
84 | public void setEnrollment(Enrollment enrollment) {
85 | this.enrollment = enrollment;
86 | }
87 |
88 | public Map getDataElementNames() {
89 | return dataElementNames;
90 | }
91 |
92 | public void setDataElementNames(Map dataElementNames) {
93 | this.dataElementNames = dataElementNames;
94 | }
95 |
96 | public TrackedEntityInstance getTrackedEntityInstance() {
97 | return trackedEntityInstance;
98 | }
99 |
100 | public void setTrackedEntityInstance(TrackedEntityInstance trackedEntityInstance) {
101 | this.trackedEntityInstance = trackedEntityInstance;
102 | }
103 |
104 | public Map getTrackedEntityAttributeValueMap() {
105 | return trackedEntityAttributeValueMap;
106 | }
107 |
108 | public void setTrackedEntityAttributeValueMap(Map trackedEntityAttributeValueMap) {
109 | this.trackedEntityAttributeValueMap = trackedEntityAttributeValueMap;
110 | }
111 |
112 | public void setOutOfTrackedEntityAttributeGeneratedValues(boolean outOfTrackedEntityAttributeGeneratedValues) {
113 | this.outOfTrackedEntityAttributeGeneratedValues = outOfTrackedEntityAttributeGeneratedValues;
114 | }
115 |
116 | public boolean isOutOfTrackedEntityAttributeGeneratedValues() {
117 | return outOfTrackedEntityAttributeGeneratedValues;
118 | }
119 | }
120 |
--------------------------------------------------------------------------------
/app/src/main/java/org/hisp/dhis/android/trackercapture/fragments/trackedentityinstance/TrackedEntityInstanceDataEntryFragmentForm.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.trackedentityinstance;
31 |
32 | import org.hisp.dhis.android.sdk.persistence.models.Enrollment;
33 | import org.hisp.dhis.android.sdk.persistence.models.OrganisationUnit;
34 | import org.hisp.dhis.android.sdk.persistence.models.Program;
35 | import org.hisp.dhis.android.sdk.persistence.models.TrackedEntityAttributeValue;
36 | import org.hisp.dhis.android.sdk.persistence.models.TrackedEntityInstance;
37 | import org.hisp.dhis.android.sdk.ui.adapters.rows.dataentry.IndicatorRow;
38 | import org.hisp.dhis.android.sdk.ui.adapters.rows.dataentry.Row;
39 |
40 | import java.util.List;
41 | import java.util.Map;
42 |
43 | class TrackedEntityInstanceDataEntryFragmentForm
44 | {
45 | private Enrollment enrollment;
46 | private Program program;
47 | private TrackedEntityInstance trackedEntityInstance;
48 | private OrganisationUnit organisationUnit;
49 |
50 | private Map trackedEntityAttributeValueMap;
51 | private Map dataElementNames;
52 | private List indicatorRows;
53 | private List dataEntryRows;
54 | private boolean outOfTrackedEntityAttributeGeneratedValues;
55 |
56 | public List getDataEntryRows() {
57 | return dataEntryRows;
58 | }
59 |
60 | public void setDataEntryRows(List dataEntryRows) {
61 | this.dataEntryRows = dataEntryRows;
62 | }
63 |
64 | public Enrollment getEnrollment() {
65 | return enrollment;
66 | }
67 |
68 | public Program getProgram() {
69 | return program;
70 | }
71 |
72 | public void setProgram(Program program) {
73 | this.program = program;
74 | }
75 |
76 | public OrganisationUnit getOrganisationUnit() {
77 | return organisationUnit;
78 | }
79 |
80 | public void setOrganisationUnit(OrganisationUnit organisationUnit) {
81 | this.organisationUnit = organisationUnit;
82 | }
83 |
84 | public void setEnrollment(Enrollment enrollment) {
85 | this.enrollment = enrollment;
86 | }
87 |
88 | public Map getDataElementNames() {
89 | return dataElementNames;
90 | }
91 |
92 | public void setDataElementNames(Map dataElementNames) {
93 | this.dataElementNames = dataElementNames;
94 | }
95 |
96 | public TrackedEntityInstance getTrackedEntityInstance() {
97 | return trackedEntityInstance;
98 | }
99 |
100 | public void setTrackedEntityInstance(TrackedEntityInstance trackedEntityInstance) {
101 | this.trackedEntityInstance = trackedEntityInstance;
102 | }
103 |
104 | public Map getTrackedEntityAttributeValueMap() {
105 | return trackedEntityAttributeValueMap;
106 | }
107 |
108 | public void setTrackedEntityAttributeValueMap(Map trackedEntityAttributeValueMap) {
109 | this.trackedEntityAttributeValueMap = trackedEntityAttributeValueMap;
110 | }
111 |
112 | public void setOutOfTrackedEntityAttributeGeneratedValues(boolean outOfTrackedEntityAttributeGeneratedValues) {
113 | this.outOfTrackedEntityAttributeGeneratedValues = outOfTrackedEntityAttributeGeneratedValues;
114 | }
115 |
116 | public boolean isOutOfTrackedEntityAttributeGeneratedValues() {
117 | return outOfTrackedEntityAttributeGeneratedValues;
118 | }
119 | }
120 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
30 |
31 |
32 |
33 | Settings
34 | Register new event
35 | Registered events
36 | Register relationship
37 | New event
38 | Enroll
39 |
40 | is
41 | Please enter
42 |
43 | Report date
44 | Sent
45 | Offline
46 | Error
47 |
48 | Username or password has changed. Please log out and sign in again. \nNote! Event will be lost
49 | Slow connection. Please, try to synchronize later
50 | 40x application level error.
51 | 50x server error. Please, try to synchronize later.
52 | Unknown error
53 |
54 | Are you sure you want to un-enroll the current
55 | enrollment? No more editing will be possible.
56 | Are you sure you want to cancel the current
57 | enrollment? This cannot be undone.
58 | Are you sure you want to delete this relationship?
59 | No active enrollment
60 | Select relationship type
61 |
62 | Search
63 | Bad request
64 | Unauthorized
65 | Forbidden
66 | Conflict
67 | Internal server error
68 | Not implemented
69 | Bad gateway
70 | Service unavailable
71 | Gateway timed out
72 |
73 | Search results
74 | Did not find what you were looking for? Search online
75 | Local search
76 | Error. Please retry
77 |
78 | You are out of automatically generated IDs. Please synchronise to download new ones
79 | Error. Please retry
80 | Re-open
81 |
82 | Download entities
83 | Enrollment is complete
84 | Enrollment is cancelled
85 |
86 | Form is empty, please fill at least one
87 | Invalid unique value: %s
88 | EVENTS
89 | UPCOMING EVENTS
90 | OVERDUE EVENTS
91 | ACTIVE EVENTS
92 | Timeline Data Entry
93 |
94 |
--------------------------------------------------------------------------------
/app/src/main/java/org/hisp/dhis/android/trackercapture/fragments/selectprogram/dialogs/QueryTrackedEntityInstancesDialogFragmentQuery.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.dialogs;
31 |
32 | import android.content.Context;
33 | import android.util.Log;
34 |
35 | import org.hisp.dhis.android.sdk.controllers.GpsController;
36 | import org.hisp.dhis.android.sdk.controllers.metadata.MetaDataController;
37 | import org.hisp.dhis.android.sdk.persistence.loaders.Query;
38 | import org.hisp.dhis.android.sdk.persistence.models.Program;
39 | import org.hisp.dhis.android.sdk.persistence.models.ProgramTrackedEntityAttribute;
40 | import org.hisp.dhis.android.sdk.persistence.models.TrackedEntityAttribute;
41 | import org.hisp.dhis.android.sdk.persistence.models.TrackedEntityAttributeValue;
42 | import org.hisp.dhis.android.sdk.ui.adapters.rows.dataentry.DataEntryRowFactory;
43 | import org.hisp.dhis.android.sdk.ui.adapters.rows.dataentry.Row;
44 | import org.hisp.dhis.android.sdk.utils.api.ValueType;
45 |
46 | import java.util.ArrayList;
47 | import java.util.List;
48 |
49 | /**
50 | * Created by Simen S. Russnes on 7/9/15.
51 | */
52 | public class QueryTrackedEntityInstancesDialogFragmentQuery implements
53 | Query {
54 | public static final String TAG =
55 | QueryTrackedEntityInstancesDialogFragmentQuery.class.getSimpleName();
56 | private String orgUnit;
57 | private String programId;
58 |
59 | public QueryTrackedEntityInstancesDialogFragmentQuery(String orgUnit, String programId) {
60 | this.programId = programId;
61 | this.orgUnit = orgUnit;
62 | }
63 |
64 | @Override
65 | public QueryTrackedEntityInstancesDialogFragmentForm query(Context context) {
66 | QueryTrackedEntityInstancesDialogFragmentForm form =
67 | new QueryTrackedEntityInstancesDialogFragmentForm();
68 | form.setOrganisationUnit(orgUnit);
69 | form.setProgram(programId);
70 |
71 | Log.d(TAG, orgUnit + programId);
72 |
73 | Program program = MetaDataController.getProgram(programId);
74 | if (program == null || orgUnit == null) {
75 | return form;
76 | }
77 | List programAttrs =
78 | program.getProgramTrackedEntityAttributes();
79 | List values = new ArrayList<>();
80 | List dataEntryRows = new ArrayList<>();
81 | for (ProgramTrackedEntityAttribute ptea : programAttrs) {
82 | TrackedEntityAttribute trackedEntityAttribute = ptea.getTrackedEntityAttribute();
83 | TrackedEntityAttributeValue value = new TrackedEntityAttributeValue();
84 | value.setTrackedEntityAttributeId(trackedEntityAttribute.getUid());
85 | values.add(value);
86 | if (ValueType.COORDINATE.equals(ptea.getTrackedEntityAttribute().getValueType())) {
87 | GpsController.activateGps(context);
88 | }
89 | boolean isRadioButton = program.getDataEntryMethod();
90 | if(!isRadioButton){
91 | isRadioButton = ptea.isRenderOptionsAsRadio();
92 | }
93 | Row row = DataEntryRowFactory.createDataEntryView(ptea.getMandatory(),
94 | ptea.getAllowFutureDate(), trackedEntityAttribute.getOptionSet(),
95 | trackedEntityAttribute.getName(), value, trackedEntityAttribute.getValueType(),
96 | true, false, isRadioButton);
97 | dataEntryRows.add(row);
98 | }
99 | form.setTrackedEntityAttributeValues(values);
100 | form.setDataEntryRows(dataEntryRows);
101 | return form;
102 | }
103 | }
104 |
--------------------------------------------------------------------------------