Skip to content

Commit 395bb31

Browse files
committedMar 9, 2015
Merge pull request #2 from chimdi2000/malaria-setup-screen
Malaria setup screen
2 parents 8e32fdf + ff101c6 commit 395bb31

32 files changed

+2655
-440
lines changed
 

‎AndroidManifest.xml

+12-11
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="com.example.viewpagertest"
3+
package="com.peacecorps.malaria"
44
android:installLocation="internalOnly"
55
android:versionCode="1"
66
android:versionName="1.0" >
77

88
<uses-sdk
9-
android:minSdkVersion="11"
9+
android:minSdkVersion="14"
1010
android:targetSdkVersion="19" />
1111

1212
<uses-permission android:name="android.permission.VIBRATE" />
1313
<uses-permission android:name="android.permission.WAKE_LOCK" />
1414
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
1515
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
16+
<uses-permission android:name="android.permission.INTERNET"/>
1617

1718
<application
19+
1820
android:allowBackup="true"
1921
android:icon="@drawable/ic_launcher"
2022
android:label="@string/app_name"
21-
android:theme="@style/AppTheme" >
23+
android:theme="@android:style/Theme.Holo.Light.DarkActionBar" >
2224
<service android:name="com.peacecorps.malaria.AlarmService" >
2325
</service>
2426

@@ -30,15 +32,15 @@
3032
</receiver>
3133
<receiver
3234
android:name="com.peacecorps.malaria.AlarmHandlerClass"
33-
android:exported="true" >
35+
android:exported="false" >
3436
<intent-filter>
35-
<action android:name="com.example.viewpagertest.START_ALARM" />
36-
37+
<action android:name="com.peacecorps.malaria.START_ALARM" />
38+
3739
</intent-filter>
3840
</receiver>
3941

4042
<activity
41-
android:name="com.peacecorps.malaria.UserMedicineSettingsFragment"
43+
android:name="com.peacecorps.malaria.UserMedicineSettingsFragmentActivity"
4244
android:label="@string/app_name" >
4345
<intent-filter>
4446
<action android:name="android.intent.action.MAIN" />
@@ -58,10 +60,9 @@
5860
</action>
5961
</intent-filter>
6062
</activity>
61-
<activity
62-
android:name="com.peacecorps.malaria.AlertDialogFragment"
63-
android:label="@string/app_name" >
64-
</activity>
63+
<activity android:name="com.peacecorps.malaria.InfoHubFragmentActivity"/>
64+
65+
<activity android:name="com.peacecorps.malaria.PeaceCorpsPolicyFragmentActivity"/>
6566
</application>
6667

6768
</manifest>

‎libs/GraphView-3.1.2.jar

32.1 KB
Binary file not shown.

‎project.properties

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@
1111
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
1212

1313
# Project target.
14-
target=android-16
15-
android.library.reference.1=..\\appcompat_v7_3
16-
android.library.reference.2=../ViewPagerIndicator
14+
target=android-19
15+
android.library.reference.1=../ViewPagerIndicator
888 Bytes
Loading

‎res/layout/activity_main.xml

+63-36
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,85 @@
1-
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
1+
<LinearLayout
2+
xmlns:android="http://schemas.android.com/apk/res/android"
23
xmlns:app="http://schemas.android.com/apk/res-auto"
4+
5+
android:orientation="vertical"
36
android:layout_width="match_parent"
4-
android:layout_height="match_parent"
5-
android:layout_gravity="center"
7+
android:layout_height="wrap_content"
68
android:background="@drawable/background"
7-
android:orientation="vertical" >
9+
android:layout_gravity="center"
10+
11+
>
12+
13+
14+
<android.support.v4.view.ViewPager
815

9-
<android.support.v4.view.ViewPager
1016
android:id="@+id/vPager"
1117
android:layout_width="match_parent"
1218
android:layout_height="0dp"
13-
android:layout_weight="1" />
19+
android:layout_weight="1"
20+
/>
21+
1422

1523
<com.viewpagerindicator.CirclePageIndicator
24+
1625
android:id="@+id/vIndicator"
17-
android:layout_width="match_parent"
18-
android:layout_height="wrap_content"
1926
android:padding="10dip"
20-
android:textColor="@color/view_pager_indicator_text_color"
27+
android:layout_height="wrap_content"
28+
android:layout_width="match_parent"
29+
android:textColor="#2FB3E3"
30+
31+
app:footerLineHeight="1dp"
2132
app:footerIndicatorHeight="3dp"
2233
app:footerIndicatorStyle="underline"
23-
app:footerLineHeight="1dp"
34+
app:selectedColor="#FFFFFF"
2435
app:selectedBold="true"
25-
app:selectedColor="@color/white" />
36+
/>
2637

27-
<View
38+
39+
40+
<View
41+
android:layout_height="0.5dp"
2842
android:layout_width="200dp"
29-
android:layout_height="0.5dp"
43+
android:background="#000000"
3044
android:layout_gravity="center_horizontal"
31-
android:background="@color/black" />
32-
45+
46+
/>
47+
3348
<LinearLayout
34-
android:layout_width="wrap_content"
35-
android:layout_height="wrap_content"
36-
android:layout_gravity="center_horizontal"
37-
android:layout_marginTop="30dp"
38-
android:orientation="horizontal"
39-
android:paddingBottom="5dp" >
4049

41-
<Button
42-
android:layout_width="30dp"
43-
android:layout_height="30dp"
44-
android:layout_marginRight="15dp"
45-
android:adjustViewBounds="true"
46-
android:background="@drawable/home_icon_normal"
47-
android:scaleType="fitCenter" />
50+
android:orientation="horizontal"
51+
android:layout_width="wrap_content"
52+
android:layout_height="wrap_content"
53+
android:layout_gravity="center_horizontal"
54+
android:layout_marginTop="30dp"
55+
android:paddingBottom="5dp"
56+
57+
58+
59+
>
60+
61+
<Button
62+
android:id="@+id/homeButton"
63+
64+
android:background="@drawable/home_icon_normal"
65+
android:layout_width="30dp"
66+
android:layout_height="30dp"
67+
android:adjustViewBounds="true"
68+
android:layout_marginRight="15dp"
69+
android:scaleType="fitCenter"
70+
71+
/>
72+
4873

4974
<Button
50-
android:layout_width="30dp"
51-
android:layout_height="30dp"
52-
android:layout_marginLeft="15dp"
53-
android:adjustViewBounds="true"
54-
android:background="@drawable/info_hub_inactive_normal"
55-
android:scaleType="fitCenter" />
56-
</LinearLayout>
75+
android:background="@drawable/info_hub_inactive_normal"
76+
android:id="@+id/infoButton"
77+
android:layout_width="30dp"
78+
android:layout_height="30dp"
79+
android:adjustViewBounds="true"
80+
android:layout_marginLeft="15dp"
81+
android:scaleType="fitCenter"
82+
/>
5783

58-
</LinearLayout>
84+
</LinearLayout>
85+
</LinearLayout>

‎res/layout/activity_welcomeactivity.xml

-23
This file was deleted.
+106-60
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,137 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3-
android:layout_width="match_parent"
4-
android:layout_height="match_parent"
5-
android:layout_gravity="center"
6-
android:background="@drawable/background"
7-
android:orientation="vertical"
8-
android:padding="2dp" >
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
android:layout_gravity="center"
6+
android:background="@drawable/background"
7+
android:orientation="vertical"
8+
android:padding="2dp" >
99

1010
<Button
11-
android:layout_width="24dp"
12-
android:layout_height="24dp"
13-
android:layout_gravity="end"
14-
android:layout_margin="5dp"
15-
android:adjustViewBounds="true"
16-
android:background="@drawable/settings_normal"
17-
android:scaleType="fitCenter" />
11+
android:id="@+id/fragment_first_screen_settings_button"
12+
android:layout_width="24dp"
13+
android:layout_height="24dp"
14+
android:layout_gravity="end"
15+
android:layout_margin="5dp"
16+
android:adjustViewBounds="true"
17+
android:background="@drawable/settings_normal"
18+
android:scaleType="fitCenter" />
1819

1920
<LinearLayout
20-
android:layout_width="wrap_content"
21-
android:layout_height="wrap_content"
22-
android:layout_gravity="left"
23-
android:orientation="horizontal"
24-
android:padding="5dp" >
25-
26-
<ImageView
2721
android:layout_width="wrap_content"
2822
android:layout_height="wrap_content"
29-
android:adjustViewBounds="true"
30-
android:background="@drawable/medication_last_normal"
31-
android:scaleType="fitCenter" />
23+
android:layout_gravity="left"
24+
android:orientation="horizontal"
25+
android:padding="5dp" >
26+
27+
<ImageView
28+
android:layout_width="70dp"
29+
android:layout_height="60dp"
30+
android:adjustViewBounds="true"
31+
android:background="@drawable/medication_last_normal"
32+
android:scaleType="fitCenter" />
3233

3334
<TextView
34-
android:layout_width="wrap_content"
35-
android:layout_height="wrap_content"
36-
android:layout_gravity="center_vertical"
37-
android:paddingLeft="10dp"
38-
android:text="@string/first_analytic_screen_medicine_last_taken_text"
39-
android:textSize="20sp"
40-
android:textStyle="bold" />
35+
android:layout_width="wrap_content"
36+
android:layout_height="wrap_content"
37+
android:layout_gravity="center_vertical"
38+
android:paddingLeft="10dp"
39+
android:paddingRight="10dp"
40+
android:text="@string/first_analytic_screen_medicine_last_taken_text"
41+
android:textSize="13sp"
42+
android:textStyle="bold"
43+
android:textColor="@color/golden_brown"
44+
/>
45+
46+
<TextView android:layout_width="match_parent"
47+
android:layout_height="wrap_content"
48+
android:id="@+id/checkMediLastTakenTime"
49+
android:text=""
50+
android:background="@color/light_red"
51+
android:textColor="@color/white"
52+
android:textSize="20sp"
53+
android:textStyle="bold"
54+
android:layout_gravity="center_vertical"
55+
56+
/>
57+
4158
</LinearLayout>
4259

4360
<LinearLayout
44-
android:layout_width="wrap_content"
45-
android:layout_height="wrap_content"
46-
android:layout_gravity="left"
47-
android:orientation="horizontal"
48-
android:padding="5dp" >
49-
50-
<ImageView
5161
android:layout_width="wrap_content"
5262
android:layout_height="wrap_content"
53-
android:adjustViewBounds="true"
54-
android:background="@drawable/doses_missing_image_normal"
55-
android:scaleType="fitCenter" />
63+
android:layout_gravity="left"
64+
android:orientation="horizontal"
65+
android:padding="5dp" >
66+
67+
<ImageView
68+
android:layout_width="70dp"
69+
android:layout_height="60dp"
70+
android:adjustViewBounds="true"
71+
android:background="@drawable/doses_missing_image_normal"
72+
android:scaleType="fitCenter" />
5673

5774
<TextView
58-
android:layout_width="wrap_content"
75+
android:layout_width="wrap_content"
76+
android:layout_height="wrap_content"
77+
android:layout_gravity="center_vertical"
78+
android:paddingLeft="10dp"
79+
android:paddingRight="10dp"
80+
android:text="@string/first_analytic_screen_doses_missing_text"
81+
android:textSize="13sp"
82+
android:textStyle="bold"
83+
android:textColor="@color/golden_brown"
84+
/>
85+
86+
<TextView
87+
android:id="@+id/doses"
88+
android:layout_width="match_parent"
5989
android:layout_height="wrap_content"
60-
android:layout_gravity="center_vertical"
61-
android:paddingLeft="10dp"
62-
android:text="@string/first_analytic_screen_doses_missing_text"
90+
android:background="@color/light_red"
91+
android:textColor="@color/white"
6392
android:textSize="20sp"
64-
android:textStyle="bold" />
93+
android:textStyle="bold"
94+
android:layout_gravity="center_vertical"
95+
/>
96+
6597
</LinearLayout>
6698

6799
<LinearLayout
68-
android:layout_width="wrap_content"
69-
android:layout_height="wrap_content"
70-
android:layout_gravity="left"
71-
android:orientation="horizontal"
72-
android:padding="5dp" >
73-
74-
<ImageView
75100
android:layout_width="wrap_content"
76101
android:layout_height="wrap_content"
77-
android:adjustViewBounds="true"
78-
android:background="@drawable/medicine_adhere_normal"
79-
android:scaleType="fitCenter" />
102+
android:layout_gravity="left"
103+
android:orientation="horizontal"
104+
android:padding="5dp" >
105+
106+
<ImageView
107+
android:layout_width="70dp"
108+
android:layout_height="60dp"
109+
android:adjustViewBounds="true"
110+
android:background="@drawable/medicine_adhere_normal"
111+
android:scaleType="fitCenter" />
80112

81113
<TextView
82-
android:layout_width="wrap_content"
114+
android:layout_width="wrap_content"
115+
android:layout_height="wrap_content"
116+
android:layout_gravity="center_vertical"
117+
android:paddingLeft="10dp"
118+
android:paddingRight="10dp"
119+
android:text="@string/first_analytic_screen_medicine_adherence_to_medicine_text"
120+
android:textSize="13sp"
121+
android:textStyle="bold"
122+
android:textColor="@color/golden_brown"
123+
/>
124+
125+
<TextView
126+
android:id="@+id/adherence"
127+
android:layout_width="match_parent"
83128
android:layout_height="wrap_content"
84-
android:layout_gravity="center_vertical"
85-
android:paddingLeft="10dp"
86-
android:text="@string/first_analytic_screen_medicine_adherence_to_medicine_text"
129+
android:background="@color/light_red"
130+
android:textColor="@color/white"
87131
android:textSize="20sp"
88-
android:textStyle="bold" />
132+
android:textStyle="bold"
133+
android:layout_gravity="center_vertical" />
134+
89135
</LinearLayout>
90136

91137
</LinearLayout>

‎res/layout/fragment_home_screen.xml

+50-50
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,69 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3-
android:layout_width="match_parent"
4-
android:layout_height="match_parent"
5-
android:background="@drawable/background"
6-
android:orientation="vertical"
7-
android:padding="2dp" >
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
android:background="@drawable/background"
6+
android:orientation="vertical"
7+
android:padding="2dp" >
88

99
<Button
10-
android:id="@+id/fragment_home_screen_settings_button"
11-
android:layout_width="24dp"
12-
android:layout_height="24dp"
13-
android:layout_gravity="end"
14-
android:layout_margin="5dp"
15-
android:adjustViewBounds="true"
16-
android:background="@drawable/settings_normal"
17-
android:scaleType="fitCenter" />
10+
android:id="@+id/fragment_home_screen_settings_button"
11+
android:layout_width="24dp"
12+
android:layout_height="24dp"
13+
android:layout_gravity="end"
14+
android:layout_margin="5dp"
15+
android:adjustViewBounds="true"
16+
android:background="@drawable/settings_normal"
17+
android:scaleType="fitCenter" />
1818

1919
<TextView
20-
android:id="@+id/fragment_home_screen_current_day_of_week"
21-
android:layout_width="wrap_content"
22-
android:layout_height="wrap_content"
23-
android:layout_gravity="center_horizontal"
24-
android:textSize="40sp"
25-
android:textStyle="bold" />
20+
android:id="@+id/fragment_home_screen_current_day_of_week"
21+
android:layout_width="wrap_content"
22+
android:layout_height="wrap_content"
23+
android:layout_gravity="center_horizontal"
24+
android:textSize="40sp"
25+
android:textStyle="bold" />
2626

2727
<TextView
28-
android:id="@+id/fragment_home_screen_current_date"
29-
android:layout_width="wrap_content"
30-
android:layout_height="wrap_content"
31-
android:layout_gravity="end"
32-
android:layout_marginRight="30dp"
33-
android:scaleType="fitCenter"
34-
android:textSize="20sp"
35-
android:textStyle="bold" />
28+
android:id="@+id/fragment_home_screen_current_date"
29+
android:layout_width="wrap_content"
30+
android:layout_height="wrap_content"
31+
android:layout_gravity="end"
32+
android:layout_marginRight="30dp"
33+
android:scaleType="fitCenter"
34+
android:textSize="20sp"
35+
android:textStyle="bold" />
3636

3737
<ImageView
38-
android:layout_width="143dp"
39-
android:layout_height="143dp"
40-
android:layout_gravity="center_horizontal"
41-
android:adjustViewBounds="true"
42-
android:background="@drawable/drug_normal"
43-
android:scaleType="fitCenter" />
38+
android:layout_width="143dp"
39+
android:layout_height="143dp"
40+
android:layout_gravity="center_horizontal"
41+
android:adjustViewBounds="true"
42+
android:background="@drawable/drug_normal"
43+
android:scaleType="fitCenter" />
4444

4545
<LinearLayout
46-
android:layout_width="wrap_content"
47-
android:layout_height="wrap_content"
48-
android:layout_gravity="center_horizontal"
49-
android:orientation="horizontal" >
50-
51-
<Button
52-
android:id="@+id/fragment_home_screen__reject_medication_button"
5346
android:layout_width="wrap_content"
5447
android:layout_height="wrap_content"
55-
android:layout_marginRight="20dp"
56-
android:adjustViewBounds="true"
57-
android:background="@drawable/reject_medi_normal" />
48+
android:layout_gravity="center_horizontal"
49+
android:orientation="horizontal" >
5850

5951
<Button
60-
android:id="@+id/fragment_home_screen_accept_medication_button"
61-
android:layout_width="wrap_content"
62-
android:layout_height="wrap_content"
63-
android:layout_marginLeft="20dp"
64-
android:adjustViewBounds="true"
65-
android:background="@drawable/accept_medi_normal"
66-
android:scaleType="fitCenter" />
52+
android:id="@+id/fragment_home_screen__reject_medication_button"
53+
android:layout_width="70dp"
54+
android:layout_height="50dp"
55+
android:layout_marginRight="20dp"
56+
android:adjustViewBounds="true"
57+
android:background="@drawable/reject_medi_normal" />
58+
59+
<Button
60+
android:id="@+id/fragment_home_screen_accept_medication_button"
61+
android:layout_width="70dp"
62+
android:layout_height="50dp"
63+
android:layout_marginLeft="20dp"
64+
android:adjustViewBounds="true"
65+
android:background="@drawable/accept_medi_normal"
66+
android:scaleType="fitCenter" />
6767
</LinearLayout>
6868

6969
</LinearLayout>
+183-21
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,189 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3-
android:layout_width="match_parent"
4-
android:layout_height="match_parent"
5-
android:layout_gravity="center"
6-
android:background="@drawable/background"
7-
android:orientation="vertical"
8-
android:padding="2dp" >
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
android:layout_gravity="center"
6+
android:background="@drawable/background"
7+
android:orientation="vertical"
8+
android:padding="2dp" >
99

1010
<Button
11-
android:layout_width="24dp"
12-
android:layout_height="24dp"
13-
android:layout_gravity="end"
14-
android:layout_margin="5dp"
15-
android:adjustViewBounds="true"
16-
android:background="@drawable/settings_normal"
17-
android:scaleType="fitCenter" />
18-
19-
<TextView
20-
android:layout_width="wrap_content"
21-
android:layout_height="wrap_content"
22-
android:layout_gravity="center"
23-
android:background="@color/white"
24-
android:text="@string/second_analytic_screen_title"
25-
android:textStyle="bold" />
11+
android:id="@+id/fragment_second_screen_settings_button"
12+
android:layout_width="24dp"
13+
android:layout_height="24dp"
14+
android:layout_gravity="end"
15+
android:layout_margin="5dp"
16+
android:adjustViewBounds="true"
17+
android:background="@drawable/settings_normal"
18+
android:scaleType="fitCenter" />
19+
20+
21+
22+
<LinearLayout android:layout_width="fill_parent"
23+
android:layout_height="wrap_content"
24+
android:orientation="horizontal"
25+
android:layout_margin="10dp"
26+
>
27+
<TextView android:layout_width="fill_parent"
28+
android:layout_height="wrap_content"
29+
android:text="January"
30+
android:layout_weight="2"
31+
android:id="@+id/firstMonthProgressLabel"
32+
android:textStyle="bold"
33+
android:textColor="@color/golden_brown"
34+
35+
36+
/>
37+
38+
<ProgressBar android:layout_width="fill_parent"
39+
android:layout_height="wrap_content"
40+
android:progress="100"
41+
android:background="#fff"
42+
style="?android:attr/progressBarStyleHorizontal"
43+
android:layout_weight="1"
44+
android:id="@+id/firstMonthProgressBar"
45+
android:layout_marginRight="5dp"
46+
android:layout_marginLeft="5dp"
47+
48+
/>
49+
50+
<TextView android:layout_width="fill_parent"
51+
android:layout_height="wrap_content"
52+
android:text="100%"
53+
android:layout_weight="2"
54+
android:id="@+id/firstMonthProgressPercent"
55+
android:textStyle="bold"
56+
android:textColor="@color/golden_brown"
57+
/>
58+
59+
</LinearLayout>
60+
61+
<LinearLayout android:layout_width="fill_parent"
62+
android:layout_height="wrap_content"
63+
android:orientation="horizontal"
64+
android:layout_margin="10dp"
65+
>
66+
<TextView android:layout_width="fill_parent"
67+
android:layout_height="wrap_content"
68+
android:text="February"
69+
android:layout_weight="2"
70+
android:id="@+id/secondMonthProgressLabel"
71+
android:textStyle="bold"
72+
android:textColor="@color/golden_brown"
73+
74+
/>
75+
76+
<ProgressBar android:layout_width="fill_parent"
77+
android:layout_height="wrap_content"
78+
android:progress="60"
79+
android:background="#fff"
80+
style="?android:attr/progressBarStyleHorizontal"
81+
android:layout_weight="1"
82+
android:id="@+id/secondMonthProgressBar"
83+
android:layout_marginRight="5dp"
84+
android:layout_marginLeft="5dp"
85+
86+
87+
/>
88+
89+
<TextView android:layout_width="fill_parent"
90+
android:layout_height="wrap_content"
91+
android:text="60%"
92+
android:layout_weight="2"
93+
android:id="@+id/secondMonthProgressPercent"
94+
android:textStyle="bold"
95+
android:textColor="@color/golden_brown"
96+
/>
97+
98+
</LinearLayout>
99+
100+
101+
<LinearLayout android:layout_width="fill_parent"
102+
android:layout_height="wrap_content"
103+
android:orientation="horizontal"
104+
android:layout_margin="10dp"
105+
>
106+
<TextView android:layout_width="fill_parent"
107+
android:layout_height="wrap_content"
108+
android:text="March"
109+
android:layout_weight="2"
110+
android:id="@+id/thirdMonthProgressLabel"
111+
android:textStyle="bold"
112+
android:textColor="@color/golden_brown"
113+
114+
/>
115+
116+
<ProgressBar android:layout_width="fill_parent"
117+
android:layout_height="wrap_content"
118+
android:progress="80"
119+
android:background="#fff"
120+
style="?android:attr/progressBarStyleHorizontal"
121+
android:layout_weight="1"
122+
android:id="@+id/thirdMonthProgressBar"
123+
android:layout_marginRight="5dp"
124+
android:layout_marginLeft="5dp"
125+
126+
/>
127+
128+
<TextView android:layout_width="fill_parent"
129+
android:layout_height="wrap_content"
130+
android:text="80%"
131+
android:layout_weight="2"
132+
android:id="@+id/thirdMonthProgressPercent"
133+
android:textStyle="bold"
134+
android:textColor="@color/golden_brown"
135+
/>
136+
137+
</LinearLayout>
138+
139+
<LinearLayout android:layout_width="fill_parent"
140+
android:layout_height="wrap_content"
141+
android:orientation="horizontal"
142+
android:layout_margin="10dp"
143+
>
144+
<TextView android:layout_width="fill_parent"
145+
android:layout_height="wrap_content"
146+
android:text="April"
147+
android:layout_weight="2"
148+
android:id="@+id/fourthMonthProgressLabel"
149+
android:textStyle="bold"
150+
android:textColor="@color/golden_brown"
151+
152+
/>
153+
154+
<ProgressBar android:layout_width="fill_parent"
155+
android:layout_height="wrap_content"
156+
android:progress="80"
157+
android:background="#fff"
158+
style="?android:attr/progressBarStyleHorizontal"
159+
android:layout_weight="1"
160+
android:id="@+id/fourthMonthProgressBar"
161+
android:layout_marginRight="5dp"
162+
android:layout_marginLeft="5dp"
163+
164+
165+
/>
166+
167+
<TextView android:layout_width="fill_parent"
168+
android:layout_height="wrap_content"
169+
android:text="80%"
170+
android:layout_weight="2"
171+
android:id="@+id/fourthMonthProgressPercent"
172+
android:textStyle="bold"
173+
android:textColor="@color/golden_brown"
174+
/>
175+
176+
</LinearLayout>
177+
178+
179+
180+
<LinearLayout android:layout_width="match_parent"
181+
android:layout_height="wrap_content"
182+
android:orientation="vertical"
183+
android:id="@+id/graphView"
184+
>
185+
186+
</LinearLayout>
187+
26188

27189
</LinearLayout>
+91-80
Original file line numberDiff line numberDiff line change
@@ -1,116 +1,127 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3-
xmlns:tools="http://schemas.android.com/tools"
4-
android:layout_width="match_parent"
5-
android:layout_height="match_parent"
6-
android:layout_gravity="center"
7-
android:background="@drawable/background"
8-
android:orientation="vertical"
9-
tools:context=".UserMedicineSettingsFragmentActivity" >
3+
xmlns:tools="http://schemas.android.com/tools"
4+
android:layout_width="match_parent"
5+
android:layout_height="match_parent"
6+
android:layout_gravity="center"
7+
android:background="@drawable/background"
8+
android:orientation="vertical"
9+
tools:context=".UserMedicineSettingsFragmentActivity" >
1010

1111
<LinearLayout
12-
android:id="@+id/user_medicine_settings_activity_container"
13-
android:layout_width="match_parent"
14-
android:layout_height="wrap_content"
15-
android:layout_marginTop="20dp"
16-
android:gravity="center"
17-
android:orientation="vertical" >
12+
android:id="@+id/user_medicine_settings_activity_container"
13+
android:layout_width="match_parent"
14+
android:layout_height="wrap_content"
15+
android:layout_marginTop="20dp"
16+
android:gravity="center"
17+
android:orientation="vertical" >
1818

