diff --git a/app/build.gradle b/app/build.gradle index 4fc709d..3d6707d 100755 --- a/app/build.gradle +++ b/app/build.gradle @@ -14,7 +14,7 @@ android { versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" - vectorDrawables.generatedDensities = ['hdpi', 'xxhdpi'] + vectorDrawables.generatedDensities = ['hdpi', 'xxhdpi'] } buildTypes { release { @@ -54,8 +54,11 @@ dependencies { releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4' implementation 'com.google.firebase:firebase-messaging:15.0.2' implementation files('libs/YouTubeAndroidPlayerApi.jar') + implementation 'com.google.android.gms:play-services-maps:15.0.1' + implementation "com.google.android.gms:play-services-location:15.0.1" } apply plugin: 'com.google.gms.google-services' +apply plugin: 'com.google.gms.google-services' diff --git a/app/src/debug/res/values/google_maps_api.xml b/app/src/debug/res/values/google_maps_api.xml new file mode 100644 index 0000000..ebb5b8a --- /dev/null +++ b/app/src/debug/res/values/google_maps_api.xml @@ -0,0 +1,24 @@ + + + AIzaSyCLN5U22uZvhQy0qZo0TGx4mH4TuGzT-VE + diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a36b3f3..5b2c234 100755 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -3,6 +3,7 @@ xmlns:tools="http://schemas.android.com/tools" package="in.paperwrk.safetycollabproject"> + @@ -14,8 +15,15 @@ android:smallScreens="false" android:xlargeScreens="true" /> + + + - - - - - - - + + android:theme="@style/AppTheme.NoActionBar"/> + + + + + @@ -61,13 +77,22 @@ - - + + diff --git a/app/src/main/java/in/paperwrk/safetycollabproject/accounts/SigninActivity.java b/app/src/main/java/in/paperwrk/safetycollabproject/accounts/SigninActivity.java index 5ff434b..49f2346 100644 --- a/app/src/main/java/in/paperwrk/safetycollabproject/accounts/SigninActivity.java +++ b/app/src/main/java/in/paperwrk/safetycollabproject/accounts/SigninActivity.java @@ -120,16 +120,18 @@ private void doSignIn() { String email = mEmailText.getText().toString(); String password = mPasswordText.getText().toString(); - if (email.isEmpty()) { - mHelpers.showAlertDialog(getString(R.string.email_required_msg), getString(R.string.enter_email_msg)).show(); - return; - } - - if (password.isEmpty()) { - mHelpers.showAlertDialog(getString(R.string.password_required_msg), getString(R.string.enter_password_msg)).show(); - return; - } - loginWithFirebaseEmailPassword(email, password); +// if (email.isEmpty()) { +// mHelpers.showAlertDialog(getString(R.string.email_required_msg), getString(R.string.enter_email_msg)).show(); +// return; +// } +// +// if (password.isEmpty()) { +// mHelpers.showAlertDialog(getString(R.string.password_required_msg), getString(R.string.enter_password_msg)).show(); +// return; +// } +// loginWithFirebaseEmailPassword(email, password); + + navigateToHome(); } private void navigateToHome() { diff --git a/app/src/main/java/in/paperwrk/safetycollabproject/activities/HomeActivity.java b/app/src/main/java/in/paperwrk/safetycollabproject/activities/HomeActivity.java index b1fdb66..91bf173 100644 --- a/app/src/main/java/in/paperwrk/safetycollabproject/activities/HomeActivity.java +++ b/app/src/main/java/in/paperwrk/safetycollabproject/activities/HomeActivity.java @@ -111,7 +111,7 @@ public boolean onItemClick(View view, int position, IDrawerItem drawerItem) { @Override public boolean onItemClick(View view, int position, IDrawerItem drawerItem) { if (mFirebaseUser != null) { - mGoogleSignInClient.signOut(); + mFirebaseAuth.signOut(); mFirebaseAuth.signOut(); } navigateToHome(); diff --git a/app/src/main/java/in/paperwrk/safetycollabproject/activities/PageIntroActivity.java b/app/src/main/java/in/paperwrk/safetycollabproject/activities/PageIntroActivity.java index 1cf24ce..44930ef 100644 --- a/app/src/main/java/in/paperwrk/safetycollabproject/activities/PageIntroActivity.java +++ b/app/src/main/java/in/paperwrk/safetycollabproject/activities/PageIntroActivity.java @@ -181,4 +181,4 @@ public void destroyItem(ViewGroup container, int position, Object object) { container.removeView(view); } } -} +} \ No newline at end of file diff --git a/app/src/main/java/in/paperwrk/safetycollabproject/activities/SplashActivity.java b/app/src/main/java/in/paperwrk/safetycollabproject/activities/SplashActivity.java index 76dc838..3f65abe 100644 --- a/app/src/main/java/in/paperwrk/safetycollabproject/activities/SplashActivity.java +++ b/app/src/main/java/in/paperwrk/safetycollabproject/activities/SplashActivity.java @@ -37,4 +37,4 @@ public void onBackPressed() { finish(); } -} +} \ No newline at end of file diff --git a/app/src/main/java/in/paperwrk/safetycollabproject/fragments/TrackUserFragment.java b/app/src/main/java/in/paperwrk/safetycollabproject/fragments/TrackUserFragment.java index 682c29c..919cea8 100644 --- a/app/src/main/java/in/paperwrk/safetycollabproject/fragments/TrackUserFragment.java +++ b/app/src/main/java/in/paperwrk/safetycollabproject/fragments/TrackUserFragment.java @@ -1,19 +1,44 @@ package in.paperwrk.safetycollabproject.fragments; +import android.Manifest; +import android.content.pm.PackageManager; +import android.location.Location; +import android.os.Build; import android.os.Bundle; +import android.support.v4.app.ActivityCompat; import android.support.v4.app.Fragment; +import android.support.v4.app.FragmentManager; +import android.support.v4.app.FragmentTransaction; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import com.google.android.gms.location.FusedLocationProviderClient; +import com.google.android.gms.location.LocationServices; +import com.google.android.gms.maps.CameraUpdateFactory; +import com.google.android.gms.maps.GoogleMap; +import com.google.android.gms.maps.OnMapReadyCallback; +import com.google.android.gms.maps.SupportMapFragment; +import com.google.android.gms.maps.model.BitmapDescriptorFactory; +import com.google.android.gms.maps.model.LatLng; +import com.google.android.gms.maps.model.MarkerOptions; +import com.google.android.gms.tasks.OnSuccessListener; + import in.paperwrk.safetycollabproject.R; /** * A simple {@link Fragment} subclass. */ -public class TrackUserFragment extends Fragment { +public class TrackUserFragment extends Fragment implements OnMapReadyCallback { + + + SupportMapFragment mMapFragment; + private GoogleMap mMap; + double latitude; + double longitude; + private FusedLocationProviderClient mFusedLocationClient; public TrackUserFragment() { @@ -25,7 +50,89 @@ public TrackUserFragment() { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment - return inflater.inflate(R.layout.fragment_track_user, container, false); + View v = inflater.inflate(R.layout.fragment_track_user, container, false); + mMapFragment = (SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.mapView); + mFusedLocationClient = LocationServices.getFusedLocationProviderClient(getActivity()); + if (mMapFragment == null) { + FragmentManager fragmentManager = getFragmentManager(); + FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); + mMapFragment = SupportMapFragment.newInstance(); + fragmentTransaction.replace(R.id.mapView, mMapFragment).commit(); + } + + mMapFragment.getMapAsync(this); + return v; + } + + + @Override + public void onMapReady(GoogleMap googleMap) { + + mMap = googleMap; + onPermissionCheck(); + } + private void onPermissionCheck() { + + if (Build.VERSION.SDK_INT < 23) { + if (ActivityCompat.checkSelfPermission(getActivity(), android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(getActivity(), android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { + + ActivityCompat.requestPermissions(getActivity(), new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION}, 1); + ActivityCompat.requestPermissions(getActivity(), new String[]{android.Manifest.permission.ACCESS_COARSE_LOCATION}, 1); + } + mFusedLocationClient.getLastLocation() + .addOnSuccessListener(getActivity(), new OnSuccessListener() { + @Override + public void onSuccess(Location location) { + if (location != null) { + latitude = location.getLatitude(); + longitude = location.getLongitude(); + LatLng cureentLocation = new LatLng(location.getLatitude(), location.getLongitude()); + mMap.addMarker(new MarkerOptions().position(cureentLocation) + .title("Current Location") + .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN))); + mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(cureentLocation, 15)); + } + + } + }); + } else { + if (ActivityCompat.checkSelfPermission(getActivity(), android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(getActivity(), android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { + ActivityCompat.requestPermissions(getActivity(), new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 1); + mFusedLocationClient.getLastLocation() + .addOnSuccessListener(getActivity(), new OnSuccessListener() { + @Override + public void onSuccess(Location location) { + + if (location != null) { + latitude = location.getLatitude(); + longitude = location.getLongitude(); + LatLng cureentLocation = new LatLng(location.getLatitude(), location.getLongitude()); + mMap.addMarker(new MarkerOptions().position(cureentLocation).title("Current Location")); + mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(cureentLocation, 15)); + } + + } + }); + + } else { + mFusedLocationClient.getLastLocation() + .addOnSuccessListener(getActivity(), new OnSuccessListener() { + @Override + public void onSuccess(Location location) { + + if (location != null) { + latitude = location.getLatitude(); + longitude = location.getLongitude(); + LatLng cureentLocation = new LatLng(location.getLatitude(), location.getLongitude()); + mMap.addMarker(new MarkerOptions().position(cureentLocation).title("Current Location")); + mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(cureentLocation, 15)); + } + + } + }); + } + } + } } diff --git a/app/src/main/java/in/paperwrk/safetycollabproject/notification/MyFirebaseMessagingService.java b/app/src/main/java/in/paperwrk/safetycollabproject/notification/MyFirebaseMessagingService.java index be338e5..1fe1bd3 100644 --- a/app/src/main/java/in/paperwrk/safetycollabproject/notification/MyFirebaseMessagingService.java +++ b/app/src/main/java/in/paperwrk/safetycollabproject/notification/MyFirebaseMessagingService.java @@ -2,7 +2,6 @@ import android.content.Intent; -import com.google.firebase.iid.FirebaseInstanceIdService; import com.google.firebase.messaging.FirebaseMessagingService; import com.google.firebase.messaging.RemoteMessage; diff --git a/app/src/main/res/anim/animdowntoup.xml b/app/src/main/res/anim/animdowntoup.xml new file mode 100644 index 0000000..fff206b --- /dev/null +++ b/app/src/main/res/anim/animdowntoup.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/anim/animlefttoright.xml b/app/src/main/res/anim/animlefttoright.xml new file mode 100644 index 0000000..70f1afc --- /dev/null +++ b/app/src/main/res/anim/animlefttoright.xml @@ -0,0 +1,7 @@ + + + + diff --git a/app/src/main/res/anim/scaleup.xml b/app/src/main/res/anim/scaleup.xml new file mode 100644 index 0000000..1796bd1 --- /dev/null +++ b/app/src/main/res/anim/scaleup.xml @@ -0,0 +1,12 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable-hdpi/ic_email_black_18dp.png b/app/src/main/res/drawable-hdpi/ic_email_black_18dp.png new file mode 100644 index 0000000..ef03f95 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_email_black_18dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_lock_black_18dp.png b/app/src/main/res/drawable-hdpi/ic_lock_black_18dp.png new file mode 100644 index 0000000..f314292 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_lock_black_18dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_person_black_18dp.png b/app/src/main/res/drawable-hdpi/ic_person_black_18dp.png new file mode 100644 index 0000000..c19e355 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_person_black_18dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_phone_black_18dp.png b/app/src/main/res/drawable-hdpi/ic_phone_black_18dp.png new file mode 100644 index 0000000..8def1e0 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_phone_black_18dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_email_black_18dp.png b/app/src/main/res/drawable-mdpi/ic_email_black_18dp.png new file mode 100644 index 0000000..977c4cb Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_email_black_18dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_lock_black_18dp.png b/app/src/main/res/drawable-mdpi/ic_lock_black_18dp.png new file mode 100644 index 0000000..317c034 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_lock_black_18dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_person_black_18dp.png b/app/src/main/res/drawable-mdpi/ic_person_black_18dp.png new file mode 100644 index 0000000..599e87b Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_person_black_18dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_phone_black_18dp.png b/app/src/main/res/drawable-mdpi/ic_phone_black_18dp.png new file mode 100644 index 0000000..0bfd66d Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_phone_black_18dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_email_black_18dp.png b/app/src/main/res/drawable-xhdpi/ic_email_black_18dp.png new file mode 100644 index 0000000..36c6311 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_email_black_18dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_lock_black_18dp.png b/app/src/main/res/drawable-xhdpi/ic_lock_black_18dp.png new file mode 100644 index 0000000..de50295 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_lock_black_18dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_person_black_18dp.png b/app/src/main/res/drawable-xhdpi/ic_person_black_18dp.png new file mode 100644 index 0000000..6fbcc6d Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_person_black_18dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_phone_black_18dp.png b/app/src/main/res/drawable-xhdpi/ic_phone_black_18dp.png new file mode 100644 index 0000000..d4077ac Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_phone_black_18dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_email_black_18dp.png b/app/src/main/res/drawable-xxhdpi/ic_email_black_18dp.png new file mode 100644 index 0000000..0648fbd Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_email_black_18dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_lock_black_18dp.png b/app/src/main/res/drawable-xxhdpi/ic_lock_black_18dp.png new file mode 100644 index 0000000..17e8158 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_lock_black_18dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_person_black_18dp.png b/app/src/main/res/drawable-xxhdpi/ic_person_black_18dp.png new file mode 100644 index 0000000..5e516bc Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_person_black_18dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_phone_black_18dp.png b/app/src/main/res/drawable-xxhdpi/ic_phone_black_18dp.png new file mode 100644 index 0000000..5dba808 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_phone_black_18dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_email_black_18dp.png b/app/src/main/res/drawable-xxxhdpi/ic_email_black_18dp.png new file mode 100644 index 0000000..3d13627 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_email_black_18dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_lock_black_18dp.png b/app/src/main/res/drawable-xxxhdpi/ic_lock_black_18dp.png new file mode 100644 index 0000000..a7caa2d Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_lock_black_18dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_person_black_18dp.png b/app/src/main/res/drawable-xxxhdpi/ic_person_black_18dp.png new file mode 100644 index 0000000..f1e1484 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_person_black_18dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_phone_black_18dp.png b/app/src/main/res/drawable-xxxhdpi/ic_phone_black_18dp.png new file mode 100644 index 0000000..7c9d1b0 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_phone_black_18dp.png differ diff --git a/app/src/main/res/drawable/googleicon.png b/app/src/main/res/drawable/googleicon.png new file mode 100644 index 0000000..708d4c3 Binary files /dev/null and b/app/src/main/res/drawable/googleicon.png differ diff --git a/app/src/main/res/drawable/ic_email_black_18dp.png b/app/src/main/res/drawable/ic_email_black_18dp.png new file mode 100644 index 0000000..ef03f95 Binary files /dev/null and b/app/src/main/res/drawable/ic_email_black_18dp.png differ diff --git a/app/src/main/res/drawable/ic_lock_black_18dp.png b/app/src/main/res/drawable/ic_lock_black_18dp.png new file mode 100644 index 0000000..f314292 Binary files /dev/null and b/app/src/main/res/drawable/ic_lock_black_18dp.png differ diff --git a/app/src/main/res/drawable/ic_person_black_18dp.png b/app/src/main/res/drawable/ic_person_black_18dp.png new file mode 100644 index 0000000..c19e355 Binary files /dev/null and b/app/src/main/res/drawable/ic_person_black_18dp.png differ diff --git a/app/src/main/res/drawable/ic_phone_black_18dp.png b/app/src/main/res/drawable/ic_phone_black_18dp.png new file mode 100644 index 0000000..8def1e0 Binary files /dev/null and b/app/src/main/res/drawable/ic_phone_black_18dp.png differ diff --git a/app/src/main/res/drawable/ic_phonelink_ring_white_18dp.png b/app/src/main/res/drawable/ic_phonelink_ring_white_18dp.png new file mode 100644 index 0000000..0f642ff Binary files /dev/null and b/app/src/main/res/drawable/ic_phonelink_ring_white_18dp.png differ diff --git a/app/src/main/res/drawable/onboarding_image_1.png b/app/src/main/res/drawable/onboarding_image_1.png new file mode 100644 index 0000000..e7a08a1 Binary files /dev/null and b/app/src/main/res/drawable/onboarding_image_1.png differ diff --git a/app/src/main/res/drawable/onboarding_image_2.png b/app/src/main/res/drawable/onboarding_image_2.png new file mode 100644 index 0000000..e4e3b1f Binary files /dev/null and b/app/src/main/res/drawable/onboarding_image_2.png differ diff --git a/app/src/main/res/drawable/onboarding_image_3.png b/app/src/main/res/drawable/onboarding_image_3.png new file mode 100644 index 0000000..f680138 Binary files /dev/null and b/app/src/main/res/drawable/onboarding_image_3.png differ diff --git a/app/src/main/res/drawable/onboarding_image_4.png b/app/src/main/res/drawable/onboarding_image_4.png new file mode 100644 index 0000000..c684025 Binary files /dev/null and b/app/src/main/res/drawable/onboarding_image_4.png differ diff --git a/app/src/main/res/drawable/women.png b/app/src/main/res/drawable/women.png new file mode 100644 index 0000000..eaf1cf9 Binary files /dev/null and b/app/src/main/res/drawable/women.png differ diff --git a/app/src/main/res/layout/fragment_fake_call.xml b/app/src/main/res/layout/fragment_fake_call.xml index a7c28ac..2f356e6 100644 --- a/app/src/main/res/layout/fragment_fake_call.xml +++ b/app/src/main/res/layout/fragment_fake_call.xml @@ -1,47 +1,40 @@ - + + - + - + android:layout_marginTop="50dp" + /> + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_sos.xml b/app/src/main/res/layout/fragment_sos.xml index e0cd405..d9503c8 100644 --- a/app/src/main/res/layout/fragment_sos.xml +++ b/app/src/main/res/layout/fragment_sos.xml @@ -1,32 +1,27 @@ - + + + android:layout_height="match_parent" + android:layout_gravity="center_horizontal|center_vertical" + android:gravity="center" + android:background="@color/fragmentsBackgroudColor" + > -