Skip to content

Commit

Permalink
Merge pull request #2 from TheMelody/v1.0.0
Browse files Browse the repository at this point in the history
V1.0.0
  • Loading branch information
TheMelody authored Mar 2, 2023
2 parents a93e89d + df0cd38 commit 2ac7409
Show file tree
Hide file tree
Showing 100 changed files with 6,435 additions and 563 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Android CI

on:
push:
branches:
- 'v1.0.0'
# master分支不触发工作流
- '!master'
# dev_开头的分支不触发工作流
- '!dev_**'

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Clean with Gradle
run: ./gradlew clean

- name: Build with Gradle
run: ./gradlew sample-gaode:assembleRelease

# 对安装包进行签名
- name: Build Signed APK
uses: victorbnl/build-signed-apk@main
with:
keystore_b64: MIIKEQIBAzCCCcoGCSqGSIb3DQEHAaCCCbsEggm3MIIJszCCBaoGCSqGSIb3DQEHAaCCBZsEggWXMIIFkzCCBY8GCyqGSIb3DQEMCgECoIIFQDCCBTwwZgYJKoZIhvcNAQUNMFkwOAYJKoZIhvcNAQUMMCsEFMD9+cALE8NYYZw3IjXoShPZjkkLAgInEAIBIDAMBggqhkiG9w0CCQUAMB0GCWCGSAFlAwQBKgQQnqtq621mwIzaqOBGAeHfOwSCBNA4Pj+jIJ1PQ0ai1LI98EHQoyUXDmKc9oaB7s82c1YQMgBguGKRNabx7wyJsGAaSWif1WWATO2Y/Su8VZAG0wTpuMQVdO9Zq79i47pc2+PwYJLOUTpAqi+A3jO4yehwwk/ABSF39B0HJl51zdvl1sv8/h1hunBShXlVB7j3c8RboGVuQcl4uXEkSwBynwt5VzTtMg36cLRTbw20Ehz1FAmLXk3o/Yp2Uttgsli/waqgInv4p5RvTMLM7qMFC2IEMJfQJaYp72cnhVYX/xSc/nJc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E9t/PtJsTOKsowhxBMBgI6AXCizAe+HuZpt1Ej8bZy42HqXJhJu1Dsu3WIVArS4qyL+pssIKZWIAxChF9HgAzrmDnpGJng4bn5yXq+HOARE3kFz4Xo4zOqbftDUbqc0ALoImN3eWIj35WkeXSLt7CH7XTQ965pxNM7rK6I6QMn/GLmAudZ38bCfc3xff2bq0lHVe008VjPycVHPe0GjQ2UkrBMVDlp7UwWFYddGmbZYNtJ5alid+XyYb8DNuiMCRguRtFkf5GpK4q2XHFXt58V6CyDFeDbt8NqjahVRhT2S5nRr7YoeXcFy+kGYqxfAIUU/AjRX93KdFoN/wl5pcI78Q3PX7WjwvGVx0Mk2zJ/xIYrjPWBC1a3/p2ftjq9LDwDq0+tnsRKhUO/gYFMvPjJoDm7NHBnwjEHFjhBW7x2PaGCWxD9TpGtbTn6snCt6WkiibbxHyvzpXRURfPoptvegHLHXcng65KD0g7V59/ca1oCfysthPBcSqMlRCClrABQBgFAVKkL+2dQ+12Os9ZZ2m9tGUKhXJTNJL0Po13bnIT8CYu03SlsFOWFXmNC7W/BZlAIlabFTaTcC3Qsxcj2bQHQheuOvlmzMk0oYwmpv9HG4aWOZP4M313OIlBWUtHwdGvLae37eLVK6ZQzlu/bBsxdYq04OoMD4wITAJBgUrDgMCGgUABBTNwDytEwqNH8oTgy5hTbDQ5xpYaQQUF4EU+aFtoDZ/2LCQiAfhFdOH3KECAwGGoA==
keystore_password: 123456
key_alias: key0
key_password: 123456

# 创建并提交签名后的APK包和源码提交至对应ref_name的tag
- 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"
# v1.0.0 目前只做完了高德地图和腾讯地图
artifacts: "sample-gaode/build/outputs/apk/release/*.apk,sample-tencent/build/outputs/apk/release/*.apk"
artifactErrorsFailBuild: true
#body: "五大地图集成示例APK包以及全量源码"
body: "高德地图和腾讯地图示例包APK包以及全量源码"
token: ${{ secrets.github_token }}
commit: master
# tag名称和分支名称保持一致,dev_**分支不触发工作流,vx.x.x分支触发工作流
tag: ${{ github.ref_name }}
45 changes: 0 additions & 45 deletions .github/workflows/sample-gaode.yml

This file was deleted.

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
2 changes: 1 addition & 1 deletion sample-gaode/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ android {

android.applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "sample-gaode_${defaultConfig.versionName}_${formattedDate}-${variant.buildType.name}.apk"
outputFileName = "gaode_${defaultConfig.versionName}_${formattedDate}-${variant.buildType.name}.apk"
}
}
}
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 2ac7409

Please sign in to comment.