Skip to content

Commit

Permalink
* fix follow location for vector map #544
Browse files Browse the repository at this point in the history
* fix some gradle issue
  • Loading branch information
liodali committed Nov 24, 2024
1 parent 538577b commit abc2c02
Show file tree
Hide file tree
Showing 23 changed files with 404 additions and 330 deletions.
73 changes: 38 additions & 35 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,73 +1,80 @@
group 'hamza.dali.flutter_osm_plugin'
version '1.0'
group = "hamza.dali.flutter_osm_plugin"
version = "1.0-SNAPSHOT"

buildscript {
ext.kotlin_version = '1.9.23'
ext.kotlin_version = "1.9.24"
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" }
}

dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.android.tools.build:gradle:7.1.3'
classpath("com.android.tools.build:gradle:8.1.4")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
}
}

rootProject.allprojects {
allprojects {
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" }
}
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
//apply plugin: 'kotlin-kapt'
apply plugin: "com.android.library"
apply plugin: "kotlin-android"

android {
compileSdk 34
namespace "hamza.dali.flutter_osm_plugin"
if (project.android.hasProperty("namespace")) {
namespace = "hamza.dali.flutter_osm_plugin"
}

compileSdk = 34

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

defaultConfig {
minSdkVersion 20
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {
// disable 'InvalidPackage'
minSdk = 23
}
buildFeatures {
viewBinding true
}
compileOptions {
coreLibraryDesugaringEnabled true
// Sets Java compatibility to Java 8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
packagingOptions {
pickFirst 'lib/x86/libc++_shared.so'
pickFirst 'lib/x86_64/libc++_shared.so'
pickFirst 'lib/armeabi-v7a/libc++_shared.so'
pickFirst 'lib/arm64-v8a/libc++_shared.so'
}

testOptions {
unitTests.all {
useJUnitPlatform()

testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
outputs.upToDateWhen {false}
showStandardStreams = true
}
}
}
}
dependencies {

def coroutines_version ="1.9.0"

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

//implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

// Retrofit and relevant converters
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
Expand All @@ -91,9 +98,5 @@ dependencies {
implementation 'org.maplibre.gl:android-sdk:11.5.2'
implementation 'org.maplibre.gl:android-plugin-annotation-v9:3.0.1'

coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.2'

implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.29'

coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.3'
}

4 changes: 0 additions & 4 deletions android/gradle.properties

This file was deleted.

5 changes: 0 additions & 5 deletions android/gradle/wrapper/gradle-wrapper.properties

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,30 @@ import java.util.LinkedList
import kotlin.lazy

typealias OnChangedLocation = (userLocation: GeoPoint, heading: Double) -> Unit
enum class LocationMode {
LocationOnly,
UserPositionOnly,
GPSOnly,
GPSBearing,
NONE,
}
fun Enum<LocationMode>.isFollowing()= this == LocationMode.GPSBearing || this == LocationMode.GPSOnly

interface CustomLocationManager : IMyLocationConsumer {
val context: Context
val provider: GpsMyLocationProvider
var currentLocation: Location?
var mGeoPoint: GeoPoint?
var mIsFollowing: Boolean
var controlMapFromOutSide: Boolean
var enableAutoStop: Boolean
var mIsLocationEnabled: Boolean
fun setMarkerIcon(personIcon: Bitmap?, directionIcon: Bitmap?)
var useDirectionMarker: Boolean

fun startLocationUpdating()
fun stopLocationUpdating()
fun enableMyLocation()
fun onStopLocation()
fun toggleFollow(enableStop: Boolean)
fun configurationFollow(enableStop: Boolean?,useDirectionIcon: Boolean? )
fun toggleFollow()
fun disableFollowLocation()
fun sendLocation()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ abstract class CustomOSMLocationManager(

) : Overlay(), Snappable, CustomLocationManager {

abstract var mIsFollowing: Boolean
abstract var controlMapFromOutSide: Boolean
abstract val onMove: (IGeoPoint) -> Unit
abstract val onUpdate: () -> Unit
override val provider: GpsMyLocationProvider by lazy {
Expand Down Expand Up @@ -70,14 +72,14 @@ class OSMLocationManager(

private var mDirectionArrowCenterX = 0f
private var mDirectionArrowCenterY = 0f
var disableRotateDirection = false
var disableRotateDirection = false
override var enableAutoStop = true

override var mIsFollowing: Boolean = false


override var mIsLocationEnabled: Boolean = false
var useDirectionMarker = false
override var useDirectionMarker = false
override var currentLocation: Location? = null

override var mGeoPoint: GeoPoint? = GeoPoint(0.0, 0.0)
Expand Down Expand Up @@ -165,6 +167,8 @@ class OSMLocationManager(
mHandler.removeCallbacksAndMessages(mHandlerToken)
}



private fun disableMyLocation() {
mIsLocationEnabled = false
stopLocationProvider()
Expand Down Expand Up @@ -251,9 +255,18 @@ class OSMLocationManager(
}, mHandlerToken, 0)
}
}

override fun toggleFollow(enableStop: Boolean) {
enableAutoStop = enableStop
override fun configurationFollow(
enableStop: Boolean?,
useDirectionIcon: Boolean?
) {
if(enableStop!= null){
this.enableAutoStop = enableStop
}
if(useDirectionIcon!= null){
this.useDirectionMarker = useDirectionIcon
}
}
override fun toggleFollow() {
enableFollowLocation()
}

Expand Down Expand Up @@ -312,7 +325,7 @@ class OSMLocationManager(
}
}

override fun setMarkerIcon(personIcon: Bitmap?, directionIcon: Bitmap?) {
fun setMarkerIcon(personIcon: Bitmap?, directionIcon: Bitmap?) {

when {
personIcon != null && directionIcon != null -> {
Expand Down
Loading

0 comments on commit abc2c02

Please sign in to comment.