├── .gitignore
├── .idea
├── codeStyles
│ ├── Project.xml
│ └── codeStyleConfig.xml
├── copyright
│ ├── profiles_settings.xml
│ └── utsman.xml
├── dictionaries
│ └── utsman.xml
├── gradle.xml
├── misc.xml
├── runConfigurations.xml
└── vcs.xml
├── LICENSE
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── utsman
│ │ └── smartmarker
│ │ └── sample
│ │ └── ExampleInstrumentedTest.kt
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── utsman
│ │ │ └── smartmarker
│ │ │ └── sample
│ │ │ ├── MainActivity.kt
│ │ │ ├── SimpleActivity.kt
│ │ │ ├── TrackerMapboxActivity.kt
│ │ │ └── ext.kt
│ └── res
│ │ ├── drawable-v24
│ │ ├── ic_launcher_foreground.xml
│ │ └── ic_marker_direction_2.xml
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ ├── activity_main.xml
│ │ ├── activity_simple.xml
│ │ └── activity_tracker_mapbox.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
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── utsman
│ └── smartmarker
│ └── sample
│ └── ExampleUnitTest.kt
├── base.gradle
├── build.gradle
├── buildSrc
├── build.gradle.kts
├── build
│ ├── classes
│ │ └── kotlin
│ │ │ └── main
│ │ │ ├── Core.class
│ │ │ ├── DependenciesKt.class
│ │ │ ├── META-INF
│ │ │ └── buildSrc.kotlin_module
│ │ │ ├── Maps.class
│ │ │ ├── Module.class
│ │ │ └── Rx.class
│ ├── kotlin
│ │ ├── buildSrcjar-classes.txt
│ │ └── compileKotlin
│ │ │ ├── build-history.bin
│ │ │ ├── caches-jvm
│ │ │ ├── inputs
│ │ │ │ ├── source-to-output.tab
│ │ │ │ ├── source-to-output.tab.keystream
│ │ │ │ ├── source-to-output.tab.keystream.len
│ │ │ │ ├── source-to-output.tab.len
│ │ │ │ ├── source-to-output.tab.values.at
│ │ │ │ ├── source-to-output.tab_i
│ │ │ │ └── source-to-output.tab_i.len
│ │ │ ├── jvm
│ │ │ │ └── kotlin
│ │ │ │ │ ├── class-fq-name-to-source.tab
│ │ │ │ │ ├── class-fq-name-to-source.tab.keystream
│ │ │ │ │ ├── class-fq-name-to-source.tab.keystream.len
│ │ │ │ │ ├── class-fq-name-to-source.tab.len
│ │ │ │ │ ├── class-fq-name-to-source.tab.values.at
│ │ │ │ │ ├── class-fq-name-to-source.tab_i
│ │ │ │ │ ├── class-fq-name-to-source.tab_i.len
│ │ │ │ │ ├── constants.tab
│ │ │ │ │ ├── constants.tab.keystream
│ │ │ │ │ ├── constants.tab.keystream.len
│ │ │ │ │ ├── constants.tab.len
│ │ │ │ │ ├── constants.tab.values.at
│ │ │ │ │ ├── constants.tab_i
│ │ │ │ │ ├── constants.tab_i.len
│ │ │ │ │ ├── internal-name-to-source.tab
│ │ │ │ │ ├── internal-name-to-source.tab.keystream
│ │ │ │ │ ├── internal-name-to-source.tab.keystream.len
│ │ │ │ │ ├── internal-name-to-source.tab.len
│ │ │ │ │ ├── internal-name-to-source.tab.values.at
│ │ │ │ │ ├── internal-name-to-source.tab_i
│ │ │ │ │ ├── internal-name-to-source.tab_i.len
│ │ │ │ │ ├── package-parts.tab
│ │ │ │ │ ├── package-parts.tab.keystream
│ │ │ │ │ ├── package-parts.tab.keystream.len
│ │ │ │ │ ├── package-parts.tab.len
│ │ │ │ │ ├── package-parts.tab.values.at
│ │ │ │ │ ├── package-parts.tab_i
│ │ │ │ │ ├── package-parts.tab_i.len
│ │ │ │ │ ├── proto.tab
│ │ │ │ │ ├── proto.tab.keystream
│ │ │ │ │ ├── proto.tab.keystream.len
│ │ │ │ │ ├── proto.tab.len
│ │ │ │ │ ├── proto.tab.values.at
│ │ │ │ │ ├── proto.tab_i
│ │ │ │ │ ├── proto.tab_i.len
│ │ │ │ │ ├── source-to-classes.tab
│ │ │ │ │ ├── source-to-classes.tab.keystream
│ │ │ │ │ ├── source-to-classes.tab.keystream.len
│ │ │ │ │ ├── source-to-classes.tab.len
│ │ │ │ │ ├── source-to-classes.tab.values.at
│ │ │ │ │ ├── source-to-classes.tab_i
│ │ │ │ │ └── source-to-classes.tab_i.len
│ │ │ └── lookups
│ │ │ │ ├── counters.tab
│ │ │ │ ├── file-to-id.tab
│ │ │ │ ├── file-to-id.tab.keystream
│ │ │ │ ├── file-to-id.tab.keystream.len
│ │ │ │ ├── file-to-id.tab.len
│ │ │ │ ├── file-to-id.tab.values.at
│ │ │ │ ├── file-to-id.tab_i
│ │ │ │ ├── file-to-id.tab_i.len
│ │ │ │ ├── id-to-file.tab
│ │ │ │ ├── id-to-file.tab.keystream
│ │ │ │ ├── id-to-file.tab.keystream.len
│ │ │ │ ├── id-to-file.tab.len
│ │ │ │ ├── id-to-file.tab.values.at
│ │ │ │ ├── lookups.tab
│ │ │ │ ├── lookups.tab.keystream
│ │ │ │ ├── lookups.tab.keystream.len
│ │ │ │ ├── lookups.tab.len
│ │ │ │ ├── lookups.tab.values.at
│ │ │ │ ├── lookups.tab_i
│ │ │ │ └── lookups.tab_i.len
│ │ │ └── last-build.bin
│ ├── libs
│ │ └── buildSrc.jar
│ ├── pluginUnderTestMetadata
│ │ └── plugin-under-test-metadata.properties
│ ├── reports
│ │ └── task-properties
│ │ │ └── report.txt
│ └── tmp
│ │ └── jar
│ │ └── MANIFEST.MF
└── src
│ └── main
│ └── java
│ └── Dependencies.kt
├── extensions
├── googlemaps
│ ├── .gitignore
│ ├── build.gradle
│ ├── consumer-rules.pro
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── utsman
│ │ │ └── smartmarker
│ │ │ └── googlemaps
│ │ │ └── ExampleInstrumentedTest.kt
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── utsman
│ │ │ │ └── smartmarker
│ │ │ │ └── googlemaps
│ │ │ │ └── Ext.kt
│ │ └── res
│ │ │ └── values
│ │ │ └── strings.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── utsman
│ │ └── smartmarker
│ │ └── googlemaps
│ │ └── ExampleUnitTest.kt
├── location
│ ├── .gitignore
│ ├── build.gradle
│ ├── consumer-rules.pro
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── utsman
│ │ │ └── smartmarker
│ │ │ └── location
│ │ │ └── ExampleInstrumentedTest.kt
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── utsman
│ │ │ │ └── smartmarker
│ │ │ │ └── location
│ │ │ │ ├── LocationListener.java
│ │ │ │ ├── LocationUpdateListener.java
│ │ │ │ └── LocationWatcher.java
│ │ └── res
│ │ │ └── values
│ │ │ └── strings.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── utsman
│ │ └── smartmarker
│ │ └── location
│ │ └── ExampleUnitTest.kt
└── mapbox
│ ├── .gitignore
│ ├── build.gradle
│ ├── consumer-rules.pro
│ ├── proguard-rules.pro
│ └── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── utsman
│ │ └── smartmarker
│ │ └── mapbox
│ │ └── ExampleInstrumentedTest.kt
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── utsman
│ │ │ └── smartmarker
│ │ │ └── mapbox
│ │ │ ├── Ext.kt
│ │ │ ├── Marker.kt
│ │ │ ├── MarkerBuilder.kt
│ │ │ ├── MarkerOptions.kt
│ │ │ └── MathUtil.kt
│ └── res
│ │ └── values
│ │ └── strings.xml
│ └── test
│ └── java
│ └── com
│ └── utsman
│ └── smartmarker
│ └── mapbox
│ └── ExampleUnitTest.kt
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── settings.gradle
└── smartmarker
├── .gitignore
├── build.gradle
├── consumer-rules.pro
├── proguard-rules.pro
└── src
├── androidTest
└── java
│ └── com
│ └── utsman
│ └── smartmarker
│ └── ExampleInstrumentedTest.kt
├── main
├── AndroidManifest.xml
├── java
│ └── com
│ │ └── utsman
│ │ └── smartmarker
│ │ ├── Ext.kt
│ │ ├── MathUtil.java
│ │ ├── SmartLatLon.java
│ │ ├── SmartMarker.java
│ │ └── SmartUtil.java
└── res
│ └── values
│ └── strings.xml
└── test
└── java
└── com
└── utsman
└── smartmarker
└── ExampleUnitTest.kt
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 |
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | xmlns:android
20 |
21 | ^$
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | xmlns:.*
31 |
32 | ^$
33 |
34 |
35 | BY_NAME
36 |
37 |
38 |
39 |
40 |
41 |
42 | .*:id
43 |
44 | http://schemas.android.com/apk/res/android
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 | .*:name
54 |
55 | http://schemas.android.com/apk/res/android
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 | name
65 |
66 | ^$
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 | style
76 |
77 | ^$
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 | .*
87 |
88 | ^$
89 |
90 |
91 | BY_NAME
92 |
93 |
94 |
95 |
96 |
97 |
98 | .*
99 |
100 | http://schemas.android.com/apk/res/android
101 |
102 |
103 | ANDROID_ATTRIBUTE_ORDER
104 |
105 |
106 |
107 |
108 |
109 |
110 | .*
111 |
112 | .*
113 |
114 |
115 | BY_NAME
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
--------------------------------------------------------------------------------
/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/copyright/utsman.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/dictionaries/utsman.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | googlemaps
5 | mapbox
6 | smartmarker
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
24 |
25 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2019 Muhammad Utsman
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | apply plugin: 'com.android.application'
18 |
19 | apply plugin: 'kotlin-android'
20 |
21 | apply plugin: 'kotlin-android-extensions'
22 |
23 | android {
24 | compileSdkVersion 29
25 | buildToolsVersion "29.0.2"
26 | defaultConfig {
27 | applicationId "com.utsman.smartmarker.sample"
28 | minSdkVersion 16
29 | targetSdkVersion 29
30 | versionCode 1
31 | versionName "1.0"
32 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
33 | }
34 | buildTypes {
35 | release {
36 | minifyEnabled false
37 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
38 | }
39 | }
40 | }
41 |
42 | dependencies {
43 | implementation Core.kotlin
44 | implementation Core.appCompat
45 | implementation Core.ktx
46 |
47 | implementation Maps.googleMap
48 | implementation Maps.mapbox
49 |
50 | implementation Maps.rxLocation
51 | implementation Maps.gmsLocationService
52 |
53 | implementation Rx.rxJava
54 | implementation Rx.rxAndroid
55 |
56 | implementation project(Module.smartMarker)
57 | implementation project(":extensions:googlemaps")
58 | implementation project(":extensions:mapbox")
59 | implementation project(":extensions:location")
60 |
61 | implementation 'com.karumi:dexter:6.0.0'
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/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/utsman/smartmarker/sample/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.utsman.smartmarker.sample
18 |
19 | import androidx.test.platform.app.InstrumentationRegistry
20 | import androidx.test.ext.junit.runners.AndroidJUnit4
21 |
22 | import org.junit.Test
23 | import org.junit.runner.RunWith
24 |
25 | import org.junit.Assert.*
26 |
27 | /**
28 | * Instrumented test, which will execute on an Android device.
29 | *
30 | * See [testing documentation](http://d.android.com/tools/testing).
31 | */
32 | @RunWith(AndroidJUnit4::class)
33 | class ExampleInstrumentedTest {
34 | @Test
35 | fun useAppContext() {
36 | // Context of the app under test.
37 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
38 | assertEquals("com.utsman.smartmarker.sample", appContext.packageName)
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
21 |
22 |
23 |
24 |
25 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/app/src/main/java/com/utsman/smartmarker/sample/MainActivity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.utsman.smartmarker.sample
18 |
19 | import android.location.Location
20 | import android.os.Bundle
21 | import androidx.appcompat.app.AppCompatActivity
22 | import com.google.android.gms.maps.CameraUpdateFactory
23 | import com.google.android.gms.maps.GoogleMap
24 | import com.google.android.gms.maps.SupportMapFragment
25 | import com.google.android.gms.maps.model.Marker
26 | import com.google.android.gms.maps.model.MarkerOptions
27 | import com.mapbox.mapboxsdk.Mapbox
28 | import com.mapbox.mapboxsdk.camera.CameraPosition
29 | import com.mapbox.mapboxsdk.maps.MapView
30 | import com.mapbox.mapboxsdk.maps.MapboxMap
31 | import com.mapbox.mapboxsdk.maps.Style
32 | import com.utsman.smartmarker.SmartMarker
33 | import com.utsman.smartmarker.googlemaps.bitmapFromVector
34 | import com.utsman.smartmarker.googlemaps.toLatLngGoogle
35 | import com.utsman.smartmarker.location.LocationUpdateListener
36 | import com.utsman.smartmarker.location.LocationWatcher
37 | import com.utsman.smartmarker.mapbox.addMarker
38 | import com.utsman.smartmarker.mapbox.toLatLngMapbox
39 | import com.utsman.smartmarker.moveMarkerSmoothly
40 | import io.reactivex.Observable
41 | import io.reactivex.android.schedulers.AndroidSchedulers
42 | import io.reactivex.disposables.CompositeDisposable
43 | import io.reactivex.schedulers.Schedulers
44 | import kotlinx.android.synthetic.main.activity_main.*
45 | import java.util.concurrent.TimeUnit
46 |
47 | class MainActivity : AppCompatActivity() {
48 |
49 | private lateinit var locationWatcher: LocationWatcher
50 | private var googleMarker: Marker? = null
51 | private var mapboxMarker: com.utsman.smartmarker.mapbox.Marker? = null
52 |
53 | private var googleMap: GoogleMap? = null
54 | private var mapboxMap: MapboxMap? = null
55 |
56 | private val disposable = CompositeDisposable()
57 |
58 | override fun onCreate(savedInstanceState: Bundle?) {
59 | super.onCreate(savedInstanceState)
60 | Mapbox.getInstance(this, "sk.eyJ1Ijoia3VjaW5nYXBlcyIsImEiOiJjazMxaTMwdnUwNmZhM2RxZnN3MXB3NXVxIn0.SbImlZrtwRkxSpk-1h0h3A")
61 | setContentView(R.layout.activity_main)
62 |
63 | locationWatcher = LocationWatcher(this)
64 | val googleMapsView = (google_map_view as SupportMapFragment)
65 | val mapboxMapsView = findViewById(R.id.mapbox_view)
66 |
67 |
68 | // get location once time
69 | locationWatcher.getLocation(this) { loc ->
70 |
71 | // google maps async
72 | googleMapsView.getMapAsync { map ->
73 | googleMap = map
74 |
75 | val markerOption = MarkerOptions()
76 | .position(loc.toLatLngGoogle())
77 | .icon(bitmapFromVector(this@MainActivity, R.drawable.ic_marker_direction_2))
78 |
79 | googleMarker = map.addMarker(markerOption)
80 |
81 |
82 | map.animateCamera(CameraUpdateFactory.newLatLngZoom(loc.toLatLngGoogle(), 17f))
83 | }
84 |
85 | // mapbox async
86 | mapboxMapsView.getMapAsync { map ->
87 | mapboxMap = map
88 |
89 | map.setStyle(Style.OUTDOORS) { style ->
90 | /**
91 | * version 0.0.3
92 | * */
93 | /*val markerUtil = com.utsman.smartmarker.mapbox.MarkerOptions(this, style)
94 | mapboxMarker = markerUtil.addMarker("driver", R.drawable.ic_marker_direction_2, true, loc.toLatLngMapbox())*/
95 | /**
96 | * End version 0.0.3
97 | * */
98 |
99 | /**
100 | * version 1.0.3 use MarkerOptions
101 | * */
102 | val markerOptions = com.utsman.smartmarker.mapbox.MarkerOptions.Builder()
103 | .setId("id")
104 | .setIcon(R.drawable.mapbox_marker_icon_default)
105 | .setPosition(loc.toLatLngMapbox())
106 | .build(this)
107 |
108 | val bnd = com.mapbox.mapboxsdk.geometry.LatLng(-6.914744, 107.609810)
109 | val jgkt = com.mapbox.mapboxsdk.geometry.LatLng(-7.797068, 110.370529)
110 | val bks = com.mapbox.mapboxsdk.geometry.LatLng(-6.241586, 106.992416)
111 | val btn = com.mapbox.mapboxsdk.geometry.LatLng(-6.120000, 106.150276)
112 |
113 | val markerOptions1 = com.utsman.smartmarker.mapbox.MarkerOptions.Builder()
114 | .setId("jgja")
115 | .setIcon(R.drawable.ic_marker_direction_2, true)
116 | .setPosition(jgkt)
117 | .build(this)
118 |
119 | val markerOptions2 = com.utsman.smartmarker.mapbox.MarkerOptions.Builder()
120 | .setId("bks")
121 | .setIcon(R.drawable.ic_marker_direction_2, true)
122 | .setPosition(bks)
123 | .build(this)
124 |
125 | val markerOptions3 = com.utsman.smartmarker.mapbox.MarkerOptions.Builder()
126 | .setId("btn")
127 | .setPosition(btn)
128 | .build(this)
129 |
130 | //val markers = map.addMarkers(markerOptions1, markerOptions2, markerOptions3)
131 |
132 | val marker = map.addMarker(markerOptions3)
133 |
134 | btn_test.setOnClickListener {
135 |
136 | //markers.getId("btn").moveMarkerSmoothly(bks)
137 | marker?.moveMarkerSmoothly(bks)
138 |
139 | /*markers.filter {
140 | it.getId() != "bks"
141 | }.apply {
142 | map {
143 | it.moveMarkerSmoothly(bnd)
144 | }
145 | }*/
146 | }
147 |
148 |
149 |
150 | //val bndMarker = map.addMarker(markerOptions1)
151 |
152 | val position = CameraPosition.Builder()
153 | .target(loc.toLatLngMapbox())
154 | .zoom(15.0)
155 | .build()
156 |
157 | map.animateCamera(com.mapbox.mapboxsdk.camera.CameraUpdateFactory.newCameraPosition(position))
158 | }
159 | }
160 | }
161 |
162 | // update camera to marker every 5 second
163 | timer {
164 | //googleMap?.animateCamera(CameraUpdateFactory.newLatLngZoom(it.toLatLngGoogle(), 17f))
165 | val position = CameraPosition.Builder()
166 | .target(it.toLatLngMapbox())
167 | .zoom(15.0)
168 | .build()
169 |
170 | //mapboxMap?.animateCamera(com.mapbox.mapboxsdk.camera.CameraUpdateFactory.newCameraPosition(position))
171 | }
172 |
173 | // update your location
174 | updateLocation()
175 | }
176 |
177 | private fun updateLocation() {
178 | locationWatcher.getLocationUpdate(this, LocationWatcher.Priority.HIGH, object : LocationUpdateListener {
179 | override fun oldLocation(oldLocation: Location) {
180 |
181 | }
182 |
183 | override fun newLocation(newLocation: Location) {
184 | googleMarker?.moveMarkerSmoothly(newLocation.toLatLngGoogle())
185 |
186 |
187 | mapboxMarker?.let { marker ->
188 | SmartMarker.moveMarkerSmoothly(marker, newLocation.toLatLngMapbox())
189 | }
190 | }
191 |
192 | override fun failed(throwable: Throwable?) {
193 | }
194 | })
195 | }
196 |
197 | private fun timer(ready: (Location) -> Unit) {
198 | val obs = Observable.interval(5000, TimeUnit.MILLISECONDS)
199 | .subscribeOn(Schedulers.io())
200 | .observeOn(AndroidSchedulers.mainThread())
201 | .subscribe {
202 | locationWatcher.getLocation(this) {
203 | ready.invoke(it)
204 | }
205 | }
206 |
207 | disposable.add(obs)
208 | }
209 |
210 | override fun onDestroy() {
211 | locationWatcher.stopLocationWatcher()
212 | disposable.dispose()
213 | super.onDestroy()
214 | }
215 | }
216 |
--------------------------------------------------------------------------------
/app/src/main/java/com/utsman/smartmarker/sample/SimpleActivity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.utsman.smartmarker.sample
18 |
19 | import android.os.Bundle
20 | import androidx.appcompat.app.AppCompatActivity
21 | import com.mapbox.mapboxsdk.Mapbox
22 | import com.mapbox.mapboxsdk.maps.Style
23 | import com.utsman.smartmarker.location.LocationWatcher
24 | import com.utsman.smartmarker.mapbox.MarkerOptions
25 | import com.utsman.smartmarker.mapbox.addMarker
26 | import com.utsman.smartmarker.mapbox.toLatLngMapbox
27 | import kotlinx.android.synthetic.main.activity_simple.*
28 |
29 | class SimpleActivity : AppCompatActivity() {
30 |
31 | override fun onCreate(savedInstanceState: Bundle?) {
32 | super.onCreate(savedInstanceState)
33 | Mapbox.getInstance(this, "sk.eyJ1Ijoia3VjaW5nYXBlcyIsImEiOiJjazMxaTMwdnUwNmZhM2RxZnN3MXB3NXVxIn0.SbImlZrtwRkxSpk-1h0h3A")
34 | setContentView(R.layout.activity_simple)
35 |
36 | val locationWatcher = LocationWatcher(this)
37 | locationWatcher.getLocation(this) {
38 |
39 | mapbox_view.getMapAsync { mapboxMap ->
40 | mapboxMap.setStyle(Style.MAPBOX_STREETS) { style ->
41 |
42 | val latlng = it.toLatLngMapbox()
43 |
44 | val markerOptions = MarkerOptions.Builder()
45 | .setId("layer-id")
46 | .setIcon(R.drawable.ic_marker_direction_2, true)
47 | .setPosition(latlng)
48 | .build(this)
49 |
50 | val marker = mapboxMap.addMarker(markerOptions)
51 |
52 | btn_test.setOnClickListener {
53 | style.removeLayer(marker.getId())
54 | }
55 |
56 |
57 |
58 | mapboxMap.addOnMapLongClickListener {
59 | marker.moveMarkerSmoothly(it)
60 | true
61 | }
62 | }
63 | }
64 | }
65 | }
66 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/utsman/smartmarker/sample/TrackerMapboxActivity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.utsman.smartmarker.sample
18 |
19 | import android.location.Location
20 | import android.os.Bundle
21 | import android.os.Handler
22 | import androidx.appcompat.app.AppCompatActivity
23 | import com.mapbox.android.gestures.RotateGestureDetector
24 | import com.mapbox.mapboxsdk.Mapbox
25 | import com.mapbox.mapboxsdk.camera.CameraPosition
26 | import com.mapbox.mapboxsdk.camera.CameraUpdateFactory
27 | import com.mapbox.mapboxsdk.location.LocationComponentActivationOptions
28 | import com.mapbox.mapboxsdk.location.LocationComponentOptions
29 | import com.mapbox.mapboxsdk.location.modes.CameraMode
30 | import com.mapbox.mapboxsdk.location.modes.RenderMode
31 | import com.mapbox.mapboxsdk.maps.MapboxMap
32 | import com.mapbox.mapboxsdk.maps.Style
33 | import com.mapbox.mapboxsdk.style.layers.SymbolLayer
34 | import com.utsman.smartmarker.location.LocationUpdateListener
35 | import com.utsman.smartmarker.location.LocationWatcher
36 | import com.utsman.smartmarker.mapbox.*
37 | import io.reactivex.Observable
38 | import io.reactivex.android.schedulers.AndroidSchedulers
39 | import io.reactivex.disposables.CompositeDisposable
40 | import io.reactivex.schedulers.Schedulers
41 | import kotlinx.android.synthetic.main.activity_tracker_mapbox.*
42 | import java.util.concurrent.TimeUnit
43 |
44 | class TrackerMapboxActivity : AppCompatActivity() {
45 |
46 | private val locationWatcher by lazy {
47 | LocationWatcher(this)
48 | }
49 |
50 | private val compositeDisposable = CompositeDisposable()
51 |
52 | private var marker1: Marker? = null
53 | private lateinit var marker2: Marker
54 |
55 | override fun onCreate(savedInstanceState: Bundle?) {
56 | super.onCreate(savedInstanceState)
57 | Mapbox.getInstance(this, "sk.eyJ1Ijoia3VjaW5nYXBlcyIsImEiOiJjazMxaTMwdnUwNmZhM2RxZnN3MXB3NXVxIn0.SbImlZrtwRkxSpk-1h0h3A")
58 | setContentView(R.layout.activity_tracker_mapbox)
59 |
60 | mapbox_view_1.getMapAsync { mapboxMap ->
61 | mapboxMap.setStyle(Style.OUTDOORS) { style ->
62 |
63 | val updatePosition = CameraPosition.Builder()
64 | .zoom(17.0)
65 | .build()
66 |
67 | mapboxMap.animateCamera(CameraUpdateFactory.newCameraPosition(updatePosition))
68 |
69 | val locationComponentOption = LocationComponentOptions.builder(this)
70 | .bearingTintColor(R.color.colorPrimary)
71 | //.accuracyAlpha(0.8f) // 0.0f - 1.0f
72 | .build()
73 |
74 | val locationComponentActivationOptions = LocationComponentActivationOptions
75 | .builder(this, style)
76 | .locationComponentOptions(locationComponentOption)
77 | .useDefaultLocationEngine(true)
78 | .build()
79 |
80 | val locationComponent = mapboxMap.locationComponent
81 | locationComponent.activateLocationComponent(locationComponentActivationOptions)
82 |
83 | locationComponent.isLocationComponentEnabled = true
84 | locationComponent.cameraMode = CameraMode.TRACKING_GPS
85 | locationComponent.renderMode = RenderMode.GPS
86 |
87 |
88 | timer {
89 | moveCamera(it, mapboxMap)
90 | }
91 | }
92 | }
93 |
94 | mapbox_view_2.getMapAsync { mapboxMap ->
95 |
96 | mapboxMap.setStyle(Style.OUTDOORS) { style ->
97 |
98 | locationWatcher.getLocation(this) { location ->
99 | val markerOptions = MarkerOptions.Builder()
100 | .setId("id", true)
101 | .setIcon(R.drawable.ic_marker_direction_2, true)
102 | .setPosition(location.toLatLngMapbox())
103 | .build(this)
104 |
105 | marker1 = mapboxMap.addMarker(markerOptions)
106 |
107 | moveCamera(location, mapboxMap)
108 | updateLocation()
109 |
110 | mapboxMap.addOnRotateListener(object : MapboxMap.OnRotateListener {
111 | override fun onRotate(detector: RotateGestureDetector) {
112 |
113 | }
114 |
115 | override fun onRotateEnd(detector: RotateGestureDetector) {
116 | toast("rotation --> ${mapboxMap.cameraPosition.bearing}")
117 | logi("rotation --> ${mapboxMap.cameraPosition.bearing}")
118 | }
119 |
120 | override fun onRotateBegin(detector: RotateGestureDetector) {
121 |
122 | }
123 |
124 | })
125 |
126 | timer {
127 | moveCamera(it, mapboxMap)
128 | }
129 | }
130 | }
131 | }
132 |
133 | mapbox_view_3.getMapAsync { mapboxMap ->
134 | mapboxMap.setStyle(Style.OUTDOORS) { style ->
135 |
136 | locationWatcher.getLocation(this) { location ->
137 |
138 | val markerOptions = MarkerOptions.Builder()
139 | .setId("layer-id")
140 | .setIcon(R.drawable.ic_marker_direction_2, true)
141 | .setPosition(location.toLatLngMapbox())
142 | .build(this)
143 |
144 | marker2 = mapboxMap.addMarker(markerOptions)
145 | logi("marker is --> ${marker2.getId()}")
146 |
147 | moveCamera(location, mapboxMap)
148 | updateLocation()
149 |
150 | mapboxMap.addOnRotateListener(object : MapboxMap.OnRotateListener {
151 | override fun onRotate(detector: RotateGestureDetector) {
152 |
153 | }
154 |
155 | override fun onRotateEnd(detector: RotateGestureDetector) {
156 | toast("rotation --> ${mapboxMap.cameraPosition.bearing}")
157 | logi("rotation --> ${mapboxMap.cameraPosition.bearing}")
158 | }
159 |
160 | override fun onRotateBegin(detector: RotateGestureDetector) {
161 |
162 | }
163 |
164 | })
165 |
166 | Handler().postDelayed({
167 | toast("start remove marker --> ${marker2.getId()}")
168 | //style.removeImage(marker2?.getId()!!)
169 | //style.removeMarker(marker2!!)
170 | //style.removeLayer
171 |
172 | //style.removeLayer(marker2.getId())
173 | //style.layers.clear()
174 | //markerOptions.removeMe()
175 | style.removeLayer("layer-id")
176 | }, 5000)
177 |
178 | val updatePosition = CameraPosition.Builder()
179 | .zoom(17.0)
180 | .build()
181 |
182 | mapboxMap.animateCamera(CameraUpdateFactory.newCameraPosition(updatePosition))
183 |
184 | val locationComponentOption = LocationComponentOptions.builder(this)
185 | .bearingTintColor(R.color.colorPrimary)
186 | //.accuracyAlpha(0.8f) // 0.0f - 1.0f
187 | .build()
188 |
189 | val locationComponentActivationOptions = LocationComponentActivationOptions
190 | .builder(this, style)
191 | .locationComponentOptions(locationComponentOption)
192 | .useDefaultLocationEngine(true)
193 | .build()
194 |
195 | val locationComponent = mapboxMap.locationComponent
196 | locationComponent.activateLocationComponent(locationComponentActivationOptions)
197 |
198 | locationComponent.isLocationComponentEnabled = true
199 | locationComponent.cameraMode = CameraMode.TRACKING_GPS
200 | locationComponent.renderMode = RenderMode.GPS
201 |
202 | timer {
203 | moveCamera(it, mapboxMap)
204 | }
205 | }
206 | }
207 |
208 | }
209 | }
210 |
211 | private fun moveCamera(it: Location, mapboxMap: MapboxMap) {
212 | val updatePosition = CameraPosition.Builder()
213 | .target(it.toLatLngMapbox())
214 | .zoom(17.0)
215 | .build()
216 |
217 | mapboxMap.animateCamera(CameraUpdateFactory.newCameraPosition(updatePosition))
218 | }
219 |
220 | private fun updateLocation() {
221 | locationWatcher.getLocationUpdate(LocationWatcher.Priority.JEDI, object : LocationUpdateListener {
222 | override fun oldLocation(oldLocation: Location) {
223 |
224 | }
225 |
226 | override fun newLocation(newLocation: Location) {
227 | marker1?.moveMarkerSmoothly(newLocation.toLatLngMapbox())
228 | marker2?.moveMarkerSmoothly(newLocation.toLatLngMapbox())
229 | }
230 |
231 | override fun failed(throwable: Throwable) {
232 |
233 | }
234 |
235 | })
236 | }
237 |
238 | private fun timer(ready: (Location) -> Unit) {
239 | val obs = Observable.interval(5000, TimeUnit.MILLISECONDS)
240 | .subscribeOn(Schedulers.io())
241 | .observeOn(AndroidSchedulers.mainThread())
242 | .subscribe {
243 | locationWatcher.getLocation(this) {
244 | ready.invoke(it)
245 | }
246 | }
247 |
248 | compositeDisposable.add(obs)
249 | }
250 |
251 | override fun onDestroy() {
252 | super.onDestroy()
253 | compositeDisposable.dispose()
254 | locationWatcher.stopLocationWatcher()
255 | }
256 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/utsman/smartmarker/sample/ext.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.utsman.smartmarker.sample
18 |
19 | import android.content.Context
20 | import android.util.Log
21 | import android.widget.Toast
22 |
23 | fun logi(msg: String?) = Log.i("anjay", msg)
24 | fun loge(msg: String?) = Log.e("anjay", msg)
25 |
26 | fun Context.toast(msg: String) = Toast.makeText(this, msg, Toast.LENGTH_SHORT).show()
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
23 |
28 |
29 |
35 |
38 |
41 |
42 |
43 |
44 |
50 |
51 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_marker_direction_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
23 |
24 |
26 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
23 |
26 |
31 |
36 |
41 |
46 |
51 |
56 |
61 |
66 |
71 |
76 |
81 |
86 |
91 |
96 |
101 |
106 |
111 |
116 |
121 |
126 |
131 |
136 |
141 |
146 |
151 |
156 |
161 |
166 |
171 |
176 |
181 |
186 |
187 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
26 |
27 |
33 |
34 |
41 |
42 |
47 |
48 |
54 |
55 |
60 |
61 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_simple.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
21 |
22 |
28 |
29 |
34 |
35 |
40 |
41 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_tracker_mapbox.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
25 |
26 |
32 |
33 |
39 |
40 |
46 |
47 |
53 |
54 |
60 |
61 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 | #008577
20 | #00574B
21 | #D81B60
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 | Smart Marker
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/test/java/com/utsman/smartmarker/sample/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.utsman.smartmarker.sample
18 |
19 | import org.junit.Test
20 |
21 | import org.junit.Assert.*
22 |
23 | /**
24 | * Example local unit test, which will execute on the development machine (host).
25 | *
26 | * See [testing documentation](http://d.android.com/tools/testing).
27 | */
28 | class ExampleUnitTest {
29 | @Test
30 | fun addition_isCorrect() {
31 | assertEquals(4, 2 + 2)
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/base.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | apply plugin: 'com.jfrog.bintray'
18 | apply plugin: 'com.github.dcendents.android-maven'
19 |
20 | ext {
21 | bintrayRepo = "utsman"
22 | bintrayName = "com.utsman.smartmarker"
23 |
24 | libraryName = 'smartmarker'
25 |
26 | publishedGroupId = 'com.utsman.smartmarker'
27 | libraryVersion = '1.3.2'
28 |
29 | libraryDescription = 'Smart Marker for Google Maps and Mapbox'
30 | siteUrl = 'https://github.com/utsmannn/SmartMarker'
31 | gitUrl = 'https://github.com/utsmannn/SmartMarker.git'
32 | developerId = 'utsman'
33 | developerName = 'Muhammad Utsman'
34 | developerEmail = 'kucingapes@gmail.com'
35 | licenseName = 'The Apache Software License, Version 2.0'
36 | licenseUrl = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
37 | allLicenses = ["Apache-2.0"]
38 |
39 | }
40 |
41 | android {
42 | compileSdkVersion 29
43 | buildToolsVersion "29.0.2"
44 |
45 |
46 | defaultConfig {
47 | minSdkVersion 16
48 | targetSdkVersion 29
49 | versionCode 1
50 | versionName libraryVersion
51 |
52 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
53 | consumerProguardFiles 'consumer-rules.pro'
54 | }
55 |
56 | buildTypes {
57 | release {
58 | minifyEnabled false
59 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
60 | }
61 | }
62 |
63 | }
64 |
65 | if (project.rootProject.file('local.properties').exists()) {
66 | apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
67 | apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'
68 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
18 |
19 | buildscript {
20 | ext.kotlin_version = '1.3.50'
21 | repositories {
22 | google()
23 | jcenter()
24 |
25 | }
26 | dependencies {
27 | classpath 'com.android.tools.build:gradle:3.5.1'
28 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
29 | // NOTE: Do not place your application dependencies here; they belong
30 | // in the individual module build.gradle files
31 |
32 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
33 | classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
34 | }
35 | }
36 |
37 | allprojects {
38 | repositories {
39 | google()
40 | jcenter()
41 |
42 | }
43 | }
44 |
45 | task clean(type: Delete) {
46 | delete rootProject.buildDir
47 | }
48 |
49 | subprojects {
50 | tasks.withType(Javadoc).all { enabled = false }
51 | }
52 |
--------------------------------------------------------------------------------
/buildSrc/build.gradle.kts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | plugins {
18 | `kotlin-dsl`
19 | }
20 |
21 | repositories {
22 | jcenter()
23 | }
--------------------------------------------------------------------------------
/buildSrc/build/classes/kotlin/main/Core.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/classes/kotlin/main/Core.class
--------------------------------------------------------------------------------
/buildSrc/build/classes/kotlin/main/DependenciesKt.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/classes/kotlin/main/DependenciesKt.class
--------------------------------------------------------------------------------
/buildSrc/build/classes/kotlin/main/META-INF/buildSrc.kotlin_module:
--------------------------------------------------------------------------------
1 |
2 |
3 | DependenciesKt
--------------------------------------------------------------------------------
/buildSrc/build/classes/kotlin/main/Maps.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/classes/kotlin/main/Maps.class
--------------------------------------------------------------------------------
/buildSrc/build/classes/kotlin/main/Module.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/classes/kotlin/main/Module.class
--------------------------------------------------------------------------------
/buildSrc/build/classes/kotlin/main/Rx.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/classes/kotlin/main/Rx.class
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/buildSrcjar-classes.txt:
--------------------------------------------------------------------------------
1 | /Users/utsman/AndroidStudioProjects/SmartMarker/buildSrc/build/classes/kotlin/main/Core.class:/Users/utsman/AndroidStudioProjects/SmartMarker/buildSrc/build/classes/kotlin/main/DependenciesKt.class:/Users/utsman/AndroidStudioProjects/SmartMarker/buildSrc/build/classes/kotlin/main/Maps.class:/Users/utsman/AndroidStudioProjects/SmartMarker/buildSrc/build/classes/kotlin/main/Module.class:/Users/utsman/AndroidStudioProjects/SmartMarker/buildSrc/build/classes/kotlin/main/Rx.class
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/build-history.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/build-history.bin
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream:
--------------------------------------------------------------------------------
1 | V/Users/utsman/AndroidStudioProjects/SmartMarker/buildSrc/src/main/java/Dependencies.kt
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.keystream.len:
--------------------------------------------------------------------------------
1 | W
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.len:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.len
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.values.at:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.values.at
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i.len:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab_i.len
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream:
--------------------------------------------------------------------------------
1 | CoreMapsRxModule
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at:
--------------------------------------------------------------------------------
1 | / Header Record For PersistentHashMapValueStorageW V/Users/utsman/AndroidStudioProjects/SmartMarker/buildSrc/src/main/java/Dependencies.ktW V/Users/utsman/AndroidStudioProjects/SmartMarker/buildSrc/src/main/java/Dependencies.ktW V/Users/utsman/AndroidStudioProjects/SmartMarker/buildSrc/src/main/java/Dependencies.ktW V/Users/utsman/AndroidStudioProjects/SmartMarker/buildSrc/src/main/java/Dependencies.kt
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream:
--------------------------------------------------------------------------------
1 | DependenciesKt
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream.len:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.len:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.len
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab.values.at:
--------------------------------------------------------------------------------
1 | / Header Record For PersistentHashMapValueStorage5 k o t l i n _ v e r s i o n 1 . 3 . 5 0
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i.len:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/constants.tab_i.len
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream:
--------------------------------------------------------------------------------
1 | CoreMapsRxModuleDependenciesKt
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len:
--------------------------------------------------------------------------------
1 | #
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at:
--------------------------------------------------------------------------------
1 | / Header Record For PersistentHashMapValueStorageW V/Users/utsman/AndroidStudioProjects/SmartMarker/buildSrc/src/main/java/Dependencies.ktW V/Users/utsman/AndroidStudioProjects/SmartMarker/buildSrc/src/main/java/Dependencies.ktW V/Users/utsman/AndroidStudioProjects/SmartMarker/buildSrc/src/main/java/Dependencies.ktW V/Users/utsman/AndroidStudioProjects/SmartMarker/buildSrc/src/main/java/Dependencies.ktW V/Users/utsman/AndroidStudioProjects/SmartMarker/buildSrc/src/main/java/Dependencies.kt
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.keystream:
--------------------------------------------------------------------------------
1 | DependenciesKt
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.keystream.len:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.len:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.len
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab.values.at:
--------------------------------------------------------------------------------
1 | / Header Record For PersistentHashMapValueStorage
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab_i:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab_i
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab_i.len:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/package-parts.tab_i.len
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream:
--------------------------------------------------------------------------------
1 | CoreMapsRxModuleDependenciesKt.kotlin_module
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream.len:
--------------------------------------------------------------------------------
1 | 2
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.len:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.len
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream:
--------------------------------------------------------------------------------
1 | V/Users/utsman/AndroidStudioProjects/SmartMarker/buildSrc/src/main/java/Dependencies.kt
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len:
--------------------------------------------------------------------------------
1 | W
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at:
--------------------------------------------------------------------------------
1 | / Header Record For PersistentHashMapValueStorage2 CoreMapsRxModuleDependenciesKt.kotlin_module
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/counters.tab:
--------------------------------------------------------------------------------
1 | 1
2 | 0
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream:
--------------------------------------------------------------------------------
1 | V/Users/utsman/AndroidStudioProjects/SmartMarker/buildSrc/src/main/java/Dependencies.kt
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.keystream.len:
--------------------------------------------------------------------------------
1 | X
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.len:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.len
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.values.at:
--------------------------------------------------------------------------------
1 | / Header Record For PersistentHashMapValueStorage
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i.len:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab_i.len
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream.len:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.len:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.len
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.values.at:
--------------------------------------------------------------------------------
1 | / Header Record For PersistentHashMapValueStorageX V/Users/utsman/AndroidStudioProjects/SmartMarker/buildSrc/src/main/java/Dependencies.kt
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream.len:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.keystream.len
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.len:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.at:
--------------------------------------------------------------------------------
1 | / Header Record For PersistentHashMapValueStorage
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i.len:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab_i.len
--------------------------------------------------------------------------------
/buildSrc/build/kotlin/compileKotlin/last-build.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/kotlin/compileKotlin/last-build.bin
--------------------------------------------------------------------------------
/buildSrc/build/libs/buildSrc.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/libs/buildSrc.jar
--------------------------------------------------------------------------------
/buildSrc/build/pluginUnderTestMetadata/plugin-under-test-metadata.properties:
--------------------------------------------------------------------------------
1 | implementation-classpath=/Users/utsman/AndroidStudioProjects/SmartMarker/buildSrc/build/classes/java/main\:/Users/utsman/AndroidStudioProjects/SmartMarker/buildSrc/build/classes/groovy/main\:/Users/utsman/AndroidStudioProjects/SmartMarker/buildSrc/build/classes/kotlin/main\:/Users/utsman/AndroidStudioProjects/SmartMarker/buildSrc/build/resources/main
2 |
--------------------------------------------------------------------------------
/buildSrc/build/reports/task-properties/report.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/buildSrc/build/reports/task-properties/report.txt
--------------------------------------------------------------------------------
/buildSrc/build/tmp/jar/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 |
3 |
--------------------------------------------------------------------------------
/buildSrc/src/main/java/Dependencies.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | const val kotlin_version = "1.3.50"
18 |
19 | object Core {
20 | val kotlin = "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
21 | val appCompat = "androidx.appcompat:appcompat:1.0.2"
22 | val ktx = "androidx.core:core-ktx:1.0.2"
23 | val permission = "com.karumi:dexter:5.0.0"
24 | }
25 |
26 | object Maps {
27 | val mapbox = "com.mapbox.mapboxsdk:mapbox-android-sdk:8.4.0"
28 | val googleMap = "com.google.android.gms:play-services-maps:17.0.0"
29 | val gmsLocationService = "com.google.android.gms:play-services-location:17.0.0"
30 | val rxLocation = "pl.charmas.android:android-reactive-location2:2.1@aar"
31 | }
32 |
33 | object Rx {
34 | val rxJava = "io.reactivex.rxjava2:rxjava:2.2.9"
35 | val rxAndroid = "io.reactivex.rxjava2:rxandroid:2.1.1"
36 | }
37 |
38 | object Module {
39 | val smartMarker = ":smartmarker"
40 | val extGoogleMaps = ":extensions:googlemaps"
41 | val extMapbox = ":extensions:mapbox"
42 | }
--------------------------------------------------------------------------------
/extensions/googlemaps/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/extensions/googlemaps/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | apply plugin: 'com.android.library'
18 | apply plugin: 'kotlin-android'
19 | apply plugin: 'kotlin-android-extensions'
20 |
21 | ext {
22 | artifact = 'ext-googlemaps'
23 | }
24 |
25 | dependencies {
26 | implementation Core.kotlin
27 | implementation Core.appCompat
28 | implementation Core.ktx
29 |
30 | api Maps.googleMap
31 | }
32 |
33 | apply from: '../../base.gradle'
34 |
--------------------------------------------------------------------------------
/extensions/googlemaps/consumer-rules.pro:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/extensions/googlemaps/consumer-rules.pro
--------------------------------------------------------------------------------
/extensions/googlemaps/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 |
--------------------------------------------------------------------------------
/extensions/googlemaps/src/androidTest/java/com/utsman/smartmarker/googlemaps/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.utsman.smartmarker.googlemaps
18 |
19 | import androidx.test.platform.app.InstrumentationRegistry
20 | import androidx.test.ext.junit.runners.AndroidJUnit4
21 |
22 | import org.junit.Test
23 | import org.junit.runner.RunWith
24 |
25 | import org.junit.Assert.*
26 |
27 | /**
28 | * Instrumented test, which will execute on an Android device.
29 | *
30 | * See [testing documentation](http://d.android.com/tools/testing).
31 | */
32 | @RunWith(AndroidJUnit4::class)
33 | class ExampleInstrumentedTest {
34 | @Test
35 | fun useAppContext() {
36 | // Context of the app under test.
37 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
38 | assertEquals("com.utsman.smartmarker.googlemaps.test", appContext.packageName)
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/extensions/googlemaps/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
19 |
--------------------------------------------------------------------------------
/extensions/googlemaps/src/main/java/com/utsman/smartmarker/googlemaps/Ext.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.utsman.smartmarker.googlemaps
18 |
19 | import android.animation.ValueAnimator
20 | import android.content.Context
21 | import android.graphics.Bitmap
22 | import android.graphics.Canvas
23 | import android.location.Location
24 | import android.os.Handler
25 | import android.os.SystemClock
26 | import android.view.animation.LinearInterpolator
27 | import androidx.annotation.DrawableRes
28 | import androidx.core.content.ContextCompat
29 | import com.google.android.gms.maps.model.BitmapDescriptor
30 | import com.google.android.gms.maps.model.BitmapDescriptorFactory
31 | import com.google.android.gms.maps.model.LatLng
32 | import com.google.android.gms.maps.model.Marker
33 |
34 | fun Location.toLatLngGoogle() = LatLng(latitude, longitude)
35 |
36 | fun rotateMarker(marker: Marker, toRotation: Float, rotate: Boolean? = true) {
37 |
38 | if (rotate != null && rotate) {
39 | val handler = Handler()
40 | val start = SystemClock.uptimeMillis()
41 | val startRotation = marker.rotation
42 | val duration: Long = 300
43 |
44 | handler.post(object : Runnable {
45 | override fun run() {
46 | val elapsed = SystemClock.uptimeMillis() - start
47 | val t = LinearInterpolator().getInterpolation(elapsed.toFloat() / duration)
48 |
49 | val rot = t * toRotation + (1 - t) * startRotation
50 |
51 | marker.rotation = if (-rot > 180) rot / 2 else rot
52 | if (t < 1.0) {
53 | handler.postDelayed(this, 16)
54 | }
55 | }
56 | })
57 | }
58 | }
59 |
60 | fun bitmapFromVector(context: Context, @DrawableRes icon: Int): BitmapDescriptor {
61 |
62 | val background = ContextCompat.getDrawable(context, icon)
63 | background!!.setBounds(0, 0, background.intrinsicWidth, background.intrinsicHeight)
64 |
65 | val bitmap = Bitmap.createBitmap(background.intrinsicWidth, background.intrinsicHeight, Bitmap.Config.ARGB_8888)
66 | val canvas = Canvas(bitmap)
67 |
68 | background.draw(canvas)
69 | return BitmapDescriptorFactory.fromBitmap(bitmap)
70 | }
71 |
72 | fun moveMarkerSmoothly(marker: Marker, newLatLng: LatLng) : ValueAnimator {
73 | val animator = ValueAnimator.ofFloat(0f, 100f)
74 |
75 | val deltaLatitude = doubleArrayOf(newLatLng.latitude - marker.position.latitude)
76 | val deltaLongitude = newLatLng.longitude - marker.position.longitude
77 | val prevStep = floatArrayOf(0f)
78 | animator.duration = 1500
79 |
80 | animator.addUpdateListener { animation ->
81 | val deltaStep = (animation.animatedValue as Float - prevStep[0]).toDouble()
82 | prevStep[0] = animation.animatedValue as Float
83 | val latLng = LatLng(marker.position.latitude + deltaLatitude[0] * deltaStep * 1.0 / 100, marker.position.longitude + deltaStep * deltaLongitude * 1.0 / 100)
84 | marker.setPosition(latLng)
85 | }
86 |
87 | return animator
88 | }
--------------------------------------------------------------------------------
/extensions/googlemaps/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 | GoogleMaps
19 |
20 |
--------------------------------------------------------------------------------
/extensions/googlemaps/src/test/java/com/utsman/smartmarker/googlemaps/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.utsman.smartmarker.googlemaps
18 |
19 | import org.junit.Test
20 |
21 | import org.junit.Assert.*
22 |
23 | /**
24 | * Example local unit test, which will execute on the development machine (host).
25 | *
26 | * See [testing documentation](http://d.android.com/tools/testing).
27 | */
28 | class ExampleUnitTest {
29 | @Test
30 | fun addition_isCorrect() {
31 | assertEquals(4, 2 + 2)
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/extensions/location/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/extensions/location/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | apply plugin: 'com.android.library'
18 | apply plugin: 'kotlin-android'
19 | apply plugin: 'kotlin-android-extensions'
20 |
21 | ext {
22 | artifact = 'ext-location'
23 | }
24 |
25 | dependencies {
26 | implementation Core.kotlin
27 | implementation Core.appCompat
28 | implementation Core.ktx
29 | implementation Core.permission
30 |
31 | implementation Maps.rxLocation
32 | implementation Maps.gmsLocationService
33 |
34 | implementation Rx.rxJava
35 | implementation Rx.rxAndroid
36 |
37 | implementation project(Module.smartMarker)
38 | }
39 |
40 | apply from: '../../base.gradle'
--------------------------------------------------------------------------------
/extensions/location/consumer-rules.pro:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/extensions/location/consumer-rules.pro
--------------------------------------------------------------------------------
/extensions/location/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 |
--------------------------------------------------------------------------------
/extensions/location/src/androidTest/java/com/utsman/smartmarker/location/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.utsman.smartmarker.location
18 |
19 | import androidx.test.platform.app.InstrumentationRegistry
20 | import androidx.test.ext.junit.runners.AndroidJUnit4
21 |
22 | import org.junit.Test
23 | import org.junit.runner.RunWith
24 |
25 | import org.junit.Assert.*
26 |
27 | /**
28 | * Instrumented test, which will execute on an Android device.
29 | *
30 | * See [testing documentation](http://d.android.com/tools/testing).
31 | */
32 | @RunWith(AndroidJUnit4::class)
33 | class ExampleInstrumentedTest {
34 | @Test
35 | fun useAppContext() {
36 | // Context of the app under test.
37 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
38 | assertEquals("com.utsman.smartmarker.location.test", appContext.packageName)
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/extensions/location/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
19 |
--------------------------------------------------------------------------------
/extensions/location/src/main/java/com/utsman/smartmarker/location/LocationListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.utsman.smartmarker.location;
18 |
19 | import android.location.Location;
20 |
21 | public interface LocationListener {
22 | void location(Location location);
23 | }
24 |
--------------------------------------------------------------------------------
/extensions/location/src/main/java/com/utsman/smartmarker/location/LocationUpdateListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.utsman.smartmarker.location;
18 |
19 | import android.location.Location;
20 |
21 | public interface LocationUpdateListener {
22 | void oldLocation(Location oldLocation);
23 | void newLocation(Location newLocation);
24 | void failed(Throwable throwable);
25 | }
--------------------------------------------------------------------------------
/extensions/location/src/main/java/com/utsman/smartmarker/location/LocationWatcher.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.utsman.smartmarker.location;
18 |
19 | import android.Manifest;
20 | import android.app.Activity;
21 | import android.content.Context;
22 | import android.location.Location;
23 | import android.util.Log;
24 |
25 | import com.google.android.gms.location.LocationRequest;
26 | import com.karumi.dexter.Dexter;
27 | import com.karumi.dexter.PermissionToken;
28 | import com.karumi.dexter.listener.PermissionDeniedResponse;
29 | import com.karumi.dexter.listener.PermissionGrantedResponse;
30 | import com.karumi.dexter.listener.PermissionRequest;
31 | import com.karumi.dexter.listener.single.PermissionListener;
32 |
33 | import java.util.concurrent.TimeUnit;
34 |
35 | import io.reactivex.android.schedulers.AndroidSchedulers;
36 | import io.reactivex.disposables.CompositeDisposable;
37 | import io.reactivex.disposables.Disposable;
38 | import io.reactivex.functions.Consumer;
39 | import io.reactivex.schedulers.Schedulers;
40 | import pl.charmas.android.reactivelocation2.ReactiveLocationProvider;
41 |
42 | public class LocationWatcher {
43 |
44 | private Context context;
45 | private CompositeDisposable compositeDisposable;
46 |
47 | public static class Priority {
48 | public static long JEDI = 3;
49 | public static long VERY_HIGH = 30;
50 | public static long HIGH = 50;
51 | public static long MEDIUM = 300;
52 | public static long LOW = 3000;
53 | public static long VERY_LOW = 8000;
54 | }
55 |
56 | public LocationWatcher(Context context) {
57 | compositeDisposable = new CompositeDisposable();
58 | this.context = context;
59 | }
60 |
61 | public void stopLocationWatcher() {
62 | compositeDisposable.dispose();
63 | }
64 |
65 | public void getLocation(final Activity activity, final LocationListener locationListener) {
66 |
67 | Dexter.withActivity(activity)
68 | .withPermission(Manifest.permission.ACCESS_FINE_LOCATION)
69 | .withListener(new PermissionListener() {
70 | @Override
71 | public void onPermissionGranted(PermissionGrantedResponse response) {
72 | getLocation(locationListener);
73 | }
74 |
75 | @Override
76 | public void onPermissionDenied(PermissionDeniedResponse response) {
77 | activity.finish();
78 | }
79 |
80 | @Override
81 | public void onPermissionRationaleShouldBeShown(PermissionRequest permission, PermissionToken token) {
82 | token.continuePermissionRequest();
83 | }
84 | })
85 | .check();
86 | }
87 |
88 | public void getLocation(final LocationListener locationListener) {
89 | LocationRequest request = LocationRequest.create()
90 | .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY)
91 | .setNumUpdates(1)
92 | .setInterval(100);
93 |
94 | ReactiveLocationProvider locationProvider = new ReactiveLocationProvider(context);
95 | Disposable locationDisposable = locationProvider
96 | .getUpdatedLocation(request)
97 | .subscribeOn(Schedulers.io())
98 | .observeOn(AndroidSchedulers.mainThread())
99 | .subscribe(new Consumer() {
100 | @Override
101 | public void accept(Location location) throws Exception {
102 | locationListener.location(location);
103 | }
104 | }, new Consumer() {
105 | @Override
106 | public void accept(Throwable throwable) throws Exception {
107 | throwable.printStackTrace();
108 | Log.e("anjay", "cannot update location --> " + throwable.getMessage());
109 |
110 | }
111 | });
112 |
113 | compositeDisposable.add(locationDisposable);
114 | }
115 |
116 | public void getLocationUpdate(final Activity activity, final long priority, final LocationUpdateListener locationUpdateListener) {
117 | Dexter.withActivity(activity)
118 | .withPermission(Manifest.permission.ACCESS_FINE_LOCATION)
119 | .withListener(new PermissionListener() {
120 | @Override
121 | public void onPermissionGranted(PermissionGrantedResponse response) {
122 | getLocationUpdate(priority, locationUpdateListener);
123 | }
124 |
125 | @Override
126 | public void onPermissionDenied(PermissionDeniedResponse response) {
127 | activity.finish();
128 | }
129 |
130 | @Override
131 | public void onPermissionRationaleShouldBeShown(PermissionRequest permission, PermissionToken token) {
132 | token.continuePermissionRequest();
133 | }
134 | })
135 | .check();
136 | }
137 |
138 | public void getLocationUpdate(long priority, final LocationUpdateListener locationUpdateListener) {
139 | LocationRequest request = LocationRequest.create()
140 | .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY)
141 | .setInterval(100);
142 |
143 | ReactiveLocationProvider locationProvider = new ReactiveLocationProvider(context);
144 | Disposable locationDisposable = locationProvider
145 | .getUpdatedLocation(request)
146 | .subscribeOn(Schedulers.io())
147 | .doOnNext(new Consumer() {
148 | @Override
149 | public void accept(Location location) throws Exception {
150 | locationUpdateListener.oldLocation(location);
151 | }
152 | })
153 | .delay(priority, TimeUnit.MILLISECONDS)
154 | .observeOn(AndroidSchedulers.mainThread())
155 | .doOnNext(new Consumer() {
156 | @Override
157 | public void accept(Location location) throws Exception {
158 | locationUpdateListener.newLocation(location);
159 | }
160 | })
161 |
162 | .doOnError(new Consumer() {
163 | @Override
164 | public void accept(Throwable throwable) throws Exception {
165 | locationUpdateListener.failed(throwable);
166 | }
167 | })
168 | .subscribe();
169 |
170 | compositeDisposable.add(locationDisposable);
171 | }
172 | }
173 |
--------------------------------------------------------------------------------
/extensions/location/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 | Location
19 |
20 |
--------------------------------------------------------------------------------
/extensions/location/src/test/java/com/utsman/smartmarker/location/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.utsman.smartmarker.location
18 |
19 | import org.junit.Test
20 |
21 | import org.junit.Assert.*
22 |
23 | /**
24 | * Example local unit test, which will execute on the development machine (host).
25 | *
26 | * See [testing documentation](http://d.android.com/tools/testing).
27 | */
28 | class ExampleUnitTest {
29 | @Test
30 | fun addition_isCorrect() {
31 | assertEquals(4, 2 + 2)
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/extensions/mapbox/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/extensions/mapbox/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | apply plugin: 'com.android.library'
18 | apply plugin: 'kotlin-android'
19 | apply plugin: 'kotlin-android-extensions'
20 |
21 | ext {
22 | artifact = 'ext-mapbox'
23 | }
24 |
25 | dependencies {
26 | implementation Core.kotlin
27 | implementation Core.appCompat
28 | implementation Core.ktx
29 |
30 | api Maps.mapbox
31 | }
32 |
33 | apply from: '../../base.gradle'
34 |
--------------------------------------------------------------------------------
/extensions/mapbox/consumer-rules.pro:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/extensions/mapbox/consumer-rules.pro
--------------------------------------------------------------------------------
/extensions/mapbox/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 |
--------------------------------------------------------------------------------
/extensions/mapbox/src/androidTest/java/com/utsman/smartmarker/mapbox/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.utsman.smartmarker.mapbox
18 |
19 | import androidx.test.platform.app.InstrumentationRegistry
20 | import androidx.test.ext.junit.runners.AndroidJUnit4
21 |
22 | import org.junit.Test
23 | import org.junit.runner.RunWith
24 |
25 | import org.junit.Assert.*
26 |
27 | /**
28 | * Instrumented test, which will execute on an Android device.
29 | *
30 | * See [testing documentation](http://d.android.com/tools/testing).
31 | */
32 | @RunWith(AndroidJUnit4::class)
33 | class ExampleInstrumentedTest {
34 | @Test
35 | fun useAppContext() {
36 | // Context of the app under test.
37 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
38 | assertEquals("com.utsman.smartmarker.mapbox.test", appContext.packageName)
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/extensions/mapbox/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
19 |
--------------------------------------------------------------------------------
/extensions/mapbox/src/main/java/com/utsman/smartmarker/mapbox/Ext.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.utsman.smartmarker.mapbox
18 |
19 | import android.animation.TypeEvaluator
20 | import android.location.Location
21 | import android.util.Log
22 | import com.mapbox.mapboxsdk.geometry.LatLng
23 | import com.mapbox.mapboxsdk.maps.MapboxMap
24 | import com.mapbox.mapboxsdk.style.layers.SymbolLayer
25 |
26 | fun Location.toLatLngMapbox() = LatLng(latitude, longitude)
27 |
28 | val latLngEvaluator = object : TypeEvaluator {
29 | val latLng = LatLng()
30 |
31 | override fun evaluate(f: Float, startLatLng: LatLng, endLatlng: LatLng): LatLng {
32 | latLng.latitude = startLatLng.latitude + (endLatlng.latitude - startLatLng.latitude) * f
33 | latLng.longitude = startLatLng.longitude + (endLatlng.longitude - startLatLng.longitude) * f
34 | return latLng
35 | }
36 | }
37 |
38 | fun MapboxMap.addMarker(options: MarkerOptions): Marker {
39 | val markerBuilder = MarkerBuilder(options.context!!, style)
40 | val marker = markerBuilder.newMarker(options.id!!, options.latLng!!, options.icon!!, options.vector!!)
41 | options.symbolLayer?.invoke(marker)
42 | style?.addMarker(marker)
43 | Log.i("marker is ", "added, markerId -> ${options.id}")
44 |
45 | val jsonSource = markerBuilder.jsonSource
46 | val mark = Marker(options.latLng, this, jsonSource, marker, options.id)
47 | options.rotation?.let { rot ->
48 | mark.rotateMarker(rot)
49 | }
50 |
51 | val markerLayer = MarkerLayer(markerBuilder.symbolLayer.id, jsonSource.id)
52 |
53 | markerLayer.add(mark)
54 | return markerLayer.get(options.id)
55 | }
56 |
57 | class MarkerLayer(layerId: String, sourceId: String) : SymbolLayer(layerId, sourceId) {
58 | private val markers: MutableList = mutableListOf()
59 |
60 | fun add(marker: Marker) = apply { markers.add(marker) }
61 |
62 | fun get(id: String): Marker {
63 | return markers.single { id == it.getId() }
64 | }
65 | }
--------------------------------------------------------------------------------
/extensions/mapbox/src/main/java/com/utsman/smartmarker/mapbox/Marker.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.utsman.smartmarker.mapbox
18 |
19 | import android.animation.ObjectAnimator
20 | import android.animation.ValueAnimator
21 | import android.graphics.Color
22 | import android.os.Handler
23 | import android.os.SystemClock
24 | import android.util.Log
25 | import android.view.animation.LinearInterpolator
26 | import androidx.annotation.ColorInt
27 | import androidx.annotation.Nullable
28 | import androidx.lifecycle.MutableLiveData
29 | import com.mapbox.android.gestures.RotateGestureDetector
30 | import com.mapbox.geojson.Point
31 | import com.mapbox.mapboxsdk.geometry.LatLng
32 | import com.mapbox.mapboxsdk.maps.MapboxMap
33 | import com.mapbox.mapboxsdk.maps.Style
34 | import com.mapbox.mapboxsdk.style.layers.PropertyFactory
35 | import com.mapbox.mapboxsdk.style.layers.PropertyValue
36 | import com.mapbox.mapboxsdk.style.layers.SymbolLayer
37 | import com.mapbox.mapboxsdk.style.sources.GeoJsonSource
38 |
39 | class Marker(private var currentLatLng: LatLng,
40 | private val mapboxMap: MapboxMap,
41 | private val jsonSource: GeoJsonSource,
42 | private val symbolLayer: SymbolLayer,
43 | private val idMarker: String) {
44 |
45 | private val liveRotate = MutableLiveData()
46 | private var animator: ValueAnimator? = null
47 | private var heading = 0.0
48 | fun getId() = idMarker
49 | fun getRotation() = heading
50 |
51 | private val liveVisibility = MutableLiveData()
52 |
53 | init {
54 | liveRotate.postValue(0f)
55 | liveRotate.observeForever {
56 | symbolLayer.withProperties(PropertyFactory.iconRotate(it))
57 | }
58 |
59 | liveVisibility.observeForever {
60 | symbolLayer.withProperties(PropertyFactory.iconRotate(160f))
61 | }
62 | }
63 |
64 | internal fun rotateMarker(rotate: Double) {
65 | rotateMarker(symbolLayer, rotate.toFloat())
66 | }
67 |
68 | fun moveMarkerSmoothly(newLatLng: LatLng, @Nullable rotate: Boolean? = true) {
69 | if (animator != null && animator!!.isStarted) {
70 | currentLatLng = animator!!.animatedValue as LatLng
71 | animator!!.cancel()
72 | }
73 |
74 | animator = ObjectAnimator.ofObject(latLngEvaluator, currentLatLng, newLatLng).apply {
75 | duration = 2000
76 | addUpdateListener(animatorUpdateListener(jsonSource))
77 | }
78 |
79 | animator?.start()
80 |
81 | if (rotate != null && rotate) {
82 | mapboxMap.addOnRotateListener(object : MapboxMap.OnRotateListener {
83 | override fun onRotate(detector: RotateGestureDetector) {
84 |
85 | }
86 |
87 | override fun onRotateEnd(detector: RotateGestureDetector) {
88 |
89 | }
90 |
91 | override fun onRotateBegin(detector: RotateGestureDetector) {
92 |
93 | }
94 |
95 | })
96 |
97 | rotateMarker(symbolLayer, (getAngle(currentLatLng, newLatLng)).toFloat())
98 | }
99 | }
100 |
101 | fun getLatLng() = currentLatLng
102 |
103 | fun getSource() = jsonSource
104 |
105 | private fun animatorUpdateListener(jsonSource: GeoJsonSource) : ValueAnimator.AnimatorUpdateListener {
106 | return ValueAnimator.AnimatorUpdateListener { value ->
107 | val animatedLatLng = value.animatedValue as LatLng
108 | jsonSource.setGeoJson(Point.fromLngLat(animatedLatLng.longitude, animatedLatLng.latitude))
109 | }
110 | }
111 |
112 | private fun rotateMarker(symbolLayer: SymbolLayer?, toRotation: Float) {
113 | val handler = Handler()
114 | val start = SystemClock.uptimeMillis()
115 | var startRotation = symbolLayer?.iconRotate?.value ?: 90f
116 | val duration: Long = 200
117 |
118 | handler.post(object : Runnable {
119 | override fun run() {
120 | val elapsed = SystemClock.uptimeMillis() - start
121 | val t = LinearInterpolator().getInterpolation( elapsed.toFloat() / duration)
122 |
123 | try {
124 | val rot = t * toRotation + (1 - t) * startRotation
125 |
126 | val rotation = if (-rot > 180) rot / 2 else rot
127 | liveRotate.postValue(rotation)
128 | currentLatLng = animator!!.animatedValue as LatLng
129 | startRotation = rotation
130 | if (t < 1.0) {
131 | handler.postDelayed(this, 100)
132 | }
133 | } catch (e: IllegalStateException) {
134 | Log.e("smartmarker-mapbox", "set rotation failed")
135 | }
136 |
137 | }
138 | })
139 | }
140 |
141 | private fun getAngle(fromLatLng: LatLng, toLatLng: LatLng) : Double {
142 | if (fromLatLng != toLatLng) {
143 | val mapRot = mapboxMap.cameraPosition.bearing
144 |
145 | heading = MathUtil.computeHeading(fromLatLng, toLatLng, mapRot)
146 |
147 | logi("angle is --> $heading -- $mapRot")
148 | }
149 |
150 | return heading
151 | }
152 |
153 | private fun logi(msg: String?) = Log.i("anjay", msg)
154 | }
155 |
--------------------------------------------------------------------------------
/extensions/mapbox/src/main/java/com/utsman/smartmarker/mapbox/MarkerBuilder.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.utsman.smartmarker.mapbox
18 |
19 | import android.content.Context
20 | import android.graphics.Bitmap
21 | import android.graphics.BitmapFactory
22 | import android.os.Handler
23 | import android.util.Log
24 | import androidx.annotation.DrawableRes
25 | import androidx.core.content.res.ResourcesCompat
26 | import com.mapbox.geojson.Feature
27 | import com.mapbox.geojson.Point
28 | import com.mapbox.mapboxsdk.geometry.LatLng
29 | import com.mapbox.mapboxsdk.maps.Style
30 | import com.mapbox.mapboxsdk.style.layers.PropertyFactory
31 | import com.mapbox.mapboxsdk.style.layers.SymbolLayer
32 | import com.mapbox.mapboxsdk.style.sources.GeoJsonSource
33 | import com.mapbox.mapboxsdk.utils.BitmapUtils
34 |
35 | class MarkerBuilder(private val context: Context, private val style: Style?) {
36 |
37 | lateinit var jsonSource: GeoJsonSource
38 | lateinit var symbolLayer: SymbolLayer
39 |
40 | private fun newSymbol(id: String): SymbolLayer {
41 | return SymbolLayer(id, "source-$id")
42 | }
43 |
44 | internal fun newMarker(id: String, latLng: LatLng, @DrawableRes iconVector: Int, vector: Boolean = false): SymbolLayer {
45 | symbolLayer = newSymbol(id)
46 |
47 | jsonSource = GeoJsonSource(
48 | "source-$id",
49 | Feature.fromGeometry(Point.fromLngLat(latLng.longitude, latLng.latitude))
50 | )
51 |
52 | if (vector) {
53 | style?.addImage("marker-$id", markerVector(context, iconVector))
54 | } else {
55 | val markerBitmap =
56 | BitmapFactory.decodeResource(context.resources, iconVector)
57 | try {
58 | style?.addImage("marker-$id", markerBitmap)
59 | } catch (e: NullPointerException) {
60 | Log.e("SmartMarker-mapbox", "Cannot process bitmap, maybe your marker is vector, please add 'true' in 'addIcon'")
61 | }
62 | }
63 |
64 |
65 | style?.addSource(jsonSource)
66 |
67 | symbolLayer.withProperties(
68 | PropertyFactory.iconImage("marker-$id"),
69 | PropertyFactory.iconIgnorePlacement(true),
70 | PropertyFactory.iconAllowOverlap(true)
71 | )
72 |
73 | Log.i("symbol layer id is --> ", id)
74 | return symbolLayer
75 | }
76 | }
77 |
78 | internal fun Style.addMarker(symbolLayer: SymbolLayer) {
79 | addLayer(symbolLayer)
80 | }
81 |
82 | internal fun markerVector(context: Context, @DrawableRes marker: Int): Bitmap {
83 | val drawable = ResourcesCompat.getDrawable(context.resources,
84 | marker, null)
85 | return BitmapUtils.getBitmapFromDrawable(drawable) ?: BitmapFactory.decodeResource(context.resources,
86 | R.drawable.mapbox_marker_icon_default
87 | )
88 | }
--------------------------------------------------------------------------------
/extensions/mapbox/src/main/java/com/utsman/smartmarker/mapbox/MarkerOptions.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.utsman.smartmarker.mapbox
18 |
19 | import android.content.Context
20 | import com.mapbox.mapboxsdk.geometry.LatLng
21 | import com.mapbox.mapboxsdk.maps.Style
22 | import com.mapbox.mapboxsdk.style.layers.SymbolLayer
23 |
24 | class MarkerOptions private constructor(
25 | internal val context: Context?,
26 | internal val id: String?,
27 | internal val icon: Int?,
28 | internal val vector: Boolean?,
29 | internal val latLng: LatLng?,
30 | internal val rotation: Double?,
31 | internal val symbolLayer: ((SymbolLayer) -> Unit)?) {
32 |
33 | data class Builder(
34 | private var context: Context? = null,
35 | private var id: String? = null,
36 | private var requestUniqueId: Boolean? = false,
37 | private var icon: Int = R.drawable.mapbox_marker_icon_default,
38 | private var vector: Boolean? = false,
39 | private var latLng: LatLng? = null,
40 | private var rotation: Double? = null,
41 | private var symbolLayer: ((SymbolLayer) -> Unit)? = null
42 | ) {
43 |
44 | fun setId(id: String, requestUniqueId: Boolean = false) = apply {
45 | if (requestUniqueId) {
46 | this.id = "${id}_${System.currentTimeMillis()}"
47 | } else {
48 | this.id = id
49 | }
50 | }
51 |
52 | fun setIcon(icon: Int, vector: Boolean? = false) = apply {
53 | this.icon = icon
54 | this.vector = vector
55 | }
56 | fun setPosition(latLng: LatLng) = apply { this.latLng = latLng }
57 | fun setRotation(rotation: Double?) = apply { this.rotation = rotation }
58 | fun withSymbolLayer(symbolLayer: ((SymbolLayer) -> Unit)) = apply { this.symbolLayer = symbolLayer }
59 | fun build(context: Context) = MarkerOptions(context, id, icon, vector, latLng, rotation, symbolLayer)
60 | }
61 |
62 | internal lateinit var markerSymbol: SymbolLayer
63 | internal var style: Style? = null
64 | /*internal fun addMarkerSymbol(style: Style?, markerSymbol: SymbolLayer) {
65 | this.style = style
66 | this.markerSymbol = markerSymbol
67 | }*/
68 |
69 | internal var remo: (() -> Unit?)? = null
70 | internal fun remove(remove : () -> Unit) {
71 | remo = remove
72 | }
73 |
74 | fun removeMe() = apply {
75 | remo?.invoke()
76 | }
77 | }
78 |
79 |
--------------------------------------------------------------------------------
/extensions/mapbox/src/main/java/com/utsman/smartmarker/mapbox/MathUtil.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.utsman.smartmarker.mapbox
18 |
19 | import com.mapbox.mapboxsdk.geometry.LatLng
20 | import kotlin.math.atan2
21 | import kotlin.math.cos
22 | import kotlin.math.sin
23 |
24 | object MathUtil {
25 | fun computeHeading(from: LatLng, to: LatLng, fromN: Double): Double {
26 | val fromLat = Math.toRadians(from.latitude)
27 | val fromLng = Math.toRadians(from.longitude)
28 | val toLat = Math.toRadians(to.latitude)
29 | val toLng = Math.toRadians(to.longitude)
30 | val dLng = toLng - fromLng
31 | val heading = atan2(
32 | sin(dLng) * cos(toLat),
33 | cos(fromLat) * sin(toLat) - sin(fromLat) * cos(toLat) * cos(dLng)
34 | )
35 | return wrap(Math.toDegrees(heading) - fromN, -180.0, 180.0)
36 | }
37 |
38 | private fun wrap(n: Double, min: Double, max: Double): Double {
39 | return if (n >= min && n < max) n else mod(
40 | n - min,
41 | max - min
42 | ) + min
43 | }
44 |
45 | private fun mod(x: Double, m: Double): Double {
46 | return (x % m + m) % m
47 | }
48 | }
--------------------------------------------------------------------------------
/extensions/mapbox/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 | Mapbox
19 |
20 |
--------------------------------------------------------------------------------
/extensions/mapbox/src/test/java/com/utsman/smartmarker/mapbox/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.utsman.smartmarker.mapbox
18 |
19 | import org.junit.Test
20 |
21 | import org.junit.Assert.*
22 |
23 | /**
24 | * Example local unit test, which will execute on the development machine (host).
25 | *
26 | * See [testing documentation](http://d.android.com/tools/testing).
27 | */
28 | class ExampleUnitTest {
29 | @Test
30 | fun addition_isCorrect() {
31 | assertEquals(4, 2 + 2)
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2019 Muhammad Utsman
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | #
16 |
17 | # Project-wide Gradle settings.
18 | # IDE (e.g. Android Studio) users:
19 | # Gradle settings configured through the IDE *will override*
20 | # any settings specified in this file.
21 | # For more details on how to configure your build environment visit
22 | # http://www.gradle.org/docs/current/userguide/build_environment.html
23 | # Specifies the JVM arguments used for the daemon process.
24 | # The setting is particularly useful for tweaking memory settings.
25 | org.gradle.jvmargs=-Xmx1536m
26 | # When configured, Gradle will run in incubating parallel mode.
27 | # This option should only be used with decoupled projects. More details, visit
28 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
29 | # org.gradle.parallel=true
30 | # AndroidX package structure to make it clearer which packages are bundled with the
31 | # Android operating system, and which are packaged with your app's APK
32 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
33 | android.useAndroidX=true
34 | # Automatically convert third-party libraries to use AndroidX
35 | android.enableJetifier=true
36 | # Kotlin code style for this project: "official" or "obsolete":
37 | kotlin.code.style=official
38 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2019 Muhammad Utsman
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | #
16 |
17 | #Fri Nov 01 12:33:58 WIB 2019
18 | distributionBase=GRADLE_USER_HOME
19 | distributionPath=wrapper/dists
20 | zipStoreBase=GRADLE_USER_HOME
21 | zipStorePath=wrapper/dists
22 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
23 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | include ':app', ':extensions:googlemaps', ':smartmarker', ':extensions:location', ':extensions:mapbox'
18 | rootProject.name='SmartMarker'
19 |
--------------------------------------------------------------------------------
/smartmarker/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/smartmarker/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | apply plugin: 'com.android.library'
18 | apply plugin: 'kotlin-android'
19 | apply plugin: 'kotlin-android-extensions'
20 |
21 | ext {
22 | artifact = 'core'
23 | }
24 |
25 | dependencies {
26 | implementation Core.kotlin
27 | implementation Core.appCompat
28 | implementation Core.ktx
29 |
30 | implementation project(Module.extGoogleMaps)
31 | implementation project(Module.extMapbox)
32 | }
33 |
34 | apply from: '../base.gradle'
--------------------------------------------------------------------------------
/smartmarker/consumer-rules.pro:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/utsmannn/SmartMarker/78b433e5df19488ee0fe7ce8e154886ed7ca6a6e/smartmarker/consumer-rules.pro
--------------------------------------------------------------------------------
/smartmarker/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 |
--------------------------------------------------------------------------------
/smartmarker/src/androidTest/java/com/utsman/smartmarker/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.utsman.smartmarker
18 |
19 | import androidx.test.platform.app.InstrumentationRegistry
20 | import androidx.test.ext.junit.runners.AndroidJUnit4
21 |
22 | import org.junit.Test
23 | import org.junit.runner.RunWith
24 |
25 | import org.junit.Assert.*
26 |
27 | /**
28 | * Instrumented test, which will execute on an Android device.
29 | *
30 | * See [testing documentation](http://d.android.com/tools/testing).
31 | */
32 | @RunWith(AndroidJUnit4::class)
33 | class ExampleInstrumentedTest {
34 | @Test
35 | fun useAppContext() {
36 | // Context of the app under test.
37 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
38 | assertEquals("com.utsman.smartmarker.test", appContext.packageName)
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/smartmarker/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
19 |
--------------------------------------------------------------------------------
/smartmarker/src/main/java/com/utsman/smartmarker/Ext.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.utsman.smartmarker
18 |
19 | import com.google.android.gms.maps.model.LatLng
20 | import com.google.android.gms.maps.model.Marker
21 |
22 | fun Marker.moveMarkerSmoothly(newLatLng: LatLng, rotate: Boolean? = true) {
23 | SmartMarker.moveMarkerSmoothly(this, newLatLng, rotate)
24 | }
--------------------------------------------------------------------------------
/smartmarker/src/main/java/com/utsman/smartmarker/MathUtil.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.utsman.smartmarker;
18 |
19 | public class MathUtil {
20 |
21 | public static double computeHeading(SmartLatLon from, SmartLatLon to) {
22 | double fromLat = Math.toRadians(from.getLatitude());
23 | double fromLng = Math.toRadians(from.getLongitude());
24 | double toLat = Math.toRadians(to.getLatitude());
25 | double toLng = Math.toRadians(to.getLongitude());
26 | double dLng = toLng - fromLng;
27 | double heading = Math.atan2(Math.sin(dLng) * Math.cos(toLat), Math.cos(fromLat) * Math.sin(toLat) - Math.sin(fromLat) * Math.cos(toLat) * Math.cos(dLng));
28 | return MathUtil.wrap(Math.toDegrees(heading));
29 | }
30 |
31 | private static double wrap(double n) {
32 | double min = -180.0D;
33 | double max = 180.0D;
34 | return n >= min && n < max ? n : mod(n - -180.0D, max - min) + min;
35 | }
36 |
37 | private static double mod(double x, double m) {
38 | return (x % m + m) % m;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/smartmarker/src/main/java/com/utsman/smartmarker/SmartLatLon.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.utsman.smartmarker;
18 |
19 | public class SmartLatLon {
20 | private Double latitude;
21 | private Double longitude;
22 |
23 | public SmartLatLon(Double latitude, Double longitude) {
24 | this.latitude = latitude;
25 | this.longitude = longitude;
26 | }
27 |
28 | public Double getLatitude() {
29 | return latitude;
30 | }
31 |
32 | public void setLatitude(Double latitude) {
33 | this.latitude = latitude;
34 | }
35 |
36 | public Double getLongitude() {
37 | return longitude;
38 | }
39 |
40 | public void setLongitude(Double longitude) {
41 | this.longitude = longitude;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/smartmarker/src/main/java/com/utsman/smartmarker/SmartMarker.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.utsman.smartmarker;
18 |
19 | import android.animation.ValueAnimator;
20 |
21 | import androidx.annotation.Nullable;
22 |
23 | import com.google.android.gms.maps.model.LatLng;
24 | import com.google.android.gms.maps.model.Marker;
25 | import com.utsman.smartmarker.googlemaps.ExtKt;
26 |
27 | public class SmartMarker {
28 | public static void moveMarkerSmoothly(final Marker marker, LatLng newLatLng, @Nullable Boolean rotate) {
29 | ValueAnimator animator = ExtKt.moveMarkerSmoothly(marker, newLatLng);
30 |
31 | animator.start();
32 | float f = (float) SmartUtil.getAngle(new SmartLatLon(marker.getPosition().latitude, marker.getPosition().longitude), new SmartLatLon(newLatLng.latitude, newLatLng.longitude));
33 | ExtKt.rotateMarker(marker, f, rotate);
34 | }
35 |
36 | public static void moveMarkerSmoothly(com.utsman.smartmarker.mapbox.Marker marker, com.mapbox.mapboxsdk.geometry.LatLng newLatLng, @Nullable Boolean rotate) {
37 | marker.moveMarkerSmoothly(newLatLng, rotate);
38 | }
39 |
40 | public static void moveMarkerSmoothly(final Marker marker, LatLng newLatLng) {
41 | ValueAnimator animator = ExtKt.moveMarkerSmoothly(marker, newLatLng);
42 |
43 | animator.start();
44 | float f = (float) SmartUtil.getAngle(new SmartLatLon(marker.getPosition().latitude, marker.getPosition().longitude), new SmartLatLon(newLatLng.latitude, newLatLng.longitude));
45 | ExtKt.rotateMarker(marker, f, true);
46 | }
47 |
48 | public static void moveMarkerSmoothly(com.utsman.smartmarker.mapbox.Marker marker, com.mapbox.mapboxsdk.geometry.LatLng newLatLng) {
49 | marker.moveMarkerSmoothly(newLatLng, true);
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/smartmarker/src/main/java/com/utsman/smartmarker/SmartUtil.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.utsman.smartmarker;
18 |
19 | public class SmartUtil {
20 |
21 | public static double getAngle(SmartLatLon fromSmartLatLon, SmartLatLon toSmartLatLon) {
22 | double heading = 0.0;
23 | if (fromSmartLatLon != toSmartLatLon) {
24 | heading = MathUtil.computeHeading(fromSmartLatLon, toSmartLatLon);
25 | }
26 |
27 | return heading;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/smartmarker/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 | Smart Marker
19 |
20 |
--------------------------------------------------------------------------------
/smartmarker/src/test/java/com/utsman/smartmarker/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Muhammad Utsman
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.utsman.smartmarker
18 |
19 | import org.junit.Test
20 |
21 | import org.junit.Assert.*
22 |
23 | /**
24 | * Example local unit test, which will execute on the development machine (host).
25 | *
26 | * See [testing documentation](http://d.android.com/tools/testing).
27 | */
28 | class ExampleUnitTest {
29 | @Test
30 | fun addition_isCorrect() {
31 | assertEquals(4, 2 + 2)
32 | }
33 | }
34 |
--------------------------------------------------------------------------------