Skip to content

Commit

Permalink
Merge pull request #1 from TheMelody/dev_v1.0.0
Browse files Browse the repository at this point in the history
merge Dev v1.0.0
  • Loading branch information
TheMelody authored Mar 2, 2023
2 parents aa99148 + 73a068f commit ec3eb9b
Show file tree
Hide file tree
Showing 98 changed files with 6,385 additions and 520 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
- 'v1.0.0'
# master分支不触发工作流
- '!master'
# dev_开头的分支不触发工作流
- '!dev_**'

jobs:
build:
Expand Down Expand Up @@ -43,10 +45,13 @@ jobs:
- name: Create a Release APK
uses: ncipollo/release-action@v1
with:
artifacts: "sample-baidu/build/outputs/apk/release/*.apk,sample-gaode/build/outputs/apk/release/*.apk,sample-google/build/outputs/apk/release/*.apk,sample-huawei/build/outputs/apk/release/*.apk,sample-tencent/build/outputs/apk/release/*.apk"
#artifacts: "sample-baidu/build/outputs/apk/release/*.apk,sample-gaode/build/outputs/apk/release/*.apk,sample-google/build/outputs/apk/release/*.apk,sample-huawei/build/outputs/apk/release/*.apk,sample-tencent/build/outputs/apk/release/*.apk"
# v1.0.0 目前只做完了高德地图和腾讯地图
artifacts: "sample-gaode/build/outputs/apk/release/*.apk,sample-tencent/build/outputs/apk/release/*.apk"
artifactErrorsFailBuild: true
body: "五大地图集成示例APK包以及全量源码"
#body: "五大地图集成示例APK包以及全量源码"
body: "高德地图和腾讯地图示例包APK包以及全量源码"
token: ${{ secrets.github_token }}
commit: master
# tag名称和分支名称保持一致
# tag名称和分支名称保持一致,dev_**分支不触发工作流,vx.x.x分支触发工作流
tag: ${{ github.ref_name }}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
OmniMap Compose 🗺
===============
<a href="https://github.com/TheMelody/OmniMap-Compose/blob/main/LICENSE"><img alt="LICENSE" src="https://img.shields.io/github/license/TheMelody/OmniMap-Compose"/></a> <img alt="issues" src="https://img.shields.io/github/issues/TheMelody/OmniMap-Compose?color=important"/> <img alt="forks" src="https://img.shields.io/github/forks/TheMelody/OmniMap-Compose?color=blueviolet"/> <img alt="stars" src="https://img.shields.io/github/stars/TheMelody/OmniMap-Compose?color=success"/> <a href="https://juejin.cn/user/8451824316670/posts"><img alt="稀土掘金" src="https://img.shields.io/badge/%E7%A8%80%E5%9C%9F%E6%8E%98%E9%87%91-301-green?labelColor=%231e80FF&color=black" ></a> <a href="https://www.zhihu.com/people/fq_halifax"><img src="https://img.shields.io/badge/dynamic/json?color=282c34&amp;labelColor=0084ff&amp;label=%E7%9F%A5%E4%B9%8E%E5%85%B3%E6%B3%A8&amp;query=%24.data.totalSubs&amp;url=https%3A%2F%2Fapi.spencerwoo.com%2Fsubstats%2F%3Fsource%3Dzhihu%26queryKey%3Dfq_halifax&amp;longCache=true" alt="知乎"></a>


<a href="https://github.com/TheMelody/OmniMap-Compose/blob/main/LICENSE"><img alt="LICENSE" src="https://img.shields.io/github/license/TheMelody/OmniMap-Compose"/></a> <img alt="issues" src="https://img.shields.io/github/issues/TheMelody/OmniMap-Compose?color=important"/> <img alt="forks" src="https://img.shields.io/github/forks/TheMelody/OmniMap-Compose?color=blueviolet"/> <img alt="stars" src="https://img.shields.io/github/stars/TheMelody/OmniMap-Compose?color=success"/> <a href="https://juejin.cn/user/8451824316670/posts"><img alt="稀土掘金" src="https://img.shields.io/badge/%E7%A8%80%E5%9C%9F%E6%8E%98%E9%87%91-354-green?labelColor=%231e80FF&color=black" ></a> <a href="https://www.zhihu.com/people/fq_halifax"><img src="https://img.shields.io/badge/dynamic/json?color=282c34&amp;labelColor=0084ff&amp;label=%E7%9F%A5%E4%B9%8E%E5%85%B3%E6%B3%A8&amp;query=%24.data.totalSubs&amp;url=https%3A%2F%2Fapi.spencerwoo.com%2Fsubstats%2F%3Fsource%3Dzhihu%26queryKey%3Dfq_halifax&amp;longCache=true" alt="知乎"></a> <a href="https://blog.csdn.net/logicsboy"><img src="https://img.shields.io/badge/CSDN-1k+-red?labelColor=%231e80FF&color=black" alt="CSDN"></a>

