├── .gitignore
├── .idea
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── gradle.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── README.md
├── app
├── .gitignore
├── build.gradle
├── libs
│ └── volley.jar
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── cbitss
│ │ └── careforu
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── assets
│ │ └── fonts
│ │ │ ├── Gabriola.ttf
│ │ │ ├── bradhitc.ttf
│ │ │ ├── georgia.ttf
│ │ │ ├── georgiab.ttf
│ │ │ ├── georgiai.ttf
│ │ │ └── georgiaz.ttf
│ ├── java
│ │ └── com
│ │ │ └── cbitss
│ │ │ └── careforu
│ │ │ ├── AboutUs.java
│ │ │ ├── AddReminder.java
│ │ │ ├── AlarmActivity.java
│ │ │ ├── AlarmReceiver.java
│ │ │ ├── ColorGenerator.java
│ │ │ ├── CustomAdapter.java
│ │ │ ├── CustomDialogClass.java
│ │ │ ├── CustomGrid.java
│ │ │ ├── CustomList.java
│ │ │ ├── DatabaseHandler.java
│ │ │ ├── FirstAidCard.java
│ │ │ ├── FirstAidContent.java
│ │ │ ├── FirstAidContentAdapter.java
│ │ │ ├── FirstAidOffline.java
│ │ │ ├── FirstAidRVAdapter.java
│ │ │ ├── FirstAidTips.java
│ │ │ ├── FirstAidTipsHome.java
│ │ │ ├── FragmentReminder.java
│ │ │ ├── GooglePlacesReadTask.java
│ │ │ ├── HealthTips.java
│ │ │ ├── Home.java
│ │ │ ├── Http.java
│ │ │ ├── Knowmed.java
│ │ │ ├── MainActivity.java
│ │ │ ├── MedInfo.java
│ │ │ ├── MedRemInfo.java
│ │ │ ├── MedReminderObj.java
│ │ │ ├── Nearbyhosp.java
│ │ │ ├── Places.java
│ │ │ ├── PlacesDisplayTask.java
│ │ │ ├── Reminder.java
│ │ │ ├── Splash.java
│ │ │ └── TextDrawable.java
│ └── res
│ │ ├── anim
│ │ └── slidingimages.xml
│ │ ├── color
│ │ └── drawer_item.xml
│ │ ├── drawable-v21
│ │ ├── diltran.png
│ │ ├── ic_menu_slideshow.xml
│ │ └── logo2.png
│ │ ├── drawable
│ │ ├── border_edit_text.xml
│ │ ├── border_without_top.xml
│ │ ├── boy.jpg
│ │ ├── boythree.jpg
│ │ ├── boytwo.jpg
│ │ ├── careforu.PNG
│ │ ├── dil.png
│ │ ├── dil_tran.png
│ │ ├── firstaidtips.png
│ │ ├── flask.png
│ │ ├── girl.jpg
│ │ ├── girlfour.jpg
│ │ ├── girlone.jpg
│ │ ├── girlthree.jpg
│ │ ├── health_tips.png
│ │ ├── hospitals.png
│ │ ├── ic_add_black_24dp.xml
│ │ ├── ic_add_location_black_24dp.xml
│ │ ├── ic_alarm_black_24dp.xml
│ │ ├── ic_arrow_back_black_24dp.xml
│ │ ├── ic_check_black_24dp.xml
│ │ ├── ic_chevron_right_black_24dp.xml
│ │ ├── ic_delete_black_24dp.xml
│ │ ├── ic_edit_black_24dp.xml
│ │ ├── ic_info_black_24dp.xml
│ │ ├── ic_info_outline_black_24dp.xml
│ │ ├── ic_local_hospital_black_24dp.xml
│ │ ├── ic_note_add_black_24dp.xml
│ │ ├── ic_power_settings_new_black_24dp.xml
│ │ ├── ic_search_black_24dp.xml
│ │ ├── ic_watch_later_black_24dp.xml
│ │ ├── logo.png
│ │ ├── med.png
│ │ ├── med_remind.png
│ │ ├── medicines.jpg
│ │ ├── medreminder.png
│ │ ├── nosebleeding.jpg
│ │ ├── remind.jpg
│ │ ├── rounded_corner.xml
│ │ ├── side_nav_bar.xml
│ │ ├── splash.png
│ │ ├── tip1.jpg
│ │ ├── tip2.png
│ │ ├── tip3.png
│ │ ├── tip4.jpg
│ │ └── tip5.png
│ │ ├── layout
│ │ ├── activity_add_reminder.xml
│ │ ├── activity_alarm.xml
│ │ ├── activity_first_aid_content.xml
│ │ ├── activity_main.xml
│ │ ├── activity_med_info.xml
│ │ ├── activity_med_rem_info.xml
│ │ ├── activity_splash.xml
│ │ ├── app_bar_main.xml
│ │ ├── card_view.xml
│ │ ├── components_view.xml
│ │ ├── content_main.xml
│ │ ├── custom_dialog.xml
│ │ ├── fragment_about_us.xml
│ │ ├── fragment_first_aid_offline.xml
│ │ ├── fragment_first_aid_tips.xml
│ │ ├── fragment_first_aid_tips_home.xml
│ │ ├── fragment_health_tips.xml
│ │ ├── fragment_home.xml
│ │ ├── fragment_knowmed.xml
│ │ ├── fragment_nearbyhosp.xml
│ │ ├── fragment_reminder.xml
│ │ ├── grid_single.xml
│ │ ├── imageitem.xml
│ │ ├── list_medinfo.xml
│ │ └── nav_header_main.xml
│ │ ├── menu
│ │ ├── activity_main_drawer.xml
│ │ └── main.xml
│ │ ├── mipmap-hdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ └── ic_launcher.png
│ │ ├── values-v21
│ │ └── styles.xml
│ │ ├── values-w820dp
│ │ └── dimens.xml
│ │ └── values
│ │ ├── arrays.xml
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── drawables.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── cbitss
│ └── careforu
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── screenshots
├── Screenshot (10).png
├── Screenshot (11).png
├── Screenshot (12).png
├── Screenshot (13).png
├── Screenshot (14).png
├── Screenshot (15).png
├── Screenshot (16).png
├── Screenshot (17).png
├── Screenshot (18).png
├── Screenshot (19).png
├── Screenshot (2).png
├── Screenshot (3).png
├── Screenshot (4).png
├── Screenshot (5).png
├── Screenshot (6).png
├── Screenshot (7).png
├── Screenshot (8).png
├── Screenshot (8-1).png
└── Screenshot (9).png
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | 1.8
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 25
5 | buildToolsVersion '25.0.0'
6 | defaultConfig {
7 | applicationId "com.cbitss.careforu"
8 | minSdkVersion 15
9 | targetSdkVersion 25
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
25 | exclude group: 'com.android.support', module: 'support-annotations'
26 | })
27 | //compile 'com.google.android.gms:play-services:10.0.1'
28 | compile 'com.android.support:cardview-v7:25.1.0'
29 | compile 'com.android.support:recyclerview-v7:25.1.0'
30 | compile 'com.android.support:appcompat-v7:25.1.0'
31 | compile 'com.android.support:design:25.1.0'
32 | compile 'com.android.support:support-v4:25.1.0'
33 | compile 'com.squareup.picasso:picasso:2.5.2'
34 | compile 'com.google.android.gms:play-services:9.0.1'
35 | compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
36 | compile 'com.android.volley:volley:1.0.0'
37 | compile 'com.squareup.okhttp:okhttp:2.5.0'
38 | compile 'com.android.support.constraint:constraint-layout:1.0.2'
39 | compile 'org.apache.commons:commons-lang3:3.5'
40 | testCompile 'junit:junit:4.12'
41 | }
42 |
--------------------------------------------------------------------------------
/app/libs/volley.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rishab951/CareForU/542a68c5f413250d7770a34945fb88442a3ae3aa/app/libs/volley.jar
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in C:\Users\Rishab\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/cbitss/careforu/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.cbitss.careforu;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.cbitss.careforu", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
22 |
23 |
29 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
43 |
48 |
49 |
52 |
53 |
54 |
55 |
56 |
57 |
59 |
62 |
65 |
66 |
69 |
70 |
74 |
77 |
78 |
81 |
82 |
83 |
84 |
--------------------------------------------------------------------------------
/app/src/main/assets/fonts/Gabriola.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rishab951/CareForU/542a68c5f413250d7770a34945fb88442a3ae3aa/app/src/main/assets/fonts/Gabriola.ttf
--------------------------------------------------------------------------------
/app/src/main/assets/fonts/bradhitc.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rishab951/CareForU/542a68c5f413250d7770a34945fb88442a3ae3aa/app/src/main/assets/fonts/bradhitc.ttf
--------------------------------------------------------------------------------
/app/src/main/assets/fonts/georgia.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rishab951/CareForU/542a68c5f413250d7770a34945fb88442a3ae3aa/app/src/main/assets/fonts/georgia.ttf
--------------------------------------------------------------------------------
/app/src/main/assets/fonts/georgiab.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rishab951/CareForU/542a68c5f413250d7770a34945fb88442a3ae3aa/app/src/main/assets/fonts/georgiab.ttf
--------------------------------------------------------------------------------
/app/src/main/assets/fonts/georgiai.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rishab951/CareForU/542a68c5f413250d7770a34945fb88442a3ae3aa/app/src/main/assets/fonts/georgiai.ttf
--------------------------------------------------------------------------------
/app/src/main/assets/fonts/georgiaz.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rishab951/CareForU/542a68c5f413250d7770a34945fb88442a3ae3aa/app/src/main/assets/fonts/georgiaz.ttf
--------------------------------------------------------------------------------
/app/src/main/java/com/cbitss/careforu/AboutUs.java:
--------------------------------------------------------------------------------
1 | package com.cbitss.careforu;
2 |
3 | import android.content.Context;
4 | import android.content.res.AssetManager;
5 | import android.graphics.Typeface;
6 | import android.net.Uri;
7 | import android.os.Bundle;
8 | import android.support.v4.app.Fragment;
9 | import android.view.LayoutInflater;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.widget.TextView;
13 |
14 |
15 | /**
16 | * A simple {@link Fragment} subclass.
17 | * Activities that contain this fragment must implement the
18 | * {@link OnFragmentInteractionListener} interface
19 | * to handle interaction events.
20 | * Use the {@link AboutUs#newInstance} factory method to
21 | * create an instance of this fragment.
22 | */
23 | public class AboutUs extends Fragment {
24 | // TODO: Rename parameter arguments, choose names that match
25 | // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
26 | private static final String ARG_PARAM1 = "param1";
27 | private static final String ARG_PARAM2 = "param2";
28 |
29 | // TODO: Rename and change types of parameters
30 | private String mParam1;
31 | private String mParam2;
32 |
33 | private OnFragmentInteractionListener mListener;
34 |
35 | public AboutUs() {
36 | // Required empty public constructor
37 | }
38 |
39 | /**
40 | * Use this factory method to create a new instance of
41 | * this fragment using the provided parameters.
42 | *
43 | * @param param1 Parameter 1.
44 | * @param param2 Parameter 2.
45 | * @return A new instance of fragment AboutUs.
46 | */
47 | // TODO: Rename and change types and number of parameters
48 | public static AboutUs newInstance(String param1, String param2) {
49 | AboutUs fragment = new AboutUs();
50 | Bundle args = new Bundle();
51 | args.putString(ARG_PARAM1, param1);
52 | args.putString(ARG_PARAM2, param2);
53 | fragment.setArguments(args);
54 | return fragment;
55 | }
56 |
57 | @Override
58 | public void onCreate(Bundle savedInstanceState) {
59 | super.onCreate(savedInstanceState);
60 | if (getArguments() != null) {
61 | mParam1 = getArguments().getString(ARG_PARAM1);
62 | mParam2 = getArguments().getString(ARG_PARAM2);
63 | }
64 | }
65 |
66 | @Override
67 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
68 | Bundle savedInstanceState) {
69 | // Inflate the layout for this fragment
70 | View v=inflater.inflate(R.layout.fragment_about_us, container, false);
71 | TextView myTextView = (TextView) v.findViewById(R.id.AbtUs_tv);
72 | Typeface typeface=Typeface.createFromAsset(getActivity().getAssets(), "fonts/bradhitc.ttf");
73 | myTextView.setTypeface(typeface);
74 | return v;
75 | }
76 |
77 | // TODO: Rename method, update argument and hook method into UI event
78 | public void onButtonPressed(Uri uri) {
79 | if (mListener != null) {
80 | mListener.onFragmentInteraction(uri);
81 | }
82 | }
83 |
84 | @Override
85 | public void onAttach(Context context) {
86 | super.onAttach(context);
87 | if (context instanceof OnFragmentInteractionListener) {
88 | mListener = (OnFragmentInteractionListener) context;
89 | } else {
90 | throw new RuntimeException(context.toString()
91 | + " must implement OnFragmentInteractionListener");
92 | }
93 | }
94 |
95 | @Override
96 | public void onDetach() {
97 | super.onDetach();
98 | mListener = null;
99 | }
100 |
101 | /**
102 | * This interface must be implemented by activities that contain this
103 | * fragment to allow an interaction in this fragment to be communicated
104 | * to the activity and potentially other fragments contained in that
105 | * activity.
106 | *
107 | * See the Android Training lesson Communicating with Other Fragments for more information.
110 | */
111 | public interface OnFragmentInteractionListener {
112 | // TODO: Update argument type and name
113 | void onFragmentInteraction(Uri uri);
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cbitss/careforu/AlarmActivity.java:
--------------------------------------------------------------------------------
1 | package com.cbitss.careforu;
2 |
3 | import android.content.Intent;
4 | import android.icu.text.DateFormat;
5 | import android.icu.text.SimpleDateFormat;
6 | import android.icu.util.Calendar;
7 | import android.os.Build;
8 | import android.os.Bundle;
9 | import android.support.annotation.RequiresApi;
10 | import android.support.v7.app.AppCompatActivity;
11 | import android.view.View;
12 | import android.view.Window;
13 | import android.widget.Button;
14 | import android.widget.TextView;
15 |
16 | import java.util.ArrayList;
17 |
18 | public class AlarmActivity extends AppCompatActivity {
19 |
20 | @RequiresApi(api = Build.VERSION_CODES.N)
21 | @Override
22 | protected void onCreate(Bundle savedInstanceState) {
23 |
24 | super.onCreate(savedInstanceState);
25 | supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
26 | setContentView(R.layout.activity_alarm);
27 | TextView tv=(TextView)findViewById(R.id.AlarmActtextView) ;
28 | TextView name = (TextView) findViewById(R.id.medname);
29 | TextView inst = (TextView) findViewById(R.id.instructions);
30 |
31 | Intent i=getIntent();
32 | int a=i.getExtras().getInt("AlarmActivityid");
33 | DatabaseHandler dh= new DatabaseHandler(this);
34 | ArrayList ar=dh.getReminder(a);
35 |
36 | DateFormat df = new SimpleDateFormat("EEE, d MMM yyyy, HH:mm");
37 | String date = df.format(Calendar.getInstance().getTime());
38 | tv.setText(date);
39 | name.setText(ar.get(1).toString());
40 | String instructions = ar.get(2).toString();
41 | if(instructions.compareTo("")==0)
42 | inst.setVisibility(View.GONE);
43 | else
44 | inst.setText(instructions);
45 |
46 | Button stop=(Button)findViewById(R.id.stop);
47 |
48 | stop.setOnClickListener(new View.OnClickListener() {
49 | public void onClick(View v) {
50 | AlarmReceiver.ringtone.stop();
51 | finish();
52 | //android.os.Process.killProcess(android.os.Process.myPid());
53 | //System.exit(1);
54 | }
55 | });
56 |
57 |
58 |
59 |
60 | }
61 |
62 | @Override
63 | public void onBackPressed() {
64 | AlarmReceiver.ringtone.stop();
65 | finish();
66 | }
67 | }
68 |
69 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cbitss/careforu/AlarmReceiver.java:
--------------------------------------------------------------------------------
1 | package com.cbitss.careforu;
2 |
3 | import android.app.AlarmManager;
4 | import android.app.PendingIntent;
5 | import android.content.BroadcastReceiver;
6 | import android.content.Context;
7 | import android.content.Intent;
8 | import android.media.Ringtone;
9 | import android.media.RingtoneManager;
10 | import android.net.Uri;
11 | import android.os.SystemClock;
12 | import android.util.Log;
13 | import android.widget.Toast;
14 |
15 | import java.text.SimpleDateFormat;
16 | import java.util.ArrayList;
17 | import java.util.Calendar;
18 |
19 | /**
20 | * Created by Harpreet on 12/23/2016.
21 | */
22 | public class AlarmReceiver extends BroadcastReceiver {
23 | static Ringtone ringtone;
24 | String ending_date;
25 | @Override
26 | public void onReceive(Context context, Intent intent) {
27 |
28 | int a=intent.getIntExtra("Reminderid",2332);
29 | Log.d("integeralarmReceiver ",""+a);
30 |
31 | DatabaseHandler dh= new DatabaseHandler(context);
32 | ArrayList all=dh.getReminder(a);
33 | ending_date= (String) all.get(10);
34 | if( checkEndingDate()==0)
35 | {
36 | Toast.makeText(context, "received", Toast.LENGTH_SHORT).show();
37 | Uri alarmUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM);
38 | if (alarmUri == null) {
39 | alarmUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
40 |
41 | }
42 |
43 | //this will update the UI with message
44 | ringtone = RingtoneManager.getRingtone(context, alarmUri);
45 | ringtone.play();
46 |
47 | Intent i = new Intent().setClass(context,AlarmActivity.class);
48 | i.putExtra("AlarmActivityid",a);
49 | i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
50 | context.startActivity(i);
51 | }
52 | else
53 | {
54 |
55 | AlarmManager alarmMgr = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
56 | int times=Integer.parseInt((String) all.get(4));
57 | if(times>1)
58 | {
59 | for(int i=0;i mColors;
51 | private final Random mRandom;
52 |
53 | public static ColorGenerator create(List colorList) {
54 | return new ColorGenerator(colorList);
55 | }
56 |
57 | private ColorGenerator(List colorList) {
58 | mColors = colorList;
59 | mRandom = new Random(System.currentTimeMillis());
60 | }
61 |
62 | public int getRandomColor() {
63 | return mColors.get(mRandom.nextInt(mColors.size()));
64 | }
65 |
66 | public int getColor(Object key) {
67 | return mColors.get(Math.abs(key.hashCode()) % mColors.size());
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cbitss/careforu/CustomAdapter.java:
--------------------------------------------------------------------------------
1 | package com.cbitss.careforu;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.support.v4.view.PagerAdapter;
6 | import android.support.v4.view.ViewPager;
7 | import android.util.Log;
8 | import android.view.LayoutInflater;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 | import android.view.animation.Animation;
12 | import android.view.animation.AnimationUtils;
13 | import android.widget.ImageView;
14 |
15 | public class CustomAdapter extends PagerAdapter {
16 |
17 | Context context;
18 | int[] imageId = {R.drawable.tip1, R.drawable.tip2, R.drawable.tip3,R.drawable.tip4,R.drawable.tip5};
19 |
20 | public CustomAdapter(Context context){
21 | this.context = context;
22 |
23 | }
24 |
25 | public static int cposition=0;
26 |
27 | @Override
28 | public Object instantiateItem(ViewGroup container, int position) {
29 | // TODO Auto-generated method stub
30 |
31 | position=cposition;
32 | LayoutInflater inflater = ((Activity)context).getLayoutInflater();
33 | Log.d("ffffffffffffffffffff",""+cposition);
34 | View viewItem = inflater.inflate(R.layout.imageitem, container, false);
35 | ImageView imageView = (ImageView) viewItem.findViewById(R.id.imageView);
36 | imageView.setImageResource(imageId[cposition%imageId.length]);
37 | imageView.setScaleType(ImageView.ScaleType.FIT_XY);
38 | cposition++;
39 |
40 | Animation rotateimage = AnimationUtils.loadAnimation(context, R.anim.slidingimages);
41 | imageView.startAnimation(rotateimage);
42 |
43 | ((ViewPager)container).addView(viewItem);
44 |
45 | return viewItem;
46 | }
47 |
48 | @Override
49 | public int getCount() {
50 | // TODO Auto-generated method stub
51 | return imageId.length;
52 | }
53 |
54 | @Override
55 | public boolean isViewFromObject(View view, Object object) {
56 | // TODO Auto-generated method stub
57 |
58 | return view == ((View)object);
59 | }
60 |
61 |
62 | @Override
63 | public void destroyItem(ViewGroup container, int position, Object object) {
64 | // TODO Auto-generated method stub
65 | ((ViewPager) container).removeView((View) object);
66 | }
67 |
68 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/cbitss/careforu/CustomDialogClass.java:
--------------------------------------------------------------------------------
1 | package com.cbitss.careforu;
2 |
3 | import android.app.Activity;
4 | import android.app.Dialog;
5 | import android.content.Context;
6 | import android.content.Intent;
7 | import android.os.Bundle;
8 | import android.view.View;
9 | import android.view.Window;
10 | import android.widget.ImageView;
11 | import android.widget.TextView;
12 |
13 | /**
14 | * Created by Harpreet on 1/3/2017.
15 | */
16 |
17 | public class CustomDialogClass extends Dialog implements
18 | View.OnClickListener {
19 |
20 | public Activity c;
21 | TextView textView;
22 | public Dialog d;
23 | int img=0;
24 | ImageView g1,g2,g3,b1,b2,b3;
25 | Context con;
26 |
27 | public CustomDialogClass(Activity a, Context c) {
28 | super(a);
29 | // TODO Auto-generated constructor stub
30 | this.c = a;
31 | con=c;
32 | }
33 |
34 | @Override
35 | protected void onCreate(Bundle savedInstanceState) {
36 | super.onCreate(savedInstanceState);
37 | requestWindowFeature(Window.FEATURE_NO_TITLE);
38 | setContentView(R.layout.custom_dialog);
39 | g1=(ImageView)findViewById(R.id.g1);
40 | g2=(ImageView)findViewById(R.id.g2);
41 | g3=(ImageView)findViewById(R.id.g3);
42 | b1=(ImageView)findViewById(R.id.b1);
43 | b2=(ImageView)findViewById(R.id.b2);
44 | b3=(ImageView)findViewById(R.id.b3);
45 | textView=(TextView)findViewById(R.id.dia_name) ;
46 | g1.setOnClickListener(this); g2.setOnClickListener(this); g3.setOnClickListener(this);
47 | b1.setOnClickListener(this);b2.setOnClickListener(this);b3.setOnClickListener(this);
48 |
49 | }
50 |
51 | @Override
52 | public void onClick(View v) {
53 | switch (v.getId()) {
54 | case R.id.g1:
55 | img=R.drawable.girlone;
56 | break;
57 | case R.id.g2:
58 | img=R.drawable.girlthree;
59 | break;
60 | case R.id.g3:
61 | img=R.drawable.girlfour;
62 | break;
63 | case R.id.b1:
64 | img=R.drawable.boy;
65 | break;
66 | case R.id.b2:
67 | img=R.drawable.boytwo;
68 | break;
69 | case R.id.b3:
70 | img=R.drawable.boythree;
71 | break;
72 | default:
73 | break;
74 | }
75 |
76 | String s=textView.getText().toString();
77 | Intent in=new Intent(con,MainActivity.class);
78 | in.putExtra("id",img);
79 | in.putExtra("text",s);
80 |
81 | in.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
82 | con.startActivity(in);
83 | c.finish();
84 |
85 | dismiss();
86 | }
87 |
88 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/cbitss/careforu/CustomGrid.java:
--------------------------------------------------------------------------------
1 | package com.cbitss.careforu;
2 |
3 | /**
4 | * Created by Rishab on 6/28/2017.
5 | */
6 |
7 | import android.content.Context;
8 | import android.view.LayoutInflater;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 | import android.widget.BaseAdapter;
12 | import android.widget.ImageView;
13 | import android.widget.TextView;
14 |
15 | public class CustomGrid extends BaseAdapter{
16 | private Context mContext;
17 | private final String[] text;
18 | private final int[] Imageid;
19 |
20 | public CustomGrid(Context c,String[] text,int[] Imageid ) {
21 | mContext = c;
22 | this.Imageid = Imageid;
23 | this.text = text;
24 | }
25 |
26 | @Override
27 | public int getCount() {
28 | // TODO Auto-generated method stub
29 | return text.length;
30 | }
31 |
32 | @Override
33 | public Object getItem(int position) {
34 | // TODO Auto-generated method stub
35 | return null;
36 | }
37 |
38 | @Override
39 | public long getItemId(int position) {
40 | // TODO Auto-generated method stub
41 | return 0;
42 | }
43 |
44 | @Override
45 | public View getView(int position, View convertView, ViewGroup parent) {
46 | // TODO Auto-generated method stub
47 | View grid;
48 | LayoutInflater inflater = (LayoutInflater) mContext
49 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
50 |
51 | if (convertView == null) {
52 |
53 | grid = new View(mContext);
54 | grid = inflater.inflate(R.layout.grid_single, null);
55 | TextView textView = (TextView) grid.findViewById(R.id.grid_text);
56 | ImageView imageView = (ImageView)grid.findViewById(R.id.grid_image);
57 | textView.setText(text[position]);
58 | imageView.setImageResource(Imageid[position]);
59 | } else {
60 | grid = (View) convertView;
61 | }
62 |
63 | return grid;
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cbitss/careforu/CustomList.java:
--------------------------------------------------------------------------------
1 | package com.cbitss.careforu;
2 |
3 | /**
4 | * Created by Harpreet on 1/3/2017.
5 | */
6 |
7 | import android.app.Activity;
8 | import android.graphics.Color;
9 | import android.graphics.Typeface;
10 | import android.util.Log;
11 | import android.util.TypedValue;
12 | import android.view.LayoutInflater;
13 | import android.view.View;
14 | import android.view.ViewGroup;
15 | import android.widget.ArrayAdapter;
16 | import android.widget.ImageView;
17 | import android.widget.TextView;
18 |
19 | import java.util.List;
20 | import java.util.Random;
21 |
22 | /**
23 | * Created by Belal on 7/22/2015.
24 | */
25 | public class CustomList extends ArrayAdapter {
26 | private List names;
27 | private String[] desc;
28 | private Activity context;
29 |
30 | public CustomList(Activity context, List names, String[] desc) {
31 | super(context, R.layout.list_medinfo, names);
32 | this.context = context;
33 | this.names = names;
34 | this.desc = desc;
35 |
36 | }
37 | String color_hex[]={"#ff4000","#0000ff","#003EFF","#5C246E","#8B668B","#CD2990","#D41A1F","#FBDB0C","#FF6600"};
38 | @Override
39 | public View getView(int position, View convertView, ViewGroup parent) {
40 | //********************************************************************
41 | ViewHolder holder;
42 | LayoutInflater inflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
43 | // If holder not exist then locate all view from UI file.
44 | if (convertView == null) {
45 | // inflate UI from XML file
46 | convertView = inflater.inflate(R.layout.list_medinfo, parent, false);
47 | // get all UI view
48 | holder = new ViewHolder(convertView);
49 | // set tag for holder
50 | convertView.setTag(holder);
51 | } else {
52 | // if holder created, get tag from view
53 | holder = (ViewHolder) convertView.getTag();
54 | }
55 |
56 | holder.textView.setText(getItem(position));
57 | String firstLetter = null;
58 | //get first letter of each String item
59 |
60 | Log.d("String",getItem(position));
61 | String str=getItem(position);
62 |
63 | firstLetter=String.valueOf(str.charAt(0)).toUpperCase();
64 | // firstLetter.toUpperCase();
65 | ColorGenerator generator = ColorGenerator.MATERIAL; // or use DEFAULT
66 | // generate random color
67 | //int color = generator.getColor(getItem(position));
68 |
69 | int color = generator.getRandomColor();
70 | int pos= new Random().nextInt(color_hex.length);
71 | color = Color.parseColor(color_hex[pos]);
72 | Log.d("Color",""+pos);
73 |
74 | TextDrawable drawable = TextDrawable.builder()
75 | .buildRound(firstLetter, color); // radius in px
76 |
77 | holder.imageView.setImageDrawable(drawable);
78 |
79 | return convertView;
80 | //***********************************************************************
81 | /* LayoutInflater inflater = context.getLayoutInflater();
82 | View listViewItem = inflater.inflate(R.layout.list_medinfo, null, true);
83 | TextView textViewName = (TextView) listViewItem.findViewById(R.id.medname);
84 | TextView textViewDesc = (TextView) listViewItem.findViewById(R.id.textViewDesc);
85 | ImageView image = (ImageView) listViewItem.findViewById(R.id.imageView);
86 |
87 | textViewName.setText(names.get(position).toString());
88 | textViewDesc.setText(desc[position]);
89 | image.setImageResource(imageid[position]);
90 | return listViewItem;*/
91 | }
92 |
93 | private class ViewHolder {
94 | private ImageView imageView;
95 | private TextView textView;
96 |
97 | public ViewHolder(View v) {
98 | imageView = (ImageView) v.findViewById(R.id.medimage);
99 | textView = (TextView) v.findViewById(R.id.medname);
100 | Typeface typeface=Typeface.createFromAsset(context.getAssets(), "fonts/georgia.ttf");
101 | textView.setTypeface(typeface);
102 | textView.setTextSize(TypedValue.COMPLEX_UNIT_SP,20);
103 | }
104 | }
105 | }
106 |
107 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cbitss/careforu/DatabaseHandler.java:
--------------------------------------------------------------------------------
1 | package com.cbitss.careforu;
2 |
3 | import android.content.ContentValues;
4 | import android.content.Context;
5 | import android.database.Cursor;
6 | import android.database.sqlite.SQLiteDatabase;
7 | import android.database.sqlite.SQLiteOpenHelper;
8 | import android.util.Log;
9 |
10 | import java.util.ArrayList;
11 | import java.util.List;
12 |
13 | /**
14 | * Created by Harpreet on 12/24/2016.
15 | */
16 |
17 | public class DatabaseHandler extends SQLiteOpenHelper {
18 |
19 | // All Static variables
20 | // Database Version
21 | private static final int DATABASE_VERSION = 1;
22 |
23 | // Database Name
24 | private static final String DATABASE_NAME = "ReminderManager";
25 |
26 | // table name
27 | private static final String TABLE_REMINDERS = "Reminders";
28 | private static final String TABLE_TIPS = "Tips";
29 |
30 | // Table Columns names
31 |
32 | public DatabaseHandler(Context context) {
33 | super(context, DATABASE_NAME, null, DATABASE_VERSION);
34 | }
35 |
36 | // Creating Tables
37 | @Override
38 | public void onCreate(SQLiteDatabase db) {
39 | String CREATE_REMINDERS_TABLE = "CREATE TABLE " + TABLE_REMINDERS + "( counter INTEGER PRIMARY KEY , medname TEXT , medinfo TEXT,"+
40 | "interval INTEGER ,TimeUnit TEXT,Freq INTEGER,weekdays TEXT,Times TEXT, StartTime TEXT,StartDate DATE,EndDate DATE)";
41 | db.execSQL(CREATE_REMINDERS_TABLE);
42 | String CREATE_TIPS_TABLE = "CREATE TABLE " + TABLE_TIPS + "( id INTEGER PRIMARY KEY, title TEXT,"+
43 | "intro_text TEXT )";
44 | db.execSQL(CREATE_TIPS_TABLE);
45 | Log.d("DatabaseHandler","Database Created");
46 | }
47 |
48 | // Upgrading database
49 | @Override
50 | public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
51 | // Drop older table if existed
52 | db.execSQL("DROP TABLE IF EXISTS " + TABLE_REMINDERS);
53 | db.execSQL("DROP TABLE IF EXISTS " + TABLE_TIPS);
54 | // Create tables again
55 | onCreate(db);
56 | }
57 |
58 | int deleteReminder(String name)
59 | {
60 | SQLiteDatabase db = this.getWritableDatabase();
61 | return db.delete(TABLE_REMINDERS,"medname" + "='" + name + "'",null);
62 | }
63 |
64 | void addReminder(ArrayList al) {
65 | SQLiteDatabase db = this.getWritableDatabase();
66 |
67 | ContentValues values = new ContentValues();
68 | values.put("counter", (int) al.get(0));
69 | values.put("medname", ""+al.get(1));
70 | values.put("medinfo", ""+al.get(2));
71 | values.put("interval", (int) al.get(3));
72 | values.put("TimeUnit", ""+al.get(4));
73 | values.put("Freq", ""+al.get(5));
74 | values.put("weekdays", ""+al.get(6));
75 | values.put("Times",""+al.get(7));
76 | values.put("StartTime", ""+al.get(8));
77 | values.put("StartDate", ""+al.get(9));
78 | values.put("EndDate", ""+al.get(10));
79 |
80 | // Inserting Row
81 | db.insert(TABLE_REMINDERS, null, values);
82 | Log.d("Inserted:","Row Inserted");
83 | db.close(); // Closing database connection
84 |
85 | ArrayList all=new ArrayList();
86 | all.add(al.get(0));
87 | all.add(al.get(1));
88 | //final boolean hi = al.add("hi");
89 | FragmentReminder rm=new FragmentReminder();
90 | rm.receiveData(al);
91 | }
92 |
93 | void addTips(ArrayList al) {
94 | SQLiteDatabase db = this.getWritableDatabase();
95 | ContentValues values = new ContentValues();
96 | values.put("id", (int)al.get(0));
97 | values.put("title", ""+al.get(1));
98 | values.put("intro_text", ""+al.get(2));
99 |
100 | // Inserting Row
101 | db.insert(TABLE_TIPS, null, values);
102 | Log.d("Inserted:",values+"");
103 | db.close(); // Closing database connection
104 | }
105 |
106 |
107 |
108 | // Getting single contact
109 | ArrayList getReminder(int count) {
110 | SQLiteDatabase db = this.getReadableDatabase();
111 |
112 | Cursor cursor = db.query(TABLE_REMINDERS, new String[] { "counter","medname",
113 | "medinfo", "interval","TimeUnit","Freq","weekdays","Times","StartTime","StartDate","EndDate"}, "counter" + "=?",
114 | new String[] { ""+count },null,null,null,null);
115 | if (cursor != null)
116 | cursor.moveToFirst();
117 |
118 | ArrayList al=new ArrayList();
119 |
120 | al.add(cursor.getString(0));al.add(cursor.getString(1));al.add(cursor.getString(2));al.add(cursor.getString(3));
121 | al.add(cursor.getString(4));al.add(cursor.getString(5));al.add(cursor.getString(6));al.add(cursor.getString(7));
122 | al.add(cursor.getString(8));al.add(cursor.getString(9));al.add(cursor.getString(10));
123 |
124 | return al;
125 |
126 | }
127 |
128 | // Getting All Contacts
129 | public ArrayList getAllReminders() {
130 | ArrayList ReminderList = new ArrayList();
131 | // Select All Query
132 | String selectQuery = "SELECT * FROM " + TABLE_REMINDERS;
133 |
134 | SQLiteDatabase db = this.getWritableDatabase();
135 | Cursor cursor = db.rawQuery(selectQuery, null);
136 |
137 | // looping through all rows and adding to list
138 | if (cursor.moveToFirst()){
139 | do{
140 | ReminderList.add(cursor.getString(1));
141 | }while(cursor.moveToNext());
142 | db.close();
143 | }
144 |
145 | return ReminderList;
146 | }
147 |
148 | public List getAllTips(String path) {
149 | List TipsList = new ArrayList<>();
150 | // Select All Query
151 | String selectQuery = "SELECT * FROM " + TABLE_TIPS;
152 |
153 | SQLiteDatabase db = this.getWritableDatabase();
154 | Cursor cursor = db.rawQuery(selectQuery, null);
155 |
156 | // looping through all rows and adding to list
157 | if (cursor.moveToFirst()) {
158 | do {
159 |
160 | TipsList.add(new FirstAidCard(Integer.parseInt(cursor.getString(0)),cursor.getString(1),
161 | cursor.getString(2),"file://"+path+"/"+cursor.getString(0)+"_0.jpg"));
162 | } while (cursor.moveToNext());
163 | }
164 | db.close();
165 |
166 | return TipsList;
167 | }
168 |
169 |
170 | // Getting Reminder Count
171 | public int getRemindersCount() {
172 | String countQuery = "SELECT * FROM " + TABLE_REMINDERS;
173 | SQLiteDatabase db = this.getWritableDatabase();
174 | Cursor cursor = db.rawQuery(countQuery, null);
175 | if(cursor.getCount()==0)
176 | return 0;
177 | // looping through all rows and adding to list
178 | cursor.moveToLast();
179 | int count=Integer.parseInt(cursor.getString(0));
180 |
181 | db.close();
182 | return count;
183 | }
184 |
185 | public ArrayList getReminder(String s) {
186 | SQLiteDatabase db = this.getReadableDatabase();
187 |
188 | Cursor cursor = db.query(TABLE_REMINDERS, new String[] { "counter","medname",
189 | "medinfo", "interval","TimeUnit","Freq","weekdays","Times","StartTime","StartDate","EndDate"}, "medname" + "=?",
190 | new String[] {s },null,null,null,null);
191 | if (cursor != null)
192 | cursor.moveToFirst();
193 |
194 | ArrayList al=new ArrayList();
195 |
196 | al.add(cursor.getString(0));al.add(cursor.getString(1));al.add(cursor.getString(2));al.add(cursor.getString(3));
197 | al.add(cursor.getString(4));al.add(cursor.getString(5));al.add(cursor.getString(6));al.add(cursor.getString(7));
198 | al.add(cursor.getString(8));al.add(cursor.getString(9));al.add(cursor.getString(10));
199 |
200 | return al;
201 | }
202 | }
203 |
204 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cbitss/careforu/FirstAidCard.java:
--------------------------------------------------------------------------------
1 | package com.cbitss.careforu;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | /**
7 | * Created by Rishab on 12/29/2016.
8 | */
9 |
10 | public class FirstAidCard {
11 |
12 | int id;
13 | String title,content;
14 | String imageId;
15 |
16 | FirstAidCard(int id,String title,String content,String imageId)
17 | {
18 | this.title = title;
19 | this.id=id;
20 | this.content = content;
21 | this.imageId = imageId;
22 | }
23 |
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cbitss/careforu/FirstAidContentAdapter.java:
--------------------------------------------------------------------------------
1 | package com.cbitss.careforu;
2 |
3 | import android.support.v4.app.Fragment;
4 | import android.support.v4.app.FragmentManager;
5 | import android.support.v4.app.FragmentStatePagerAdapter;
6 |
7 | import static android.icu.lang.UCharacter.GraphemeClusterBreak.T;
8 |
9 | /**
10 | * Created by Rishab on 1/3/2017.
11 | */
12 |
13 | public class FirstAidContentAdapter extends FragmentStatePagerAdapter {
14 |
15 | int tabno;
16 | public FirstAidContentAdapter(FragmentManager fm, int t)
17 | {
18 | super(fm);
19 | tabno=t;
20 | }
21 | @Override
22 | public Fragment getItem(int position) {
23 | switch(position)
24 | {
25 | case 0: FirstAidTips firstAidTips= new FirstAidTips();
26 | return firstAidTips;
27 | case 1: FirstAidOffline firstAidOffline= new FirstAidOffline();
28 | return firstAidOffline;
29 | default: return null;
30 | }
31 | }
32 |
33 | @Override
34 | public int getCount() {
35 | return tabno;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cbitss/careforu/FirstAidOffline.java:
--------------------------------------------------------------------------------
1 | package com.cbitss.careforu;
2 |
3 | import android.content.Context;
4 | import android.net.Uri;
5 | import android.os.Bundle;
6 | import android.support.v4.app.Fragment;
7 | import android.support.v4.widget.SwipeRefreshLayout;
8 | import android.support.v7.widget.CardView;
9 | import android.support.v7.widget.LinearLayoutManager;
10 | import android.support.v7.widget.RecyclerView;
11 | import android.util.Log;
12 | import android.view.LayoutInflater;
13 | import android.view.View;
14 | import android.view.ViewGroup;
15 | import android.widget.ListView;
16 | import android.widget.Toast;
17 |
18 | import java.util.ArrayList;
19 | import java.util.List;
20 |
21 | import static android.icu.lang.UCharacter.GraphemeClusterBreak.T;
22 | import static com.cbitss.careforu.R.id.rv;
23 | import static com.google.android.gms.wallet.PaymentInstrumentType.getAll;
24 |
25 |
26 | /**
27 | * A simple {@link Fragment} subclass.
28 | * Activities that contain this fragment must implement the
29 | * {@link OnFragmentInteractionListener} interface
30 | * to handle interaction events.
31 | * Use the {@link FirstAidOffline#newInstance} factory method to
32 | * create an instance of this fragment.
33 | */
34 | public class FirstAidOffline extends Fragment implements SwipeRefreshLayout.OnRefreshListener{
35 | // TODO: Rename parameter arguments, choose names that match
36 | // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
37 | private static final String ARG_PARAM1 = "param1";
38 | private static final String ARG_PARAM2 = "param2";
39 |
40 | // TODO: Rename and change types of parameters
41 | private String mParam1;
42 | private String mParam2;
43 | SwipeRefreshLayout swipeRefreshLayout;
44 | private OnFragmentInteractionListener mListener;
45 | RecyclerView rv;
46 | CardView cardView;
47 | List firstAidCardList;
48 |
49 | public FirstAidOffline() {
50 | // Required empty public constructor
51 | }
52 |
53 | /**
54 | * Use this factory method to create a new instance of
55 | * this fragment using the provided parameters.
56 | *
57 | * @param param1 Parameter 1.
58 | * @param param2 Parameter 2.
59 | * @return A new instance of fragment FirstAidOffline.
60 | */
61 | // TODO: Rename and change types and number of parameters
62 | public static FirstAidOffline newInstance(String param1, String param2) {
63 | FirstAidOffline fragment = new FirstAidOffline();
64 | Bundle args = new Bundle();
65 | args.putString(ARG_PARAM1, param1);
66 | args.putString(ARG_PARAM2, param2);
67 | fragment.setArguments(args);
68 | return fragment;
69 | }
70 |
71 | @Override
72 | public void onCreate(Bundle savedInstanceState) {
73 | super.onCreate(savedInstanceState);
74 | if (getArguments() != null) {
75 | mParam1 = getArguments().getString(ARG_PARAM1);
76 | mParam2 = getArguments().getString(ARG_PARAM2);
77 | }
78 | }
79 |
80 | @Override
81 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
82 | Bundle savedInstanceState) {
83 | View v =inflater.inflate(R.layout.fragment_first_aid_tips, container, false);
84 | rv = (RecyclerView)v.findViewById(R.id.rv);
85 | cardView = (CardView) v.findViewById(R.id.card);
86 | // Setting layout manager for recycler view
87 | LinearLayoutManager llm = new LinearLayoutManager(getActivity());
88 | rv.setLayoutManager(llm);
89 | swipeRefreshLayout = (SwipeRefreshLayout)v.findViewById(R.id.tips_swipe_layout);
90 | swipeRefreshLayout.setOnRefreshListener(this);
91 | refresh();
92 | return v;
93 | // Inflate the layout for this fragment
94 | }
95 |
96 |
97 |
98 |
99 | // TODO: Rename method, update argument and hook method into UI event
100 | public void onButtonPressed(Uri uri) {
101 | if (mListener != null) {
102 | mListener.onFragmentInteraction(uri);
103 | }
104 | }
105 |
106 | @Override
107 | public void onAttach(Context context) {
108 | super.onAttach(context);
109 | if (context instanceof OnFragmentInteractionListener) {
110 | mListener = (OnFragmentInteractionListener) context;
111 | } else {
112 | throw new RuntimeException(context.toString()
113 | + " must implement OnFragmentInteractionListener");
114 | }
115 | }
116 |
117 | @Override
118 | public void onDetach() {
119 | super.onDetach();
120 | mListener = null;
121 | }
122 |
123 | @Override
124 | public void onRefresh() {
125 | refresh();
126 | }
127 |
128 | public void refresh()
129 | {
130 | DatabaseHandler dh = new DatabaseHandler(getActivity());
131 | firstAidCardList = dh.getAllTips(getActivity().getExternalFilesDir(null)+"");
132 | FirstAidRVAdapter adapter = new FirstAidRVAdapter(firstAidCardList,getActivity(),true);
133 | rv.setAdapter(adapter);
134 | swipeRefreshLayout.setRefreshing(false);
135 | }
136 | @Override
137 | public void setUserVisibleHint(boolean isVisibleToUser) {
138 | super.setUserVisibleHint(isVisibleToUser);
139 | if(isVisibleToUser){
140 | refresh();
141 | }
142 | }
143 |
144 |
145 |
146 | /**
147 | * This interface must be implemented by activities that contain this
148 | * fragment to allow an interaction in this fragment to be communicated
149 | * to the activity and potentially other fragments contained in that
150 | * activity.
151 | *
152 | * See the Android Training lesson Communicating with Other Fragments for more information.
155 | */
156 | public interface OnFragmentInteractionListener {
157 | // TODO: Update argument type and name
158 | void onFragmentInteraction(Uri uri);
159 | }
160 | }
161 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cbitss/careforu/FirstAidRVAdapter.java:
--------------------------------------------------------------------------------
1 | package com.cbitss.careforu;
2 |
3 | /**
4 | * Created by Rishab on 12/29/2016.
5 | */
6 |
7 | import android.app.ProgressDialog;
8 | import android.content.Context;
9 | import android.content.Intent;
10 | import android.os.AsyncTask;
11 | import android.support.v7.widget.CardView;
12 | import android.support.v7.widget.RecyclerView;
13 | import android.view.LayoutInflater;
14 | import android.view.View;
15 | import android.view.ViewGroup;
16 | import android.widget.ImageView;
17 | import android.widget.TextView;
18 | import android.widget.Toast;
19 |
20 | import com.android.volley.Request;
21 | import com.android.volley.RequestQueue;
22 | import com.android.volley.Response;
23 | import com.android.volley.VolleyError;
24 | import com.android.volley.toolbox.StringRequest;
25 | import com.android.volley.toolbox.Volley;
26 | import com.squareup.picasso.Picasso;
27 |
28 | import java.util.HashMap;
29 | import java.util.List;
30 | import java.util.Map;
31 |
32 | public class FirstAidRVAdapter extends RecyclerView.Adapter{
33 | private static final String CONTENT_URL="http://careforu.esy.es/first_aid_content.php";
34 |
35 | List firstAidList;
36 | boolean offline;
37 | Context context;
38 | String htmlres,photo,text,title; int pid;
39 |
40 | FirstAidRVAdapter(List firstAidList, Context context, boolean offline)
41 | {
42 | this.firstAidList = firstAidList;
43 | this.offline = offline;
44 | this.context = context;
45 | }
46 |
47 |
48 | @Override
49 | public TipsViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
50 | View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.card_view, parent, false);
51 | TipsViewHolder tvh = new TipsViewHolder(v);
52 | return tvh;
53 | }
54 |
55 | @Override
56 | public void onBindViewHolder(TipsViewHolder holder, final int position) {
57 | holder.title.setText(firstAidList.get(position).title);
58 | holder.content.setText(firstAidList.get(position).content);
59 | Picasso.with(context).load(firstAidList.get(position).imageId).into(holder.image);
60 | holder.cv.setOnClickListener(new View.OnClickListener() {
61 | @Override
62 | public void onClick(View v) {
63 | pid = firstAidList.get(position).id;
64 | text = firstAidList.get(position).content;
65 | photo = firstAidList.get(position).imageId;
66 | title = firstAidList.get(position).title;
67 | if(offline)
68 | {
69 | Intent intent = new Intent(context,FirstAidContent.class);
70 | intent.putExtra("pid",pid);
71 | intent.putExtra("offline",true);
72 | intent.putExtra("title",title);
73 | context.startActivity(intent);
74 | }
75 | else
76 | getContent(pid);
77 | }
78 | });
79 | //holder.image.setImageResource(firstAidList.get(position).imageId);
80 |
81 | }
82 |
83 | @Override
84 | public int getItemCount() {
85 | return firstAidList.size();
86 | }
87 |
88 | @Override
89 | public void onAttachedToRecyclerView(RecyclerView recyclerView) {
90 | super.onAttachedToRecyclerView(recyclerView);
91 | }
92 |
93 | public static class TipsViewHolder extends RecyclerView.ViewHolder {
94 | CardView cv;
95 | TextView title;
96 | TextView content;
97 | ImageView image;
98 |
99 | TipsViewHolder(View itemView) {
100 | super(itemView);
101 | cv = (CardView)itemView.findViewById(R.id.card);
102 | title = (TextView)itemView.findViewById(R.id.ftips_title);
103 | content = (TextView)itemView.findViewById(R.id.ftips_content);
104 | image = (ImageView)itemView.findViewById(R.id.ftips_image);
105 | }
106 | }
107 | void loadContent(final int id){
108 |
109 | }
110 |
111 |
112 | private void getContent(final int id) {
113 |
114 | class GetContent extends AsyncTask {
115 | ProgressDialog loading;
116 | @Override
117 | protected void onPreExecute() {
118 | super.onPreExecute();
119 | loading = ProgressDialog.show(context, "Fetching Data...","Please Wait...",true,true);
120 | }
121 |
122 | @Override
123 | protected void onPostExecute(String s) {
124 | super.onPostExecute(s);
125 | }
126 |
127 | @Override
128 | protected String doInBackground(String... params) {
129 | StringRequest stringRequest = new StringRequest(Request.Method.POST,CONTENT_URL,
130 | new Response.Listener() {
131 | @Override
132 | public void onResponse(String response) {
133 | //Toast.makeText(context,response,Toast.LENGTH_LONG).show();
134 | htmlres = response;
135 | loading.dismiss();
136 | Intent intent = new Intent(context,FirstAidContent.class);
137 | intent.putExtra("html",htmlres);
138 | intent.putExtra("offline",false);
139 | intent.putExtra("pid",pid);
140 | intent.putExtra("text",text);
141 | intent.putExtra("photo",photo);
142 | intent.putExtra("title",title);
143 | context.startActivity(intent);
144 | }
145 | },
146 | new Response.ErrorListener() {
147 | @Override
148 | public void onErrorResponse(VolleyError error) {
149 | Toast.makeText(context,error.toString()+"\nPlease Try again in a while",Toast.LENGTH_LONG).show();
150 | }
151 | }){
152 | @Override
153 | protected Map getParams(){
154 | Map params = new HashMap();
155 | params.put("id",String.valueOf(id));
156 | return params;
157 | }
158 |
159 | };
160 |
161 | RequestQueue requestQueue = Volley.newRequestQueue(context);
162 | requestQueue.add(stringRequest);
163 | return null;
164 | }
165 | }
166 | GetContent gc = new GetContent();
167 | gc.execute();
168 | }
169 | }
170 |
171 |
172 | /*//loadImage(firstAidList.get(position).imageId,holder.image);
173 | private void loadImage(String url,ImageView iv){
174 |
175 | class DownloadImageTask extends AsyncTask {
176 | ImageView bmImage;
177 |
178 | public DownloadImageTask(ImageView bmImage) {
179 | this.bmImage = bmImage;
180 | }
181 |
182 | protected Bitmap doInBackground(String... urls) {
183 | String urldisplay = urls[0];
184 | Bitmap mIcon11 = null;
185 | try {
186 | InputStream in = new java.net.URL(urldisplay).openStream();
187 | mIcon11 = BitmapFactory.decodeStream(in);
188 | } catch (Exception e) {
189 | Log.e("Error", e.getMessage());
190 | e.printStackTrace();
191 | }
192 | return mIcon11;
193 | }
194 |
195 | protected void onPostExecute(Bitmap result) {
196 | bmImage.setImageBitmap(result);
197 | }
198 | }
199 |
200 | new DownloadImageTask(iv).execute(url);
201 | }*/
202 |
203 |
204 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cbitss/careforu/FirstAidTips.java:
--------------------------------------------------------------------------------
1 | package com.cbitss.careforu;
2 |
3 | import android.app.ProgressDialog;
4 | import android.content.Context;
5 | import android.net.Uri;
6 | import android.os.AsyncTask;
7 | import android.os.Bundle;
8 | import android.os.Handler;
9 | import android.support.v4.app.Fragment;
10 | import android.support.v4.widget.SwipeRefreshLayout;
11 | import android.support.v7.widget.CardView;
12 | import android.support.v7.widget.LinearLayoutManager;
13 | import android.support.v7.widget.RecyclerView;
14 | import android.util.Log;
15 | import android.view.LayoutInflater;
16 | import android.view.View;
17 | import android.view.ViewGroup;
18 | import android.widget.Toast;
19 |
20 | import java.io.BufferedReader;
21 | import java.io.InputStreamReader;
22 | import java.net.HttpURLConnection;
23 | import java.net.URL;
24 | import java.util.ArrayList;
25 | import java.util.List;
26 |
27 |
28 | /**
29 | * A simple {@link Fragment} subclass.
30 | * Activities that contain this fragment must implement the
31 | * {@link OnFragmentInteractionListener} interface
32 | * to handle interaction events.
33 | * Use the {@link FirstAidTips#newInstance} factory method to
34 | * create an instance of this fragment.
35 | */
36 | public class FirstAidTips extends Fragment {
37 | // TODO: Rename parameter arguments, choose names that match
38 | // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
39 | private static final String ARG_PARAM1 = "param1";
40 | private static final String ARG_PARAM2 = "param2";
41 | RecyclerView rv;
42 | List firstAidCardList;
43 | SwipeRefreshLayout swipeRefreshLayout;
44 | ProgressDialog loading;
45 | private static final String IMAGES_URL = "http://careforu.esy.es/first_aid_tips.php";
46 |
47 | String str[];
48 | CardView cardView;
49 | Fragment fragment;
50 |
51 | // TODO: Rename and change types of parameters
52 | private String mParam1;
53 | private String mParam2;
54 |
55 | private OnFragmentInteractionListener mListener;
56 |
57 | public FirstAidTips() {
58 | // Required empty public constructor
59 | }
60 |
61 | /**
62 | * Use this factory method to create a new instance of
63 | * this fragment using the provided parameters.
64 | *
65 | * @param param1 Parameter 1.
66 | * @param param2 Parameter 2.
67 | * @return A new instance of fragment FirstAidTips.
68 | */
69 | // TODO: Rename and change types and number of parameters
70 | public static FirstAidTips newInstance(String param1, String param2) {
71 | FirstAidTips fragment = new FirstAidTips();
72 | Bundle args = new Bundle();
73 | args.putString(ARG_PARAM1, param1);
74 | args.putString(ARG_PARAM2, param2);
75 | fragment.setArguments(args);
76 | return fragment;
77 | }
78 |
79 | @Override
80 | public void onCreate(Bundle savedInstanceState) {
81 | super.onCreate(savedInstanceState);
82 | if (getArguments() != null) {
83 | mParam1 = getArguments().getString(ARG_PARAM1);
84 | mParam2 = getArguments().getString(ARG_PARAM2);
85 | }
86 | }
87 |
88 | @Override
89 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
90 | Bundle savedInstanceState) {
91 | getActivity().setTitle("First Aid Tips");
92 | fragment = this;
93 | View v =inflater.inflate(R.layout.fragment_first_aid_tips, container, false);
94 | rv = (RecyclerView)v.findViewById(R.id.rv);
95 | cardView = (CardView) v.findViewById(R.id.card);
96 | // Setting layout manager for recycler view
97 | LinearLayoutManager llm = new LinearLayoutManager(getActivity());
98 | rv.setLayoutManager(llm);
99 | swipeRefreshLayout = (SwipeRefreshLayout)v.findViewById(R.id.tips_swipe_layout);
100 | getAll();
101 | swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
102 | @Override
103 | public void onRefresh() {
104 | getAll();
105 | }
106 | });
107 | return v;
108 | }
109 |
110 | // TODO: Rename method, update argument and hook method into UI event
111 | public void onButtonPressed(Uri uri) {
112 | if (mListener != null) {
113 | mListener.onFragmentInteraction(uri);
114 | }
115 | }
116 |
117 | @Override
118 | public void onAttach(Context context) {
119 | super.onAttach(context);
120 | if (context instanceof OnFragmentInteractionListener) {
121 | mListener = (OnFragmentInteractionListener) context;
122 | } else {
123 | throw new RuntimeException(context.toString()
124 | + " must implement OnFragmentInteractionListener");
125 | }
126 | }
127 |
128 | @Override
129 | public void onDetach() {
130 | super.onDetach();
131 | mListener = null;
132 | }
133 |
134 | /**
135 | * This interface must be implemented by activities that contain this
136 | * fragment to allow an interaction in this fragment to be communicated
137 | * to the activity and potentially other fragments contained in that
138 | * activity.
139 | *
140 | * See the Android Training lesson Communicating with Other Fragments for more information.
143 | */
144 | public interface OnFragmentInteractionListener {
145 | // TODO: Update argument type and name
146 | void onFragmentInteraction(Uri uri);
147 | }
148 |
149 | private void getAll() {
150 |
151 | class GetData extends AsyncTask {
152 | @Override
153 | protected void onPreExecute() {
154 | super.onPreExecute();
155 | loading = ProgressDialog.show(getActivity(), "Fetching Data...","Please Wait...",true,true);
156 | }
157 |
158 | @Override
159 | protected void onPostExecute(String s) {
160 | super.onPostExecute(s);
161 | Log.d("hello",s+"");
162 | loading.dismiss();
163 | if(s!=null)
164 | {
165 | str = s.split("~");
166 | //Adding data to list
167 | firstAidCardList = new ArrayList<>();
168 | for(int i=0;i
131 | * See the Android Training lesson Communicating with Other Fragments for more information.
134 | */
135 | public interface OnFragmentInteractionListener {
136 | // TODO: Update argument type and name
137 | void onFragmentInteraction(Uri uri);
138 | }
139 | }
140 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cbitss/careforu/FragmentReminder.java:
--------------------------------------------------------------------------------
1 | package com.cbitss.careforu;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.net.Uri;
6 | import android.os.Bundle;
7 | import android.support.design.widget.FloatingActionButton;
8 | import android.support.v4.app.Fragment;
9 | import android.view.LayoutInflater;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.widget.AdapterView;
13 | import android.widget.ArrayAdapter;
14 | import android.widget.ListView;
15 | import android.widget.TextView;
16 |
17 | import java.util.ArrayList;
18 | import java.util.List;
19 |
20 | import static android.view.View.GONE;
21 |
22 |
23 | /**
24 | * A simple {@link Fragment} subclass.
25 | * Activities that contain this fragment must implement the
26 | * {@link OnFragmentInteractionListener} interface
27 | * to handle interaction events.
28 | * Use the {@link FragmentReminder#newInstance} factory method to
29 | * create an instance of this fragment.
30 | */
31 | public class FragmentReminder extends Fragment implements View.OnClickListener{
32 | // TODO: Rename parameter arguments, choose names that match
33 | // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
34 | private static final String ARG_PARAM1 = "param1";
35 | private static final String ARG_PARAM2 = "param2";
36 |
37 | // TODO: Rename and change types of parameters
38 | private String mParam1;
39 | private String mParam2;
40 | private ArrayList al;
41 | private List list=new ArrayList();
42 | private ArrayAdapter adapter;
43 | ListView lv;
44 | TextView tv;
45 | FloatingActionButton fab;
46 |
47 | private OnFragmentInteractionListener mListener;
48 |
49 | public FragmentReminder() {
50 | // Required empty public constructor
51 | }
52 |
53 | public void receiveData(ArrayList al)
54 | {
55 | this.al=al;
56 | list.add(al.get(0));
57 |
58 | }
59 | /**
60 | * Use this factory method to create a new instance of
61 | * this fragment using the provided parameters.
62 | *
63 | * @param param1 Parameter 1.
64 | * @param param2 Parameter 2.
65 | * @return A new instance of fragment FragmentReminder.
66 | */
67 | // TODO: Rename and change types and number of parameters
68 | public static FragmentReminder newInstance(String param1, String param2) {
69 | FragmentReminder fragment = new FragmentReminder();
70 | Bundle args = new Bundle();
71 | args.putString(ARG_PARAM1, param1);
72 | args.putString(ARG_PARAM2, param2);
73 | fragment.setArguments(args);
74 | return fragment;
75 | }
76 |
77 | @Override
78 | public void onCreate(Bundle savedInstanceState) {
79 | super.onCreate(savedInstanceState);
80 | if (getArguments() != null) {
81 | mParam1 = getArguments().getString(ARG_PARAM1);
82 | mParam2 = getArguments().getString(ARG_PARAM2);
83 | }
84 | }
85 |
86 | //data for customlist************************************************************************************
87 |
88 | private String desc[] = {};
89 |
90 |
91 | //*************************************************************************************
92 |
93 |
94 | @Override
95 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
96 | Bundle savedInstanceState) {
97 | getActivity().setTitle("Medicine Reminder");
98 | View v=inflater.inflate(R.layout.fragment_reminder, container, false);
99 | fab=(FloatingActionButton)v.findViewById(R.id.floatingActionButton);
100 | lv=(ListView)v.findViewById(R.id.rem_lv);
101 | tv=(TextView) v.findViewById(R.id.reminder_tv);
102 |
103 | fab.setOnClickListener(this);
104 | DatabaseHandler db=new DatabaseHandler(getContext());
105 | list=db.getAllReminders();
106 |
107 | if(list.size()==0)
108 | {
109 | lv.setVisibility(GONE);
110 | return v;
111 | }
112 |
113 | tv.setVisibility(GONE);
114 |
115 | adapter = new CustomList(getActivity(),list,desc);
116 | lv.setAdapter(adapter);
117 |
118 | //***Customised list view add***********************************************************************
119 | /* CustomList customList = new CustomList(getActivity(),list, desc);
120 | lv.setAdapter(customList);*/
121 |
122 | lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
123 | @Override
124 | public void onItemClick(AdapterView> adapterView, View view, int i, long l) {
125 | //Toast.makeText(getActivity(),"You Clicked "+list.get(i),Toast.LENGTH_SHORT).show();
126 | //addReminderInCalendar();
127 | Intent in=new Intent(getActivity(),MedRemInfo.class);
128 | in.putExtra("id",list.get(i).toString());
129 | startActivity(in);
130 | }
131 | });
132 | //***************************************************************************
133 |
134 | return v;
135 | }
136 |
137 | // TODO: Rename method, update argument and hook method into UI event
138 | public void onButtonPressed(Uri uri) {
139 | if (mListener != null) {
140 | mListener.onFragmentInteraction(uri);
141 | }
142 | }
143 |
144 | @Override
145 | public void onAttach(Context context) {
146 | super.onAttach(context);
147 | if (context instanceof OnFragmentInteractionListener) {
148 | mListener = (OnFragmentInteractionListener) context;
149 | } else {
150 | throw new RuntimeException(context.toString()
151 | + " must implement OnFragmentInteractionListener");
152 | }
153 | }
154 |
155 | @Override
156 | public void onDetach() {
157 | super.onDetach();
158 | mListener = null;
159 | }
160 |
161 | @Override
162 | public void onClick(View v) {
163 | Intent in=new Intent(getActivity(),AddReminder.class);
164 | startActivity(in);
165 | }
166 |
167 | /**
168 | * This interface must be implemented by activities that contain this
169 | * fragment to allow an interaction in this fragment to be communicated
170 | * to the activity and potentially other fragments contained in that
171 | * activity.
172 | *
173 | * See the Android Training lesson Communicating with Other Fragments for more information.
176 | */
177 | public interface OnFragmentInteractionListener {
178 | // TODO: Update argument type and name
179 | void onFragmentInteraction(Uri uri);
180 | }
181 | }
182 |
183 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cbitss/careforu/GooglePlacesReadTask.java:
--------------------------------------------------------------------------------
1 | package com.cbitss.careforu;
2 |
3 | import android.content.Context;
4 | import android.os.AsyncTask;
5 | import android.util.Log;
6 |
7 | import com.google.android.gms.maps.GoogleMap;
8 |
9 | public class GooglePlacesReadTask extends AsyncTask