1919
<TextView
20-
android:id="@+id/user_medicine_settings_activity_setup_label"
21-
android:layout_width="wrap_content"
22-
android:layout_height="wrap_content"
23-
android:layout_gravity="center"
24-
android:layout_marginBottom="10dp"
25-
android:layout_marginTop="10dp"
26-
android:hint="@string/user_medicine_settings_activity_setup_label"
27-
android:textSize="38sp"
28-
android:textStyle="bold" />
20+
android:id="@+id/user_medicine_settings_activity_setup_label"
21+
android:layout_width="wrap_content"
22+
android:layout_height="wrap_content"
23+
android:layout_gravity="center"
24+
android:layout_marginBottom="10dp"
25+
android:layout_marginTop="10dp"
26+
android:text="@string/user_medicine_settings_activity_setup_label"
27+
android:textSize="38sp"
28+
android:textStyle="bold"
29+
android:textColor="@color/user_medicine_first_text_color"
30+
/>
2931

3032
<LinearLayout
31-
android:layout_width="wrap_content"
32-
android:layout_height="wrap_content"
33-
android:layout_gravity="center_horizontal"
34-
android:layout_marginLeft="20dp"
35-
android:layout_marginRight="20dp"
36-
android:background="@drawable/custom_line_border"
37-
android:orientation="vertical"
38-
android:paddingLeft="30dp" >
39-
40-
<LinearLayout
4133
android:layout_width="wrap_content"
4234
android:layout_height="wrap_content"
43-
android:orientation="horizontal" >
35+
android:layout_gravity="center_horizontal"
36+
android:layout_marginLeft="20dp"
37+
android:layout_marginRight="20dp"
38+
android:background="@drawable/custom_line_border"
39+
android:orientation="vertical"
40+
android:paddingLeft="30dp" >
41+
42+
<LinearLayout
43+
android:layout_width="wrap_content"
44+
android:layout_height="wrap_content"
45+
android:orientation="horizontal" >
4446

4547
<TextView
46-
android:id="@+id/user_medicine_settings_activity_drug_take_label"
47-
style="@style/UserMedicineSettingsCommonTextAppearance"
48-
android:hint="@string/user_medicine_settings_activity_drug_take_label"
49-
android:paddingTop="15dp" />
48+
android:id="@+id/user_medicine_settings_activity_drug_take_label"
49+
style="@style/UserMedicineSettingsCommonTextAppearance"
50+
android:text="@string/user_medicine_settings_activity_drug_take_label"
51+
android:paddingTop="15dp"
52+
android:textColor="@color/golden_brown"
53+
/>
5054

5155
<TextView
52-
android:layout_width="wrap_content"
53-
android:layout_height="wrap_content"
54-
android:paddingLeft="114dp" />
56+
android:layout_width="wrap_content"
57+
android:layout_height="wrap_content"
58+
android:paddingLeft="114dp" />
5559
</LinearLayout>
5660

5761
<Spinner
58-
android:id="@+id/user_medicine_settings_activity_drug_select_spinner"
59-
android:layout_width="wrap_content"
60-
android:layout_height="wrap_content"
61-
android:layout_gravity="center" />
62+
android:id="@+id/user_medicine_settings_activity_drug_select_spinner"
63+
android:layout_width="wrap_content"
64+
android:layout_height="wrap_content"
65+
android:layout_gravity="center" />
6266

6367
<TextView
64-
android:id="@+id/user_medicine_settings_activity_time_pick_label"
65-
style="@style/UserMedicineSettingsCommonTextAppearance"
66-
android:layout_marginRight="8dp"
67-
android:layout_marginTop="5dp"
68-
android:hint="@string/user_medicine_settings_activity_time_pick_label" />
68+
android:id="@+id/user_medicine_settings_activity_time_pick_label"
69+
style="@style/UserMedicineSettingsCommonTextAppearance"
70+
android:layout_marginRight="8dp"
71+
android:layout_marginTop="5dp"
72+
android:text="@string/user_medicine_settings_activity_time_pick_label"
73+
android:textColor="@color/golden_brown"
74+
/>
6975

7076
<TextView
71-
android:id="@+id/user_medicine_settings_activity_time_pick_button"
72-
style="@style/UserMedicineSettingsCommonTextAppearance"
73-
android:layout_gravity="center"
74-
android:paddingBottom="10dp"
75-
android:paddingTop="5dp"
76-
android:text="@string/user_medicine_settings_activity_time_pick_button"
77-
android:textAppearance="?android:attr/textAppearanceLarge" />
77+
android:id="@+id/user_medicine_settings_activity_time_pick_button"
78+
style="@style/UserMedicineSettingsCommonTextAppearance"
79+
android:layout_gravity="center"
80+
android:paddingBottom="10dp"
81+
android:paddingTop="5dp"
82+
android:text="@string/user_medicine_settings_activity_time_pick_button"
83+
android:textAppearance="?android:attr/textAppearanceLarge" />
7884

7985
<LinearLayout
80-
android:layout_width="wrap_content"
81-
android:layout_height="wrap_content" >
86+
android:layout_width="wrap_content"
87+
android:layout_height="wrap_content" >
8288

8389
<TextView
84-
android:id="@+id/user_medicine_settings_activity_if_forget_label"
85-
style="@style/UserMedicineSettingsCommonTextAppearance"
86-
android:hint="@string/user_medicine_settings_activity_if_forget_label"
87-
android:paddingBottom="10dp" />
90+
android:id="@+id/user_medicine_settings_activity_if_forget_label"
91+
style="@style/UserMedicineSettingsCommonTextAppearance"
92+
android:text="@string/user_medicine_settings_activity_if_forget_label"
93+
android:paddingBottom="10dp"
94+
android:textColor="@color/golden_brown"
95+
/>
8896

8997
<TextView
90-
android:layout_width="wrap_content"
91-
android:layout_height="wrap_content"
92-
android:paddingLeft="72dp" />
98+
android:layout_width="wrap_content"
99+
android:layout_height="wrap_content"
100+
android:paddingLeft="72dp" />
93101
</LinearLayout>
94102
</LinearLayout>
95103

96104
<Button
97-
android:id="@+id/user_medicine_settings_activity_done_button"
98-
style="@style/UserMedicineSettingsCommonTextAppearance"
99-
android:layout_gravity="center"
100-
android:layout_marginTop="15dp"
101-
android:hint="@string/user_medicine_settings_activity_done_button"
102-
android:paddingLeft="40dp"
103-
android:paddingRight="40dp" />
105+
android:id="@+id/user_medicine_settings_activity_done_button"
106+
style="@style/UserMedicineSettingsCommonTextAppearance"
107+
android:layout_gravity="center"
108+
android:layout_marginTop="15dp"
109+
android:text="@string/user_medicine_settings_activity_done_button"
110+
android:textColor="@color/white"
111+
android:paddingLeft="40dp"
112+
android:paddingRight="40dp"
113+
android:background="@color/golden_brown"
114+
/>
104115
</LinearLayout>
105116

106117
<ImageView
107-
android:id="@+id/user_medicine_settings_activity_pc_logo"
108-
android:layout_width="wrap_content"
109-
android:layout_height="wrap_content"
110-
android:layout_gravity="right"
111-
android:adjustViewBounds="true"
112-
android:contentDescription="@string/user_medicine_settings_activity_pc_logo"
113-
android:scaleType="fitCenter"
114-
android:src="@drawable/pc_logo" />
118+
android:id="@+id/user_medicine_settings_activity_pc_logo"
119+
android:layout_width="wrap_content"
120+
android:layout_height="wrap_content"
121+
android:layout_gravity="right"
122+
android:adjustViewBounds="true"
123+
android:contentDescription="@string/user_medicine_settings_activity_pc_logo"
124+
android:scaleType="fitCenter"
125+
android:src="@drawable/pc_logo" />
115126

116127
</LinearLayout>

‎res/layout/info_hub_screen.xml

+226
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
1+
<RelativeLayout
2+
xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
4+
android:layout_width="match_parent"
5+
android:layout_height="match_parent"
6+
android:background="@drawable/background"
7+
android:layout_gravity="center_horizontal"
8+
9+
>
10+
11+
<ScrollView android:layout_width="match_parent"
12+
android:layout_height="wrap_content"
13+
android:id="@+id/scrollSegment"
14+
15+
>
16+
<LinearLayout android:layout_width="match_parent"
17+
android:layout_height="wrap_content"
18+
android:orientation="vertical"
19+
>
20+
<LinearLayout
21+
android:id="@+id/upperLayout"
22+
android:orientation="vertical"
23+
android:gravity="center_horizontal"
24+
android:layout_alignParentTop="true"
25+
android:layout_width="match_parent"
26+
android:layout_height="wrap_content">
27+
28+
<Button
29+
android:id="@+id/info_hub_settings_button"
30+
android:layout_width="24dp"
31+
android:layout_height="24dp"
32+
android:layout_gravity="end"
33+
android:layout_margin="5dp"
34+
android:adjustViewBounds="true"
35+
36+
android:background="@drawable/settings_normal"
37+
android:scaleType="fitCenter" />
38+
39+
<LinearLayout android:layout_width="wrap_content"
40+
android:layout_height="wrap_content"
41+
android:orientation="horizontal"
42+
>
43+
<ImageView android:layout_width="wrap_content"
44+
android:layout_height="wrap_content"
45+
android:background="@drawable/peace_corps_logo_normal"
46+
/>
47+
48+
<TextView android:layout_width="wrap_content"
49+
android:layout_height="wrap_content"
50+
android:text="@string/info_hub_title_label"
51+
android:textColor="@color/golden_brown"
52+
android:textSize="25sp"
53+
android:textStyle="bold"
54+
android:layout_marginTop="10dp"
55+
android:layout_marginLeft="10dp"
56+
57+
/>
58+
59+
</LinearLayout>
60+
61+
</LinearLayout>
62+
63+
64+
<LinearLayout android:layout_width="match_parent"
65+
android:layout_height="wrap_content"
66+
android:id="@+id/firstButtonSet"
67+
android:orientation="horizontal"
68+
69+
android:layout_marginTop="5dp"
70+
71+
>
72+
<Button android:layout_width="match_parent"
73+
android:layout_height="wrap_content"
74+
android:text="@string/peace_corps_policy"
75+
android:background="@color/light_red"
76+
android:textColor="@color/white"
77+
android:layout_weight="1"
78+
android:padding="5dp"
79+
android:layout_margin="15dp"
80+
android:id="@+id/peaceCorpsPolicy"
81+
/>
82+
83+
<Button android:layout_width="match_parent"
84+
android:layout_height="wrap_content"
85+
android:text="@string/percentage_of_side_effects"
86+
android:background="@color/light_red"
87+
android:textColor="@color/white"
88+
android:layout_weight="1"
89+
android:padding="5dp"
90+
android:layout_margin="15dp"
91+
92+
/>
93+
94+
95+
96+
</LinearLayout>
97+
98+
99+
<LinearLayout android:layout_width="match_parent"
100+
android:layout_height="wrap_content"
101+
android:id="@+id/secondButtonSet"
102+
android:orientation="horizontal"
103+
android:layout_below="@+id/firstButtonSet"
104+
android:layout_marginTop="5dp"
105+
>
106+
<Button android:layout_width="match_parent"
107+
android:layout_height="wrap_content"
108+
android:text="@string/side_effects_reported_by_PCVs"
109+
android:background="@color/light_red"
110+
android:textColor="@color/white"
111+
android:layout_weight="1"
112+
android:padding="5dp"
113+
android:layout_margin="15dp"
114+
/>
115+
116+
<Button android:layout_width="match_parent"
117+
android:layout_height="wrap_content"
118+
android:text="@string/non_PCV_reported_side_effects"
119+
android:background="@color/light_red"
120+
android:textColor="@color/white"
121+
android:layout_weight="1"
122+
android:padding="5dp"
123+
android:layout_margin="15dp"
124+
125+
/>
126+
127+
128+
129+
130+
131+
</LinearLayout>
132+
133+
<LinearLayout android:layout_width="match_parent"
134+
android:layout_height="wrap_content"
135+
android:id="@+id/thirdButtonSet"
136+
android:orientation="horizontal"
137+
android:layout_below="@+id/secondButtonSet"
138+
android:layout_marginTop="5dp"
139+
>
140+
<Button android:layout_width="match_parent"
141+
android:layout_height="wrap_content"
142+
android:text="@string/volunteer_adherence_rates"
143+
android:background="@color/light_red"
144+
android:textColor="@color/white"
145+
android:layout_weight="1"
146+
android:padding="5dp"
147+
android:layout_margin="10dp"
148+
/>
149+
150+
<Button android:layout_width="match_parent"
151+
android:layout_height="wrap_content"
152+
android:text="@string/effectiveness_against_malaria"
153+
android:background="@color/light_red"
154+
android:textColor="@color/white"
155+
android:layout_weight="1"
156+
android:padding="5dp"
157+
android:layout_margin="10dp"
158+
159+
/>
160+
161+
162+
163+
164+
165+
</LinearLayout>
166+
</LinearLayout>
167+
</ScrollView>
168+
169+
170+
171+
<LinearLayout
172+
android:orientation="vertical"
173+
android:layout_alignBottom="@id/scrollSegment"
174+
android:layout_alignParentBottom="true"
175+
android:layout_width="match_parent"
176+
android:layout_height="wrap_content">
177+
178+
179+
180+
<View
181+
android:layout_height="0.5dp"
182+
android:layout_width="200dp"
183+
android:background="#000000"
184+
android:layout_gravity="center_horizontal"
185+
186+
/>
187+
188+
<LinearLayout
189+
android:orientation="horizontal"
190+
android:layout_width="wrap_content"
191+
android:layout_height="wrap_content"
192+
android:layout_gravity="center_horizontal"
193+
android:layout_marginTop="30dp"
194+
android:paddingBottom="5dp"
195+
196+
>
197+
198+
<Button
199+
android:id="@+id/homeButton"
200+
201+
android:background="@drawable/home_icon_inactive_normal"
202+
android:layout_width="30dp"
203+
android:layout_height="30dp"
204+
android:adjustViewBounds="true"
205+
android:layout_marginRight="15dp"
206+
android:scaleType="fitCenter"
207+
208+
/>
209+
210+
211+
<Button
212+
android:background="@drawable/info_hub_normal"
213+
android:id="@+id/infoButton"
214+
android:layout_width="30dp"
215+
android:layout_height="30dp"
216+
android:adjustViewBounds="true"
217+
android:layout_marginLeft="15dp"
218+
android:scaleType="fitCenter"
219+
/>
220+
221+
</LinearLayout>
222+
223+
224+
</LinearLayout>
225+
226+
</RelativeLayout>

‎res/layout/initial_screen_layout.xml

-118
This file was deleted.

‎res/layout/launch_screen_layout.xml

-34
This file was deleted.

‎res/layout/layout3.xml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
android:orientation="vertical" >
6+
7+
8+
</LinearLayout>
+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
4+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
5+
android:orientation="vertical"
6+
android:background="@drawable/background"
7+
android:layout_gravity="center_horizontal"
8+
android:layout_width="match_parent"
9+
android:padding="10dp"
10+
android:layout_height="match_parent">
11+
12+
13+
14+
15+
<TextView android:layout_width="match_parent"
16+
android:layout_height="wrap_content"
17+
android:text="Peace Corps Policy"
18+
android:textColor="@color/golden_brown"
19+
android:textSize="25sp"
20+
android:gravity="center"
21+
android:textStyle="bold"
22+
android:id="@+id/peaceCorpsPolicyLabel"
23+
24+
/>
25+
<View android:layout_width="match_parent"
26+
android:layout_height="0.2dp"
27+
android:background="@color/black"/>
28+
29+
<ScrollView
30+
android:layout_width="match_parent"
31+
android:layout_height="wrap_content">
32+
<LinearLayout android:layout_width="match_parent"
33+
android:layout_height="wrap_content"
34+
android:orientation="vertical"
35+
>
36+
37+
38+
<TextView android:layout_width="match_parent"
39+
android:padding="5dp"
40+
android:text="@string/dump_test"
41+
android:textColor="@color/black"
42+
android:layout_height="wrap_content"/>
43+
</LinearLayout>
44+
</ScrollView>
45+
</LinearLayout>

‎res/values/color.xml

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
3-
<color name="white">#FFFFFF</color>
4-
<color name="view_pager_indicator_text_color">#2FB3E3</color>
3+
<color name="white">#FFF</color>
4+
<color name="golden_brown">#664a3a</color>
5+
<color name="light_red">#da6767</color>
6+
7+
8+
<color name="view_pager_indicator_text_color">#2FB3E3</color>
59
<color name="black">#000000</color>
610
<color name="user_medicine_first_text_color">#592b15</color>
11+
712
<color name="user_medicine_second_text_color">#664a3a</color>
813

14+
915
</resources>

‎res/values/strings.xml

+42-1
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,59 @@
1111
<string name="user_medicine_settings_activity_if_forget_label">If I forget</string>
1212
<string name="user_medicine_settings_activity_done_button">DONE</string>
1313
<string name="second_analytic_screen_title">SECOND ANALYTIC SCREEN</string>
14-
<string name="first_analytic_screen_doses_missing_text">Doses Missing since Last Check in</string>
14+
<string name="first_analytic_screen_doses_missing_text">Doses in a Row</string>
1515
<string name="first_analytic_screen_medicine_last_taken_text">Medicine Last Taken</string>
1616
<string name="first_analytic_screen_medicine_adherence_to_medicine_text">Adherence to Medicine</string>
1717
<string name="alarm_auto_start_boot_completed_intent_check">android.intent.action.BOOT_COMPLETED</string>
1818
<string name="alert_dialog_title">Malaria medication reminder</string>
1919
<string name="alert_dialog_message">Have you taken your drug today ?</string>
2020
<string name="user_medicine_settings_fragment_activity_title">PC Malaria Prevention</string>
21+
<string name="info_hub_title_label">info Hub</string>
22+
<string name="peace_corps_policy">Peace Corps Policy</string>
23+
<string name="percentage_of_side_effects">Percentage of Side Effects</string>
24+
<string name="side_effects_reported_by_PCVs">Side Effects Reported by PCVs</string>
25+
<string name="effectiveness_against_malaria">Effectiveness Against Malaria</string>
26+
<string name="volunteer_adherence_rates">Volunteer Adherence Rates</string>
27+
<string name="non_PCV_reported_side_effects">Non-PCV Reported Side Effects</string>
28+
29+
30+
<string name="dump_test">Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem
31+
Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem IpsumLorem Ipsum Lorem Ipsum
32+
Lorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem Ipsum
33+
Lorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem Ipsum
34+
Lorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem Ipsum
35+
Lorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem Ipsum
36+
Lorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem Ipsum
37+
Lorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem Ipsum
38+
Lorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem Ipsum
39+
Lorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem Ipsum
40+
Lorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem Ipsum
41+
Lorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem Ipsum
42+
Lorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem Ipsum
43+
Lorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem Ipsum
44+
45+
</string>
46+
2147

2248
<string-array name="user_medicine_settings_activity_drug_array">
2349
<item>Malarone (Daily)</item>
2450
<item>Doxycycline (Daily)</item>
2551
<item>Mefloquine (Weekly)</item>
2652
</string-array>
2753

54+
<string-array name="month">
55+
<item>January</item>
56+
<item>February</item>
57+
<item>March</item>
58+
<item>April</item>
59+
<item>May</item>
60+
<item>June</item>
61+
<item>July</item>
62+
<item>August</item>
63+
<item>September</item>
64+
<item>October</item>
65+
<item>November</item>
66+
<item>December</item>
67+
</string-array>
68+
2869
</resources>

‎src/com/peacecorps/malaria/AlarmAutoStart.java

+21
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
<<<<<<< HEAD
2+
package com.peacecorps.malaria;
3+
4+
import android.content.BroadcastReceiver;
5+
import android.content.Context;
6+
import android.content.Intent;
7+
import com.peacecorps.malaria.R;
8+
9+
public class AlarmAutoStart extends BroadcastReceiver {
10+
11+
@Override
12+
public void onReceive(Context context, Intent intent) {
13+
14+
if (intent.getAction().equals(R.string.alarm_auto_start_boot_completed_intent_check)) {
15+
context.startService(new Intent(context, AlarmService.class));
16+
}
17+
}
18+
19+
}
20+
=======
121
package com.peacecorps.malaria;
222

323
import android.content.BroadcastReceiver;
@@ -16,3 +36,4 @@ public void onReceive(Context context, Intent intent) {
1636
}
1737

1838
}
39+
>>>>>>> FETCH_HEAD

‎src/com/peacecorps/malaria/AlarmHandlerClass.java

+93
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,95 @@
1+
<<<<<<< HEAD
2+
package com.peacecorps.malaria;
3+
4+
import java.util.Calendar;
5+
import java.util.Date;
6+
7+
import android.app.AlarmManager;
8+
import android.app.PendingIntent;
9+
import android.content.BroadcastReceiver;
10+
import android.content.Context;
11+
import android.content.Intent;
12+
import android.os.PowerManager;
13+
14+
public class AlarmHandlerClass extends BroadcastReceiver {
15+
16+
public static Calendar mAlarmScheduleTime;
17+
final int INTERVAL_WEEK = 604800000;
18+
public static AlarmManager mAlarmManager;
19+
20+
static SharedPreferenceStore mSharedPreferenceStore;
21+
22+
@Override
23+
public void onReceive(Context context, Intent intent) {
24+
PowerManager powerManager = (PowerManager) context
25+
.getSystemService(Context.POWER_SERVICE);
26+
PowerManager.WakeLock wakeLock = powerManager.newWakeLock(
27+
PowerManager.PARTIAL_WAKE_LOCK, "");
28+
wakeLock.acquire();
29+
30+
/** Opening the Alert Dialog Window */
31+
32+
intent = new Intent(context, AlertCallerFragmentActivity.class);
33+
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
34+
context.startActivity(intent);
35+
wakeLock.release();
36+
}
37+
38+
public void getSharedPreferences(Context context) {
39+
mSharedPreferenceStore.mPrefsStore = context.getSharedPreferences(
40+
"com.peacecorps.malaria.storeTimePicked", Context.MODE_PRIVATE);
41+
mSharedPreferenceStore.mEditor = mSharedPreferenceStore.mPrefsStore
42+
.edit();
43+
}
44+
45+
public void setAlarm(Context context) {
46+
47+
getSharedPreferences(context);
48+
int hour = mSharedPreferenceStore.mPrefsStore.getInt(
49+
"com.peacecorps.malaria.AlarmHour", -1);
50+
int minute = mSharedPreferenceStore.mPrefsStore.getInt(
51+
"com.peacecorps.malaria.AlarmMinute", -1);
52+
if ((hour != -1) && (minute != -1)) {
53+
AlarmTime(context, hour, minute);
54+
mAlarmManager = (AlarmManager) context
55+
.getSystemService(Context.ALARM_SERVICE);
56+
Intent alarmIntent = new Intent(
57+
"com.peacecorps.malaria.START_ALARM");
58+
PendingIntent pendingAlarm = PendingIntent.getBroadcast(context, 0,
59+
alarmIntent, Intent.FLAG_ACTIVITY_NEW_TASK);
60+
if (mSharedPreferenceStore.mPrefsStore.getBoolean(
61+
"com.peacecorps.malaria.isWeekly", false)) {
62+
mAlarmManager.setRepeating(AlarmManager.RTC_WAKEUP,
63+
mAlarmScheduleTime.getTimeInMillis(), INTERVAL_WEEK,
64+
pendingAlarm);
65+
} else {
66+
mAlarmManager.setRepeating(AlarmManager.RTC_WAKEUP,
67+
mAlarmScheduleTime.getTimeInMillis(),
68+
AlarmManager.INTERVAL_DAY, pendingAlarm);
69+
}
70+
}
71+
72+
}
73+
74+
public void AlarmTime(Context context, int hour, int minute) {
75+
76+
Date date = new Date();
77+
mAlarmScheduleTime = Calendar.getInstance();
78+
mAlarmScheduleTime.setTime(date);
79+
80+
Calendar dateNow = Calendar.getInstance();
81+
dateNow.setTime(date);
82+
83+
mAlarmScheduleTime.set(Calendar.HOUR_OF_DAY, hour);
84+
mAlarmScheduleTime.set(Calendar.MINUTE, minute);
85+
86+
if (mAlarmScheduleTime.before(dateNow)) {
87+
mAlarmScheduleTime.add(Calendar.DATE, 1);
88+
}
89+
90+
}
91+
}
92+
=======
193
package com.peacecorps.malaria;
294

395
import java.util.Calendar;
@@ -88,3 +180,4 @@ public void AlarmTime(Context context, int hour, int minute) {
88180

89181
}
90182
}
183+
>>>>>>> FETCH_HEAD

‎src/com/peacecorps/malaria/AlarmService.java

+38
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,40 @@
1+
<<<<<<< HEAD
2+
package com.peacecorps.malaria;
3+
4+
import android.app.Service;
5+
import android.content.Intent;
6+
import android.os.IBinder;
7+
8+
public class AlarmService extends Service {
9+
10+
AlarmHandlerClass alarmHandlerClass = new AlarmHandlerClass();
11+
12+
@Override
13+
public IBinder onBind(Intent intent) {
14+
15+
return null;
16+
}
17+
18+
public void onStart(Intent intent, int startId) {
19+
20+
alarmHandlerClass.setAlarm(AlarmService.this);
21+
}
22+
23+
@Override
24+
public void onCreate() {
25+
26+
super.onCreate();
27+
}
28+
29+
@Override
30+
public int onStartCommand(Intent intent, int flags, int startId) {
31+
32+
alarmHandlerClass.setAlarm(AlarmService.this);
33+
return START_STICKY;
34+
}
35+
36+
}
37+
=======
138
package com.peacecorps.malaria;
239

340
import android.app.Service;
@@ -33,3 +70,4 @@ public int onStartCommand(Intent intent, int flags, int startId) {
3370
}
3471

3572
}
73+
>>>>>>> FETCH_HEAD

‎src/com/peacecorps/malaria/AlertCallerFragmentActivity.java

