-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f291fbf
Showing
76 changed files
with
2,638 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# ⚡ Spark Women - A Women Safety Application | ||
## _Feel Safe Everywhere_ | ||
|
||
|
||
Women Safety App is user friendly application built in Android Studio, | ||
it is simple to implement,easy to understand. | ||
|
||
Demo Download App : [Click Here](https://drive.google.com/file/d/1ZWB_HUyxm86T6GtpMhTWbOwuw6i7G4Wp/view?usp=sharing) | ||
|
||
[<img src="media/SPARKWOMEN.png" />](https://t.me/vinayak_09) | ||
|
||
|
||
|
||
|
||
## Features | ||
|
||
- Easy to implement | ||
- Easy to understand | ||
- Shake detector | ||
- Siren sound | ||
- Call to registered mobile | ||
- Shake device to send SOS to registered mobile and play siren | ||
- Sends Last Known Location to registered mobile | ||
- Now we can add multiple contacts to send SOS | ||
|
||
#### Prerequisites : | ||
- Android Studio | ||
- Basic knowledge about Firebase Authentication and Realtime database. | ||
## Build and Run Application | ||
|
||
###### SparkWomen A Women Safety Application requires Android Oreo or newer version to run. | ||
Follow this steps to get Working Project! | ||
``` | ||
Clone this repository or download file | ||
Extract zip if downloaded code | ||
Open project in Android Studio | ||
Wait while Android Studio Download gradle or required files | ||
Hit Run Button ! | ||
``` | ||
|
||
------------ | ||
|
||
Full Project demonstration Youtube :<br> | ||
Link - https://youtu.be/E0WLnlkPDJY | ||
|
||
**Free Software, Hell Yeah!** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
plugins { | ||
id 'com.android.application' | ||
} | ||
|
||
android { | ||
compileSdkVersion 31 | ||
buildToolsVersion "30.0.3" | ||
|
||
defaultConfig { | ||
applicationId "com.darkness.sparkwomen" | ||
minSdkVersion 24 | ||
targetSdkVersion 31 | ||
versionCode 1 | ||
versionName "1.0" | ||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
} | ||
|
||
dependencies { | ||
|
||
implementation 'androidx.appcompat:appcompat:1.4.1' | ||
implementation 'com.google.android.material:material:1.5.0' | ||
implementation 'androidx.constraintlayout:constraintlayout:2.1.3' | ||
testImplementation 'junit:junit:4.+' | ||
androidTestImplementation 'androidx.test.ext:junit:1.1.3' | ||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' | ||
|
||
|
||
implementation 'com.google.android.gms:play-services-maps:18.0.2' | ||
implementation 'com.google.android.gms:play-services-location:19.0.1' | ||
implementation 'com.github.tbouron.shakedetector:library:1.0.0@aar' | ||
|
||
implementation 'com.karumi:dexter:6.2.3' | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
26 changes: 26 additions & 0 deletions
26
app/src/androidTest/java/com/darkness/sparkwomen/ExampleInstrumentedTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.darkness.sparkwomen; | ||
|
||
import android.content.Context; | ||
|
||
import androidx.test.platform.app.InstrumentationRegistry; | ||
import androidx.test.ext.junit.runners.AndroidJUnit4; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
*/ | ||
@RunWith(AndroidJUnit4.class) | ||
public class ExampleInstrumentedTest { | ||
@Test | ||
public void useAppContext() { | ||
// Context of the app under test. | ||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); | ||
assertEquals("com.darkness.sparkwomen", appContext.getPackageName()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.darkness.sparkwomen"> | ||
|
||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | ||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | ||
<uses-permission android:name="android.permission.SEND_SMS"/> | ||
<uses-permission android:name="android.permission.CALL_PHONE"/> | ||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/> | ||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> | ||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/> | ||
<uses-permission android:name="android.permission.RECORD_AUDIO"/> | ||
|
||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.SparkWomen"> | ||
<activity android:name="com.darkness.sparkwomen.SmsActivity"></activity> | ||
<activity android:name="com.darkness.sparkwomen.MainActivity" /> | ||
<activity android:name="com.darkness.sparkwomen.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="com.darkness.sparkwomen.LawDisplayerActivity" /> | ||
<activity android:name="com.darkness.sparkwomen.LawsActivity" /> | ||
<activity android:name="com.darkness.sparkwomen.ContactActivity" /> | ||
<activity android:name=".SelfDefenseActivity" /> | ||
|
||
<service android:name="com.darkness.sparkwomen.ServiceMine" /> | ||
</application> | ||
|
||
</manifest> |
190 changes: 190 additions & 0 deletions
190
app/src/main/java/com/darkness/sparkwomen/ContactActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,190 @@ | ||
package com.darkness.sparkwomen; | ||
|
||
import androidx.appcompat.app.AppCompatActivity; | ||
import androidx.recyclerview.widget.LinearLayoutManager; | ||
import androidx.recyclerview.widget.RecyclerView; | ||
|
||
import android.app.Dialog; | ||
import android.content.Intent; | ||
import android.content.SharedPreferences; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
import android.view.Window; | ||
import android.widget.Button; | ||
import android.widget.EditText; | ||
import android.widget.ImageView; | ||
import android.widget.TextView; | ||
import android.widget.Toast; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.LinkedHashSet; | ||
import java.util.Set; | ||
|
||
public class ContactActivity extends AppCompatActivity { | ||
|
||
|
||
EditText contact; | ||
Button addContact; | ||
|
||
RecyclerView recyclerView; | ||
|
||
HashMap<String,String> contacts; | ||
|
||
ArrayList<String> send; | ||
|
||
ContactsAdapter adapter; | ||
MyOnClickListener onClickListener; | ||
|
||
ImageView edit; | ||
|
||
TextView callerInfo; | ||
|
||
|
||
@Override | ||
public void onBackPressed() { | ||
super.onBackPressed(); | ||
startActivity(new Intent(this,MainActivity.class)); | ||
this.finish(); | ||
} | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_contact); | ||
|
||
|
||
|
||
edit = findViewById(R.id.editCallButton); | ||
|
||
|
||
edit.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View view) { | ||
Dialog dialog = new Dialog(ContactActivity.this); | ||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); | ||
dialog.setCancelable(false); | ||
dialog.setContentView(R.layout.dialog); | ||
|
||
Button close,save; | ||
close = dialog.findViewById(R.id.dialogCancel); | ||
save = dialog.findViewById(R.id.dialogSave); | ||
EditText number = dialog.findViewById(R.id.dialogEditText); | ||
|
||
save.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View view) { | ||
String numberText = number.getText().toString(); | ||
if(numberText.length() == 10){ | ||
SharedPreferences sharedPreferences = getSharedPreferences("MySharedPref",MODE_PRIVATE); | ||
SharedPreferences.Editor editor = sharedPreferences.edit(); | ||
editor.putString("firstNumber",numberText); | ||
editor.apply(); | ||
setCallingInformation(); | ||
dialog.dismiss(); | ||
}else { | ||
Toast.makeText(ContactActivity.this, "Enter valid number!", Toast.LENGTH_SHORT).show(); | ||
} | ||
} | ||
}); | ||
|
||
close.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View view) { | ||
dialog.dismiss(); | ||
} | ||
}); | ||
|
||
|
||
dialog.show(); | ||
} | ||
}); | ||
|
||
|
||
|
||
|
||
callerInfo = findViewById(R.id.callText); | ||
|
||
|
||
setCallingInformation(); | ||
|
||
|
||
contacts = new HashMap<>(); | ||
send = new ArrayList<>(); | ||
|
||
adapter = new ContactsAdapter(this, send, new MyOnClickListener() { | ||
@Override | ||
public void onItemClicked(int position) { | ||
deleteItemFromDatabase(position); | ||
} | ||
}); | ||
|
||
recyclerView = findViewById(R.id.contacts); | ||
recyclerView.setAdapter(adapter); | ||
recyclerView.setLayoutManager(new LinearLayoutManager(this)); | ||
|
||
getData(); | ||
|
||
contact = findViewById(R.id.contactGet); | ||
addContact = findViewById(R.id.addContact); | ||
|
||
addContact.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View view) { | ||
createContact(contact.getText().toString()); | ||
} | ||
}); | ||
} | ||
|
||
private void createContact(String contactString) { | ||
SharedPreferences sharedPreferences = getSharedPreferences("MySharedPref",MODE_PRIVATE); | ||
SharedPreferences.Editor editor = sharedPreferences.edit(); | ||
Set<String> oldNumbers = sharedPreferences.getStringSet("enumbers", new LinkedHashSet<>()); | ||
oldNumbers.add(contactString); | ||
editor.remove("enumbers"); | ||
editor.putStringSet("enumbers",oldNumbers); | ||
editor.apply(); | ||
|
||
contact.setText(""); | ||
editor.apply(); | ||
getData(); | ||
|
||
} | ||
|
||
|
||
private void setCallingInformation(){ | ||
SharedPreferences sharedPreferences = getSharedPreferences("MySharedPref",MODE_PRIVATE); | ||
String firstNumber = sharedPreferences.getString("firstNumber","null"); | ||
|
||
if (firstNumber.isEmpty()||firstNumber.equalsIgnoreCase("null")){ | ||
callerInfo.setText("Please add number."); | ||
}else { | ||
callerInfo.setText(firstNumber); | ||
} | ||
|
||
} | ||
|
||
|
||
|
||
|
||
private void deleteItemFromDatabase(int position) { | ||
SharedPreferences sharedPreferences = getSharedPreferences("MySharedPref",MODE_PRIVATE); | ||
Set<String> oldNumbers = sharedPreferences.getStringSet("enumbers", new LinkedHashSet<>()); | ||
SharedPreferences.Editor editor = sharedPreferences.edit(); | ||
editor.remove("enumbers"); | ||
oldNumbers.remove(send.get(position)); | ||
editor.putStringSet("enumbers",oldNumbers); | ||
editor.apply(); | ||
getData(); | ||
} | ||
|
||
|
||
|
||
private void getData() { | ||
send.clear(); | ||
SharedPreferences sharedPreferences = getSharedPreferences("MySharedPref",MODE_PRIVATE); | ||
Set<String> oldNumbers = sharedPreferences.getStringSet("enumbers", new LinkedHashSet<>()); | ||
send.addAll(oldNumbers); | ||
adapter.notifyDataSetChanged(); | ||
} | ||
} |
Oops, something went wrong.