diff --git a/FastBleLib/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties b/FastBleLib/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties index c657fc6..315de23 100644 --- a/FastBleLib/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +++ b/FastBleLib/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties @@ -1 +1 @@ -#Thu Mar 19 17:33:53 CST 2026 +#Wed Apr 08 14:56:42 CST 2026 diff --git a/app/build.gradle b/app/build.gradle index 8f0689f..629a992 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -28,9 +28,9 @@ android { applicationId "com.abbidot.tracker" minSdkVersion 23 targetSdkVersion 35 - versionCode 2112 - versionName "2.1.12" -// versionName "2.1.12-Beta4" + versionCode 2113 +// versionName "2.1.13" + versionName "2.1.13-Beta3" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/app/src/main/java/com/abbidot/tracker/constant/ConstantInt.kt b/app/src/main/java/com/abbidot/tracker/constant/ConstantInt.kt index ebdd91a..286194a 100644 --- a/app/src/main/java/com/abbidot/tracker/constant/ConstantInt.kt +++ b/app/src/main/java/com/abbidot/tracker/constant/ConstantInt.kt @@ -49,6 +49,8 @@ import androidx.annotation.IntDef ConstantInt.BasicPackage, ConstantInt.PremiumPackage, ConstantInt.MinSportGoal, + ConstantInt.PetSpecialType, + ConstantInt.DefaultType, ConstantInt.NoShare, ConstantInt.ReportTimeOutTime, ConstantInt.PetLocationType @@ -100,6 +102,8 @@ annotation class ConstantInt { const val OtherLocationType = 2 const val UserLocationType = 1 const val PetLocationType = 0 + const val PetSpecialType = 3 + const val DefaultType = 4 //默认的运动目标时间(min) const val DefaultSportGoal = 60 diff --git a/app/src/main/java/com/abbidot/tracker/constant/LinkMapCallback.kt b/app/src/main/java/com/abbidot/tracker/constant/LinkMapCallback.kt new file mode 100644 index 0000000..5bb472f --- /dev/null +++ b/app/src/main/java/com/abbidot/tracker/constant/LinkMapCallback.kt @@ -0,0 +1,10 @@ +package com.abbidot.tracker.constant + +/** + *Created by .yzq on 2026/4/8/周三. + * @link + * @description: + */ +interface LinkMapCallback { + fun onCameraListener(type:Int) +} \ No newline at end of file diff --git a/app/src/main/java/com/abbidot/tracker/ui/activity/device/AddNewTracker3Activity.kt b/app/src/main/java/com/abbidot/tracker/ui/activity/device/AddNewTracker3Activity.kt index 62882b7..a94927e 100644 --- a/app/src/main/java/com/abbidot/tracker/ui/activity/device/AddNewTracker3Activity.kt +++ b/app/src/main/java/com/abbidot/tracker/ui/activity/device/AddNewTracker3Activity.kt @@ -96,6 +96,7 @@ class AddNewTracker3Activity : //接收蓝牙连接状态 XEventBus.observe(this, EventName.ConnectDeviceState) { ble: BleTrackDeviceBean -> if (mConBleMac == ble.mac) { + mViewBinding.ivAddNewTracker3RefreshBtn.isEnabled = true if (ble.conState == ConState.CONNECTED) { setNoConnectState() val intent = Intent(mContext, AddPairedSuccessActivity::class.java) @@ -107,9 +108,6 @@ class AddNewTracker3Activity : startActivity(intent) } else if (ble.conState == ConState.CONNECTION_FAIL) { setNoConnectState() - mViewBinding.ivAddNewTracker3RefreshBtn.isEnabled = true - } else { - mViewBinding.ivAddNewTracker3RefreshBtn.isEnabled = true } } } diff --git a/app/src/main/java/com/abbidot/tracker/ui/activity/device/AddPairedSuccessActivity.kt b/app/src/main/java/com/abbidot/tracker/ui/activity/device/AddPairedSuccessActivity.kt index c469ec9..035f2f1 100644 --- a/app/src/main/java/com/abbidot/tracker/ui/activity/device/AddPairedSuccessActivity.kt +++ b/app/src/main/java/com/abbidot/tracker/ui/activity/device/AddPairedSuccessActivity.kt @@ -348,6 +348,13 @@ class AddPairedSuccessActivity : } } + override fun leftBackOnClick() { + if (!TextUtils.isEmpty(mMac)) { + SRBleUtil.instance.disconnectToMac(mMac) + } + super.leftBackOnClick() + } + override fun onClick(v: View?) { mViewBinding.apply { when (v!!) { diff --git a/app/src/main/java/com/abbidot/tracker/ui/common/map/HomeMapCommonV3.kt b/app/src/main/java/com/abbidot/tracker/ui/common/map/HomeMapCommonV3.kt index 0ecbfc3..1631715 100644 --- a/app/src/main/java/com/abbidot/tracker/ui/common/map/HomeMapCommonV3.kt +++ b/app/src/main/java/com/abbidot/tracker/ui/common/map/HomeMapCommonV3.kt @@ -10,6 +10,7 @@ import com.abbidot.tracker.base.BaseMapCommon import com.abbidot.tracker.bean.HistoryDataBean import com.abbidot.tracker.bean.MapDeviceBean import com.abbidot.tracker.constant.ConstantInt +import com.abbidot.tracker.constant.LinkMapCallback import com.abbidot.tracker.databinding.LayoutPetLocationInfoBinding import com.abbidot.tracker.ui.fragment.map.baidumap.HomeMapBaiduMapFragment import com.abbidot.tracker.ui.fragment.map.googlemap.HomeMapGoogleMapFragmentV3 diff --git a/app/src/main/java/com/abbidot/tracker/ui/fragment/map/MapV3Fragment.kt b/app/src/main/java/com/abbidot/tracker/ui/fragment/map/MapV3Fragment.kt index 6b17121..6e00a34 100644 --- a/app/src/main/java/com/abbidot/tracker/ui/fragment/map/MapV3Fragment.kt +++ b/app/src/main/java/com/abbidot/tracker/ui/fragment/map/MapV3Fragment.kt @@ -11,6 +11,7 @@ import android.view.Gravity import android.view.View import androidx.activity.result.contract.ActivityResultContracts import androidx.core.content.ContextCompat +import androidx.core.net.toUri import androidx.core.view.WindowInsetsCompat import androidx.fragment.app.Fragment import androidx.fragment.app.commit @@ -123,7 +124,7 @@ class MapV3Fragment : BaseFragment(FragmentMapV3Binding::i mViewBinding.apply { getHomeV2Activity()?.edgeToEdgeAdapterBars( - rlHomeMapTopLayout, WindowInsetsCompat.Type.statusBars() + root, WindowInsetsCompat.Type.statusBars() ) mFragment = mHomeMapCommon.getMapFragment( mContext!!, @@ -151,6 +152,17 @@ class MapV3Fragment : BaseFragment(FragmentMapV3Binding::i // mContext!!, rvHomeMapDeviceMsg, mDeviceMsgAdapter, bottom = 10 // ) + +// rlHomeMapTopLayout.setOnTouchListener { _, _ -> +// if (mShowCenterLocationType == ConstantInt.PetLocationType) { +// mShowCenterLocationType = ConstantInt.PetSpecialType +// ViewUtil.instance.setMapSwitchLocationButtonImage( +// homeMapRefreshBtn, mShowCenterLocationType +// ) +// } +// false +// } + setOnClickListenerViews( homeMapRefreshBtn, homeMapBluetoothBtn, @@ -160,7 +172,8 @@ class MapV3Fragment : BaseFragment(FragmentMapV3Binding::i llHomeMapTopPet.homeDataPetNameSmall, llHomeMapTopPet.homeDataPetHeadSmall.root, ilHomeMapDeviceBatteryLayout.ivDeviceCloseBtn, - ilHomeMapDeviceMsg.ivDeviceMsgCloseBtn + ilHomeMapDeviceMsg.ivDeviceMsgCloseBtn, + ilHomeMapPetLocation.ivPetLocationNavigationBtn ) if (AppUtils.isDebug()) { @@ -185,7 +198,9 @@ class MapV3Fragment : BaseFragment(FragmentMapV3Binding::i override fun onResume() { super.onResume() - if (mShowCenterLocationType == ConstantInt.PetLocationType) isMoveCamera = true + if (mShowCenterLocationType == ConstantInt.PetLocationType) { + isMoveCamera = true + } getHomeV2Activity()?.apply { //其他页面是否选择了宠物 if (mCurrentShowPetPos != mSelectPetPosition) { @@ -863,6 +878,9 @@ class MapV3Fragment : BaseFragment(FragmentMapV3Binding::i } } + /** + * 停止一键定位 + */ private fun stopRefreshLocation() { getHomeV2Activity()?.apply { if (isNotifyRefreshLocation) { @@ -891,6 +909,26 @@ class MapV3Fragment : BaseFragment(FragmentMapV3Binding::i } } + private fun goNavigation() { + mMapDeviceBean?.let { m -> + try { + //自动弹出手机中已经有安装地图的应用 + val uri = if (MMKVUtil.getBoolean(MMKVKey.isGpsToGCJ02)) { + val convertLatLon = + LonAndLatUtil.convertFromWGS84ToGCJ02(m.latitude, m.longitude) + "google.navigation:q=${convertLatLon[0]},${convertLatLon[1]}&mode=w".toUri() + } else { + "google.navigation:q=${m.latitude},${m.longitude}&mode=w".toUri() + } + val intent = Intent(Intent.ACTION_VIEW, uri) + intent.setPackage("com.google.android.apps.maps") + startActivity(intent) + } catch (e: Exception) { + showToast(getString(R.string.txt_no_install)) + } + } + } + override fun onClick(v: View?) { if (isLimitClick()) return mViewBinding.apply { @@ -901,13 +939,23 @@ class MapV3Fragment : BaseFragment(FragmentMapV3Binding::i showToast(R.string.no_bind_pet) return } - if (mShowCenterLocationType == ConstantInt.PetLocationType) { - mShowCenterLocationType = ConstantInt.UserLocationType - mHomeMapCommon.switchShowLocation(mShowCenterLocationType) - } else { - mShowCenterLocationType = ConstantInt.PetLocationType - isMoveCamera = true - updateMapDeviceStatus(useBleLocation = false) + when (mShowCenterLocationType) { +// ConstantInt.PetSpecialType -> { +// mShowCenterLocationType = ConstantInt.PetLocationType +// mHomeMapCommon.switchShowLocation(mShowCenterLocationType) +// } + + ConstantInt.PetLocationType -> { + mShowCenterLocationType = ConstantInt.UserLocationType + mHomeMapCommon.switchShowLocation(mShowCenterLocationType) + } + + ConstantInt.UserLocationType -> { + mShowCenterLocationType = ConstantInt.PetLocationType +// isMoveCamera = true +// updateMapDeviceStatus(useBleLocation = false) + mHomeMapCommon.switchShowLocation(mShowCenterLocationType) + } } ViewUtil.instance.setMapSwitchLocationButtonImage( homeMapRefreshBtn, mShowCenterLocationType @@ -944,8 +992,10 @@ class MapV3Fragment : BaseFragment(FragmentMapV3Binding::i mMapDeviceBean?.isCloseMsg = true ilHomeMapDeviceMsg.root.visibility = View.GONE } - } + ilHomeMapPetLocation.ivPetLocationNavigationBtn -> goNavigation() + } } } + } \ No newline at end of file diff --git a/app/src/main/java/com/abbidot/tracker/ui/fragment/map/googlemap/BaseGoogleMapFragment.kt b/app/src/main/java/com/abbidot/tracker/ui/fragment/map/googlemap/BaseGoogleMapFragment.kt index 9936b36..ce43970 100644 --- a/app/src/main/java/com/abbidot/tracker/ui/fragment/map/googlemap/BaseGoogleMapFragment.kt +++ b/app/src/main/java/com/abbidot/tracker/ui/fragment/map/googlemap/BaseGoogleMapFragment.kt @@ -304,15 +304,40 @@ abstract class BaseGoogleMapFragment : * 切换用户和宠物的位置居中显示,移动摄像头中心 */ fun switchShowLocation(@ConstantInt type: Int) { - val latLng = if (type == ConstantInt.PetLocationType) { - //刷新下用户当前的位置 - getLastLocation() - mPetLatLng - } else { - mUserLatLng - } - latLng?.let { - moveCameraLocation(it) + when (type) { + ConstantInt.PetLocationType -> { + //刷新下用户当前的位置 + getLastLocation() + mPetLatLng?.let { + mGoogleMapZoom = 17f + refreshPetCurrentLocation(it, true) + } + } + + ConstantInt.UserLocationType -> { + mPetLatLng?.let { + mUserLatLng?.apply { + setLatLngZoom(mContext!!, 250, it, this) + cameraUpdateMove() + } + } + } + else->{ + + } + +// ConstantInt.DefaultType -> { +// mPetLatLng?.let { +// mGoogleMapZoom = 17f +// refreshPetCurrentLocation(it, true) +// } +// } + +// else -> { +// mUserLatLng?.let { +// moveCameraLocation(it) +// } +// } } } @@ -948,10 +973,9 @@ abstract class BaseGoogleMapFragment : it.isMyLocationButtonEnabled = false //用于设置是启用还是停用倾斜手势的偏好设置。 // https://developers.google.cn/maps/documentation/android-sdk/reference/com/google/android/libraries/maps/UiSettings?hl=zh-cn - it.isTiltGesturesEnabled = false it.isMapToolbarEnabled = false it.isTiltGesturesEnabled = false - it.isCompassEnabled = false + it.isCompassEnabled = true } onMapLoadOk(googleMap) @@ -1052,6 +1076,14 @@ abstract class BaseGoogleMapFragment : mCameraUpdate = CameraUpdateFactory.newLatLngBounds(builder.build(), screenPaddingPx) } + private fun cameraUpdateMove() { + mGoogleMap?.apply { + mCameraUpdate?.let { + animateCamera(it) + } + } + } + fun getMyZoom1(distance: Double): Float { val scale = intArrayOf( 3,//21 diff --git a/app/src/main/java/com/abbidot/tracker/ui/fragment/map/googlemap/HistoryDataGoogleMapFragment.kt b/app/src/main/java/com/abbidot/tracker/ui/fragment/map/googlemap/HistoryDataGoogleMapFragment.kt index 3085570..e832f9f 100644 --- a/app/src/main/java/com/abbidot/tracker/ui/fragment/map/googlemap/HistoryDataGoogleMapFragment.kt +++ b/app/src/main/java/com/abbidot/tracker/ui/fragment/map/googlemap/HistoryDataGoogleMapFragment.kt @@ -115,8 +115,6 @@ class HistoryDataGoogleMapFragment : BaseGoogleMapFragment() { true } else false } - - uiSettings.isCompassEnabled = true } getLastLocation() diff --git a/app/src/main/java/com/abbidot/tracker/util/ViewUtil.kt b/app/src/main/java/com/abbidot/tracker/util/ViewUtil.kt index 82d37eb..68f9c3e 100644 --- a/app/src/main/java/com/abbidot/tracker/util/ViewUtil.kt +++ b/app/src/main/java/com/abbidot/tracker/util/ViewUtil.kt @@ -38,6 +38,7 @@ import androidx.core.animation.doOnCancel import androidx.core.content.ContextCompat import androidx.core.view.isGone import androidx.core.view.isInvisible +import androidx.core.view.isVisible import androidx.core.view.setPadding import androidx.core.widget.addTextChangedListener import androidx.fragment.app.FragmentActivity @@ -89,7 +90,6 @@ import com.qmuiteam.qmui.util.QMUIDisplayHelper import com.qmuiteam.qmui.widget.dialog.QMUIBottomSheet.BottomListSheetBuilder import com.qmuiteam.qmui.widget.grouplist.QMUICommonListItemView import java.util.Calendar -import androidx.core.view.isVisible /** @@ -892,6 +892,12 @@ class ViewUtil private constructor() { fun setMapSwitchLocationButtonImage(iv: ImageView, locationType: Int) { viewShowFadeInAnimation(iv, 600) when (locationType) { + ConstantInt.PetSpecialType -> { + iv.setBackgroundResource(R.drawable.shape_white_circle_bg) + iv.setImageResource(R.drawable.icon_pet_foot_svg) + iv.setPadding(AppUtils.dpToPx(14)) + } + ConstantInt.PetLocationType -> { iv.setBackgroundResource(R.drawable.shape_yellow_circle_bg) iv.setImageResource(R.drawable.icon_pet_foot_svg) @@ -909,6 +915,12 @@ class ViewUtil private constructor() { iv.setImageResource(R.drawable.icon_pet_fence_svg) iv.setPadding(AppUtils.dpToPx(13)) } + + ConstantInt.DefaultType -> { + iv.setBackgroundResource(R.drawable.shape_white_circle_bg) + iv.setImageResource(R.drawable.icon_map_gps) + iv.setPadding(AppUtils.dpToPx(13)) + } } } diff --git a/app/src/main/res/drawable-xhdpi/ico_map_navigati_image.png b/app/src/main/res/drawable-xhdpi/ico_map_navigati_image.png new file mode 100644 index 0000000..5cca689 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ico_map_navigati_image.png differ diff --git a/app/src/main/res/drawable-xhdpi/icon_white_bg_gray_delete.png b/app/src/main/res/drawable-xhdpi/icon_white_bg_gray_delete.png index e3ae76f..ea784fa 100644 Binary files a/app/src/main/res/drawable-xhdpi/icon_white_bg_gray_delete.png and b/app/src/main/res/drawable-xhdpi/icon_white_bg_gray_delete.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ico_map_navigati_image.png b/app/src/main/res/drawable-xxhdpi/ico_map_navigati_image.png new file mode 100644 index 0000000..82b1aa9 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ico_map_navigati_image.png differ diff --git a/app/src/main/res/drawable-xxhdpi/icon_white_bg_gray_delete.png b/app/src/main/res/drawable-xxhdpi/icon_white_bg_gray_delete.png index f069b78..fdc274b 100644 Binary files a/app/src/main/res/drawable-xxhdpi/icon_white_bg_gray_delete.png and b/app/src/main/res/drawable-xxhdpi/icon_white_bg_gray_delete.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ico_map_navigati_image.png b/app/src/main/res/drawable-xxxhdpi/ico_map_navigati_image.png new file mode 100644 index 0000000..c33edf9 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ico_map_navigati_image.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/icon_white_bg_gray_delete.png b/app/src/main/res/drawable-xxxhdpi/icon_white_bg_gray_delete.png index d4d615a..9282a82 100644 Binary files a/app/src/main/res/drawable-xxxhdpi/icon_white_bg_gray_delete.png and b/app/src/main/res/drawable-xxxhdpi/icon_white_bg_gray_delete.png differ diff --git a/app/src/main/res/layout/fragment_map_v3.xml b/app/src/main/res/layout/fragment_map_v3.xml index 2e3b536..7396ea0 100644 --- a/app/src/main/res/layout/fragment_map_v3.xml +++ b/app/src/main/res/layout/fragment_map_v3.xml @@ -1,130 +1,134 @@ - - - - - + android:layout_margin="@dimen/dp_8" /> - - - - - + android:layout_height="match_parent"> - + android:layout_height="match_parent" /> - - - - - - - - - - - - - + android:visibility="invisible"> - - - + - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_route_v2.xml b/app/src/main/res/layout/fragment_route_v2.xml index bade677..3a7d2bb 100644 --- a/app/src/main/res/layout/fragment_route_v2.xml +++ b/app/src/main/res/layout/fragment_route_v2.xml @@ -41,7 +41,6 @@ + android:thumb="@drawable/shape_black_circle_bg" + android:visibility="gone" /> @@ -21,9 +22,18 @@ android:id="@+id/tv_pet_location_update_time" style="@style/my_TextView_style_v2" android:layout_below="@id/tv_pet_location_reverse_geocode" - android:layout_alignParentEnd="true" + android:layout_marginTop="@dimen/dp_2" android:layout_marginBottom="@dimen/dp_12" android:textColor="@color/select_color3" android:textSize="@dimen/textSize12" app:typeface="@string/roboto_regular_font" /> + + \ No newline at end of file