+70
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,72 @@
1+
<<<<<<< HEAD
2+
package com.peacecorps.malaria;
3+
4+
import java.util.Date;
5+
6+
import android.content.Context;
7+
import android.os.Bundle;
8+
import android.support.v4.app.FragmentActivity;
9+
10+
public class AlertCallerFragmentActivity extends FragmentActivity {
11+
static SharedPreferenceStore mSharedPreferenceStore;
12+
13+
@Override
14+
protected void onCreate(Bundle savedInstanceState) {
15+
super.onCreate(savedInstanceState);
16+
17+
/** Creating an Alert Dialog Window */
18+
runOnUiThread(new Runnable() {
19+
20+
@Override
21+
public void run() {
22+
23+
String weeklyDate = "weeklyDate";
24+
getSharedPreferences();
25+
if (mSharedPreferenceStore.mPrefsStore.getBoolean(
26+
"com.peacecorps.malaria.isWeekly", false)) {
27+
28+
if (checkDrugTakenTimeInterval(weeklyDate) == 0
29+
|| checkDrugTakenTimeInterval(weeklyDate) >= 7) {
30+
callAlarm();
31+
} else {
32+
finish();
33+
}
34+
} else {
35+
callAlarm();
36+
}
37+
}
38+
});
39+
40+
}
41+
42+
public void callAlarm() {
43+
AlertDialogFragment alert = new AlertDialogFragment();
44+
45+
alert.show(getSupportFragmentManager(), "alertDemo");
46+
47+
alert.setCancelable(false);
48+
}
49+
50+
public long checkDrugTakenTimeInterval(String time) {
51+
long interval = 0;
52+
long today = new Date().getTime();
53+
long takenDate = mSharedPreferenceStore.mPrefsStore.getLong("com.peacecorps.malaria."
54+
+ time, 0);
55+
long oneDay = 1000 * 60 * 60 * 24;
56+
interval = (today - takenDate) / oneDay;
57+
return interval;
58+
}
59+
60+
public void getSharedPreferences() {
61+
// reading the application SharedPreferences for storing of time and
62+
// drug selected
63+
mSharedPreferenceStore.mPrefsStore = getSharedPreferences(
64+
"com.peacecorps.malaria.storeTimePicked", Context.MODE_PRIVATE);
65+
mSharedPreferenceStore.mEditor = mSharedPreferenceStore.mPrefsStore
66+
.edit();
67+
}
68+
}
69+
=======
170
package com.peacecorps.malaria;
271

372
import java.util.Date;
@@ -65,3 +134,4 @@ public void getSharedPreferences() {
65134
.edit();
66135
}
67136
}
137+
>>>>>>> FETCH_HEAD

‎src/com/peacecorps/malaria/AlertDialogFragment.java

+188
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,190 @@
1+
<<<<<<< HEAD
2+
package com.peacecorps.malaria;
3+
4+
import java.util.Calendar;
5+
import java.util.Date;
6+
7+
import android.app.AlarmManager;
8+
import android.app.AlertDialog;
9+
import android.app.Dialog;
10+
import android.app.PendingIntent;
11+
import android.content.Context;
12+
import android.content.DialogInterface;
13+
import android.content.DialogInterface.OnClickListener;
14+
import android.content.Intent;
15+
import android.os.Bundle;
16+
import android.support.v4.app.DialogFragment;
17+
import android.view.WindowManager.LayoutParams;
18+
19+
20+
public class AlertDialogFragment extends DialogFragment {
21+
22+
private static int mDrugAcceptedCount;
23+
private static int mDrugRejectedCount;
24+
static SharedPreferenceStore mSharedPreferenceStore;
25+
26+
@Override
27+
public Dialog onCreateDialog(Bundle savedInstanceState) {
28+
29+
/**
30+
* Turn Screen On and Unlock the keypad when this alert dialog is
31+
* displayed
32+
*/
33+
getActivity().getWindow().addFlags(
34+
LayoutParams.FLAG_TURN_SCREEN_ON
35+
| LayoutParams.FLAG_DISMISS_KEYGUARD);
36+
37+
/** Creating a alert dialog builder */
38+
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
39+
40+
/** Setting title for the alert dialog */
41+
42+
builder.setTitle(R.string.alert_dialog_title);
43+
44+
/** Setting the content for the alert dialog */
45+
builder.setMessage(R.string.alert_dialog_message);
46+
47+
/** Defining an OK button event listener */
48+
builder.setPositiveButton("Taken", new OnClickListener() {
49+
@Override
50+
public void onClick(DialogInterface dialog, int which) {
51+
getActivity().runOnUiThread(new Runnable() {
52+
53+
@Override
54+
public void run() {
55+
getSharedPreferences();
56+
getSettings();
57+
if (mSharedPreferenceStore.mPrefsStore.getBoolean(
58+
"com.pc.isWeekly", false)) {
59+
saveUsersettings(true, true);
60+
changeWeeklyAlarmTime();
61+
} else {
62+
if (checkDrugTakenTimeInterval("dateDrugTaken") > 0) {
63+
saveUsersettings(true, false);
64+
}
65+
}
66+
getActivity().finish();
67+
}
68+
});
69+
70+
}
71+
}).setNegativeButton("Not Taken", new OnClickListener() {
72+
73+
@Override
74+
public void onClick(DialogInterface dialog, int which) {
75+
getActivity().runOnUiThread(new Runnable() {
76+
77+
@Override
78+
public void run() {
79+
getSharedPreferences();
80+
getActivity().finish();
81+
}
82+
});
83+
84+
}
85+
}).setNeutralButton("Snooze", new OnClickListener() {
86+
87+
@Override
88+
public void onClick(DialogInterface dialog, int which) {
89+
snooze();
90+
91+
}
92+
}).setCancelable(false);
93+
94+
/** Creating the alert dialog window */
95+
return builder.create();
96+
}
97+
98+
public long checkDrugTakenTimeInterval(String time) {
99+
long interval = 0;
100+
long today = new Date().getTime();
101+
long takenDate = mSharedPreferenceStore.mPrefsStore.getLong("com.pc."
102+
+ time, 0);
103+
long oneDay = 1000 * 60 * 60 * 24;
104+
interval = (today - takenDate) / oneDay;
105+
return interval;
106+
}
107+
108+
public void snooze() {
109+
getActivity().runOnUiThread(new Runnable() {
110+
111+
@Override
112+
public void run() {
113+
getSharedPreferences();
114+
Intent intent = new Intent(getActivity(),
115+
AlertCallerFragmentActivity.class);
116+
PendingIntent pendingSnooze = PendingIntent.getActivity(
117+
getActivity().getApplicationContext(), 0, intent,
118+
PendingIntent.FLAG_UPDATE_CURRENT);
119+
AlarmManager alarmManager = (AlarmManager) getActivity()
120+
.getSystemService(getActivity().ALARM_SERVICE);
121+
Calendar calender = Calendar.getInstance();
122+
Date date = new Date();
123+
calender.setTime(date);
124+
calender.add(Calendar.MINUTE, 30);
125+
alarmManager.set(AlarmManager.RTC_WAKEUP,
126+
calender.getTimeInMillis(), pendingSnooze);
127+
}
128+
});
129+
}
130+
131+
public void changeWeeklyAlarmTime() {
132+
int hour = Calendar.getInstance().getTime().getHours();
133+
int minute = Calendar.getInstance().getTime().getMinutes() - 1;
134+
getActivity().startService(
135+
new Intent(getActivity(), AlarmService.class));
136+
mSharedPreferenceStore.mEditor.putInt("com.pc.AlarmHour", hour)
137+
.commit();
138+
mSharedPreferenceStore.mEditor.putInt("com.pc.AlarmMinute", minute)
139+
.commit();
140+
}
141+
142+
public void saveUsersettings(Boolean state, Boolean isWeekly) {
143+
if (isWeekly) {
144+
mSharedPreferenceStore.mEditor.putLong("com.pc.weeklyDate",
145+
new Date().getTime()).commit();
146+
mSharedPreferenceStore.mEditor.putBoolean(
147+
"com.pc.isWeeklyDrugTaken", state).commit();
148+
} else {
149+
mSharedPreferenceStore.mEditor.putLong("com.pc.dateDrugTaken",
150+
new Date().getTime()).commit();
151+
mSharedPreferenceStore.mEditor.putBoolean("com.pc.isDrugTaken",
152+
state).commit();
153+
}
154+
mSharedPreferenceStore.mEditor.putInt("com.pc.drugRejectedCount",
155+
mDrugRejectedCount).commit();
156+
mSharedPreferenceStore.mEditor.putInt("com.pc.drugAcceptedCount",
157+
mDrugAcceptedCount).commit();
158+
159+
}
160+
161+
public void getSettings() {
162+
mDrugAcceptedCount = mSharedPreferenceStore.mPrefsStore.getInt(
163+
"com.pc.drugAcceptedCount", 0);
164+
mDrugRejectedCount = mSharedPreferenceStore.mPrefsStore.getInt(
165+
"com.pc.drugRejectedCount", 0);
166+
}
167+
168+
public void getSharedPreferences() {
169+
170+
mSharedPreferenceStore.mPrefsStore = getActivity()
171+
.getSharedPreferences("com.pc.storeTimePicked",
172+
Context.MODE_PRIVATE);
173+
mSharedPreferenceStore.mEditor = mSharedPreferenceStore.mPrefsStore
174+
.edit();
175+
}
176+
177+
/**
178+
* The application exits, if the user presses the back button
179+
*/
180+
@Override
181+
public void onDestroy() {
182+
super.onDestroy();
183+
getActivity().finish();
184+
}
185+
186+
}
187+
=======
1188
package com.peacecorps.malaria;
2189

3190
import java.util.Calendar;
@@ -181,3 +368,4 @@ public void onDestroy() {
181368
}
182369

183370
}
371+
>>>>>>> FETCH_HEAD

‎src/com/peacecorps/malaria/DatabaseSQLiteHelper.java

100755100644
+85
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,87 @@
1+
<<<<<<< HEAD
2+
package com.peacecorps.malaria;
3+
4+
import android.content.ContentValues;
5+
import android.content.Context;
6+
import android.database.Cursor;
7+
import android.database.sqlite.SQLiteDatabase;
8+
import android.database.sqlite.SQLiteOpenHelper;
9+
10+
import java.util.ArrayList;
11+
import java.util.Calendar;
12+
import java.util.Date;
13+
14+
/**
15+
* Created by Chimdi on 7/18/14.
16+
*/
17+
public class DatabaseSQLiteHelper extends SQLiteOpenHelper {
18+
19+
private static final String DATABASE_NAME = "MalariaDatabase";
20+
private static final String userMedicationChoiceTable = "userSettings";
21+
22+
public DatabaseSQLiteHelper(Context context) {
23+
super(context, DATABASE_NAME, null, 1);
24+
}
25+
26+
@Override
27+
public void onCreate(SQLiteDatabase database) {
28+
database.execSQL("CREATE TABLE " + userMedicationChoiceTable + " (_id INTEGER PRIMARY KEY AUTOINCREMENT, Drug INTEGER,Choice VARCHAR, Month VARCHAR, Year VARCHAR,Status VARCHAR,Date INTEGER,Percentage DOUBLE);");
29+
}
30+
31+
@Override
32+
public void onUpgrade(SQLiteDatabase database, int oldVersion, int newVersion) {
33+
}
34+
35+
public static ArrayList<Double> percentage;
36+
public static ArrayList<Integer> date;
37+
38+
public int getData(int month, int year, String choice) {
39+
40+
percentage = new ArrayList<Double>();
41+
date = new ArrayList<Integer>();
42+
int count = 0;
43+
SQLiteDatabase sqLiteDatabase = getWritableDatabase();
44+
String column[] = {"_id", "Date", "Percentage"};
45+
String args[] = {"" + month, "" + year, "yes", choice};
46+
Cursor cursor = sqLiteDatabase.query(userMedicationChoiceTable, column, "Month =? AND Year =? AND Status =? AND Choice =?", args, null, null, null, null);
47+
boolean isDataFound = false;
48+
while (cursor.moveToNext()) {
49+
isDataFound = true;
50+
count += 1;
51+
date.add(cursor.getInt(1));
52+
percentage.add(cursor.getDouble(2));
53+
54+
}
55+
if (isDataFound) {
56+
if (!(date.get(date.size() - 1) == Calendar.getInstance().getTime().getDate())) {
57+
percentage.add(0.0);
58+
date.add(Calendar.getInstance().getTime().getDate());
59+
}
60+
}
61+
return count;
62+
}
63+
64+
public void getUserMedicationSelection(Context context, String choice, Date date, String status, Double percentage) {
65+
ContentValues values = new ContentValues(2);
66+
67+
values.put("Drug", SharedPreferenceStore.mPrefsStore.getInt("com.peacecorps.malaria.drug", 0));
68+
values.put("Choice", choice);
69+
values.put("Month", "" + date.getMonth());
70+
values.put("Year", "" + date.getYear());
71+
values.put("Status", status);
72+
values.put("Date", date.getDate());
73+
values.put("Percentage", percentage);
74+
75+
this.getWritableDatabase().insert(userMedicationChoiceTable, "medication", values);
76+
77+
78+
}
79+
80+
public Cursor getMedicationData() {
81+
return null;
82+
}
83+
}
84+
=======
185
package com.peacecorps.malaria;
286

387
import android.content.ContentValues;
@@ -85,3 +169,4 @@ public Cursor getMedicationData() {
85169
return null;
86170
}
87171
}
172+
>>>>>>> FETCH_HEAD

‎src/com/peacecorps/malaria/FirstAnalyticFragment.java

+76
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,78 @@
1+
<<<<<<< HEAD
2+
package com.peacecorps.malaria;
3+
4+
import android.content.Context;
5+
import android.content.Intent;
6+
import android.os.Bundle;
7+
import android.support.v4.app.Fragment;
8+
import android.view.LayoutInflater;
9+
import android.view.View;
10+
import android.view.ViewGroup;
11+
import android.widget.Button;
12+
import android.widget.TextView;
13+
import com.peacecorps.malaria.R;
14+
15+
16+
public class FirstAnalyticFragment extends Fragment {
17+
18+
19+
static SharedPreferenceStore mSharedPreferenceStore;
20+
static View rootView;
21+
public static TextView checkMediLastTakenTime = null;
22+
public static TextView doses = null;
23+
public static TextView adherence = null;
24+
private Button mSettingsButton;
25+
26+
public View onCreateView(LayoutInflater inflater, ViewGroup container,
27+
Bundle savedInstanceState) {
28+
rootView = inflater
29+
.inflate(R.layout.fragment_first_analytic_screen, null);
30+
31+
32+
mSettingsButton = (Button) rootView.findViewById(R.id.fragment_first_screen_settings_button);
33+
checkMediLastTakenTime = (TextView) rootView.findViewById(R.id.checkMediLastTakenTime);
34+
doses = (TextView) rootView.findViewById(R.id.doses);
35+
adherence = (TextView) rootView.findViewById(R.id.adherence);
36+
37+
if (checkMediLastTakenTime != null) {
38+
checkMediLastTakenTime.setText(mSharedPreferenceStore.mPrefsStore.getString("com.peacecorps.malaria.checkMediLastTakenTime", "").toString());
39+
doses.setText("" + mSharedPreferenceStore.mPrefsStore.getInt("com.peacecorps.malaria.acceptedCount", 0));
40+
}
41+
42+
43+
getSharedPreferences();
44+
addButtonListeners();
45+
46+
return rootView;
47+
48+
}
49+
50+
public void addButtonListeners() {
51+
mSettingsButton.setOnClickListener(new View.OnClickListener() {
52+
53+
@Override
54+
public void onClick(View v) {
55+
56+
mSharedPreferenceStore.mEditor.putBoolean(
57+
"com.peacecorps.malaria.hasUserSetPreference", false).commit();
58+
startActivity(new Intent(getActivity(),
59+
UserMedicineSettingsFragmentActivity.class));
60+
getActivity().finish();
61+
62+
}
63+
});
64+
}
65+
66+
public void getSharedPreferences() {
67+
68+
mSharedPreferenceStore.mPrefsStore = getActivity()
69+
.getSharedPreferences("com.peacecorps.malaria.storeTimePicked",
70+
Context.MODE_PRIVATE);
71+
mSharedPreferenceStore.mEditor = mSharedPreferenceStore.mPrefsStore
72+
.edit();
73+
}
74+
75+
=======
176
package com.peacecorps.malaria;
277

378
import android.content.Context;
@@ -74,4 +149,5 @@ public void getSharedPreferences() {
74149
.edit();
75150
}
76151

152+
>>>>>>> FETCH_HEAD
77153
}

‎src/com/peacecorps/malaria/FragmentAdapter.java

