diff --git a/android/src/main/kotlin/com/github/josxha/maplibre/MapLibrePlugin.kt b/android/src/main/kotlin/com/github/josxha/maplibre/MapLibrePlugin.kt index 66da188a..8528402f 100644 --- a/android/src/main/kotlin/com/github/josxha/maplibre/MapLibrePlugin.kt +++ b/android/src/main/kotlin/com/github/josxha/maplibre/MapLibrePlugin.kt @@ -22,6 +22,7 @@ class MapLibrePlugin : FlutterPlugin, ActivityAware { private lateinit var flutterAssets: FlutterPlugin.FlutterAssets override fun onAttachedToEngine(binding: FlutterPlugin.FlutterPluginBinding) { + MapLibreRegistry.context = binding.applicationContext; flutterAssets = binding.flutterAssets binding .platformViewRegistry diff --git a/android/src/main/kotlin/com/github/josxha/maplibre/MapLibreRegistry.kt b/android/src/main/kotlin/com/github/josxha/maplibre/MapLibreRegistry.kt index 3a28e753..8953767a 100644 --- a/android/src/main/kotlin/com/github/josxha/maplibre/MapLibreRegistry.kt +++ b/android/src/main/kotlin/com/github/josxha/maplibre/MapLibreRegistry.kt @@ -1,9 +1,13 @@ package com.github.josxha.maplibre +import android.annotation.SuppressLint +import android.app.Activity +import android.content.Context import androidx.annotation.Keep import org.maplibre.android.maps.MapLibreMap @Keep +@SuppressLint("StaticFieldLeak") object MapLibreRegistry { private val mapRegistry = HashMap() @@ -14,4 +18,10 @@ object MapLibreRegistry { fun addMap(viewId: Int, map: MapLibreMap) { mapRegistry[viewId] = map } + + // TODO: Storing the Activity in a static field is a potential memory leak. + public var activity: Activity? = null; + + // TODO: Storing the Context in a static field is a potential memory leak. + public var context: Context? = null; } diff --git a/example/lib/main.dart b/example/lib/main.dart index 8f95c4a7..16a1073c 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -21,6 +21,7 @@ import 'package:maplibre_example/menu_page.dart'; import 'package:maplibre_example/parameters_page.dart'; import 'package:maplibre_example/styled_map_page.dart'; import 'package:maplibre_example/two_maps_page.dart'; +import 'package:maplibre_example/user_location_page.dart'; import 'package:maplibre_example/web_controls_page.dart'; void main() { @@ -47,6 +48,7 @@ class MyApp extends StatelessWidget { GesturesPage.location: (context) => const GesturesPage(), EventsPage.location: (context) => const EventsPage(), StyledMapPage.location: (context) => const StyledMapPage(), + UserLocationPage.location: (context) => const UserLocationPage(), LayersSymbolPage.location: (context) => const LayersSymbolPage(), LayersCirclePage.location: (context) => const LayersCirclePage(), LayersHeatmapPage.location: (context) => const LayersHeatmapPage(), diff --git a/example/lib/menu_page.dart b/example/lib/menu_page.dart index fff720cc..01a3c574 100644 --- a/example/lib/menu_page.dart +++ b/example/lib/menu_page.dart @@ -20,6 +20,7 @@ import 'package:maplibre_example/layers_symbol_page.dart'; import 'package:maplibre_example/parameters_page.dart'; import 'package:maplibre_example/styled_map_page.dart'; import 'package:maplibre_example/two_maps_page.dart'; +import 'package:maplibre_example/user_location_page.dart'; import 'package:maplibre_example/web_controls_page.dart'; class MenuPage extends StatelessWidget { @@ -79,6 +80,12 @@ class MenuPage extends StatelessWidget { iconData: Icons.animation, location: AnimationPage.location, ), + if (!kIsWeb) + ItemCard( + label: 'User Location', + iconData: Icons.gps_fixed, + location: UserLocationPage.location, + ), ], ), const SliverToBoxAdapter(child: SectionTitle('Annotations')), diff --git a/example/lib/user_location_page.dart b/example/lib/user_location_page.dart new file mode 100644 index 00000000..3849ee50 --- /dev/null +++ b/example/lib/user_location_page.dart @@ -0,0 +1,76 @@ +import 'package:flutter/material.dart'; +import 'package:maplibre/maplibre.dart'; +import 'package:maplibre_example/styled_map_page.dart'; +import 'package:permission_handler/permission_handler.dart'; + +@immutable +class UserLocationPage extends StatefulWidget { + const UserLocationPage({super.key}); + + static const location = '/user-location'; + + @override + State createState() => _UserLocationPageState(); +} + +class _UserLocationPageState extends State { + late final MapController _controller; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: const Text('User Location')), + body: Column( + children: [ + Padding( + padding: const EdgeInsets.all(8), + child: Wrap( + spacing: 8, + alignment: WrapAlignment.center, + children: [ + OutlinedButton( + onPressed: () async { + final status = await Permission.locationWhenInUse.request(); + debugPrint(status.toString()); + }, + child: const Text( + 'Get permission', + textAlign: TextAlign.center, + ), + ), + OutlinedButton( + onPressed: () async { + await _controller.enableLocation(); + }, + child: const Text( + 'Enable location', + textAlign: TextAlign.center, + ), + ), + OutlinedButton( + onPressed: () async { + await _controller.trackLocation(); + }, + child: const Text( + 'Track location', + textAlign: TextAlign.center, + ), + ), + ], + ), + ), + Expanded( + child: MapLibreMap( + options: MapOptions( + zoom: 1, + center: Position(0, 0), + style: StyledMapPage.styleUrl, + ), + onMapCreated: (controller) => _controller = controller, + ), + ), + ], + ), + ); + } +} diff --git a/example/pubspec.yaml b/example/pubspec.yaml index d261b485..0f89dbb8 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -16,6 +16,7 @@ dependencies: http: ^1.2.2 maplibre: path: ../ + permission_handler: ^11.3.1 dev_dependencies: flutter_test: diff --git a/example/windows/flutter/generated_plugin_registrant.cc b/example/windows/flutter/generated_plugin_registrant.cc index 605147dd..fcfeeaf3 100644 --- a/example/windows/flutter/generated_plugin_registrant.cc +++ b/example/windows/flutter/generated_plugin_registrant.cc @@ -7,8 +7,11 @@ #include "generated_plugin_registrant.h" #include +#include void RegisterPlugins(flutter::PluginRegistry* registry) { MaplibrePluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("MaplibrePluginCApi")); + PermissionHandlerWindowsPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin")); } diff --git a/example/windows/flutter/generated_plugins.cmake b/example/windows/flutter/generated_plugins.cmake index f09dfb26..7d9daca9 100644 --- a/example/windows/flutter/generated_plugins.cmake +++ b/example/windows/flutter/generated_plugins.cmake @@ -4,6 +4,7 @@ list(APPEND FLUTTER_PLUGIN_LIST maplibre + permission_handler_windows ) list(APPEND FLUTTER_FFI_PLUGIN_LIST diff --git a/jnigen.yml b/jnigen.yml index e62ecb37..a803ecf2 100644 --- a/jnigen.yml +++ b/jnigen.yml @@ -24,8 +24,8 @@ source_path: - 'android/src/main' classes: # https://github.com/maplibre/maplibre-native/tree/main/platform/android/MapLibreAndroid/src/main/java/org/maplibre/android - - 'android.app.Activity' - 'android.graphics.PointF' + - 'android.location.Location' - 'com.github.josxha.maplibre.MapLibreRegistry' - 'org.maplibre.android.attribution' - 'org.maplibre.android.camera' diff --git a/lib/src/jni/android/app/Activity.dart b/lib/src/jni/android/app/Activity.dart index cc50282b..5533b839 100644 --- a/lib/src/jni/android/app/Activity.dart +++ b/lib/src/jni/android/app/Activity.dart @@ -350,62 +350,6 @@ class Activity extends _$jni.JObject { .check(); } - static final _id_getCaller = _class.instanceMethodId( - r'getCaller', - r'()Landroid/app/ComponentCaller;', - ); - - static final _getCaller = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - )>>('globalEnv_CallObjectMethod') - .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - )>(); - - /// from: `public android.app.ComponentCaller getCaller()` - /// The returned object must be released after use, by calling the [release] method. - _$jni.JObject getCaller() { - return _getCaller(reference.pointer, _id_getCaller as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); - } - - static final _id_setIntent$1 = _class.instanceMethodId( - r'setIntent', - r'(Landroid/content/Intent;Landroid/app/ComponentCaller;)V', - ); - - static final _setIntent$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< - ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> - )>)>>('globalEnv_CallVoidMethod') - .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); - - /// from: `public void setIntent(android.content.Intent intent, android.app.ComponentCaller componentCaller)` - void setIntent$1( - _$jni.JObject intent, - _$jni.JObject componentCaller, - ) { - _setIntent$1(reference.pointer, _id_setIntent$1 as _$jni.JMethodIDPtr, - intent.reference.pointer, componentCaller.reference.pointer) - .check(); - } - static final _id_setLocusContext = _class.instanceMethodId( r'setLocusContext', r'(Landroid/content/LocusId;Landroid/os/Bundle;)V', @@ -1097,38 +1041,6 @@ class Activity extends _$jni.JObject { .check(); } - static final _id_onNewIntent = _class.instanceMethodId( - r'onNewIntent', - r'(Landroid/content/Intent;Landroid/app/ComponentCaller;)V', - ); - - static final _onNewIntent = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< - ( - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> - )>)>>('globalEnv_CallVoidMethod') - .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); - - /// from: `public void onNewIntent(android.content.Intent intent, android.app.ComponentCaller componentCaller)` - void onNewIntent( - _$jni.JObject intent, - _$jni.JObject componentCaller, - ) { - _onNewIntent(reference.pointer, _id_onNewIntent as _$jni.JMethodIDPtr, - intent.reference.pointer, componentCaller.reference.pointer) - .check(); - } - static final _id_onSaveInstanceState = _class.instanceMethodId( r'onSaveInstanceState', r'(Landroid/os/Bundle;Landroid/os/PersistableBundle;)V', @@ -4298,41 +4210,6 @@ class Activity extends _$jni.JObject { .check(); } - static final _id_requestPermissions$1 = _class.instanceMethodId( - r'requestPermissions', - r'([Ljava/lang/String;II)V', - ); - - static final _requestPermissions$1 = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< - ( - _$jni.Pointer<_$jni.Void>, - _$jni.Int32, - _$jni.Int32 - )>)>>('globalEnv_CallVoidMethod') - .asFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>, int, int)>(); - - /// from: `public final void requestPermissions(java.lang.String[] strings, int i, int i1)` - void requestPermissions$1( - _$jni.JArray<_$jni.JString> strings, - int i, - int i1, - ) { - _requestPermissions$1( - reference.pointer, - _id_requestPermissions$1 as _$jni.JMethodIDPtr, - strings.reference.pointer, - i, - i1) - .check(); - } - static final _id_onRequestPermissionsResult = _class.instanceMethodId( r'onRequestPermissionsResult', r'(I[Ljava/lang/String;[I)V', @@ -4373,50 +4250,6 @@ class Activity extends _$jni.JObject { .check(); } - static final _id_onRequestPermissionsResult$1 = _class.instanceMethodId( - r'onRequestPermissionsResult', - r'(I[Ljava/lang/String;[II)V', - ); - - static final _onRequestPermissionsResult$1 = - _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< - ( - _$jni.Int32, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - _$jni.Int32 - )>)>>('globalEnv_CallVoidMethod') - .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - int, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>, - int)>(); - - /// from: `public void onRequestPermissionsResult(int i, java.lang.String[] strings, int[] is, int i1)` - void onRequestPermissionsResult$1( - int i, - _$jni.JArray<_$jni.JString> strings, - _$jni.JArray<_$jni.jint> is$, - int i1, - ) { - _onRequestPermissionsResult$1( - reference.pointer, - _id_onRequestPermissionsResult$1 as _$jni.JMethodIDPtr, - i, - strings.reference.pointer, - is$.reference.pointer, - i1) - .check(); - } - static final _id_shouldShowRequestPermissionRationale = _class.instanceMethodId( r'shouldShowRequestPermissionRationale', @@ -4446,40 +4279,6 @@ class Activity extends _$jni.JObject { .boolean; } - static final _id_shouldShowRequestPermissionRationale$1 = - _class.instanceMethodId( - r'shouldShowRequestPermissionRationale', - r'(Ljava/lang/String;I)Z', - ); - - static final _shouldShowRequestPermissionRationale$1 = - _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< - ( - _$jni.Pointer<_$jni.Void>, - _$jni.Int32 - )>)>>('globalEnv_CallBooleanMethod') - .asFunction< - _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>, int)>(); - - /// from: `public boolean shouldShowRequestPermissionRationale(java.lang.String string, int i)` - bool shouldShowRequestPermissionRationale$1( - _$jni.JString string, - int i, - ) { - return _shouldShowRequestPermissionRationale$1( - reference.pointer, - _id_shouldShowRequestPermissionRationale$1 as _$jni.JMethodIDPtr, - string.reference.pointer, - i) - .boolean; - } - static final _id_startActivityForResult = _class.instanceMethodId( r'startActivityForResult', r'(Landroid/content/Intent;I)V', @@ -5667,56 +5466,6 @@ class Activity extends _$jni.JObject { .object(const _$jni.JStringType()); } - static final _id_getInitialCaller = _class.instanceMethodId( - r'getInitialCaller', - r'()Landroid/app/ComponentCaller;', - ); - - static final _getInitialCaller = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - )>>('globalEnv_CallObjectMethod') - .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - )>(); - - /// from: `public android.app.ComponentCaller getInitialCaller()` - /// The returned object must be released after use, by calling the [release] method. - _$jni.JObject getInitialCaller() { - return _getInitialCaller( - reference.pointer, _id_getInitialCaller as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); - } - - static final _id_getCurrentCaller = _class.instanceMethodId( - r'getCurrentCaller', - r'()Landroid/app/ComponentCaller;', - ); - - static final _getCurrentCaller = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - )>>('globalEnv_CallObjectMethod') - .asFunction< - _$jni.JniResult Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - )>(); - - /// from: `public android.app.ComponentCaller getCurrentCaller()` - /// The returned object must be released after use, by calling the [release] method. - _$jni.JObject getCurrentCaller() { - return _getCurrentCaller( - reference.pointer, _id_getCurrentCaller as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); - } - static final _id_setVisible = _class.instanceMethodId( r'setVisible', r'(Z)V', @@ -6033,49 +5782,6 @@ class Activity extends _$jni.JObject { .boolean; } - static final _id_onActivityResult = _class.instanceMethodId( - r'onActivityResult', - r'(IILandroid/content/Intent;Landroid/app/ComponentCaller;)V', - ); - - static final _onActivityResult = _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - _$jni.VarArgs< - ( - _$jni.Int32, - _$jni.Int32, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void> - )>)>>('globalEnv_CallVoidMethod') - .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, - int, - int, - _$jni.Pointer<_$jni.Void>, - _$jni.Pointer<_$jni.Void>)>(); - - /// from: `public void onActivityResult(int i, int i1, android.content.Intent intent, android.app.ComponentCaller componentCaller)` - void onActivityResult( - int i, - int i1, - _$jni.JObject intent, - _$jni.JObject componentCaller, - ) { - _onActivityResult( - reference.pointer, - _id_onActivityResult as _$jni.JMethodIDPtr, - i, - i1, - intent.reference.pointer, - componentCaller.reference.pointer) - .check(); - } - static final _id_onActivityReenter = _class.instanceMethodId( r'onActivityReenter', r'(ILandroid/content/Intent;)V', @@ -7673,33 +7379,6 @@ class Activity extends _$jni.JObject { .check(); } - static final _id_setAllowCrossUidActivitySwitchFromBelow = - _class.instanceMethodId( - r'setAllowCrossUidActivitySwitchFromBelow', - r'(Z)V', - ); - - static final _setAllowCrossUidActivitySwitchFromBelow = - _$jni.ProtectedJniExtensions.lookup< - _$jni.NativeFunction< - _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, - _$jni.JMethodIDPtr, _$jni.VarArgs<(_$jni.Int32,)>)>>( - 'globalEnv_CallVoidMethod') - .asFunction< - _$jni.JThrowablePtr Function( - _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); - - /// from: `public void setAllowCrossUidActivitySwitchFromBelow(boolean z)` - void setAllowCrossUidActivitySwitchFromBelow( - bool z, - ) { - _setAllowCrossUidActivitySwitchFromBelow( - reference.pointer, - _id_setAllowCrossUidActivitySwitchFromBelow as _$jni.JMethodIDPtr, - z ? 1 : 0) - .check(); - } - static final _id_getOnBackInvokedDispatcher = _class.instanceMethodId( r'getOnBackInvokedDispatcher', r'()Landroid/window/OnBackInvokedDispatcher;', diff --git a/lib/src/jni/android/location/Location.dart b/lib/src/jni/android/location/Location.dart new file mode 100644 index 00000000..3c32a0a6 --- /dev/null +++ b/lib/src/jni/android/location/Location.dart @@ -0,0 +1,1919 @@ +// Autogenerated by jnigen. DO NOT EDIT! + +// ignore_for_file: public_member_api_docs +// ignore_for_file: require_trailing_commas +// ignore_for_file: unnecessary_raw_strings +// ignore_for_file: avoid_field_initializers_in_const_classes +// ignore_for_file: avoid_equals_and_hash_code_on_mutable_classes +// ignore_for_file: sort_constructors_first +// ignore_for_file: avoid_positional_boolean_parameters +// ignore_for_file: sort_unnamed_constructors_first +// ignore_for_file: always_use_package_imports +// ignore_for_file: use_late_for_private_fields_and_variables +// ignore_for_file: one_member_abstracts +// ignore_for_file: always_put_required_named_parameters_first + +// Autogenerated by jnigen. DO NOT EDIT! + +// ignore_for_file: annotate_overrides +// ignore_for_file: argument_type_not_assignable +// ignore_for_file: camel_case_extensions +// ignore_for_file: camel_case_types +// ignore_for_file: constant_identifier_names +// ignore_for_file: doc_directive_unknown +// ignore_for_file: file_names +// ignore_for_file: inference_failure_on_untyped_parameter +// ignore_for_file: invalid_internal_annotation +// ignore_for_file: invalid_use_of_internal_member +// ignore_for_file: library_prefixes +// ignore_for_file: lines_longer_than_80_chars +// ignore_for_file: no_leading_underscores_for_library_prefixes +// ignore_for_file: no_leading_underscores_for_local_identifiers +// ignore_for_file: non_constant_identifier_names +// ignore_for_file: only_throw_errors +// ignore_for_file: overridden_fields +// ignore_for_file: prefer_double_quotes +// ignore_for_file: unintended_html_in_doc_comment +// ignore_for_file: unnecessary_cast +// ignore_for_file: unnecessary_parenthesis +// ignore_for_file: unused_element +// ignore_for_file: unused_field +// ignore_for_file: unused_import +// ignore_for_file: unused_local_variable +// ignore_for_file: unused_shown_name +// ignore_for_file: use_super_parameters + +import 'dart:core' show Object, String, bool, double, int; +import 'dart:core' as _$core; + +import 'package:jni/_internal.dart' as _$jni; +import 'package:jni/jni.dart' as _$jni; + +/// from: `android.location.Location` +class Location extends _$jni.JObject { + @_$jni.internal + @_$core.override + final _$jni.JObjType $type; + + @_$jni.internal + Location.fromReference( + _$jni.JReference reference, + ) : $type = type, + super.fromReference(reference); + + static final _class = _$jni.JClass.forName(r'android/location/Location'); + + /// The type which includes information such as the signature of this class. + static const type = $Location$Type(); + static final _id_CREATOR = _class.staticFieldId( + r'CREATOR', + r'Landroid/os/Parcelable$Creator;', + ); + + /// from: `static public final android.os.Parcelable$Creator CREATOR` + /// The returned object must be released after use, by calling the [release] method. + static _$jni.JObject get CREATOR => + _id_CREATOR.get(_class, const _$jni.JObjectType()); + + /// from: `static public final int FORMAT_DEGREES` + static const FORMAT_DEGREES = 0; + + /// from: `static public final int FORMAT_MINUTES` + static const FORMAT_MINUTES = 1; + + /// from: `static public final int FORMAT_SECONDS` + static const FORMAT_SECONDS = 2; + static final _id_new$ = _class.constructorId( + r'(Ljava/lang/String;)V', + ); + + static final _new$ = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void (java.lang.String string)` + /// The returned object must be released after use, by calling the [release] method. + factory Location( + _$jni.JString string, + ) { + return Location.fromReference(_new$(_class.reference.pointer, + _id_new$ as _$jni.JMethodIDPtr, string.reference.pointer) + .reference); + } + + static final _id_new$1 = _class.constructorId( + r'(Landroid/location/Location;)V', + ); + + static final _new$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_NewObject') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void (android.location.Location location)` + /// The returned object must be released after use, by calling the [release] method. + factory Location.new$1( + Location location, + ) { + return Location.fromReference(_new$1(_class.reference.pointer, + _id_new$1 as _$jni.JMethodIDPtr, location.reference.pointer) + .reference); + } + + static final _id_set = _class.instanceMethodId( + r'set', + r'(Landroid/location/Location;)V', + ); + + static final _set = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void set(android.location.Location location)` + void set( + Location location, + ) { + _set(reference.pointer, _id_set as _$jni.JMethodIDPtr, + location.reference.pointer) + .check(); + } + + static final _id_reset = _class.instanceMethodId( + r'reset', + r'()V', + ); + + static final _reset = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public void reset()` + void reset() { + _reset(reference.pointer, _id_reset as _$jni.JMethodIDPtr).check(); + } + + static final _id_distanceTo = _class.instanceMethodId( + r'distanceTo', + r'(Landroid/location/Location;)F', + ); + + static final _distanceTo = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallFloatMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public float distanceTo(android.location.Location location)` + double distanceTo( + Location location, + ) { + return _distanceTo(reference.pointer, _id_distanceTo as _$jni.JMethodIDPtr, + location.reference.pointer) + .float; + } + + static final _id_bearingTo = _class.instanceMethodId( + r'bearingTo', + r'(Landroid/location/Location;)F', + ); + + static final _bearingTo = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallFloatMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public float bearingTo(android.location.Location location)` + double bearingTo( + Location location, + ) { + return _bearingTo(reference.pointer, _id_bearingTo as _$jni.JMethodIDPtr, + location.reference.pointer) + .float; + } + + static final _id_getProvider = _class.instanceMethodId( + r'getProvider', + r'()Ljava/lang/String;', + ); + + static final _getProvider = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public java.lang.String getProvider()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString getProvider() { + return _getProvider( + reference.pointer, _id_getProvider as _$jni.JMethodIDPtr) + .object(const _$jni.JStringType()); + } + + static final _id_setProvider = _class.instanceMethodId( + r'setProvider', + r'(Ljava/lang/String;)V', + ); + + static final _setProvider = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void setProvider(java.lang.String string)` + void setProvider( + _$jni.JString string, + ) { + _setProvider(reference.pointer, _id_setProvider as _$jni.JMethodIDPtr, + string.reference.pointer) + .check(); + } + + static final _id_getTime = _class.instanceMethodId( + r'getTime', + r'()J', + ); + + static final _getTime = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallLongMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public long getTime()` + int getTime() { + return _getTime(reference.pointer, _id_getTime as _$jni.JMethodIDPtr).long; + } + + static final _id_setTime = _class.instanceMethodId( + r'setTime', + r'(J)V', + ); + + static final _setTime = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Int64,)>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `public void setTime(long j)` + void setTime( + int j, + ) { + _setTime(reference.pointer, _id_setTime as _$jni.JMethodIDPtr, j).check(); + } + + static final _id_getElapsedRealtimeNanos = _class.instanceMethodId( + r'getElapsedRealtimeNanos', + r'()J', + ); + + static final _getElapsedRealtimeNanos = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallLongMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public long getElapsedRealtimeNanos()` + int getElapsedRealtimeNanos() { + return _getElapsedRealtimeNanos(reference.pointer, + _id_getElapsedRealtimeNanos as _$jni.JMethodIDPtr) + .long; + } + + static final _id_getElapsedRealtimeMillis = _class.instanceMethodId( + r'getElapsedRealtimeMillis', + r'()J', + ); + + static final _getElapsedRealtimeMillis = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallLongMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public long getElapsedRealtimeMillis()` + int getElapsedRealtimeMillis() { + return _getElapsedRealtimeMillis(reference.pointer, + _id_getElapsedRealtimeMillis as _$jni.JMethodIDPtr) + .long; + } + + static final _id_getElapsedRealtimeAgeMillis = _class.instanceMethodId( + r'getElapsedRealtimeAgeMillis', + r'()J', + ); + + static final _getElapsedRealtimeAgeMillis = + _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallLongMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public long getElapsedRealtimeAgeMillis()` + int getElapsedRealtimeAgeMillis() { + return _getElapsedRealtimeAgeMillis(reference.pointer, + _id_getElapsedRealtimeAgeMillis as _$jni.JMethodIDPtr) + .long; + } + + static final _id_getElapsedRealtimeAgeMillis$1 = _class.instanceMethodId( + r'getElapsedRealtimeAgeMillis', + r'(J)J', + ); + + static final _getElapsedRealtimeAgeMillis$1 = + _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.VarArgs<(_$jni.Int64,)>)>>( + 'globalEnv_CallLongMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `public long getElapsedRealtimeAgeMillis(long j)` + int getElapsedRealtimeAgeMillis$1( + int j, + ) { + return _getElapsedRealtimeAgeMillis$1(reference.pointer, + _id_getElapsedRealtimeAgeMillis$1 as _$jni.JMethodIDPtr, j) + .long; + } + + static final _id_setElapsedRealtimeNanos = _class.instanceMethodId( + r'setElapsedRealtimeNanos', + r'(J)V', + ); + + static final _setElapsedRealtimeNanos = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Int64,)>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `public void setElapsedRealtimeNanos(long j)` + void setElapsedRealtimeNanos( + int j, + ) { + _setElapsedRealtimeNanos(reference.pointer, + _id_setElapsedRealtimeNanos as _$jni.JMethodIDPtr, j) + .check(); + } + + static final _id_getElapsedRealtimeUncertaintyNanos = _class.instanceMethodId( + r'getElapsedRealtimeUncertaintyNanos', + r'()D', + ); + + static final _getElapsedRealtimeUncertaintyNanos = + _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallDoubleMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public double getElapsedRealtimeUncertaintyNanos()` + double getElapsedRealtimeUncertaintyNanos() { + return _getElapsedRealtimeUncertaintyNanos(reference.pointer, + _id_getElapsedRealtimeUncertaintyNanos as _$jni.JMethodIDPtr) + .doubleFloat; + } + + static final _id_setElapsedRealtimeUncertaintyNanos = _class.instanceMethodId( + r'setElapsedRealtimeUncertaintyNanos', + r'(D)V', + ); + + static final _setElapsedRealtimeUncertaintyNanos = + _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.VarArgs<(_$jni.Double,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, double)>(); + + /// from: `public void setElapsedRealtimeUncertaintyNanos(double d)` + void setElapsedRealtimeUncertaintyNanos( + double d, + ) { + _setElapsedRealtimeUncertaintyNanos(reference.pointer, + _id_setElapsedRealtimeUncertaintyNanos as _$jni.JMethodIDPtr, d) + .check(); + } + + static final _id_hasElapsedRealtimeUncertaintyNanos = _class.instanceMethodId( + r'hasElapsedRealtimeUncertaintyNanos', + r'()Z', + ); + + static final _hasElapsedRealtimeUncertaintyNanos = + _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public boolean hasElapsedRealtimeUncertaintyNanos()` + bool hasElapsedRealtimeUncertaintyNanos() { + return _hasElapsedRealtimeUncertaintyNanos(reference.pointer, + _id_hasElapsedRealtimeUncertaintyNanos as _$jni.JMethodIDPtr) + .boolean; + } + + static final _id_removeElapsedRealtimeUncertaintyNanos = + _class.instanceMethodId( + r'removeElapsedRealtimeUncertaintyNanos', + r'()V', + ); + + static final _removeElapsedRealtimeUncertaintyNanos = + _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public void removeElapsedRealtimeUncertaintyNanos()` + void removeElapsedRealtimeUncertaintyNanos() { + _removeElapsedRealtimeUncertaintyNanos(reference.pointer, + _id_removeElapsedRealtimeUncertaintyNanos as _$jni.JMethodIDPtr) + .check(); + } + + static final _id_getLatitude = _class.instanceMethodId( + r'getLatitude', + r'()D', + ); + + static final _getLatitude = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallDoubleMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public double getLatitude()` + double getLatitude() { + return _getLatitude( + reference.pointer, _id_getLatitude as _$jni.JMethodIDPtr) + .doubleFloat; + } + + static final _id_setLatitude = _class.instanceMethodId( + r'setLatitude', + r'(D)V', + ); + + static final _setLatitude = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Double,)>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, double)>(); + + /// from: `public void setLatitude(double d)` + void setLatitude( + double d, + ) { + _setLatitude(reference.pointer, _id_setLatitude as _$jni.JMethodIDPtr, d) + .check(); + } + + static final _id_getLongitude = _class.instanceMethodId( + r'getLongitude', + r'()D', + ); + + static final _getLongitude = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallDoubleMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public double getLongitude()` + double getLongitude() { + return _getLongitude( + reference.pointer, _id_getLongitude as _$jni.JMethodIDPtr) + .doubleFloat; + } + + static final _id_setLongitude = _class.instanceMethodId( + r'setLongitude', + r'(D)V', + ); + + static final _setLongitude = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Double,)>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, double)>(); + + /// from: `public void setLongitude(double d)` + void setLongitude( + double d, + ) { + _setLongitude(reference.pointer, _id_setLongitude as _$jni.JMethodIDPtr, d) + .check(); + } + + static final _id_getAccuracy = _class.instanceMethodId( + r'getAccuracy', + r'()F', + ); + + static final _getAccuracy = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallFloatMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public float getAccuracy()` + double getAccuracy() { + return _getAccuracy( + reference.pointer, _id_getAccuracy as _$jni.JMethodIDPtr) + .float; + } + + static final _id_setAccuracy = _class.instanceMethodId( + r'setAccuracy', + r'(F)V', + ); + + static final _setAccuracy = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Double,)>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, double)>(); + + /// from: `public void setAccuracy(float f)` + void setAccuracy( + double f, + ) { + _setAccuracy(reference.pointer, _id_setAccuracy as _$jni.JMethodIDPtr, f) + .check(); + } + + static final _id_hasAccuracy = _class.instanceMethodId( + r'hasAccuracy', + r'()Z', + ); + + static final _hasAccuracy = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public boolean hasAccuracy()` + bool hasAccuracy() { + return _hasAccuracy( + reference.pointer, _id_hasAccuracy as _$jni.JMethodIDPtr) + .boolean; + } + + static final _id_removeAccuracy = _class.instanceMethodId( + r'removeAccuracy', + r'()V', + ); + + static final _removeAccuracy = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public void removeAccuracy()` + void removeAccuracy() { + _removeAccuracy(reference.pointer, _id_removeAccuracy as _$jni.JMethodIDPtr) + .check(); + } + + static final _id_getAltitude = _class.instanceMethodId( + r'getAltitude', + r'()D', + ); + + static final _getAltitude = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallDoubleMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public double getAltitude()` + double getAltitude() { + return _getAltitude( + reference.pointer, _id_getAltitude as _$jni.JMethodIDPtr) + .doubleFloat; + } + + static final _id_setAltitude = _class.instanceMethodId( + r'setAltitude', + r'(D)V', + ); + + static final _setAltitude = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Double,)>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, double)>(); + + /// from: `public void setAltitude(double d)` + void setAltitude( + double d, + ) { + _setAltitude(reference.pointer, _id_setAltitude as _$jni.JMethodIDPtr, d) + .check(); + } + + static final _id_hasAltitude = _class.instanceMethodId( + r'hasAltitude', + r'()Z', + ); + + static final _hasAltitude = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public boolean hasAltitude()` + bool hasAltitude() { + return _hasAltitude( + reference.pointer, _id_hasAltitude as _$jni.JMethodIDPtr) + .boolean; + } + + static final _id_removeAltitude = _class.instanceMethodId( + r'removeAltitude', + r'()V', + ); + + static final _removeAltitude = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public void removeAltitude()` + void removeAltitude() { + _removeAltitude(reference.pointer, _id_removeAltitude as _$jni.JMethodIDPtr) + .check(); + } + + static final _id_getVerticalAccuracyMeters = _class.instanceMethodId( + r'getVerticalAccuracyMeters', + r'()F', + ); + + static final _getVerticalAccuracyMeters = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallFloatMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public float getVerticalAccuracyMeters()` + double getVerticalAccuracyMeters() { + return _getVerticalAccuracyMeters(reference.pointer, + _id_getVerticalAccuracyMeters as _$jni.JMethodIDPtr) + .float; + } + + static final _id_setVerticalAccuracyMeters = _class.instanceMethodId( + r'setVerticalAccuracyMeters', + r'(F)V', + ); + + static final _setVerticalAccuracyMeters = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Double,)>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, double)>(); + + /// from: `public void setVerticalAccuracyMeters(float f)` + void setVerticalAccuracyMeters( + double f, + ) { + _setVerticalAccuracyMeters(reference.pointer, + _id_setVerticalAccuracyMeters as _$jni.JMethodIDPtr, f) + .check(); + } + + static final _id_hasVerticalAccuracy = _class.instanceMethodId( + r'hasVerticalAccuracy', + r'()Z', + ); + + static final _hasVerticalAccuracy = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public boolean hasVerticalAccuracy()` + bool hasVerticalAccuracy() { + return _hasVerticalAccuracy( + reference.pointer, _id_hasVerticalAccuracy as _$jni.JMethodIDPtr) + .boolean; + } + + static final _id_removeVerticalAccuracy = _class.instanceMethodId( + r'removeVerticalAccuracy', + r'()V', + ); + + static final _removeVerticalAccuracy = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public void removeVerticalAccuracy()` + void removeVerticalAccuracy() { + _removeVerticalAccuracy( + reference.pointer, _id_removeVerticalAccuracy as _$jni.JMethodIDPtr) + .check(); + } + + static final _id_getSpeed = _class.instanceMethodId( + r'getSpeed', + r'()F', + ); + + static final _getSpeed = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallFloatMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public float getSpeed()` + double getSpeed() { + return _getSpeed(reference.pointer, _id_getSpeed as _$jni.JMethodIDPtr) + .float; + } + + static final _id_setSpeed = _class.instanceMethodId( + r'setSpeed', + r'(F)V', + ); + + static final _setSpeed = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Double,)>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, double)>(); + + /// from: `public void setSpeed(float f)` + void setSpeed( + double f, + ) { + _setSpeed(reference.pointer, _id_setSpeed as _$jni.JMethodIDPtr, f).check(); + } + + static final _id_hasSpeed = _class.instanceMethodId( + r'hasSpeed', + r'()Z', + ); + + static final _hasSpeed = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public boolean hasSpeed()` + bool hasSpeed() { + return _hasSpeed(reference.pointer, _id_hasSpeed as _$jni.JMethodIDPtr) + .boolean; + } + + static final _id_removeSpeed = _class.instanceMethodId( + r'removeSpeed', + r'()V', + ); + + static final _removeSpeed = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public void removeSpeed()` + void removeSpeed() { + _removeSpeed(reference.pointer, _id_removeSpeed as _$jni.JMethodIDPtr) + .check(); + } + + static final _id_getSpeedAccuracyMetersPerSecond = _class.instanceMethodId( + r'getSpeedAccuracyMetersPerSecond', + r'()F', + ); + + static final _getSpeedAccuracyMetersPerSecond = + _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallFloatMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public float getSpeedAccuracyMetersPerSecond()` + double getSpeedAccuracyMetersPerSecond() { + return _getSpeedAccuracyMetersPerSecond(reference.pointer, + _id_getSpeedAccuracyMetersPerSecond as _$jni.JMethodIDPtr) + .float; + } + + static final _id_setSpeedAccuracyMetersPerSecond = _class.instanceMethodId( + r'setSpeedAccuracyMetersPerSecond', + r'(F)V', + ); + + static final _setSpeedAccuracyMetersPerSecond = + _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.VarArgs<(_$jni.Double,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, double)>(); + + /// from: `public void setSpeedAccuracyMetersPerSecond(float f)` + void setSpeedAccuracyMetersPerSecond( + double f, + ) { + _setSpeedAccuracyMetersPerSecond(reference.pointer, + _id_setSpeedAccuracyMetersPerSecond as _$jni.JMethodIDPtr, f) + .check(); + } + + static final _id_hasSpeedAccuracy = _class.instanceMethodId( + r'hasSpeedAccuracy', + r'()Z', + ); + + static final _hasSpeedAccuracy = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public boolean hasSpeedAccuracy()` + bool hasSpeedAccuracy() { + return _hasSpeedAccuracy( + reference.pointer, _id_hasSpeedAccuracy as _$jni.JMethodIDPtr) + .boolean; + } + + static final _id_removeSpeedAccuracy = _class.instanceMethodId( + r'removeSpeedAccuracy', + r'()V', + ); + + static final _removeSpeedAccuracy = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public void removeSpeedAccuracy()` + void removeSpeedAccuracy() { + _removeSpeedAccuracy( + reference.pointer, _id_removeSpeedAccuracy as _$jni.JMethodIDPtr) + .check(); + } + + static final _id_getBearing = _class.instanceMethodId( + r'getBearing', + r'()F', + ); + + static final _getBearing = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallFloatMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public float getBearing()` + double getBearing() { + return _getBearing(reference.pointer, _id_getBearing as _$jni.JMethodIDPtr) + .float; + } + + static final _id_setBearing = _class.instanceMethodId( + r'setBearing', + r'(F)V', + ); + + static final _setBearing = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Double,)>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, double)>(); + + /// from: `public void setBearing(float f)` + void setBearing( + double f, + ) { + _setBearing(reference.pointer, _id_setBearing as _$jni.JMethodIDPtr, f) + .check(); + } + + static final _id_hasBearing = _class.instanceMethodId( + r'hasBearing', + r'()Z', + ); + + static final _hasBearing = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public boolean hasBearing()` + bool hasBearing() { + return _hasBearing(reference.pointer, _id_hasBearing as _$jni.JMethodIDPtr) + .boolean; + } + + static final _id_removeBearing = _class.instanceMethodId( + r'removeBearing', + r'()V', + ); + + static final _removeBearing = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public void removeBearing()` + void removeBearing() { + _removeBearing(reference.pointer, _id_removeBearing as _$jni.JMethodIDPtr) + .check(); + } + + static final _id_getBearingAccuracyDegrees = _class.instanceMethodId( + r'getBearingAccuracyDegrees', + r'()F', + ); + + static final _getBearingAccuracyDegrees = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallFloatMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public float getBearingAccuracyDegrees()` + double getBearingAccuracyDegrees() { + return _getBearingAccuracyDegrees(reference.pointer, + _id_getBearingAccuracyDegrees as _$jni.JMethodIDPtr) + .float; + } + + static final _id_setBearingAccuracyDegrees = _class.instanceMethodId( + r'setBearingAccuracyDegrees', + r'(F)V', + ); + + static final _setBearingAccuracyDegrees = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Double,)>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, double)>(); + + /// from: `public void setBearingAccuracyDegrees(float f)` + void setBearingAccuracyDegrees( + double f, + ) { + _setBearingAccuracyDegrees(reference.pointer, + _id_setBearingAccuracyDegrees as _$jni.JMethodIDPtr, f) + .check(); + } + + static final _id_hasBearingAccuracy = _class.instanceMethodId( + r'hasBearingAccuracy', + r'()Z', + ); + + static final _hasBearingAccuracy = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public boolean hasBearingAccuracy()` + bool hasBearingAccuracy() { + return _hasBearingAccuracy( + reference.pointer, _id_hasBearingAccuracy as _$jni.JMethodIDPtr) + .boolean; + } + + static final _id_removeBearingAccuracy = _class.instanceMethodId( + r'removeBearingAccuracy', + r'()V', + ); + + static final _removeBearingAccuracy = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public void removeBearingAccuracy()` + void removeBearingAccuracy() { + _removeBearingAccuracy( + reference.pointer, _id_removeBearingAccuracy as _$jni.JMethodIDPtr) + .check(); + } + + static final _id_getMslAltitudeMeters = _class.instanceMethodId( + r'getMslAltitudeMeters', + r'()D', + ); + + static final _getMslAltitudeMeters = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallDoubleMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public double getMslAltitudeMeters()` + double getMslAltitudeMeters() { + return _getMslAltitudeMeters( + reference.pointer, _id_getMslAltitudeMeters as _$jni.JMethodIDPtr) + .doubleFloat; + } + + static final _id_setMslAltitudeMeters = _class.instanceMethodId( + r'setMslAltitudeMeters', + r'(D)V', + ); + + static final _setMslAltitudeMeters = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Double,)>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, double)>(); + + /// from: `public void setMslAltitudeMeters(double d)` + void setMslAltitudeMeters( + double d, + ) { + _setMslAltitudeMeters(reference.pointer, + _id_setMslAltitudeMeters as _$jni.JMethodIDPtr, d) + .check(); + } + + static final _id_hasMslAltitude = _class.instanceMethodId( + r'hasMslAltitude', + r'()Z', + ); + + static final _hasMslAltitude = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public boolean hasMslAltitude()` + bool hasMslAltitude() { + return _hasMslAltitude( + reference.pointer, _id_hasMslAltitude as _$jni.JMethodIDPtr) + .boolean; + } + + static final _id_removeMslAltitude = _class.instanceMethodId( + r'removeMslAltitude', + r'()V', + ); + + static final _removeMslAltitude = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public void removeMslAltitude()` + void removeMslAltitude() { + _removeMslAltitude( + reference.pointer, _id_removeMslAltitude as _$jni.JMethodIDPtr) + .check(); + } + + static final _id_getMslAltitudeAccuracyMeters = _class.instanceMethodId( + r'getMslAltitudeAccuracyMeters', + r'()F', + ); + + static final _getMslAltitudeAccuracyMeters = + _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallFloatMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public float getMslAltitudeAccuracyMeters()` + double getMslAltitudeAccuracyMeters() { + return _getMslAltitudeAccuracyMeters(reference.pointer, + _id_getMslAltitudeAccuracyMeters as _$jni.JMethodIDPtr) + .float; + } + + static final _id_setMslAltitudeAccuracyMeters = _class.instanceMethodId( + r'setMslAltitudeAccuracyMeters', + r'(F)V', + ); + + static final _setMslAltitudeAccuracyMeters = + _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.VarArgs<(_$jni.Double,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, double)>(); + + /// from: `public void setMslAltitudeAccuracyMeters(float f)` + void setMslAltitudeAccuracyMeters( + double f, + ) { + _setMslAltitudeAccuracyMeters(reference.pointer, + _id_setMslAltitudeAccuracyMeters as _$jni.JMethodIDPtr, f) + .check(); + } + + static final _id_hasMslAltitudeAccuracy = _class.instanceMethodId( + r'hasMslAltitudeAccuracy', + r'()Z', + ); + + static final _hasMslAltitudeAccuracy = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public boolean hasMslAltitudeAccuracy()` + bool hasMslAltitudeAccuracy() { + return _hasMslAltitudeAccuracy( + reference.pointer, _id_hasMslAltitudeAccuracy as _$jni.JMethodIDPtr) + .boolean; + } + + static final _id_removeMslAltitudeAccuracy = _class.instanceMethodId( + r'removeMslAltitudeAccuracy', + r'()V', + ); + + static final _removeMslAltitudeAccuracy = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public void removeMslAltitudeAccuracy()` + void removeMslAltitudeAccuracy() { + _removeMslAltitudeAccuracy(reference.pointer, + _id_removeMslAltitudeAccuracy as _$jni.JMethodIDPtr) + .check(); + } + + static final _id_isFromMockProvider = _class.instanceMethodId( + r'isFromMockProvider', + r'()Z', + ); + + static final _isFromMockProvider = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public boolean isFromMockProvider()` + bool isFromMockProvider() { + return _isFromMockProvider( + reference.pointer, _id_isFromMockProvider as _$jni.JMethodIDPtr) + .boolean; + } + + static final _id_isMock = _class.instanceMethodId( + r'isMock', + r'()Z', + ); + + static final _isMock = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public boolean isMock()` + bool isMock() { + return _isMock(reference.pointer, _id_isMock as _$jni.JMethodIDPtr).boolean; + } + + static final _id_setMock = _class.instanceMethodId( + r'setMock', + r'(Z)V', + ); + + static final _setMock = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Int32,)>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, int)>(); + + /// from: `public void setMock(boolean z)` + void setMock( + bool z, + ) { + _setMock(reference.pointer, _id_setMock as _$jni.JMethodIDPtr, z ? 1 : 0) + .check(); + } + + static final _id_getExtras = _class.instanceMethodId( + r'getExtras', + r'()Landroid/os/Bundle;', + ); + + static final _getExtras = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public android.os.Bundle getExtras()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject getExtras() { + return _getExtras(reference.pointer, _id_getExtras as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_setExtras = _class.instanceMethodId( + r'setExtras', + r'(Landroid/os/Bundle;)V', + ); + + static final _setExtras = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void setExtras(android.os.Bundle bundle)` + void setExtras( + _$jni.JObject bundle, + ) { + _setExtras(reference.pointer, _id_setExtras as _$jni.JMethodIDPtr, + bundle.reference.pointer) + .check(); + } + + static final _id_isComplete = _class.instanceMethodId( + r'isComplete', + r'()Z', + ); + + static final _isComplete = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public boolean isComplete()` + bool isComplete() { + return _isComplete(reference.pointer, _id_isComplete as _$jni.JMethodIDPtr) + .boolean; + } + + static final _id_equals = _class.instanceMethodId( + r'equals', + r'(Ljava/lang/Object;)Z', + ); + + static final _equals = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallBooleanMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public boolean equals(java.lang.Object object)` + bool equals( + _$jni.JObject object, + ) { + return _equals(reference.pointer, _id_equals as _$jni.JMethodIDPtr, + object.reference.pointer) + .boolean; + } + + static final _id_hashCode$1 = _class.instanceMethodId( + r'hashCode', + r'()I', + ); + + static final _hashCode$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public int hashCode()` + int hashCode$1() { + return _hashCode$1(reference.pointer, _id_hashCode$1 as _$jni.JMethodIDPtr) + .integer; + } + + static final _id_toString$1 = _class.instanceMethodId( + r'toString', + r'()Ljava/lang/String;', + ); + + static final _toString$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public java.lang.String toString()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JString toString$1() { + return _toString$1(reference.pointer, _id_toString$1 as _$jni.JMethodIDPtr) + .object(const _$jni.JStringType()); + } + + static final _id_dump = _class.instanceMethodId( + r'dump', + r'(Landroid/util/Printer;Ljava/lang/String;)V', + ); + + static final _dump = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.Pointer<_$jni.Void>, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public void dump(android.util.Printer printer, java.lang.String string)` + void dump( + _$jni.JObject printer, + _$jni.JString string, + ) { + _dump(reference.pointer, _id_dump as _$jni.JMethodIDPtr, + printer.reference.pointer, string.reference.pointer) + .check(); + } + + static final _id_describeContents = _class.instanceMethodId( + r'describeContents', + r'()I', + ); + + static final _describeContents = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallIntMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public int describeContents()` + int describeContents() { + return _describeContents( + reference.pointer, _id_describeContents as _$jni.JMethodIDPtr) + .integer; + } + + static final _id_writeToParcel = _class.instanceMethodId( + r'writeToParcel', + r'(Landroid/os/Parcel;I)V', + ); + + static final _writeToParcel = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni + .VarArgs<(_$jni.Pointer<_$jni.Void>, _$jni.Int32)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>, int)>(); + + /// from: `public void writeToParcel(android.os.Parcel parcel, int i)` + void writeToParcel( + _$jni.JObject parcel, + int i, + ) { + _writeToParcel(reference.pointer, _id_writeToParcel as _$jni.JMethodIDPtr, + parcel.reference.pointer, i) + .check(); + } + + static final _id_convert = _class.staticMethodId( + r'convert', + r'(DI)Ljava/lang/String;', + ); + + static final _convert = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Double, _$jni.Int32)>)>>( + 'globalEnv_CallStaticObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, _$jni.JMethodIDPtr, double, int)>(); + + /// from: `static public java.lang.String convert(double d, int i)` + /// The returned object must be released after use, by calling the [release] method. + static _$jni.JString convert( + double d, + int i, + ) { + return _convert( + _class.reference.pointer, _id_convert as _$jni.JMethodIDPtr, d, i) + .object(const _$jni.JStringType()); + } + + static final _id_convert$1 = _class.staticMethodId( + r'convert', + r'(Ljava/lang/String;)D', + ); + + static final _convert$1 = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallStaticDoubleMethod') + .asFunction< + _$jni.JniResult Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public double convert(java.lang.String string)` + static double convert$1( + _$jni.JString string, + ) { + return _convert$1(_class.reference.pointer, + _id_convert$1 as _$jni.JMethodIDPtr, string.reference.pointer) + .doubleFloat; + } + + static final _id_distanceBetween = _class.staticMethodId( + r'distanceBetween', + r'(DDDD[F)V', + ); + + static final _distanceBetween = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs< + ( + _$jni.Double, + _$jni.Double, + _$jni.Double, + _$jni.Double, + _$jni.Pointer<_$jni.Void> + )>)>>('globalEnv_CallStaticVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + double, + double, + double, + double, + _$jni.Pointer<_$jni.Void>)>(); + + /// from: `static public void distanceBetween(double d, double d1, double d2, double d3, float[] fs)` + static void distanceBetween( + double d, + double d1, + double d2, + double d3, + _$jni.JArray<_$jni.jfloat> fs, + ) { + _distanceBetween( + _class.reference.pointer, + _id_distanceBetween as _$jni.JMethodIDPtr, + d, + d1, + d2, + d3, + fs.reference.pointer) + .check(); + } +} + +final class $Location$Type extends _$jni.JObjType { + @_$jni.internal + const $Location$Type(); + + @_$jni.internal + @_$core.override + String get signature => r'Landroid/location/Location;'; + + @_$jni.internal + @_$core.override + Location fromReference(_$jni.JReference reference) => + Location.fromReference(reference); + + @_$jni.internal + @_$core.override + _$jni.JObjType get superType => const _$jni.JObjectType(); + + @_$jni.internal + @_$core.override + final superCount = 1; + + @_$core.override + int get hashCode => ($Location$Type).hashCode; + + @_$core.override + bool operator ==(Object other) { + return other.runtimeType == ($Location$Type) && other is $Location$Type; + } +} diff --git a/lib/src/jni/android/location/_package.dart b/lib/src/jni/android/location/_package.dart new file mode 100644 index 00000000..387d62bd --- /dev/null +++ b/lib/src/jni/android/location/_package.dart @@ -0,0 +1 @@ +export 'Location.dart'; diff --git a/lib/src/jni/com/github/josxha/maplibre/MapLibreRegistry.dart b/lib/src/jni/com/github/josxha/maplibre/MapLibreRegistry.dart index 07182759..09b777c4 100644 --- a/lib/src/jni/com/github/josxha/maplibre/MapLibreRegistry.dart +++ b/lib/src/jni/com/github/josxha/maplibre/MapLibreRegistry.dart @@ -128,6 +128,105 @@ class MapLibreRegistry extends _$jni.JObject { mapLibreMap.reference.pointer) .check(); } + + static final _id_getActivity = _class.instanceMethodId( + r'getActivity', + r'()Landroid/app/Activity;', + ); + + static final _getActivity = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final android.app.Activity getActivity()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject getActivity() { + return _getActivity( + reference.pointer, _id_getActivity as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_setActivity = _class.instanceMethodId( + r'setActivity', + r'(Landroid/app/Activity;)V', + ); + + static final _setActivity = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final void setActivity(android.app.Activity activity)` + void setActivity( + _$jni.JObject activity, + ) { + _setActivity(reference.pointer, _id_setActivity as _$jni.JMethodIDPtr, + activity.reference.pointer) + .check(); + } + + static final _id_getContext = _class.instanceMethodId( + r'getContext', + r'()Landroid/content/Context;', + ); + + static final _getContext = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>>('globalEnv_CallObjectMethod') + .asFunction< + _$jni.JniResult Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + )>(); + + /// from: `public final android.content.Context getContext()` + /// The returned object must be released after use, by calling the [release] method. + _$jni.JObject getContext() { + return _getContext(reference.pointer, _id_getContext as _$jni.JMethodIDPtr) + .object(const _$jni.JObjectType()); + } + + static final _id_setContext = _class.instanceMethodId( + r'setContext', + r'(Landroid/content/Context;)V', + ); + + static final _setContext = _$jni.ProtectedJniExtensions.lookup< + _$jni.NativeFunction< + _$jni.JThrowablePtr Function( + _$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, + _$jni.VarArgs<(_$jni.Pointer<_$jni.Void>,)>)>>( + 'globalEnv_CallVoidMethod') + .asFunction< + _$jni.JThrowablePtr Function(_$jni.Pointer<_$jni.Void>, + _$jni.JMethodIDPtr, _$jni.Pointer<_$jni.Void>)>(); + + /// from: `public final void setContext(android.content.Context context)` + void setContext( + _$jni.JObject context, + ) { + _setContext(reference.pointer, _id_setContext as _$jni.JMethodIDPtr, + context.reference.pointer) + .check(); + } } final class $MapLibreRegistry$Type extends _$jni.JObjType { diff --git a/lib/src/jni/jni.dart b/lib/src/jni/jni.dart index 3fb6ee94..8ccf8aa0 100644 --- a/lib/src/jni/jni.dart +++ b/lib/src/jni/jni.dart @@ -1,4 +1,5 @@ export 'android/graphics/_package.dart'; +export 'android/location/_package.dart'; export 'com/github/josxha/maplibre/_package.dart'; export 'org/maplibre/android/attribution/_package.dart'; export 'org/maplibre/android/camera/_package.dart'; diff --git a/lib/src/jni/org/maplibre/android/geometry/LatLng.dart b/lib/src/jni/org/maplibre/android/geometry/LatLng.dart index 5e6e78cd..6d7f6588 100644 --- a/lib/src/jni/org/maplibre/android/geometry/LatLng.dart +++ b/lib/src/jni/org/maplibre/android/geometry/LatLng.dart @@ -49,6 +49,8 @@ import 'dart:core' as _$core; import 'package:jni/_internal.dart' as _$jni; import 'package:jni/jni.dart' as _$jni; +import '../../../../android/location/Location.dart' as location_; + /// from: `org.maplibre.android.geometry.LatLng$Companion` class LatLng_Companion extends _$jni.JObject { @_$jni.internal @@ -432,7 +434,7 @@ class LatLng extends _$jni.JObject { /// from: `public void (android.location.Location location)` /// The returned object must be released after use, by calling the [release] method. factory LatLng.new$3( - _$jni.JObject location, + location_.Location location, ) { return LatLng.fromReference(_new$3(_class.reference.pointer, _id_new$3 as _$jni.JMethodIDPtr, location.reference.pointer) diff --git a/lib/src/jni/org/maplibre/android/location/LocationComponent.dart b/lib/src/jni/org/maplibre/android/location/LocationComponent.dart index 74aa7a02..2f993116 100644 --- a/lib/src/jni/org/maplibre/android/location/LocationComponent.dart +++ b/lib/src/jni/org/maplibre/android/location/LocationComponent.dart @@ -49,6 +49,8 @@ import 'dart:core' as _$core; import 'package:jni/_internal.dart' as _$jni; import 'package:jni/jni.dart' as _$jni; +import '../../../../android/location/Location.dart' as location_; + import '../maps/MapLibreMap.dart' as maplibremap_; import '../maps/Transform.dart' as transform_; @@ -830,7 +832,7 @@ class LocationComponent extends _$jni.JObject { /// from: `public void forceLocationUpdate(android.location.Location location)` void forceLocationUpdate( - _$jni.JObject location, + location_.Location location, ) { _forceLocationUpdate( reference.pointer, @@ -858,7 +860,7 @@ class LocationComponent extends _$jni.JObject { /// from: `public void forceLocationUpdate(java.util.List list, boolean z)` void forceLocationUpdate$1( - _$jni.JList<_$jni.JObject> list, + _$jni.JList list, bool z, ) { _forceLocationUpdate$1( @@ -1068,10 +1070,10 @@ class LocationComponent extends _$jni.JObject { /// from: `public android.location.Location getLastKnownLocation()` /// The returned object must be released after use, by calling the [release] method. - _$jni.JObject getLastKnownLocation() { + location_.Location getLastKnownLocation() { return _getLastKnownLocation( reference.pointer, _id_getLastKnownLocation as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + .object(const location_.$Location$Type()); } static final _id_addOnLocationClickListener = _class.instanceMethodId( diff --git a/lib/src/jni/org/maplibre/android/location/engine/LocationEngineResult.dart b/lib/src/jni/org/maplibre/android/location/engine/LocationEngineResult.dart index b5a1e469..7c7ee05c 100644 --- a/lib/src/jni/org/maplibre/android/location/engine/LocationEngineResult.dart +++ b/lib/src/jni/org/maplibre/android/location/engine/LocationEngineResult.dart @@ -49,6 +49,8 @@ import 'dart:core' as _$core; import 'package:jni/_internal.dart' as _$jni; import 'package:jni/jni.dart' as _$jni; +import '../../../../../android/location/Location.dart' as location_; + /// from: `org.maplibre.android.location.engine.LocationEngineResult` class LocationEngineResult extends _$jni.JObject { @_$jni.internal @@ -85,7 +87,7 @@ class LocationEngineResult extends _$jni.JObject { /// from: `static public org.maplibre.android.location.engine.LocationEngineResult create(android.location.Location location)` /// The returned object must be released after use, by calling the [release] method. static LocationEngineResult create( - _$jni.JObject location, + location_.Location location, ) { return _create(_class.reference.pointer, _id_create as _$jni.JMethodIDPtr, location.reference.pointer) @@ -111,7 +113,7 @@ class LocationEngineResult extends _$jni.JObject { /// from: `static public org.maplibre.android.location.engine.LocationEngineResult create(java.util.List list)` /// The returned object must be released after use, by calling the [release] method. static LocationEngineResult create$1( - _$jni.JList<_$jni.JObject> list, + _$jni.JList list, ) { return _create$1(_class.reference.pointer, _id_create$1 as _$jni.JMethodIDPtr, list.reference.pointer) @@ -137,10 +139,10 @@ class LocationEngineResult extends _$jni.JObject { /// from: `public android.location.Location getLastLocation()` /// The returned object must be released after use, by calling the [release] method. - _$jni.JObject getLastLocation() { + location_.Location getLastLocation() { return _getLastLocation( reference.pointer, _id_getLastLocation as _$jni.JMethodIDPtr) - .object(const _$jni.JObjectType()); + .object(const location_.$Location$Type()); } static final _id_getLocations = _class.instanceMethodId( @@ -162,10 +164,10 @@ class LocationEngineResult extends _$jni.JObject { /// from: `public java.util.List getLocations()` /// The returned object must be released after use, by calling the [release] method. - _$jni.JList<_$jni.JObject> getLocations() { + _$jni.JList getLocations() { return _getLocations( reference.pointer, _id_getLocations as _$jni.JMethodIDPtr) - .object(const _$jni.JListType(_$jni.JObjectType())); + .object(const _$jni.JListType(location_.$Location$Type())); } static final _id_extractResult = _class.staticMethodId( diff --git a/lib/src/jni/org/maplibre/android/location/permissions/PermissionsManager.dart b/lib/src/jni/org/maplibre/android/location/permissions/PermissionsManager.dart index 90950cef..ea8920de 100644 --- a/lib/src/jni/org/maplibre/android/location/permissions/PermissionsManager.dart +++ b/lib/src/jni/org/maplibre/android/location/permissions/PermissionsManager.dart @@ -49,8 +49,6 @@ import 'dart:core' as _$core; import 'package:jni/_internal.dart' as _$jni; import 'package:jni/jni.dart' as _$jni; -import '../../../../../android/app/Activity.dart' as activity_; - import 'PermissionsListener.dart' as permissionslistener_; /// from: `org.maplibre.android.location.permissions.PermissionsManager` @@ -248,7 +246,7 @@ class PermissionsManager extends _$jni.JObject { /// from: `public void requestLocationPermissions(android.app.Activity activity)` void requestLocationPermissions( - activity_.Activity activity, + _$jni.JObject activity, ) { _requestLocationPermissions( reference.pointer, diff --git a/lib/src/map_controller.dart b/lib/src/map_controller.dart index d8c1ff63..43ee75d2 100644 --- a/lib/src/map_controller.dart +++ b/lib/src/map_controller.dart @@ -85,4 +85,52 @@ abstract interface class MapController { /// Removes an image from the map Future removeImage(String id); + + /// Show the user location on the map + Future enableLocation({ + Duration fastestInterval = const Duration(milliseconds: 750), + Duration maxWaitTime = const Duration(seconds: 1), + bool pulseFade = true, + bool accuracyAnimation = true, + bool compassAnimation = true, + bool pulse = true, + }); + + /// Track the user location on the map + /// + /// Set [trackLocation] to false if only the bearing should get tracked + /// (defaults to true). + /// + /// Use [trackBearing] to set if the bearing should get tracked according to + /// the GPS location, compass direction or ignored. + Future trackLocation({ + bool trackLocation = true, + BearingTrackMode trackBearing = BearingTrackMode.gps, + }); +} + +/// The mode how the bearing should get tracked on the map. +/// Used in [MapController.trackLocation]. +enum BearingTrackMode { + /// No bearing tracking. + none, + + /// Use the bearing provided by the compass sensor. + compass, + + /// Use the bearing provided by the GPS location (normalized). + gps; +} + +/// The mode how render the location on the map. +/// Used in [MapController.enableLocation]. +enum BearingRenderMode { + /// Do not display the current bearing. + none, + + /// Use the device compass to render the bearing. + compass, + + /// Use the GPS location data to render the bearing. + gps; } diff --git a/lib/src/native/widget_state_jni.dart b/lib/src/native/widget_state_jni.dart index ef8dd4c2..9c3ea955 100644 --- a/lib/src/native/widget_state_jni.dart +++ b/lib/src/native/widget_state_jni.dart @@ -4,6 +4,7 @@ import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:jni/jni.dart'; import 'package:maplibre/maplibre.dart'; import 'package:maplibre/src/jni/jni.dart' as jni; import 'package:maplibre/src/native/extensions.dart'; @@ -17,6 +18,7 @@ final class MapLibreMapStateJni extends State late final int _viewId; jni.MapLibreMap? _cachedJniMapLibreMap; jni.Projection? _cachedJniProjection; + jni.LocationComponent? _cachedLocationComponent; jni.Style? _cachedJniStyle; MapOptions get _options => widget.options; @@ -24,13 +26,14 @@ final class MapLibreMapStateJni extends State jni.MapLibreMap get _jniMapLibreMap => _cachedJniMapLibreMap ??= jni.MapLibreRegistry.INSTANCE.getMap(_viewId); - // ignore: unused_element jni.Projection get _jniProjection => _cachedJniProjection ??= _jniMapLibreMap.getProjection(); - // ignore: unused_element jni.Style get _jniStyle => _cachedJniStyle ??= _jniMapLibreMap.getStyle$1(); + jni.LocationComponent get _locationComponent => + _cachedLocationComponent ??= _jniMapLibreMap.getLocationComponent(); + @override Widget build(BuildContext context) { if (Platform.isAndroid) { @@ -84,6 +87,7 @@ final class MapLibreMapStateJni extends State _cachedJniStyle?.release(); _cachedJniProjection?.release(); _cachedJniMapLibreMap?.release(); + _cachedLocationComponent?.release(); super.dispose(); } @@ -455,4 +459,79 @@ final class MapLibreMapStateJni extends State required String data, }) => _hostApi.updateGeoJsonSource(id: id, data: data); + + @override + Future enableLocation({ + Duration fastestInterval = const Duration(milliseconds: 750), + Duration maxWaitTime = const Duration(seconds: 1), + bool pulseFade = true, + bool accuracyAnimation = true, + bool compassAnimation = true, + bool pulse = true, + BearingRenderMode bearingRenderMode = BearingRenderMode.gps, + }) async { + // https://maplibre.org/maplibre-native/docs/book/android/location-component-guide.html + final locationComponent = _locationComponent; + final jniStyle = _jniStyle; + final bearing = switch (bearingRenderMode) { + BearingRenderMode.none => jni.RenderMode.NORMAL, + BearingRenderMode.compass => jni.RenderMode.COMPASS, + BearingRenderMode.gps => jni.RenderMode.GPS, + }; + final jniContext = jni.MapLibreRegistry.INSTANCE.getContext(); + final locationComponentOptionsBuilder = + jni.LocationComponentOptions.builder(jniContext) + .pulseFadeEnabled(pulseFade) + .accuracyAnimationEnabled(accuracyAnimation) + .compassAnimationEnabled(compassAnimation.toJBoolean()) + .pulseEnabled(pulse); + final locationComponentOptions = locationComponentOptionsBuilder.build(); + final locationEngineRequestBuilder = + jni.LocationEngineRequest_Builder(750) // TODO integrate as parameter + .setFastestInterval(fastestInterval.inMilliseconds) + .setMaxWaitTime(maxWaitTime.inMilliseconds) + .setPriority(jni.LocationEngineRequest.PRIORITY_HIGH_ACCURACY); + final locationEngineRequest = locationEngineRequestBuilder.build(); + final activationOptions = + jni.LocationComponentActivationOptions.builder(jniContext, jniStyle) + .locationComponentOptions(locationComponentOptions) + .useDefaultLocationEngine(true) + .locationEngineRequest(locationEngineRequest) + .build(); + + await runOnPlatformThread(() { + locationComponent.activateLocationComponent(activationOptions); + locationComponent.setRenderMode(bearing); + locationComponent.setLocationComponentEnabled(true); + }); + + locationComponentOptionsBuilder.release(); + locationComponentOptions.release(); + locationEngineRequestBuilder.release(); + locationEngineRequest.release(); + activationOptions.release(); + jniContext.release(); + } + + @override + Future trackLocation({ + bool trackLocation = true, + BearingTrackMode trackBearing = BearingTrackMode.gps, + }) async { + final locationComponent = _locationComponent; + final mode = switch (trackBearing) { + BearingTrackMode.none => trackLocation + ? jni.CameraMode.TRACKING // only location + : jni.CameraMode.NONE, // neither location nor bearing + BearingTrackMode.compass => trackLocation + ? jni.CameraMode.TRACKING_COMPASS // location with compass bearing + : jni.CameraMode.NONE_COMPASS, // only compass bearing + BearingTrackMode.gps => trackLocation + ? jni.CameraMode.TRACKING_GPS // location with gps bearing + : jni.CameraMode.NONE_GPS, // only gps bearing + }; + await runOnPlatformThread(() { + locationComponent.setCameraMode(mode); + }); + } } diff --git a/lib/src/web/widget_state.dart b/lib/src/web/widget_state.dart index 315e0809..a6537744 100644 --- a/lib/src/web/widget_state.dart +++ b/lib/src/web/widget_state.dart @@ -614,4 +614,24 @@ final class MapLibreMapStateWeb extends State _map.keyboard.disable(); } } + + @override + Future enableLocation({ + Duration fastestInterval = const Duration(milliseconds: 750), + Duration maxWaitTime = const Duration(seconds: 1), + bool pulseFade = true, + bool accuracyAnimation = true, + bool compassAnimation = true, + bool pulse = true, + }) async { + debugPrint("Can't enable the user location on web programmatically."); + } + + @override + Future trackLocation({ + bool trackLocation = true, + BearingTrackMode trackBearing = BearingTrackMode.gps, + }) async { + debugPrint("Can't track the user location on web."); + } }