Skip to content

Submission - Girl Geeks #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
*.iml
.gradle
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
/.idea/*
.idea/gradle.xml
.idea/misc.xml
56 changes: 33 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,42 @@
# Code-with-Google-Maps-2023 - Hack2skill
#### Team Name - Girl Geeks
#### Problem Statement - Pregnancy Friendly Map - Navigating Motherhood with Ease
#### Team Leader Email - [email protected]

Welcome to the official repository for the Code-with-Google-Maps-2023 organized by Hack2skill!
![LOGO](/images/logo.png)

## Getting Started
### A Brief of the Prototype:
- This application is specially designed for Pregnant woman. She might use mapping services and applications for various purpose related to their health, safety, and comfort during pregnancy. So, we have planned to make a pregnancy friendly map that provides customised features and valuable information to support expectant mothers during significant phase of their lives. This map can consider mother's specific needs and provide her a safe and comfortable journey.
- This specialised Google Maps Application provides customised features like maternity facility Locator, emergency assistance, healthy eating options, mood swings changer by giving options for cravings and shopping. Also, expectant moms able to view live roads for safety and comfort. After analysing the road, simply navigates to the route using Google map navigation with ease. Whenever moms plans to go to any place that may risk their health, app will give them alert not to go for such places.
- This app can be owned by mother as well as any relative that concerns about the mother and her baby. We are helping expectant moms during their amazing and sensitive phase of life.

To get started with the Code-with-Google-Maps-2023 repository, follow these steps:
## UseCase Diagram:
The UseCase diagram represents the basic functionality of launching the application. The app prompts the user for necessary location permissions to provide accurate location-based services. The app offers users various map view options (e.g., satellite view, terrain view) for a customized mapping experience. It will allow users to explore different features available within the application. The map enables users to view live roads and surroundings using Street View functionality. Using this functionality, users can use navigational assistance, helping them find the best routes to their desired destinations. It will also allow users to search for specific locations such as hospitals, pharmacies, restaurants, and more.
![UML_DIAGRAM](/images/usecase_diagram.png)

### Submission Instruction:
1. Fork this repository
2. Create a folder with your Team Name
3. Upload all the code and necessary files in the created folder
4. Upload a **README.md** file in your folder with the below mentioned informations.
5. Generate a Pull Request with your Team Name. (Example: submission-XYZ_team)
### Screenshots:
![App Screenshot](/images/screenshot1.png)
![App Screenshot](/images/screenshot2.png)

### README.md must consist of the following information:

#### Team Name -
#### Problem Statement -
#### Team Leader Email -
### Tech Stack:
- Language - Kotlin
- Google Maps SDK for android
- Google Maps APIS - StreetView API, Routes API, Places API, Elevation API
- IDE - Android Studio
- Http Library - Retrofit

### A Brief of the Prototype:
This section must include UML Diagrams and prototype description

### Tech Stack:
List Down all technologies used to Build the prototype

### Step-by-Step Code Execution Instructions:
This Section must contain a set of instructions required to clone and run the prototype so that it can be tested and deeply analyzed

1. Clone the repository in Android Studio
2. replace <YOUR_API_KEY> with your API_KEY in local.properties
3. Enable StreetView API, Routes API, Places API, Elevation API in your project in google maps platform.
4. Compile and build the project
5. Connect a device or Emulator
6. Run the application

### Future Scope:
Write about the scalability and futuristic aspects of the prototype developed
- Speed Limit Alerts: Provide speed limit information for specific routes to help pregnant women stay within safe speed limits while traveling.
- In-App Recommendations: Add navigation features within the app so users can easily find and follow routes to their destinations.
- Places Suggestions: Offer suggestions for places of interest along selected routes during navigation, making it convenient for users to find amenities and services.
- Emergency Help: Include emergency buttons or hotlines in the app for immediate access to local emergency services in case of urgent needs.
- Exclusive Discounts: Collaborate with local businesses to provide exclusive discounts and promotions to expectant mothers using the app, making it more valuable for them.
- MOM's Friendly Design: Enhance the app's user interface to make it more user-friendly for mothers.
2 changes: 2 additions & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/build
/local.properties
88 changes: 88 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import org.jetbrains.kotlin.konan.properties.Properties
import com.android.build.api.variant.BuildConfigField

plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("com.google.android.libraries.mapsplatform.secrets-gradle-plugin")
}

android {
namespace = "com.map.mom"
compileSdk = 34

defaultConfig {
applicationId = "com.map.mom"
minSdk = 24
targetSdk = 33
versionCode = 1
versionName = "1.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
buildFeatures {
buildConfig = true
viewBinding = true
}
}

androidComponents {
val localProperties = Properties()
localProperties.load(rootProject.file("local.properties").reader())

onVariants {
it.buildConfigFields.put(
"MAPS_API_KEY",
BuildConfigField(
"String",
"\"${localProperties.getProperty("MAPS_API_KEY")}\"",
"Google maps api key"
)
)
}
}

configurations.all {
resolutionStrategy {
// Force the specific version of play-services-maps
force("com.google.android.gms:play-services-maps:18.2.0")
}
}

dependencies {

implementation("androidx.core:core-ktx:1.9.0")
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("com.google.android.material:material:1.10.0")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
implementation("com.intuit.sdp:sdp-android:1.1.0")

implementation("com.squareup.retrofit2:retrofit:2.9.0")
implementation("com.squareup.retrofit2:converter-gson:2.9.0")

implementation("com.google.android.gms:play-services-location:21.0.1")
implementation("com.google.android.libraries.places:places:3.2.0")
implementation("com.google.maps.android:android-maps-utils:3.4.0")
implementation("com.google.android.gms:play-services-maps:18.2.0")


}
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
24 changes: 24 additions & 0 deletions app/src/androidTest/java/com/map/mom/ExampleInstrumentedTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.map.mom

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.map.mom", appContext.packageName)
}
}
45 changes: 45 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" /> <!-- To request foreground location access, declare one of these permissions. -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <!-- Required only when requesting background location access on Android 10 (API level 29) -->
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />

<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.MOM"
tools:targetApi="31">
<activity
android:name=".screens.SplashActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".screens.StreetViewActivity"
android:exported="false" />
<activity
android:name=".screens.MainActivity"
android:exported="true"
android:label="@string/title_activity_main"/>

<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="${MAPS_API_KEY}" />
</application>

</manifest>
Binary file added app/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
102 changes: 102 additions & 0 deletions app/src/main/java/com/map/mom/adapters/FeaturesAdapter.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
package com.map.mom.adapters

import android.content.Context
import android.graphics.drawable.GradientDrawable
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.cardview.widget.CardView
import androidx.core.content.res.ResourcesCompat
import androidx.recyclerview.widget.RecyclerView
import com.map.mom.utility.Constants
import com.map.mom.models.Feature
import com.map.mom.R
import com.map.mom.databinding.ItemFeatureBinding

class FeaturesAdapter(
private val mContext: Context,
private val features: List<Feature>,
private val iOnFeatureItemClickListener: IOnFeatureItemClickListener
) :
RecyclerView.Adapter<FeaturesAdapter.ViewHolder>() {

private lateinit var shapeDrawable: GradientDrawable

class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val binding = ItemFeatureBinding.bind(itemView)
}

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val binding = ItemFeatureBinding.inflate(LayoutInflater.from(parent.context), parent, false)
return ViewHolder(binding.root)
}

override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val feature = features[position]
holder.binding.apply {
tvFeature.text = Constants.featureTextMap[feature.name] ?: ""
if (feature.isSelected) {
cardview.setFeatureSelected(feature.name)
} else {
cardview.setFeatureUnSelected()
}
ivFeature.setImageDrawable(
ResourcesCompat.getDrawable(
mContext.resources,
Constants.featureImageMap[feature.name] ?: R.drawable.activity,
null
)
)
}
holder.itemView.setOnClickListener {
iOnFeatureItemClickListener.onItemClick(feature, position)
}
}

private fun initDrawable() {
shapeDrawable = GradientDrawable()
shapeDrawable.setColor(
ResourcesCompat.getColor(
mContext.resources,
R.color.background,
null
)
)
shapeDrawable.cornerRadius = 15.dpToPx().toFloat()
}

private fun Int.dpToPx(): Int = (this * mContext.resources.displayMetrics.density).toInt()

override fun getItemCount(): Int {
return features.size
}

fun getSelectedFeature(): String?{
val selectedFeature = features.find { it.isSelected }
return selectedFeature?.name
}

private fun CardView.setFeatureSelected(featureName: String) {
//Apply same color to card as Map marker
//initialize for every different feature
initDrawable()
shapeDrawable.setStroke(
5.dpToPx(),
ResourcesCompat.getColor(
mContext.resources,
Constants.featureColorMap[featureName] ?: R.color.grey,
null
)
)
background = shapeDrawable
setContentPadding(10, 10, 10, 10)
}

private fun CardView.setFeatureUnSelected(){
setContentPadding(0, 0, 0, 0)
}

interface IOnFeatureItemClickListener {
fun onItemClick(feature: Feature, position: Int)
}
}
Loading