Compose一键集成5大地图平台神器:
- ![百度](https://via.placeholder.com/15/4e6ef2/4e6ef2.png) **`百度地图`**
Expand All @@ -15,6 +13,8 @@ Compose一键集成5大地图平台神器:
## 注意
5大地图平台,目前只有华为的花瓣地图只支持Android 7.0+,其他平台支持Android 5.0+

**腾讯地图的缺点**:提工单,客服态度不行,没有高德地图客服好,高德地图解决效率高,腾讯地图基本上客服不会给你解决问题

**使用时需注意**

1.高德地图比例尺控件需要和地图Logo一起作用显示,腾讯地图不需要一起显示,可分开显示
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ package com.melody.map.gd_compose.overlay
import androidx.compose.runtime.Composable
import androidx.compose.runtime.ComposeNode
import androidx.compose.runtime.currentComposer
import androidx.compose.runtime.getValue
import androidx.compose.runtime.rememberUpdatedState
import androidx.compose.ui.platform.LocalContext
import com.amap.api.maps.model.BitmapDescriptor
import com.amap.api.maps.model.Marker
Expand Down Expand Up @@ -61,6 +63,7 @@ fun ClusterOverlay(
defaultClusterIcon: BitmapDescriptor,
onClick: (Marker, List<ClusterItem>)-> Unit
) {
val currentOnClick by rememberUpdatedState(newValue = onClick)
val mapApplier = currentComposer.applier as? MapApplier
val context = LocalContext.current
ComposeNode<ClusterOverlayNode, MapApplier>(
Expand All @@ -77,7 +80,7 @@ fun ClusterOverlay(
clusterOverlay.setClusterRenderer(clusterRenderer)
clusterOverlay.setOnClusterClickListener(object : ClusterClickListener {
override fun onClick(marker: Marker, clusterItems: List<ClusterItem>) {
onClick.invoke(marker,clusterItems)
currentOnClick.invoke(marker,clusterItems)
}
})
ClusterOverlayNode(clusterOverlay)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,11 +407,6 @@ private fun MarkerImpl(
) ?: error("Error adding marker")
marker.`object` = tag
marker.isClickable = isClickable
marker.setAnimationListener(animationListener)
marker.setAnimation(animation)
if(null != animation) {
marker.startAnimation()
}
MarkerNode(
compositionContext = compositionContext,
marker = marker,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ class CameraPositionState(position: CameraPosition = CameraPosition(LatLng(39.91
override fun onMapChangedLocked(newMap: AMap?) {
if (newMap == null) {
// Cancel the animate caller and crash the map setter
@Suppress("ThrowableNotThrown")
continuation.resumeWithException(CancellationException(
"internal error; no AMap available"))
error(
Expand Down
5 changes: 5 additions & 0 deletions sample-baidu/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.melody.bdmap.myapplication">

<!--访问网络获取地图服务-->
<uses-permission android:name="android.permission.INTERNET"/>

<application
android:icon="@mipmap/ic_launcher"
android:allowNativeHeapPointerTagging="false"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,13 @@ abstract class BaseViewModel<Event : IUiEvent, State : IUiState, Effect : IUiEff
*/
override fun onCleared() {
_effect.close()
asyncJobs.forEach {
it.cancel()
val iterator = asyncJobs.iterator()
while(iterator.hasNext()) {
val job = iterator.next()
if(!job.isCancelled) {
job.cancel()
}
iterator.remove()
}
super.onCleared()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@ import android.view.WindowManager
import com.melody.sample.common.model.ISensorDegreeListener
import kotlin.math.abs


class SensorEventHelper : SensorEventListener {
private val mSensorManager: SensorManager = SDKUtils.getApplicationContext()
.getSystemService(Context.SENSOR_SERVICE) as SensorManager
private val mAccelerometer: Sensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER)
private val magneticField: Sensor = mSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD)
private var lastTime: Long = 0
private var mAngle = 0f
private var accelermoterValues = FloatArray(3)
private var magneticFieldValues = FloatArray(3)
private var accelermoterValues : FloatArray ?= null // FloatArray(3) 不在这里初始化
private var magneticFieldValues : FloatArray ?= null // FloatArray(3) 不在这里初始化
private var iSensorDegreeListener:ISensorDegreeListener? = null

companion object {
Expand All @@ -32,11 +31,13 @@ class SensorEventHelper : SensorEventListener {
iSensorDegreeListener = changeDegreeListener
mSensorManager.registerListener(
this, mAccelerometer,
Sensor.TYPE_ACCELEROMETER
/*Sensor.TYPE_ACCELEROMETER*/
SensorManager.SENSOR_DELAY_UI
)
mSensorManager.registerListener(
this, magneticField,
Sensor.TYPE_MAGNETIC_FIELD
/*Sensor.TYPE_MAGNETIC_FIELD*/
SensorManager.SENSOR_DELAY_UI
)
}

Expand All @@ -59,6 +60,7 @@ class SensorEventHelper : SensorEventListener {
if(event.sensor.type == Sensor.TYPE_MAGNETIC_FIELD) {
magneticFieldValues = event.values
}
if(null == accelermoterValues || null == magneticFieldValues) return
val values = FloatArray(3)
val R = FloatArray(9)
SensorManager.getRotationMatrix(R, null, accelermoterValues, magneticFieldValues)
Expand All @@ -71,12 +73,12 @@ class SensorEventHelper : SensorEventListener {
}else if (x < -180.0F) {
x += 360.0F
}
if (abs(mAngle - x) <= 8.0F) {
if (abs(mAngle - x) < 3F) { // if (abs(mAngle - x) <= 8.0F)
return
}
mAngle = if (java.lang.Float.isNaN(x)) 0F else x
lastTime = System.currentTimeMillis()
iSensorDegreeListener?.onSensorDegree(360 - mAngle)
lastTime = System.currentTimeMillis()
}

/**
Expand Down
1 change: 1 addition & 0 deletions sample-gaode/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

<application
android:allowBackup="true"
android:allowNativeHeapPointerTagging="false"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
Expand Down
Loading

0 comments on commit ec3eb9b

Please sign in to comment.