1.优化一键定位按钮不同状态颜色
2.谷歌地图用户定位位置图标国内外同时放开 3.优化圆形和矩形围栏按钮点击范围
This commit is contained in:
4
.idea/deploymentTargetSelector.xml
generated
4
.idea/deploymentTargetSelector.xml
generated
@@ -4,10 +4,10 @@
|
||||
<selectionStates>
|
||||
<SelectionState runConfigName="app">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
<DropdownSelection timestamp="2025-10-09T01:39:35.620630500Z">
|
||||
<DropdownSelection timestamp="2026-04-01T06:06:01.472811800Z">
|
||||
<Target type="DEFAULT_BOOT">
|
||||
<handle>
|
||||
<DeviceId pluginId="LocalEmulator" identifier="path=H:\androidAvd\.android\avd\Pixel_9_Pro.avd" />
|
||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=3A040DLJH000R0" />
|
||||
</handle>
|
||||
</Target>
|
||||
</DropdownSelection>
|
||||
|
||||
@@ -29,8 +29,8 @@ android {
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 35
|
||||
versionCode 2112
|
||||
// versionName "2.1.12"
|
||||
versionName "2.1.12-Beta2"
|
||||
versionName "2.1.12"
|
||||
// versionName "2.1.12-Beta4"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
|
||||
@@ -671,9 +671,12 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
getHomeV2Activity()?.apply {
|
||||
getPet(false)?.let { pet ->
|
||||
mViewBinding.ivHomeMapRefreshLocation.let {
|
||||
val tintColor = if (SRBleUtil.instance.isMacConnect(pet.macID) || !isCanLive) {
|
||||
it.setBackgroundResource(R.drawable.shape_light_yellow_circle_bg)
|
||||
R.color.grey_color
|
||||
val tintColor = if (SRBleUtil.instance.isMacConnect(pet.macID)) {
|
||||
it.setBackgroundResource(R.drawable.shape_yellow_circle_bg)
|
||||
R.color.select_color3
|
||||
} else if (!isCanLive) {
|
||||
it.setBackgroundResource(R.drawable.shape_white_circle_bg)
|
||||
R.color.grey_color_91
|
||||
} else {
|
||||
it.setBackgroundResource(R.drawable.shape_yellow_circle_bg)
|
||||
R.color.select_color3
|
||||
|
||||
@@ -133,6 +133,7 @@ abstract class BaseGoogleMapFragment :
|
||||
|
||||
//指定地图的初始照相机位置(指定 null 以使用 默认摄像机位置)
|
||||
val options = GoogleMapOptions().apply {
|
||||
// val options = GoogleMapOptions().liteMode(true)
|
||||
//默认华盛顿经纬度
|
||||
val lat = MMKVUtil.getDouble(MMKVKey.MapShowDefaultLat, 38.913611)
|
||||
val lon = MMKVUtil.getDouble(MMKVKey.MapShowDefaultLon, -77.013222)
|
||||
@@ -388,22 +389,23 @@ abstract class BaseGoogleMapFragment :
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mGoogleMap?.apply {
|
||||
if (!isMyLocationEnabled) {
|
||||
//检测权限,开启用户的当前位置https://developers.google.cn/maps/documentation/android-sdk/location?hl=zh-cn
|
||||
if (ActivityCompat.checkSelfPermission(
|
||||
mContext!!, Manifest.permission.ACCESS_FINE_LOCATION
|
||||
) == PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(
|
||||
mContext!!, Manifest.permission.ACCESS_COARSE_LOCATION
|
||||
) == PackageManager.PERMISSION_GRANTED
|
||||
) {
|
||||
//启用“我的位置”图层。
|
||||
isMyLocationEnabled = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// else {
|
||||
// mGoogleMap?.apply {
|
||||
// if (!isMyLocationEnabled) {
|
||||
// //检测权限,开启用户的当前位置https://developers.google.cn/maps/documentation/android-sdk/location?hl=zh-cn
|
||||
// if (ActivityCompat.checkSelfPermission(
|
||||
// mContext!!, Manifest.permission.ACCESS_FINE_LOCATION
|
||||
// ) == PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(
|
||||
// mContext!!, Manifest.permission.ACCESS_COARSE_LOCATION
|
||||
// ) == PackageManager.PERMISSION_GRANTED
|
||||
// ) {
|
||||
// //启用“我的位置”图层。
|
||||
// isMyLocationEnabled = true
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -914,8 +916,6 @@ abstract class BaseGoogleMapFragment :
|
||||
LogUtil.e("谷歌地图加载好了")
|
||||
mGoogleMap = googleMap
|
||||
|
||||
// val options = GoogleMapOptions().liteMode(true)
|
||||
|
||||
isMapLoadOk = true
|
||||
|
||||
// googleMap.uiSettings.apply {
|
||||
@@ -934,15 +934,15 @@ abstract class BaseGoogleMapFragment :
|
||||
//显示实时交通信息
|
||||
// isTrafficEnabled = true
|
||||
//检测权限,开启用户的当前位置https://developers.google.cn/maps/documentation/android-sdk/location?hl=zh-cn
|
||||
// if (ActivityCompat.checkSelfPermission(
|
||||
// mContext!!, Manifest.permission.ACCESS_FINE_LOCATION
|
||||
// ) == PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(
|
||||
// mContext!!, Manifest.permission.ACCESS_COARSE_LOCATION
|
||||
// ) == PackageManager.PERMISSION_GRANTED
|
||||
// ) {
|
||||
// //启用“我的位置”图层。
|
||||
// isMyLocationEnabled = true
|
||||
// }
|
||||
if (ActivityCompat.checkSelfPermission(
|
||||
mContext!!, Manifest.permission.ACCESS_FINE_LOCATION
|
||||
) == PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(
|
||||
mContext!!, Manifest.permission.ACCESS_COARSE_LOCATION
|
||||
) == PackageManager.PERMISSION_GRANTED
|
||||
) {
|
||||
//启用“我的位置”图层。
|
||||
isMyLocationEnabled = true
|
||||
}
|
||||
uiSettings.let {
|
||||
//禁止显示“我的位置”按钮。
|
||||
it.isMyLocationButtonEnabled = false
|
||||
|
||||
@@ -11,6 +11,8 @@ import com.easysocket.config.EasySocketOptions
|
||||
import com.easysocket.entity.OriginReadData
|
||||
import com.easysocket.entity.SocketAddress
|
||||
import com.easysocket.interfaces.conn.ISocketActionListener
|
||||
import java.util.Timer
|
||||
import kotlin.concurrent.timerTask
|
||||
|
||||
|
||||
/**
|
||||
@@ -21,6 +23,7 @@ import com.easysocket.interfaces.conn.ISocketActionListener
|
||||
class SocketUtilManageV2 {
|
||||
|
||||
private var mNeedSendMessage = byteArrayOf()
|
||||
private val mTimer = Timer()
|
||||
private var mMac = ""
|
||||
|
||||
@Synchronized
|
||||
@@ -31,7 +34,8 @@ class SocketUtilManageV2 {
|
||||
val data4 = SRBleCmdUtil.instance.byteToInt(data[4])
|
||||
val ip = "$data1.$data2.$data3.$data4"
|
||||
val port = SRBleCmdUtil.instance.byte2ArrayToInt(data.sliceArray(5..6))
|
||||
LogUtil.e("$ip:$port")
|
||||
val socketAddress = "$ip:$port"
|
||||
LogUtil.e(socketAddress)
|
||||
mMac = mac
|
||||
mNeedSendMessage = data.sliceArray(8..data.size - 2)
|
||||
initEasySocket(context, ip, port)
|
||||
@@ -49,13 +53,17 @@ class SocketUtilManageV2 {
|
||||
.build()
|
||||
//初始化EasySocket
|
||||
EasySocket.getInstance().createConnection(options, context).setDebug(AppUtils.isDebug())
|
||||
// EasySocket.getInstance().createSpecifyConnection(options, context)
|
||||
|
||||
//监听socket相关行为
|
||||
EasySocket.getInstance().subscribeSocketAction(object : ISocketActionListener {
|
||||
override fun onSocketConnSuccess(socketAddress: SocketAddress?) {
|
||||
LogUtil.e("socket连接成功,${HexUtil.formatHexString(mNeedSendMessage, true)}")
|
||||
LogUtil.e("socket连接成功")
|
||||
//发送
|
||||
mTimer.schedule(timerTask {
|
||||
LogUtil.e("发送")
|
||||
EasySocket.getInstance().upMessage(mNeedSendMessage)
|
||||
}, 500)
|
||||
}
|
||||
|
||||
override fun onSocketConnFail(socketAddress: SocketAddress?, isNeedReconnect: Boolean) {
|
||||
|
||||
@@ -354,7 +354,7 @@ class FencesCircleView : View {
|
||||
val x = event.x
|
||||
val y = event.y
|
||||
mZoomBitmap?.apply {
|
||||
if (x in mLineEndX - width / 2..mLineEndX + width / 2 && y in mLineEndY - height / 2..mLineEndY + height / 2) {
|
||||
if (x in mLineEndX - width..mLineEndX + width && y in mLineEndY - height..mLineEndY + height) {
|
||||
isScale = true
|
||||
mOldX = x
|
||||
return true
|
||||
|
||||
@@ -341,7 +341,8 @@ class FencesRectView : View {
|
||||
locationDrawableRes: Int = 0,
|
||||
zoomDrawableRes: Int = 0,
|
||||
dotDrawableRes: Int = 0,
|
||||
rotateDrawableRes: Int = 0,disTextColorRes: Int = 0
|
||||
rotateDrawableRes: Int = 0,
|
||||
disTextColorRes: Int = 0
|
||||
) {
|
||||
var isRefresh = false
|
||||
if (dashedColorRes > 0) {
|
||||
@@ -563,14 +564,20 @@ class FencesRectView : View {
|
||||
return floatArrayOf((b).toFloat(), (a).toFloat())
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否点击按下了旋转,按照移动了坐标轴原点(mCentreX,mCentreY)计算初始坐标
|
||||
*/
|
||||
private fun isClickRotate(clickX: Float, clickY: Float, rotate: Double): Boolean {
|
||||
var x1 = -(mRectWidth / 2 - mRotateBitmap!!.width / 2)
|
||||
var x2 = (mRectWidth / 2 - mRotateBitmap!!.width / 2)
|
||||
var y1 = -(mRectHeight / 2 + mRotateBitmap!!.height + mRotateBitmap!!.width)
|
||||
var y2 = -(mRectHeight / 2 - mRotateBitmap!!.height)
|
||||
private fun isClick(
|
||||
bitmap: Bitmap,
|
||||
clickX: Float,
|
||||
clickY: Float,
|
||||
xX1: Float,
|
||||
xX2: Float,
|
||||
yY1: Float,
|
||||
yY2: Float,
|
||||
rotate: Double
|
||||
): Boolean {
|
||||
var x1 = xX1
|
||||
var x2 = xX2
|
||||
var y1 = yY1
|
||||
var y2 = yY2
|
||||
val minX = getRotateXY(x1, y1, rotate)
|
||||
val maxX = getRotateXY(x2, y2, rotate)
|
||||
x1 = minX[0]
|
||||
@@ -586,61 +593,48 @@ class FencesRectView : View {
|
||||
y2 = minX[1]
|
||||
}
|
||||
|
||||
//处理旋转到某个角度时,旋转图片按钮会超出坐标范围内,不在可点击坐标范围内,把可点击的坐标范围扩大
|
||||
if (abs(x2 - x1) < mRotateBitmap!!.height) {
|
||||
//处理旋转到某个角度时,图片按钮会超出坐标范围内,不在可点击坐标范围内,把可点击的坐标范围扩大
|
||||
if (abs(x2 - x1) < bitmap.height) {
|
||||
if (x2 > 0) {
|
||||
x2 += mRotateBitmap!!.height
|
||||
x2 += bitmap.height
|
||||
} else {
|
||||
x1 -= mRotateBitmap!!.height
|
||||
x1 -= bitmap.height
|
||||
}
|
||||
}
|
||||
if (abs(y2 - y1) < mRotateBitmap!!.height) {
|
||||
if (abs(y2 - y1) < bitmap.height) {
|
||||
if (y2 > 0) {
|
||||
y2 += mRotateBitmap!!.height
|
||||
y2 += bitmap.height
|
||||
} else {
|
||||
y1 -= mRotateBitmap!!.height
|
||||
y1 -= bitmap.height
|
||||
}
|
||||
}
|
||||
|
||||
val transformX = clickX - mCentreX
|
||||
val transformY = clickY - mCentreY
|
||||
|
||||
if (transformX in x1..x2 && transformY in y1..y2) {
|
||||
return true
|
||||
return transformX in x1..x2 && transformY in y1..y2
|
||||
}
|
||||
return false
|
||||
|
||||
/**
|
||||
* 是否点击按下了旋转,按照移动了坐标轴原点(mCentreX,mCentreY)计算初始坐标
|
||||
*/
|
||||
private fun isClickRotate(clickX: Float, clickY: Float, rotate: Double): Boolean {
|
||||
val x1 = -(mRectWidth / 2 - mRotateBitmap!!.width / 2)
|
||||
val x2 = (mRectWidth / 2 - mRotateBitmap!!.width / 2)
|
||||
val y1 = -(mRectHeight / 2 + mRotateBitmap!!.height + mRotateBitmap!!.width)
|
||||
val y2 = -(mRectHeight / 2 - mRotateBitmap!!.height)
|
||||
return isClick(mRotateBitmap!!, clickX, clickY, x1, x2, y1, y2, rotate)
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否点击按下了放大缩小,按照移动了坐标轴原点(mCentreX,mCentreY)计算初始坐标
|
||||
*/
|
||||
private fun isClickScale(clickX: Float, clickY: Float, rotate: Double): Boolean {
|
||||
var x1 = (mRectWidth / 2 - mZoomBitmap!!.width)
|
||||
var x2 = (mRectWidth / 2 + mZoomBitmap!!.width)
|
||||
var y1 = (mRectHeight / 2 - mRotateBitmap!!.height)
|
||||
var y2 = (mRectHeight / 2 + mRotateBitmap!!.height)
|
||||
val minX = getRotateXY(x1, y1, rotate)
|
||||
val maxX = getRotateXY(x2, y2, rotate)
|
||||
x1 = minX[0]
|
||||
x2 = maxX[0]
|
||||
if (minX[0] > maxX[0]) {
|
||||
x1 = maxX[0]
|
||||
x2 = minX[0]
|
||||
}
|
||||
y1 = minX[1]
|
||||
y2 = maxX[1]
|
||||
if (minX[1] > maxX[1]) {
|
||||
y1 = maxX[1]
|
||||
y2 = minX[1]
|
||||
}
|
||||
|
||||
val transformX = clickX - mCentreX
|
||||
val transformY = clickY - mCentreY
|
||||
|
||||
if (transformX in x1..x2 && transformY in y1..y2) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
val x1 = (mRectWidth / 2 - mZoomBitmap!!.width / 2)
|
||||
val x2 = (mRectWidth / 2 + mZoomBitmap!!.width / 2)
|
||||
val y1 = (mRectHeight / 2 - mZoomBitmap!!.height)
|
||||
val y2 = (mRectHeight / 2 + mZoomBitmap!!.height)
|
||||
return isClick(mZoomBitmap!!, clickX, clickY, x1, x2, y1, y2, rotate)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -376,4 +376,5 @@
|
||||
<color name="line_stroke_color">#077B4A</color>
|
||||
<color name="rote_line_color">#00C478</color>
|
||||
<color name="light_yellow_color">#F9FFE8</color>
|
||||
<color name="grey_color_91">#B0B0B0</color>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user