+52
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,54 @@
1+
<<<<<<< HEAD
2+
package com.peacecorps.malaria;
3+
4+
import com.viewpagerindicator.IconPagerAdapter;
5+
6+
import android.support.v4.app.Fragment;
7+
import android.support.v4.app.FragmentManager;
8+
import android.support.v4.app.FragmentStatePagerAdapter;
9+
10+
public class FragmentAdapter extends FragmentStatePagerAdapter implements
11+
IconPagerAdapter {
12+
13+
public FragmentAdapter(FragmentManager fm) {
14+
super(fm);
15+
16+
}
17+
18+
@Override
19+
public int getIconResId(int index) {
20+
21+
return 0;
22+
}
23+
24+
@Override
25+
public Fragment getItem(int position) {
26+
27+
Fragment fragment = new HomeScreenFragment();
28+
switch (position) {
29+
case 0:
30+
fragment = new HomeScreenFragment();
31+
break;
32+
case 1:
33+
fragment = new FirstAnalyticFragment();
34+
break;
35+
36+
case 2:
37+
fragment = new SecondAnalyticFragment();
38+
break;
39+
40+
}
41+
return fragment;
42+
}
43+
44+
@Override
45+
public int getCount() {
46+
47+
return 3;
48+
}
49+
50+
51+
=======
152
package com.peacecorps.malaria;
253

354
import com.viewpagerindicator.IconPagerAdapter;
@@ -48,4 +99,5 @@ public int getCount() {
4899

49100

50101

102+
>>>>>>> FETCH_HEAD
51103
}

‎src/com/peacecorps/malaria/HomeScreenFragment.java

+376
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,378 @@
1+
<<<<<<< HEAD
2+
package com.peacecorps.malaria;
3+
4+
import android.content.Context;
5+
import android.content.Intent;
6+
import android.graphics.Color;
7+
import android.media.MediaPlayer;
8+
import android.os.Bundle;
9+
import android.support.v4.app.Fragment;
10+
import android.view.LayoutInflater;
11+
import android.view.View;
12+
import android.view.ViewGroup;
13+
import android.widget.Button;
14+
import android.widget.TextView;
15+
16+
import java.text.SimpleDateFormat;
17+
import java.util.Calendar;
18+
import java.util.Date;
19+
import java.util.Locale;
20+
21+
public class HomeScreenFragment extends Fragment {
22+
23+
static final private int INIT_HOUR = 5;
24+
static final private int INIT_MINUTE = 30;
25+
26+
private Button mAcceptMedicationButton;
27+
private Button mRejectMedicationButton;
28+
private Button mSettingsButton;
29+
private TextView mCurrentDateLabel;
30+
private TextView mCurrentDayOfweekLabel;
31+
private static CharSequence mGetCurrentDate;
32+
private static int mDrugAcceptedCount;
33+
private static int drugRejectedCount;
34+
private Calendar mCalendar;
35+
private String[] mPossibledays = {"Sunday", "Monday", "Tuesday",
36+
"Wednesday", "Thursday", "Friday", "Saturday"};
37+
private static View rootView;
38+
39+
int checkDay = -1;
40+
41+
static SharedPreferenceStore mSharedPreferenceStore;
42+
43+
44+
@Override
45+
public void onResume() {
46+
47+
super.onResume();
48+
updateUI();
49+
50+
}
51+
52+
public void getSharedPreferences() {
53+
54+
mSharedPreferenceStore.mPrefsStore = getActivity()
55+
.getSharedPreferences("com.peacecorps.malaria.storeTimePicked",
56+
Context.MODE_PRIVATE);
57+
mSharedPreferenceStore.mEditor = mSharedPreferenceStore.mPrefsStore
58+
.edit();
59+
}
60+
61+
public View onCreateView(LayoutInflater inflater, ViewGroup container,
62+
Bundle savedInstanceState) {
63+
rootView = inflater.inflate(R.layout.fragment_home_screen, null);
64+
65+
updateUI();
66+
return rootView;
67+
68+
}
69+
70+
public double computeAdherenceRate() {
71+
long interval = checkDrugTakenTimeInterval("firstRunTime") + 1;
72+
int takenCount = SharedPreferenceStore.mPrefsStore.getInt("com.peacecorps.malaria.drugAcceptedCount", 0);
73+
double adherenceRate = (takenCount / interval) * 100;
74+
return adherenceRate;
75+
}
76+
77+
public void addButtonListeners() {
78+
mSettingsButton.setOnClickListener(new View.OnClickListener() {
79+
80+
@Override
81+
public void onClick(View v) {
82+
83+
mSharedPreferenceStore.mEditor.putBoolean(
84+
"com.peacecorps.malaria.hasUserSetPreference", false).commit();
85+
startActivity(new Intent(getActivity(),
86+
UserMedicineSettingsFragmentActivity.class));
87+
getActivity().finish();
88+
89+
}
90+
});
91+
92+
mAcceptMedicationButton.setOnClickListener(new View.OnClickListener() {
93+
94+
@Override
95+
public void onClick(View v) {
96+
MediaPlayer.create(getActivity(), R.raw.accept_button_sound)
97+
.start();
98+
mDrugAcceptedCount += 1;
99+
int value = SharedPreferenceStore.mPrefsStore.getInt(
100+
"com.peacecorps.malaria.AcceptedCount", 0) + 1;
101+
SharedPreferenceStore.mEditor.putInt("com.peacecorps.malaria.AcceptedCount",
102+
value).commit();
103+
if (mSharedPreferenceStore.mPrefsStore.getBoolean(
104+
"com.peacecorps.malaria.isWeekly", false)) {
105+
int currentDose = SharedPreferenceStore.mPrefsStore.getInt("com.peacecorps.malaria.weeklyDose", 0) + 1;
106+
mSharedPreferenceStore.mEditor.putInt("com.peacecorps.malaria.weeklyDose", currentDose).commit();
107+
decideDrugTakenUIBoolean(true, true);
108+
DatabaseSQLiteHelper databaseSQLiteHelper = new DatabaseSQLiteHelper(getActivity());
109+
databaseSQLiteHelper.getUserMedicationSelection(getActivity(), "weekly", Calendar.getInstance().getTime(), "yes", computeAdherenceRate());
110+
} else {
111+
decideDrugTakenUIBoolean(false, true);
112+
int currentDose = SharedPreferenceStore.mPrefsStore.getInt("com.peacecorps.malaria.dailyDose", 0) + 1;
113+
mSharedPreferenceStore.mEditor.putInt("com.peacecorps.malaria.dailyDose", currentDose).commit();
114+
DatabaseSQLiteHelper databaseSQLiteHelper = new DatabaseSQLiteHelper(getActivity());
115+
databaseSQLiteHelper.getUserMedicationSelection(getActivity(), "daily", Calendar.getInstance().getTime(), "yes", computeAdherenceRate());
116+
}
117+
118+
}
119+
});
120+
121+
mRejectMedicationButton.setOnClickListener(new View.OnClickListener() {
122+
123+
@Override
124+
public void onClick(View v) {
125+
MediaPlayer.create(getActivity(), R.raw.reject_button_sound)
126+
.start();
127+
drugRejectedCount += 1;
128+
if (mSharedPreferenceStore.mPrefsStore.getBoolean(
129+
"com.peacecorps.malaria.isWeekly", false)) {
130+
decideDrugTakenUIBoolean(true, false);
131+
DatabaseSQLiteHelper databaseSQLiteHelper = new DatabaseSQLiteHelper(getActivity());
132+
databaseSQLiteHelper.getUserMedicationSelection(getActivity(), "weekly", Calendar.getInstance().getTime(), "no", computeAdherenceRate());
133+
134+
} else {
135+
decideDrugTakenUIBoolean(false, false);
136+
DatabaseSQLiteHelper databaseSQLiteHelper = new DatabaseSQLiteHelper(getActivity());
137+
databaseSQLiteHelper.getUserMedicationSelection(getActivity(), "daily", Calendar.getInstance().getTime(), "no", computeAdherenceRate());
138+
139+
}
140+
141+
}
142+
});
143+
}
144+
145+
public void createView() {
146+
147+
mAcceptMedicationButton = (Button) rootView
148+
.findViewById(R.id.fragment_home_screen_accept_medication_button);
149+
mRejectMedicationButton = (Button) rootView
150+
.findViewById(R.id.fragment_home_screen__reject_medication_button);
151+
mSettingsButton = (Button) rootView
152+
.findViewById(R.id.fragment_home_screen_settings_button);
153+
mCurrentDateLabel = (TextView) rootView
154+
.findViewById(R.id.fragment_home_screen_current_date);
155+
mCurrentDayOfweekLabel = (TextView) rootView
156+
.findViewById(R.id.fragment_home_screen_current_day_of_week);
157+
158+
mCurrentDateLabel.setTextColor(Color.rgb(89, 43, 21));
159+
mCurrentDayOfweekLabel.setTextColor(Color.rgb(89, 43, 21));
160+
mCurrentDateLabel.setText(mGetCurrentDate);
161+
mCurrentDayOfweekLabel
162+
.setText(decideDayofWeek(checkDay, mPossibledays));
163+
}
164+
165+
public void updateUI() {
166+
getSharedPreferences();
167+
168+
mCalendar = Calendar.getInstance();
169+
170+
checkDay = mCalendar.get(Calendar.DAY_OF_WEEK);
171+
172+
173+
getSettings();
174+
createView();
175+
addButtonListeners();
176+
getSettings();
177+
decideisDrugTakenUI();
178+
}
179+
180+
public void saveUsersettings(Boolean state, Boolean isWeekly) {
181+
if (isWeekly) {
182+
mSharedPreferenceStore.mEditor.putLong("com.peacecorps.malaria.weeklyDate",
183+
new Date().getTime()).commit();
184+
mSharedPreferenceStore.mEditor.putBoolean(
185+
"com.peacecorps.malaria.isWeeklyDrugTaken", state).commit();
186+
} else {
187+
mSharedPreferenceStore.mEditor.putLong("com.peacecorps.malaria.dateDrugTaken",
188+
new Date().getTime()).commit();
189+
mSharedPreferenceStore.mEditor.putBoolean("com.peacecorps.malaria.isDrugTaken",
190+
state).commit();
191+
}
192+
mSharedPreferenceStore.mEditor.putInt("com.peacecorps.malaria.drugRejectedCount",
193+
drugRejectedCount).commit();
194+
mSharedPreferenceStore.mEditor.putInt("com.peacecorps.malaria.drugAcceptedCount",
195+
mDrugAcceptedCount).commit();
196+
197+
}
198+
199+
public void getSettings() {
200+
checkDay = mCalendar.get(Calendar.DAY_OF_WEEK);
201+
mGetCurrentDate = new SimpleDateFormat("dd/MM/yyyy",
202+
Locale.getDefault()).format(mCalendar.getTime());
203+
mDrugAcceptedCount = mSharedPreferenceStore.mPrefsStore.getInt(
204+
"com.peacecorps.malaria.drugAcceptedCount", 0);
205+
drugRejectedCount = mSharedPreferenceStore.mPrefsStore.getInt(
206+
"com.peacecorps.malaria.drugRejectedCount", 0);
207+
decideDayofWeek(checkDay, mPossibledays);
208+
}
209+
210+
public void missedWeekUI() {
211+
mSharedPreferenceStore.mEditor.putInt("com.peacecorps.malaria.weeklyDose", 0).commit();
212+
mCurrentDateLabel.setTextColor(Color.RED);
213+
mCurrentDayOfweekLabel.setTextColor(Color.RED);
214+
}
215+
216+
public void decideisDrugTakenUI() {
217+
if (mSharedPreferenceStore.mPrefsStore.getBoolean("com.peacecorps.malaria.isWeekly",
218+
false)) {
219+
if (checkDrugTakenTimeInterval("weeklyDate") == 0) {
220+
if ((mSharedPreferenceStore.mPrefsStore.getBoolean(
221+
"com.peacecorps.malaria.isWeeklyDrugTaken", false))) {
222+
isDrugTakenUI();
223+
} else {
224+
newDayUI();
225+
}
226+
} else {
227+
if (checkDrugTakenTimeInterval("weeklyDate") < 7
228+
&& checkDrugTakenTimeInterval("weeklyDate") > 0) {
229+
if ((mSharedPreferenceStore.mPrefsStore.getBoolean(
230+
"com.peacecorps.malaria.isWeeklyDrugTaken", false))) {
231+
isDrugTakenUI();
232+
} else {
233+
missedWeekUI();
234+
newDayUI();
235+
}
236+
} else if (checkDrugTakenTimeInterval("weeklyDate") > 7) {
237+
SharedPreferenceStore.mEditor.putInt(
238+
"com.peacecorps.malaria.AcceptedCount", 0).commit();
239+
missedWeekUI();
240+
newDayUI();
241+
}
242+
}
243+
} else {
244+
if (checkDrugTakenTimeInterval("dateDrugTaken") == 0) {
245+
if (mSharedPreferenceStore.mPrefsStore.getBoolean(
246+
"com.peacecorps.malaria.isDrugTaken", false)) {
247+
isDrugTakenUI();
248+
} else {
249+
250+
isDrugNotTakenUI();
251+
}
252+
253+
} else {
254+
255+
if (checkDrugTakenTimeInterval("dateDrugTaken") > 1) {
256+
mSharedPreferenceStore.mEditor.putInt("com.peacecorps.malaria.dailyDose", 0);
257+
}
258+
259+
newDayUI();
260+
}
261+
}
262+
}
263+
264+
public long checkDrugTakenTimeInterval(String time) {
265+
long interval = 0;
266+
long today = new Date().getTime();
267+
long takenDate = mSharedPreferenceStore.mPrefsStore.getLong("com.peacecorps.malaria."
268+
+ time, 0);
269+
long oneDay = 1000 * 60 * 60 * 24;
270+
interval = (today - takenDate) / oneDay;
271+
return interval;
272+
}
273+
274+
public void newDayUI() {
275+
mAcceptMedicationButton
276+
.setBackgroundResource(R.drawable.accept_medi_checked_);
277+
mRejectMedicationButton
278+
.setBackgroundResource(R.drawable.reject_medi_checked);
279+
setButtonState(true);
280+
281+
}
282+
283+
public void isDrugNotTakenUI() {
284+
mAcceptMedicationButton
285+
.setBackgroundResource(R.drawable.accept_medi_grayscale);
286+
mRejectMedicationButton
287+
.setBackgroundResource(R.drawable.reject_medi_checked);
288+
setButtonState(false);
289+
}
290+
291+
public void isDrugTakenUI() {
292+
mCurrentDateLabel.setTextColor(Color.rgb(89, 43, 21));
293+
mCurrentDayOfweekLabel.setTextColor(Color.rgb(89, 43, 21));
294+
mAcceptMedicationButton
295+
.setBackgroundResource(R.drawable.accept_medi_checked_);
296+
mRejectMedicationButton
297+
.setBackgroundResource(R.drawable.reject_medi_grayscale);
298+
setButtonState(false);
299+
storeMediTimeLastChecked();
300+
301+
}
302+
303+
public void setButtonState(boolean state) {
304+
mAcceptMedicationButton.setEnabled(state);
305+
mRejectMedicationButton.setEnabled(state);
306+
}
307+
308+
public void decideDrugTakenUIBoolean(Boolean isWeekly, Boolean isTaken) {
309+
if (isWeekly) {
310+
if (checkDrugTakenTimeInterval("weeklyDate") > 1) {
311+
changeWeeklyAlarmTime();
312+
}
313+
}
314+
saveUsersettings(isTaken, isWeekly);
315+
if (isTaken) {
316+
isDrugTakenUI();
317+
} else {
318+
isDrugNotTakenUI();
319+
}
320+
}
321+
322+
public void storeMediTimeLastChecked() {
323+
CharSequence lastMedicationCheckedTime = "";
324+
Calendar c = Calendar.getInstance();
325+
lastMedicationCheckedTime = new SimpleDateFormat("dd/MM",
326+
Locale.getDefault()).format(c.getTime());
327+
328+
mSharedPreferenceStore.mEditor.putString(
329+
"com.peacecorps.malaria.checkMediLastTakenTime",
330+
lastMedicationCheckedTime.toString()).commit();
331+
}
332+
333+
public void changeWeeklyAlarmTime() {
334+
int hour = Calendar.getInstance().getTime().getHours();
335+
int minute = Calendar.getInstance().getTime().getMinutes() - 1;
336+
getActivity().startService(
337+
new Intent(getActivity(), AlarmService.class));
338+
mSharedPreferenceStore.mEditor.putInt("com.peacecorps.malaria.AlarmHour", hour)
339+
.commit();
340+
mSharedPreferenceStore.mEditor.putInt("com.peacecorps.malaria.AlarmMinute", minute)
341+
.commit();
342+
}
343+
344+
345+
public String decideDayofWeek(int checkDay, String possibleDays[]) {
346+
String currentDayOfWeek = null;
347+
switch (checkDay) {
348+
case 1:
349+
currentDayOfWeek = possibleDays[0];
350+
break;
351+
case 2:
352+
currentDayOfWeek = possibleDays[1];
353+
break;
354+
case 3:
355+
currentDayOfWeek = possibleDays[2];
356+
break;
357+
case 4:
358+
currentDayOfWeek = possibleDays[3];
359+
break;
360+
case 5:
361+
currentDayOfWeek = possibleDays[4];
362+
break;
363+
case 6:
364+
currentDayOfWeek = possibleDays[5];
365+
break;
366+
case 7:
367+
currentDayOfWeek = possibleDays[6];
368+
break;
369+
370+
}
371+
return currentDayOfWeek;
372+
}
373+
374+
375+
=======
1376
package com.peacecorps.malaria;
2377

3378
import android.content.Context;
@@ -383,4 +758,5 @@ public String decideDayofWeek(int checkDay, String possibleDays[]) {
383758
}
384759

385760

761+
>>>>>>> FETCH_HEAD
386762
}

‎src/com/peacecorps/malaria/InfoHubFragmentActivity.java

100755100644
+54
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,56 @@
1+
<<<<<<< HEAD
2+
package com.peacecorps.malaria;
3+
4+
import android.content.Intent;
5+
import android.os.Bundle;
6+
import android.support.v4.app.FragmentActivity;
7+
import android.view.View;
8+
import android.widget.Button;
9+
import com.peacecorps.malaria.R;
10+
11+
/**
12+
* Created by Chimdi on 7/18/14.
13+
*/
14+
public class InfoHubFragmentActivity extends FragmentActivity {
15+
16+
Button homeIconButton, peaceCorpsPolicy;
17+
18+
@Override
19+
public void onCreate(Bundle savedInstanceState) {
20+
super.onCreate(savedInstanceState);
21+
setContentView(R.layout.info_hub_screen);
22+
23+
24+
homeIconButton = (Button) findViewById(R.id.homeButton);
25+
peaceCorpsPolicy = (Button) findViewById(R.id.peaceCorpsPolicy);
26+
27+
addListeners();
28+
}
29+
30+
31+
public void addListeners() {
32+
homeIconButton.setOnClickListener(new View.OnClickListener() {
33+
@Override
34+
public void onClick(View v) {
35+
startActivity(new Intent(getApplication().getApplicationContext(), MainActivity.class));
36+
finish();
37+
}
38+
});
39+
40+
peaceCorpsPolicy.setOnClickListener(new View.OnClickListener() {
41+
@Override
42+
public void onClick(View v) {
43+
startActivity(new Intent(getApplication().getApplicationContext(), PeaceCorpsPolicyFragmentActivity.class));
44+
}
45+
});
46+
}
47+
48+
49+
}
50+
51+
52+
53+
=======
154
package com.peacecorps.malaria;
255

356
import android.content.Intent;
@@ -49,3 +102,4 @@ public void onClick(View v) {
49102

50103

51104

105+
>>>>>>> FETCH_HEAD

‎src/com/peacecorps/malaria/MainActivity.java

+177-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,178 @@
1+
<<<<<<< HEAD
2+
package com.peacecorps.malaria;
3+
<<<<<<< HEAD
4+
=======
5+
6+
import java.util.Date;
7+
>>>>>>> origin/malaria-setup-screen
8+
9+
import android.content.Intent;
10+
import android.os.Bundle;
11+
import android.support.v4.app.FragmentActivity;
12+
import android.support.v4.view.ViewPager;
13+
import android.support.v4.view.ViewPager.OnPageChangeListener;
14+
<<<<<<< HEAD
15+
import android.view.View;
16+
import android.widget.Button;
17+
=======
18+
import android.widget.Toast;
19+
20+
import com.peacecorps.malaria;
21+
>>>>>>> origin/malaria-setup-screen
22+
import com.viewpagerindicator.CirclePageIndicator;
23+
import com.viewpagerindicator.PageIndicator;
24+
25+
import java.util.Date;
26+
27+
public class MainActivity extends FragmentActivity {
28+
29+
<<<<<<< HEAD
30+
FragmentAdapter mAdapter;
31+
ViewPager mPager;
32+
PageIndicator mIndicator;
33+
Button mInfoButton;
34+
35+
36+
@Override
37+
public void onCreate(Bundle savedInstanceState) {
38+
super.onCreate(savedInstanceState);
39+
setContentView(R.layout.activity_main);
40+
41+
42+
mInfoButton = (Button) findViewById(R.id.infoButton);
43+
mInfoButton.setOnClickListener(new View.OnClickListener() {
44+
@Override
45+
public void onClick(View v) {
46+
startActivity(new Intent(getApplication().getApplicationContext(), InfoHubFragmentActivity.class));
47+
finish();
48+
49+
}
50+
});
51+
52+
mAdapter = new FragmentAdapter(getSupportFragmentManager());
53+
54+
mPager = (ViewPager) findViewById(R.id.vPager);
55+
mPager.setAdapter(mAdapter);
56+
57+
mIndicator = (CirclePageIndicator) findViewById(R.id.vIndicator);
58+
mIndicator.setViewPager(mPager);
59+
mIndicator.setOnPageChangeListener(new OnPageChangeListener() {
60+
61+
62+
@Override
63+
public void onPageSelected(int position) {
64+
65+
if (position == 1) {
66+
if (FirstAnalyticFragment.checkMediLastTakenTime != null) {
67+
FirstAnalyticFragment.checkMediLastTakenTime
68+
.setText(SharedPreferenceStore.mPrefsStore
69+
.getString(
70+
"com.peacecorps.malaria.checkMediLastTakenTime",
71+
"").toString());
72+
73+
int currentDose = 0;
74+
if (SharedPreferenceStore.mPrefsStore.getBoolean(
75+
"com.peacecorps.malaria.isWeekly", false)) {
76+
currentDose = SharedPreferenceStore.mPrefsStore.getInt("com.peacecorps.malaria.weeklyDose", 0);
77+
} else {
78+
currentDose = SharedPreferenceStore.mPrefsStore.getInt("com.peacecorps.malaria.dailyDose", 0);
79+
}
80+
FirstAnalyticFragment.doses.setText("" + currentDose);
81+
82+
long interval = checkDrugTakenTimeInterval("firstRunTime");
83+
int takenCount = SharedPreferenceStore.mPrefsStore.getInt("com.peacecorps.malaria.drugAcceptedCount", 0);
84+
double adherenceRate = (takenCount / interval) * 100;
85+
FirstAnalyticFragment.adherence.setText("" + adherenceRate + "%");
86+
}
87+
88+
}
89+
}
90+
91+
@Override
92+
public void onPageScrollStateChanged(int i) {
93+
94+
}
95+
96+
@Override
97+
public void onPageScrolled(int i, float v, int i2) {
98+
99+
}
100+
101+
102+
});
103+
104+
}
105+
106+
public long checkDrugTakenTimeInterval(String time) {
107+
long interval = 0;
108+
long today = new Date().getTime();
109+
long takenDate = SharedPreferenceStore.mPrefsStore.getLong("com.peacecorps.malaria."
110+
+ time, 0);
111+
long oneDay = 1000 * 60 * 60 * 24;
112+
interval = (today - takenDate) / oneDay;
113+
return interval + 1;
114+
}
115+
=======
116+
FragmentAdapter mAdapter;
117+
ViewPager mPager;
118+
PageIndicator mIndicator;
119+
120+
@Override
121+
public void onCreate(Bundle savedInstanceState) {
122+
super.onCreate(savedInstanceState);
123+
setContentView(R.layout.activity_main);
124+
125+
mAdapter = new FragmentAdapter(getSupportFragmentManager());
126+
127+
mPager = (ViewPager) findViewById(R.id.vPager);
128+
mPager.setAdapter(mAdapter);
129+
130+
mIndicator = (CirclePageIndicator) findViewById(R.id.vIndicator);
131+
mIndicator.setViewPager(mPager);
132+
mIndicator.setOnPageChangeListener(new OnPageChangeListener() {
133+
134+
@Override
135+
public void onPageSelected(int position) {
136+
137+
int checkViewPagerPosition = 1;
138+
if (position == checkViewPagerPosition) {
139+
if (FirstAnalyticFragment.checkMediLastTakenTime != null) {
140+
FirstAnalyticFragment.checkMediLastTakenTime
141+
.setText(SharedPreferenceStore.mPrefsStore
142+
.getString(
143+
"com.pc.checkMediLastTakenTime",
144+
"").toString());
145+
FirstAnalyticFragment.doses.setText(""
146+
+ SharedPreferenceStore.mPrefsStore.getInt(
147+
"com.pc.AcceptedCount", 0));
148+
149+
long interval = checkDrugTakenTimeInterval("timeCounter");
150+
int takenCount = SharedPreferenceStore.mPrefsStore.getInt("com.pc.drugAcceptedCount", 0);
151+
double percentage = (takenCount/interval)* 100;
152+
FirstAnalyticFragment.adherence.setText(""+percentage);
153+
}
154+
155+
}
156+
}
157+
158+
159+
});
160+
161+
}
162+
163+
public long checkDrugTakenTimeInterval(String time) {
164+
long interval = 0;
165+
long today = new Date().getTime();
166+
long takenDate = SharedPreferenceStore.mPrefsStore.getLong("com.pc."
167+
+ time, 0);
168+
long oneDay = 1000 * 60 * 60 * 24;
169+
interval = (today - takenDate) / oneDay;
170+
return interval+1;
171+
}
172+
>>>>>>> origin/malaria-setup-screen
173+
174+
}
175+
=======
1176
package com.peacecorps.malaria;
2177

3178
import android.content.Intent;
@@ -100,4 +275,5 @@ public long checkDrugTakenTimeInterval(String time) {
100275
return interval + 1;
101276
}
102277

103-
}
278+
}
279+
>>>>>>> FETCH_HEAD

‎src/com/peacecorps/malaria/PeaceCorpsPolicyFragmentActivity.java

100755100644
+72
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,74 @@
1+
<<<<<<< HEAD
2+
package com.peacecorps.malaria;
3+
4+
import android.os.Bundle;
5+
import android.support.v4.app.FragmentActivity;
6+
import android.widget.TextView;
7+
import android.widget.Toast;
8+
import org.apache.http.HttpEntity;
9+
import org.apache.http.HttpResponse;
10+
import org.apache.http.client.methods.HttpPost;
11+
import org.apache.http.impl.client.DefaultHttpClient;
12+
import org.apache.http.params.BasicHttpParams;
13+
14+
import java.io.BufferedReader;
15+
import java.io.InputStream;
16+
import java.io.InputStreamReader;
17+
18+
import com.peacecorps.malaria.R;
19+
20+
/**
21+
* Created by Chimdi on 7/18/14.
22+
*/
23+
public class PeaceCorpsPolicyFragmentActivity extends FragmentActivity {
24+
25+
private TextView mPeaceCorpsPolicyLabel;
26+
27+
@Override
28+
public void onCreate(Bundle savedInstanceState) {
29+
super.onCreate(savedInstanceState);
30+
31+
setContentView(R.layout.peace_corps_policy_fragment);
32+
33+
mPeaceCorpsPolicyLabel = (TextView) findViewById(R.id.peaceCorpsPolicyLabel);
34+
}
35+
36+
public void getJSONDataFromWeb() {
37+
DefaultHttpClient httpclient = new DefaultHttpClient(new BasicHttpParams());
38+
HttpPost httppost = new HttpPost("WEB LINK TO JSON FROM PEACE CORP WILL BE HERE");
39+
40+
httppost.setHeader("Content-type", "application/json");
41+
42+
InputStream inputStream = null;
43+
String result = null;
44+
try {
45+
HttpResponse response = httpclient.execute(httppost);
46+
HttpEntity entity = response.getEntity();
47+
48+
inputStream = entity.getContent();
49+
// json is UTF-8 by default
50+
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"), 8);
51+
StringBuilder sb = new StringBuilder();
52+
53+
String line = null;
54+
while ((line = reader.readLine()) != null) {
55+
sb.append(line + "\n");
56+
}
57+
result = sb.toString();
58+
mPeaceCorpsPolicyLabel.setText(result);
59+
Toast.makeText(this, "" + result, Toast.LENGTH_LONG).show();
60+
61+
} catch (Exception e) {
62+
Toast.makeText(this, "" + e.getCause(), Toast.LENGTH_LONG).show();
63+
} finally {
64+
try {
65+
if (inputStream != null) inputStream.close();
66+
} catch (Exception squish) {
67+
}
68+
}
69+
}
70+
}
71+
=======
172
package com.peacecorps.malaria;
273

374
import android.os.Bundle;
@@ -69,3 +140,4 @@ public void getJSONDataFromWeb()
69140
}
70141
}
71142
}
143+
>>>>>>> FETCH_HEAD
+106-60
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,137 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3-
android:layout_width="match_parent"
4-
android:layout_height="match_parent"
5-
android:layout_gravity="center"
6-
android:background="@drawable/background"
7-
android:orientation="vertical"
8-
android:padding="2dp" >
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
android:layout_gravity="center"
6+
android:background="@drawable/background"
7+
android:orientation="vertical"
8+
android:padding="2dp" >
99

1010
<Button
11-
android:layout_width="24dp"
12-
android:layout_height="24dp"
13-
android:layout_gravity="end"
14-
android:layout_margin="5dp"
15-
android:adjustViewBounds="true"
16-
android:background="@drawable/settings_normal"
17-
android:scaleType="fitCenter" />
11+
android:id="@+id/fragment_first_screen_settings_button"
12+
android:layout_width="24dp"
13+
android:layout_height="24dp"
14+
android:layout_gravity="end"
15+
android:layout_margin="5dp"
16+
android:adjustViewBounds="true"
17+
android:background="@drawable/settings_normal"
18+
android:scaleType="fitCenter" />
1819

1920
<LinearLayout
20-
android:layout_width="wrap_content"
21-
android:layout_height="wrap_content"
22-
android:layout_gravity="left"
23-
android:orientation="horizontal"
24-
android:padding="5dp" >
25-
26-
<ImageView
2721
android:layout_width="wrap_content"
2822
android:layout_height="wrap_content"
29-
android:adjustViewBounds="true"
30-
android:background="@drawable/medication_last_normal"
31-
android:scaleType="fitCenter" />
23+
android:layout_gravity="left"
24+
android:orientation="horizontal"
25+
android:padding="5dp" >
26+
27+
<ImageView
28+
android:layout_width="70dp"
29+
android:layout_height="60dp"
30+
android:adjustViewBounds="true"
31+
android:background="@drawable/medication_last_normal"
32+
android:scaleType="fitCenter" />
3233

3334
<TextView
34-
android:layout_width="wrap_content"
35-
android:layout_height="wrap_content"
36-
android:layout_gravity="center_vertical"
37-
android:paddingLeft="10dp"
38-
android:text="@string/first_analytic_screen_medicine_last_taken_text"
39-
android:textSize="20sp"
40-
android:textStyle="bold" />
35+
android:layout_width="wrap_content"
36+
android:layout_height="wrap_content"
37+
android:layout_gravity="center_vertical"
38+
android:paddingLeft="10dp"
39+
android:paddingRight="10dp"
40+
android:text="@string/first_analytic_screen_medicine_last_taken_text"
41+
android:textSize="13sp"
42+
android:textStyle="bold"
43+
android:textColor="@color/golden_brown"
44+
/>
45+
46+
<TextView android:layout_width="match_parent"
47+
android:layout_height="wrap_content"
48+
android:id="@+id/checkMediLastTakenTime"
49+
android:text=""
50+
android:background="@color/light_red"
51+
android:textColor="@color/white"
52+
android:textSize="20sp"
53+
android:textStyle="bold"
54+
android:layout_gravity="center_vertical"
55+
56+
/>
57+
4158
</LinearLayout>
4259

4360
<LinearLayout
44-
android:layout_width="wrap_content"
45-
android:layout_height="wrap_content"
46-
android:layout_gravity="left"
47-
android:orientation="horizontal"
48-
android:padding="5dp" >
49-
50-
<ImageView
5161
android:layout_width="wrap_content"
5262
android:layout_height="wrap_content"
53-
android:adjustViewBounds="true"
54-
android:background="@drawable/doses_missing_image_normal"
55-
android:scaleType="fitCenter" />
63+
android:layout_gravity="left"
64+
android:orientation="horizontal"
65+
android:padding="5dp" >
66+
67+
<ImageView
68+
android:layout_width="70dp"
69+
android:layout_height="60dp"
70+
android:adjustViewBounds="true"
71+
android:background="@drawable/doses_missing_image_normal"
72+
android:scaleType="fitCenter" />
5673

5774
<TextView
58-
android:layout_width="wrap_content"
75+
android:layout_width="wrap_content"
76+
android:layout_height="wrap_content"
77+
android:layout_gravity="center_vertical"
78+
android:paddingLeft="10dp"
79+
android:paddingRight="10dp"
80+
android:text="@string/first_analytic_screen_doses_missing_text"
81+
android:textSize="13sp"
82+
android:textStyle="bold"
83+
android:textColor="@color/golden_brown"
84+
/>
85+
86+
<TextView
87+
android:id="@+id/doses"
88+
android:layout_width="match_parent"
5989
android:layout_height="wrap_content"
60-
android:layout_gravity="center_vertical"
61-
android:paddingLeft="10dp"
62-
android:text="@string/first_analytic_screen_doses_missing_text"
90+
android:background="@color/light_red"
91+
android:textColor="@color/white"
6392
android:textSize="20sp"
64-
android:textStyle="bold" />
93+
android:textStyle="bold"
94+
android:layout_gravity="center_vertical"
95+
/>
96+
6597
</LinearLayout>
6698

6799
<LinearLayout
68-
android:layout_width="wrap_content"
69-
android:layout_height="wrap_content"
70-
android:layout_gravity="left"
71-
android:orientation="horizontal"
72-
android:padding="5dp" >
73-
74-
<ImageView
75100
android:layout_width="wrap_content"
76101
android:layout_height="wrap_content"
77-
android:adjustViewBounds="true"
78-
android:background="@drawable/medicine_adhere_normal"
79-
android:scaleType="fitCenter" />
102+
android:layout_gravity="left"
103+
android:orientation="horizontal"
104+
android:padding="5dp" >
105+
106+
<ImageView
107+
android:layout_width="70dp"
108+
android:layout_height="60dp"
109+
android:adjustViewBounds="true"
110+
android:background="@drawable/medicine_adhere_normal"
111+
android:scaleType="fitCenter" />
80112

81113
<TextView
82-
android:layout_width="wrap_content"
114+
android:layout_width="wrap_content"
115+
android:layout_height="wrap_content"
116+
android:layout_gravity="center_vertical"
117+
android:paddingLeft="10dp"
118+
android:paddingRight="10dp"
119+
android:text="@string/first_analytic_screen_medicine_adherence_to_medicine_text"
120+
android:textSize="13sp"
121+
android:textStyle="bold"
122+
android:textColor="@color/golden_brown"
123+
/>
124+
125+
<TextView
126+
android:id="@+id/adherence"
127+
android:layout_width="match_parent"
83128
android:layout_height="wrap_content"
84-
android:layout_gravity="center_vertical"
85-
android:paddingLeft="10dp"
86-
android:text="@string/first_analytic_screen_medicine_adherence_to_medicine_text"
129+
android:background="@color/light_red"
130+
android:textColor="@color/white"
87131
android:textSize="20sp"
88-
android:textStyle="bold" />
132+
android:textStyle="bold"
133+
android:layout_gravity="center_vertical" />
134+
89135
</LinearLayout>
90136

91137
</LinearLayout>

‎res/layout/fragment_home_screen.xml

+50-50
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,69 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3-
android:layout_width="match_parent"
4-
android:layout_height="match_parent"
5-
android:background="@drawable/background"
6-
android:orientation="vertical"
7-
android:padding="2dp" >
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
android:background="@drawable/background"
6+
android:orientation="vertical"
7+
android:padding="2dp" >
88

