├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── drawable
│ │ │ │ ├── logo9.png
│ │ │ │ ├── logocar.png
│ │ │ │ ├── profile.png
│ │ │ │ ├── tooltip.png
│ │ │ │ ├── logocar1.png
│ │ │ │ ├── profile2.png
│ │ │ │ ├── cameraicon.png
│ │ │ │ ├── camerauser.png
│ │ │ │ ├── userprofile1.png
│ │ │ │ ├── ic_menu.xml
│ │ │ │ ├── side_nav_bar.xml
│ │ │ │ ├── ic_menu2.xml
│ │ │ │ ├── ic_menu_send.xml
│ │ │ │ ├── ic_about.xml
│ │ │ │ ├── ic_warning_black_24dp.xml
│ │ │ │ ├── favorite.xml
│ │ │ │ ├── ic_action_remove.xml
│ │ │ │ ├── ic_menu_slideshow.xml
│ │ │ │ ├── ic_menu_gallery.xml
│ │ │ │ ├── ic_notifications.xml
│ │ │ │ ├── location.xml
│ │ │ │ ├── ic_menu_manage.xml
│ │ │ │ ├── ic_location_on_black_24dp.xml
│ │ │ │ ├── user.xml
│ │ │ │ ├── ic_profileedit.xml
│ │ │ │ ├── keyboard_voice.xml
│ │ │ │ ├── ic_help.xml
│ │ │ │ ├── ic_parkinghistory.xml
│ │ │ │ ├── password.xml
│ │ │ │ ├── ic_menu_camera.xml
│ │ │ │ ├── ic_menu_share.xml
│ │ │ │ ├── button_background.xml
│ │ │ │ └── ic_launcher_background.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
│ │ │ ├── drawable-hdpi
│ │ │ │ └── ic_action_name.png
│ │ │ ├── drawable-mdpi
│ │ │ │ └── ic_action_name.png
│ │ │ ├── drawable-xhdpi
│ │ │ │ └── ic_action_name.png
│ │ │ ├── drawable-xxhdpi
│ │ │ │ └── ic_action_name.png
│ │ │ ├── values-v21
│ │ │ │ └── styles.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ ├── values
│ │ │ │ ├── colors.xml
│ │ │ │ ├── dimens.xml
│ │ │ │ ├── google_maps_api.xml
│ │ │ │ ├── strings.xml
│ │ │ │ └── styles.xml
│ │ │ ├── layout
│ │ │ │ ├── activity_notification.xml
│ │ │ │ ├── com
│ │ │ │ │ └── example
│ │ │ │ │ │ └── diram
│ │ │ │ │ │ └── cityparker
│ │ │ │ │ │ ├── MainActivity.java
│ │ │ │ │ │ ├── LoginActivity.java
│ │ │ │ │ │ ├── RegisterActivity.java
│ │ │ │ │ │ ├── Navigationmain.java
│ │ │ │ │ │ └── HomeActivity.java
│ │ │ │ ├── activity_help.xml
│ │ │ │ ├── activity_history.xml
│ │ │ │ ├── activity_logout.xml
│ │ │ │ ├── activity_maps.xml
│ │ │ │ ├── content_navigationactivity.xml
│ │ │ │ ├── activity_main.xml
│ │ │ │ ├── activity_navigationactivity.xml
│ │ │ │ ├── app_bar_navigationactivity.xml
│ │ │ │ ├── nav_header_navigationactivity.xml
│ │ │ │ ├── activity_about.xml
│ │ │ │ ├── activity_home.xml
│ │ │ │ ├── activity_register.xml
│ │ │ │ ├── activity_login.xml
│ │ │ │ ├── confirm_logout.xml
│ │ │ │ └── activity_profile.xml
│ │ │ ├── menu
│ │ │ │ ├── navigationactivity.xml
│ │ │ │ ├── main_menu.xml
│ │ │ │ ├── profile_menu.xml
│ │ │ │ ├── search_view.xml
│ │ │ │ └── activity_navigationactivity_drawer.xml
│ │ │ └── drawable-v24
│ │ │ │ └── ic_launcher_foreground.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── diram
│ │ │ │ └── parkingspacefinder
│ │ │ │ ├── ini
│ │ │ │ ├── SurfaceView.java
│ │ │ │ └── Constant.java
│ │ │ │ ├── NotificationActivity.java
│ │ │ │ ├── helper
│ │ │ │ ├── AlertClick.kt
│ │ │ │ ├── AlertCancel.kt
│ │ │ │ ├── Progress.java
│ │ │ │ └── Alert.kt
│ │ │ │ ├── HelpActivity.java
│ │ │ │ ├── MainActivity.java
│ │ │ │ ├── AboutActivity.java
│ │ │ │ ├── HistoryActivity.java
│ │ │ │ ├── models
│ │ │ │ ├── AppState.java
│ │ │ │ └── Profile.java
│ │ │ │ ├── Navigationactivity.java
│ │ │ │ ├── RegisterActivity.java
│ │ │ │ ├── LoginActivity.java
│ │ │ │ ├── ProfileActivity.java
│ │ │ │ └── HomeActivity.java
│ │ └── AndroidManifest.xml
│ ├── debug
│ │ └── res
│ │ │ ├── anim
│ │ │ ├── anim_in.xml
│ │ │ └── anim_out.xml
│ │ │ └── values
│ │ │ └── google_maps_api.xml
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── diram
│ │ │ └── parkingspacefinder
│ │ │ └── ExampleUnitTest.java
│ ├── release
│ │ └── res
│ │ │ └── values
│ │ │ └── google_maps_api.xml
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── example
│ │ └── diram
│ │ └── parkingspacefinder
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .idea
├── caches
│ └── build_file_checksums.ser
├── vcs.xml
├── runConfigurations.xml
├── gradle.xml
├── misc.xml
└── codeStyles
│ └── Project.xml
├── .gitignore
├── com
└── google
│ └── android
│ └── gms
│ └── location
│ └── places
│ └── annotations.xml
├── gradle.properties
├── gradlew.bat
└── gradlew
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dirambora/Parkingspacefinder/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/.idea/caches/build_file_checksums.ser:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dirambora/Parkingspacefinder/HEAD/.idea/caches/build_file_checksums.ser
--------------------------------------------------------------------------------
/app/src/main/res/drawable/logo9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dirambora/Parkingspacefinder/HEAD/app/src/main/res/drawable/logo9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/logocar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dirambora/Parkingspacefinder/HEAD/app/src/main/res/drawable/logocar.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/profile.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dirambora/Parkingspacefinder/HEAD/app/src/main/res/drawable/profile.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/tooltip.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dirambora/Parkingspacefinder/HEAD/app/src/main/res/drawable/tooltip.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/logocar1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dirambora/Parkingspacefinder/HEAD/app/src/main/res/drawable/logocar1.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/profile2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dirambora/Parkingspacefinder/HEAD/app/src/main/res/drawable/profile2.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/cameraicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dirambora/Parkingspacefinder/HEAD/app/src/main/res/drawable/cameraicon.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/camerauser.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dirambora/Parkingspacefinder/HEAD/app/src/main/res/drawable/camerauser.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/userprofile1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dirambora/Parkingspacefinder/HEAD/app/src/main/res/drawable/userprofile1.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dirambora/Parkingspacefinder/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dirambora/Parkingspacefinder/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dirambora/Parkingspacefinder/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dirambora/Parkingspacefinder/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dirambora/Parkingspacefinder/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_action_name.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dirambora/Parkingspacefinder/HEAD/app/src/main/res/drawable-hdpi/ic_action_name.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_action_name.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dirambora/Parkingspacefinder/HEAD/app/src/main/res/drawable-mdpi/ic_action_name.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_action_name.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dirambora/Parkingspacefinder/HEAD/app/src/main/res/drawable-xhdpi/ic_action_name.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_action_name.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dirambora/Parkingspacefinder/HEAD/app/src/main/res/drawable-xxhdpi/ic_action_name.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dirambora/Parkingspacefinder/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dirambora/Parkingspacefinder/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dirambora/Parkingspacefinder/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dirambora/Parkingspacefinder/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/java/com/example/diram/parkingspacefinder/ini/SurfaceView.java:
--------------------------------------------------------------------------------
1 | package com.example.diram.parkingspacefinder.ini;
2 |
3 | public class SurfaceView {
4 | }
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dirambora/Parkingspacefinder/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/java/com/example/diram/parkingspacefinder/NotificationActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.diram.parkingspacefinder;
2 |
3 | public class NotificationActivity {
4 | }
5 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/libraries
5 | /.idea/modules.xml
6 | /.idea/workspace.xml
7 | .DS_Store
8 | /build
9 | /captures
10 | .externalNativeBuild
11 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/com/google/android/gms/location/places/annotations.xml:
--------------------------------------------------------------------------------
1 |
2 | -
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/diram/parkingspacefinder/helper/AlertClick.kt:
--------------------------------------------------------------------------------
1 | package com.example.diram.parkingspacefinder.helper
2 |
3 | /**
4 | * Created by chris on 3/20/2018. for annisa
5 | */
6 | interface AlertClick {
7 | fun onClicked()
8 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/diram/parkingspacefinder/helper/AlertCancel.kt:
--------------------------------------------------------------------------------
1 | package com.example.diram.parkingspacefinder.helper
2 |
3 | /**
4 | * Created by chris on 3/20/2018. for annisa
5 | */
6 | interface AlertCancel {
7 | fun onCanceled()
8 | }
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Oct 09 11:46:42 EAT 2018
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-4.6-all.zip
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
--------------------------------------------------------------------------------
/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/drawable/side_nav_bar.xml:
--------------------------------------------------------------------------------
1 |
3 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 | #50acf7
7 | #ffffff
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu2.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_send.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_notification.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_about.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/navigationactivity.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_warning_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/favorite.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/com/example/diram/cityparker/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.diram.cityparker;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 |
6 | public class MainActivity extends AppCompatActivity {
7 |
8 | @Override
9 | protected void onCreate(Bundle savedInstanceState) {
10 | super.onCreate(savedInstanceState);
11 | setContentView(R.layout.activity_main);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_remove.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/diram/parkingspacefinder/HelpActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.diram.parkingspacefinder;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | public class HelpActivity extends AppCompatActivity {
7 |
8 | @Override
9 | protected void onCreate(Bundle savedInstanceState) {
10 | super.onCreate(savedInstanceState);
11 | setContentView(R.layout.activity_help);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/diram/parkingspacefinder/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.diram.parkingspacefinder;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | public class MainActivity extends AppCompatActivity {
7 |
8 | @Override
9 | protected void onCreate(Bundle savedInstanceState) {
10 | super.onCreate(savedInstanceState);
11 | setContentView(R.layout.activity_main);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_help.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/diram/parkingspacefinder/AboutActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.diram.parkingspacefinder;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | public class AboutActivity extends AppCompatActivity {
7 |
8 | @Override
9 | protected void onCreate(Bundle savedInstanceState) {
10 | super.onCreate(savedInstanceState);
11 | setContentView(R.layout.activity_about);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_history.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_logout.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/main_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/diram/parkingspacefinder/HistoryActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.diram.parkingspacefinder;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | public class HistoryActivity extends AppCompatActivity {
7 |
8 | @Override
9 | protected void onCreate(Bundle savedInstanceState) {
10 | super.onCreate(savedInstanceState);
11 | setContentView(R.layout.activity_history);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_maps.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/debug/res/anim/anim_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_slideshow.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_gallery.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_notifications.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/profile_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/location.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_manage.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
--------------------------------------------------------------------------------
/app/src/test/java/com/example/diram/parkingspacefinder/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.example.diram.parkingspacefinder;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_location_on_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 8dp
6 | 206dp
7 | 16dp
8 | 5dp
9 | 250dp
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/user.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_profileedit.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/keyboard_voice.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_help.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_parkinghistory.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/password.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/content_navigationactivity.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/debug/res/anim/anim_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 |
13 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_camera.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/diram/parkingspacefinder/models/AppState.java:
--------------------------------------------------------------------------------
1 | package com.example.diram.parkingspacefinder.models;
2 |
3 | public class AppState {
4 | private static AppState singleInstance;
5 |
6 | private boolean isLoggingOut;
7 |
8 | private AppState() {
9 | }
10 |
11 | public static AppState getSingleInstance() {
12 | if (singleInstance == null) {
13 | singleInstance = new AppState();
14 | }
15 | return singleInstance;
16 | }
17 |
18 | public boolean isLoggingOut() {
19 | return isLoggingOut;
20 | }
21 |
22 | public void setLoggingOut(boolean isLoggingOut) {
23 | this.isLoggingOut = isLoggingOut;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/search_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_share.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/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=-Xmx1536m
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 |
--------------------------------------------------------------------------------
/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
22 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/release/res/values/google_maps_api.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 | YOUR_KEY_HERE
20 |
21 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/example/diram/parkingspacefinder/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.example.diram.parkingspacefinder;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.example.diram.parkingspacefinder", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/diram/parkingspacefinder/helper/Progress.java:
--------------------------------------------------------------------------------
1 | package com.example.diram.parkingspacefinder.helper;
2 |
3 | import android.app.ProgressDialog;
4 | import android.content.Context;
5 |
6 | public class Progress {
7 | private ProgressDialog progressDialog;
8 |
9 | public Progress(Context context, String Title, String Message) {
10 | progressDialog = new ProgressDialog(context);
11 | progressDialog.setTitle(Title);
12 | progressDialog.setMessage(Message);
13 | progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
14 | progressDialog.setCanceledOnTouchOutside(false);
15 | }
16 |
17 | public void showDialog() {
18 | progressDialog.show();
19 | }
20 |
21 | public void dismissDialog() {
22 | if (progressDialog.isShowing())
23 | progressDialog.dismiss();
24 | }
25 |
26 | public void setMessage(String message) {
27 | progressDialog.setMessage(message);
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_navigationactivity.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
13 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/button_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
6 |
7 |
12 |
13 |
14 | -
15 |
17 |
18 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/com/example/diram/cityparker/LoginActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.diram.cityparker;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.view.View;
8 |
9 |
10 | public class LoginActivity extends AppCompatActivity {
11 |
12 | @Override
13 | protected void onCreate(@Nullable Bundle savedInstanceState) {
14 | super.onCreate(savedInstanceState);
15 | setContentView(R.layout.activity_login);
16 |
17 |
18 | }
19 |
20 |
21 | public void login(View view){
22 | Intent intent = new Intent(com.example.diram.cityparker.LoginActivity.this, com.example.diram.cityparker.HomeActivity.class);
23 |
24 | startActivity(intent);
25 | }
26 | public void CreateAccount(View view){
27 | Intent intent = new Intent(com.example.diram.cityparker.LoginActivity.this, com.example.diram.cityparker.RegisterActivity.class);
28 |
29 | startActivity(intent);
30 | }
31 | }
--------------------------------------------------------------------------------
/app/src/main/res/values/google_maps_api.xml:
--------------------------------------------------------------------------------
1 |
2 |
23 | AIzaSyBbgrfjQkwBywSMuGnFQZ1IkXhRAyjwE34
24 |
25 |
--------------------------------------------------------------------------------
/app/src/debug/res/values/google_maps_api.xml:
--------------------------------------------------------------------------------
1 |
2 |
23 | AIzaSyAsmqz-IUTfGwWiiNz8mEiUs35-MRnL9ww
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/com/example/diram/cityparker/RegisterActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.diram.cityparker;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.view.View;
7 | import android.widget.Button;
8 | import android.widget.TextView;
9 |
10 | /**
11 | * Created by amardeep on 10/24/2017.
12 | */
13 |
14 | public class RegisterActivity extends AppCompatActivity {
15 |
16 | @Override
17 | protected void onCreate(@Nullable Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 | setContentView(R.layout.activity_register);
20 | TextView textViewLogin = (TextView) findViewById(R.id.textViewLogin);
21 | textViewLogin.setOnClickListener(new View.OnClickListener() {
22 | @Override
23 | public void onClick(View view) {
24 | finish();
25 | }
26 | });
27 | Button buttonRegister = (Button) findViewById(R.id.buttonRegister);
28 | buttonRegister.setOnClickListener(new View.OnClickListener() {
29 | @Override
30 | public void onClick(View view) {
31 | finish();
32 | }
33 | });
34 | }
35 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/diram/parkingspacefinder/models/Profile.java:
--------------------------------------------------------------------------------
1 | package com.example.diram.parkingspacefinder.models;
2 |
3 | public class Profile {
4 | private String name;
5 | private String email;
6 | private String mobile;
7 |
8 | public Profile() {
9 | }
10 |
11 | public boolean isLoggedIn() {
12 | return loggedIn;
13 | }
14 |
15 | public void setLoggedIn(boolean loggedIn) {
16 | this.loggedIn = loggedIn;
17 | }
18 |
19 | private boolean loggedIn;
20 |
21 | public String getMobile() {
22 | return mobile;
23 | }
24 |
25 | public void setMobile(String mobile) {
26 | this.mobile = mobile;
27 | }
28 |
29 |
30 | public String getName() {
31 | return name;
32 | }
33 |
34 | public void setName(String name) {
35 | this.name = name;
36 | }
37 |
38 | public String getEmail() {
39 | return email;
40 | }
41 |
42 | public void setEmail(String email) {
43 | this.email = email;
44 | }
45 |
46 | public String getIconPath() {
47 | return iconPath;
48 | }
49 |
50 | public void setIconPath(String iconPath) {
51 | this.iconPath = iconPath;
52 | }
53 |
54 | private String iconPath;
55 |
56 |
57 |
58 |
59 | }
60 |
61 |
62 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Parkingspacefinder
3 | navigationactivity
4 | Open navigation drawer
5 | Close navigation drawer
6 | Android Studio
7 | android.studio@android.com
8 | Navigation header
9 | Settings
10 | Map
11 | Map
12 | EnabledSetting
13 | You need to enable location permissions first
14 | Settings
15 | Location Permissions
16 | Enable Geofences
17 | Profile
18 | 599551120459699
19 | fb599551120459699
20 | map
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/activity_navigationactivity_drawer.xml:
--------------------------------------------------------------------------------
1 |
2 |
41 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/app_bar_navigationactivity.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
20 |
21 |
22 |
23 |
24 |
25 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/nav_header_navigationactivity.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
20 |
21 |
28 |
29 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
13 |
14 |
23 |
24 |
29 |
30 |
31 |
32 |
33 |
36 |
40 |
41 |
--------------------------------------------------------------------------------
/.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 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 |
4 | android {
5 | compileSdkVersion 27
6 | defaultConfig {
7 | applicationId "com.example.diram.parkingspacefinder"
8 | minSdkVersion 22
9 | targetSdkVersion 27
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | vectorDrawables.useSupportLibrary = true
14 | }
15 | buildTypes {
16 | release {
17 | minifyEnabled false
18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
19 | }
20 | }
21 | }
22 |
23 | dependencies {
24 | implementation fileTree(dir: 'libs', include: ['*.jar'])
25 | implementation 'com.android.support:appcompat-v7:27.1.1'
26 | implementation 'com.android.support.constraint:constraint-layout:1.1.3'
27 | implementation 'com.android.support:design:27.1.1'
28 | implementation 'com.google.android.gms:play-services-maps:15.0.1'
29 | testImplementation 'junit:junit:4.12'
30 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
31 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
32 | implementation 'com.google.android.gms:play-services-location:15.0.1'
33 | implementation 'com.google.android.gms:play-services-places:15.0.1'
34 | implementation 'com.github.arimorty:floatingsearchview:2.1.1'
35 | implementation 'com.airbnb.android:lottie:2.2.5'
36 | implementation 'com.android.volley:volley:1.1.0'
37 | implementation 'com.koushikdutta.ion:ion:2.1.9'
38 | implementation 'com.github.bumptech.glide:glide:4.8.0'
39 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
40 | implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
41 | implementation 'com.google.android.gms:play-services-auth:15.0.1'
42 |
43 |
44 |
45 |
46 |
47 | }
48 |
49 |
50 |
51 | repositories {
52 | mavenCentral()
53 | }
54 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/diram/parkingspacefinder/ini/Constant.java:
--------------------------------------------------------------------------------
1 | package com.example.diram.parkingspacefinder.ini;
2 |
3 | import android.content.Context;
4 | import android.content.SharedPreferences;
5 |
6 | import com.example.diram.parkingspacefinder.models.Profile;
7 |
8 | import org.json.JSONException;
9 | import org.json.JSONObject;
10 |
11 | public abstract class Constant {
12 | public static Profile getUserProfile(Context context) {
13 |
14 | SharedPreferences prof = context.getSharedPreferences("parking", Context.MODE_PRIVATE);
15 | String storage = prof.getString("profile", nullProfile());
16 |
17 | Profile profile = new Profile();
18 | try {
19 | JSONObject pro = new JSONObject(storage);
20 | profile.setEmail(pro.getString("email"));
21 | profile.setIconPath(pro.getString("iconPath"));
22 | profile.setName(pro.getString("fullName"));
23 | profile.setMobile(pro.getString("mobileNumber"));
24 | profile.setLoggedIn(pro.getBoolean("loggedIn"));
25 | } catch (JSONException e) {
26 | e.printStackTrace();
27 | }
28 | return profile;
29 | }
30 |
31 | private static String nullProfile() {
32 | try {
33 | JSONObject profileNull = new JSONObject();
34 | profileNull.put("loggedIn", false);
35 | profileNull.put("email", "");
36 | profileNull.put("iconPath", "");
37 | profileNull.put("name", "");
38 | profileNull.put("mobile", "");
39 | return profileNull.toString();
40 | } catch (Exception e) {
41 | e.printStackTrace();
42 | return "";
43 | }
44 | }
45 |
46 | public static void logOutUser(Context context){
47 | SharedPreferences.Editor editor = context.getSharedPreferences("parking", Context.MODE_PRIVATE).edit();
48 | editor.clear().apply();
49 | }
50 |
51 | public static void setUserProfile(Context context, JSONObject profile) {
52 | try {
53 | profile.accumulate("loggedIn", true);
54 | } catch (JSONException e) {
55 | e.printStackTrace();
56 | }
57 | SharedPreferences.Editor editor = context.getSharedPreferences("parking", Context.MODE_PRIVATE).edit();
58 | editor.putString("profile", profile.toString());
59 | editor.apply();
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/diram/parkingspacefinder/helper/Alert.kt:
--------------------------------------------------------------------------------
1 | package com.example.diram.parkingspacefinder.helper
2 |
3 | import android.graphics.Color
4 | import android.graphics.drawable.ColorDrawable
5 | import android.support.v7.app.AlertDialog
6 | import android.support.v7.app.AppCompatActivity
7 | import android.view.View
8 | import com.example.diram.parkingspacefinder.R
9 |
10 |
11 | /**
12 | * Created by chris on 3/3/2018. for annisa
13 | */
14 | class Alert(private val context: AppCompatActivity) {
15 |
16 | private var alert: AlertDialog.Builder = AlertDialog.Builder(context, R.style.MyDialogAnimationTheme)
17 | private lateinit var alertDialog: AlertDialog
18 |
19 | init {
20 |
21 | }
22 |
23 | fun setPositiveBtn(name: String, onclick: AlertClick) {
24 | alert.setPositiveButton(name) { _, _ ->
25 | onclick.onClicked()
26 | }
27 | }
28 |
29 | fun setPositiveBtn(name: String) {
30 | alert.setPositiveButton(name) { _, _ ->
31 |
32 | }
33 | }
34 |
35 | fun setView(view: View) {
36 | alert.setView(view)
37 | }
38 |
39 | fun setView(resource: Int): View {
40 | val view = context.layoutInflater.inflate(resource, null, false)
41 | setView(view)
42 | return view
43 | }
44 |
45 | fun setNegativeBtn(name: String, onclick: AlertClick) {
46 | alert.setNegativeButton(name) { _, _ ->
47 | onclick.onClicked()
48 | }
49 | }
50 |
51 |
52 | fun setNegativeBtn(name: String) {
53 | alert.setNegativeButton(name) { _, _ ->
54 | }
55 | }
56 |
57 | fun setTitle(title: String) {
58 | alert.setTitle(title)
59 | }
60 |
61 |
62 | fun showAlertDialogue(defaultDialogue: Boolean) {
63 | if (defaultDialogue) {
64 | alert.show()
65 | return
66 | }
67 | alertDialog = alert.create()
68 | alertDialog.window.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
69 | alertDialog.show()
70 | }
71 |
72 | fun dismissAlertDialogue() {
73 | alertDialog.dismiss()
74 | }
75 |
76 | fun setCancelable(boolean: Boolean) {
77 | alert.setCancelable(boolean)
78 | }
79 |
80 | fun onCanceled(alertCancel: AlertCancel) {
81 | alertDialog.setOnCancelListener {
82 | alertCancel.onCanceled()
83 | }
84 | }
85 |
86 |
87 | fun setMessage(message: String) {
88 | alert.setMessage(message)
89 | }
90 |
91 | }
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_about.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
22 |
23 |
32 |
33 |
44 |
45 |
46 |
55 |
56 |
65 |
66 |
75 |
76 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_home.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
16 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
48 |
49 |
50 |
51 |
52 |
58 |
59 |
64 |
65 |
66 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_register.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
24 |
25 |
30 |
31 |
37 |
38 |
39 |
44 |
45 |
52 |
53 |
54 |
61 |
62 |
69 |
70 |
71 |
80 |
81 |
89 |
90 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/com/example/diram/cityparker/Navigationmain.java:
--------------------------------------------------------------------------------
1 | package com.example.diram.cityparker;
2 |
3 | import android.os.Bundle;
4 | import android.support.design.widget.FloatingActionButton;
5 | import android.support.design.widget.NavigationView;
6 | import android.support.design.widget.Snackbar;
7 | import android.support.v4.view.GravityCompat;
8 | import android.support.v4.widget.DrawerLayout;
9 | import android.support.v7.app.ActionBarDrawerToggle;
10 | import android.support.v7.app.AppCompatActivity;
11 | import android.support.v7.widget.Toolbar;
12 | import android.view.Menu;
13 | import android.view.MenuItem;
14 | import android.view.View;
15 |
16 | public class Navigationmain extends AppCompatActivity
17 | implements NavigationView.OnNavigationItemSelectedListener {
18 |
19 | @Override
20 | protected void onCreate(Bundle savedInstanceState) {
21 | super.onCreate(savedInstanceState);
22 | setContentView(R.layout.activity_navigationmain);
23 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
24 | setSupportActionBar(toolbar);
25 |
26 | FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
27 | fab.setOnClickListener(new View.OnClickListener() {
28 | @Override
29 | public void onClick(View view) {
30 | Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
31 | .setAction("Action", null).show();
32 | }
33 | });
34 |
35 | DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
36 | ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
37 | this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
38 | drawer.addDrawerListener(toggle);
39 | toggle.syncState();
40 |
41 | NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
42 | navigationView.setNavigationItemSelectedListener(this);
43 | }
44 |
45 | @Override
46 | public void onBackPressed() {
47 | DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
48 | if (drawer.isDrawerOpen(GravityCompat.START)) {
49 | drawer.closeDrawer(GravityCompat.START);
50 | } else {
51 | super.onBackPressed();
52 | }
53 | }
54 |
55 | @Override
56 | public boolean onCreateOptionsMenu(Menu menu) {
57 | // Inflate the menu; this adds items to the action bar if it is present.
58 | getMenuInflater().inflate(R.menu.navigationmain, menu);
59 | return true;
60 | }
61 |
62 | @Override
63 | public boolean onOptionsItemSelected(MenuItem item) {
64 | // Handle action bar item clicks here. The action bar will
65 | // automatically handle clicks on the Home/Up button, so long
66 | // as you specify a parent activity in AndroidManifest.xml.
67 | int id = item.getItemId();
68 |
69 | //noinspection SimplifiableIfStatement
70 | if (id == R.id.action_settings) {
71 | return true;
72 | }
73 |
74 | return super.onOptionsItemSelected(item);
75 | }
76 |
77 | @SuppressWarnings("StatementWithEmptyBody")
78 | @Override
79 | public boolean onNavigationItemSelected(MenuItem item) {
80 | // Handle navigation view item clicks here.
81 | int id = item.getItemId();
82 |
83 | if (id == R.id.nav_camera) {
84 | // Handle the camera action
85 | } else if (id == R.id.nav_gallery) {
86 |
87 | } else if (id == R.id.nav_slideshow) {
88 |
89 | } else if (id == R.id.nav_manage) {
90 |
91 | } else if (id == R.id.nav_share) {
92 |
93 | } else if (id == R.id.nav_send) {
94 |
95 | }
96 |
97 | DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
98 | drawer.closeDrawer(GravityCompat.START);
99 | return true;
100 | }
101 |
102 |
103 | }
104 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_login.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
23 |
24 |
29 |
30 |
37 |
38 |
39 |
46 |
47 |
54 |
55 |
56 |
65 |
66 |
75 |
76 |
81 |
82 |
90 |
91 |
92 |
93 |
94 |
95 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
19 |
20 |
21 |
22 |
23 |
28 |
29 |
30 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
50 |
58 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
69 |
70 |
75 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/diram/parkingspacefinder/Navigationactivity.java:
--------------------------------------------------------------------------------
1 | package com.example.diram.parkingspacefinder;
2 |
3 |
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.os.Bundle;
7 | import android.support.design.widget.FloatingActionButton;
8 | import android.support.design.widget.Snackbar;
9 | import android.view.View;
10 | import android.support.design.widget.NavigationView;
11 | import android.support.v4.view.GravityCompat;
12 | import android.support.v4.widget.DrawerLayout;
13 | import android.support.v7.app.ActionBarDrawerToggle;
14 | import android.support.v7.app.AppCompatActivity;
15 | import android.support.v7.widget.Toolbar;
16 | import android.view.Menu;
17 | import android.view.MenuItem;
18 | import android.widget.Toast;
19 |
20 | public class Navigationactivity extends AppCompatActivity
21 | implements NavigationView.OnNavigationItemSelectedListener {
22 | Context context;
23 |
24 | @Override
25 | protected void onCreate(Bundle savedInstanceState) {
26 | super.onCreate(savedInstanceState);
27 | setContentView(R.layout.activity_navigationactivity);
28 | Toolbar toolbar = findViewById(R.id.toolbar);
29 | setSupportActionBar(toolbar);
30 | context = this;
31 | FloatingActionButton fab = findViewById(R.id.fab);
32 | fab.setOnClickListener(new View.OnClickListener() {
33 | @Override
34 | public void onClick(View view) {
35 | Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
36 | .setAction("Action", null).show();
37 | }
38 | });
39 |
40 | DrawerLayout drawer = findViewById(R.id.drawer_layout);
41 | ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
42 | this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
43 | drawer.addDrawerListener(toggle);
44 | toggle.syncState();
45 |
46 | NavigationView navigationView = findViewById(R.id.nav_view);
47 | navigationView.setNavigationItemSelectedListener(this);
48 | }
49 |
50 | @Override
51 | public void onBackPressed() {
52 | DrawerLayout drawer = findViewById(R.id.drawer_layout);
53 | if (drawer.isDrawerOpen(GravityCompat.START)) {
54 | drawer.closeDrawer(GravityCompat.START);
55 | } else {
56 | super.onBackPressed();
57 | }
58 | }
59 |
60 | @Override
61 | public boolean onCreateOptionsMenu(Menu menu) {
62 | // Inflate the menu; this adds items to the action bar if it is present.
63 | getMenuInflater().inflate(R.menu.navigationactivity, menu);
64 | return true;
65 | }
66 |
67 | @Override
68 | public boolean onOptionsItemSelected(MenuItem item) {
69 | // Handle action bar item clicks here. The action bar will
70 | // automatically handle clicks on the Home/Up button, so long
71 | // as you specify a parent activity in AndroidManifest.xml.
72 | int id = item.getItemId();
73 |
74 | //noinspection SimplifiableIfStatement
75 | if (id == R.id.action_settings) {
76 | return true;
77 | }
78 |
79 | return super.onOptionsItemSelected(item);
80 | }
81 |
82 | @SuppressWarnings("StatementWithEmptyBody")
83 | @Override
84 | public boolean onNavigationItemSelected(MenuItem item) {
85 | // Handle navigation view item clicks here.
86 | int id = item.getItemId();
87 |
88 | if (id == R.id.nav_profile) {
89 | Intent profile = new Intent(Navigationactivity.this, ProfileActivity.class);
90 | startActivity(profile);
91 | // Handle the camera action
92 | } else if (id == R.id.nav_history) {
93 |
94 | Toast.makeText(this, "History", Toast.LENGTH_LONG).show();
95 | } else if (id == R.id.nav_notifications) {
96 |
97 | } else if (id == R.id.nav_about) {
98 | Intent about = new Intent(Navigationactivity.this, AboutActivity.class);
99 | startActivity(about);
100 |
101 | } else if (id == R.id.nav_logout) {
102 |
103 | } else if (id == R.id.nav_help) {
104 |
105 |
106 | }
107 |
108 | DrawerLayout drawer = findViewById(R.id.drawer_layout);
109 | drawer.closeDrawer(GravityCompat.START);
110 | return true;
111 | }
112 |
113 |
114 | }
115 |
116 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/diram/parkingspacefinder/RegisterActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.diram.parkingspacefinder;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.util.Log;
8 | import android.view.View;
9 | import android.widget.Button;
10 | import android.widget.EditText;
11 | import android.widget.TextView;
12 | import android.widget.Toast;
13 |
14 | import com.example.diram.parkingspacefinder.helper.Progress;
15 | import com.example.diram.parkingspacefinder.ini.Constant;
16 | import com.koushikdutta.async.future.FutureCallback;
17 | import com.koushikdutta.ion.Ion;
18 |
19 | import org.json.JSONObject;
20 |
21 | /**
22 | * Created by amardeep on 10/24/2017.
23 | */
24 |
25 | public class RegisterActivity extends AppCompatActivity {
26 |
27 | @Override
28 | protected void onCreate(@Nullable Bundle savedInstanceState) {
29 | super.onCreate(savedInstanceState);
30 | setContentView(R.layout.activity_register);
31 | TextView textViewLogin = (TextView) findViewById(R.id.textViewLogin);
32 | textViewLogin.setOnClickListener(new View.OnClickListener() {
33 | @Override
34 | public void onClick(View view) {
35 | finish();
36 | }
37 | });
38 |
39 |
40 | }
41 |
42 | public void createAccount(View view) {
43 | // check for null and return
44 |
45 | EditText username = findViewById(R.id.editTextEmail);
46 | EditText email = findViewById(R.id.editTextEmail);
47 | EditText password = findViewById(R.id.editTextPassword);
48 |
49 | /* if (username.getText().toString().isEmpty()) {
50 | username.setError("Username is Blank");
51 | username.requestFocus();
52 | Toast.makeText(this, "", Toast.LENGTH_LONG).show();
53 | return;
54 | }
55 | if (password.getText().toString().isEmpty()) {
56 | password.setError("Password is Blank");
57 | password.requestFocus();
58 | Toast.makeText(this, "Password is Blank", Toast.LENGTH_LONG).show();
59 | return;
60 | }*/
61 | final Progress loading = new Progress(this, "", "Loading please wait ...");
62 | loading.showDialog();
63 | Ion.with(this)
64 | .load("https://dirambora97.000webhostapp.com/parking/v1/Api.php")
65 | .setBodyParameter("username", username.getText().toString())
66 | .setBodyParameter("email", email.getText().toString())
67 | .setBodyParameter("mobileNumber", "")
68 | .setBodyParameter("password", password.getText().toString())
69 | .setBodyParameter("action", "createUser")
70 | .setBodyParameter("location", "")
71 | .setBodyParameter("fullName", "")
72 | .asString()
73 | .setCallback(new FutureCallback() {
74 | @Override
75 | public void onCompleted(Exception e, String result) {
76 | loading.dismissDialog();
77 | if (e == null) {
78 | Log.e("Server=>", result);
79 | try {
80 | JSONObject resultBack = new JSONObject(result);
81 | if (resultBack.getBoolean("status")) {
82 | Constant.setUserProfile(RegisterActivity.this,resultBack.getJSONObject("profile"));
83 | goHome();
84 | } else {
85 | Toast.makeText(RegisterActivity.this, resultBack.getString("message"),Toast.LENGTH_LONG).show();
86 | }
87 | } catch (Exception e1) {
88 | Toast.makeText(RegisterActivity.this, "Check network info" + e1.getMessage(), Toast.LENGTH_LONG).show();
89 | e1.printStackTrace();
90 | }
91 | } else {
92 | Toast.makeText(RegisterActivity.this, e.getMessage(), Toast.LENGTH_LONG).show();
93 | }
94 |
95 | }
96 | });
97 | }
98 | private void goHome() {
99 | Intent intent = new Intent(this, HomeActivity.class);
100 | startActivity(intent);
101 | finish();
102 | }
103 | }
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/layout/confirm_logout.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
16 |
17 |
21 |
22 |
28 |
29 |
40 |
41 |
42 |
43 |
47 |
48 |
53 |
54 |
58 |
59 |
60 |
64 |
65 |
72 |
73 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
92 |
93 |
103 |
104 |
109 |
110 |
115 |
116 |
126 |
127 |
128 |
129 |
139 |
140 |
144 |
145 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_profile.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
21 |
22 |
23 |
24 |
25 |
32 |
33 |
43 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
67 |
68 |
69 |
76 |
77 |
88 |
89 |
90 |
91 |
98 |
99 |
108 |
109 |
110 |
111 |
119 |
120 |
129 |
130 |
131 |
132 |
139 |
140 |
141 |
142 |
147 |
148 |
149 |
150 |
158 |
159 |
168 |
169 |
173 |
174 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/diram/parkingspacefinder/LoginActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.diram.parkingspacefinder;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.content.SharedPreferences;
6 | import android.content.pm.PackageInfo;
7 | import android.content.pm.PackageManager;
8 | import android.content.pm.Signature;
9 | import android.os.Bundle;
10 | import android.support.annotation.Nullable;
11 | import android.support.v7.app.AppCompatActivity;
12 | import android.util.Base64;
13 | import android.util.Log;
14 | import android.view.View;
15 | import android.widget.EditText;
16 | import android.widget.Toast;
17 |
18 |
19 | import com.example.diram.parkingspacefinder.helper.Progress;
20 | import com.example.diram.parkingspacefinder.ini.Constant;
21 | import com.example.diram.parkingspacefinder.models.Profile;
22 | import com.facebook.AccessToken;
23 | import com.facebook.CallbackManager;
24 | import com.facebook.FacebookCallback;
25 | import com.facebook.FacebookException;
26 | import com.facebook.login.LoginManager;
27 | import com.facebook.login.LoginResult;
28 | import com.facebook.login.widget.LoginButton;
29 | import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
30 | import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
31 | import com.google.android.gms.common.SignInButton;
32 | import com.google.android.gms.common.api.ApiException;
33 | import com.google.android.gms.tasks.Task;
34 | import com.koushikdutta.async.future.FutureCallback;
35 | import com.koushikdutta.ion.Ion;
36 |
37 | import org.json.JSONException;
38 | import org.json.JSONObject;
39 |
40 | import java.security.MessageDigest;
41 | import java.security.NoSuchAlgorithmException;
42 | import java.util.Arrays;
43 |
44 |
45 | public class LoginActivity extends AppCompatActivity {
46 | private Context context;
47 | CallbackManager callbackManager;
48 |
49 |
50 | private static final String EMAIL = "email";
51 |
52 | @Override
53 | protected void onCreate (@Nullable Bundle savedInstanceState) {
54 | super.onCreate(savedInstanceState);
55 | setContentView(R.layout.activity_login);
56 | context = this;
57 | if (Constant.getUserProfile(context).isLoggedIn()) {
58 | goHome();
59 | finish();
60 | }
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 | callbackManager = CallbackManager.Factory.create();
71 |
72 | LoginButton loginButton = findViewById(R.id.login_button);
73 | loginButton.setReadPermissions(Arrays.asList(EMAIL));
74 | // If you are using in a fragment, call loginButton.setFragment(this);
75 |
76 | // Callback registration
77 | loginButton.registerCallback(callbackManager, new FacebookCallback() {
78 | @Override
79 | public void onSuccess(LoginResult loginResult) {
80 | // App code
81 | }
82 |
83 | @Override
84 | public void onCancel() {
85 | // App code
86 | }
87 |
88 | @Override
89 | public void onError(FacebookException exception) {
90 | // App code
91 | }
92 | });
93 |
94 |
95 |
96 |
97 |
98 | }
99 |
100 |
101 |
102 |
103 | @Override
104 | protected void onActivityResult(int requestCode, int resultCode, Intent data) {
105 | callbackManager.onActivityResult(requestCode, resultCode, data);
106 | super.onActivityResult(requestCode, resultCode, data);
107 | // Result returned from launching the Intent from GoogleSignInClient.getSignInIntent(...);
108 |
109 | }
110 |
111 |
112 |
113 |
114 | public void printHashKey() {
115 | try {
116 | PackageInfo info = getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_SIGNATURES);
117 | for (Signature signature : info.signatures) {
118 | MessageDigest md = MessageDigest.getInstance("SHA");
119 | md.update(signature.toByteArray());
120 | String hashKey = new String(Base64.encode(md.digest(), 0));
121 | Log.e("error", "printHashKey() Hash Key:" + hashKey);
122 | }
123 | } catch (Exception e) {
124 | Log.e("error", "printHashKey()", e);
125 | }
126 | }
127 |
128 | public void login(View view) {
129 | // check for null and return
130 | printHashKey();
131 |
132 | EditText username = findViewById(R.id.editTextEmail);
133 | EditText password = findViewById(R.id.editTextPassword);
134 |
135 | /* if (username.getText().toString().isEmpty()) {
136 | username.setError("Username is Blank");
137 | username.requestFocus();
138 | Toast.makeText(this, "", Toast.LENGTH_LONG).show();
139 | return;
140 | }
141 | if (password.getText().toString().isEmpty()) {
142 | password.setError("Password is Blank");
143 | password.requestFocus();
144 | Toast.makeText(this, "Password is Blank", Toast.LENGTH_LONG).show();
145 | return;
146 | }*/
147 | final Progress loading = new Progress(this, "", "Loading please wait ...");
148 | loading.showDialog();
149 | Ion.with(this)
150 | .load("https://dirambora12.000webhostapp.com/parking/v1/Api.php")
151 | .setBodyParameter("username", username.getText().toString())
152 | .setBodyParameter("password", password.getText().toString())
153 | .setBodyParameter("action", "login")
154 | .asString()
155 | .setCallback(new FutureCallback() {
156 | @Override
157 | public void onCompleted(Exception e, String result) {
158 | loading.dismissDialog();
159 | if (e == null) {
160 | Log.e("Server=>", result);
161 | try {
162 | JSONObject resultBack = new JSONObject(result);
163 | if (resultBack.getBoolean("status")) {
164 | setUserProfile(resultBack.getJSONObject("profile"));
165 | goHome();
166 | } else {
167 | Toast.makeText(context, "Password or username is invalid", Toast.LENGTH_LONG).show();
168 | }
169 | } catch (Exception e1) {
170 | Toast.makeText(context, "Check network info" + e1.getMessage(), Toast.LENGTH_LONG).show();
171 | e1.printStackTrace();
172 | }
173 | } else {
174 | Toast.makeText(context, e.getMessage(), Toast.LENGTH_LONG).show();
175 | }
176 | }
177 | });
178 | }
179 |
180 | public void CreateAccount(View view) {
181 | Intent intent = new Intent(this, RegisterActivity.class);
182 |
183 | startActivity(intent);
184 | }
185 |
186 | private void setUserProfile(JSONObject profile) {
187 | try {
188 | profile.accumulate("loggedIn",true);
189 | } catch (JSONException e) {
190 | e.printStackTrace();
191 | }
192 | SharedPreferences.Editor editor = getSharedPreferences("parking", MODE_PRIVATE).edit();
193 | editor.putString("profile", profile.toString());
194 | editor.apply();
195 | }
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 | private void goHome() {
204 | Intent intent = new Intent(this, HomeActivity.class);
205 | startActivity(intent);
206 | finish();
207 | }
208 |
209 |
210 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/diram/parkingspacefinder/ProfileActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.diram.parkingspacefinder;
2 |
3 | import android.Manifest;
4 | import android.app.Activity;
5 | import android.content.Context;
6 | import android.content.Intent;
7 | import android.content.SharedPreferences;
8 | import android.content.pm.PackageManager;
9 | import android.graphics.Bitmap;
10 | import android.os.Build;
11 | import android.os.Bundle;
12 | import android.provider.MediaStore;
13 | import android.support.annotation.RequiresApi;
14 | import android.support.v7.app.AppCompatActivity;
15 | import android.util.Base64;
16 | import android.util.Log;
17 | import android.view.MenuItem;
18 | import android.view.View;
19 | import android.widget.EditText;
20 | import android.widget.ImageView;
21 | import android.widget.PopupMenu;
22 | import android.widget.Toast;
23 |
24 | import com.bumptech.glide.Glide;
25 | import com.bumptech.glide.request.RequestOptions;
26 | import com.example.diram.parkingspacefinder.helper.Progress;
27 | import com.koushikdutta.async.future.FutureCallback;
28 | import com.koushikdutta.ion.Ion;
29 |
30 | import org.json.JSONObject;
31 |
32 | import java.io.ByteArrayOutputStream;
33 | import java.io.File;
34 | import java.io.IOException;
35 |
36 |
37 | public class ProfileActivity extends AppCompatActivity implements PopupMenu.OnMenuItemClickListener {
38 | private static final int CODE_GET_REQUEST = 1024;
39 | private static final int CODE_POST_REQUEST = 1025;
40 |
41 | private Context context;
42 | ImageView userprofile1;
43 | private int REQUEST_CAMERA = 0;
44 | private final static int ALL_PERMISSIONS_RESULT = 107;
45 | private static final int MY_CAMERA_PERMISSION_CODE = 100;
46 | private int SELECT_FILE = 1;
47 | Bitmap photo;
48 | String encodedCameraImage;
49 |
50 | @Override
51 | protected void onCreate(Bundle savedInstanceState) {
52 | super.onCreate(savedInstanceState);
53 | setContentView(R.layout.activity_profile);
54 | context = this;
55 | userprofile1 = findViewById(R.id.imageView4);
56 | }
57 |
58 | public void onClick(View view) {
59 |
60 |
61 | EditText username = findViewById(R.id.editText3);
62 | EditText email = findViewById(R.id.editText5);
63 | EditText password = findViewById(R.id.editText6);
64 | EditText mobilenumber = findViewById(R.id.editText4);
65 | ImageView userprofile1 = findViewById(R.id.imageView4);
66 | final Progress loading = new Progress(this, "", "Loading please wait ...");
67 | loading.showDialog();
68 | Ion.with(this)
69 | .load("https://dirambora97.000webhostapp.com/parking/v1/Api.php")
70 | .setMultipartParameter("username", username.getText().toString())
71 | .setMultipartParameter("email", email.getText().toString())
72 | .setMultipartParameter("password", password.getText().toString())
73 | .setMultipartParameter("mobilenumber", mobilenumber.getText().toString())
74 | // .setMultipartFile("iconPath", new File(photo))
75 | .setMultipartParameter("action", "save")
76 | .asString()
77 | .setCallback(new FutureCallback() {
78 | @Override
79 | public void onCompleted(Exception e, String result) {
80 | loading.dismissDialog();
81 | if (e == null) {
82 | Log.e("Server=>", result);
83 | try {
84 | JSONObject resultBack = new JSONObject(result);
85 | if (resultBack.getBoolean("status")) {
86 | setUserProfile(resultBack.getJSONObject("profile"));
87 | goHome();
88 | } else {
89 | Toast.makeText(context, "Password or username is invalid", Toast.LENGTH_LONG).show();
90 | }
91 | } catch (Exception e1) {
92 | Toast.makeText(context, "Check network info" + e1.getMessage(), Toast.LENGTH_LONG).show();
93 | e1.printStackTrace();
94 | }
95 | } else {
96 | Toast.makeText(context, e.getMessage(), Toast.LENGTH_LONG).show();
97 | }
98 | }
99 | });
100 |
101 |
102 | PopupMenu popup = new PopupMenu(this, view);
103 |
104 | // This activity implements OnMenuItemClickListener
105 | popup.setOnMenuItemClickListener(this);
106 | popup.inflate(R.menu.profile_menu);
107 | popup.show();
108 | }
109 |
110 |
111 | @RequiresApi(api = Build.VERSION_CODES.M)
112 | @Override
113 | public boolean onMenuItemClick(MenuItem item) {
114 | switch (item.getItemId()) {
115 | case R.id.existing:
116 | Intent intent = new Intent();
117 | intent.setType("image/*");
118 | intent.setAction(Intent.ACTION_GET_CONTENT);//
119 | startActivityForResult(Intent.createChooser(intent, "Select File"), SELECT_FILE);
120 |
121 | return true;
122 | case R.id.camera_photo:
123 |
124 | if (checkSelfPermission(Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
125 | requestPermissions(new String[]{Manifest.permission.CAMERA},
126 | MY_CAMERA_PERMISSION_CODE);
127 | } else {
128 | Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
129 | startActivityForResult(cameraIntent, REQUEST_CAMERA);
130 | }
131 |
132 | return true;
133 | default:
134 | return false;
135 | }
136 | }
137 |
138 | @Override
139 | public void onActivityResult(int requestCode, int resultCode, Intent data) {
140 | super.onActivityResult(requestCode, resultCode, data);
141 |
142 | if (resultCode == Activity.RESULT_OK) {
143 | if (requestCode == SELECT_FILE) {
144 | photo = null;
145 | if (data != null) {
146 | try {
147 | photo = MediaStore.Images.Media.getBitmap(getApplicationContext().getContentResolver(), data.getData());
148 | } catch (IOException e) {
149 | e.printStackTrace();
150 | }
151 | }
152 |
153 | userprofile1.setImageBitmap(photo);
154 | Glide.with(this).load(photo)
155 | .apply(new RequestOptions().circleCrop())
156 | .into(userprofile1);
157 |
158 | } else if (requestCode == REQUEST_CAMERA && resultCode == Activity.RESULT_OK) {
159 | photo = (Bitmap) data.getExtras().get("data");
160 | userprofile1.setImageBitmap(photo);
161 | Glide.with(this).load(photo)
162 | .apply(new RequestOptions().circleCrop())
163 | .into(userprofile1);
164 |
165 |
166 | encodedCameraImage = encodeImage(photo);
167 |
168 |
169 | }
170 |
171 | }
172 | }
173 |
174 | private String encodeImage(Bitmap bm) {
175 | ByteArrayOutputStream baos = new ByteArrayOutputStream();
176 | bm.compress(Bitmap.CompressFormat.JPEG, 100, baos);
177 | byte[] b = baos.toByteArray();
178 | String encImage = Base64.encodeToString(b, Base64.DEFAULT);
179 |
180 | return encImage;
181 | }
182 |
183 |
184 | private void setUserProfile(JSONObject profile) {
185 | SharedPreferences.Editor editor = getSharedPreferences("parking", MODE_PRIVATE).edit();
186 | editor.putString("profile", profile.toString());
187 | editor.apply();
188 | }
189 |
190 |
191 | private void goHome() {
192 | Intent intent = new Intent(ProfileActivity.this, HomeActivity.class);
193 | startActivity(intent);
194 | finish();
195 | }
196 |
197 |
198 | }
199 |
200 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/com/example/diram/cityparker/HomeActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.diram.cityparker;
2 |
3 |
4 | import android.Manifest;
5 | import android.content.pm.PackageManager;
6 | import android.location.Location;
7 | import android.location.LocationListener;
8 | import android.os.Build;
9 | import android.os.Bundle;
10 | import android.support.design.widget.NavigationView;
11 | import android.support.v4.app.ActivityCompat;
12 | import android.support.v4.content.ContextCompat;
13 | import android.support.v4.view.GravityCompat;
14 | import android.support.v4.widget.DrawerLayout;
15 | import android.support.v7.app.ActionBar;
16 | import android.support.v7.app.AppCompatActivity;
17 | import android.support.v7.widget.Toolbar;
18 | import android.view.MenuItem;
19 | import android.widget.Toast;
20 |
21 |
22 | public class HomeActivity extends AppCompatActivity implements OnMapReadyCallback,
23 | GoogleApiClient.ConnectionCallbacks,
24 | GoogleApiClient.OnConnectionFailedListener,
25 | LocationListener {
26 |
27 | private GoogleMap mMap;
28 | GoogleApiClient mGoogleApiClient;
29 | Location mLastLocation;
30 | Marker mCurrLocationMarker;
31 | LocationRequest mLocationRequest;
32 | private DrawerLayout mDrawerLayout;
33 |
34 | @Override
35 | protected void onCreate(Bundle savedInstanceState) {
36 | super.onCreate(savedInstanceState);
37 | setContentView(R.layout.activity_navigationmain);
38 |
39 |
40 |
41 | Toolbar toolbar = findViewById(R.id.toolbar);
42 | setSupportActionBar(toolbar);
43 | ActionBar actionbar = getSupportActionBar();
44 | actionbar.setDisplayHomeAsUpEnabled(true);
45 | actionbar.setHomeAsUpIndicator(R.drawable.ic_menu);
46 |
47 | mDrawerLayout = findViewById(R.id.drawer_layout);
48 | NavigationView navigationView = findViewById(R.id.nav_view);
49 | navigationView.setNavigationItemSelectedListener(
50 | new NavigationView.OnNavigationItemSelectedListener() {
51 | @Override
52 | public boolean onNavigationItemSelected(MenuItem menuItem) {
53 | // set item as selected to persist highlight
54 | menuItem.setChecked(true);
55 | // close drawer when item is tapped
56 | mDrawerLayout.closeDrawers();
57 |
58 | // Add code here to update the UI based on the item selected
59 | // For example, swap UI fragments here
60 |
61 | return true;
62 | }
63 | });
64 |
65 |
66 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
67 | checkLocationPermission();
68 | }
69 | // Obtain the SupportMapFragment and get notified when the map is ready to be used.
70 | SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
71 | .findFragmentById(R.id.map);
72 | mapFragment.getMapAsync(this);
73 | }
74 |
75 |
76 | /**
77 | * Manipulates the map once available.
78 | * This callback is triggered when the map is ready to be used.
79 | * This is where we can add markers or lines, add listeners or move the camera. In this case,
80 | * we just add a marker near Sydney, Australia.
81 | * If Google Play services is not installed on the device, the user will be prompted to install
82 | * it inside the SupportMapFragment. This method will only be triggered once the user has
83 | * installed Google Play services and returned to the app.
84 | */
85 | @Override
86 | public void onMapReady(GoogleMap googleMap) {
87 | mMap = googleMap;
88 | mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
89 |
90 | //Initialize Google Play Services
91 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
92 | if (ContextCompat.checkSelfPermission(this,
93 | Manifest.permission.ACCESS_FINE_LOCATION)
94 | == PackageManager.PERMISSION_GRANTED) {
95 | buildGoogleApiClient();
96 | mMap.setMyLocationEnabled(true);
97 | }
98 | }
99 | else {
100 | buildGoogleApiClient();
101 | mMap.setMyLocationEnabled(true);
102 | }
103 | }
104 |
105 | protected synchronized void buildGoogleApiClient() {
106 | mGoogleApiClient = new GoogleApiClient.Builder(this)
107 | .addConnectionCallbacks(this)
108 | .addOnConnectionFailedListener(this)
109 | .addApi(LocationServices.API)
110 | .build();
111 | mGoogleApiClient.connect();
112 | }
113 |
114 | @Override
115 | public void onConnected(Bundle bundle) {
116 |
117 | mLocationRequest = new LocationRequest();
118 | mLocationRequest.setInterval(1000);
119 | mLocationRequest.setFastestInterval(1000);
120 | mLocationRequest.setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY);
121 | if (ContextCompat.checkSelfPermission(this,
122 | Manifest.permission.ACCESS_FINE_LOCATION)
123 | == PackageManager.PERMISSION_GRANTED) {
124 | LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this);
125 | }
126 |
127 | }
128 |
129 | @Override
130 | public void onConnectionSuspended(int i) {
131 |
132 | }
133 |
134 | @Override
135 | public void onLocationChanged(Location location) {
136 |
137 | mLastLocation = location;
138 | if (mCurrLocationMarker != null) {
139 | mCurrLocationMarker.remove();
140 | }
141 |
142 | //Place current location marker
143 | LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
144 | MarkerOptions markerOptions = new MarkerOptions();
145 | markerOptions.position(latLng);
146 | markerOptions.title("Current Position");
147 | markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_MAGENTA));
148 | mCurrLocationMarker = mMap.addMarker(markerOptions);
149 |
150 | //move map camera
151 | mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
152 | mMap.animateCamera(CameraUpdateFactory.zoomTo(11));
153 |
154 | //stop location updates
155 | if (mGoogleApiClient != null) {
156 | LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, this);
157 | }
158 |
159 | }
160 |
161 | @Override
162 | public void onStatusChanged(String provider, int status, Bundle extras) {
163 |
164 | }
165 |
166 | @Override
167 | public void onProviderEnabled(String provider) {
168 |
169 | }
170 |
171 | @Override
172 | public void onProviderDisabled(String provider) {
173 |
174 | }
175 |
176 |
177 | public static final int MY_PERMISSIONS_REQUEST_LOCATION = 99;
178 | public boolean checkLocationPermission(){
179 | if (ContextCompat.checkSelfPermission(this,
180 | Manifest.permission.ACCESS_FINE_LOCATION)
181 | != PackageManager.PERMISSION_GRANTED) {
182 |
183 | // Asking user if explanation is needed
184 | if (ActivityCompat.shouldShowRequestPermissionRationale(this,
185 | Manifest.permission.ACCESS_FINE_LOCATION)) {
186 |
187 | // Show an explanation to the user *asynchronously* -- don't block
188 | // this thread waiting for the user's response! After the user
189 | // sees the explanation, try again to request the permission.
190 |
191 | //Prompt the user once explanation has been shown
192 | ActivityCompat.requestPermissions(this,
193 | new String[]{Manifest.permission.ACCESS_FINE_LOCATION},
194 | MY_PERMISSIONS_REQUEST_LOCATION);
195 |
196 |
197 | } else {
198 | // No explanation needed, we can request the permission.
199 | ActivityCompat.requestPermissions(this,
200 | new String[]{Manifest.permission.ACCESS_FINE_LOCATION},
201 | MY_PERMISSIONS_REQUEST_LOCATION);
202 | }
203 | return false;
204 | } else {
205 | return true;
206 | }
207 | }
208 |
209 | @Override
210 | public void onRequestPermissionsResult(int requestCode,
211 | String permissions[], int[] grantResults) {
212 | switch (requestCode) {
213 | case MY_PERMISSIONS_REQUEST_LOCATION: {
214 | // If request is cancelled, the result arrays are empty.
215 | if (grantResults.length > 0
216 | && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
217 |
218 | // permission was granted. Do the
219 | // contacts-related task you need to do.
220 | if (ContextCompat.checkSelfPermission(this,
221 | Manifest.permission.ACCESS_FINE_LOCATION)
222 | == PackageManager.PERMISSION_GRANTED) {
223 |
224 | if (mGoogleApiClient == null) {
225 | buildGoogleApiClient();
226 | }
227 | mMap.setMyLocationEnabled(true);
228 | }
229 |
230 | } else {
231 |
232 | // Permission denied, Disable the functionality that depends on this permission.
233 | Toast.makeText(this, "permission denied", Toast.LENGTH_LONG).show();
234 | }
235 | return;
236 | }
237 |
238 | // other 'case' lines to check for other permissions this app might request.
239 | // You can add here other case statements according to your requirement.
240 | }
241 | }
242 |
243 | @Override
244 | public boolean onOptionsItemSelected(MenuItem item) {
245 | switch (item.getItemId()) {
246 | case android.R.id.home:
247 | mDrawerLayout.openDrawer(GravityCompat.START);
248 | return true;
249 | }
250 | return super.onOptionsItemSelected(item);
251 | }
252 |
253 |
254 | }
255 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/diram/parkingspacefinder/HomeActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.diram.parkingspacefinder;
2 |
3 |
4 | import android.Manifest;
5 | import android.content.Context;
6 | import android.content.Intent;
7 | import android.content.pm.PackageManager;
8 | import android.location.Location;
9 | import android.os.Build;
10 | import android.os.Bundle;
11 | import android.support.annotation.NonNull;
12 | import android.support.design.widget.NavigationView;
13 | import android.support.v4.app.ActivityCompat;
14 | import android.support.v4.content.ContextCompat;
15 | import android.support.v4.view.GravityCompat;
16 | import android.support.v4.widget.DrawerLayout;
17 | import android.support.v7.app.AppCompatActivity;
18 | import android.util.Log;
19 | import android.view.MenuItem;
20 | import android.view.View;
21 | import android.widget.ImageView;
22 | import android.widget.TextView;
23 | import android.widget.Toast;
24 |
25 | import com.arlib.floatingsearchview.FloatingSearchView;
26 | import com.bumptech.glide.Glide;
27 | import com.example.diram.parkingspacefinder.helper.Alert;
28 | import com.example.diram.parkingspacefinder.ini.Constant;
29 | import com.example.diram.parkingspacefinder.models.Profile;
30 | import com.google.android.gms.common.ConnectionResult;
31 | import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
32 | import com.google.android.gms.common.GooglePlayServicesRepairableException;
33 | import com.google.android.gms.common.api.GoogleApiClient;
34 | import com.google.android.gms.common.api.Status;
35 | import com.google.android.gms.location.LocationListener;
36 | import com.google.android.gms.location.LocationRequest;
37 | import com.google.android.gms.location.LocationServices;
38 | import com.google.android.gms.location.places.AutocompleteFilter;
39 | import com.google.android.gms.location.places.Place;
40 | import com.google.android.gms.location.places.ui.PlaceAutocomplete;
41 | import com.google.android.gms.location.places.ui.PlaceAutocompleteFragment;
42 | import com.google.android.gms.location.places.ui.PlaceSelectionListener;
43 | import com.google.android.gms.maps.CameraUpdateFactory;
44 | import com.google.android.gms.maps.GoogleMap;
45 | import com.google.android.gms.maps.OnMapReadyCallback;
46 | import com.google.android.gms.maps.SupportMapFragment;
47 | import com.google.android.gms.maps.model.BitmapDescriptorFactory;
48 | import com.google.android.gms.maps.model.LatLng;
49 | import com.google.android.gms.maps.model.Marker;
50 | import com.google.android.gms.maps.model.MarkerOptions;
51 |
52 |
53 | public class
54 | HomeActivity extends AppCompatActivity implements OnMapReadyCallback,
55 | GoogleApiClient.ConnectionCallbacks,
56 | GoogleApiClient.OnConnectionFailedListener,
57 | LocationListener, NavigationView.OnNavigationItemSelectedListener {
58 |
59 | private GoogleMap mMap;
60 | private Context context;
61 | private SupportMapFragment mapFragment;
62 | GoogleApiClient mGoogleApiClient;
63 | Location mLastLocation;
64 | Marker marker;
65 | Marker mCurrLocationMarker;
66 | LocationRequest mLocationRequest;
67 | private DrawerLayout mDrawerLayout;
68 | private Profile userProfile;
69 | FloatingSearchView mSearchView;
70 | private PlaceAutocompleteFragment placeAutocompleteFragment;
71 |
72 |
73 |
74 | @Override
75 | protected void onCreate(Bundle savedInstanceState) {
76 | super.onCreate(savedInstanceState);
77 | setContentView(R.layout.activity_navigationactivity);
78 |
79 |
80 | placeAutocompleteFragment = (PlaceAutocompleteFragment)getFragmentManager().findFragmentById(R.id.place_autocomplete_fragment);
81 |
82 | placeAutocompleteFragment.setFilter(new AutocompleteFilter.Builder().
83 | setTypeFilter(Place.TYPE_COUNTRY).setCountry("KE").build());
84 |
85 |
86 | placeAutocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() {
87 | @Override
88 | public void onPlaceSelected(Place place) {
89 | final LatLng latLngLoc = place.getLatLng();
90 |
91 | if(marker!=null){
92 | marker.remove();
93 | }
94 | marker = mMap.addMarker(new MarkerOptions().position(latLngLoc).title(place.getName().toString()));
95 | mMap.animateCamera(CameraUpdateFactory.zoomTo(16), 2000, null);
96 | }
97 |
98 | @Override
99 | public void onError(Status status) {
100 | Toast.makeText(HomeActivity.this, ""+status.toString(), Toast.LENGTH_SHORT).show();
101 | }
102 | });
103 |
104 |
105 |
106 |
107 |
108 | context = this;
109 | //Toolbar toolbar = findViewById(R.id.toolbar);
110 | //setSupportActionBar(toolbar);
111 | // ActionBar actionbar = getSupportActionBar();
112 | //actionbar.setDisplayHomeAsUpEnabled(true);
113 | //actionbar.setHomeAsUpIndicator(R.drawable.ic_menu2);
114 |
115 |
116 |
117 |
118 |
119 | mDrawerLayout = findViewById(R.id.drawer_layout);
120 | NavigationView navigationView = findViewById(R.id.nav_view);
121 |
122 | navigationView.setNavigationItemSelectedListener(this);
123 |
124 |
125 |
126 |
127 | mSearchView = findViewById(R.id.search_place);
128 | mSearchView.setOnQueryChangeListener(new FloatingSearchView.OnQueryChangeListener() {
129 | @Override
130 | public void onSearchTextChanged(String oldQuery, final String newQuery) {
131 |
132 |
133 | }
134 | });
135 |
136 |
137 |
138 | //now search view controlling drawer open/closer
139 | mSearchView.attachNavigationDrawerToMenuButton(mDrawerLayout);
140 |
141 |
142 |
143 |
144 |
145 | if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
146 | checkLocationPermission();
147 | }
148 | // Obtain the SupportMapFragment and get notified when the map is ready to be used.
149 | SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
150 | .findFragmentById(R.id.map);
151 | mapFragment.getMapAsync(this);
152 | userProfile = Constant.getUserProfile(this);
153 | ((TextView) navigationView.getHeaderView(0).findViewById(R.id.username)).setText(userProfile.getName());
154 | ((TextView) navigationView.getHeaderView(0).findViewById(R.id.email)).setText(userProfile.getEmail());
155 |
156 | Glide.with(this)
157 | .load(userProfile.getIconPath())
158 | .into(((ImageView) navigationView.getHeaderView(0).findViewById(R.id.userlogo)));
159 | }
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 | /**
168 | * Manipulates the map once available.
169 | * This callback is triggered when the map is ready to be used.
170 | * This is where we can add markers or lines, add listeners or move the camera. In this case,
171 | * we just add a marker near Sydney, Australia.
172 | * If Google Play services is not installed on the device, the user will be prompted to install
173 | * it inside the SupportMapFragment. This method will only be triggered once the user has
174 | * installed Google Play services and returned to the app.
175 | */
176 | @Override
177 | public void onMapReady(GoogleMap googleMap) {
178 | mMap = googleMap;
179 | mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
180 |
181 | //Initialize Google Play Services
182 | if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
183 | if (ContextCompat.checkSelfPermission(this,
184 | Manifest.permission.ACCESS_FINE_LOCATION)
185 | == PackageManager.PERMISSION_GRANTED) {
186 | buildGoogleApiClient();
187 | mMap.setMyLocationEnabled(true);
188 | }
189 | } else {
190 | buildGoogleApiClient();
191 | mMap.setMyLocationEnabled(true);
192 | }
193 | }
194 |
195 | protected synchronized void buildGoogleApiClient() {
196 | mGoogleApiClient = new GoogleApiClient.Builder(this)
197 | .addConnectionCallbacks(this)
198 | .addOnConnectionFailedListener(this)
199 | .addApi(LocationServices.API)
200 | .build();
201 | mGoogleApiClient.connect();
202 | }
203 |
204 | @Override
205 | public void onConnected(Bundle bundle) {
206 |
207 | mLocationRequest = new LocationRequest();
208 | mLocationRequest.setInterval(1000);
209 | mLocationRequest.setFastestInterval(1000);
210 | mLocationRequest.setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY);
211 | if (ContextCompat.checkSelfPermission(this,
212 | Manifest.permission.ACCESS_FINE_LOCATION)
213 | == PackageManager.PERMISSION_GRANTED) {
214 | LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this);
215 | }
216 |
217 | }
218 |
219 | @Override
220 | public void onConnectionSuspended(int i) {
221 |
222 | }
223 |
224 | @Override
225 | public void onLocationChanged(Location location) {
226 |
227 | mLastLocation = location;
228 | if (mCurrLocationMarker != null) {
229 | mCurrLocationMarker.remove();
230 | }
231 |
232 | //Place current location marker
233 | LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
234 | MarkerOptions markerOptions = new MarkerOptions();
235 | markerOptions.position(latLng);
236 | markerOptions.title("Current Position");
237 | markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_MAGENTA));
238 | mCurrLocationMarker = mMap.addMarker(markerOptions);
239 |
240 | //move map camera
241 | mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
242 | mMap.animateCamera(CameraUpdateFactory.zoomTo(11));
243 |
244 | //stop location updates
245 | if (mGoogleApiClient != null) {
246 | LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, this);
247 | }
248 |
249 | }
250 |
251 |
252 | public static final int MY_PERMISSIONS_REQUEST_LOCATION = 99;
253 |
254 | public boolean checkLocationPermission() {
255 | if (ContextCompat.checkSelfPermission(this,
256 | Manifest.permission.ACCESS_FINE_LOCATION)
257 | != PackageManager.PERMISSION_GRANTED) {
258 |
259 | // Asking user if explanation is needed
260 | if (ActivityCompat.shouldShowRequestPermissionRationale(this,
261 | Manifest.permission.ACCESS_FINE_LOCATION)) {
262 |
263 | // Show an explanation to the user *asynchronously* -- don't block
264 | // this thread waiting for the user's response! After the user
265 | // sees the explanation, try again to request the permission.
266 |
267 | //Prompt the user once explanation has been shown
268 | ActivityCompat.requestPermissions(this,
269 | new String[]{Manifest.permission.ACCESS_FINE_LOCATION},
270 | MY_PERMISSIONS_REQUEST_LOCATION);
271 |
272 |
273 | } else {
274 | // No explanation needed, we can request the permission.
275 | ActivityCompat.requestPermissions(this,
276 | new String[]{Manifest.permission.ACCESS_FINE_LOCATION},
277 | MY_PERMISSIONS_REQUEST_LOCATION);
278 | }
279 | return false;
280 | } else {
281 | return true;
282 | }
283 | }
284 |
285 | @Override
286 | public void onRequestPermissionsResult(int requestCode,
287 | String permissions[], int[] grantResults) {
288 | switch (requestCode) {
289 | case MY_PERMISSIONS_REQUEST_LOCATION: {
290 | // If request is cancelled, the result arrays are empty.
291 | if (grantResults.length > 0
292 | && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
293 |
294 | // permission was granted. Do the
295 | // contacts-related task you need to do.
296 | if (ContextCompat.checkSelfPermission(this,
297 | Manifest.permission.ACCESS_FINE_LOCATION)
298 | == PackageManager.PERMISSION_GRANTED) {
299 |
300 | if (mGoogleApiClient == null) {
301 | buildGoogleApiClient();
302 | }
303 | mMap.setMyLocationEnabled(true);
304 | }
305 |
306 | } else {
307 |
308 | // Permission denied, Disable the functionality that depends on this permission.
309 | Toast.makeText(this, "permission denied", Toast.LENGTH_LONG).show();
310 | }
311 | }
312 |
313 | // other 'case' lines to check for other permissions this app might request.
314 | // You can add here other case statements according to your requirement.
315 | }
316 | }
317 |
318 |
319 | @Override
320 | public boolean onOptionsItemSelected(MenuItem item) {
321 | switch (item.getItemId()) {
322 | case android.R.id.home:
323 |
324 | mDrawerLayout.openDrawer(GravityCompat.START);
325 | return true;
326 | }
327 | return super.onOptionsItemSelected(item);
328 | }
329 |
330 |
331 | @SuppressWarnings("StatementWithEmptyBody")
332 | @Override
333 | public boolean onNavigationItemSelected(MenuItem item) {
334 | // Handle navigation view item clicks here.
335 | int id = item.getItemId();
336 |
337 | if (id == R.id.nav_profile) {
338 | Intent profile = new Intent(context, ProfileActivity.class);
339 | startActivity(profile);
340 | // Handle the camera action
341 | } else if (id == R.id.nav_history) {
342 | Intent history = new Intent(context, HistoryActivity.class);
343 | startActivity(history);
344 |
345 | Toast.makeText(this, "History", Toast.LENGTH_LONG).show();
346 | } else if (id == R.id.nav_notifications) {
347 |
348 | Intent notification = new Intent(context, NotificationActivity.class);
349 | startActivity(notification);
350 |
351 | Toast.makeText(this, "History", Toast.LENGTH_LONG).show();
352 | } else if (id == R.id.nav_about) {
353 | Intent about = new Intent(context, AboutActivity.class);
354 | startActivity(about);
355 |
356 | } else if (id == R.id.nav_logout) {
357 | //MY LOGOUT LOGIC HERE
358 | //JUST CALL PROFILE OBJECT BY CALLING CLEAR PROFILE LOGIC?
359 |
360 | final Alert alert = new Alert(this);
361 | alert.setCancelable(true);
362 | View view = alert.setView(R.layout.confirm_logout);
363 | TextView textView = view.findViewById(R.id.message);
364 | TextView header = view.findViewById(R.id.header);
365 | textView.setText("Are you sure you want to logout?");
366 | header.setText("Message");
367 | view.findViewById(R.id.positive_btn).setOnClickListener(new View.OnClickListener() {
368 | @Override
369 | public void onClick(View v) {
370 | alert.dismissAlertDialogue();
371 | }
372 | });
373 | view.findViewById(R.id.negative_btn).setOnClickListener(new View.OnClickListener() {
374 | @Override
375 | public void onClick(View v) {
376 | Constant.logOutUser(context);
377 | Intent intent = new Intent(context, LoginActivity.class);
378 | startActivity(intent);
379 | finish();
380 | }
381 | });
382 |
383 | alert.showAlertDialogue(false);
384 | } else if (id == R.id.nav_help) {
385 | Intent help = new Intent(context, HelpActivity.class);
386 | startActivity(help);
387 |
388 | }
389 |
390 | DrawerLayout drawer = findViewById(R.id.drawer_layout);
391 | drawer.closeDrawer(GravityCompat.START);
392 | return true;
393 | }
394 |
395 | @Override
396 | public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
397 |
398 | }
399 |
400 |
401 |
402 |
403 |
404 |
405 | }
406 |
--------------------------------------------------------------------------------