├── .github
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
└── pull_request_template.md
├── .gitignore
├── .idea
├── .gitignore
├── .name
├── codeStyles
│ ├── Project.xml
│ └── codeStyleConfig.xml
├── compiler.xml
├── gradle.xml
├── jarRepositories.xml
├── misc.xml
└── vcs.xml
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── README.md
├── app
├── .gitignore
├── build.gradle
├── google-services.json
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── project
│ │ └── absurdnerds
│ │ └── simplify
│ │ └── ExampleInstrumentedTest.kt
│ ├── debug
│ └── res
│ │ └── values
│ │ └── google_maps_api.xml
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── project
│ │ │ └── absurdnerds
│ │ │ └── simplify
│ │ │ ├── FirebaseNotificationService.kt
│ │ │ ├── FragmentChangeInterface.kt
│ │ │ ├── MainApplication.kt
│ │ │ ├── api
│ │ │ ├── ApiInterface.kt
│ │ │ └── SafeApiRequest.kt
│ │ │ ├── data
│ │ │ ├── request
│ │ │ │ ├── AmbulancePostRequest.kt
│ │ │ │ ├── AmbulanceRequest.kt
│ │ │ │ ├── CommonPhoneRequest.kt
│ │ │ │ ├── FireRequest.kt
│ │ │ │ ├── PolicePostRequest.kt
│ │ │ │ ├── ProfilePutRequest.kt
│ │ │ │ └── ProfileRequest.kt
│ │ │ └── response
│ │ │ │ ├── AmbulanceGetResponse.kt
│ │ │ │ ├── FireGetResponse.kt
│ │ │ │ ├── FirePostResponse.kt
│ │ │ │ ├── PoliceGetResponse.kt
│ │ │ │ ├── PolicePostResponse.kt
│ │ │ │ └── ProfilePostResponse.kt
│ │ │ ├── repository
│ │ │ └── NetworkRepository.kt
│ │ │ ├── ui
│ │ │ ├── MainActivity.kt
│ │ │ ├── Maps
│ │ │ │ ├── LocationChangeInterface.kt
│ │ │ │ └── MapsFragment.kt
│ │ │ ├── NewUser
│ │ │ │ ├── NewUserActivity.kt
│ │ │ │ └── UserModel.kt
│ │ │ ├── fire
│ │ │ │ ├── FireActivity.kt
│ │ │ │ ├── FireViewModel.kt
│ │ │ │ └── FireViewState.kt
│ │ │ ├── history
│ │ │ │ ├── FireHistoryActivity.kt
│ │ │ │ └── adapter
│ │ │ │ │ ├── AmbulanceAdapter.kt
│ │ │ │ │ ├── FireAdapter.kt
│ │ │ │ │ └── PoliceAdapter.kt
│ │ │ ├── home
│ │ │ │ └── HomeActivity.kt
│ │ │ ├── login
│ │ │ │ ├── LoginActivity.kt
│ │ │ │ ├── LoginMobileFragment.kt
│ │ │ │ ├── LoginMobileViewModel.kt
│ │ │ │ ├── LoginOTPFragment.kt
│ │ │ │ └── LoginOTPViewModel.kt
│ │ │ ├── medical
│ │ │ │ ├── MedicaViewState.kt
│ │ │ │ ├── MedicalActivity.kt
│ │ │ │ └── MedicalViewModel.kt
│ │ │ └── police
│ │ │ │ ├── PoliceActivity.kt
│ │ │ │ ├── PoliceModel.kt
│ │ │ │ ├── PoliceReportType.kt
│ │ │ │ ├── adapter
│ │ │ │ └── PoliceReportAdapter.kt
│ │ │ │ └── policeReport
│ │ │ │ ├── PoliceReportActivity.kt
│ │ │ │ ├── PoliceReportViewModel.kt
│ │ │ │ └── PoliceReportViewState.kt
│ │ │ └── utils
│ │ │ ├── AppConfig.kt
│ │ │ ├── ReportType.kt
│ │ │ ├── Utils.kt
│ │ │ ├── dialog
│ │ │ └── ViewDialog.kt
│ │ │ ├── lifecycle
│ │ │ └── SingleLiveEvent.kt
│ │ │ └── timber
│ │ │ ├── DebugTree.kt
│ │ │ └── ReleaseTree.kt
│ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ ├── ambulance.gif
│ │ ├── bottom_gradient.xml
│ │ ├── et_background.xml
│ │ ├── fire_gif.gif
│ │ ├── ic_arrow_right.xml
│ │ ├── ic_authentication.xml
│ │ ├── ic_baseline_arrow_back_ios_24.xml
│ │ ├── ic_baseline_info_24.xml
│ │ ├── ic_baseline_local_phone_24.xml
│ │ ├── ic_baseline_location_on_24.xml
│ │ ├── ic_baseline_person_24.xml
│ │ ├── ic_launcher_background.xml
│ │ ├── ic_mobile_login.xml
│ │ ├── police_gif.gif
│ │ ├── signup_bg.xml
│ │ └── simplify_icon.png
│ │ ├── font
│ │ ├── roboto.xml
│ │ └── roboto_medium.xml
│ │ ├── layout
│ │ ├── activity_fire.xml
│ │ ├── activity_fire_history.xml
│ │ ├── activity_home.xml
│ │ ├── activity_login.xml
│ │ ├── activity_main.xml
│ │ ├── activity_medical.xml
│ │ ├── activity_new_user.xml
│ │ ├── activity_police.xml
│ │ ├── activity_police_report.xml
│ │ ├── fragment_maps.xml
│ │ ├── item_history_fire.xml
│ │ ├── item_history_police.xml
│ │ ├── item_police_report.xml
│ │ ├── loading_dialog.xml
│ │ ├── login_mobile_fragment.xml
│ │ └── login_otp_fragment.xml
│ │ ├── menu
│ │ └── menu.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── raw
│ │ └── pikachu_scream.mp3
│ │ ├── values-night
│ │ └── themes.xml
│ │ └── values
│ │ ├── colors.xml
│ │ ├── font_certs.xml
│ │ ├── preloaded_fonts.xml
│ │ ├── strings.xml
│ │ └── themes.xml
│ ├── release
│ └── res
│ │ └── values
│ │ └── google_maps_api.xml
│ └── test
│ └── java
│ └── project
│ └── absurdnerds
│ └── simplify
│ └── ExampleUnitTest.kt
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve.
4 | title: Bug report
5 | labels: bug
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 |
19 |
20 | **Expected behavior**
21 | A clear and concise description of what you expected to happen.
22 |
23 | **Actual behavior**
24 | A clear and concise description of how the code performed w.r.t expectations.
25 |
26 | **Screenshots**
27 | If applicable, add screenshots to help explain your problem.
28 |
29 | **Additional details**
30 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: Feature request
5 | labels: feature
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is.
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Approach to be followed (optional)**
20 | A clear and concise description of approach to be followed.
21 |
22 | **Additional context**
23 | Add any other context or screenshots about the feature request here.
24 |
--------------------------------------------------------------------------------
/.github/pull_request_template.md:
--------------------------------------------------------------------------------
1 | ### What is the change?
2 |
3 |
4 | ### What does it fix/add?
5 |
6 |
7 | ### How was it tested?
8 |
9 |
10 | ## Submissions guide:
11 | - [ ] Have you checked to ensure there aren't other open [Pull Requests](https://github.com/AbsurdNerd/SimplifyReports/pulls) for the same update/change?
12 | - [ ] Have you made corresponding changes to the documentation?
13 | - [ ] Your submission doesn't break any existing feature.
14 | - [ ] Have you lint your code locally prior to submission?
15 |
16 | ### Screenshots (if appropriate):
17 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 | local.properties
16 |
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/.idea/.name:
--------------------------------------------------------------------------------
1 | Simplify
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.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 | xmlns:android
33 |
34 | ^$
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | xmlns:.*
44 |
45 | ^$
46 |
47 |
48 | BY_NAME
49 |
50 |
51 |
52 |
53 |
54 |
55 | .*:id
56 |
57 | http://schemas.android.com/apk/res/android
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 | .*:name
67 |
68 | http://schemas.android.com/apk/res/android
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 | name
78 |
79 | ^$
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 | style
89 |
90 | ^$
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 | .*
100 |
101 | ^$
102 |
103 |
104 | BY_NAME
105 |
106 |
107 |
108 |
109 |
110 |
111 | .*
112 |
113 | http://schemas.android.com/apk/res/android
114 |
115 |
116 | ANDROID_ATTRIBUTE_ORDER
117 |
118 |
119 |
120 |
121 |
122 |
123 | .*
124 |
125 | .*
126 |
127 |
128 | BY_NAME
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
--------------------------------------------------------------------------------
/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/.idea/jarRepositories.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 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as
6 | contributors and maintainers pledge to making participation in our project and
7 | our community a harassment-free experience for everyone, regardless of age, body
8 | size, disability, ethnicity, sex characteristics, gender identity and expression,
9 | level of experience, education, socio-economic status, nationality, personal
10 | appearance, race, religion, or sexual identity and orientation.
11 |
12 | ## Our Standards
13 |
14 | Examples of behavior that contributes to creating a positive environment
15 | include:
16 |
17 | * Using welcoming and inclusive language
18 | * Being respectful of differing viewpoints and experiences
19 | * Gracefully accepting constructive criticism
20 | * Focusing on what is best for the community
21 | * Showing empathy towards other community members
22 |
23 | Examples of unacceptable behavior by participants include:
24 |
25 | * The use of sexualized language or imagery and unwelcome sexual attention or
26 | advances
27 | * Trolling, insulting/derogatory comments, and personal or political attacks
28 | * Public or private harassment
29 | * Publishing others' private information, such as a physical or electronic
30 | address, without explicit permission
31 | * Other conduct which could reasonably be considered inappropriate in a
32 | professional setting
33 |
34 | ## Our Responsibilities
35 |
36 | Project maintainers are responsible for clarifying the standards of acceptable
37 | behavior and are expected to take appropriate and fair corrective action in
38 | response to any instances of unacceptable behavior.
39 |
40 | Project maintainers have the right and responsibility to remove, edit, or
41 | reject comments, commits, code, wiki edits, issues, and other contributions
42 | that are not aligned to this Code of Conduct, or to ban temporarily or
43 | permanently any contributor for other behaviors that they deem inappropriate,
44 | threatening, offensive, or harmful.
45 |
46 | ## Scope
47 |
48 | This Code of Conduct applies both within project spaces and in public spaces
49 | when an individual is representing the project or its community. Examples of
50 | representing a project or community include using an official project e-mail
51 | address, posting via an official social media account, or acting as an appointed
52 | representative at an online or offline event. Representation of a project may be
53 | further defined and clarified by project maintainers.
54 |
55 | ## Enforcement
56 |
57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
58 | reported by contacting the project team. All
59 | complaints will be reviewed and investigated and will result in a response that
60 | is deemed necessary and appropriate to the circumstances. The project team is
61 | obligated to maintain confidentiality with regard to the reporter of an incident.
62 | Further details of specific enforcement policies may be posted separately.
63 |
64 | Project maintainers who do not follow or enforce the Code of Conduct in good
65 | faith may face temporary or permanent repercussions as determined by other
66 | members of the project's leadership.
67 |
68 | ## Attribution
69 |
70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72 |
73 | [homepage]: https://www.contributor-covenant.org
74 |
75 | For answers to common questions about this code of conduct, see
76 | https://www.contributor-covenant.org/faq
77 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contribution
2 |
3 | # How to contribute?
4 |
5 | ## Steps:
6 |
7 |
8 | - Go to [issues](https://github.com/AbsurdNerd/SimplifyReports/issues) & select one upon which you want to work!
9 |
10 | - Fork the [repository](https://github.com/AbsurdNerd/SimplifyReports.git)
11 |
12 | - Clone the fork [repo](https://github.com//SimplifyReports)
13 | - `git clone https://https://github.com//SimplifyReports`
14 |
15 | - Create new branch
16 | - `git checkout -b `
17 |
18 | - Add code/scripts related to your respective issues.
19 | - `git add `
20 |
21 | - Add a commit message !
22 | - `git commit -a -m ""`
23 |
24 | - Push changes
25 | - `git push `
26 |
27 |
28 | - Create pull requests
29 | - Mention the changes you have made. And add screenshot of before and after the changes.
30 |
31 |
32 | When contributing to this repository, please first discuss the change you wish to make via issue,
33 | email, or any other method with the owners of this repository before making a change.
34 |
35 | Please note we have a code of conduct, please follow it in all your interactions with the project.
36 |
37 | ## Pull Request Process
38 |
39 | 1. Ensure any install or build dependencies are removed before the end of the layer when doing a
40 | build.
41 | 2. Update the README.md with details of changes to the interface, this includes new environment
42 | variables, exposed ports, useful file locations and container parameters.
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # SimplifyReport📢
2 |
3 |
4 |
5 |
6 |
7 |
8 | ### About the Project
9 | SimplifyReport is an Android Application with backend on Django REST Framework which simplifies the process of reporting cases of fire 🧯, crimes⚠️ and calling an ambulance🚑.
10 | Immediate help is provided to people in cases of emergencies as these. User can easily post his reports and his neighbours are immediately notified through the application in cases of emergency such as fire outbreak, robbery or any other crime.
11 |
12 |
13 | ## Tech used
14 | - Kotlin
15 | - Model-View-Viewmodel Architecture
16 | - Navigation component
17 | - Retrofit 2
18 | - GSON
19 | - Glide
20 | - Firebase Analytics
21 | - Firebase Auth
22 | - Stetho
23 | - Timber
24 |
25 | ## Requirements
26 | - Android 5.0 and Above
27 | - Min sdk version 21
28 |
29 | ## Permissions
30 | - Internet
31 | - Location
32 |
33 | ## Our Team 😄:
34 |
35 | | S.No. | Name | Role | GitHub Username :octocat: |
36 | | ----- | ------------------ | ------------------------- | ---------------------------------------------------- |
37 | | 1. | Dheeraj Kotwani | Android Developer | [@dheerajkotwani](https://github.com/dheerajkotwani) |
38 | | 2. | Vatsal Kesarwani | Android Developer | [@plazzy99](https://github.com/plazzy99) |
39 | | 3. | Diya Jaiswal | Backend Developer | [@diyajaiswal11](https://github.com/diyajaiswal11) |
40 | | 4. | Manshi Todi | Backend Developer | [@todi-2000](https://github.com/todi-2000) |
41 |
42 | ## Contributors ✨:
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.application'
3 | id 'kotlin-android'
4 | id 'kotlin-kapt'
5 | id 'kotlin-android-extensions'
6 | id 'com.google.gms.google-services'
7 | }
8 |
9 | android {
10 | compileSdkVersion 30
11 | buildToolsVersion "30.0.1"
12 |
13 | defaultConfig {
14 | applicationId "project.absurdnerds.simplify"
15 | minSdkVersion 21
16 | targetSdkVersion 30
17 | versionCode 1
18 | versionName "1.0"
19 |
20 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
21 | }
22 |
23 | buildTypes {
24 | release {
25 | minifyEnabled false
26 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
27 | }
28 | }
29 | compileOptions {
30 | sourceCompatibility JavaVersion.VERSION_1_8
31 | targetCompatibility JavaVersion.VERSION_1_8
32 | }
33 | kotlinOptions {
34 | jvmTarget = '1.8'
35 | }
36 |
37 | buildFeatures {
38 | //noinspection DataBindingWithoutKapt
39 | dataBinding true
40 | }
41 | }
42 |
43 | dependencies {
44 |
45 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
46 | implementation 'androidx.core:core-ktx:1.3.2'
47 | implementation 'androidx.appcompat:appcompat:1.2.0'
48 | implementation 'com.google.android.material:material:1.2.1'
49 | implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
50 | implementation 'androidx.legacy:legacy-support-v4:1.0.0'
51 | implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
52 | implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
53 |
54 | // Sweet Alert
55 | // implementation 'cn.pedant.sweetalert:library:1.3'
56 | implementation 'com.github.f0ris.sweetalert:library:1.5.1'
57 |
58 |
59 | implementation 'androidx.legacy:legacy-support-v4:1.0.0'
60 | implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
61 | implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
62 |
63 | // Country Code Picker
64 | implementation 'com.hbb20:ccp:2.4.0'
65 |
66 | //glide
67 | implementation 'com.github.bumptech.glide:glide:4.11.0'
68 | implementation 'com.google.firebase:firebase-analytics:18.0.0'
69 | implementation 'com.google.firebase:firebase-auth:20.0.0'
70 | implementation 'com.google.firebase:firebase-messaging:21.0.0'
71 | implementation 'com.google.android.gms:play-services-location:17.1.0'
72 | implementation 'com.google.android.gms:play-services-maps:17.0.0'
73 | annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
74 |
75 | implementation 'android.arch.lifecycle:extensions:1.1.1'
76 |
77 | implementation 'org.permissionsdispatcher:permissionsdispatcher:4.8.0'
78 | annotationProcessor 'org.permissionsdispatcher:permissionsdispatcher-processor:4.8.0'
79 |
80 | // Timber
81 | implementation 'com.jakewharton.timber:timber:4.7.1'
82 |
83 | // Stetho
84 | implementation 'com.facebook.stetho:stetho:1.5.1'
85 |
86 | // Retrofit
87 | implementation 'com.squareup.retrofit2:retrofit:2.9.0'
88 | implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
89 |
90 | implementation "androidx.browser:browser:1.2.0"
91 |
92 | testImplementation 'junit:junit:4.+'
93 | androidTestImplementation 'androidx.test.ext:junit:1.1.2'
94 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
95 | }
--------------------------------------------------------------------------------
/app/google-services.json:
--------------------------------------------------------------------------------
1 | {
2 | "project_info": {
3 | "project_number": "730628947794",
4 | "firebase_url": "https://simplify-app-dd4f6.firebaseio.com",
5 | "project_id": "simplify-app-dd4f6",
6 | "storage_bucket": "simplify-app-dd4f6.appspot.com"
7 | },
8 | "client": [
9 | {
10 | "client_info": {
11 | "mobilesdk_app_id": "1:730628947794:android:5a9af0819bad6eebe4c48b",
12 | "android_client_info": {
13 | "package_name": "project.absurdnerds.simplify"
14 | }
15 | },
16 | "oauth_client": [
17 | {
18 | "client_id": "730628947794-ucs3e1rk06ofi00iv6pn8u1vaijs5hl1.apps.googleusercontent.com",
19 | "client_type": 3
20 | }
21 | ],
22 | "api_key": [
23 | {
24 | "current_key": "AIzaSyA_0zQ8Zg8FnE5iuOn40r35it_j1q7kmrA"
25 | }
26 | ],
27 | "services": {
28 | "appinvite_service": {
29 | "other_platform_oauth_client": [
30 | {
31 | "client_id": "730628947794-ucs3e1rk06ofi00iv6pn8u1vaijs5hl1.apps.googleusercontent.com",
32 | "client_type": 3
33 | }
34 | ]
35 | }
36 | }
37 | }
38 | ],
39 | "configuration_version": "1"
40 | }
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/app/src/androidTest/java/project/absurdnerds/simplify/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 | assertEquals("project.absurdnerds.simplify", appContext.packageName)
23 | }
24 | }
--------------------------------------------------------------------------------
/app/src/debug/res/values/google_maps_api.xml:
--------------------------------------------------------------------------------
1 |
2 |
23 | AIzaSyA_0zQ8Zg8FnE5iuOn40r35it_j1q7kmrA
24 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
10 |
11 |
12 |
13 |
14 |
15 |
24 |
25 |
33 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
49 |
52 |
55 |
60 |
63 |
64 |
67 |
68 |
69 |
70 |
71 |
72 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/FirebaseNotificationService.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify
2 |
3 | import android.content.ContentResolver
4 | import android.media.RingtoneManager
5 | import android.net.Uri
6 | import androidx.core.app.NotificationCompat
7 | import androidx.core.app.NotificationManagerCompat
8 | import com.google.firebase.messaging.FirebaseMessagingService
9 | import com.google.firebase.messaging.RemoteMessage
10 | import timber.log.Timber.e
11 |
12 |
13 | class FirebaseNotificationService: FirebaseMessagingService() {
14 |
15 | override fun onMessageReceived(message: RemoteMessage) {
16 | super.onMessageReceived(message)
17 |
18 | e("Notification Received")
19 | if (message.notification != null) {
20 | val title = message.notification!!.title.toString()
21 | val body = message.notification!!.body.toString()
22 | // val id = message.notification!!.imageUrl
23 |
24 | e(title)
25 | e(body)
26 |
27 |
28 | val CHANNEL_ID = "101"
29 | val vibrate = longArrayOf(0, 400)
30 | var builder = NotificationCompat.Builder(applicationContext, CHANNEL_ID)
31 | .setSmallIcon(R.drawable.ic_launcher_foreground)
32 | .setContentTitle(title)
33 | .setContentText(body)
34 | .setSound(Uri.parse("android.resource://"
35 | + applicationContext.packageName + "/" + R.raw.pikachu_scream))
36 | .setVibrate(vibrate)
37 | .setPriority(NotificationCompat.PRIORITY_HIGH)
38 |
39 | // Toast.makeText(applicationContext,title, Toast.LENGTH_SHORT).show()
40 | // val alarmSound = Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE
41 | // + "://" + applicationContext.packageName + "/raw/pikachu_scream")
42 | // val r = RingtoneManager.getRingtone(applicationContext, alarmSound)
43 | // r.play()
44 |
45 | var notificationManager = NotificationManagerCompat.from(applicationContext)
46 | notificationManager.notify(1, builder.build())
47 | }
48 | }
49 |
50 |
51 |
52 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/FragmentChangeInterface.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify
2 |
3 | import androidx.fragment.app.Fragment
4 |
5 | interface FragmentChangeInterface {
6 |
7 | fun changeFragment(fragment: Fragment)
8 |
9 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/MainApplication.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify
2 |
3 | import android.app.Application
4 | import com.facebook.stetho.BuildConfig
5 | import com.facebook.stetho.Stetho
6 | import project.absurdnerds.simplify.utils.timber.ReleaseTree
7 | import project.absurdnerds.simplify.utils.timber.DebugTree
8 | import timber.log.Timber
9 |
10 | class MainApplication : Application() {
11 |
12 | override fun onCreate() {
13 | super.onCreate()
14 | setDebugTools()
15 | }
16 |
17 | private fun setDebugTools() {
18 | if (BuildConfig.DEBUG) {
19 | Timber.plant(DebugTree())
20 | Stetho.initializeWithDefaults(this)
21 | } else {
22 | Timber.plant(ReleaseTree())
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/api/ApiInterface.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.api
2 |
3 | import com.google.gson.GsonBuilder
4 | import project.absurdnerds.simplify.data.request.*
5 | import project.absurdnerds.simplify.data.response.*
6 | import project.absurdnerds.simplify.utils.AppConfig
7 | import retrofit2.Call
8 | import retrofit2.Response
9 | import retrofit2.Retrofit
10 | import retrofit2.converter.gson.GsonConverterFactory
11 | import retrofit2.http.*
12 |
13 | interface ApiInterface {
14 |
15 | companion object{
16 | operator fun invoke(): ApiInterface {
17 |
18 | var gson = GsonBuilder()
19 | .setLenient()
20 | .create()
21 |
22 | return Retrofit.Builder()
23 | .baseUrl(AppConfig.BASE_URL)
24 | .addConverterFactory(GsonConverterFactory.create(gson))
25 | .build()
26 | .create(ApiInterface::class.java)
27 | }
28 | }
29 |
30 | // Get User
31 | @Headers("Content-Type: application/json")
32 | @GET("profile/")
33 | suspend fun putUser(
34 | @Body putPhoneRequest: ProfilePutRequest
35 | ): Response
36 |
37 | // Get User
38 | @Headers("Content-Type: application/json")
39 | @GET("profile/")
40 | fun getProfile(
41 | @Body commonPhoneRequest: CommonPhoneRequest
42 | ): Call
43 |
44 | // Profile
45 | @Headers("Content-Type: application/json")
46 | @PUT("profile/")
47 | fun putProfileToken(
48 | @Body putPhoneRequest: ProfilePutRequest
49 | ): Call
50 |
51 | @Headers("Content-Type: application/json")
52 | @POST("profile/")
53 | fun postProfileData(
54 | @Body profileRequest: ProfileRequest
55 | ): Call
56 |
57 | // Ambulance
58 | @Headers("Content-Type: application/json")
59 | @POST("ambulance/")
60 | fun postAmbulanceData(
61 | @Body ambulancePostRequest: AmbulancePostRequest
62 | ): Call
63 |
64 | // Fire
65 | @Headers("Content-Type: application/json")
66 | @POST("fire/")
67 | fun postFireData(
68 | @Body fireRequest: FireRequest
69 | ): Call
70 |
71 | // Police
72 | @Headers("Content-Type: application/json")
73 | @POST("police/")
74 | fun postPoliceData(
75 | @Body policePostRequest: PolicePostRequest
76 | ): Call
77 |
78 |
79 | @Headers("Content-Type: application/json")
80 | @GET("ambulance/")
81 | fun getAmbulance(
82 | @Query("phone") phone: String
83 | ) : Call
84 |
85 | @Headers("Content-Type: application/json")
86 | @GET("fire/")
87 | fun getFire(
88 | @Query("phone") phone: String
89 | ) : Call
90 |
91 | @Headers("Content-Type: application/json")
92 | @GET("police/")
93 | fun getPolice(
94 | @Query("phone") phone: String
95 | ) : Call
96 |
97 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/api/SafeApiRequest.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 Dheeraj Kotwani
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | package project.absurdnerds.simplify.api
26 |
27 | import com.google.android.gms.common.api.ApiException
28 | import retrofit2.Response
29 | import timber.log.Timber
30 | import java.io.IOException
31 |
32 | abstract class SafeApiRequest {
33 |
34 | suspend fun apiRequest(call: suspend() -> Response) : T {
35 |
36 |
37 | val response = call.invoke()
38 |
39 | if (response.body() != null) {
40 |
41 | return response.body()!!
42 |
43 | } else {
44 | throw ApiException(response.code().toString())
45 | }
46 |
47 | }
48 |
49 | suspend fun apiResponseCode(call: suspend() -> Response) : Int {
50 |
51 | val response = call.invoke()
52 |
53 | return response.code()
54 | }
55 |
56 | }
57 |
58 | class ApiException (message : String): Exception(message)
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/data/request/AmbulancePostRequest.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.data.request
2 |
3 | import com.google.gson.annotations.SerializedName
4 | import kotlinx.android.parcel.Parcelize
5 | import android.os.Parcelable
6 |
7 | @Parcelize
8 | class AmbulancePostRequest(
9 |
10 | @SerializedName("patient_name")
11 | var patientName: String? = null,
12 |
13 | @SerializedName("age")
14 | var age: Int? = null,
15 |
16 | @SerializedName("patient_phone_number")
17 | var patientPhoneNumber: String? = null,
18 |
19 | @SerializedName("gender")
20 | var gender: String? = null,
21 |
22 | @SerializedName("blood_group")
23 | var bloodGroup: String? = null,
24 |
25 | @SerializedName("patient_problem")
26 | var patientProblem: String? = null,
27 |
28 | @SerializedName("location")
29 | var location: String? = null,
30 |
31 | @SerializedName("address")
32 | var address: String? = null,
33 |
34 | @SerializedName("user")
35 | var user: String? = null
36 |
37 | ) : Parcelable
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/data/request/AmbulanceRequest.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.data.request
2 |
3 | import com.google.gson.annotations.SerializedName
4 | import kotlinx.android.parcel.Parcelize
5 | import android.os.Parcelable
6 |
7 | @Parcelize
8 | class AmbulanceRequest(
9 |
10 | @SerializedName("id")
11 | var id: Int? = null,
12 |
13 | @SerializedName("patient_name")
14 | var patientName: String? = null,
15 |
16 | @SerializedName("patient_phone_number")
17 | var patientPhoneNumber: String? = null,
18 |
19 | @SerializedName("location")
20 | var location: String? = null,
21 |
22 | @SerializedName("address")
23 | var address: String? = null,
24 |
25 | @SerializedName("age")
26 | var age: Int? = null,
27 |
28 | @SerializedName("gender")
29 | var gender: String? = null,
30 |
31 | @SerializedName("blood_group")
32 | var bloodGroup: String? = null,
33 |
34 | @SerializedName("patient_problem")
35 | var patientProblem: String? = null,
36 |
37 | @SerializedName("created")
38 | var created: String? = null,
39 |
40 | @SerializedName("user")
41 | var user: String? = null
42 |
43 | ) : Parcelable
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/data/request/CommonPhoneRequest.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.data.request
2 |
3 | import com.google.gson.annotations.SerializedName
4 | import kotlinx.android.parcel.Parcelize
5 | import android.os.Parcelable
6 |
7 | @Parcelize
8 | class CommonPhoneRequest(
9 |
10 | @SerializedName("phone")
11 | var phone: String? = null
12 |
13 | ) : Parcelable
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/data/request/FireRequest.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.data.request
2 |
3 | import com.google.gson.annotations.SerializedName
4 | import kotlinx.android.parcel.Parcelize
5 | import android.os.Parcelable
6 |
7 | @Parcelize
8 | class FireRequest(
9 |
10 | @SerializedName("location")
11 | var location: String? = null,
12 |
13 | @SerializedName("address")
14 | var address: String? = null,
15 |
16 | @SerializedName("user")
17 | var user: String? = null
18 |
19 | ) : Parcelable
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/data/request/PolicePostRequest.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.data.request
2 |
3 |
4 | import com.google.gson.annotations.SerializedName
5 | import kotlinx.android.parcel.Parcelize
6 | import android.os.Parcelable
7 |
8 | @Parcelize
9 | class PolicePostRequest(
10 |
11 | @SerializedName("location")
12 | var location: String? = null,
13 |
14 | @SerializedName("address")
15 | var address: String? = null,
16 |
17 | @SerializedName("problem")
18 | var problem: String? = null,
19 |
20 | @SerializedName("problem_description")
21 | var problemDescription: String? = null,
22 |
23 | @SerializedName("image")
24 | var image: String? = null,
25 |
26 | @SerializedName("do_notify")
27 | var doNotify: Boolean? = null,
28 |
29 | @SerializedName("user")
30 | var user: String? = null
31 |
32 | ) : Parcelable
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/data/request/ProfilePutRequest.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.data.request
2 |
3 | import com.google.gson.annotations.SerializedName
4 | import kotlinx.android.parcel.Parcelize
5 | import android.os.Parcelable
6 |
7 | @Parcelize
8 | class ProfilePutRequest(
9 |
10 | @SerializedName("phone")
11 | var phone: String? = null,
12 |
13 | @SerializedName("token")
14 | var token: String? = null
15 |
16 | ) : Parcelable
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/data/request/ProfileRequest.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.data.request
2 |
3 | import com.google.gson.annotations.SerializedName
4 | import kotlinx.android.parcel.Parcelize
5 | import android.os.Parcelable
6 |
7 | @Parcelize
8 | class ProfileRequest(
9 |
10 | @SerializedName("name")
11 | var name: String? = null,
12 |
13 | @SerializedName("phone")
14 | var phone: String? = null,
15 |
16 | @SerializedName("gender")
17 | var gender: String? = null,
18 |
19 | @SerializedName("location")
20 | var location: String? = null,
21 |
22 | @SerializedName("permanent_address")
23 | var permanentAddress: String? = null,
24 |
25 | @SerializedName("token")
26 | var token: String? = null
27 |
28 | ) : Parcelable
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/data/response/AmbulanceGetResponse.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.data.response
2 |
3 | import com.google.gson.annotations.SerializedName
4 | import kotlinx.android.parcel.Parcelize
5 | import android.os.Parcelable
6 |
7 | class AmbulanceGetResponse : ArrayList(){
8 |
9 | @Parcelize
10 | class AmbulanceGetResponseItem(
11 |
12 | @SerializedName("id")
13 | var id: Int? = null,
14 |
15 | @SerializedName("patient_name")
16 | var patientName: String? = null,
17 |
18 | @SerializedName("patient_phone_number")
19 | var patientPhoneNumber: String? = null,
20 |
21 | @SerializedName("location")
22 | var location: String? = null,
23 |
24 | @SerializedName("address")
25 | var address: String? = null,
26 |
27 | @SerializedName("age")
28 | var age: Int? = null,
29 |
30 | @SerializedName("gender")
31 | var gender: String? = null,
32 |
33 | @SerializedName("blood_group")
34 | var bloodGroup: String? = null,
35 |
36 | @SerializedName("patient_problem")
37 | var patientProblem: String? = null,
38 |
39 | @SerializedName("created")
40 | var created: String? = null,
41 |
42 | @SerializedName("user")
43 | var user: String? = null
44 |
45 | ) : Parcelable
46 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/data/response/FireGetResponse.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.data.response
2 |
3 | import com.google.gson.annotations.SerializedName
4 | import kotlinx.android.parcel.Parcelize
5 | import android.os.Parcelable
6 |
7 | class FireGetResponse : ArrayList(){
8 |
9 | @Parcelize
10 | class FireGetResponseItem(
11 |
12 | @SerializedName("id")
13 | var id: Int? = null,
14 |
15 | @SerializedName("location")
16 | var location: String? = null,
17 |
18 | @SerializedName("address")
19 | var address: String? = null,
20 |
21 | @SerializedName("created")
22 | var created: String? = null,
23 |
24 | @SerializedName("user")
25 | var user: String? = null
26 |
27 | ) : Parcelable
28 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/data/response/FirePostResponse.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.data.response
2 |
3 | import com.google.gson.annotations.SerializedName
4 | import kotlinx.android.parcel.Parcelize
5 | import android.os.Parcelable
6 |
7 | @Parcelize
8 | class FirePostResponse(
9 |
10 | @SerializedName("id")
11 | var id: Int? = null,
12 |
13 | @SerializedName("location")
14 | var location: String? = null,
15 |
16 | @SerializedName("address")
17 | var address: String? = null,
18 |
19 | @SerializedName("created")
20 | var created: String? = null,
21 |
22 | @SerializedName("user")
23 | var user: String? = null
24 |
25 | ) : Parcelable
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/data/response/PoliceGetResponse.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.data.response
2 |
3 |
4 | import com.google.gson.annotations.SerializedName
5 | import kotlinx.android.parcel.Parcelize
6 | import android.os.Parcelable
7 |
8 | class PoliceGetResponse : ArrayList(){
9 |
10 | @Parcelize
11 | class PoliceGetResponseItem(
12 |
13 | @SerializedName("id")
14 | var id: Int? = null,
15 |
16 | @SerializedName("location")
17 | var location: String? = null,
18 |
19 | @SerializedName("address")
20 | var address: String? = null,
21 |
22 | @SerializedName("problem")
23 | var problem: String? = null,
24 |
25 | @SerializedName("problem_description")
26 | var problemDescription: String? = null,
27 |
28 | @SerializedName("image")
29 | var image: String? = null,
30 |
31 | @SerializedName("do_notify")
32 | var doNotify: Boolean? = null,
33 |
34 | @SerializedName("created")
35 | var created: String? = null,
36 |
37 | @SerializedName("user")
38 | var user: String? = null
39 |
40 | ) : Parcelable
41 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/data/response/PolicePostResponse.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.data.response
2 |
3 | import com.google.gson.annotations.SerializedName
4 | import kotlinx.android.parcel.Parcelize
5 | import android.os.Parcelable
6 |
7 | @Parcelize
8 | class PolicePostResponse(
9 |
10 | @SerializedName("id")
11 | var id: Int? = null,
12 |
13 | @SerializedName("location")
14 | var location: String? = null,
15 |
16 | @SerializedName("address")
17 | var address: String? = null,
18 |
19 | @SerializedName("problem")
20 | var problem: String? = null,
21 |
22 | @SerializedName("problem_description")
23 | var problemDescription: String? = null,
24 |
25 | @SerializedName("image")
26 | var image: String? = null,
27 |
28 | @SerializedName("do_notify")
29 | var doNotify: Boolean? = null,
30 |
31 | @SerializedName("created")
32 | var created: String? = null,
33 |
34 | @SerializedName("user")
35 | var user: String? = null
36 |
37 | ) : Parcelable
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/data/response/ProfilePostResponse.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.data.response
2 |
3 | import com.google.gson.annotations.SerializedName
4 | import kotlinx.android.parcel.Parcelize
5 | import android.os.Parcelable
6 |
7 | @Parcelize
8 | class ProfilePostResponse(
9 |
10 | @SerializedName("id")
11 | var id: Int? = null,
12 |
13 | @SerializedName("name")
14 | var name: String? = null,
15 |
16 | @SerializedName("phone")
17 | var phone: String? = null,
18 |
19 | @SerializedName("gender")
20 | var gender: String? = null,
21 |
22 | @SerializedName("location")
23 | var location: String? = null,
24 |
25 | @SerializedName("permanent_address")
26 | var permanentAddress: String? = null,
27 |
28 | @SerializedName("token")
29 | var token: String? = null
30 |
31 | ) : Parcelable
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/repository/NetworkRepository.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.repository
2 |
3 | import project.absurdnerds.simplify.api.ApiInterface
4 | import project.absurdnerds.simplify.api.SafeApiRequest
5 | import project.absurdnerds.simplify.data.request.ProfilePutRequest
6 |
7 | /**
8 | * Created by Dheeraj Kotwani on 13-11-2020.
9 | */
10 |
11 | class NetworkRepository(
12 | private val api: ApiInterface
13 | ) : SafeApiRequest() {
14 |
15 | suspend fun putUser (putPhoneRequest: ProfilePutRequest) = apiRequest { api.putUser(putPhoneRequest) }
16 |
17 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/ui/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.ui
2 |
3 | import android.content.Intent
4 | import androidx.appcompat.app.AppCompatActivity
5 | import android.os.Bundle
6 | import project.absurdnerds.simplify.R
7 | import project.absurdnerds.simplify.ui.home.HomeActivity
8 |
9 | class MainActivity : AppCompatActivity() {
10 | override fun onCreate(savedInstanceState: Bundle?) {
11 | super.onCreate(savedInstanceState)
12 | setContentView(R.layout.activity_main)
13 |
14 | startActivity(Intent(this, HomeActivity::class.java))
15 | }
16 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/ui/Maps/LocationChangeInterface.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.Maps
2 |
3 | /**
4 | * Created by Dheeraj Kotwani on 13-11-2020.
5 | */
6 | interface LocationChangeInterface {
7 |
8 | fun onLocationChange(location: String, latLong: String)
9 |
10 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/ui/Maps/MapsFragment.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.Maps
2 |
3 | import android.Manifest
4 | import android.content.pm.PackageManager
5 | import android.location.Address
6 | import android.location.Geocoder
7 | import android.location.Location
8 | import android.os.Bundle
9 | import android.view.LayoutInflater
10 | import android.view.View
11 | import android.view.ViewGroup
12 | import androidx.core.app.ActivityCompat
13 | import androidx.fragment.app.Fragment
14 | import com.google.android.gms.location.LocationServices
15 | import com.google.android.gms.maps.CameraUpdateFactory
16 | import com.google.android.gms.maps.OnMapReadyCallback
17 | import com.google.android.gms.maps.SupportMapFragment
18 | import com.google.android.gms.maps.model.LatLng
19 | import project.absurdnerds.simplify.R
20 | import project.absurdnerds.simplify.utils.REQUEST_CODE_PERMISSIONS
21 | import project.absurdnerds.simplify.utils.REQUIRED_PERMISSIONS
22 | import project.absurdnerds.simplify.utils.allPermissionsGranted
23 |
24 |
25 | class MapsFragment : Fragment() {
26 |
27 | private val DEFAULT_ZOOM = 18f
28 | private var addressList: List? = null
29 |
30 | override fun onCreateView(
31 | inflater: LayoutInflater,
32 | container: ViewGroup?,
33 | savedInstanceState: Bundle?
34 | ): View? {
35 | return inflater.inflate(R.layout.fragment_maps, container, false)
36 | }
37 |
38 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
39 | super.onViewCreated(view, savedInstanceState)
40 |
41 | val fusedLocationClient = LocationServices.getFusedLocationProviderClient(context!!)
42 | var locationChangeInterface = context as LocationChangeInterface
43 |
44 | if (allPermissionsGranted(context!!) && ActivityCompat.checkSelfPermission(
45 | context!!,
46 | Manifest.permission.ACCESS_FINE_LOCATION
47 | ) == PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(
48 | context!!,
49 | Manifest.permission.ACCESS_COARSE_LOCATION
50 | ) == PackageManager.PERMISSION_GRANTED) {
51 |
52 | fusedLocationClient.lastLocation
53 | .addOnSuccessListener { location : Location? ->
54 |
55 | val callback = OnMapReadyCallback { googleMap ->
56 |
57 | var myLocation = LatLng(
58 | location!!.latitude,
59 | location!!.longitude
60 | )
61 | // googleMap.addMarker(
62 | // MarkerOptions().position(myLocation).title("Your current position")
63 | // )
64 |
65 | googleMap.setOnCameraIdleListener {
66 | myLocation = LatLng(
67 | googleMap.cameraPosition.target.latitude,
68 | googleMap.cameraPosition.target.longitude
69 | )
70 | val geocoder = Geocoder(context)
71 | var address =
72 | geocoder.getFromLocation(myLocation.latitude, myLocation.longitude, 1)
73 |
74 | var area = ""
75 | if (!address[0].getAddressLine(0).isNullOrEmpty()) {
76 | area += "${address[0].getAddressLine(0).toString()} "
77 | }
78 | else {
79 | if (!address[0].subLocality.isNullOrEmpty()) {
80 | area += "${address[0].subLocality.toString()} "
81 | }
82 |
83 | if (!address[0].adminArea.isNullOrEmpty()) {
84 | area += "${address[0].adminArea.toString()} "
85 | }
86 |
87 | if (!address[0].adminArea.isNullOrEmpty()) {
88 | area += "${address[0].adminArea.toString()} "
89 | }
90 | }
91 |
92 | locationChangeInterface.onLocationChange(
93 | area,
94 | "${ myLocation.latitude},${myLocation.longitude}"
95 | )
96 |
97 | }
98 |
99 |
100 | googleMap.isMyLocationEnabled = true
101 | googleMap.uiSettings.isMyLocationButtonEnabled = true;
102 | googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(myLocation, DEFAULT_ZOOM))
103 | }
104 |
105 |
106 | val mapFragment = childFragmentManager.findFragmentById(R.id.map) as SupportMapFragment?
107 | mapFragment?.getMapAsync(callback)
108 | }
109 | } else {
110 | ActivityCompat.requestPermissions(
111 | activity!!,
112 | REQUIRED_PERMISSIONS,
113 | REQUEST_CODE_PERMISSIONS
114 | )
115 | }
116 |
117 | }
118 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/ui/NewUser/NewUserActivity.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.NewUser
2 |
3 | import android.Manifest
4 | import android.content.Intent
5 | import android.content.pm.PackageManager
6 | import android.graphics.Color
7 | import android.location.Location
8 | import androidx.appcompat.app.AppCompatActivity
9 | import android.os.Bundle
10 | import android.widget.Toast
11 | import androidx.core.app.ActivityCompat
12 | import androidx.core.content.ContextCompat
13 | import cn.pedant.SweetAlert.SweetAlertDialog
14 | import com.google.android.gms.location.LocationServices
15 | import com.google.firebase.auth.FirebaseAuth
16 | import com.google.firebase.messaging.FirebaseMessaging
17 | import kotlinx.android.synthetic.main.activity_new_user.*
18 | import project.absurdnerds.simplify.R
19 | import project.absurdnerds.simplify.api.ApiInterface
20 | import project.absurdnerds.simplify.data.request.ProfileRequest
21 | import project.absurdnerds.simplify.data.response.ProfilePostResponse
22 | import project.absurdnerds.simplify.ui.home.HomeActivity
23 | import retrofit2.Call
24 | import retrofit2.Callback
25 | import retrofit2.Response
26 | import timber.log.Timber
27 |
28 | class NewUserActivity : AppCompatActivity() {
29 |
30 | private lateinit var firebaseAuth: FirebaseAuth
31 | private lateinit var currentLocation: String
32 | private lateinit var sweetAlertDialog: SweetAlertDialog
33 | private val REQUEST_CODE_PERMISSIONS = 99
34 | private val REQUEST_CODE_LOCATION = 98
35 | private val REQUIRED_PERMISSIONS = arrayOf(
36 | Manifest.permission.ACCESS_COARSE_LOCATION,
37 | Manifest.permission.ACCESS_FINE_LOCATION
38 | )
39 |
40 | override fun onCreate(savedInstanceState: Bundle?) {
41 | super.onCreate(savedInstanceState)
42 | setContentView(R.layout.activity_new_user)
43 |
44 | firebaseAuth = FirebaseAuth.getInstance()
45 |
46 | etPhone.setText(firebaseAuth.currentUser!!.phoneNumber.toString())
47 |
48 | val fusedLocationClient = LocationServices.getFusedLocationProviderClient(this)
49 |
50 |
51 |
52 |
53 | cardSubmit.setOnClickListener {
54 |
55 | Timber.e("Click")
56 | if (allPermissionsGranted()) {
57 | if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
58 | fusedLocationClient.lastLocation
59 | .addOnSuccessListener { location : Location? ->
60 | // Got last known location. In some rare situations this can be null.
61 | currentLocation = "${location!!.latitude},${location.longitude}"
62 |
63 | if (checkFields()) {
64 | FirebaseMessaging.getInstance().token.addOnSuccessListener {
65 | createUser(it)
66 | }
67 | }
68 | else {
69 | Toast.makeText(this, getString(R.string.all_fields_are_compulsory), Toast.LENGTH_SHORT).show()
70 | }
71 | }
72 | }
73 | else {
74 | Toast.makeText(this, getString(R.string.turn_on_location_access_from_settings), Toast.LENGTH_SHORT).show()
75 | }
76 | } else {
77 | ActivityCompat.requestPermissions(
78 | this,
79 | REQUIRED_PERMISSIONS,
80 | REQUEST_CODE_PERMISSIONS
81 | )
82 | }
83 | }
84 | }
85 |
86 | private fun checkFields(): Boolean {
87 | if (etFName.text.isNullOrEmpty())
88 | return false
89 | if (etLName.text.isNullOrEmpty())
90 | return false
91 | if (etPhone.text.isNullOrEmpty())
92 | return false
93 | if (etPermanentAddress.text.isNullOrEmpty())
94 | return false
95 | return true
96 | }
97 |
98 | private fun allPermissionsGranted() = REQUIRED_PERMISSIONS.all {
99 | ContextCompat.checkSelfPermission(
100 | this, it
101 | ) == PackageManager.PERMISSION_GRANTED
102 | }
103 |
104 | private fun createUser(token: String) {
105 |
106 | sweetAlertDialog = SweetAlertDialog(this, SweetAlertDialog.PROGRESS_TYPE)
107 | sweetAlertDialog.progressHelper.barColor = Color.parseColor(R.color.progressBarColor.toString())
108 | sweetAlertDialog.titleText = R.string.loading.toString()
109 | sweetAlertDialog.setCancelable(false)
110 | sweetAlertDialog.show()
111 |
112 | var gender = "Male"
113 |
114 | gender = if (rbMale.isChecked)
115 | "Male"
116 | else
117 | "Female"
118 |
119 |
120 | var apiInterface = ApiInterface.invoke()
121 | val profilePostRequest = ProfileRequest(
122 | "${etFName.text.toString()} ${etLName.text.toString()}",
123 | "${etPhone.text.toString()}",
124 | gender,
125 | currentLocation,
126 | "${etPermanentAddress.text.toString()}",
127 | token
128 |
129 | )
130 | var call: Call = apiInterface.postProfileData(profilePostRequest)
131 |
132 | call.enqueue(object : Callback {
133 | override fun onResponse(
134 | call: Call,
135 | response: Response
136 | ) {
137 | if (response.isSuccessful) {
138 | startActivity(Intent(this@NewUserActivity, HomeActivity::class.java))
139 | finish()
140 | }
141 | sweetAlertDialog.cancel()
142 | }
143 |
144 | override fun onFailure(call: Call, t: Throwable) {
145 | Timber.e(t)
146 | sweetAlertDialog.cancel()
147 | }
148 |
149 | })
150 | }
151 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/ui/NewUser/UserModel.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.NewUser
2 |
3 | /**
4 | * Created by Dheeraj Kotwani on 13-11-2020.
5 | */
6 | class UserModel (
7 | var name: String,
8 | var phone: String,
9 | var gender: String,
10 | var location: String,
11 | var permanent_address: String,
12 | var token: String
13 | )
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/ui/fire/FireActivity.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.fire
2 |
3 | import android.Manifest
4 | import android.content.Context
5 | import android.content.Intent
6 | import android.content.SharedPreferences
7 | import android.graphics.Color
8 | import android.os.Bundle
9 | import android.view.Menu
10 | import android.view.MenuItem
11 | import androidx.appcompat.app.AppCompatActivity
12 | import androidx.databinding.DataBindingUtil
13 | import androidx.lifecycle.ViewModelProviders
14 | import cn.pedant.SweetAlert.SweetAlertDialog
15 | import com.google.firebase.auth.FirebaseAuth
16 | import kotlinx.android.synthetic.main.activity_fire.*
17 | import project.absurdnerds.simplify.Maps.LocationChangeInterface
18 | import project.absurdnerds.simplify.Maps.MapsFragment
19 | import project.absurdnerds.simplify.R
20 | import project.absurdnerds.simplify.api.ApiInterface
21 | import project.absurdnerds.simplify.data.request.FireRequest
22 | import project.absurdnerds.simplify.data.response.FirePostResponse
23 | import project.absurdnerds.simplify.databinding.ActivityFireBinding
24 | import project.absurdnerds.simplify.fire.FireViewState.*
25 | import project.absurdnerds.simplify.history.FireHistoryActivity
26 | import project.absurdnerds.simplify.utils.AppConfig.SHARED_PREF
27 | import project.absurdnerds.simplify.utils.ReportType
28 | import project.absurdnerds.simplify.utils.allPermissionsGranted
29 | import project.absurdnerds.simplify.utils.dialog.ViewDialog
30 | import project.absurdnerds.simplify.utils.showToast
31 | import retrofit2.Call
32 | import retrofit2.Callback
33 | import retrofit2.Response
34 | import timber.log.Timber
35 |
36 |
37 | class FireActivity : AppCompatActivity(), LocationChangeInterface {
38 |
39 | companion object{
40 | private lateinit var firebaseAuth: FirebaseAuth
41 | private var mobileNumber: String = ""
42 | private lateinit var sharedPreferences: SharedPreferences
43 | private lateinit var sweetAlertDialog: SweetAlertDialog
44 | private val REQUEST_CODE_PERMISSIONS = 99
45 | private var location: String = ""
46 | private var latLong: String = ""
47 | val REQUIRED_PERMISSIONS = arrayOf(
48 | Manifest.permission.ACCESS_COARSE_LOCATION,
49 | Manifest.permission.ACCESS_FINE_LOCATION
50 | )
51 | fun start(context: Context) {
52 | val intent = Intent(context, FireActivity::class.java)
53 | context.startActivity(intent)
54 | }
55 | }
56 |
57 | private lateinit var binding : ActivityFireBinding
58 |
59 | private lateinit var viewModel : FireViewModel
60 |
61 | private lateinit var loadingDialog : ViewDialog
62 |
63 | override fun onCreate(savedInstanceState: Bundle?) {
64 | super.onCreate(savedInstanceState)
65 | binding = DataBindingUtil.setContentView(this, R.layout.activity_fire)
66 | sharedPreferences = getSharedPreferences(SHARED_PREF, Context.MODE_PRIVATE)
67 |
68 | setSupportActionBar(toolFire)
69 | // toolFire.inflateMenu(R.menu.menu)
70 |
71 | firebaseAuth = FirebaseAuth.getInstance()
72 | initViewModel()
73 | setObservers()
74 | initUI()
75 |
76 | if (sharedPreferences.contains("PHONE")) {
77 | mobileNumber = sharedPreferences.getString("PHONE", "0").toString()
78 | }
79 | else {
80 | mobileNumber = firebaseAuth.currentUser!!.phoneNumber.toString()
81 | }
82 |
83 |
84 |
85 | supportFragmentManager.beginTransaction()
86 | .replace(R.id.locationFrame, MapsFragment())
87 | .commit()
88 |
89 | btAlert.setOnClickListener {
90 |
91 | showToast(getString(R.string.alert))
92 | reportFire()
93 |
94 | }
95 |
96 | }
97 |
98 | private fun initViewModel() {
99 | viewModel = ViewModelProviders.of(this).get(FireViewModel::class.java)
100 | loadingDialog = ViewDialog(this)
101 | }
102 |
103 | private fun initUI() {
104 | binding.viewModel = viewModel
105 | }
106 |
107 | private fun setObservers() {
108 | viewModel.stateObservable.observe(this, {
109 | render(it)
110 | })
111 | }
112 |
113 | private fun render(state: FireViewState) {
114 | when(state) {
115 | Loading -> showLoading()
116 | OnSuccess -> onSuccess()
117 | is OnError -> onError(state.mssg)
118 | is FieldError -> showFieldError(state)
119 | }
120 | }
121 |
122 | private fun showLoading() {
123 | loadingDialog.showDialog()
124 | }
125 |
126 | private fun hideLoading() {
127 | loadingDialog.hideDialog()
128 | }
129 |
130 | private fun onSuccess() {
131 | hideLoading()
132 | showToast(getString(R.string.success))
133 | }
134 |
135 | private fun onError(message: String?) {
136 | hideLoading()
137 | if (message != null) {
138 | showToast(message)
139 | }
140 | }
141 |
142 | private fun showFieldError(type: FieldError) {
143 | hideLoading()
144 | /*when (type.errorType) {
145 | ErrorField.FIRST_NAME -> binding.etFirstName.error = type.message
146 | ErrorField.LAST_NAME -> binding.etLastName.error = type.message
147 | ErrorField.DOB -> binding.etDob.error = type.message
148 | ErrorField.HEIGHT -> binding.etHeight.error = type.message
149 | ErrorField.WEIGHT -> binding.etWeight.error = type.message
150 | ErrorField.PHONE -> binding.etPhone.error = type.message
151 | ErrorField.GENDER -> showToast(type.message)
152 | }*/
153 | }
154 |
155 |
156 | private fun reportFire() {
157 |
158 | sweetAlertDialog = SweetAlertDialog(this, SweetAlertDialog.PROGRESS_TYPE)
159 | sweetAlertDialog.progressHelper.barColor = Color.parseColor(R.color.progressBarColor.toString())
160 | sweetAlertDialog.titleText = getString(R.string.loading)
161 | sweetAlertDialog.setCancelable(false)
162 | sweetAlertDialog.show()
163 |
164 | location = etReportFireLocation.text.toString()
165 | var apiInterface = ApiInterface.invoke()
166 | val postRequest = FireRequest(latLong, location, mobileNumber)
167 | var call: Call = apiInterface.postFireData(postRequest)
168 |
169 | call.enqueue(object : Callback {
170 | override fun onResponse(
171 | call: Call,
172 | response: Response
173 | ) {
174 | Timber.e("Fire Report : ${response.code().toString()}")
175 | if (response.isSuccessful) {
176 | var sad = SweetAlertDialog(this@FireActivity, SweetAlertDialog.SUCCESS_TYPE)
177 | sad.titleText = getString(R.string.you_have_reported_fire_in_your_area)
178 | sad.show()
179 | } else {
180 | showToast(getString(R.string.something_went_wrong))
181 | }
182 | sweetAlertDialog.cancel()
183 | }
184 |
185 | override fun onFailure(call: Call, t: Throwable) {
186 | Timber.e(t)
187 | showToast(getString(R.string.something_went_wrong))
188 | sweetAlertDialog.cancel()
189 | }
190 | })
191 | }
192 |
193 | override fun onRequestPermissionsResult(
194 | requestCode: Int, permissions: Array, grantResults:
195 | IntArray
196 | ) {
197 | if (requestCode == REQUEST_CODE_PERMISSIONS) {
198 | if (!allPermissionsGranted(this)) {
199 | showToast(getString(R.string.permissions_not_granted_by_the_user))
200 | }
201 | }
202 | }
203 |
204 | override fun onLocationChange(a: String, b: String) {
205 |
206 | latLong = b
207 |
208 | etReportFireLocation.setText(a)
209 | }
210 |
211 | override fun onCreateOptionsMenu(menu: Menu?): Boolean {
212 | menuInflater.inflate(R.menu.menu, menu)
213 | return true
214 | }
215 |
216 | override fun onOptionsItemSelected(item: MenuItem): Boolean {
217 | // Handle item selection
218 | return when (item.itemId) {
219 | R.id.itemHistory -> {
220 | // TODO Add your Activity to open here
221 | FireHistoryActivity.start(
222 | this,
223 | ReportType.FIRE.name
224 | )
225 |
226 | showToast(getString(R.string.history))
227 |
228 | true
229 | }
230 | else -> super.onOptionsItemSelected(item)
231 | }
232 | }
233 |
234 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/ui/fire/FireViewModel.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.fire
2 |
3 | import android.app.Application
4 | import androidx.lifecycle.AndroidViewModel
5 | import androidx.lifecycle.MutableLiveData
6 | import project.absurdnerds.simplify.fire.FireViewState.*
7 | import project.absurdnerds.simplify.utils.lifecycle.SingleLiveEvent
8 |
9 | class FireViewModel constructor(
10 | private val app : Application
11 | ) : AndroidViewModel(app) {
12 |
13 | private var viewState: FireViewState = Init
14 | set(value) {
15 | field = value
16 | stateObservable.postValue(value)
17 | }
18 |
19 | val stateObservable: SingleLiveEvent by lazy {
20 | SingleLiveEvent()
21 | }
22 |
23 | var text : MutableLiveData = MutableLiveData()
24 |
25 | // fun button (){
26 | // viewState = OnSuccess
27 | // text.value = "button pressed"
28 | // }
29 |
30 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/ui/fire/FireViewState.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.fire
2 |
3 | sealed class FireViewState {
4 |
5 | object Init : FireViewState()
6 |
7 | object Loading : FireViewState()
8 |
9 | object OnSuccess : FireViewState()
10 |
11 | data class OnError(var mssg : String?) : FireViewState()
12 |
13 | data class FieldError(var errorType: ErrorField, var message: String?) : FireViewState()
14 |
15 | //todo change fields
16 | enum class ErrorField {
17 | FIRST_NAME,
18 | LAST_NAME,
19 | GENDER,
20 | DOB,
21 | WEIGHT,
22 | HEIGHT,
23 | PHONE
24 | }
25 |
26 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/ui/history/FireHistoryActivity.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.history
2 |
3 | import android.content.Context
4 | import android.content.Intent
5 | import android.content.SharedPreferences
6 | import androidx.appcompat.app.AppCompatActivity
7 | import android.os.Bundle
8 | import androidx.databinding.DataBindingUtil
9 | import com.google.firebase.auth.FirebaseAuth
10 | import project.absurdnerds.simplify.R
11 | import project.absurdnerds.simplify.api.ApiInterface
12 | import project.absurdnerds.simplify.data.request.CommonPhoneRequest
13 | import project.absurdnerds.simplify.data.response.AmbulanceGetResponse
14 | import project.absurdnerds.simplify.data.response.FireGetResponse
15 | import project.absurdnerds.simplify.data.response.PoliceGetResponse
16 | import project.absurdnerds.simplify.databinding.ActivityFireHistoryBinding
17 | import project.absurdnerds.simplify.history.adapter.AmbulanceAdapter
18 | import project.absurdnerds.simplify.history.adapter.FireAdapter
19 | import project.absurdnerds.simplify.history.adapter.PoliceAdapter
20 | import project.absurdnerds.simplify.utils.AppConfig
21 | import project.absurdnerds.simplify.utils.ReportType
22 | import project.absurdnerds.simplify.utils.showToast
23 | import retrofit2.Call
24 | import retrofit2.Callback
25 | import retrofit2.Response
26 | import timber.log.Timber
27 |
28 | class FireHistoryActivity : AppCompatActivity() {
29 |
30 | companion object {
31 | private lateinit var firebaseAuth: FirebaseAuth
32 | private var mobileNumber: String = ""
33 | private lateinit var sharedPreferences: SharedPreferences
34 | private const val INTENT_HISTORY = "intent_history"
35 | fun start(context : Context, history : String) {
36 | val intent = Intent(context, FireHistoryActivity::class.java)
37 | intent.putExtra(INTENT_HISTORY, history)
38 | context.startActivity(intent)
39 | }
40 | }
41 | private lateinit var binding : ActivityFireHistoryBinding
42 |
43 | private lateinit var fireAdapter: FireAdapter
44 |
45 | private lateinit var ambulanceAdapter: AmbulanceAdapter
46 |
47 | private lateinit var policeAdapter: PoliceAdapter
48 |
49 | private var fireList : MutableList = mutableListOf()
50 |
51 | private var ambulanceList : MutableList = mutableListOf()
52 |
53 | private var policeList : MutableList = mutableListOf()
54 |
55 | private lateinit var type : String
56 |
57 | override fun onCreate(savedInstanceState: Bundle?) {
58 | super.onCreate(savedInstanceState)
59 | binding = DataBindingUtil.setContentView(this,R.layout.activity_fire_history)
60 | sharedPreferences = getSharedPreferences(AppConfig.SHARED_PREF, Context.MODE_PRIVATE)
61 | firebaseAuth = FirebaseAuth.getInstance()
62 | handleIntent()
63 | initAdapter()
64 | if (sharedPreferences.contains("PHONE")) {
65 | mobileNumber = sharedPreferences.getString("PHONE", "0").toString()
66 | }
67 | else {
68 | mobileNumber = firebaseAuth.currentUser!!.phoneNumber.toString()
69 | }
70 | }
71 |
72 | private fun handleIntent() {
73 | type = intent.getStringExtra(INTENT_HISTORY).toString()
74 | }
75 |
76 | private fun initAdapter() {
77 |
78 | fireAdapter = FireAdapter(fireList, this)
79 | ambulanceAdapter = AmbulanceAdapter(ambulanceList, this)
80 | policeAdapter = PoliceAdapter(policeList, this)
81 |
82 | when(type) {
83 | ReportType.AMBULANCE.name -> {
84 | binding.recycleHistory.adapter = ambulanceAdapter
85 | fetchAmbulance()
86 | }
87 | ReportType.FIRE.name -> {
88 | binding.recycleHistory.adapter = fireAdapter
89 | fetchFire()
90 | }
91 | else -> {
92 | binding.recycleHistory.adapter = policeAdapter
93 | fetchPolice()
94 | }
95 | }
96 | }
97 |
98 | private fun fetchAmbulance() {
99 |
100 | var apiInterface = ApiInterface.invoke()
101 | // val getRequest = CommonPhoneRequest(mobileNumber)
102 | var call: Call = apiInterface.getAmbulance(mobileNumber)
103 |
104 | call.enqueue(object : Callback {
105 |
106 | override fun onResponse(
107 | call: Call,
108 | response: Response
109 | ) {
110 | Timber.e("history : ${response.code().toString()}")
111 | if (response.isSuccessful) {
112 | ambulanceList = response.body()!!
113 | } else {
114 | showToast(getString(R.string.something_went_wrong))
115 | }
116 | }
117 |
118 | override fun onFailure(call: Call, t: Throwable) {
119 | Timber.e(t)
120 | showToast(getString(R.string.something_went_wrong))
121 | }
122 |
123 | })
124 |
125 | ambulanceAdapter.notifyDataSetChanged()
126 | }
127 |
128 | private fun fetchFire() {
129 |
130 | var apiInterface = ApiInterface.invoke()
131 | val getRequest = CommonPhoneRequest(mobileNumber)
132 | var call: Call = apiInterface.getFire(mobileNumber)
133 |
134 | call.enqueue(object : Callback {
135 |
136 | override fun onResponse(
137 | call: Call,
138 | response: Response
139 | ) {
140 | Timber.e("fire history : ${response.code().toString()}")
141 | if (response.isSuccessful) {
142 | fireList.addAll(response.body()!!)
143 | fireAdapter.notifyDataSetChanged()
144 | Timber.e(response.body()!!.toString())
145 | } else {
146 | showToast(getString(R.string.something_went_wrong))
147 | }
148 | }
149 |
150 | override fun onFailure(call: Call, t: Throwable) {
151 | Timber.e(t)
152 | showToast(getString(R.string.something_went_wrong))
153 | }
154 |
155 | })
156 |
157 | fireAdapter.notifyDataSetChanged()
158 | }
159 |
160 | private fun fetchPolice() {
161 |
162 | var apiInterface = ApiInterface.invoke()
163 | val getRequest = CommonPhoneRequest(mobileNumber)
164 | var call: Call = apiInterface.getPolice(mobileNumber)
165 |
166 | call.enqueue(object : Callback {
167 |
168 | override fun onResponse(
169 | call: Call,
170 | response: Response
171 | ) {
172 | Timber.e("police history : ${response.code().toString()}")
173 | if (response.isSuccessful) {
174 | policeList = response.body()!!
175 | Timber.e(policeList.size.toString())
176 | } else {
177 | showToast(getString(R.string.something_went_wrong))
178 | }
179 | }
180 |
181 | override fun onFailure(call: Call, t: Throwable) {
182 | Timber.e(t)
183 | showToast(getString(R.string.something_went_wrong))
184 | }
185 |
186 | })
187 |
188 | policeAdapter.notifyDataSetChanged()
189 | }
190 |
191 |
192 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/ui/history/adapter/AmbulanceAdapter.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.history.adapter
2 |
3 | import android.content.Context
4 | import android.view.LayoutInflater
5 | import android.view.ViewGroup
6 | import androidx.databinding.DataBindingUtil
7 | import androidx.recyclerview.widget.RecyclerView
8 | import project.absurdnerds.simplify.R
9 | import project.absurdnerds.simplify.data.response.AmbulanceGetResponse
10 | import project.absurdnerds.simplify.databinding.ItemHistoryPoliceBinding
11 |
12 | class AmbulanceAdapter constructor(
13 | private val list : List,
14 | private val context : Context
15 | ) : RecyclerView.Adapter() {
16 |
17 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder =
18 | ViewHolder(
19 | DataBindingUtil.inflate(
20 | LayoutInflater.from(parent.context),
21 | R.layout.item_history_police,
22 | parent,
23 | false
24 | )
25 | )
26 |
27 | override fun onBindViewHolder(holder: ViewHolder, position: Int) = holder.bind(list[position])
28 |
29 | override fun getItemCount(): Int = list.size
30 |
31 | inner class ViewHolder(
32 | private val binding : ItemHistoryPoliceBinding
33 | ): RecyclerView.ViewHolder(
34 | binding.root
35 | ) {
36 |
37 | fun bind (item : AmbulanceGetResponse.AmbulanceGetResponseItem) {
38 |
39 | binding.tvName.text = item.patientName
40 | binding.tvLocation.text = item.address
41 | binding.tvDate.text = item.created
42 |
43 | }
44 |
45 | }
46 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/ui/history/adapter/FireAdapter.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.history.adapter
2 |
3 | import android.content.Context
4 | import android.view.LayoutInflater
5 | import android.view.ViewGroup
6 | import androidx.databinding.DataBindingUtil
7 | import androidx.recyclerview.widget.RecyclerView
8 | import project.absurdnerds.simplify.R
9 | import project.absurdnerds.simplify.data.response.FireGetResponse
10 | import project.absurdnerds.simplify.databinding.ItemHistoryFireBinding
11 |
12 | class FireAdapter constructor(
13 | private val list : List,
14 | private val context : Context
15 | ) : RecyclerView.Adapter() {
16 |
17 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): FireAdapter.ViewHolder =
18 | ViewHolder(
19 | DataBindingUtil.inflate(
20 | LayoutInflater.from(parent.context),
21 | R.layout.item_history_fire,
22 | parent,
23 | false
24 | )
25 | )
26 |
27 | override fun onBindViewHolder(holder: FireAdapter.ViewHolder, position: Int) = holder.bind(list[position])
28 |
29 | override fun getItemCount(): Int = list.size
30 |
31 | inner class ViewHolder(
32 | private val binding : ItemHistoryFireBinding
33 | ) : RecyclerView.ViewHolder(
34 | binding.root
35 | ) {
36 |
37 | fun bind (item : FireGetResponse.FireGetResponseItem) {
38 |
39 | binding.tvLocation.text = item.address
40 | binding.tvDate.text = item.created
41 |
42 | }
43 |
44 | }
45 |
46 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/ui/history/adapter/PoliceAdapter.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.history.adapter
2 |
3 | import android.content.Context
4 | import android.view.LayoutInflater
5 | import android.view.ViewGroup
6 | import androidx.databinding.DataBindingUtil
7 | import androidx.recyclerview.widget.RecyclerView
8 | import project.absurdnerds.simplify.R
9 | import project.absurdnerds.simplify.data.response.AmbulanceGetResponse
10 | import project.absurdnerds.simplify.data.response.PoliceGetResponse
11 | import project.absurdnerds.simplify.databinding.ItemHistoryPoliceBinding
12 |
13 | class PoliceAdapter constructor(
14 | private val list : List,
15 | private val context : Context
16 | ) : RecyclerView.Adapter() {
17 |
18 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PoliceAdapter.ViewHolder =
19 | ViewHolder(
20 | DataBindingUtil.inflate(
21 | LayoutInflater.from(parent.context),
22 | R.layout.item_history_police,
23 | parent,
24 | false
25 | )
26 | )
27 |
28 | override fun onBindViewHolder(holder: PoliceAdapter.ViewHolder, position: Int) = holder.bind(list[position])
29 |
30 | override fun getItemCount(): Int = list.size
31 |
32 | inner class ViewHolder(
33 | private val binding : ItemHistoryPoliceBinding
34 | ) : RecyclerView.ViewHolder(
35 | binding.root
36 | ) {
37 |
38 | fun bind (item : PoliceGetResponse.PoliceGetResponseItem) {
39 |
40 | binding.tvName.text = item.problem
41 | binding.tvLocation.text = item.address
42 | binding.tvDate.text = item.created
43 |
44 | }
45 |
46 | }
47 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/ui/home/HomeActivity.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.ui.home
2 |
3 | import android.content.Context
4 | import android.content.SharedPreferences
5 | import android.os.Bundle
6 | import androidx.appcompat.app.AppCompatActivity
7 | import androidx.databinding.DataBindingUtil
8 | import com.bumptech.glide.Glide
9 | import com.google.firebase.auth.FirebaseAuth
10 | import com.google.firebase.messaging.FirebaseMessaging
11 | import project.absurdnerds.simplify.R
12 | import project.absurdnerds.simplify.databinding.ActivityHomeBinding
13 | import project.absurdnerds.simplify.fire.FireActivity
14 | import project.absurdnerds.simplify.ui.ui.medical.MedicalActivity
15 | import project.absurdnerds.simplify.ui.police.PoliceActivity
16 | import project.absurdnerds.simplify.utils.AppConfig.SHARED_PREF
17 | import timber.log.Timber
18 |
19 | class HomeActivity : AppCompatActivity() {
20 |
21 | private lateinit var binding : ActivityHomeBinding
22 | private lateinit var sharedPreferences: SharedPreferences
23 | private lateinit var firebaseAuth: FirebaseAuth
24 |
25 | override fun onCreate(savedInstanceState: Bundle?) {
26 | super.onCreate(savedInstanceState)
27 | binding = DataBindingUtil.setContentView(this, R.layout.activity_home)
28 | initView()
29 | onClick()
30 |
31 | sharedPreferences = getSharedPreferences(SHARED_PREF, Context.MODE_PRIVATE)
32 | firebaseAuth = FirebaseAuth.getInstance()
33 |
34 | FirebaseMessaging.getInstance().token.addOnSuccessListener {
35 | Timber.e(it)
36 | }
37 |
38 | sharedPreferences.edit().putString(getString(R.string.PHONE), firebaseAuth.currentUser!!.phoneNumber)
39 | .apply()
40 |
41 | }
42 |
43 | private fun onClick() {
44 | binding.cdFire.setOnClickListener {
45 | FireActivity.start(
46 | this
47 | )
48 | }
49 |
50 | binding.cdMedical.setOnClickListener {
51 | MedicalActivity.start(
52 | this
53 | )
54 | }
55 |
56 | binding.cdPolice.setOnClickListener {
57 | PoliceActivity.start(
58 | this
59 | )
60 | }
61 | }
62 |
63 | private fun initView() {
64 | Glide.with(this)
65 | .asGif()
66 | .load(R.drawable.fire_gif)
67 | .into(binding.imFire)
68 |
69 | Glide.with(this)
70 | .asGif()
71 | .load(R.drawable.ambulance)
72 | .into(binding.imMedical)
73 |
74 | Glide.with(this)
75 | .asGif()
76 | .load(R.drawable.police_gif)
77 | .into(binding.imPolice)
78 | }
79 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/ui/login/LoginActivity.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.login
2 |
3 | import android.Manifest
4 | import android.content.Context
5 | import android.content.Intent
6 | import android.content.SharedPreferences
7 | import android.content.pm.PackageManager
8 | import android.graphics.Color
9 | import androidx.appcompat.app.AppCompatActivity
10 | import android.os.Bundle
11 | import androidx.core.app.ActivityCompat
12 | import androidx.core.content.ContextCompat
13 | import androidx.fragment.app.Fragment
14 | import androidx.fragment.app.FragmentTransaction
15 | import cn.pedant.SweetAlert.SweetAlertDialog
16 | import com.google.firebase.auth.FirebaseAuth
17 | import com.google.firebase.messaging.FirebaseMessaging
18 | import project.absurdnerds.simplify.FragmentChangeInterface
19 | import project.absurdnerds.simplify.NewUser.NewUserActivity
20 | import project.absurdnerds.simplify.R
21 | import project.absurdnerds.simplify.api.ApiInterface
22 | import project.absurdnerds.simplify.data.request.ProfilePutRequest
23 | import project.absurdnerds.simplify.ui.home.HomeActivity
24 | import project.absurdnerds.simplify.utils.showToast
25 | import retrofit2.Call
26 | import retrofit2.Callback
27 | import retrofit2.Response
28 | import timber.log.Timber
29 |
30 | class LoginActivity : AppCompatActivity(), FragmentChangeInterface {
31 |
32 | private lateinit var sharedPreferences: SharedPreferences
33 | private lateinit var fragmentTransaction: FragmentTransaction
34 | private lateinit var firebaseAuth: FirebaseAuth
35 | private lateinit var sweetAlertDialog: SweetAlertDialog
36 | private val REQUEST_CODE_PERMISSIONS = 99
37 | private val REQUIRED_PERMISSIONS = arrayOf(
38 | Manifest.permission.ACCESS_COARSE_LOCATION,
39 | Manifest.permission.ACCESS_FINE_LOCATION
40 | )
41 |
42 | override fun onCreate(savedInstanceState: Bundle?) {
43 | super.onCreate(savedInstanceState)
44 | setContentView(R.layout.activity_login)
45 |
46 | var fragment = LoginMobileFragment()
47 | firebaseAuth = FirebaseAuth.getInstance()
48 | sharedPreferences = getSharedPreferences(getString(R.string.SHARED_PREF), Context.MODE_PRIVATE)
49 |
50 | if (firebaseAuth.currentUser != null) {
51 | sweetAlertDialog = SweetAlertDialog(this, SweetAlertDialog.PROGRESS_TYPE)
52 | sweetAlertDialog.progressHelper.barColor = Color.parseColor(R.color.progressBarColor.toString())
53 | sweetAlertDialog.titleText = getString(R.string.loading)
54 | sweetAlertDialog.setCancelable(false)
55 | sweetAlertDialog.show()
56 |
57 | sharedPreferences.edit().putString(getString(R.string.PHONE), firebaseAuth.currentUser!!.phoneNumber)
58 | .apply()
59 |
60 | Timber.e(firebaseAuth.currentUser!!.phoneNumber)
61 | createToken(firebaseAuth.currentUser!!.phoneNumber.toString())
62 |
63 | }
64 |
65 | if (!allPermissionsGranted()) {
66 | ActivityCompat.requestPermissions(
67 | this,
68 | REQUIRED_PERMISSIONS,
69 | REQUEST_CODE_PERMISSIONS
70 | )
71 | }
72 |
73 | fragmentTransaction = supportFragmentManager.beginTransaction()
74 | fragmentTransaction.replace(R.id.loginFrame, fragment)
75 | fragmentTransaction.commit()
76 |
77 | }
78 |
79 | override fun changeFragment(fragment: Fragment) {
80 | if (supportFragmentManager.backStackEntryCount == 0) {
81 | supportFragmentManager.beginTransaction()
82 | .addToBackStack(null)
83 | .replace(R.id.loginFrame, fragment).commit()
84 | }
85 | else {
86 | supportFragmentManager.beginTransaction()
87 | .replace(R.id.loginFrame, fragment).commit()
88 | }
89 | }
90 |
91 | private fun allPermissionsGranted() = REQUIRED_PERMISSIONS.all {
92 | ContextCompat.checkSelfPermission(
93 | this, it
94 | ) == PackageManager.PERMISSION_GRANTED
95 | }
96 |
97 | fun createToken(mobileNumber: String) {
98 | FirebaseMessaging.getInstance().token.addOnSuccessListener {
99 | checkUser(mobileNumber, it)
100 | }
101 | }
102 |
103 | private fun checkUser(mobile: String, token: String) {
104 | var apiInterface = ApiInterface.invoke()
105 | val commonPostResponse = ProfilePutRequest(mobile, token)
106 | var call: Call = apiInterface.putProfileToken(commonPostResponse)
107 |
108 | call.enqueue(object : Callback {
109 | override fun onResponse(
110 | call: Call,
111 | response: Response
112 | ) {
113 | Timber.e("860 : ${response.code().toString()}")
114 | if (response.code() == 200) {
115 | startActivity(Intent(this@LoginActivity, HomeActivity::class.java))
116 | }
117 | else {
118 | startActivity(Intent(this@LoginActivity, NewUserActivity::class.java))
119 | }
120 | sweetAlertDialog.cancel()
121 | finish()
122 | }
123 |
124 | override fun onFailure(call: Call, t: Throwable) {
125 | Timber.e(t)
126 | sweetAlertDialog.cancel()
127 | }
128 |
129 | })
130 | }
131 |
132 | override fun onRequestPermissionsResult(
133 | requestCode: Int, permissions: Array, grantResults:
134 | IntArray
135 | ) {
136 | if (requestCode == REQUEST_CODE_PERMISSIONS) {
137 | if (!allPermissionsGranted()) {
138 | showToast(getString(R.string.permissions_not_granted_by_the_user))
139 | }
140 | }
141 | }
142 |
143 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/ui/login/LoginMobileFragment.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.login
2 |
3 | import android.annotation.SuppressLint
4 | import android.graphics.Color
5 | import androidx.lifecycle.ViewModelProvider
6 | import android.os.Bundle
7 | import androidx.fragment.app.Fragment
8 | import android.view.LayoutInflater
9 | import android.view.View
10 | import android.view.ViewGroup
11 | import cn.pedant.SweetAlert.SweetAlertDialog
12 | import com.google.firebase.FirebaseException
13 | import com.google.firebase.auth.FirebaseAuth
14 | import com.google.firebase.auth.PhoneAuthCredential
15 | import com.google.firebase.auth.PhoneAuthProvider
16 | import kotlinx.android.synthetic.main.login_mobile_fragment.*
17 | import project.absurdnerds.simplify.FragmentChangeInterface
18 | import project.absurdnerds.simplify.R
19 | import project.absurdnerds.simplify.utils.showToast
20 | import timber.log.Timber
21 | import java.util.concurrent.TimeUnit
22 |
23 | class LoginMobileFragment : Fragment() {
24 |
25 | companion object {
26 | fun newInstance() = LoginMobileFragment()
27 | }
28 |
29 | private lateinit var viewModel: LoginMobileViewModel
30 | private lateinit var fragmentChangeInterface: FragmentChangeInterface
31 | private var mobileNumber: String = ""
32 | private var storedVerificationId: String = ""
33 | private lateinit var firebaseAuth: FirebaseAuth
34 |
35 | override fun onCreateView(
36 | inflater: LayoutInflater, container: ViewGroup?,
37 | savedInstanceState: Bundle?
38 | ): View? {
39 | return inflater.inflate(R.layout.login_mobile_fragment, container, false)
40 | }
41 |
42 | override fun onActivityCreated(savedInstanceState: Bundle?) {
43 | super.onActivityCreated(savedInstanceState)
44 | viewModel = ViewModelProvider(this).get(LoginMobileViewModel::class.java)
45 |
46 | init()
47 |
48 | buttonGetOtp.setOnClickListener {
49 |
50 | if (etLoginMobile.text.isNullOrEmpty()) {
51 | showToast(getString(R.string.mobile_number_cant_be_blank))
52 | return@setOnClickListener
53 | }
54 |
55 | mobileNumber = "+${etCountryCode.selectedCountryCode.toString()+etLoginMobile.text.toString()}"
56 | firebaseAuth()
57 |
58 | }
59 |
60 |
61 | }
62 |
63 | private fun init() {
64 | fragmentChangeInterface = context as FragmentChangeInterface
65 | firebaseAuth = FirebaseAuth.getInstance()
66 | }
67 |
68 |
69 | @SuppressLint("ResourceType")
70 | private fun firebaseAuth() {
71 |
72 | var sweetAlertDialog = SweetAlertDialog(context, SweetAlertDialog.PROGRESS_TYPE)
73 | sweetAlertDialog.progressHelper.barColor = Color.parseColor(resources.getString(R.color.progressBarColor))
74 | sweetAlertDialog.titleText = getString(R.string.loading)
75 | sweetAlertDialog.setCancelable(false)
76 | sweetAlertDialog.show()
77 |
78 | val callbacks = object : PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
79 |
80 | override fun onVerificationCompleted(credential: PhoneAuthCredential) {
81 |
82 | Timber.d(getString(R.string.phone_verified))
83 |
84 | }
85 |
86 | override fun onVerificationFailed(e: FirebaseException) {
87 |
88 | Timber.e(e.message.toString())
89 | sweetAlertDialog.cancel()
90 |
91 | SweetAlertDialog(context, SweetAlertDialog.ERROR_TYPE)
92 | .setTitleText(getString(R.string.error_sending_otp))
93 | .show()
94 |
95 | }
96 |
97 | override fun onCodeSent(
98 | verificationId: String,
99 | token: PhoneAuthProvider.ForceResendingToken
100 | ) {
101 |
102 | sweetAlertDialog.cancel()
103 | Timber.d("onCodeSent:$verificationId")
104 | storedVerificationId = verificationId
105 |
106 |
107 | var bundle = Bundle()
108 | bundle.putString("mobileNumber", mobileNumber)
109 | bundle.putString("storedVerificationId", storedVerificationId)
110 |
111 | var fragment = LoginOTPFragment()
112 | fragment.arguments = bundle
113 | fragmentChangeInterface.changeFragment(fragment)
114 |
115 | }
116 |
117 | }
118 |
119 | Timber.d(mobileNumber)
120 |
121 | PhoneAuthProvider.getInstance().verifyPhoneNumber(
122 | mobileNumber, // Phone number to verify
123 | 120, // Timeout duration
124 | TimeUnit.SECONDS, // Unit of timeout
125 | activity!!, // Activity (for callback binding)
126 | callbacks
127 | ) // OnVerificationStateChangedCallbacks
128 |
129 | }
130 |
131 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/ui/login/LoginMobileViewModel.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.login
2 |
3 | import androidx.lifecycle.ViewModel
4 |
5 | class LoginMobileViewModel : ViewModel() {
6 | // TODO: Implement the ViewModel
7 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/ui/login/LoginOTPViewModel.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.login
2 |
3 | import androidx.lifecycle.ViewModel
4 |
5 | class LoginOTPViewModel : ViewModel() {
6 | // TODO: Implement the ViewModel
7 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/ui/medical/MedicaViewState.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.ui.ui.medical
2 |
3 | sealed class MedicalViewState {
4 |
5 | object Init : MedicalViewState()
6 |
7 | object Loading : MedicalViewState()
8 |
9 | object OnSuccess : MedicalViewState()
10 |
11 | data class OnError(var mssg :String?) : MedicalViewState()
12 |
13 | data class FieldError(var errorType: ErrorField, var message: String?) : MedicalViewState()
14 |
15 | //todo change fields
16 | enum class ErrorField {
17 | FIRST_NAME,
18 | LAST_NAME,
19 | GENDER,
20 | DOB,
21 | WEIGHT,
22 | HEIGHT,
23 | PHONE
24 | }
25 |
26 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/ui/medical/MedicalViewModel.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.ui.ui.medical
2 |
3 | import android.app.Application
4 | import androidx.lifecycle.AndroidViewModel
5 | import androidx.lifecycle.MutableLiveData
6 | import com.google.firebase.auth.FirebaseAuth
7 | import project.absurdnerds.simplify.R
8 | import project.absurdnerds.simplify.ui.ui.medical.MedicalViewState.*
9 | import project.absurdnerds.simplify.utils.lifecycle.SingleLiveEvent
10 |
11 | class MedicalViewModel constructor(
12 | app : Application
13 | ) : AndroidViewModel(app){
14 |
15 | var firebaseAuth = FirebaseAuth.getInstance()
16 |
17 | var viewState : MedicalViewState = Init
18 | set(value) {
19 | field = value
20 | stateObservable.postValue(value)
21 | }
22 |
23 | val stateObservable : SingleLiveEvent by lazy {
24 | SingleLiveEvent()
25 | }
26 |
27 | var text : MutableLiveData = MutableLiveData()
28 |
29 | fun button() {
30 | viewState = OnSuccess
31 | text.value = R.string.button_pressed.toString()
32 | firebaseAuth.signOut()
33 | }
34 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/ui/police/PoliceActivity.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.ui.police
2 |
3 | import android.content.Context
4 | import android.content.Intent
5 | import androidx.appcompat.app.AppCompatActivity
6 | import android.os.Bundle
7 | import androidx.databinding.DataBindingUtil
8 | import project.absurdnerds.simplify.R
9 | import project.absurdnerds.simplify.databinding.ActivityPoliceBinding
10 | import project.absurdnerds.simplify.ui.police.adapter.PoliceReportAdapter
11 | import project.absurdnerds.simplify.ui.police.policeReport.PoliceReportActivity
12 |
13 | class PoliceActivity : AppCompatActivity() {
14 |
15 | companion object{
16 | fun start(context: Context) {
17 | val intent = Intent(context, PoliceActivity::class.java)
18 | context.startActivity(intent)
19 | }
20 | }
21 |
22 | private lateinit var binding : ActivityPoliceBinding
23 |
24 | private lateinit var adapter : PoliceReportAdapter
25 |
26 | private var list : MutableList = mutableListOf()
27 |
28 | override fun onCreate(savedInstanceState: Bundle?) {
29 | super.onCreate(savedInstanceState)
30 | binding = DataBindingUtil.setContentView(this, R.layout.activity_police)
31 | initAdapter()
32 | fillList()
33 | }
34 |
35 | private fun initAdapter() {
36 | adapter = PoliceReportAdapter(list, this)
37 | binding.recycleReportType.adapter = adapter
38 | }
39 |
40 | private fun fillList(){
41 | list.add(PoliceModel(getString(R.string.found),false))
42 | list.add(PoliceModel(getString(R.string.missing),true))
43 | list.add(PoliceModel(getString(R.string.death),false))
44 | list.add(PoliceModel(getString(R.string.robbery),true))
45 | adapter.notifyDataSetChanged()
46 | }
47 |
48 | fun onClick(model: PoliceModel) {
49 | PoliceReportActivity.start(
50 | this,
51 | model.reportType,
52 | model.notify
53 | )
54 | }
55 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/ui/police/PoliceModel.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.ui.police
2 |
3 | class PoliceModel (
4 | val reportType : String,
5 | val notify : Boolean
6 | )
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/ui/police/PoliceReportType.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.ui.police
2 |
3 | enum class PoliceReportType {
4 | MISSING,
5 | FOUND,
6 | MURDER,
7 | ROBBERY
8 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/ui/police/adapter/PoliceReportAdapter.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.ui.police.adapter
2 |
3 | import android.content.Context
4 | import android.view.LayoutInflater
5 | import android.view.ViewGroup
6 | import androidx.databinding.DataBindingUtil
7 | import androidx.recyclerview.widget.RecyclerView
8 | import project.absurdnerds.simplify.R
9 | import project.absurdnerds.simplify.ui.police.PoliceModel
10 | import project.absurdnerds.simplify.databinding.ItemPoliceReportBinding
11 | import project.absurdnerds.simplify.ui.police.PoliceActivity
12 |
13 | class PoliceReportAdapter constructor(
14 | private val list : List,
15 | private val context : Context
16 | ) : RecyclerView.Adapter() {
17 |
18 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ReportHolder =
19 | ReportHolder(
20 | DataBindingUtil.inflate(
21 | LayoutInflater.from(parent.context),
22 | R.layout.item_police_report,
23 | parent,
24 | false
25 | )
26 | )
27 |
28 | override fun onBindViewHolder(holder: ReportHolder, position: Int) {
29 | holder.bind(list[position])
30 |
31 | holder.itemView.setOnClickListener{
32 | (context as PoliceActivity).onClick(list[position])
33 | }
34 | }
35 |
36 | override fun getItemCount(): Int = list.size
37 |
38 | inner class ReportHolder(
39 | val binding: ItemPoliceReportBinding
40 | ) : RecyclerView.ViewHolder(
41 | binding.root
42 | ) {
43 |
44 | fun bind (item : PoliceModel) {
45 |
46 | binding.tvReportName.text = item.reportType
47 |
48 | }
49 |
50 | }
51 |
52 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/ui/police/policeReport/PoliceReportActivity.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.ui.police.policeReport
2 |
3 | import android.content.Context
4 | import android.content.Intent
5 | import android.content.SharedPreferences
6 | import android.graphics.Color
7 | import androidx.appcompat.app.AppCompatActivity
8 | import android.os.Bundle
9 | import android.view.Menu
10 | import android.view.MenuItem
11 | import androidx.databinding.DataBindingUtil
12 | import androidx.lifecycle.ViewModelProviders
13 | import cn.pedant.SweetAlert.SweetAlertDialog
14 | import com.google.firebase.auth.FirebaseAuth
15 | import kotlinx.android.synthetic.main.activity_police_report.*
16 | import project.absurdnerds.simplify.Maps.LocationChangeInterface
17 | import project.absurdnerds.simplify.Maps.MapsFragment
18 | import project.absurdnerds.simplify.R
19 | import project.absurdnerds.simplify.api.ApiInterface
20 | import project.absurdnerds.simplify.data.request.PolicePostRequest
21 | import project.absurdnerds.simplify.data.response.PolicePostResponse
22 | import project.absurdnerds.simplify.databinding.ActivityPoliceReportBinding
23 | import project.absurdnerds.simplify.utils.dialog.ViewDialog
24 | import project.absurdnerds.simplify.utils.showToast
25 | import project.absurdnerds.simplify.ui.police.policeReport.PoliceReportViewState.*
26 | import project.absurdnerds.simplify.utils.AppConfig
27 | import retrofit2.Call
28 | import retrofit2.Callback
29 | import retrofit2.Response
30 | import timber.log.Timber
31 |
32 | class PoliceReportActivity : AppCompatActivity(), LocationChangeInterface {
33 |
34 | companion object{
35 |
36 | private lateinit var sharedPreferences: SharedPreferences
37 | private lateinit var firebaseAuth: FirebaseAuth
38 | private lateinit var sweetAlertDialog: SweetAlertDialog
39 | private var location: String = ""
40 | private var latLong: String = ""
41 | private var mobileNumber: String = ""
42 |
43 | private const val INTENT_REPORT_NAME = "intent_report_name"
44 | private const val INTENT_NOTIFY = "intent_notify"
45 | fun start(context: Context, report_name: String, notify : Boolean) {
46 | val intent = Intent(context, PoliceReportActivity::class.java)
47 | intent.putExtra(INTENT_REPORT_NAME, report_name)
48 | intent.putExtra(INTENT_NOTIFY, notify)
49 | context.startActivity(intent)
50 | }
51 | }
52 |
53 | private lateinit var binding : ActivityPoliceReportBinding
54 |
55 | private lateinit var viewModel : PoliceReportViewModel
56 |
57 | private lateinit var loadingDialog : ViewDialog
58 |
59 | private var reportType : String? = null
60 |
61 | private var notify : Boolean = false
62 |
63 | override fun onCreate(savedInstanceState: Bundle?) {
64 | super.onCreate(savedInstanceState)
65 | binding = DataBindingUtil.setContentView(this, R.layout.activity_police_report)
66 | initViewModel()
67 | handleIntent()
68 | setObservers()
69 | initUI()
70 |
71 | setSupportActionBar(toolPolice)
72 |
73 | supportFragmentManager.beginTransaction()
74 | .replace(R.id.policeLocationFrame, MapsFragment())
75 | .commit()
76 |
77 | btPoliceSubmit.setOnClickListener {
78 | postPoliceRequest()
79 | }
80 |
81 | }
82 |
83 | private fun postPoliceRequest() {
84 | sweetAlertDialog = SweetAlertDialog(this, SweetAlertDialog.PROGRESS_TYPE)
85 | sweetAlertDialog.progressHelper.barColor = Color.parseColor("#A5DC86");
86 | sweetAlertDialog.titleText = "Loading";
87 | sweetAlertDialog.setCancelable(false);
88 | sweetAlertDialog.show();
89 |
90 | location = etPoliceAddress.text.toString()
91 | var apiInterface = ApiInterface.invoke()
92 | val postRequest = PolicePostRequest(
93 | latLong,
94 | etPoliceAddress.text.toString(),
95 | intent.getStringExtra(INTENT_REPORT_NAME),
96 | etPoliceDescription.text.toString(),
97 | null,
98 | intent.getBooleanExtra(INTENT_NOTIFY, false),
99 | mobileNumber
100 | )
101 | Timber.e(intent.getStringExtra(INTENT_REPORT_NAME))
102 | Timber.e(mobileNumber)
103 | var call: Call = apiInterface.postPoliceData(postRequest)
104 |
105 | call.enqueue(object : Callback {
106 | override fun onResponse(
107 | call: Call,
108 | response: Response
109 | ) {
110 | Timber.e("Police Report : ${response.code().toString()}")
111 | Timber.e(response.message().toString())
112 | if (response.isSuccessful) {
113 | var sad = SweetAlertDialog(this@PoliceReportActivity, SweetAlertDialog.SUCCESS_TYPE)
114 | sad.titleText = "You have Registered your complaint"
115 | sad.show()
116 | }
117 | else {
118 | showToast("Something went wrong")
119 | }
120 | sweetAlertDialog.cancel()
121 | }
122 |
123 | override fun onFailure(call: Call, t: Throwable) {
124 | Timber.e(t)
125 | showToast("Something went wrong")
126 | sweetAlertDialog.cancel()
127 | }
128 | })
129 | }
130 |
131 | private fun initViewModel() {
132 | viewModel = ViewModelProviders.of(this).get(PoliceReportViewModel::class.java)
133 | loadingDialog = ViewDialog(this)
134 | }
135 |
136 | private fun setObservers() {
137 | viewModel.stateObservable.observe(this, {
138 | render(it)
139 | })
140 | }
141 |
142 | private fun handleIntent() {
143 | reportType = intent.getStringExtra(INTENT_REPORT_NAME)
144 | notify = intent.getBooleanExtra(INTENT_NOTIFY, false)
145 | }
146 |
147 | private fun initUI() {
148 |
149 | sharedPreferences = getSharedPreferences(AppConfig.SHARED_PREF, Context.MODE_PRIVATE)
150 | firebaseAuth = FirebaseAuth.getInstance()
151 |
152 | if (sharedPreferences.contains("PHONE")) {
153 | mobileNumber = sharedPreferences.getString("PHONE", "0").toString()
154 | }
155 | else {
156 | mobileNumber = firebaseAuth.currentUser!!.phoneNumber.toString()
157 | }
158 |
159 |
160 | binding.viewModel = viewModel
161 | }
162 |
163 | private fun render(state : PoliceReportViewState) {
164 | when(state) {
165 | Loading -> showLoading()
166 | OnSuccess -> onSuccess()
167 | is OnError -> onError(state.mssg)
168 | is FieldError -> showFieldError(state)
169 | }
170 | }
171 |
172 | private fun showLoading() {
173 | loadingDialog.showDialog()
174 | }
175 |
176 | private fun hideLoading() {
177 | loadingDialog.hideDialog()
178 | }
179 |
180 | private fun onSuccess() {
181 | hideLoading()
182 | showToast("Success")
183 | }
184 |
185 | private fun onError(message : String?) {
186 | hideLoading()
187 | if (message != null) {
188 | showToast(message)
189 | }
190 | }
191 |
192 | private fun showFieldError(type: FieldError) {
193 | hideLoading()
194 | /*when (type.errorType) {
195 | ErrorField.FIRST_NAME -> binding.etFirstName.error = type.message
196 | ErrorField.LAST_NAME -> binding.etLastName.error = type.message
197 | ErrorField.DOB -> binding.etDob.error = type.message
198 | ErrorField.HEIGHT -> binding.etHeight.error = type.message
199 | ErrorField.WEIGHT -> binding.etWeight.error = type.message
200 | ErrorField.PHONE -> binding.etPhone.error = type.message
201 | ErrorField.GENDER -> showToast(type.message)
202 | }*/
203 | }
204 |
205 | override fun onLocationChange(loc: String, lat: String) {
206 | location = loc
207 | latLong = lat
208 | etPoliceAddress.setText(location)
209 | }
210 |
211 | override fun onCreateOptionsMenu(menu: Menu?): Boolean {
212 | menuInflater.inflate(R.menu.menu, menu)
213 | return true
214 | }
215 |
216 | override fun onOptionsItemSelected(item: MenuItem): Boolean {
217 | // Handle item selection
218 | return when (item.itemId) {
219 | R.id.itemHistory -> {
220 | // TODO Add your Activity to open here
221 | // INTENT
222 |
223 | showToast("History")
224 |
225 | true
226 | }
227 | else -> super.onOptionsItemSelected(item)
228 | }
229 | }
230 |
231 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/ui/police/policeReport/PoliceReportViewModel.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.ui.police.policeReport
2 |
3 | import android.app.Application
4 | import androidx.lifecycle.AndroidViewModel
5 | import project.absurdnerds.simplify.ui.police.policeReport.PoliceReportViewState.*
6 | import project.absurdnerds.simplify.utils.lifecycle.SingleLiveEvent
7 |
8 | class PoliceReportViewModel constructor(
9 | private val app: Application
10 | ) : AndroidViewModel(app) {
11 |
12 | private var viewState: PoliceReportViewState = Init
13 | set(value) {
14 | field = value
15 | stateObservable.postValue(value)
16 | }
17 |
18 | val stateObservable: SingleLiveEvent by lazy {
19 | SingleLiveEvent()
20 | }
21 |
22 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/ui/police/policeReport/PoliceReportViewState.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.ui.police.policeReport
2 |
3 | sealed class PoliceReportViewState {
4 |
5 | object Init : PoliceReportViewState()
6 |
7 | object Loading : PoliceReportViewState()
8 |
9 | object OnSuccess : PoliceReportViewState()
10 |
11 | data class OnError(var mssg : String?) : PoliceReportViewState()
12 |
13 | data class FieldError(var errorType: ErrorField, var message: String?) : PoliceReportViewState()
14 |
15 | //todo change fields
16 | enum class ErrorField {
17 | FIRST_NAME,
18 | LAST_NAME,
19 | GENDER,
20 | DOB,
21 | WEIGHT,
22 | HEIGHT,
23 | PHONE
24 | }
25 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/utils/AppConfig.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * MIT License
3 | *
4 | * Copyright (c) 2020 Dheeraj Kotwani
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 |
25 | package project.absurdnerds.simplify.utils
26 |
27 | import java.util.*
28 |
29 | object AppConfig {
30 |
31 | const val BASE_URL = "https://simplify-reports.herokuapp.com/"
32 | const val AMBULANCE = "ambulance/"
33 | const val FIRE = "fire"
34 | const val POLICE = "police"
35 | const val SHARED_PREF = "SHARED_PREF"
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/utils/ReportType.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.utils
2 |
3 | enum class ReportType {
4 | FIRE,
5 | AMBULANCE,
6 | POLICE
7 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/utils/Utils.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.utils
2 |
3 | import android.Manifest
4 | import android.content.Context
5 | import android.content.pm.PackageManager
6 | import android.view.View
7 | import android.widget.Toast
8 | import androidx.appcompat.app.AppCompatActivity
9 | import androidx.constraintlayout.widget.Group
10 | import androidx.core.content.ContextCompat
11 | import androidx.fragment.app.Fragment
12 | import project.absurdnerds.simplify.fire.FireActivity
13 |
14 | val REQUEST_CODE_PERMISSIONS = 99
15 | val REQUEST_CODE_LOCATION = 98
16 | val REQUIRED_PERMISSIONS = arrayOf(
17 | Manifest.permission.ACCESS_COARSE_LOCATION,
18 | Manifest.permission.ACCESS_FINE_LOCATION
19 | )
20 |
21 | /**
22 | * This function enable the visibility of View
23 | */
24 | fun View.visible(): View {
25 | this.visibility = View.VISIBLE
26 | if (this is Group) {
27 | this.requestLayout()
28 | }
29 | return this
30 | }
31 |
32 | /**
33 | * This function hide the visibility of View
34 | */
35 | fun View.inVisible(): View {
36 | this.visibility = View.INVISIBLE
37 | if (this is Group) {
38 | this.requestLayout()
39 | }
40 | return this
41 | }
42 |
43 | /**
44 | * This function remove the visibility of View
45 | */
46 | fun View.gone(): View {
47 | this.visibility = View.GONE
48 | if (this is Group) {
49 | this.requestLayout()
50 | }
51 | return this
52 | }
53 |
54 | /**
55 | * This showToast fun can be called from Activity
56 | */
57 | fun AppCompatActivity.showToast(message: String) {
58 | Toast.makeText(this, message, Toast.LENGTH_SHORT).show()
59 | }
60 |
61 | /**
62 | * This showToast fun can be called from fragment
63 | */
64 | fun Fragment.showToast(message: String?) {
65 | Toast.makeText(this.activity, message, Toast.LENGTH_SHORT).show()
66 | }
67 |
68 | fun allPermissionsGranted(context: Context) = REQUIRED_PERMISSIONS.all {
69 | ContextCompat.checkSelfPermission(
70 | context, it
71 | ) == PackageManager.PERMISSION_GRANTED
72 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/utils/dialog/ViewDialog.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.utils.dialog
2 |
3 | import android.app.Dialog
4 | import android.content.Context
5 | import android.view.Window
6 | import androidx.appcompat.widget.AppCompatImageView
7 | import com.bumptech.glide.Glide
8 | import com.bumptech.glide.request.target.DrawableImageViewTarget
9 | import project.absurdnerds.simplify.R
10 |
11 | class ViewDialog constructor(context: Context) {
12 |
13 | private var dialog: Dialog = Dialog(context)
14 |
15 | init {
16 | dialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
17 | dialog.setCancelable(false)
18 | dialog.setContentView(R.layout.loading_dialog)
19 | val gifImageView: AppCompatImageView = dialog.findViewById(R.id.custom_loading_imageView)
20 | val imageViewTarget = DrawableImageViewTarget(gifImageView)
21 | Glide.with(context)
22 | .load(R.drawable.ambulance)
23 | .placeholder(R.drawable.ambulance)
24 | .centerCrop()
25 | .into(imageViewTarget)
26 | }
27 |
28 | fun showDialog() {
29 | dialog.show()
30 | }
31 |
32 | fun hideDialog() {
33 | dialog.dismiss()
34 | }
35 |
36 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/utils/lifecycle/SingleLiveEvent.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.utils.lifecycle
2 |
3 | import androidx.lifecycle.LifecycleOwner
4 | import androidx.lifecycle.MutableLiveData
5 | import androidx.lifecycle.Observer
6 | import java.util.concurrent.atomic.AtomicBoolean
7 |
8 | class SingleLiveEvent : MutableLiveData() {
9 |
10 | private val pending = AtomicBoolean(false)
11 |
12 | override fun observe(owner: LifecycleOwner, observer: Observer) {
13 | super.observe(owner, Observer { t ->
14 | if (pending.compareAndSet(true, false)) {
15 | observer.onChanged(t)
16 | }
17 | })
18 | }
19 |
20 | override fun setValue(t: T?) {
21 | pending.set(true)
22 | super.setValue(t)
23 | }
24 |
25 | fun call() {
26 | postValue(null)
27 | }
28 | }
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/utils/timber/DebugTree.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.utils.timber
2 |
3 | import timber.log.Timber
4 |
5 | class DebugTree : Timber.DebugTree() {
6 | override fun createStackElementTag(element: StackTraceElement): String? {
7 | return "(${element.fileName}:${element.lineNumber})#${element.methodName}"
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/app/src/main/java/project/absurdnerds/simplify/utils/timber/ReleaseTree.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify.utils.timber
2 |
3 | import timber.log.Timber
4 |
5 | class ReleaseTree : Timber.Tree() {
6 |
7 | override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
8 | }
9 |
10 | override fun e(t: Throwable?) {
11 | super.e(t)
12 | }
13 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ambulance.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AbsurdNerd/SimplifyReports/6d11358060c8db3443cef7875c029baca9049cba/app/src/main/res/drawable/ambulance.gif
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bottom_gradient.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/et_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
11 |
12 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/fire_gif.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AbsurdNerd/SimplifyReports/6d11358060c8db3443cef7875c029baca9049cba/app/src/main/res/drawable/fire_gif.gif
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_arrow_right.xml:
--------------------------------------------------------------------------------
1 |
6 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_baseline_arrow_back_ios_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_baseline_info_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_baseline_local_phone_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_baseline_location_on_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_baseline_person_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/police_gif.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AbsurdNerd/SimplifyReports/6d11358060c8db3443cef7875c029baca9049cba/app/src/main/res/drawable/police_gif.gif
--------------------------------------------------------------------------------
/app/src/main/res/drawable/signup_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/simplify_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AbsurdNerd/SimplifyReports/6d11358060c8db3443cef7875c029baca9049cba/app/src/main/res/drawable/simplify_icon.png
--------------------------------------------------------------------------------
/app/src/main/res/font/roboto.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/font/roboto_medium.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_fire.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
12 |
13 |
14 |
15 |
18 |
19 |
27 |
28 |
33 |
34 |
35 |
36 |
42 |
43 |
49 |
50 |
56 |
57 |
63 |
64 |
70 |
71 |
80 |
81 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
103 |
107 |
108 |
115 |
116 |
117 |
118 |
129 |
130 |
131 |
132 |
141 |
142 |
143 |
144 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_fire_history.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
19 |
20 |
25 |
26 |
27 |
28 |
34 |
35 |
41 |
42 |
48 |
49 |
55 |
56 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_login.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_new_user.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
22 |
28 |
29 |
35 |
36 |
43 |
44 |
45 |
46 |
47 |
61 |
62 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
86 |
87 |
97 |
98 |
109 |
110 |
115 |
116 |
125 |
126 |
130 |
131 |
138 |
139 |
144 |
145 |
146 |
147 |
148 |
149 |
158 |
159 |
170 |
171 |
180 |
181 |
182 |
183 |
184 |
185 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_police.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
19 |
20 |
25 |
26 |
27 |
28 |
34 |
35 |
41 |
42 |
48 |
49 |
55 |
56 |
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_police_report.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
12 |
13 |
14 |
15 |
18 |
19 |
27 |
28 |
33 |
34 |
35 |
36 |
42 |
43 |
49 |
50 |
56 |
57 |
63 |
64 |
70 |
71 |
79 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
108 |
116 |
117 |
124 |
125 |
126 |
127 |
132 |
133 |
140 |
141 |
142 |
143 |
148 |
149 |
157 |
158 |
159 |
160 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_maps.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_history_fire.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
12 |
16 |
17 |
27 |
28 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_history_police.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
12 |
16 |
17 |
28 |
29 |
39 |
40 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_police_report.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
12 |
15 |
16 |
28 |
29 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/loading_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/login_mobile_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
18 |
19 |
29 |
30 |
39 |
40 |
54 |
55 |
56 |
69 |
70 |
79 |
80 |
90 |
91 |
106 |
107 |
108 |
123 |
124 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/login_otp_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
18 |
19 |
20 |
29 |
30 |
40 |
41 |
54 |
55 |
64 |
65 |
80 |
81 |
84 |
85 |
100 |
101 |
104 |
105 |
120 |
121 |
124 |
125 |
140 |
141 |
144 |
145 |
160 |
161 |
164 |
165 |
180 |
181 |
182 |
183 |
193 |
194 |
202 |
203 |
214 |
215 |
216 |
231 |
232 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AbsurdNerd/SimplifyReports/6d11358060c8db3443cef7875c029baca9049cba/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AbsurdNerd/SimplifyReports/6d11358060c8db3443cef7875c029baca9049cba/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AbsurdNerd/SimplifyReports/6d11358060c8db3443cef7875c029baca9049cba/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AbsurdNerd/SimplifyReports/6d11358060c8db3443cef7875c029baca9049cba/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AbsurdNerd/SimplifyReports/6d11358060c8db3443cef7875c029baca9049cba/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AbsurdNerd/SimplifyReports/6d11358060c8db3443cef7875c029baca9049cba/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AbsurdNerd/SimplifyReports/6d11358060c8db3443cef7875c029baca9049cba/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AbsurdNerd/SimplifyReports/6d11358060c8db3443cef7875c029baca9049cba/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AbsurdNerd/SimplifyReports/6d11358060c8db3443cef7875c029baca9049cba/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AbsurdNerd/SimplifyReports/6d11358060c8db3443cef7875c029baca9049cba/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/raw/pikachu_scream.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AbsurdNerd/SimplifyReports/6d11358060c8db3443cef7875c029baca9049cba/app/src/main/res/raw/pikachu_scream.mp3
--------------------------------------------------------------------------------
/app/src/main/res/values-night/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFBB86FC
4 | #FF6200EE
5 | #FF3700B3
6 | #FF03DAC5
7 | #FF018786
8 | #FF000000
9 | #FFFFFFFF
10 | #F4EAEA
11 | #A5DC86
12 | #9D7ED6
13 |
--------------------------------------------------------------------------------
/app/src/main/res/values/font_certs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | - @array/com_google_android_gms_fonts_certs_dev
5 | - @array/com_google_android_gms_fonts_certs_prod
6 |
7 |
8 | -
9 | MIIEqDCCA5CgAwIBAgIJANWFuGx90071MA0GCSqGSIb3DQEBBAUAMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTAeFw0wODA0MTUyMzM2NTZaFw0zNTA5MDEyMzM2NTZaMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTCCASAwDQYJKoZIhvcNAQEBBQADggENADCCAQgCggEBANbOLggKv+IxTdGNs8/TGFy0PTP6DHThvbbR24kT9ixcOd9W+EaBPWW+wPPKQmsHxajtWjmQwWfna8mZuSeJS48LIgAZlKkpFeVyxW0qMBujb8X8ETrWy550NaFtI6t9+u7hZeTfHwqNvacKhp1RbE6dBRGWynwMVX8XW8N1+UjFaq6GCJukT4qmpN2afb8sCjUigq0GuMwYXrFVee74bQgLHWGJwPmvmLHC69EH6kWr22ijx4OKXlSIx2xT1AsSHee70w5iDBiK4aph27yH3TxkXy9V89TDdexAcKk/cVHYNnDBapcavl7y0RiQ4biu8ymM8Ga/nmzhRKya6G0cGw8CAQOjgfwwgfkwHQYDVR0OBBYEFI0cxb6VTEM8YYY6FbBMvAPyT+CyMIHJBgNVHSMEgcEwgb6AFI0cxb6VTEM8YYY6FbBMvAPyT+CyoYGapIGXMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbYIJANWFuGx90071MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEEBQADggEBABnTDPEF+3iSP0wNfdIjIz1AlnrPzgAIHVvXxunW7SBrDhEglQZBbKJEk5kT0mtKoOD1JMrSu1xuTKEBahWRbqHsXclaXjoBADb0kkjVEJu/Lh5hgYZnOjvlba8Ld7HCKePCVePoTJBdI4fvugnL8TsgK05aIskyY0hKI9L8KfqfGTl1lzOv2KoWD0KWwtAWPoGChZxmQ+nBli+gwYMzM1vAkP+aayLe0a1EQimlOalO762r0GXO0ks+UeXde2Z4e+8S/pf7pITEI/tP+MxJTALw9QUWEv9lKTk+jkbqxbsh8nfBUapfKqYn0eidpwq2AzVp3juYl7//fKnaPhJD9gs=
10 |
11 |
12 |
13 | -
14 | MIIEQzCCAyugAwIBAgIJAMLgh0ZkSjCNMA0GCSqGSIb3DQEBBAUAMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDAeFw0wODA4MjEyMzEzMzRaFw0zNjAxMDcyMzEzMzRaMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDCCASAwDQYJKoZIhvcNAQEBBQADggENADCCAQgCggEBAKtWLgDYO6IIrgqWbxJOKdoR8qtW0I9Y4sypEwPpt1TTcvZApxsdyxMJZ2JORland2qSGT2y5b+3JKkedxiLDmpHpDsz2WCbdxgxRczfey5YZnTJ4VZbH0xqWVW/8lGmPav5xVwnIiJS6HXk+BVKZF+JcWjAsb/GEuq/eFdpuzSqeYTcfi6idkyugwfYwXFU1+5fZKUaRKYCwkkFQVfcAs1fXA5V+++FGfvjJ/CxURaSxaBvGdGDhfXE28LWuT9ozCl5xw4Yq5OGazvV24mZVSoOO0yZ31j7kYvtwYK6NeADwbSxDdJEqO4k//0zOHKrUiGYXtqw/A0LFFtqoZKFjnkCAQOjgdkwgdYwHQYDVR0OBBYEFMd9jMIhF1Ylmn/Tgt9r45jk14alMIGmBgNVHSMEgZ4wgZuAFMd9jMIhF1Ylmn/Tgt9r45jk14aloXikdjB0MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLR29vZ2xlIEluYy4xEDAOBgNVBAsTB0FuZHJvaWQxEDAOBgNVBAMTB0FuZHJvaWSCCQDC4IdGZEowjTAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBAUAA4IBAQBt0lLO74UwLDYKqs6Tm8/yzKkEu116FmH4rkaymUIE0P9KaMftGlMexFlaYjzmB2OxZyl6euNXEsQH8gjwyxCUKRJNexBiGcCEyj6z+a1fuHHvkiaai+KL8W1EyNmgjmyy8AW7P+LLlkR+ho5zEHatRbM/YAnqGcFh5iZBqpknHf1SKMXFh4dd239FJ1jWYfbMDMy3NS5CTMQ2XFI1MvcyUTdZPErjQfTbQe3aDQsQcafEQPD+nqActifKZ0Np0IS9L9kR/wbNvyz6ENwPiTrjV2KRkEjH78ZMcUQXg0L3BYHJ3lc69Vs5Ddf9uUGGMYldX3WfMBEmh/9iFBDAaTCK
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/values/preloaded_fonts.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | - @font/roboto
5 | - @font/roboto_medium
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Simplify Report
3 |
4 | We will send you an One Time Password \n on your registering mobile number
5 | Enter the OTP sent to +91-XXXXXXXXXX
6 |
7 | Fire Alert
8 | Medical Alert
9 | Police Report
10 | Enter Age
11 | Fill the patient form :
12 | Enter Patient Name
13 | Enter Patient Gender
14 | Encounter fire nearby pin the location and hit alert
15 | Alert
16 | Call an Ambulance
17 | Enter Patient Problem
18 | Enter patient phone number
19 | Submit
20 | Describe your problem in detail
21 | SHARED_PREF
22 | PHONE
23 | Success
24 | Loading
25 | You have Reported Fire in your Area
26 | Something went wrong
27 | Permissions not granted by the user
28 | History
29 | Mobile Number can\'t be blank
30 | Phone Verified
31 | Error Sending OTP
32 | You have Reported a Patient
33 | button pressed
34 | Found
35 | Missing
36 | Death
37 | Robbery
38 | All fields are compulsory
39 | Turn on Location Access from settings
40 | Ambulance
41 | Create Account
42 | Address
43 | Location
44 | Date
45 | Patient Name
46 | Verification
47 | Enter Mobile Number
48 | GET OTP
49 | OTP Verification
50 | Didn\'t receive the OTP?
51 | RESEND OTP
52 | Verify
53 | First Name
54 | Last Name
55 | Phone
56 | Gender
57 | Male
58 | Female
59 | Permanent Address
60 |
61 | - A+
62 | - B+
63 | - O+
64 | - AB+
65 | - A-
66 | - B-
67 | - O-
68 | - AB-
69 |
70 |
71 | - Male
72 | - Female
73 | - Other
74 |
75 |
76 |
--------------------------------------------------------------------------------
/app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
17 |
--------------------------------------------------------------------------------
/app/src/release/res/values/google_maps_api.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 | YOUR_KEY_HERE
20 |
--------------------------------------------------------------------------------
/app/src/test/java/project/absurdnerds/simplify/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package project.absurdnerds.simplify
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | buildscript {
3 | ext.kotlin_version = "1.4.10"
4 | repositories {
5 | google()
6 | jcenter()
7 | }
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:4.0.1'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | classpath 'com.google.gms:google-services:4.3.4'
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app"s APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
20 | # Kotlin code style for this project: "official" or "obsolete":
21 | kotlin.code.style=official
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AbsurdNerd/SimplifyReports/6d11358060c8db3443cef7875c029baca9049cba/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Nov 10 18:08:26 IST 2020
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 | rootProject.name = "Simplify"
--------------------------------------------------------------------------------