99
<Button
10-
android:id="@+id/fragment_home_screen_settings_button"
11-
android:layout_width="24dp"
12-
android:layout_height="24dp"
13-
android:layout_gravity="end"
14-
android:layout_margin="5dp"
15-
android:adjustViewBounds="true"
16-
android:background="@drawable/settings_normal"
17-
android:scaleType="fitCenter" />
10+
android:id="@+id/fragment_home_screen_settings_button"
11+
android:layout_width="24dp"
12+
android:layout_height="24dp"
13+
android:layout_gravity="end"
14+
android:layout_margin="5dp"
15+
android:adjustViewBounds="true"
16+
android:background="@drawable/settings_normal"
17+
android:scaleType="fitCenter" />
1818

1919
<TextView
20-
android:id="@+id/fragment_home_screen_current_day_of_week"
21-
android:layout_width="wrap_content"
22-
android:layout_height="wrap_content"
23-
android:layout_gravity="center_horizontal"
24-
android:textSize="40sp"
25-
android:textStyle="bold" />
20+
android:id="@+id/fragment_home_screen_current_day_of_week"
21+
android:layout_width="wrap_content"
22+
android:layout_height="wrap_content"
23+
android:layout_gravity="center_horizontal"
24+
android:textSize="40sp"
25+
android:textStyle="bold" />
2626

2727
<TextView
28-
android:id="@+id/fragment_home_screen_current_date"
29-
android:layout_width="wrap_content"
30-
android:layout_height="wrap_content"
31-
android:layout_gravity="end"
32-
android:layout_marginRight="30dp"
33-
android:scaleType="fitCenter"
34-
android:textSize="20sp"
35-
android:textStyle="bold" />
28+
android:id="@+id/fragment_home_screen_current_date"
29+
android:layout_width="wrap_content"
30+
android:layout_height="wrap_content"
31+
android:layout_gravity="end"
32+
android:layout_marginRight="30dp"
33+
android:scaleType="fitCenter"
34+
android:textSize="20sp"
35+
android:textStyle="bold" />
3636

3737
<ImageView
38-
android:layout_width="143dp"
39-
android:layout_height="143dp"
40-
android:layout_gravity="center_horizontal"
41-
android:adjustViewBounds="true"
42-
android:background="@drawable/drug_normal"
43-
android:scaleType="fitCenter" />
38+
android:layout_width="143dp"
39+
android:layout_height="143dp"
40+
android:layout_gravity="center_horizontal"
41+
android:adjustViewBounds="true"
42+
android:background="@drawable/drug_normal"
43+
android:scaleType="fitCenter" />
4444

4545
<LinearLayout
46-
android:layout_width="wrap_content"
47-
android:layout_height="wrap_content"
48-
android:layout_gravity="center_horizontal"
49-
android:orientation="horizontal" >
50-
51-
<Button
52-
android:id="@+id/fragment_home_screen__reject_medication_button"
5346
android:layout_width="wrap_content"
5447
android:layout_height="wrap_content"
55-
android:layout_marginRight="20dp"
56-
android:adjustViewBounds="true"
57-
android:background="@drawable/reject_medi_normal" />
48+
android:layout_gravity="center_horizontal"
49+
android:orientation="horizontal" >
5850

5951
<Button
60-
android:id="@+id/fragment_home_screen_accept_medication_button"
61-
android:layout_width="wrap_content"
62-
android:layout_height="wrap_content"
63-
android:layout_marginLeft="20dp"
64-
android:adjustViewBounds="true"
65-
android:background="@drawable/accept_medi_normal"
66-
android:scaleType="fitCenter" />
52+
android:id="@+id/fragment_home_screen__reject_medication_button"
53+
android:layout_width="70dp"
54+
android:layout_height="50dp"
55+
android:layout_marginRight="20dp"
56+
android:adjustViewBounds="true"
57+
android:background="@drawable/reject_medi_normal" />
58+
59+
<Button
60+
android:id="@+id/fragment_home_screen_accept_medication_button"
61+
android:layout_width="70dp"
62+
android:layout_height="50dp"
63+
android:layout_marginLeft="20dp"
64+
android:adjustViewBounds="true"
65+
android:background="@drawable/accept_medi_normal"
66+
android:scaleType="fitCenter" />
6767
</LinearLayout>
6868

6969
</LinearLayout>
+183-21
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,189 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3-
android:layout_width="match_parent"
4-
android:layout_height="match_parent"
5-
android:layout_gravity="center"
6-
android:background="@drawable/background"
7-
android:orientation="vertical"
8-
android:padding="2dp" >
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
android:layout_gravity="center"
6+
android:background="@drawable/background"
7+
android:orientation="vertical"
8+
android:padding="2dp" >
99

1010
<Button
11-
android:layout_width="24dp"
12-
android:layout_height="24dp"
13-
android:layout_gravity="end"
14-
android:layout_margin="5dp"
15-
android:adjustViewBounds="true"
16-
android:background="@drawable/settings_normal"
17-
android:scaleType="fitCenter" />
18-
19-
<TextView
20-
android:layout_width="wrap_content"
21-
android:layout_height="wrap_content"
22-
android:layout_gravity="center"
23-
android:background="@color/white"
24-
android:text="@string/second_analytic_screen_title"
25-
android:textStyle="bold" />
11+
android:id="@+id/fragment_second_screen_settings_button"
12+
android:layout_width="24dp"
13+
android:layout_height="24dp"
14+
android:layout_gravity="end"
15+
android:layout_margin="5dp"
16+
android:adjustViewBounds="true"
17+
android:background="@drawable/settings_normal"
18+
android:scaleType="fitCenter" />
19+
20+
21+
22+
<LinearLayout android:layout_width="fill_parent"
23+
android:layout_height="wrap_content"
24+
android:orientation="horizontal"
25+
android:layout_margin="10dp"
26+
>
27+
<TextView android:layout_width="fill_parent"
28+
android:layout_height="wrap_content"
29+
android:text="January"
30+
android:layout_weight="2"
31+
android:id="@+id/firstMonthProgressLabel"
32+
android:textStyle="bold"
33+
android:textColor="@color/golden_brown"
34+
35+
36+
/>
37+
38+
<ProgressBar android:layout_width="fill_parent"
39+
android:layout_height="wrap_content"
40+
android:progress="100"
41+
android:background="#fff"
42+
style="?android:attr/progressBarStyleHorizontal"
43+
android:layout_weight="1"
44+
android:id="@+id/firstMonthProgressBar"
45+
android:layout_marginRight="5dp"
46+
android:layout_marginLeft="5dp"
47+
48+
/>
49+
50+
<TextView android:layout_width="fill_parent"
51+
android:layout_height="wrap_content"
52+
android:text="100%"
53+
android:layout_weight="2"
54+
android:id="@+id/firstMonthProgressPercent"
55+
android:textStyle="bold"
56+
android:textColor="@color/golden_brown"
57+
/>
58+
59+
</LinearLayout>
60+
61+
<LinearLayout android:layout_width="fill_parent"
62+
android:layout_height="wrap_content"
63+
android:orientation="horizontal"
64+
android:layout_margin="10dp"
65+
>
66+
<TextView android:layout_width="fill_parent"
67+
android:layout_height="wrap_content"
68+
android:text="February"
69+
android:layout_weight="2"
70+
android:id="@+id/secondMonthProgressLabel"
71+
android:textStyle="bold"
72+
android:textColor="@color/golden_brown"
73+
74+
/>
75+
76+
<ProgressBar android:layout_width="fill_parent"
77+
android:layout_height="wrap_content"
78+
android:progress="60"
79+
android:background="#fff"
80+
style="?android:attr/progressBarStyleHorizontal"
81+
android:layout_weight="1"
82+
android:id="@+id/secondMonthProgressBar"
83+
android:layout_marginRight="5dp"
84+
android:layout_marginLeft="5dp"
85+
86+
87+
/>
88+
89+
<TextView android:layout_width="fill_parent"
90+
android:layout_height="wrap_content"
91+
android:text="60%"
92+
android:layout_weight="2"
93+
android:id="@+id/secondMonthProgressPercent"
94+
android:textStyle="bold"
95+
android:textColor="@color/golden_brown"
96+
/>
97+
98+
</LinearLayout>
99+
100+
101+
<LinearLayout android:layout_width="fill_parent"
102+
android:layout_height="wrap_content"
103+
android:orientation="horizontal"
104+
android:layout_margin="10dp"
105+
>
106+
<TextView android:layout_width="fill_parent"
107+
android:layout_height="wrap_content"
108+
android:text="March"
109+
android:layout_weight="2"
110+
android:id="@+id/thirdMonthProgressLabel"
111+
android:textStyle="bold"
112+
android:textColor="@color/golden_brown"
113+
114+
/>
115+
116+
<ProgressBar android:layout_width="fill_parent"
117+
android:layout_height="wrap_content"
118+
android:progress="80"
119+
android:background="#fff"
120+
style="?android:attr/progressBarStyleHorizontal"
121+
android:layout_weight="1"
122+
android:id="@+id/thirdMonthProgressBar"
123+
android:layout_marginRight="5dp"
124+
android:layout_marginLeft="5dp"
125+
126+
/>
127+
128+
<TextView android:layout_width="fill_parent"
129+
android:layout_height="wrap_content"
130+
android:text="80%"
131+
android:layout_weight="2"
132+
android:id="@+id/thirdMonthProgressPercent"
133+
android:textStyle="bold"
134+
android:textColor="@color/golden_brown"
135+
/>
136+
137+
</LinearLayout>
138+
139+
<LinearLayout android:layout_width="fill_parent"
140+
android:layout_height="wrap_content"
141+
android:orientation="horizontal"
142+
android:layout_margin="10dp"
143+
>
144+
<TextView android:layout_width="fill_parent"
145+
android:layout_height="wrap_content"
146+
android:text="April"
147+
android:layout_weight="2"
148+
android:id="@+id/fourthMonthProgressLabel"
149+
android:textStyle="bold"
150+
android:textColor="@color/golden_brown"
151+
152+
/>
153+
154+
<ProgressBar android:layout_width="fill_parent"
155+
android:layout_height="wrap_content"
156+
android:progress="80"
157+
android:background="#fff"
158+
style="?android:attr/progressBarStyleHorizontal"
159+
android:layout_weight="1"
160+
android:id="@+id/fourthMonthProgressBar"
161+
android:layout_marginRight="5dp"
162+
android:layout_marginLeft="5dp"
163+
164+
165+
/>
166+
167+
<TextView android:layout_width="fill_parent"
168+
android:layout_height="wrap_content"
169+
android:text="80%"
170+
android:layout_weight="2"
171+
android:id="@+id/fourthMonthProgressPercent"
172+
android:textStyle="bold"
173+
android:textColor="@color/golden_brown"
174+
/>
175+
176+
</LinearLayout>
177+
178+
179+
180+
<LinearLayout android:layout_width="match_parent"
181+
android:layout_height="wrap_content"
182+
android:orientation="vertical"
183+
android:id="@+id/graphView"
184+
>
185+
186+
</LinearLayout>
187+
26188

27189
</LinearLayout>
+91-80
Original file line numberDiff line numberDiff line change
@@ -1,116 +1,127 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3-
xmlns:tools="http://schemas.android.com/tools"
4-
android:layout_width="match_parent"
5-
android:layout_height="match_parent"
6-
android:layout_gravity="center"
7-
android:background="@drawable/background"
8-
android:orientation="vertical"
9-
tools:context=".UserMedicineSettingsFragmentActivity" >
3+
xmlns:tools="http://schemas.android.com/tools"
4+
android:layout_width="match_parent"
5+
android:layout_height="match_parent"
6+
android:layout_gravity="center"
7+
android:background="@drawable/background"
8+
android:orientation="vertical"
9+
tools:context=".UserMedicineSettingsFragmentActivity" >
1010

1111
<LinearLayout
12-
android:id="@+id/user_medicine_settings_activity_container"
13-
android:layout_width="match_parent"
14-
android:layout_height="wrap_content"
15-
android:layout_marginTop="20dp"
16-
android:gravity="center"
17-
android:orientation="vertical" >
12+
android:id="@+id/user_medicine_settings_activity_container"
13+
android:layout_width="match_parent"
14+
android:layout_height="wrap_content"
15+
android:layout_marginTop="20dp"
16+
android:gravity="center"
17+
android:orientation="vertical" >
1818

1919
<TextView
20-
android:id="@+id/user_medicine_settings_activity_setup_label"
21-
android:layout_width="wrap_content"
22-
android:layout_height="wrap_content"
23-
android:layout_gravity="center"
24-
android:layout_marginBottom="10dp"
25-
android:layout_marginTop="10dp"
26-
android:hint="@string/user_medicine_settings_activity_setup_label"
27-
android:textSize="38sp"
28-
android:textStyle="bold" />
20+
android:id="@+id/user_medicine_settings_activity_setup_label"
21+
android:layout_width="wrap_content"
22+
android:layout_height="wrap_content"
23+
android:layout_gravity="center"
24+
android:layout_marginBottom="10dp"
25+
android:layout_marginTop="10dp"
26+
android:text="@string/user_medicine_settings_activity_setup_label"
27+
android:textSize="38sp"
28+
android:textStyle="bold"
29+
android:textColor="@color/user_medicine_first_text_color"
30+
/>
2931

3032
<LinearLayout
31-
android:layout_width="wrap_content"
32-
android:layout_height="wrap_content"
33-
android:layout_gravity="center_horizontal"
34-
android:layout_marginLeft="20dp"
35-
android:layout_marginRight="20dp"
36-
android:background="@drawable/custom_line_border"
37-
android:orientation="vertical"
38-
android:paddingLeft="30dp" >
39-
40-
<LinearLayout
4133
android:layout_width="wrap_content"
4234
android:layout_height="wrap_content"
43-
android:orientation="horizontal" >
35+
android:layout_gravity="center_horizontal"
36+
android:layout_marginLeft="20dp"
37+
android:layout_marginRight="20dp"
38+
android:background="@drawable/custom_line_border"
39+
android:orientation="vertical"
40+
android:paddingLeft="30dp" >
41+
42+
<LinearLayout
43+
android:layout_width="wrap_content"
44+
android:layout_height="wrap_content"
45+
android:orientation="horizontal" >
4446

4547
<TextView
46-
android:id="@+id/user_medicine_settings_activity_drug_take_label"
47-
style="@style/UserMedicineSettingsCommonTextAppearance"
48-
android:hint="@string/user_medicine_settings_activity_drug_take_label"
49-
android:paddingTop="15dp" />
48+
android:id="@+id/user_medicine_settings_activity_drug_take_label"
49+
style="@style/UserMedicineSettingsCommonTextAppearance"
50+
android:text="@string/user_medicine_settings_activity_drug_take_label"
51+
android:paddingTop="15dp"
52+
android:textColor="@color/golden_brown"
53+
/>
5054

5155
<TextView
52-
android:layout_width="wrap_content"
53-
android:layout_height="wrap_content"
54-
android:paddingLeft="114dp" />
56+
android:layout_width="wrap_content"
57+
android:layout_height="wrap_content"
58+
android:paddingLeft="114dp" />
5559
</LinearLayout>
5660

5761
<Spinner
58-
android:id="@+id/user_medicine_settings_activity_drug_select_spinner"
59-
android:layout_width="wrap_content"
60-
android:layout_height="wrap_content"
61-
android:layout_gravity="center" />
62+
android:id="@+id/user_medicine_settings_activity_drug_select_spinner"
63+
android:layout_width="wrap_content"
64+
android:layout_height="wrap_content"
65+
android:layout_gravity="center" />
6266

6367
<TextView
64-
android:id="@+id/user_medicine_settings_activity_time_pick_label"
65-
style="@style/UserMedicineSettingsCommonTextAppearance"
66-
android:layout_marginRight="8dp"
67-
android:layout_marginTop="5dp"
68-
android:hint="@string/user_medicine_settings_activity_time_pick_label" />
68+
android:id="@+id/user_medicine_settings_activity_time_pick_label"
69+
style="@style/UserMedicineSettingsCommonTextAppearance"
70+
android:layout_marginRight="8dp"
71+
android:layout_marginTop="5dp"
72+
android:text="@string/user_medicine_settings_activity_time_pick_label"
73+
android:textColor="@color/golden_brown"
74+
/>
6975

7076
<TextView
71-
android:id="@+id/user_medicine_settings_activity_time_pick_button"
72-
style="@style/UserMedicineSettingsCommonTextAppearance"
73-
android:layout_gravity="center"
74-
android:paddingBottom="10dp"
75-
android:paddingTop="5dp"
76-
android:text="@string/user_medicine_settings_activity_time_pick_button"
77-
android:textAppearance="?android:attr/textAppearanceLarge" />
77+
android:id="@+id/user_medicine_settings_activity_time_pick_button"
78+
style="@style/UserMedicineSettingsCommonTextAppearance"
79+
android:layout_gravity="center"
80+
android:paddingBottom="10dp"
81+
android:paddingTop="5dp"
82+
android:text="@string/user_medicine_settings_activity_time_pick_button"
83+
android:textAppearance="?android:attr/textAppearanceLarge" />
7884

7985
<LinearLayout
80-
android:layout_width="wrap_content"
81-
android:layout_height="wrap_content" >
86+
android:layout_width="wrap_content"
87+
android:layout_height="wrap_content" >
8288

8389
<TextView
84-
android:id="@+id/user_medicine_settings_activity_if_forget_label"
85-
style="@style/UserMedicineSettingsCommonTextAppearance"
86-
android:hint="@string/user_medicine_settings_activity_if_forget_label"
87-
android:paddingBottom="10dp" />
90+
android:id="@+id/user_medicine_settings_activity_if_forget_label"
91+
style="@style/UserMedicineSettingsCommonTextAppearance"
92+
android:text="@string/user_medicine_settings_activity_if_forget_label"
93+
android:paddingBottom="10dp"
94+
android:textColor="@color/golden_brown"
95+
/>
8896

8997
<TextView
90-
android:layout_width="wrap_content"
91-
android:layout_height="wrap_content"
92-
android:paddingLeft="72dp" />
98+
android:layout_width="wrap_content"
99+
android:layout_height="wrap_content"
100+
android:paddingLeft="72dp" />
93101
</LinearLayout>
94102
</LinearLayout>
95103

96104
<Button
97-
android:id="@+id/user_medicine_settings_activity_done_button"
98-
style="@style/UserMedicineSettingsCommonTextAppearance"
99-
android:layout_gravity="center"
100-
android:layout_marginTop="15dp"
101-
android:hint="@string/user_medicine_settings_activity_done_button"
102-
android:paddingLeft="40dp"
103-
android:paddingRight="40dp" />
105+
android:id="@+id/user_medicine_settings_activity_done_button"
106+
style="@style/UserMedicineSettingsCommonTextAppearance"
107+
android:layout_gravity="center"
108+
android:layout_marginTop="15dp"
109+
android:text="@string/user_medicine_settings_activity_done_button"
110+
android:textColor="@color/white"
111+
android:paddingLeft="40dp"
112+
android:paddingRight="40dp"
113+
android:background="@color/golden_brown"
114+
/>
104115
</LinearLayout>
105116

106117
<ImageView
107-
android:id="@+id/user_medicine_settings_activity_pc_logo"
108-
android:layout_width="wrap_content"
109-
android:layout_height="wrap_content"
110-
android:layout_gravity="right"
111-
android:adjustViewBounds="true"
112-
android:contentDescription="@string/user_medicine_settings_activity_pc_logo"
113-
android:scaleType="fitCenter"
114-
android:src="@drawable/pc_logo" />
118+
android:id="@+id/user_medicine_settings_activity_pc_logo"
119+
android:layout_width="wrap_content"
120+
android:layout_height="wrap_content"
121+
android:layout_gravity="right"
122+
android:adjustViewBounds="true"
123+
android:contentDescription="@string/user_medicine_settings_activity_pc_logo"
124+
android:scaleType="fitCenter"
125+
android:src="@drawable/pc_logo" />
115126

116127
</LinearLayout>

‎res/layout/info_hub_screen.xml

+226
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
1+
<RelativeLayout
2+
xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
4+
android:layout_width="match_parent"
5+
android:layout_height="match_parent"
6+
android:background="@drawable/background"
7+
android:layout_gravity="center_horizontal"
8+
9+
>
10+
11+
<ScrollView android:layout_width="match_parent"
12+
android:layout_height="wrap_content"
13+
android:id="@+id/scrollSegment"
14+
15+
>
16+
<LinearLayout android:layout_width="match_parent"
17+
android:layout_height="wrap_content"
18+
android:orientation="vertical"
19+
>
20+
<LinearLayout
21+
android:id="@+id/upperLayout"
22+
android:orientation="vertical"
23+
android:gravity="center_horizontal"
24+
android:layout_alignParentTop="true"
25+
android:layout_width="match_parent"
26+
android:layout_height="wrap_content">
27+
28+
<Button
29+
android:id="@+id/info_hub_settings_button"
30+
android:layout_width="24dp"
31+
android:layout_height="24dp"
32+
android:layout_gravity="end"
33+
android:layout_margin="5dp"
34+
android:adjustViewBounds="true"
35+
36+
android:background="@drawable/settings_normal"
37+
android:scaleType="fitCenter" />
38+
39+
<LinearLayout android:layout_width="wrap_content"
40+
android:layout_height="wrap_content"
41+
android:orientation="horizontal"
42+
>
43+
<ImageView android:layout_width="wrap_content"
44+
android:layout_height="wrap_content"
45+
android:background="@drawable/peace_corps_logo_normal"
46+
/>
47+
48+
<TextView android:layout_width="wrap_content"
49+
android:layout_height="wrap_content"
50+
android:text="@string/info_hub_title_label"
51+
android:textColor="@color/golden_brown"
52+
android:textSize="25sp"
53+
android:textStyle="bold"
54+
android:layout_marginTop="10dp"
55+
android:layout_marginLeft="10dp"
56+
57+
/>
58+
59+
</LinearLayout>
60+
61+
</LinearLayout>
62+
63+
64+
<LinearLayout android:layout_width="match_parent"
65+
android:layout_height="wrap_content"
66+
android:id="@+id/firstButtonSet"
67+
android:orientation="horizontal"
68+
69+
android:layout_marginTop="5dp"
70+
71+
>
72+
<Button android:layout_width="match_parent"
73+
android:layout_height="wrap_content"
74+
android:text="@string/peace_corps_policy"
75+
android:background="@color/light_red"
76+
android:textColor="@color/white"
77+
android:layout_weight="1"
78+
android:padding="5dp"
79+
android:layout_margin="15dp"
80+
android:id="@+id/peaceCorpsPolicy"
81+
/>
82+
83+
<Button android:layout_width="match_parent"
84+
android:layout_height="wrap_content"
85+
android:text="@string/percentage_of_side_effects"
86+
android:background="@color/light_red"
87+
android:textColor="@color/white"
88+
android:layout_weight="1"
89+
android:padding="5dp"
90+
android:layout_margin="15dp"
91+
92+
/>
93+
94+
95+
96+
</LinearLayout>
97+
98+
99+
<LinearLayout android:layout_width="match_parent"
100+
android:layout_height="wrap_content"
101+
android:id="@+id/secondButtonSet"
102+
android:orientation="horizontal"
103+
android:layout_below="@+id/firstButtonSet"
104+
android:layout_marginTop="5dp"
105+
>
106+
<Button android:layout_width="match_parent"
107+
android:layout_height="wrap_content"
108+
android:text="@string/side_effects_reported_by_PCVs"
109+
android:background="@color/light_red"
110+
android:textColor="@color/white"
111+
android:layout_weight="1"
112+
android:padding="5dp"
113+
android:layout_margin="15dp"
114+
/>
115+
116+
<Button android:layout_width="match_parent"
117+
android:layout_height="wrap_content"
118+
android:text="@string/non_PCV_reported_side_effects"
119+
android:background="@color/light_red"
120+
android:textColor="@color/white"
121+
android:layout_weight="1"
122+
android:padding="5dp"
123+
android:layout_margin="15dp"
124+
125+
/>
126+
127+
128+
129+
130+
131+
</LinearLayout>
132+
133+
<LinearLayout android:layout_width="match_parent"
134+
android:layout_height="wrap_content"
135+
android:id="@+id/thirdButtonSet"
136+
android:orientation="horizontal"
137+
android:layout_below="@+id/secondButtonSet"
138+
android:layout_marginTop="5dp"
139+
>
140+
<Button android:layout_width="match_parent"
141+
android:layout_height="wrap_content"
142+
android:text="@string/volunteer_adherence_rates"
143+
android:background="@color/light_red"
144+
android:textColor="@color/white"
145+
android:layout_weight="1"
146+
android:padding="5dp"
147+
android:layout_margin="10dp"
148+
/>
149+
150+
<Button android:layout_width="match_parent"
151+
android:layout_height="wrap_content"
152+
android:text="@string/effectiveness_against_malaria"
153+
android:background="@color/light_red"
154+
android:textColor="@color/white"
155+
android:layout_weight="1"
156+
android:padding="5dp"
157+
android:layout_margin="10dp"
158+
159+
/>
160+
161+
162+
163+
164+
165+
</LinearLayout>
166+
</LinearLayout>
167+
</ScrollView>
168+
169+
170+
171+
<LinearLayout
172+
android:orientation="vertical"
173+
android:layout_alignBottom="@id/scrollSegment"
174+
android:layout_alignParentBottom="true"
175+
android:layout_width="match_parent"
176+
android:layout_height="wrap_content">
177+
178+
179+
180+
<View
181+
android:layout_height="0.5dp"
182+
android:layout_width="200dp"
183+
android:background="#000000"
184+
android:layout_gravity="center_horizontal"
185+
186+
/>
187+
188+
<LinearLayout
189+
android:orientation="horizontal"
190+
android:layout_width="wrap_content"
191+
android:layout_height="wrap_content"
192+
android:layout_gravity="center_horizontal"
193+
android:layout_marginTop="30dp"
194+
android:paddingBottom="5dp"
195+
196+
>
197+
198+
<Button
199+
android:id="@+id/homeButton"
200+
201+
android:background="@drawable/home_icon_inactive_normal"
202+
android:layout_width="30dp"
203+
android:layout_height="30dp"
204+
android:adjustViewBounds="true"
205+
android:layout_marginRight="15dp"
206+
android:scaleType="fitCenter"
207+
208+
/>
209+
210+
211+
<Button
212+
android:background="@drawable/info_hub_normal"
213+
android:id="@+id/infoButton"
214+
android:layout_width="30dp"
215+
android:layout_height="30dp"
216+
android:adjustViewBounds="true"
217+
android:layout_marginLeft="15dp"
218+
android:scaleType="fitCenter"
219+
/>
220+
221+
</LinearLayout>
222+
223+
224+
</LinearLayout>
225+
226+
</RelativeLayout>

