├── .idea └── vcs.xml ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── spartons │ │ └── driverapp │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── spartons │ │ │ └── driverapp │ │ │ ├── MainActivity.kt │ │ │ ├── helper │ │ │ ├── FirebaseHelper.kt │ │ │ ├── GoogleMapHelper.kt │ │ │ ├── MarkerAnimationHelper.kt │ │ │ └── UiHelper.kt │ │ │ ├── interfaces │ │ │ ├── IPositiveNegativeListener.kt │ │ │ └── LatLngInterpolator.kt │ │ │ └── model │ │ │ └── Driver.kt │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ ├── car_icon.png │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── google_maps_api.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── spartons │ └── driverapp │ └── ExampleUnitTest.kt ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ └── gradle-wrapper.properties └── settings.gradle /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-android-extensions' 4 | 5 | android { 6 | compileSdkVersion 27 7 | defaultConfig { 8 | applicationId "com.spartons.driverapp" 9 | minSdkVersion 20 10 | targetSdkVersion 27 11 | versionCode 1 12 | versionName "1.0" 13 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 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"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 26 | implementation 'com.android.support:appcompat-v7:27.1.1' 27 | implementation 'com.android.support:support-v4:27.1.1' 28 | implementation 'com.android.support:animated-vector-drawable:27.1.1' 29 | implementation 'com.android.support.constraint:constraint-layout:1.1.2' 30 | implementation 'com.google.android.gms:play-services-maps:15.0.1' 31 | implementation 'com.google.firebase:firebase-database:16.0.1' 32 | implementation 'com.google.android.gms:play-services-location:15.0.1' 33 | implementation 'com.afollestad.material-dialogs:core:0.9.6.0' 34 | testImplementation 'junit:junit:4.12' 35 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 36 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 37 | } 38 | apply plugin: 'com.google.gms.google-services' 39 | -------------------------------------------------------------------------------- /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/androidTest/java/com/spartons/driverapp/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.spartons.driverapp 2 | 3 | import android.support.test.InstrumentationRegistry 4 | import android.support.test.runner.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getTargetContext() 22 | assertEquals("com.spartons.driverapp", appContext.packageName) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 35 | 36 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /app/src/main/java/com/spartons/driverapp/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.spartons.driverapp 2 | 3 | import android.Manifest 4 | import android.annotation.SuppressLint 5 | import android.content.Intent 6 | import android.content.pm.PackageManager.PERMISSION_DENIED 7 | import android.content.pm.PackageManager.PERMISSION_GRANTED 8 | import android.os.Bundle 9 | import android.os.Looper 10 | import android.provider.Settings 11 | import android.support.v4.app.ActivityCompat 12 | import android.support.v7.app.AppCompatActivity 13 | import android.support.v7.widget.SwitchCompat 14 | import android.util.Log 15 | import android.widget.TextView 16 | import android.widget.Toast 17 | import com.google.android.gms.location.* 18 | import com.google.android.gms.maps.GoogleMap 19 | import com.google.android.gms.maps.OnMapReadyCallback 20 | import com.google.android.gms.maps.SupportMapFragment 21 | import com.google.android.gms.maps.model.LatLng 22 | import com.google.android.gms.maps.model.Marker 23 | import com.spartons.driverapp.helper.* 24 | import com.spartons.driverapp.interfaces.IPositiveNegativeListener 25 | import com.spartons.driverapp.interfaces.LatLngInterpolator 26 | import com.spartons.driverapp.model.Driver 27 | 28 | class MainActivity : AppCompatActivity() { 29 | 30 | companion object { 31 | private const val MY_PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION = 2200 32 | } 33 | 34 | private lateinit var googleMap: GoogleMap 35 | private lateinit var locationProviderClient: FusedLocationProviderClient 36 | private lateinit var locationRequest: LocationRequest 37 | private lateinit var locationCallback: LocationCallback 38 | private var locationFlag = true 39 | private var driverOnlineFlag = false 40 | private var currentPositionMarker: Marker? = null 41 | private val googleMapHelper = GoogleMapHelper() 42 | private val firebaseHelper = FirebaseHelper("0000") 43 | private val markerAnimationHelper = MarkerAnimationHelper() 44 | private val uiHelper = UiHelper() 45 | 46 | override fun onCreate(savedInstanceState: Bundle?) { 47 | super.onCreate(savedInstanceState) 48 | setContentView(R.layout.activity_main) 49 | val mapFragment: SupportMapFragment = supportFragmentManager.findFragmentById(R.id.supportMap) as SupportMapFragment 50 | mapFragment.getMapAsync(object : OnMapReadyCallback { 51 | override fun onMapReady(p0: GoogleMap?) { 52 | googleMap = p0!! 53 | } 54 | }) 55 | createLocationCallback() 56 | locationProviderClient = LocationServices.getFusedLocationProviderClient(this) 57 | locationRequest = uiHelper.getLocationRequest() 58 | if (!uiHelper.isPlayServicesAvailable(this)) { 59 | Toast.makeText(this, "Play Services did not installed!", Toast.LENGTH_SHORT).show() 60 | finish() 61 | } else requestLocationUpdate() 62 | val driverStatusTextView = findViewById(R.id.driverStatusTextView) 63 | findViewById(R.id.driverStatusSwitch).setOnCheckedChangeListener { _, b -> 64 | driverOnlineFlag = b 65 | if (driverOnlineFlag) driverStatusTextView.text = resources.getString(R.string.online_driver) 66 | else { 67 | driverStatusTextView.text = resources.getString(R.string.offline) 68 | firebaseHelper.deleteDriver() 69 | } 70 | } 71 | } 72 | 73 | @SuppressLint("MissingPermission") 74 | private fun requestLocationUpdate() { 75 | if (!uiHelper.isHaveLocationPermission(this)) { 76 | ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.ACCESS_FINE_LOCATION), MY_PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION) 77 | return 78 | } 79 | if (uiHelper.isLocationProviderEnabled(this)) 80 | uiHelper.showPositiveDialogWithListener(this, resources.getString(R.string.need_location), resources.getString(R.string.location_content), object : IPositiveNegativeListener { 81 | override fun onPositive() { 82 | startActivity(Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS)) 83 | } 84 | }, "Turn On", false) 85 | locationProviderClient.requestLocationUpdates(locationRequest, locationCallback, Looper.myLooper()) 86 | } 87 | 88 | private fun createLocationCallback() { 89 | locationCallback = object : LocationCallback() { 90 | override fun onLocationResult(locationResult: LocationResult?) { 91 | super.onLocationResult(locationResult) 92 | if (locationResult!!.lastLocation == null) return 93 | val latLng = LatLng(locationResult.lastLocation.latitude, locationResult.lastLocation.longitude) 94 | Log.e("Location", latLng.latitude.toString() + " , " + latLng.longitude) 95 | if (locationFlag) { 96 | locationFlag = false 97 | animateCamera(latLng) 98 | } 99 | if (driverOnlineFlag) firebaseHelper.updateDriver(Driver(lat = latLng.latitude, lng = latLng.longitude)) 100 | showOrAnimateMarker(latLng) 101 | } 102 | } 103 | } 104 | 105 | private fun showOrAnimateMarker(latLng: LatLng) { 106 | if (currentPositionMarker == null) 107 | currentPositionMarker = googleMap.addMarker(googleMapHelper.getDriverMarkerOptions(latLng)) 108 | else markerAnimationHelper.animateMarkerToGB(currentPositionMarker!!, latLng, LatLngInterpolator.Spherical()) 109 | } 110 | 111 | private fun animateCamera(latLng: LatLng) { 112 | val cameraUpdate = googleMapHelper.buildCameraUpdate(latLng) 113 | googleMap.animateCamera(cameraUpdate, 10, null) 114 | } 115 | 116 | override fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray) { 117 | super.onRequestPermissionsResult(requestCode, permissions, grantResults) 118 | if (requestCode == MY_PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION) { 119 | val value = grantResults[0] 120 | if (value == PERMISSION_DENIED) { 121 | Toast.makeText(this, "Location Permission denied", Toast.LENGTH_SHORT).show() 122 | finish() 123 | } else if (value == PERMISSION_GRANTED) requestLocationUpdate() 124 | } 125 | } 126 | } 127 | 128 | -------------------------------------------------------------------------------- /app/src/main/java/com/spartons/driverapp/helper/FirebaseHelper.kt: -------------------------------------------------------------------------------- 1 | package com.spartons.driverapp.helper 2 | 3 | import android.util.Log 4 | import com.google.firebase.database.DatabaseReference 5 | import com.google.firebase.database.FirebaseDatabase 6 | import com.spartons.driverapp.model.Driver 7 | 8 | class FirebaseHelper constructor(driverId: String) { 9 | 10 | companion object { 11 | private const val ONLINE_DRIVERS = "online_drivers" 12 | } 13 | 14 | private val onlineDriverDatabaseReference: DatabaseReference = FirebaseDatabase 15 | .getInstance() 16 | .reference 17 | .child(ONLINE_DRIVERS) 18 | .child(driverId) 19 | 20 | init { 21 | onlineDriverDatabaseReference 22 | .onDisconnect() 23 | .removeValue() 24 | } 25 | 26 | fun updateDriver(driver: Driver) { 27 | onlineDriverDatabaseReference 28 | .setValue(driver) 29 | Log.e("Driver Info", " Updated") 30 | } 31 | 32 | fun deleteDriver() { 33 | onlineDriverDatabaseReference 34 | .removeValue() 35 | } 36 | } -------------------------------------------------------------------------------- /app/src/main/java/com/spartons/driverapp/helper/GoogleMapHelper.kt: -------------------------------------------------------------------------------- 1 | package com.spartons.driverapp.helper 2 | 3 | import com.google.android.gms.maps.CameraUpdate 4 | import com.google.android.gms.maps.CameraUpdateFactory 5 | import com.google.android.gms.maps.model.BitmapDescriptorFactory 6 | import com.google.android.gms.maps.model.CameraPosition 7 | import com.google.android.gms.maps.model.LatLng 8 | import com.google.android.gms.maps.model.MarkerOptions 9 | import com.spartons.driverapp.R 10 | 11 | class GoogleMapHelper { 12 | 13 | companion object { 14 | private const val ZOOM_LEVEL = 18 15 | private const val TILT_LEVEL = 25 16 | } 17 | 18 | /** 19 | * @param latLng in which position to Zoom the camera. 20 | * @return the [CameraUpdate] with Zoom and Tilt level added with the given position. 21 | */ 22 | 23 | fun buildCameraUpdate(latLng: LatLng): CameraUpdate { 24 | val cameraPosition = CameraPosition.Builder() 25 | .target(latLng) 26 | .tilt(TILT_LEVEL.toFloat()) 27 | .zoom(ZOOM_LEVEL.toFloat()) 28 | .build() 29 | return CameraUpdateFactory.newCameraPosition(cameraPosition) 30 | } 31 | 32 | /** 33 | * @param position where to draw the [com.google.android.gms.maps.model.Marker] 34 | * @return the [MarkerOptions] with given properties added to it. 35 | */ 36 | 37 | fun getDriverMarkerOptions(position: LatLng): MarkerOptions { 38 | val options = getMarkerOptions(R.drawable.car_icon, position) 39 | options.flat(true) 40 | return options 41 | } 42 | 43 | private fun getMarkerOptions(resource: Int, position: LatLng): MarkerOptions { 44 | return MarkerOptions() 45 | .icon(BitmapDescriptorFactory.fromResource(resource)) 46 | .position(position) 47 | } 48 | } -------------------------------------------------------------------------------- /app/src/main/java/com/spartons/driverapp/helper/MarkerAnimationHelper.kt: -------------------------------------------------------------------------------- 1 | package com.spartons.driverapp.helper 2 | 3 | import android.os.Handler 4 | import android.os.SystemClock 5 | import android.view.animation.AccelerateDecelerateInterpolator 6 | import com.google.android.gms.maps.model.LatLng 7 | import com.google.android.gms.maps.model.Marker 8 | import com.spartons.driverapp.interfaces.LatLngInterpolator 9 | 10 | class MarkerAnimationHelper { 11 | 12 | fun animateMarkerToGB(marker: Marker, finalPosition: LatLng, latLngInterpolator: LatLngInterpolator) { 13 | val startPosition = marker.position 14 | val handler = Handler() 15 | val start = SystemClock.uptimeMillis() 16 | val interpolator = AccelerateDecelerateInterpolator() 17 | val durationInMs = 2000f 18 | handler.post(object : Runnable { 19 | var elapsed: Long = 0 20 | var t: Float = 0.toFloat() 21 | var v: Float = 0.toFloat() 22 | override fun run() { 23 | // Calculate progress using interpolator 24 | elapsed = SystemClock.uptimeMillis() - start 25 | t = elapsed / durationInMs 26 | v = interpolator.getInterpolation(t) 27 | marker.position = latLngInterpolator.interpolate(v, startPosition, finalPosition) 28 | // Repeat till progress is complete. 29 | if (t < 1) { 30 | // Post again 16ms later. 31 | handler.postDelayed(this, 16) 32 | } 33 | } 34 | }) 35 | } 36 | } -------------------------------------------------------------------------------- /app/src/main/java/com/spartons/driverapp/helper/UiHelper.kt: -------------------------------------------------------------------------------- 1 | package com.spartons.driverapp.helper 2 | 3 | import android.content.Context 4 | import android.content.pm.PackageManager 5 | import android.location.LocationManager 6 | import android.os.Build 7 | import android.support.v4.app.ActivityCompat 8 | import android.support.v4.content.ContextCompat 9 | import com.afollestad.materialdialogs.MaterialDialog 10 | import com.google.android.gms.common.ConnectionResult 11 | import com.google.android.gms.common.GoogleApiAvailability 12 | import com.google.android.gms.location.LocationRequest 13 | import com.spartons.driverapp.R 14 | import com.spartons.driverapp.interfaces.IPositiveNegativeListener 15 | 16 | class UiHelper { 17 | 18 | fun isPlayServicesAvailable(context: Context): Boolean { 19 | val googleApiAvailability = GoogleApiAvailability.getInstance() 20 | val status = googleApiAvailability.isGooglePlayServicesAvailable(context) 21 | return ConnectionResult.SUCCESS == status 22 | } 23 | 24 | fun isHaveLocationPermission(context: Context): Boolean { 25 | return Build.VERSION.SDK_INT < Build.VERSION_CODES.M || ActivityCompat.checkSelfPermission(context, android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(context, android.Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED 26 | } 27 | 28 | fun isLocationProviderEnabled(context: Context): Boolean { 29 | val locationManager = context.getSystemService(Context.LOCATION_SERVICE) as LocationManager 30 | return !locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER) && !locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER) 31 | } 32 | 33 | fun showPositiveDialogWithListener(callingClassContext: Context, title: String, content: String, positiveNegativeListener: IPositiveNegativeListener, positiveText: String, cancelable: Boolean) { 34 | buildDialog(callingClassContext, title, content) 35 | .builder 36 | .positiveText(positiveText) 37 | .positiveColor(getColor(R.color.colorPrimary, callingClassContext)) 38 | .onPositive { _, _ -> positiveNegativeListener.onPositive() } 39 | .cancelable(cancelable) 40 | .show() 41 | } 42 | 43 | private fun buildDialog(callingClassContext: Context, title: String, content: String): MaterialDialog { 44 | return MaterialDialog.Builder(callingClassContext) 45 | .title(title) 46 | .content(content) 47 | .build() 48 | } 49 | 50 | 51 | private fun getColor(color: Int, context: Context): Int { 52 | return ContextCompat.getColor(context, color) 53 | } 54 | 55 | fun getLocationRequest() : LocationRequest { 56 | val locationRequest = LocationRequest.create() 57 | locationRequest.priority = LocationRequest.PRIORITY_HIGH_ACCURACY 58 | locationRequest.interval = 3000 59 | return locationRequest 60 | } 61 | } -------------------------------------------------------------------------------- /app/src/main/java/com/spartons/driverapp/interfaces/IPositiveNegativeListener.kt: -------------------------------------------------------------------------------- 1 | package com.spartons.driverapp.interfaces 2 | 3 | @FunctionalInterface 4 | interface IPositiveNegativeListener { 5 | 6 | fun onPositive() 7 | 8 | fun onNegative() { 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /app/src/main/java/com/spartons/driverapp/interfaces/LatLngInterpolator.kt: -------------------------------------------------------------------------------- 1 | package com.spartons.driverapp.interfaces 2 | 3 | import com.google.android.gms.maps.model.LatLng 4 | import java.lang.Math.asin 5 | import java.lang.Math.atan2 6 | import java.lang.Math.cos 7 | import java.lang.Math.pow 8 | import java.lang.Math.sin 9 | import java.lang.Math.sqrt 10 | import java.lang.Math.toDegrees 11 | import java.lang.Math.toRadians 12 | 13 | interface LatLngInterpolator { 14 | 15 | fun interpolate(fraction: Float, a: LatLng, b: LatLng): LatLng 16 | 17 | class Spherical : LatLngInterpolator { 18 | 19 | override fun interpolate(fraction: Float, a: LatLng, b: LatLng): LatLng { 20 | // http://en.wikipedia.org/wiki/Slerp 21 | val fromLat = toRadians(a.latitude) 22 | val fromLng = toRadians(a.longitude) 23 | val toLat = toRadians(b.latitude) 24 | val toLng = toRadians(b.longitude) 25 | val cosFromLat = cos(fromLat) 26 | val cosToLat = cos(toLat) 27 | 28 | // Computes Spherical interpolation coefficients. 29 | val angle = computeAngleBetween(fromLat, fromLng, toLat, toLng) 30 | val sinAngle = sin(angle) 31 | if (sinAngle < 1E-6) { 32 | return a 33 | } 34 | val temp1 = sin((1 - fraction) * angle) / sinAngle 35 | val temp2 = sin(fraction * angle) / sinAngle 36 | 37 | // Converts from polar to vector and interpolate. 38 | val x = temp1 * cosFromLat * cos(fromLng) + temp2 * cosToLat * cos(toLng) 39 | val y = temp1 * cosFromLat * sin(fromLng) + temp2 * cosToLat * sin(toLng) 40 | val z = temp1 * sin(fromLat) + temp2 * sin(toLat) 41 | 42 | // Converts interpolated vector back to polar. 43 | val lat = atan2(z, sqrt(x * x + y * y)) 44 | val lng = atan2(y, x) 45 | return LatLng(toDegrees(lat), toDegrees(lng)) 46 | } 47 | 48 | private fun computeAngleBetween(fromLat: Double, fromLng: Double, toLat: Double, toLng: Double): Double { 49 | val dLat = fromLat - toLat 50 | val dLng = fromLng - toLng 51 | return 2 * asin(sqrt(pow(sin(dLat / 2), 2.0) + cos(fromLat) * cos(toLat) * pow(sin(dLng / 2), 2.0))) 52 | } 53 | } 54 | } 55 | 56 | -------------------------------------------------------------------------------- /app/src/main/java/com/spartons/driverapp/model/Driver.kt: -------------------------------------------------------------------------------- 1 | package com.spartons.driverapp.model 2 | 3 | data class Driver(val lat: Double, val lng: Double, val driverId: String = "0000") -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/car_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodingInfinite/DriverApp/6c01c6bb25e3018ca71d57bb02245eb105eb30e9/app/src/main/res/drawable/car_icon.png -------------------------------------------------------------------------------- /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/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 14 | 15 | 24 | 25 | 33 | 34 | 35 | 36 | 43 | 44 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodingInfinite/DriverApp/6c01c6bb25e3018ca71d57bb02245eb105eb30e9/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodingInfinite/DriverApp/6c01c6bb25e3018ca71d57bb02245eb105eb30e9/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodingInfinite/DriverApp/6c01c6bb25e3018ca71d57bb02245eb105eb30e9/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodingInfinite/DriverApp/6c01c6bb25e3018ca71d57bb02245eb105eb30e9/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodingInfinite/DriverApp/6c01c6bb25e3018ca71d57bb02245eb105eb30e9/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodingInfinite/DriverApp/6c01c6bb25e3018ca71d57bb02245eb105eb30e9/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodingInfinite/DriverApp/6c01c6bb25e3018ca71d57bb02245eb105eb30e9/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodingInfinite/DriverApp/6c01c6bb25e3018ca71d57bb02245eb105eb30e9/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodingInfinite/DriverApp/6c01c6bb25e3018ca71d57bb02245eb105eb30e9/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodingInfinite/DriverApp/6c01c6bb25e3018ca71d57bb02245eb105eb30e9/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | #FFFFFF 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/values/google_maps_api.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | AIzJ**************tvNMRGNuxk // Change it with your google map api key. 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | DriverApp 3 | Offline 4 | Enable GPS SERVICE 5 | This app wants to change your device settings use GPS,Wi-Fi and cell networks for your location 6 | Online 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/test/java/com/spartons/driverapp/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.spartons.driverapp 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext.kotlin_version = '1.2.50' 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.1.4' 11 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 12 | classpath 'com.google.gms:google-services:4.0.1' 13 | } 14 | } 15 | 16 | allprojects { 17 | repositories { 18 | google() 19 | jcenter() 20 | } 21 | } 22 | 23 | task clean(type: Delete) { 24 | delete rootProject.buildDir 25 | } 26 | -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sun Aug 26 07:57:25 PKT 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.4-all.zip 7 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | --------------------------------------------------------------------------------