diff --git a/app/build.gradle.kts b/app/build.gradle.kts index c1979f6..7bdbd2e 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -31,6 +31,11 @@ android { versionName = "1.0" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + externalNativeBuild { + cmake { + cppFlags += "" + } + } } buildTypes { @@ -61,6 +66,12 @@ android { buildFeatures { viewBinding = true } + externalNativeBuild { + cmake { + path = file("src/main/cpp/CMakeLists.txt") + version = "3.22.1" + } + } } dependencies { diff --git a/app/libs/AMap2DMap_6.0.0_AMapSearch_9.7.3_AMapLocation_6.4.7_20240816.aar b/app/libs/AMap2DMap_6.0.0_AMapSearch_9.7.3_AMapLocation_6.4.7_20240816.aar deleted file mode 100644 index 4f33ae6..0000000 Binary files a/app/libs/AMap2DMap_6.0.0_AMapSearch_9.7.3_AMapLocation_6.4.7_20240816.aar and /dev/null differ diff --git a/app/libs/AMap3DMap_10.1.200_AMapSearch_9.7.4_AMapLocation_6.4.9_20241226.aar b/app/libs/AMap3DMap_10.1.200_AMapSearch_9.7.4_AMapLocation_6.4.9_20241226.aar new file mode 100644 index 0000000..b8b0792 Binary files /dev/null and b/app/libs/AMap3DMap_10.1.200_AMapSearch_9.7.4_AMapLocation_6.4.9_20241226.aar differ diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ed441da..0c328a8 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -47,7 +47,7 @@ tools:targetApi="31"> diff --git a/app/src/main/cpp/CMakeLists.txt b/app/src/main/cpp/CMakeLists.txt new file mode 100644 index 0000000..a41e5d3 --- /dev/null +++ b/app/src/main/cpp/CMakeLists.txt @@ -0,0 +1,38 @@ + +# For more information about using CMake with Android Studio, read the +# documentation: https://d.android.com/studio/projects/add-native-code.html. +# For more examples on how to use CMake, see https://github.com/android/ndk-samples. + +# Sets the minimum CMake version required for this project. +cmake_minimum_required(VERSION 3.22.1) + +# Declares the project name. The project name can be accessed via ${ PROJECT_NAME}, +# Since this is the top level CMakeLists.txt, the project name is also accessible +# with ${CMAKE_PROJECT_NAME} (both CMake variables are in-sync within the top level +# build script scope). +project("gaodemap") + +# Creates and names a library, sets it as either STATIC +# or SHARED, and provides the relative paths to its source code. +# You can define multiple libraries, and CMake builds them for you. +# Gradle automatically packages shared libraries with your APK. +# +# In this top level CMakeLists.txt, ${CMAKE_PROJECT_NAME} is used to define +# the target library name; in the sub-module's CMakeLists.txt, ${PROJECT_NAME} +# is preferred for the same purpose. +# +# In order to load a library into your app from Java/Kotlin, you must call +# System.loadLibrary() and pass the name of the library defined here; +# for GameActivity/NativeActivity derived applications, the same library name must be +# used in the AndroidManifest.xml file. +add_library(${CMAKE_PROJECT_NAME} SHARED + # List C/C++ source files with relative paths to this CMakeLists.txt. + gaodemap.cpp) + +# Specifies libraries CMake should link to your target library. You +# can link libraries from various origins, such as libraries defined in this +# build script, prebuilt third-party libraries, or Android system libraries. +target_link_libraries(${CMAKE_PROJECT_NAME} + # List libraries link to the target library + android + log) diff --git a/app/src/main/cpp/gaodemap.cpp b/app/src/main/cpp/gaodemap.cpp new file mode 100644 index 0000000..14d8305 --- /dev/null +++ b/app/src/main/cpp/gaodemap.cpp @@ -0,0 +1,17 @@ +// Write C++ code here. +// +// Do not forget to dynamically load the C++ library into your application. +// +// For instance, +// +// In MainActivity.java: +// static { +// System.loadLibrary("gaodemap"); +// } +// +// Or, in MainActivity.kt: +// companion object { +// init { +// System.loadLibrary("gaodemap") +// } +// } \ No newline at end of file diff --git a/app/src/main/java/com/coldmint/gaodemap/AppPlugin.kt b/app/src/main/java/com/coldmint/gaodemap/AppPlugin.kt index 98beef7..66d14f3 100644 --- a/app/src/main/java/com/coldmint/gaodemap/AppPlugin.kt +++ b/app/src/main/java/com/coldmint/gaodemap/AppPlugin.kt @@ -4,8 +4,8 @@ import android.os.Handler import android.os.Looper import android.view.View import androidx.core.view.isVisible -import com.amap.api.maps2d.AMap -import com.amap.api.maps2d.CameraUpdateFactory +import com.amap.api.maps.AMap +import com.amap.api.maps.CameraUpdateFactory import org.godotengine.godot.Godot import org.godotengine.godot.plugin.GodotPlugin import org.godotengine.godot.plugin.SignalInfo diff --git a/app/src/main/java/com/coldmint/gaodemap/MainActivity.kt b/app/src/main/java/com/coldmint/gaodemap/MainActivity.kt index daddffc..a56209a 100644 --- a/app/src/main/java/com/coldmint/gaodemap/MainActivity.kt +++ b/app/src/main/java/com/coldmint/gaodemap/MainActivity.kt @@ -136,9 +136,9 @@ import android.view.WindowManager import androidx.appcompat.app.AppCompatActivity import androidx.core.view.isVisible import com.amap.api.location.AMapLocationClient -import com.amap.api.maps2d.AMap -import com.amap.api.maps2d.CameraUpdateFactory -import com.amap.api.maps2d.model.MyLocationStyle +import com.amap.api.maps.AMap +import com.amap.api.maps.CameraUpdateFactory +import com.amap.api.maps.model.MyLocationStyle import com.coldmint.gaodemap.databinding.ActivityMainBinding import org.godotengine.godot.Godot import org.godotengine.godot.GodotFragment @@ -177,6 +177,7 @@ class MainActivity : AppCompatActivity(), GodotHost { } override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) // 调用全屏设置方法 fullScreen() diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 758f5e4..8dddf06 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -23,19 +23,19 @@ android:id="@+id/card_view" android:layout_width="0dp" android:layout_height="0dp" + android:visibility="visible" app:cardCornerRadius="8dp" app:cardElevation="0dp" - android:visibility="gone" app:cardMaxElevation="0dp" app:layout_constraintBottom_toTopOf="@+id/guideline2" app:layout_constraintEnd_toStartOf="@+id/guideline4" app:layout_constraintStart_toStartOf="@+id/guideline3" app:layout_constraintTop_toTopOf="@+id/guideline"> - + android:layout_height="match_parent" />