‎res/layout/initial_screen_layout.xml

-118
This file was deleted.

‎res/layout/launch_screen_layout.xml

-34
This file was deleted.

‎res/layout/layout3.xml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
android:orientation="vertical" >
6+
7+
8+
</LinearLayout>
+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
4+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
5+
android:orientation="vertical"
6+
android:background="@drawable/background"
7+
android:layout_gravity="center_horizontal"
8+
android:layout_width="match_parent"
9+
android:padding="10dp"
10+
android:layout_height="match_parent">
11+
12+
13+
14+
15+
<TextView android:layout_width="match_parent"
16+
android:layout_height="wrap_content"
17+
android:text="Peace Corps Policy"
18+
android:textColor="@color/golden_brown"
19+
android:textSize="25sp"
20+
android:gravity="center"
21+
android:textStyle="bold"
22+
android:id="@+id/peaceCorpsPolicyLabel"
23+
24+
/>
25+
<View android:layout_width="match_parent"
26+
android:layout_height="0.2dp"
27+
android:background="@color/black"/>
28+
29+
<ScrollView
30+
android:layout_width="match_parent"
31+
android:layout_height="wrap_content">
32+
<LinearLayout android:layout_width="match_parent"
33+
android:layout_height="wrap_content"
34+
android:orientation="vertical"
35+
>
36+
37+
38+
<TextView android:layout_width="match_parent"
39+
android:padding="5dp"
40+
android:text="@string/dump_test"
41+
android:textColor="@color/black"
42+
android:layout_height="wrap_content"/>
43+
</LinearLayout>
44+
</ScrollView>
45+
</LinearLayout>

‎res/values/color.xml

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
3-
<color name="white">#FFFFFF</color>
4-
<color name="view_pager_indicator_text_color">#2FB3E3</color>
3+
<color name="white">#FFF</color>
4+
<color name="golden_brown">#664a3a</color>
5+
<color name="light_red">#da6767</color>
6+
7+
8+
<color name="view_pager_indicator_text_color">#2FB3E3</color>
59
<color name="black">#000000</color>
610
<color name="user_medicine_first_text_color">#592b15</color>
11+
712
<color name="user_medicine_second_text_color">#664a3a</color>
813

14+
915
</resources>

‎res/values/strings.xml

+42-1
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,59 @@
1111
<string name="user_medicine_settings_activity_if_forget_label">If I forget</string>
1212
<string name="user_medicine_settings_activity_done_button">DONE</string>
1313
<string name="second_analytic_screen_title">SECOND ANALYTIC SCREEN</string>
14-
<string name="first_analytic_screen_doses_missing_text">Doses Missing since Last Check in</string>
14+
<string name="first_analytic_screen_doses_missing_text">Doses in a Row</string>
1515
<string name="first_analytic_screen_medicine_last_taken_text">Medicine Last Taken</string>
1616
<string name="first_analytic_screen_medicine_adherence_to_medicine_text">Adherence to Medicine</string>
1717
<string name="alarm_auto_start_boot_completed_intent_check">android.intent.action.BOOT_COMPLETED</string>
1818
<string name="alert_dialog_title">Malaria medication reminder</string>
1919
<string name="alert_dialog_message">Have you taken your drug today ?</string>
2020
<string name="user_medicine_settings_fragment_activity_title">PC Malaria Prevention</string>
21+
<string name="info_hub_title_label">info Hub</string>
22+
<string name="peace_corps_policy">Peace Corps Policy</string>
23+
<string name="percentage_of_side_effects">Percentage of Side Effects</string>
24+
<string name="side_effects_reported_by_PCVs">Side Effects Reported by PCVs</string>
25+
<string name="effectiveness_against_malaria">Effectiveness Against Malaria</string>
26+
<string name="volunteer_adherence_rates">Volunteer Adherence Rates</string>
27+
<string name="non_PCV_reported_side_effects">Non-PCV Reported Side Effects</string>
28+
29+
30+
<string name="dump_test">Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem
31+
Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem IpsumLorem Ipsum Lorem Ipsum
32+
Lorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem Ipsum
33+
Lorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem Ipsum
34+
Lorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem Ipsum
35+
Lorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem Ipsum
36+
Lorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem Ipsum
37+
Lorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem Ipsum
38+
Lorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem Ipsum
39+
Lorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem Ipsum
40+
Lorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem Ipsum
41+
Lorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem Ipsum
42+
Lorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem Ipsum
43+
Lorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem IpsumLorem Ipsum Lorem Ipsum
44+
45+
</string>
46+
2147

2248
<string-array name="user_medicine_settings_activity_drug_array">
2349
<item>Malarone (Daily)</item>
2450
<item>Doxycycline (Daily)</item>
2551
<item>Mefloquine (Weekly)</item>
2652
</string-array>
2753

54+
<string-array name="month">
55+
<item>January</item>
56+
<item>February</item>
57+
<item>March</item>
58+
<item>April</item>
59+
<item>May</item>
60+
<item>June</item>
61+
<item>July</item>
62+
<item>August</item>
63+
<item>September</item>
64+
<item>October</item>
65+
<item>November</item>
66+
<item>December</item>
67+
</string-array>
68+
2869
</resources>

‎src/com/peacecorps/malaria/AlarmAutoStart.java

+21
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
<<<<<<< HEAD
2+
package com.peacecorps.malaria;
3+
4+
import android.content.BroadcastReceiver;
5+
import android.content.Context;
6+
import android.content.Intent;
7+
import com.peacecorps.malaria.R;
8+
9+
public class AlarmAutoStart extends BroadcastReceiver {
10+
11+
@Override
12+
public void onReceive(Context context, Intent intent) {
13+
14+
if (intent.getAction().equals(R.string.alarm_auto_start_boot_completed_intent_check)) {
15+
context.startService(new Intent(context, AlarmService.class));
16+
}
17+
}
18+
19+
}
20+
=======
121
package com.peacecorps.malaria;
222

323
import android.content.BroadcastReceiver;
@@ -16,3 +36,4 @@ public void onReceive(Context context, Intent intent) {
1636
}
1737

1838
}
39+
>>>>>>> FETCH_HEAD

‎src/com/peacecorps/malaria/AlarmHandlerClass.java

+93
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,95 @@
1+
<<<<<<< HEAD
2+
package com.peacecorps.malaria;
3+
4+
import java.util.Calendar;
5+
import java.util.Date;
6+
7+
import android.app.AlarmManager;
8+
import android.app.PendingIntent;
9+
import android.content.BroadcastReceiver;
10+
import android.content.Context;
11+
import android.content.Intent;
12+
import android.os.PowerManager;
13+
14+
public class AlarmHandlerClass extends BroadcastReceiver {
15+
16+
public static Calendar mAlarmScheduleTime;
17+
final int INTERVAL_WEEK = 604800000;
18+
public static AlarmManager mAlarmManager;
19+
20+
static SharedPreferenceStore mSharedPreferenceStore;
21+
22+
@Override
23+
public void onReceive(Context context, Intent intent) {
24+
PowerManager powerManager = (PowerManager) context
25+
.getSystemService(Context.POWER_SERVICE);
26+
PowerManager.WakeLock wakeLock = powerManager.newWakeLock(
27+
PowerManager.PARTIAL_WAKE_LOCK, "");
28+
wakeLock.acquire();
29+
30+
/** Opening the Alert Dialog Window */
31+
32+
intent = new Intent(context, AlertCallerFragmentActivity.class);
33+
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
34+
context.startActivity(intent);
35+
wakeLock.release();
36+
}
37+
38+
public void getSharedPreferences(Context context) {
39+
mSharedPreferenceStore.mPrefsStore = context.getSharedPreferences(
40+
"com.peacecorps.malaria.storeTimePicked", Context.MODE_PRIVATE);
41+
mSharedPreferenceStore.mEditor = mSharedPreferenceStore.mPrefsStore
42+
.edit();
43+
}
44+
45+
public void setAlarm(Context context) {
46+
47+
getSharedPreferences(context);
48+
int hour = mSharedPreferenceStore.mPrefsStore.getInt(
49+
"com.peacecorps.malaria.AlarmHour", -1);
50+
int minute = mSharedPreferenceStore.mPrefsStore.getInt(
51+
"com.peacecorps.malaria.AlarmMinute", -1);
52+
if ((hour != -1) && (minute != -1)) {
53+
AlarmTime(context, hour, minute);
54+
mAlarmManager = (AlarmManager) context
55+
.getSystemService(Context.ALARM_SERVICE);
56+
Intent alarmIntent = new Intent(
57+
"com.peacecorps.malaria.START_ALARM");
58+
PendingIntent pendingAlarm = PendingIntent.getBroadcast(context, 0,
59+
alarmIntent, Intent.FLAG_ACTIVITY_NEW_TASK);
60+
if (mSharedPreferenceStore.mPrefsStore.getBoolean(
61+
"com.peacecorps.malaria.isWeekly", false)) {
62+
mAlarmManager.setRepeating(AlarmManager.RTC_WAKEUP,
63+
mAlarmScheduleTime.getTimeInMillis(), INTERVAL_WEEK,
64+
pendingAlarm);
65+
} else {
66+
mAlarmManager.setRepeating(AlarmManager.RTC_WAKEUP,
67+
mAlarmScheduleTime.getTimeInMillis(),
68+
AlarmManager.INTERVAL_DAY, pendingAlarm);
69+
}
70+
}
71+
72+
}
73+
74+
public void AlarmTime(Context context, int hour, int minute) {
75+
76+
Date date = new Date();
77+
mAlarmScheduleTime = Calendar.getInstance();
78+
mAlarmScheduleTime.setTime(date);
79+
80+
Calendar dateNow = Calendar.getInstance();
81+
dateNow.setTime(date);
82+
83+
mAlarmScheduleTime.set(Calendar.HOUR_OF_DAY, hour);
84+
mAlarmScheduleTime.set(Calendar.MINUTE, minute);
85+
86+
if (mAlarmScheduleTime.before(dateNow)) {
87+
mAlarmScheduleTime.add(Calendar.DATE, 1);
88+
}
89+
90+
}
91+
}
92+
=======
193
package com.peacecorps.malaria;
294

395
import java.util.Calendar;
@@ -88,3 +180,4 @@ public void AlarmTime(Context context, int hour, int minute) {
88180

89181
}
90182
}
183+
>>>>>>> FETCH_HEAD

‎src/com/peacecorps/malaria/AlarmService.java

+38
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,40 @@
1+
<<<<<<< HEAD
2+
package com.peacecorps.malaria;
3+
4+
import android.app.Service;
5+
import android.content.Intent;
6+
import android.os.IBinder;
7+
8+
public class AlarmService extends Service {
9+
10+
AlarmHandlerClass alarmHandlerClass = new AlarmHandlerClass();
11+
12+
@Override
13+
public IBinder onBind(Intent intent) {
14+
15+
return null;
16+
}
17+
18+
public void onStart(Intent intent, int startId) {
19+
20+
alarmHandlerClass.setAlarm(AlarmService.this);
21+
}
22+
23+
@Override
24+
public void onCreate() {
25+
26+
super.onCreate();
27+
}
28+
29+
@Override
30+
public int onStartCommand(Intent intent, int flags, int startId) {
31+
32+
alarmHandlerClass.setAlarm(AlarmService.this);
33+
return START_STICKY;
34+
}
35+
36+
}
37+
=======
138
package com.peacecorps.malaria;
239

340
import android.app.Service;
@@ -33,3 +70,4 @@ public int onStartCommand(Intent intent, int flags, int startId) {
3370
}
3471

3572
}
73+
>>>>>>> FETCH_HEAD

‎src/com/peacecorps/malaria/AlertCallerFragmentActivity.java

+70
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,72 @@
1+
<<<<<<< HEAD
2+
package com.peacecorps.malaria;
3+
4+
import java.util.Date;
5+
6+
import android.content.Context;
7+
import android.os.Bundle;
8+
import android.support.v4.app.FragmentActivity;
9+
10+
public class AlertCallerFragmentActivity extends FragmentActivity {
11+
static SharedPreferenceStore mSharedPreferenceStore;
12+
13+
@Override
14+
protected void onCreate(Bundle savedInstanceState) {
15+
super.onCreate(savedInstanceState);
16+
17+
/** Creating an Alert Dialog Window */
18+
runOnUiThread(new Runnable() {
19+
20+
@Override
21+
public void run() {
22+
23+
String weeklyDate = "weeklyDate";
24+
getSharedPreferences();
25+
if (mSharedPreferenceStore.mPrefsStore.getBoolean(
26+
"com.peacecorps.malaria.isWeekly", false)) {
27+
28+
if (checkDrugTakenTimeInterval(weeklyDate) == 0
29+
|| checkDrugTakenTimeInterval(weeklyDate) >= 7) {
30+
callAlarm();
31+
} else {
32+
finish();
33+
}
34+
} else {
35+
callAlarm();
36+
}
37+
}
38+
});
39+
40+
}
41+
42+
public void callAlarm() {
43+
AlertDialogFragment alert = new AlertDialogFragment();
44+
45+
alert.show(getSupportFragmentManager(), "alertDemo");
46+
47+
alert.setCancelable(false);
48+
}
49+
50+
public long checkDrugTakenTimeInterval(String time) {
51+
long interval = 0;
52+
long today = new Date().getTime();
53+
long takenDate = mSharedPreferenceStore.mPrefsStore.getLong("com.peacecorps.malaria."
54+
+ time, 0);
55+
long oneDay = 1000 * 60 * 60 * 24;
56+
interval = (today - takenDate) / oneDay;
57+
return interval;
58+
}
59+
60+
public void getSharedPreferences() {
61+
// reading the application SharedPreferences for storing of time and
62+
// drug selected
63+
mSharedPreferenceStore.mPrefsStore = getSharedPreferences(
64+
"com.peacecorps.malaria.storeTimePicked", Context.MODE_PRIVATE);
65+
mSharedPreferenceStore.mEditor = mSharedPreferenceStore.mPrefsStore
66+
.edit();
67+
}
68+
}
69+
=======
170
package com.peacecorps.malaria;
271

372
import java.util.Date;
@@ -65,3 +134,4 @@ public void getSharedPreferences() {
65134
.edit();
66135
}
67136
}
137+
>>>>>>> FETCH_HEAD

‎src/com/peacecorps/malaria/AlertDialogFragment.java

+188
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,190 @@
1+
<<<<<<< HEAD
2+
package com.peacecorps.malaria;
3+
4+
import java.util.Calendar;
5+
import java.util.Date;
6+
7+
import android.app.AlarmManager;
8+
import android.app.AlertDialog;
9+
import android.app.Dialog;
10+
import android.app.PendingIntent;
11+
import android.content.Context;
12+
import android.content.DialogInterface;
13+
import android.content.DialogInterface.OnClickListener;
14+
import android.content.Intent;
15+
import android.os.Bundle;
16+
import android.support.v4.app.DialogFragment;
17+
import android.view.WindowManager.LayoutParams;
18+
19+
20+
public class AlertDialogFragment extends DialogFragment {
21+
22+
private static int mDrugAcceptedCount;
23+
private static int mDrugRejectedCount;
24+
static SharedPreferenceStore mSharedPreferenceStore;
25+
26+
@Override
27+
public Dialog onCreateDialog(Bundle savedInstanceState) {
28+
29+
/**
30+
* Turn Screen On and Unlock the keypad when this alert dialog is
31+
* displayed
32+
*/
33+
getActivity().getWindow().addFlags(
34+
LayoutParams.FLAG_TURN_SCREEN_ON
35+
| LayoutParams.FLAG_DISMISS_KEYGUARD);
36+
37+
/** Creating a alert dialog builder */
38+
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
39+
40+
/** Setting title for the alert dialog */
41+
42+
builder.setTitle(R.string.alert_dialog_title);
43+
44+
/** Setting the content for the alert dialog */
45+
builder.setMessage(R.string.alert_dialog_message);
46+
47+
/** Defining an OK button event listener */
48+
builder.setPositiveButton("Taken", new OnClickListener() {
49+
@Override
50+
public void onClick(DialogInterface dialog, int which) {
51+
getActivity().runOnUiThread(new Runnable() {
52+
53+
@Override
54+
public void run() {
55+
getSharedPreferences();
56+
getSettings();
57+
if (mSharedPreferenceStore.mPrefsStore.getBoolean(
58+
"com.pc.isWeekly", false)) {
59+
saveUsersettings(true, true);
60+
changeWeeklyAlarmTime();
61+
} else {
62+
if (checkDrugTakenTimeInterval("dateDrugTaken") > 0) {
63+
saveUsersettings(true, false);
64+
}
65+
}
66+
getActivity().finish();
67+
}
68+
});
69+
70+
}
71+
}).setNegativeButton("Not Taken", new OnClickListener() {
72+
73+
@Override
74+
public void onClick(DialogInterface dialog, int which) {
75+
getActivity().runOnUiThread(new Runnable() {
76+
77+
@Override
78+
public void run() {
79+
getSharedPreferences();
80+
getActivity().finish();
81+
}
82+
});
83+
84+
}
85+
}).setNeutralButton("Snooze", new OnClickListener() {
86+
87+
@Override
88+
public void onClick(DialogInterface dialog, int which) {
89+
snooze();
90+
91+
}
92+
}).setCancelable(false);
93+
94+
/** Creating the alert dialog window */
95+
return builder.create();
96+
}
97+
98+
public long checkDrugTakenTimeInterval(String time) {
99+
long interval = 0;
100+
long today = new Date().getTime();
101+
long takenDate = mSharedPreferenceStore.mPrefsStore.getLong("com.pc."
102+
+ time, 0);
103+
long oneDay = 1000 * 60 * 60 * 24;
104+
interval = (today - takenDate) / oneDay;
105+
return interval;
106+
}
107+
108+
public void snooze() {
109+
getActivity().runOnUiThread(new Runnable() {
110+
111+
@Override
112+
public void run() {
113+
getSharedPreferences();
114+
Intent intent = new Intent(getActivity(),
115+
AlertCallerFragmentActivity.class);
116+
PendingIntent pendingSnooze = PendingIntent.getActivity(
117+
getActivity().getApplicationContext(), 0, intent,
118+
PendingIntent.FLAG_UPDATE_CURRENT);
119+
AlarmManager alarmManager = (AlarmManager) getActivity()
120+
.getSystemService(getActivity().ALARM_SERVICE);
121+
Calendar calender = Calendar.getInstance();
122+
Date date = new Date();
123+
calender.setTime(date);
124+
calender.add(Calendar.MINUTE, 30);
125+
alarmManager.set(AlarmManager.RTC_WAKEUP,
126+
calender.getTimeInMillis(), pendingSnooze);
127+
}
128+
});
129+
}
130+
131+
public void changeWeeklyAlarmTime() {
132+
int hour = Calendar.getInstance().getTime().getHours();
133+
int minute = Calendar.getInstance().getTime().getMinutes() - 1;
134+
getActivity().startService(
135+
new Intent(getActivity(), AlarmService.class));
136+
mSharedPreferenceStore.mEditor.putInt("com.pc.AlarmHour", hour)
137+
.commit();
138+
mSharedPreferenceStore.mEditor.putInt("com.pc.AlarmMinute", minute)
139+
.commit();
140+
}
141+
142+
public void saveUsersettings(Boolean state, Boolean isWeekly) {
143+
if (isWeekly) {
144+
mSharedPreferenceStore.mEditor.putLong("com.pc.weeklyDate",
145+
new Date().getTime()).commit();
146+
mSharedPreferenceStore.mEditor.putBoolean(
147+
"com.pc.isWeeklyDrugTaken", state).commit();
148+
} else {
149+
mSharedPreferenceStore.mEditor.putLong("com.pc.dateDrugTaken",
150+
new Date().getTime()).commit();
151+
mSharedPreferenceStore.mEditor.putBoolean("com.pc.isDrugTaken",
152+
state).commit();
153+
}
154+
mSharedPreferenceStore.mEditor.putInt("com.pc.drugRejectedCount",
155+
mDrugRejectedCount).commit();
156+
mSharedPreferenceStore.mEditor.putInt("com.pc.drugAcceptedCount",
157+
mDrugAcceptedCount).commit();
158+
159+
}
160+
161+
public void getSettings() {
162+
mDrugAcceptedCount = mSharedPreferenceStore.mPrefsStore.getInt(
163+
"com.pc.drugAcceptedCount", 0);
164+
mDrugRejectedCount = mSharedPreferenceStore.mPrefsStore.getInt(
165+
"com.pc.drugRejectedCount", 0);
166+
}
167+
168+
public void getSharedPreferences() {
169+
170+
mSharedPreferenceStore.mPrefsStore = getActivity()
171+
.getSharedPreferences("com.pc.storeTimePicked",
172+
Context.MODE_PRIVATE);
173+
mSharedPreferenceStore.mEditor = mSharedPreferenceStore.mPrefsStore
174+
.edit();
175+
}
176+
177+
/**
178+
* The application exits, if the user presses the back button
179+
*/
180+
@Override
181+
public void onDestroy() {
182+
super.onDestroy();
183+
getActivity().finish();
184+
}
185+
186+
}
187+
=======
1188
package com.peacecorps.malaria;
2189

3190
import java.util.Calendar;
@@ -181,3 +368,4 @@ public void onDestroy() {
181368
}
182369

183370
}
371+
>>>>>>> FETCH_HEAD

‎src/com/peacecorps/malaria/DatabaseSQLiteHelper.java

100755100644
+85
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,87 @@
1+
<<<<<<< HEAD
2+
package com.peacecorps.malaria;
3+
4+
import android.content.ContentValues;
5+
import android.content.Context;
6+
import android.database.Cursor;
7+
import android.database.sqlite.SQLiteDatabase;
8+
import android.database.sqlite.SQLiteOpenHelper;
9+
10+
import java.util.ArrayList;
11+
import java.util.Calendar;
12+
import java.util.Date;
13+
14+
/**
15+
* Created by Chimdi on 7/18/14.
16+
*/
17+
public class DatabaseSQLiteHelper extends SQLiteOpenHelper {
18+
19+
private static final String DATABASE_NAME = "MalariaDatabase";
20+
private static final String userMedicationChoiceTable = "userSettings";
21+
22+
public DatabaseSQLiteHelper(Context context) {
23+
super(context, DATABASE_NAME, null, 1);
24+
}
25+
26+
@Override
27+
public void onCreate(SQLiteDatabase database) {
28+
database.execSQL("CREATE TABLE " + userMedicationChoiceTable + " (_id INTEGER PRIMARY KEY AUTOINCREMENT, Drug INTEGER,Choice VARCHAR, Month VARCHAR, Year VARCHAR,Status VARCHAR,Date INTEGER,Percentage DOUBLE);");
29+
}
30+
31+
@Override
32+
public void onUpgrade(SQLiteDatabase database, int oldVersion, int newVersion) {
33+
}
34+
35+
public static ArrayList<Double> percentage;
36+
public static ArrayList<Integer> date;
37+
38+
public int getData(int month, int year, String choice) {
39+
40+
percentage = new ArrayList<Double>();
41+
date = new ArrayList<Integer>();
42+
int count = 0;
43+
SQLiteDatabase sqLiteDatabase = getWritableDatabase();
44+
String column[] = {"_id", "Date", "Percentage"};
45+
String args[] = {"" + month, "" + year, "yes", choice};
46+
Cursor cursor = sqLiteDatabase.query(userMedicationChoiceTable, column, "Month =? AND Year =? AND Status =? AND Choice =?", args, null, null, null, null);
47+
boolean isDataFound = false;
48+
while (cursor.moveToNext()) {
49+
isDataFound = true;
50+
count += 1;
51+
date.add(cursor.getInt(1));
52+
percentage.add(cursor.getDouble(2));
53+
54+
}
55+
if (isDataFound) {
56+
if (!(date.get(date.size() - 1) == Calendar.getInstance().getTime().getDate())) {
57+
percentage.add(0.0);
58+
date.add(Calendar.getInstance().getTime().getDate());
59+
}
60+
}
61+
return count;
62+
}
63+
64+
public void getUserMedicationSelection(Context context, String choice, Date date, String status, Double percentage) {
65+
ContentValues values = new ContentValues(2);
66+
67+
values.put("Drug", SharedPreferenceStore.mPrefsStore.getInt("com.peacecorps.malaria.drug", 0));
68+
values.put("Choice", choice);
69+
values.put("Month", "" + date.getMonth());
70+
values.put("Year", "" + date.getYear());
71+
values.put("Status", status);
72+
values.put("Date", date.getDate());
73+
values.put("Percentage", percentage);
74+
75+
this.getWritableDatabase().insert(userMedicationChoiceTable, "medication", values);
76+
77+
78+
}
79+
80+
public Cursor getMedicationData() {
81+
return null;
82+
}
83+
}
84+
=======
185
package com.peacecorps.malaria;
286

387
import android.content.ContentValues;
@@ -85,3 +169,4 @@ public Cursor getMedicationData() {
85169
return null;
86170
}
87171
}
172+
>>>>>>> FETCH_HEAD

‎src/com/peacecorps/malaria/FirstAnalyticFragment.java

+76
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,78 @@
1+
<<<<<<< HEAD
2+
package com.peacecorps.malaria;
3+
4+
import android.content.Context;
5+
import android.content.Intent;
6+
import android.os.Bundle;
7+
import android.support.v4.app.Fragment;
8+
import android.view.LayoutInflater;
9+
import android.view.View;
10+
import android.view.ViewGroup;
11+
import android.widget.Button;
12+
import android.widget.TextView;
13+
import com.peacecorps.malaria.R;
14+
15+
16+
public class FirstAnalyticFragment extends Fragment {
17+
18+
19+
static SharedPreferenceStore mSharedPreferenceStore;
20+
static View rootView;
21+
public static TextView checkMediLastTakenTime = null;
22+
public static TextView doses = null;
23+
public static TextView adherence = null;
24+
private Button mSettingsButton;
25+
26+
public View onCreateView(LayoutInflater inflater, ViewGroup container,
27+
Bundle savedInstanceState) {
28+
rootView = inflater
29+
.inflate(R.layout.fragment_first_analytic_screen, null);
30+
31+
32+
mSettingsButton = (Button) rootView.findViewById(R.id.fragment_first_screen_settings_button);
33+
checkMediLastTakenTime = (TextView) rootView.findViewById(R.id.checkMediLastTakenTime);
34+
doses = (TextView) rootView.findViewById(R.id.doses);
35+
adherence = (TextView) rootView.findViewById(R.id.adherence);
36+
37+
if (checkMediLastTakenTime != null) {
38+
checkMediLastTakenTime.setText(mSharedPreferenceStore.mPrefsStore.getString("com.peacecorps.malaria.checkMediLastTakenTime", "").toString());
39+
doses.setText("" + mSharedPreferenceStore.mPrefsStore.getInt("com.peacecorps.malaria.acceptedCount", 0));
40+
}
41+
42+
43+
getSharedPreferences();
44+
addButtonListeners();
45+
46+
return rootView;
47+
48+
}
49+
50+
public void addButtonListeners() {
51+
mSettingsButton.setOnClickListener(new View.OnClickListener() {
52+
53+
@Override
54+
public void onClick(View v) {
55+
56+
mSharedPreferenceStore.mEditor.putBoolean(
57+
"com.peacecorps.malaria.hasUserSetPreference", false).commit();
58+
startActivity(new Intent(getActivity(),
59+
UserMedicineSettingsFragmentActivity.class));
60+
getActivity().finish();
61+
62+
}
63+
});
64+
}
65+
66+
public void getSharedPreferences() {
67+
68+
mSharedPreferenceStore.mPrefsStore = getActivity()
69+
.getSharedPreferences("com.peacecorps.malaria.storeTimePicked",
70+
Context.MODE_PRIVATE);
71+
mSharedPreferenceStore.mEditor = mSharedPreferenceStore.mPrefsStore
72+
.edit();
73+
}
74+
75+
=======
176
package com.peacecorps.malaria;
277

378
import android.content.Context;
@@ -74,4 +149,5 @@ public void getSharedPreferences() {
74149
.edit();
75150
}
76151

152+
>>>>>>> FETCH_HEAD
77153
}

‎src/com/peacecorps/malaria/FragmentAdapter.java

+52
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,54 @@
1+
<<<<<<< HEAD
2+
package com.peacecorps.malaria;
3+
4+
import com.viewpagerindicator.IconPagerAdapter;
5+
6+
import android.support.v4.app.Fragment;
7+
import android.support.v4.app.FragmentManager;
8+
import android.support.v4.app.FragmentStatePagerAdapter;
9+
10+
public class FragmentAdapter extends FragmentStatePagerAdapter implements
11+
IconPagerAdapter {
12+
13+
public FragmentAdapter(FragmentManager fm) {
14+
super(fm);
15+
16+
}
17+
18+
@Override
19+
public int getIconResId(int index) {
20+
21+
return 0;
22+
}
23+
24+
@Override
25+
public Fragment getItem(int position) {
26+
27+
Fragment fragment = new HomeScreenFragment();
28+
switch (position) {
29+
case 0:
30+
fragment = new HomeScreenFragment();
31+
break;
32+
case 1:
33+
fragment = new FirstAnalyticFragment();
34+
break;
35+
36+
case 2:
37+
fragment = new SecondAnalyticFragment();
38+
break;
39+
40+
}
41+
return fragment;
42+
}
43+
44+
@Override
45+
public int getCount() {
46+
47+
return 3;
48+
}
49+
50+
51+
=======
152
package com.peacecorps.malaria;
253

354
import com.viewpagerindicator.IconPagerAdapter;
@@ -48,4 +99,5 @@ public int getCount() {
4899

49100

50101

102+
>>>>>>> FETCH_HEAD
51103
}

‎src/com/peacecorps/malaria/HomeScreenFragment.java

+376
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,378 @@
1+
<<<<<<< HEAD
2+
package com.peacecorps.malaria;
3+
4+
import android.content.Context;
5+
import android.content.Intent;
6+
import android.graphics.Color;
7+
import android.media.MediaPlayer;
8+
import android.os.Bundle;
9+
import android.support.v4.app.Fragment;
10+
import android.view.LayoutInflater;
11+
import android.view.View;
12+
import android.view.ViewGroup;
13+
import android.widget.Button;
14+
import android.widget.TextView;
15+
16+
import java.text.SimpleDateFormat;
17+
import java.util.Calendar;
18+
import java.util.Date;
19+
import java.util.Locale;
20+
21+
public class HomeScreenFragment extends Fragment {
22+
23+
static final private int INIT_HOUR = 5;
24+
static final private int INIT_MINUTE = 30;
25+
26+
private Button mAcceptMedicationButton;
27+
private Button mRejectMedicationButton;
28+
private Button mSettingsButton;
29+
private TextView mCurrentDateLabel;
30+
private TextView mCurrentDayOfweekLabel;
31+
private static CharSequence mGetCurrentDate;
32+
private static int mDrugAcceptedCount;
33+
private static int drugRejectedCount;
34+
private Calendar mCalendar;
35+
private String[] mPossibledays = {"Sunday", "Monday", "Tuesday",
36+
"Wednesday", "Thursday", "Friday", "Saturday"};
37+
private static View rootView;
38+
39+
int checkDay = -1;
40+
41+
static SharedPreferenceStore mSharedPreferenceStore;
42+
43+
44+
@Override
45+
public void onResume() {
46+
47+
super.onResume();
48+
updateUI();
49+
50+
}
51+
52+
public void getSharedPreferences() {
53+
54+
mSharedPreferenceStore.mPrefsStore = getActivity()
55+
.getSharedPreferences("com.peacecorps.malaria.storeTimePicked",
56+
Context.MODE_PRIVATE);
57+
mSharedPreferenceStore.mEditor = mSharedPreferenceStore.mPrefsStore
58+
.edit();
59+
}
60+
61+
public View onCreateView(LayoutInflater inflater, ViewGroup container,
62+
Bundle savedInstanceState) {
63+
rootView = inflater.inflate(R.layout.fragment_home_screen, null);
64+
65+
updateUI();
66+
return rootView;
67+
68+
}
69+
70+
public double computeAdherenceRate() {
71+
long interval = checkDrugTakenTimeInterval("firstRunTime") + 1;
72+
int takenCount = SharedPreferenceStore.mPrefsStore.getInt("com.peacecorps.malaria.drugAcceptedCount", 0);
73+
double adherenceRate = (takenCount / interval) * 100;
74+
return adherenceRate;
75+
}
76+
77+
public void addButtonListeners() {
78+
mSettingsButton.setOnClickListener(new View.OnClickListener() {
79+
80+
@Override
81+
public void onClick(View v) {
82+
83+
mSharedPreferenceStore.mEditor.putBoolean(
84+
"com.peacecorps.malaria.hasUserSetPreference", false).commit();
85+
startActivity(new Intent(getActivity(),
86+
UserMedicineSettingsFragmentActivity.class));
87+
getActivity().finish();
88+
89+
}
90+
});
91+
92+
mAcceptMedicationButton.setOnClickListener(new View.OnClickListener() {
93+
94+
@Override
95+
public void onClick(View v) {
96+
MediaPlayer.create(getActivity(), R.raw.accept_button_sound)
97+
.start();
98+
mDrugAcceptedCount += 1;
99+
int value = SharedPreferenceStore.mPrefsStore.getInt(
100+
"com.peacecorps.malaria.AcceptedCount", 0) + 1;
101+
SharedPreferenceStore.mEditor.putInt("com.peacecorps.malaria.AcceptedCount",
102+
value).commit();
103+
if (mSharedPreferenceStore.mPrefsStore.getBoolean(
104+
"com.peacecorps.malaria.isWeekly", false)) {
105+
int currentDose = SharedPreferenceStore.mPrefsStore.getInt("com.peacecorps.malaria.weeklyDose", 0) + 1;
106+
mSharedPreferenceStore.mEditor.putInt("com.peacecorps.malaria.weeklyDose", currentDose).commit();
107+
decideDrugTakenUIBoolean(true, true);
108+
DatabaseSQLiteHelper databaseSQLiteHelper = new DatabaseSQLiteHelper(getActivity());
109+
databaseSQLiteHelper.getUserMedicationSelection(getActivity(), "weekly", Calendar.getInstance().getTime(), "yes", computeAdherenceRate());
110+
} else {
111+
decideDrugTakenUIBoolean(false, true);
112+
int currentDose = SharedPreferenceStore.mPrefsStore.getInt("com.peacecorps.malaria.dailyDose", 0) + 1;
113+
mSharedPreferenceStore.mEditor.putInt("com.peacecorps.malaria.dailyDose", currentDose).commit();
114+
DatabaseSQLiteHelper databaseSQLiteHelper = new DatabaseSQLiteHelper(getActivity());
115+
databaseSQLiteHelper.getUserMedicationSelection(getActivity(), "daily", Calendar.getInstance().getTime(), "yes", computeAdherenceRate());
116+
}
117+
118+
}
119+
});
120+
121+
mRejectMedicationButton.setOnClickListener(new View.OnClickListener() {
122+
123+
@Override
124+
public void onClick(View v) {
125+
MediaPlayer.create(getActivity(), R.raw.reject_button_sound)
126+
.start();
127+
drugRejectedCount += 1;
128+
if (mSharedPreferenceStore.mPrefsStore.getBoolean(
129+
"com.peacecorps.malaria.isWeekly", false)) {
130+
decideDrugTakenUIBoolean(true, false);
131+
DatabaseSQLiteHelper databaseSQLiteHelper = new DatabaseSQLiteHelper(getActivity());
132+
databaseSQLiteHelper.getUserMedicationSelection(getActivity(), "weekly", Calendar.getInstance().getTime(), "no", computeAdherenceRate());
133+
134+
} else {
135+
decideDrugTakenUIBoolean(false, false);
136+
DatabaseSQLiteHelper databaseSQLiteHelper = new DatabaseSQLiteHelper(getActivity());
137+
databaseSQLiteHelper.getUserMedicationSelection(getActivity(), "daily", Calendar.getInstance().getTime(), "no", computeAdherenceRate());
138+
139+
}
140+
141+
}
142+
});
143+
}
144+
145+
public void createView() {
146+
147+
mAcceptMedicationButton = (Button) rootView
148+
.findViewById(R.id.fragment_home_screen_accept_medication_button);
149+
mRejectMedicationButton = (Button) rootView
150+
.findViewById(R.id.fragment_home_screen__reject_medication_button);
151+
mSettingsButton = (Button) rootView
152+
.findViewById(R.id.fragment_home_screen_settings_button);
153+
mCurrentDateLabel = (TextView) rootView
154+
.findViewById(R.id.fragment_home_screen_current_date);
155+
mCurrentDayOfweekLabel = (TextView) rootView
156+
.findViewById(R.id.fragment_home_screen_current_day_of_week);
157+
158+
mCurrentDateLabel.setTextColor(Color.rgb(89, 43, 21));
159+
mCurrentDayOfweekLabel.setTextColor(Color.rgb(89, 43, 21));
160+
mCurrentDateLabel.setText(mGetCurrentDate);
161+
mCurrentDayOfweekLabel
162+
.setText(decideDayofWeek(checkDay, mPossibledays));
163+
}
164+
165+
public void updateUI() {
166+
getSharedPreferences();
167+
168+
mCalendar = Calendar.getInstance();
169+
170+
checkDay = mCalendar.get(Calendar.DAY_OF_WEEK);
171+
172+
173+
getSettings();
174+
createView();
175+
addButtonListeners();
176+
getSettings();
177+
decideisDrugTakenUI();
178+
}
179+
180+
public void saveUsersettings(Boolean state, Boolean isWeekly) {
181+
if (isWeekly) {
182+
mSharedPreferenceStore.mEditor.putLong("com.peacecorps.malaria.weeklyDate",
183+
new Date().getTime()).commit();
184+
mSharedPreferenceStore.mEditor.putBoolean(
185+
"com.peacecorps.malaria.isWeeklyDrugTaken", state).commit();
186+
} else {
187+
mSharedPreferenceStore.mEditor.putLong("com.peacecorps.malaria.dateDrugTaken",
188+
new Date().getTime()).commit();
189+
mSharedPreferenceStore.mEditor.putBoolean("com.peacecorps.malaria.isDrugTaken",
190+
state).commit();
191+
}
192+
mSharedPreferenceStore.mEditor.putInt("com.peacecorps.malaria.drugRejectedCount",
193+
drugRejectedCount).commit();
194+
mSharedPreferenceStore.mEditor.putInt("com.peacecorps.malaria.drugAcceptedCount",
195+
mDrugAcceptedCount).commit();
196+
197+
}
198+
199+
public void getSettings() {
200+
checkDay = mCalendar.get(Calendar.DAY_OF_WEEK);
201+
mGetCurrentDate = new SimpleDateFormat("dd/MM/yyyy",
202+
Locale.getDefault()).format(mCalendar.getTime());
203+
mDrugAcceptedCount = mSharedPreferenceStore.mPrefsStore.getInt(
204+
"com.peacecorps.malaria.drugAcceptedCount", 0);
205+
drugRejectedCount = mSharedPreferenceStore.mPrefsStore.getInt(
206+
"com.peacecorps.malaria.drugRejectedCount", 0);
207+
decideDayofWeek(checkDay, mPossibledays);
208+
}
209+
210+
public void missedWeekUI() {
211+
mSharedPreferenceStore.mEditor.putInt("com.peacecorps.malaria.weeklyDose", 0).commit();
212+
mCurrentDateLabel.setTextColor(Color.RED);
213+
mCurrentDayOfweekLabel.setTextColor(Color.RED);
214+
}
215+
216+
public void decideisDrugTakenUI() {
217+
if (mSharedPreferenceStore.mPrefsStore.getBoolean("com.peacecorps.malaria.isWeekly",
218+
false)) {
219+
if (checkDrugTakenTimeInterval("weeklyDate") == 0) {
220+
if ((mSharedPreferenceStore.mPrefsStore.getBoolean(
221+
"com.peacecorps.malaria.isWeeklyDrugTaken", false))) {
222+
isDrugTakenUI();
223+
} else {
224+
newDayUI();
225+
}
226+
} else {
227+
if (checkDrugTakenTimeInterval("weeklyDate") < 7
228+
&& checkDrugTakenTimeInterval("weeklyDate") > 0) {
229+
if ((mSharedPreferenceStore.mPrefsStore.getBoolean(
230+
"com.peacecorps.malaria.isWeeklyDrugTaken", false))) {
231+
isDrugTakenUI();
232+
} else {
233+
missedWeekUI();
234+
newDayUI();
235+
}
236+
} else if (checkDrugTakenTimeInterval("weeklyDate") > 7) {
237+
SharedPreferenceStore.mEditor.putInt(
238+
"com.peacecorps.malaria.AcceptedCount", 0).commit();
239+
missedWeekUI();
240+
newDayUI();
241+
}
242+
}
243+
} else {
244+
if (checkDrugTakenTimeInterval("dateDrugTaken") == 0) {
245+
if (mSharedPreferenceStore.mPrefsStore.getBoolean(
246+
"com.peacecorps.malaria.isDrugTaken", false)) {
247+
isDrugTakenUI();
248+
} else {
249+
250+
isDrugNotTakenUI();
251+
}
252+
253+
} else {
254+
255+
if (checkDrugTakenTimeInterval("dateDrugTaken") > 1) {
256+
mSharedPreferenceStore.mEditor.putInt("com.peacecorps.malaria.dailyDose", 0);
257+
}
258+
259+
newDayUI();
260+
}
261+
}
262+
}
263+
264+
public long checkDrugTakenTimeInterval(String time) {
265+
long interval = 0;
266+
long today = new Date().getTime();
267+
long takenDate = mSharedPreferenceStore.mPrefsStore.getLong("com.peacecorps.malaria."
268+
+ time, 0);
269+
long oneDay = 1000 * 60 * 60 * 24;
270+
interval = (today - takenDate) / oneDay;
271+
return interval;
272+
}
273+
274+
public void newDayUI() {
275+
mAcceptMedicationButton
276+
.setBackgroundResource(R.drawable.accept_medi_checked_);
277+
mRejectMedicationButton
278+
.setBackgroundResource(R.drawable.reject_medi_checked);
279+
setButtonState(true);
280+
281+
}
282+
283+
public void isDrugNotTakenUI() {
284+
mAcceptMedicationButton
285+
.setBackgroundResource(R.drawable.accept_medi_grayscale);
286+
mRejectMedicationButton
287+
.setBackgroundResource(R.drawable.reject_medi_checked);
288+
setButtonState(false);
289+
}
290+
291+
public void isDrugTakenUI() {
292+
mCurrentDateLabel.setTextColor(Color.rgb(89, 43, 21));
293+
mCurrentDayOfweekLabel.setTextColor(Color.rgb(89, 43, 21));
294+
mAcceptMedicationButton
295+
.setBackgroundResource(R.drawable.accept_medi_checked_);
296+
mRejectMedicationButton
297+
.setBackgroundResource(R.drawable.reject_medi_grayscale);
298+
setButtonState(false);
299+
storeMediTimeLastChecked();
300+
301+
}
302+
303+
public void setButtonState(boolean state) {
304+
mAcceptMedicationButton.setEnabled(state);
305+
mRejectMedicationButton.setEnabled(state);
306+
}
307+
308+
public void decideDrugTakenUIBoolean(Boolean isWeekly, Boolean isTaken) {
309+
if (isWeekly) {
310+
if (checkDrugTakenTimeInterval("weeklyDate") > 1) {
311+
changeWeeklyAlarmTime();
312+
}
313+
}
314+
saveUsersettings(isTaken, isWeekly);
315+
if (isTaken) {
316+
isDrugTakenUI();
317+
} else {
318+
isDrugNotTakenUI();
319+
}
320+
}
321+
322+
public void storeMediTimeLastChecked() {
323+
CharSequence lastMedicationCheckedTime = "";
324+
Calendar c = Calendar.getInstance();
325+
lastMedicationCheckedTime = new SimpleDateFormat("dd/MM",
326+
Locale.getDefault()).format(c.getTime());
327+
328+
mSharedPreferenceStore.mEditor.putString(
329+
"com.peacecorps.malaria.checkMediLastTakenTime",
330+
lastMedicationCheckedTime.toString()).commit();
331+
}
332+
333+
public void changeWeeklyAlarmTime() {
334+
int hour = Calendar.getInstance().getTime().getHours();
335+
int minute = Calendar.getInstance().getTime().getMinutes() - 1;
336+
getActivity().startService(
337+
new Intent(getActivity(), AlarmService.class));
338+
mSharedPreferenceStore.mEditor.putInt("com.peacecorps.malaria.AlarmHour", hour)
339+
.commit();
340+
mSharedPreferenceStore.mEditor.putInt("com.peacecorps.malaria.AlarmMinute", minute)
341+
.commit();
342+
}
343+
344+
345+
public String decideDayofWeek(int checkDay, String possibleDays[]) {
346+
String currentDayOfWeek = null;
347+
switch (checkDay) {
348+
case 1:
349+
currentDayOfWeek = possibleDays[0];
350+
break;
351+
case 2:
352+
currentDayOfWeek = possibleDays[1];
353+
break;
354+
case 3:
355+
currentDayOfWeek = possibleDays[2];
356+
break;
357+
case 4:
358+
currentDayOfWeek = possibleDays[3];
359+
break;
360+
case 5:
361+
currentDayOfWeek = possibleDays[4];
362+
break;
363+
case 6:
364+
currentDayOfWeek = possibleDays[5];
365+
break;
366+
case 7:
367+
currentDayOfWeek = possibleDays[6];
368+
break;
369+
370+
}
371+
return currentDayOfWeek;
372+
}
373+
374+
375+
=======
1376
package com.peacecorps.malaria;
2377

3378
import android.content.Context;
@@ -383,4 +758,5 @@ public String decideDayofWeek(int checkDay, String possibleDays[]) {
383758
}
384759

385760

761+
>>>>>>> FETCH_HEAD
386762
}

‎src/com/peacecorps/malaria/InfoHubFragmentActivity.java

100755100644
+54
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,56 @@
1+
<<<<<<< HEAD
2+
package com.peacecorps.malaria;
3+
4+
import android.content.Intent;
5+
import android.os.Bundle;
6+
import android.support.v4.app.FragmentActivity;
7+
import android.view.View;
8+
import android.widget.Button;
9+
import com.peacecorps.malaria.R;
10+
11+
/**
12+
* Created by Chimdi on 7/18/14.
13+
*/
14+
public class InfoHubFragmentActivity extends FragmentActivity {
15+
16+
Button homeIconButton, peaceCorpsPolicy;
17+
18+
@Override
19+
public void onCreate(Bundle savedInstanceState) {
20+
super.onCreate(savedInstanceState);
21+
setContentView(R.layout.info_hub_screen);
22+
23+
24+
homeIconButton = (Button) findViewById(R.id.homeButton);
25+
peaceCorpsPolicy = (Button) findViewById(R.id.peaceCorpsPolicy);
26+
27+
addListeners();
28+
}
29+
30+
31+
public void addListeners() {
32+
homeIconButton.setOnClickListener(new View.OnClickListener() {
33+
@Override
34+
public void onClick(View v) {
35+
startActivity(new Intent(getApplication().getApplicationContext(), MainActivity.class));
36+
finish();
37+
}
38+
});
39+
40+
peaceCorpsPolicy.setOnClickListener(new View.OnClickListener() {
41+
@Override
42+
public void onClick(View v) {
43+
startActivity(new Intent(getApplication().getApplicationContext(), PeaceCorpsPolicyFragmentActivity.class));
44+
}
45+
});
46+
}
47+
48+
49+
}
50+
51+
52+
53+
=======
154
package com.peacecorps.malaria;
255

356
import android.content.Intent;
@@ -49,3 +102,4 @@ public void onClick(View v) {
49102

50103

51104

105+
>>>>>>> FETCH_HEAD

‎src/com/peacecorps/malaria/MainActivity.java

+177-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,178 @@
1+
<<<<<<< HEAD
2+
package com.peacecorps.malaria;
3+
<<<<<<< HEAD
4+
=======
5+
6+
import java.util.Date;
7+
>>>>>>> origin/malaria-setup-screen
8+
9+
import android.content.Intent;
10+
import android.os.Bundle;
11+
import android.support.v4.app.FragmentActivity;
12+
import android.support.v4.view.ViewPager;
13+
import android.support.v4.view.ViewPager.OnPageChangeListener;
14+
<<<<<<< HEAD
15+
import android.view.View;
16+
import android.widget.Button;
17+
=======
18+
import android.widget.Toast;
19+
20+
import com.peacecorps.malaria;
21+
>>>>>>> origin/malaria-setup-screen
22+
import com.viewpagerindicator.CirclePageIndicator;
23+
import com.viewpagerindicator.PageIndicator;
24+
25+
import java.util.Date;
26+
27+
public class MainActivity extends FragmentActivity {
28+
29+
<<<<<<< HEAD
30+
FragmentAdapter mAdapter;
31+
ViewPager mPager;
32+
PageIndicator mIndicator;
33+
Button mInfoButton;
34+
35+
36+
@Override
37+
public void onCreate(Bundle savedInstanceState) {
38+
super.onCreate(savedInstanceState);
39+
setContentView(R.layout.activity_main);
40+
41+
42+
mInfoButton = (Button) findViewById(R.id.infoButton);
43+
mInfoButton.setOnClickListener(new View.OnClickListener() {
44+
@Override
45+
public void onClick(View v) {
46+
startActivity(new Intent(getApplication().getApplicationContext(), InfoHubFragmentActivity.class));
47+
finish();
48+
49+
}
50+
});
51+
52+
mAdapter = new FragmentAdapter(getSupportFragmentManager());
53+
54+
mPager = (ViewPager) findViewById(R.id.vPager);
55+
mPager.setAdapter(mAdapter);
56+
57+
mIndicator = (CirclePageIndicator) findViewById(R.id.vIndicator);
58+
mIndicator.setViewPager(mPager);
59+
mIndicator.setOnPageChangeListener(new OnPageChangeListener() {
60+
61+
62+
@Override
63+
public void onPageSelected(int position) {
64+
65+
if (position == 1) {
66+
if (FirstAnalyticFragment.checkMediLastTakenTime != null) {
67+
FirstAnalyticFragment.checkMediLastTakenTime
68+
.setText(SharedPreferenceStore.mPrefsStore
69+
.getString(
70+
"com.peacecorps.malaria.checkMediLastTakenTime",
71+
"").toString());
72+
73+
int currentDose = 0;
74+
if (SharedPreferenceStore.mPrefsStore.getBoolean(
75+
"com.peacecorps.malaria.isWeekly", false)) {
76+
currentDose = SharedPreferenceStore.mPrefsStore.getInt("com.peacecorps.malaria.weeklyDose", 0);
77+
} else {
78+
currentDose = SharedPreferenceStore.mPrefsStore.getInt("com.peacecorps.malaria.dailyDose", 0);
79+
}
80+
FirstAnalyticFragment.doses.setText("" + currentDose);
81+
82+
long interval = checkDrugTakenTimeInterval("firstRunTime");
83+
int takenCount = SharedPreferenceStore.mPrefsStore.getInt("com.peacecorps.malaria.drugAcceptedCount", 0);
84+
double adherenceRate = (takenCount / interval) * 100;
85+
FirstAnalyticFragment.adherence.setText("" + adherenceRate + "%");
86+
}
87+
88+
}
89+
}
90+
91+
@Override
92+
public void onPageScrollStateChanged(int i) {
93+
94+
}
95+
96+
@Override
97+
public void onPageScrolled(int i, float v, int i2) {
98+
99+
}
100+
101+
102+
});
103+
104+
}
105+
106+
public long checkDrugTakenTimeInterval(String time) {
107+
long interval = 0;
108+
long today = new Date().getTime();
109+
long takenDate = SharedPreferenceStore.mPrefsStore.getLong("com.peacecorps.malaria."
110+
+ time, 0);
111+
long oneDay = 1000 * 60 * 60 * 24;
112+
interval = (today - takenDate) / oneDay;
113+
return interval + 1;
114+
}
115+
=======
116+
FragmentAdapter mAdapter;
117+
ViewPager mPager;
118+
PageIndicator mIndicator;
119+
120+
@Override
121+
public void onCreate(Bundle savedInstanceState) {
122+
super.onCreate(savedInstanceState);
123+
setContentView(R.layout.activity_main);
124+
125+
mAdapter = new FragmentAdapter(getSupportFragmentManager());
126+
127+
mPager = (ViewPager) findViewById(R.id.vPager);
128+
mPager.setAdapter(mAdapter);
129+
130+
mIndicator = (CirclePageIndicator) findViewById(R.id.vIndicator);
131+
mIndicator.setViewPager(mPager);
132+
mIndicator.setOnPageChangeListener(new OnPageChangeListener() {
133+
134+
@Override
135+
public void onPageSelected(int position) {
136+
137+
int checkViewPagerPosition = 1;
138+
if (position == checkViewPagerPosition) {
139+
if (FirstAnalyticFragment.checkMediLastTakenTime != null) {
140+
FirstAnalyticFragment.checkMediLastTakenTime
141+
.setText(SharedPreferenceStore.mPrefsStore
142+
.getString(
143+
"com.pc.checkMediLastTakenTime",
144+
"").toString());
145+
FirstAnalyticFragment.doses.setText(""
146+
+ SharedPreferenceStore.mPrefsStore.getInt(
147+
"com.pc.AcceptedCount", 0));
148+
149+
long interval = checkDrugTakenTimeInterval("timeCounter");
150+
int takenCount = SharedPreferenceStore.mPrefsStore.getInt("com.pc.drugAcceptedCount", 0);
151+
double percentage = (takenCount/interval)* 100;
152+
FirstAnalyticFragment.adherence.setText(""+percentage);
153+
}
154+
155+
}
156+
}
157+
158+
159+
});
160+
161+
}
162+
163+
public long checkDrugTakenTimeInterval(String time) {
164+
long interval = 0;
165+
long today = new Date().getTime();
166+
long takenDate = SharedPreferenceStore.mPrefsStore.getLong("com.pc."
167+
+ time, 0);
168+
long oneDay = 1000 * 60 * 60 * 24;
169+
interval = (today - takenDate) / oneDay;
170+
return interval+1;
171+
}
172+
>>>>>>> origin/malaria-setup-screen
173+
174+
}
175+
=======
1176
package com.peacecorps.malaria;
2177

3178
import android.content.Intent;
@@ -100,4 +275,5 @@ public long checkDrugTakenTimeInterval(String time) {
100275
return interval + 1;
101276
}
102277

103-
}
278+
}
279+
>>>>>>> FETCH_HEAD

‎src/com/peacecorps/malaria/PeaceCorpsPolicyFragmentActivity.java

100755100644
+72
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,74 @@
1+
<<<<<<< HEAD
2+
package com.peacecorps.malaria;
3+
4+
import android.os.Bundle;
5+
import android.support.v4.app.FragmentActivity;
6+
import android.widget.TextView;
7+
import android.widget.Toast;
8+
import org.apache.http.HttpEntity;
9+
import org.apache.http.HttpResponse;
10+
import org.apache.http.client.methods.HttpPost;
11+
import org.apache.http.impl.client.DefaultHttpClient;
12+
import org.apache.http.params.BasicHttpParams;
13+
14+
import java.io.BufferedReader;
15+
import java.io.InputStream;
16+
import java.io.InputStreamReader;
17+
18+
import com.peacecorps.malaria.R;
19+
20+
/**
21+
* Created by Chimdi on 7/18/14.
22+
*/
23+
public class PeaceCorpsPolicyFragmentActivity extends FragmentActivity {
24+
25+
private TextView mPeaceCorpsPolicyLabel;
26+
27+
@Override
28+
public void onCreate(Bundle savedInstanceState) {
29+
super.onCreate(savedInstanceState);
30+
31+
setContentView(R.layout.peace_corps_policy_fragment);
32+
33+
mPeaceCorpsPolicyLabel = (TextView) findViewById(R.id.peaceCorpsPolicyLabel);
34+
}
35+
36+
public void getJSONDataFromWeb() {
37+
DefaultHttpClient httpclient = new DefaultHttpClient(new BasicHttpParams());
38+
HttpPost httppost = new HttpPost("WEB LINK TO JSON FROM PEACE CORP WILL BE HERE");
39+
40+
httppost.setHeader("Content-type", "application/json");
41+
42+
InputStream inputStream = null;
43+
String result = null;
44+
try {
45+
HttpResponse response = httpclient.execute(httppost);
46+
HttpEntity entity = response.getEntity();
47+
48+
inputStream = entity.getContent();
49+
// json is UTF-8 by default
50+
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"), 8);
51+
StringBuilder sb = new StringBuilder();
52+
53+
String line = null;
54+
while ((line = reader.readLine()) != null) {
55+
sb.append(line + "\n");
56+
}
57+
result = sb.toString();
58+
mPeaceCorpsPolicyLabel.setText(result);
59+
Toast.makeText(this, "" + result, Toast.LENGTH_LONG).show();
60+
61+
} catch (Exception e) {
62+
Toast.makeText(this, "" + e.getCause(), Toast.LENGTH_LONG).show();
63+
} finally {
64+
try {
65+
if (inputStream != null) inputStream.close();
66+
} catch (Exception squish) {
67+
}
68+
}
69+
}
70+
}
71+
=======
172
package com.peacecorps.malaria;
273

374
import android.os.Bundle;
@@ -69,3 +140,4 @@ public void getJSONDataFromWeb()
69140
}
70141
}
71142
}
143+
>>>>>>> FETCH_HEAD

‎src/com/peacecorps/malaria/SecondAnalyticFragment.java

+202
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,204 @@
1+
<<<<<<< HEAD
2+
package com.peacecorps.malaria;
3+
4+
import android.content.Context;
5+
import android.content.Intent;
6+
import android.os.Bundle;
7+
import android.support.v4.app.Fragment;
8+
import android.view.LayoutInflater;
9+
import android.view.View;
10+
import android.view.ViewGroup;
11+
import android.widget.*;
12+
import com.jjoe64.graphview.CustomLabelFormatter;
13+
import com.jjoe64.graphview.GraphView;
14+
import com.jjoe64.graphview.GraphView.GraphViewData;
15+
import com.jjoe64.graphview.GraphViewSeries;
16+
import com.jjoe64.graphview.LineGraphView;
17+
18+
import java.util.Calendar;
19+
20+
public class SecondAnalyticFragment extends Fragment {
21+
22+
private TextView firstMonthProgressLabel, secondMonthProgressLabel, thirdMonthProgressLabel, fourthMonthProgressLabel;
23+
private TextView firstMonthProgressPercent, secondMonthProgressPercent, thirdMonthProgressPercent, fourthMonthProgressPercent;
24+
private ProgressBar firstMonthProgressBar, secondMonthProgressBar, thirdMonthProgressBar, fourthMonthProgressBar;
25+
private Button mSettingsButton;
26+
private View rootView;
27+
28+
static SharedPreferenceStore mSharedPreferenceStore;
29+
30+
GraphViewSeries drugGraphSeries;
31+
private GraphViewData[] graphViewData;
32+
33+
public View onCreateView(LayoutInflater inflater, ViewGroup container,
34+
Bundle savedInstanceState) {
35+
rootView = inflater.inflate(R.layout.fragment_second_analytic_screen,
36+
null);
37+
38+
mSettingsButton = (Button) rootView.findViewById(R.id.fragment_second_screen_settings_button);
39+
40+
firstMonthProgressLabel = (TextView) rootView.findViewById(R.id.firstMonthProgressLabel);
41+
secondMonthProgressLabel = (TextView) rootView.findViewById(R.id.secondMonthProgressLabel);
42+
thirdMonthProgressLabel = (TextView) rootView.findViewById(R.id.thirdMonthProgressLabel);
43+
fourthMonthProgressLabel = (TextView) rootView.findViewById(R.id.fourthMonthProgressLabel);
44+
45+
firstMonthProgressPercent = (TextView) rootView.findViewById(R.id.firstMonthProgressPercent);
46+
secondMonthProgressPercent = (TextView) rootView.findViewById(R.id.secondMonthProgressPercent);
47+
thirdMonthProgressPercent = (TextView) rootView.findViewById(R.id.thirdMonthProgressPercent);
48+
fourthMonthProgressPercent = (TextView) rootView.findViewById(R.id.fourthMonthProgressPercent);
49+
50+
firstMonthProgressBar = (ProgressBar) rootView.findViewById(R.id.firstMonthProgressBar);
51+
secondMonthProgressBar = (ProgressBar) rootView.findViewById(R.id.secondMonthProgressBar);
52+
thirdMonthProgressBar = (ProgressBar) rootView.findViewById(R.id.thirdMonthProgressBar);
53+
fourthMonthProgressBar = (ProgressBar) rootView.findViewById(R.id.fourthMonthProgressBar);
54+
55+
56+
DatabaseSQLiteHelper databaseSQLiteHelper = new DatabaseSQLiteHelper(getActivity());
57+
int date = Calendar.getInstance().getTime().getMonth();
58+
String choice;
59+
if (mSharedPreferenceStore.mPrefsStore.getBoolean(
60+
"com.peacecorps.malaria.isWeekly", false)) {
61+
choice = "weekly";
62+
} else {
63+
choice = "daily";
64+
}
65+
66+
67+
firstMonthProgressLabel.setText(getMonth(date - 3));
68+
int progress = databaseSQLiteHelper.getData(mdate, myear, choice) * 100;
69+
firstMonthProgressBar.setProgress(progress);
70+
firstMonthProgressPercent.setText("" + progress + "%");
71+
72+
secondMonthProgressLabel.setText(getMonth(date - 2));
73+
progress = databaseSQLiteHelper.getData(mdate, myear, choice) * 100;
74+
secondMonthProgressBar.setProgress(progress);
75+
secondMonthProgressPercent.setText("" + progress + "%");
76+
77+
thirdMonthProgressLabel.setText(getMonth(date - 1));
78+
progress = databaseSQLiteHelper.getData(mdate, myear, choice) * 100;
79+
thirdMonthProgressBar.setProgress(progress);
80+
thirdMonthProgressPercent.setText("" + progress + "%");
81+
82+
fourthMonthProgressLabel.setText(getMonth(date));
83+
progress = databaseSQLiteHelper.getData(mdate, myear, choice) * 100;
84+
fourthMonthProgressBar.setProgress(progress);
85+
fourthMonthProgressPercent.setText("" + progress + "%");
86+
87+
getSharedPreferences();
88+
addButtonListeners();
89+
setupAndShowGraph();
90+
91+
return rootView;
92+
}
93+
94+
int mdate;
95+
int myear;
96+
97+
public String getMonth(int date) {
98+
String month[] = getResources().getStringArray(R.array.month);
99+
if (date == 0) {
100+
date = 12;
101+
myear = Calendar.getInstance().getTime().getYear() - 1;
102+
} else if (date == -1) {
103+
date = 11;
104+
myear = Calendar.getInstance().getTime().getYear() - 1;
105+
} else if (date == -2) {
106+
date = 10;
107+
myear = Calendar.getInstance().getTime().getYear() - 1;
108+
}
109+
myear = Calendar.getInstance().getTime().getYear();
110+
mdate = date;
111+
return month[date];
112+
}
113+
114+
public void addButtonListeners() {
115+
mSettingsButton.setOnClickListener(new View.OnClickListener() {
116+
117+
@Override
118+
public void onClick(View v) {
119+
120+
mSharedPreferenceStore.mEditor.putBoolean(
121+
"com.peacecorps.malaria.hasUserSetPreference", false).commit();
122+
startActivity(new Intent(getActivity(),
123+
UserMedicineSettingsFragmentActivity.class));
124+
getActivity().finish();
125+
126+
}
127+
});
128+
129+
firstMonthProgressBar.setOnClickListener(new View.OnClickListener() {
130+
@Override
131+
public void onClick(View v) {
132+
Toast.makeText(getActivity(), "First progress", Toast.LENGTH_SHORT).show();
133+
}
134+
});
135+
136+
secondMonthProgressBar.setOnClickListener(new View.OnClickListener() {
137+
@Override
138+
public void onClick(View v) {
139+
Toast.makeText(getActivity(), "Second progress", Toast.LENGTH_SHORT).show();
140+
}
141+
});
142+
143+
thirdMonthProgressBar.setOnClickListener(new View.OnClickListener() {
144+
@Override
145+
public void onClick(View v) {
146+
Toast.makeText(getActivity(), "Third progress", Toast.LENGTH_SHORT).show();
147+
}
148+
});
149+
150+
fourthMonthProgressBar.setOnClickListener(new View.OnClickListener() {
151+
@Override
152+
public void onClick(View v) {
153+
Toast.makeText(getActivity(), "Fourth progress", Toast.LENGTH_SHORT).show();
154+
}
155+
});
156+
}
157+
158+
public void getSharedPreferences() {
159+
160+
mSharedPreferenceStore.mPrefsStore = getActivity()
161+
.getSharedPreferences("com.peacecorps.malaria.storeTimePicked",
162+
Context.MODE_PRIVATE);
163+
mSharedPreferenceStore.mEditor = mSharedPreferenceStore.mPrefsStore
164+
.edit();
165+
}
166+
167+
public void setupAndShowGraph() {
168+
GraphViewData graphViewData[] = new GraphViewData[DatabaseSQLiteHelper.percentage.size()];
169+
for (int index = 0; index < DatabaseSQLiteHelper.percentage.size(); index++) {
170+
graphViewData[index] = new GraphViewData(DatabaseSQLiteHelper.date.get(index), Double.parseDouble("" + DatabaseSQLiteHelper.percentage.get(index)));
171+
}
172+
drugGraphSeries = new GraphViewSeries(graphViewData);
173+
174+
GraphView lineGraphView = new LineGraphView(getActivity(), "");
175+
176+
lineGraphView.getGraphViewStyle().setGridColor(getResources().getColor(R.color.golden_brown));
177+
lineGraphView.getGraphViewStyle().setHorizontalLabelsColor(getResources().getColor(R.color.golden_brown));
178+
lineGraphView.getGraphViewStyle().setVerticalLabelsColor(getResources().getColor(R.color.golden_brown));
179+
lineGraphView.getGraphViewStyle().setTextSize(15.0F);
180+
lineGraphView.setScrollable(true);
181+
lineGraphView.setScalable(true);
182+
183+
lineGraphView.setCustomLabelFormatter(new CustomLabelFormatter() {
184+
@Override
185+
public String formatLabel(double value, boolean isXAxis) {
186+
187+
188+
return null;
189+
}
190+
});
191+
192+
((LineGraphView) lineGraphView).setDrawBackground(true);
193+
lineGraphView.addSeries(drugGraphSeries);
194+
195+
LinearLayout linearLayout = (LinearLayout) rootView.findViewById(R.id.graphView);
196+
linearLayout.addView(lineGraphView);
197+
198+
}
199+
200+
201+
=======
1202
package com.peacecorps.malaria;
2203

3204
import android.content.Context;
@@ -205,4 +406,5 @@ public String formatLabel(double value, boolean isXAxis) {
205406
}
206407

207408

409+
>>>>>>> FETCH_HEAD
208410
}

‎src/com/peacecorps/malaria/SharedPreferenceStore.java

+24
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
<<<<<<< HEAD
2+
package com.peacecorps.malaria;
3+
4+
import android.content.Context;
5+
import android.content.SharedPreferences;
6+
7+
public class SharedPreferenceStore {
8+
public static SharedPreferences mPrefsStore;
9+
public static SharedPreferences.Editor mEditor;
10+
11+
public SharedPreferenceStore() {
12+
13+
}
14+
15+
public void getSharedPreferences(Context context) {
16+
17+
mPrefsStore = context.getSharedPreferences("com.pc.storeTimePicked",
18+
Context.MODE_PRIVATE);
19+
mEditor = mPrefsStore.edit();
20+
}
21+
22+
}
23+
=======
124
package com.peacecorps.malaria;
225

326
import android.content.Context;
@@ -19,3 +42,4 @@ public void getSharedPreferences(Context context) {
1942
}
2043

2144
}
45+
>>>>>>> FETCH_HEAD

‎src/com/peacecorps/malaria/UserMedicineSettingsFragmentActivity.java

+291
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,293 @@
1+
<<<<<<< HEAD
2+
package com.peacecorps.malaria;
3+
4+
/**
5+
* Created by Chimdi on 6/2/2014.
6+
*/
7+
8+
import android.app.Dialog;
9+
import android.app.TimePickerDialog;
10+
import android.content.Context;
11+
import android.content.Intent;
12+
import android.os.Bundle;
13+
import android.support.v4.app.DialogFragment;
14+
import android.support.v4.app.FragmentActivity;
15+
import android.text.format.DateFormat;
16+
import android.view.View;
17+
<<<<<<< HEAD
18+
import android.widget.*;
19+
20+
import java.util.Calendar;
21+
import java.util.Date;
22+
=======
23+
import android.widget.AdapterView;
24+
import android.widget.ArrayAdapter;
25+
import android.widget.Button;
26+
import android.widget.Spinner;
27+
import android.widget.TextView;
28+
import android.widget.TimePicker;
29+
>>>>>>> origin/malaria-setup-screen
30+
import com.peacecorps.malaria.R;
31+
32+
public class UserMedicineSettingsFragmentActivity extends FragmentActivity
33+
implements AdapterView.OnItemSelectedListener {
34+
35+
private static Button mDoneButton;
36+
37+
private static TextView timePickButton;
38+
private TextView mSetupLabel;
39+
private TextView mDrugTakeLabel;
40+
private TextView mTimePickLabel;
41+
private TextView mIfForgetLabel;
42+
private Spinner mDrugSelectSpinner;
43+
private static String mDrugPicked;
44+
private static int mHour;
45+
private static int mMinute;
46+
private final static Calendar mCalendar = Calendar.getInstance();
47+
48+
static SharedPreferenceStore mSharedPreferenceStore;
49+
50+
public static Context mFragmentContext;
51+
52+
@Override
53+
public void onCreate(Bundle savedInstanceState) {
54+
super.onCreate(savedInstanceState);
55+
56+
setContentView(R.layout.fragment_user_medicine_settings);
57+
this.setTitle(R.string.user_medicine_settings_fragment_activity_title);
58+
59+
mSharedPreferenceStore = new SharedPreferenceStore();
60+
61+
mFragmentContext = UserMedicineSettingsFragmentActivity.this
62+
.getApplicationContext();
63+
mDoneButton = (Button) findViewById(R.id.user_medicine_settings_activity_done_button);
64+
mDoneButton.setOnClickListener(mDoneButtonClickListener);
65+
66+
boolean isDoneButtonChecked = false;
67+
68+
timePickButton = (TextView) findViewById(R.id.user_medicine_settings_activity_time_pick_button);
69+
mDrugTakeLabel = (TextView) findViewById(R.id.user_medicine_settings_activity_drug_take_label);
70+
mSetupLabel = (TextView) findViewById(R.id.user_medicine_settings_activity_setup_label);
71+
mTimePickLabel = (TextView) findViewById(R.id.user_medicine_settings_activity_time_pick_label);
72+
mIfForgetLabel = (TextView) findViewById(R.id.user_medicine_settings_activity_if_forget_label);
73+
mDrugSelectSpinner = (Spinner) findViewById(R.id.user_medicine_settings_activity_drug_select_spinner);
74+
75+
mSharedPreferenceStore.getSharedPreferences(this);
76+
77+
78+
checkInitialAppInstall();
79+
80+
createDrugSelectionSpinner();
81+
82+
checkIfTimeSet(isDoneButtonChecked);
83+
84+
addTimePickButtonClickListener();
85+
86+
}
87+
88+
@Override
89+
protected void onDestroy() {
90+
91+
super.onDestroy();
92+
if (mSharedPreferenceStore.mPrefsStore.getBoolean("com.peacecorps.malaria.isFirstRun",
93+
true)) {
94+
mSharedPreferenceStore.mEditor.putBoolean(
95+
"com.peacecorps.malaria.hasUserSetPreference", true).commit();
96+
}
97+
98+
}
99+
100+
@Override
101+
protected void onResume() {
102+
super.onResume();
103+
104+
if (mSharedPreferenceStore.mPrefsStore.getBoolean("com.peacecorps.malaria.isFirstRun",
105+
true)) {
106+
mSharedPreferenceStore.mEditor.putBoolean(
107+
"com.peacecorps.malaria.hasUserSetPreference", true).commit();
108+
}
109+
110+
}
111+
112+
@Override
113+
protected void onPause() {
114+
115+
super.onPause();
116+
if (mSharedPreferenceStore.mPrefsStore.getBoolean("com.peacecorps.malaria.isFirstRun",
117+
true)) {
118+
mSharedPreferenceStore.mEditor.putBoolean(
119+
"com.peacecorps.malaria.hasUserSetPreference", true).commit();
120+
}
121+
122+
}
123+
124+
private void checkInitialAppInstall() {
125+
126+
if (mSharedPreferenceStore.mPrefsStore.getBoolean(
127+
"com.peacecorps.malaria.hasUserSetPreference", false)) {
128+
129+
mSharedPreferenceStore.mEditor.putBoolean(
130+
"com.peacecorps.malaria.hasUserSetPreference", true).commit();
131+
mSharedPreferenceStore.mEditor
132+
.putBoolean("com.peacecorps.malaria.isFirstRun", true).commit();
133+
134+
startActivity(new Intent(UserMedicineSettingsFragmentActivity.this,
135+
MainActivity.class));
136+
finish();
137+
}
138+
139+
}
140+
141+
private void createDrugSelectionSpinner() {
142+
143+
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
144+
this, R.array.user_medicine_settings_activity_drug_array,
145+
android.R.layout.simple_spinner_item);
146+
147+
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
148+
149+
mDrugSelectSpinner.setAdapter(adapter);
150+
151+
mDrugSelectSpinner.setOnItemSelectedListener(this);
152+
}
153+
154+
155+
public void addTimePickButtonClickListener() {
156+
157+
timePickButton.setOnClickListener(new View.OnClickListener() {
158+
159+
@Override
160+
public void onClick(View v) {
161+
162+
DialogFragment newFragment = new TimePickerFragment();
163+
newFragment.show(getSupportFragmentManager(), "Time Picker");
164+
}
165+
166+
});
167+
}
168+
169+
public static class TimePickerFragment extends DialogFragment implements
170+
TimePickerDialog.OnTimeSetListener {
171+
172+
@Override
173+
public Dialog onCreateDialog(Bundle savedInstanceState) {
174+
175+
int hour = mCalendar.get(Calendar.HOUR_OF_DAY);
176+
int minute = mCalendar.get(Calendar.MINUTE);
177+
178+
return new TimePickerDialog(getActivity(), this, hour, minute,
179+
DateFormat.is24HourFormat(getActivity()));
180+
}
181+
182+
public void onTimeSet(TimePicker view, int hourOfDay, int minutes) {
183+
184+
boolean isDoneButtonChecked = true;
185+
186+
mHour = hourOfDay;
187+
mMinute = minutes;
188+
189+
updateTime(hourOfDay, minutes);
190+
checkIfTimeSet(isDoneButtonChecked);
191+
192+
}
193+
194+
}
195+
196+
public static void checkIfTimeSet(boolean isDoneButtonChecked) {
197+
mDoneButton.setEnabled(isDoneButtonChecked);
198+
}
199+
200+
public static void saveUserTimeAndMedicationPrefs() {
201+
202+
int checkDay = mCalendar.get(Calendar.DAY_OF_WEEK);
203+
204+
205+
mSharedPreferenceStore.mEditor.putInt("com.peacecorps.malaria.AlarmHour", mHour)
206+
.commit();
207+
mSharedPreferenceStore.mEditor.putInt("com.peacecorps.malaria.AlarmMinute", mMinute)
208+
.commit();
209+
mSharedPreferenceStore.mEditor.putInt("com.peacecorps.malaria.dayTakingDrug", checkDay);
210+
211+
mSharedPreferenceStore.mEditor.putString("com.peacecorps.malaria.drugPicked",
212+
mDrugPicked);
213+
mSharedPreferenceStore.mEditor.putBoolean("com.peacecorps.malaria.isDrugTaken", false)
214+
.commit();
215+
mSharedPreferenceStore.mEditor.commit();
216+
mFragmentContext.startService(new Intent(mFragmentContext,
217+
AlarmService.class));
218+
219+
}
220+
221+
// converts 24hr format to 12hr format with AM/PM values
222+
private static void updateTime(int hours, int mins) {
223+
String timeSet;
224+
if (hours > 12) {
225+
hours -= 12;
226+
timeSet = "PM";
227+
} else if (hours == 0) {
228+
hours += 12;
229+
timeSet = "AM";
230+
} else if (hours == 12)
231+
timeSet = "PM";
232+
else
233+
timeSet = "AM";
234+
235+
String minutes;
236+
if (mins < 10)
237+
minutes = "0" + mins;
238+
else
239+
minutes = String.valueOf(mins);
240+
241+
// Append the time to a stringBuilder
242+
String theTime = String.valueOf(hours) + ':' + minutes + " " + timeSet;
243+
244+
// Set the timePickButton as the converted time
245+
timePickButton.setText(theTime);
246+
247+
}
248+
249+
// Listeners
250+
private View.OnClickListener mDoneButtonClickListener = new View.OnClickListener() {
251+
@Override
252+
public void onClick(View view) {
253+
254+
saveUserTimeAndMedicationPrefs();
255+
256+
startActivity(new Intent(UserMedicineSettingsFragmentActivity.this,
257+
MainActivity.class));
258+
finish();
259+
260+
}
261+
};
262+
263+
@Override
264+
public void onItemSelected(AdapterView<?> parent, View view, int position,
265+
long id) {
266+
267+
mDrugPicked = parent.getItemAtPosition(position).toString();
268+
269+
parent.setSelection(parent.getSelectedItemPosition());
270+
mSharedPreferenceStore.mEditor.putInt("com.peacecorps.malaria.drug", position).commit();
271+
if (position == 2) {
272+
mSharedPreferenceStore.mEditor.putBoolean("com.peacecorps.malaria.isWeekly", true);
273+
mSharedPreferenceStore.mEditor.putLong("com.peacecorps.malaria.weeklyDate",
274+
new Date().getTime()).commit();
275+
} else {
276+
mSharedPreferenceStore.mEditor.putBoolean("com.peacecorps.malaria.isWeekly", false);
277+
}
278+
if(mSharedPreferenceStore.mPrefsStore.getBoolean("com.peacecorps.malaria.isFirstRun",true)){
279+
mSharedPreferenceStore.mEditor.putLong("com.peacecorps.malaria.firstRunTime", Calendar.getInstance().getTimeInMillis());
280+
}
281+
mSharedPreferenceStore.mEditor.putBoolean("com.peacecorps.malaria.isFirstRun", false);
282+
283+
}
284+
285+
@Override
286+
public void onNothingSelected(AdapterView<?> parent) {
287+
}
288+
289+
}
290+
=======
1291
package com.peacecorps.malaria;
2292

3293
/**
@@ -283,3 +573,4 @@ public void onNothingSelected(AdapterView<?> parent) {
283573
}
284574

285575
}
576+
>>>>>>> FETCH_HEAD

0 commit comments

Comments
 (0)
Please sign in to comment.