1.增加支付宝微信支付
2.增加设备页不同电量图片背景 3.修复用户定位刷新,宠物和用户虚线没有及时更新bug
@@ -45,7 +45,7 @@ class CreditCardAdapter(
|
||||
)
|
||||
}
|
||||
holder.getView(R.id.iv_credit_card_edit_btn).setOnClickListener {
|
||||
(((mContext as PaymentMethodActivity).mFragments[0]) as CreditCardPaymentFragment).goEditCard(
|
||||
(((mContext as PaymentMethodActivity).mPayFragments[0]) as CreditCardPaymentFragment).goEditCard(
|
||||
item
|
||||
)
|
||||
}
|
||||
|
||||
@@ -105,6 +105,13 @@ class MyTrackerV2Adapter(
|
||||
trackerName.text = item.deviceOutId
|
||||
val battery = "${item.batteryCapacity} "
|
||||
batteryTextView.text = battery
|
||||
val batteryBg = if (item.batteryCapacity >= 60)
|
||||
R.drawable.icon_device_high_battery_bg
|
||||
else if (item.batteryCapacity >= 20)
|
||||
R.drawable.icon_device_middle_battery_bg
|
||||
else
|
||||
R.drawable.icon_device_low_battery_bg
|
||||
batteryTextView.setBackgroundResource(batteryBg)
|
||||
}
|
||||
if (null == item.pet) {
|
||||
addPetLayout.visibility = View.VISIBLE
|
||||
|
||||
@@ -213,6 +213,8 @@ abstract class BaseActivity<T : ViewBinding>(val inflater: (inflater: LayoutInfl
|
||||
} else {
|
||||
setStatusBarLight()
|
||||
}
|
||||
|
||||
//TopBar为空时不能适配状态栏,需要手动适配状态栏
|
||||
mTopBar?.apply {
|
||||
//适配状态栏
|
||||
this.parent?.let {
|
||||
@@ -936,6 +938,31 @@ abstract class BaseActivity<T : ViewBinding>(val inflater: (inflater: LayoutInfl
|
||||
|
||||
/*****************************监听软键盘弹出,输入框上移end************************************/
|
||||
|
||||
/**
|
||||
* 开始定位
|
||||
*/
|
||||
fun startUpLocation() {
|
||||
LogUtil.e("开始定位")
|
||||
if (AppUtils.isChina()) {
|
||||
//30秒定位一次,定位精度为高精度
|
||||
BaiduLocationManager.startLocation(30)
|
||||
} else {
|
||||
GoogleLocationManager.startLocation()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止定位
|
||||
*/
|
||||
private fun stopUpLocation() {
|
||||
LogUtil.e("停止定位")
|
||||
if (AppUtils.isChina()) {
|
||||
BaiduLocationManager.stopLocation()
|
||||
} else {
|
||||
GoogleLocationManager.stopLocation()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 释放定位服务
|
||||
*/
|
||||
@@ -954,6 +981,7 @@ abstract class BaseActivity<T : ViewBinding>(val inflater: (inflater: LayoutInfl
|
||||
//isFinishing:判断 Activity 是否正在被销毁。
|
||||
//isTaskRoot:判断当前 Activity 是否为任务栈的根 Activity(避免其他 Activity 销毁时误触发)
|
||||
if (isFinishing && isTaskRoot) {
|
||||
stopUpLocation()
|
||||
releaseLocationService()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,4 @@ package com.abbidot.tracker.bean
|
||||
* @link
|
||||
* @description:微信支付预支付订单
|
||||
*/
|
||||
data class AlipayOrderBean(val orderString: String) {
|
||||
constructor() : this("")
|
||||
}
|
||||
data class AlipayOrderBean(val orderString: String, val payData: PayResultBean?)
|
||||
@@ -5,12 +5,13 @@ package com.abbidot.tracker.bean
|
||||
* @link
|
||||
* @description:微信支付预支付订单
|
||||
*/
|
||||
data class WXPayOrderBean(val appid: String,
|
||||
data class WXPayOrderBean(
|
||||
val appid: String,
|
||||
val noncestr: String,
|
||||
val packageStr: String,
|
||||
val partnerid: String,
|
||||
val prepayid: String,
|
||||
val sign: String,
|
||||
val timestamp: String) {
|
||||
constructor() : this("", "", "", "", "", "", "")
|
||||
}
|
||||
val payData: PayResultBean?,
|
||||
val timestamp: String
|
||||
)
|
||||
@@ -19,10 +19,10 @@ import com.abbidot.tracker.bean.SetMealBean
|
||||
import com.abbidot.tracker.constant.ConstantString
|
||||
import com.abbidot.tracker.constant.GetResultCallback
|
||||
import com.abbidot.tracker.databinding.ActivityRechargeOrderDetailCnBinding
|
||||
import com.abbidot.tracker.deprecated.ui.activity.vm.PayCNViewModel
|
||||
import com.abbidot.tracker.util.ThirdPartyUtil
|
||||
import com.abbidot.tracker.util.Util
|
||||
import com.abbidot.tracker.util.ViewUtil
|
||||
import com.abbidot.tracker.vm.cn.PayCNViewModel
|
||||
import com.alipay.sdk.app.PayTask
|
||||
import com.qmuiteam.qmui.widget.dialog.QMUIBottomSheet
|
||||
import com.tencent.mm.opensdk.modelpay.PayReq
|
||||
@@ -231,11 +231,11 @@ class RechargeOrderDetailCNActivity : BaseActivity<ActivityRechargeOrderDetailCn
|
||||
*/
|
||||
private fun goPay() {
|
||||
when (mPayWay) {
|
||||
0 -> mPayCNViewModel.getWxPayOrder(this, mSetMealBean!!, mRechargeDeviceBean!!.deviceId)
|
||||
|
||||
1 -> mPayCNViewModel.getAlipayOrder(
|
||||
this, mSetMealBean!!, mRechargeDeviceBean!!.deviceId
|
||||
)
|
||||
// 0 -> mPayCNViewModel.getWxPayOrder(this, mSetMealBean!!, mRechargeDeviceBean!!.deviceId)
|
||||
//
|
||||
// 1 -> mPayCNViewModel.getAlipayOrder(
|
||||
// this, mSetMealBean!!, mRechargeDeviceBean!!.deviceId
|
||||
// )
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,11 +64,11 @@ interface INetworkService {
|
||||
|
||||
//测试服务器
|
||||
const val BASE_URL_TEST = "https://aws.abbidot.com:8443/abbidot/"
|
||||
// const val BASE_URL_TEST = "https://192.168.0.72:8089/abbidot/"
|
||||
|
||||
//设备透传
|
||||
const val BASE_URL_BLE = "https://ab-server.abbidot.com/"
|
||||
// const val BASE_URL_TEST = "http://aws.abbidot.com:8089/abbidot/"
|
||||
// const val BASE_URL_ABROAD = "http://192.168.0.220:8080/abbidot/"
|
||||
|
||||
//亚马逊服务器(国内ip)
|
||||
// const val BASE_URL_CN = "$IP_SERVER:8443/abbidotServer/"
|
||||
@@ -1464,12 +1464,35 @@ interface INetworkService {
|
||||
@FormUrlEncoded
|
||||
@POST("order/getWxPayOrder")
|
||||
suspend fun getWxPayOrder(
|
||||
@Field("feePackage") feePackage: String,
|
||||
@Field("deviceId") deviceId: String,
|
||||
@Field("payFee") payFee: Double,
|
||||
@Field("period") period: Float,
|
||||
@Field("userId") userId: String,
|
||||
@Field("username") username: String
|
||||
@Field("deviceId") deviceId: String,
|
||||
@Field("payMethod") payMethod: Int,
|
||||
@Field("iccid") iccid: String,
|
||||
@Field("deviceOutId") deviceOutId: String,
|
||||
@Field("username") username: String,
|
||||
@Field("mealName") mealName: String,
|
||||
@Field("mealDesc") mealDesc: String,
|
||||
@Field("mealId") mealId: String,
|
||||
@Field("mealPeriod") mealPeriod: Int,
|
||||
@Field("mealPrice") mealPrice: Double,
|
||||
@Field("mealDiscountPrice") mealDiscountPrice: Double,
|
||||
@Field("mealUnit") mealUnit: String,
|
||||
@Field("annualCareType") annualCareType: Int,
|
||||
@Field("annualCarePrice") annualCarePrice: Double,
|
||||
// @Field("couponCode") couponCode: String,
|
||||
@Field("reactivation") reactivation: Int,
|
||||
@Field("reactivatePrice") reactivatePrice: Double,
|
||||
@Field("totalAmountWithTax") totalAmountWithTax: Double,
|
||||
@Field("planCategory") planCategory: String,
|
||||
@Field("autoRenewPrice") autoRenewPrice: Double,
|
||||
// @Field("couponPrice") couponPrice: Double,
|
||||
// @Field("useCoupon") useCoupon: Int,
|
||||
@Field("tax") tax: Double,
|
||||
@Field("customerId") customerId: String,
|
||||
@Field("orderNum") orderNum: String,
|
||||
@Field("isUpdateOrder") isUpdateOrder: Int,
|
||||
@Field("planTimeMonthsCount") planTimeMonthsCount: Int,
|
||||
@Field("subscriptionId") subscriptionId: String
|
||||
): BaseResponse<WXPayOrderBean>
|
||||
|
||||
/**
|
||||
@@ -1478,12 +1501,35 @@ interface INetworkService {
|
||||
@FormUrlEncoded
|
||||
@POST("order/getAlipayOrder")
|
||||
suspend fun getAlipayOrder(
|
||||
@Field("feePackage") feePackage: String,
|
||||
@Field("deviceId") deviceId: String,
|
||||
@Field("payFee") payFee: Double,
|
||||
@Field("period") period: Float,
|
||||
@Field("userId") userId: String,
|
||||
@Field("username") username: String
|
||||
@Field("deviceId") deviceId: String,
|
||||
@Field("payMethod") payMethod: Int,
|
||||
@Field("iccid") iccid: String,
|
||||
@Field("deviceOutId") deviceOutId: String,
|
||||
@Field("username") username: String,
|
||||
@Field("mealName") mealName: String,
|
||||
@Field("mealDesc") mealDesc: String,
|
||||
@Field("mealId") mealId: String,
|
||||
@Field("mealPeriod") mealPeriod: Int,
|
||||
@Field("mealPrice") mealPrice: Double,
|
||||
@Field("mealDiscountPrice") mealDiscountPrice: Double,
|
||||
@Field("mealUnit") mealUnit: String,
|
||||
@Field("annualCareType") annualCareType: Int,
|
||||
@Field("annualCarePrice") annualCarePrice: Double,
|
||||
// @Field("couponCode") couponCode: String,
|
||||
@Field("reactivation") reactivation: Int,
|
||||
@Field("reactivatePrice") reactivatePrice: Double,
|
||||
@Field("totalAmountWithTax") totalAmountWithTax: Double,
|
||||
@Field("planCategory") planCategory: String,
|
||||
@Field("autoRenewPrice") autoRenewPrice: Double,
|
||||
// @Field("couponPrice") couponPrice: Double,
|
||||
// @Field("useCoupon") useCoupon: Int,
|
||||
@Field("tax") tax: Double,
|
||||
@Field("customerId") customerId: String,
|
||||
@Field("orderNum") orderNum: String,
|
||||
@Field("isUpdateOrder") isUpdateOrder: Int,
|
||||
@Field("planTimeMonthsCount") planTimeMonthsCount: Int,
|
||||
@Field("subscriptionId") subscriptionId: String
|
||||
): BaseResponse<AlipayOrderBean>
|
||||
|
||||
/*******************************************以上是国内版本接口end***********************************/
|
||||
|
||||
@@ -2,10 +2,12 @@ package com.abbidot.tracker.retrofit2
|
||||
|
||||
import com.abbidot.baselibrary.network.base.BaseNetworkApi
|
||||
import com.abbidot.baselibrary.util.AppUtils
|
||||
import com.abbidot.tracker.bean.AlipayOrderBean
|
||||
import com.abbidot.tracker.bean.FencesBean
|
||||
import com.abbidot.tracker.bean.PayResultBean
|
||||
import com.abbidot.tracker.bean.SetMealBean
|
||||
import com.abbidot.tracker.bean.SubscriptionsOrderBean
|
||||
import com.abbidot.tracker.bean.WXPayOrderBean
|
||||
import com.abbidot.tracker.constant.ConstantInt
|
||||
import okhttp3.MultipartBody
|
||||
import okhttp3.RequestBody
|
||||
@@ -1347,24 +1349,86 @@ object NetworkApi : BaseNetworkApi<INetworkService>(INetworkService.BASE_URL) {
|
||||
/**
|
||||
* 获取微信Prepay_id
|
||||
*/
|
||||
suspend fun getWxPayOrder(
|
||||
setMealBean: SetMealBean, deviceId: String, userId: String, username: String
|
||||
) = getResult {
|
||||
suspend fun getWxPayOrder(subscriptionsOrder: SubscriptionsOrderBean): Result<WXPayOrderBean> {
|
||||
subscriptionsOrder.apply {
|
||||
if (isUpdateOrder == ConstantInt.Type0) {
|
||||
orderNum = ""
|
||||
subscriptionId = ""
|
||||
}
|
||||
return getResult {
|
||||
service.getWxPayOrder(
|
||||
setMealBean.name, deviceId, setMealBean.accountFee, setMealBean.period, userId, username
|
||||
userId,
|
||||
deviceId,
|
||||
3,
|
||||
iccid,
|
||||
deviceOutId,
|
||||
username,
|
||||
mealName,
|
||||
mealDesc,
|
||||
mealId,
|
||||
mealPeriod,
|
||||
mealPrice,
|
||||
mealDiscountPrice,
|
||||
mealUnit,
|
||||
annualCareType,
|
||||
annualCarePrice,
|
||||
reactivation,
|
||||
reactivatePrice,
|
||||
totalAmountWithTax,
|
||||
planCategory,
|
||||
autoRenewPrice,
|
||||
tax,
|
||||
"",
|
||||
orderNum,
|
||||
isUpdateOrder,
|
||||
planTimeMonthsCount,
|
||||
subscriptionId
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取支付宝支付订单
|
||||
*/
|
||||
suspend fun getAlipayOrder(
|
||||
setMealBean: SetMealBean, deviceId: String, userId: String, username: String
|
||||
) = getResult {
|
||||
suspend fun getAlipayOrder(subscriptionsOrder: SubscriptionsOrderBean): Result<AlipayOrderBean> {
|
||||
subscriptionsOrder.apply {
|
||||
if (isUpdateOrder == ConstantInt.Type0) {
|
||||
orderNum = ""
|
||||
subscriptionId = ""
|
||||
}
|
||||
return getResult {
|
||||
service.getAlipayOrder(
|
||||
setMealBean.name, deviceId, setMealBean.accountFee, setMealBean.period, userId, username
|
||||
userId,
|
||||
deviceId,
|
||||
4,
|
||||
iccid,
|
||||
deviceOutId,
|
||||
username,
|
||||
mealName,
|
||||
mealDesc,
|
||||
mealId,
|
||||
mealPeriod,
|
||||
mealPrice,
|
||||
mealDiscountPrice,
|
||||
mealUnit,
|
||||
annualCareType,
|
||||
annualCarePrice,
|
||||
reactivation,
|
||||
reactivatePrice,
|
||||
totalAmountWithTax,
|
||||
planCategory,
|
||||
autoRenewPrice,
|
||||
tax,
|
||||
"",
|
||||
orderNum,
|
||||
isUpdateOrder,
|
||||
planTimeMonthsCount,
|
||||
subscriptionId
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************以上是国内版本接口end***********************************/
|
||||
}
|
||||
@@ -18,7 +18,6 @@ import com.google.android.gms.location.LocationRequest
|
||||
import com.google.android.gms.location.LocationResult
|
||||
import com.google.android.gms.location.LocationServices
|
||||
import com.google.android.gms.location.Priority
|
||||
import com.hjq.toast.Toaster
|
||||
|
||||
/**
|
||||
* 谷歌定位服务
|
||||
@@ -44,7 +43,6 @@ class GoogleLocationService : Service() {
|
||||
mLocationCallback = object : LocationCallback() {
|
||||
override fun onLocationResult(locationResult: LocationResult) {
|
||||
locationResult.lastLocation?.let {
|
||||
Toaster.show("谷歌定位成功")
|
||||
LogUtil.e("谷歌定位成功: ${it.latitude}, ${it.longitude}")
|
||||
setLocationData(it)
|
||||
XEventBus.post(EventName.LocationData, it)
|
||||
|
||||
@@ -50,8 +50,6 @@ import com.abbidot.tracker.ui.fragment.data.ActivityV2Fragment
|
||||
import com.abbidot.tracker.ui.fragment.data.RouteV3Fragment
|
||||
import com.abbidot.tracker.ui.fragment.map.MapV3Fragment
|
||||
import com.abbidot.tracker.ui.fragment.pet.PetV2Fragment
|
||||
import com.abbidot.tracker.util.BaiduLocationManager
|
||||
import com.abbidot.tracker.util.GoogleLocationManager
|
||||
import com.abbidot.tracker.util.Util
|
||||
import com.abbidot.tracker.util.ViewUtil
|
||||
import com.abbidot.tracker.util.bluetooth.SRBleUtil
|
||||
@@ -62,7 +60,6 @@ import com.abbidot.tracker.vm.FamilyViewModel
|
||||
import com.abbidot.tracker.vm.LogBleReportViewModel
|
||||
import com.clj.fastble.BleManager
|
||||
import com.google.android.material.navigation.NavigationBarView
|
||||
import com.qmuiteam.qmui.widget.QMUITopBar
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
@@ -127,7 +124,7 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
||||
// BleReportManage(mSocketSendMessageViewModel, mSocketUtilManage!!)
|
||||
// }
|
||||
|
||||
override fun getTopBar(): QMUITopBar? = null
|
||||
override fun getTopBar() = null
|
||||
|
||||
override fun initData() {
|
||||
isEdgeToEdgeAdapterNavigationBars = false
|
||||
@@ -802,32 +799,6 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始定位
|
||||
*/
|
||||
private fun startUpLocation() {
|
||||
LogUtil.e("开始定位")
|
||||
if (AppUtils.isChina()) {
|
||||
//30秒定位一次,定位精度为高精度
|
||||
BaiduLocationManager.startLocation(30)
|
||||
} else {
|
||||
GoogleLocationManager.startLocation()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止定位
|
||||
*/
|
||||
private fun stopUpLocation() {
|
||||
LogUtil.e("停止定位")
|
||||
if (AppUtils.isChina()) {
|
||||
BaiduLocationManager.stopLocation()
|
||||
} else {
|
||||
GoogleLocationManager.stopLocation()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// override fun onTrimMemory(level: Int) {
|
||||
// super.onTrimMemory(level)
|
||||
// LogUtil.e("系统级别:$level"+printLevel(level))
|
||||
@@ -868,7 +839,6 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
LogUtil.e("HomeV2Activity---------------onDestroy")
|
||||
stopUpLocation()
|
||||
stopCountDownConBle()
|
||||
mBleListenerReceiver?.let {
|
||||
unregisterReceiver(it)
|
||||
|
||||
@@ -6,6 +6,7 @@ import androidx.activity.viewModels
|
||||
import com.abbidot.baselibrary.constant.EventName
|
||||
import com.abbidot.baselibrary.eventbus.XEventBus
|
||||
import com.abbidot.baselibrary.util.AppUtils
|
||||
import com.abbidot.baselibrary.util.LogUtil
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.base.BaseActivity
|
||||
import com.abbidot.tracker.bean.FamilyBean
|
||||
@@ -39,10 +40,13 @@ class AddNewTracker1Activity :
|
||||
mViewBinding.apply {
|
||||
// ivChargePowerOnGif.load(R.drawable.charge_power_on)
|
||||
|
||||
if (!isFirstBind) {
|
||||
if (isFirstBind) {
|
||||
LogUtil.e("首次添加开始定位,添加wifi需要用到")
|
||||
startUpLocation()
|
||||
} else {
|
||||
tvChargePowerOnBackLoginBtn.visibility = View.GONE
|
||||
|
||||
}
|
||||
|
||||
setOnClickListenerViews(btnChargePowerOnNext, tvChargePowerOnBackLoginBtn)
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,14 @@ package com.abbidot.tracker.ui.activity.map
|
||||
import android.content.Intent
|
||||
import android.graphics.PorterDuff
|
||||
import android.graphics.Typeface
|
||||
import android.text.TextUtils
|
||||
import android.view.KeyEvent
|
||||
import android.view.View
|
||||
import android.widget.RelativeLayout
|
||||
import androidx.activity.viewModels
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.graphics.drawable.DrawableCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.isGone
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.fragment.app.Fragment
|
||||
@@ -152,6 +154,7 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
|
||||
isShowAllPet = MMKVUtil.getBoolean(MMKVKey.ShowAllPet)
|
||||
|
||||
mViewBinding.apply {
|
||||
edgeToEdgeAdapterBars(root, WindowInsetsCompat.Type.statusBars())
|
||||
ViewUtil.instance.viewRotationAnimator(
|
||||
ilLiveV2OperateLayout.ilLiveV2DataLightSwitch.ilDeviceLightBtnState.ivLedBtnState,
|
||||
true
|
||||
@@ -302,6 +305,12 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
|
||||
3 -> mViewBinding.llLiveV2StateLayout.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
//接收地图刷新位置通知
|
||||
XEventBus.observe(this, EventName.LocationData) { any: Any ->
|
||||
if (isShowDashed) {
|
||||
mHomeMapCommon.addUserAndPetLine()
|
||||
}
|
||||
}
|
||||
//获取当前宠物位置和围栏信息
|
||||
mMapViewModel.mMapDeviceLiveData.observe(this) {
|
||||
dealRequestResult(it, object : GetResultCallback {
|
||||
@@ -1121,7 +1130,10 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
|
||||
YoYo.with(Techniques.BounceInUp).duration(800).delay(400).onEnd {
|
||||
//蓝牙图标按钮显示动画
|
||||
ViewUtil.instance.viewShowFadeInAnimation(ivMapLiveV2BluetoothBtn)
|
||||
ViewUtil.instance.viewShowFadeInAnimation(ilLiveV3MapPetLocation.root)
|
||||
ilLiveV3MapPetLocation.let {
|
||||
if (!TextUtils.isEmpty(it.tvPetLocationReverseGeocode.text))
|
||||
ViewUtil.instance.viewShowFadeInAnimation(it.root)
|
||||
}
|
||||
//刷新定位按钮显示动画
|
||||
ViewUtil.instance.viewShowFadeInAnimation(ivMapLiveV2RefreshBtn)
|
||||
}.playOn(ilLiveV2OperateLayout.root)
|
||||
@@ -1152,7 +1164,10 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
|
||||
YoYo.with(Techniques.SlideOutDown).duration(600).onEnd {
|
||||
ilMapLiveV2IssueLayout.root.visibility = View.GONE
|
||||
YoYo.with(Techniques.BounceInUp).duration(600).onStart {
|
||||
ilLiveV3MapPetLocation.root.visibility = View.VISIBLE
|
||||
ilLiveV3MapPetLocation.let {
|
||||
if (!TextUtils.isEmpty(it.tvPetLocationReverseGeocode.text))
|
||||
it.root.visibility = View.VISIBLE
|
||||
}
|
||||
ilLiveV2OperateLayout.root.visibility = View.VISIBLE
|
||||
}.playOn(ilLiveV2OperateLayout.root)
|
||||
}.playOn(ilMapLiveV2IssueLayout.root)
|
||||
|
||||
@@ -131,7 +131,7 @@ class ChoosePlanActivity :
|
||||
// else if (l.mealUnit != ConstantString.PackageUnitYear) iterator.remove()
|
||||
}
|
||||
}
|
||||
if (list.size > 0) {
|
||||
if (list.isNotEmpty()) {
|
||||
list[0].selected = true
|
||||
mChoosePlanAdapter.setData(list, true)
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ class PaymentMethodActivity :
|
||||
|
||||
//设备充值类型,0=首次设备充值激活,1=已添加设备再次添加设备充值,2=给当前的设备续费或者升级套餐
|
||||
var mRechargeType = ConstantInt.Type1
|
||||
var mFragments = mutableListOf<Fragment>()
|
||||
val mPayFragments = mutableListOf<Fragment>()
|
||||
|
||||
//设备类型
|
||||
var mType = ConstantInt.Type1
|
||||
@@ -52,8 +52,8 @@ class PaymentMethodActivity :
|
||||
mRechargeType = getInt(ConstantString.RechargeType, ConstantInt.Type1)
|
||||
}
|
||||
|
||||
mFragments.add(CreditCardPaymentFragment.newInstance(mContext))
|
||||
mFragments.add(PaypalPaymentFragment.newInstance(mContext))
|
||||
mPayFragments.add(CreditCardPaymentFragment.newInstance(mContext))
|
||||
mPayFragments.add(PaypalPaymentFragment.newInstance(mContext))
|
||||
|
||||
mViewBinding.apply {
|
||||
rgSwitchPaymentMethod.setOnCheckedChangeListener { _, checkedId ->
|
||||
@@ -64,7 +64,7 @@ class PaymentMethodActivity :
|
||||
}
|
||||
|
||||
vp2SwitchPaymentMethod.let {
|
||||
it.adapter = ViewPagerAdapter(mFragments, this@PaymentMethodActivity)
|
||||
it.adapter = ViewPagerAdapter(mPayFragments, this@PaymentMethodActivity)
|
||||
ViewUtil.instance.setViewPager2Config(
|
||||
it, object : ViewPager2.OnPageChangeCallback() {
|
||||
override fun onPageSelected(position: Int) {
|
||||
@@ -95,9 +95,9 @@ class PaymentMethodActivity :
|
||||
override fun onResult(any: Any) {
|
||||
it.getOrNull()?.let { p ->
|
||||
mPaymentIDBean = p
|
||||
(mFragments[0] as CreditCardPaymentFragment).getCardData(p.stripeMethodInfo)
|
||||
if (mFragments.size > 1) {
|
||||
(mFragments[1] as PaypalPaymentFragment).showPaypalInfo()
|
||||
(mPayFragments[0] as CreditCardPaymentFragment).getCardData(p.stripeMethodInfo)
|
||||
if (mPayFragments.size > 1) {
|
||||
(mPayFragments[1] as PaypalPaymentFragment).showPaypalInfo()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,14 +136,12 @@ class PaymentSuccessActivity :
|
||||
//接收蓝牙返回数据
|
||||
XEventBus.observe(this, EventName.DeviceReceiveData) { receiveData: ReceiveDeviceData ->
|
||||
if (TextUtils.isEmpty(mMac)) return@observe
|
||||
mPayResult?.apply {
|
||||
if (mMac == receiveData.mac) {
|
||||
val data = receiveData.data
|
||||
// setButtonEnabled(mViewBinding.btnPaymentSuccessContinue, ConstantInt.Type1)
|
||||
parseData(data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mAddTrackerViewModel.mUpdatePayDeviceStateLiveData.observe(this) {
|
||||
|
||||
@@ -6,30 +6,40 @@ import android.view.Gravity
|
||||
import android.view.View
|
||||
import android.widget.RadioGroup
|
||||
import androidx.activity.viewModels
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.abbidot.baselibrary.constant.EventName
|
||||
import com.abbidot.baselibrary.constant.MMKVKey
|
||||
import com.abbidot.baselibrary.eventbus.XEventBus
|
||||
import com.abbidot.baselibrary.util.AppUtils
|
||||
import com.abbidot.baselibrary.util.LogUtil
|
||||
import com.abbidot.baselibrary.util.MMKVUtil
|
||||
import com.abbidot.baselibrary.util.Utils
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.adapter.SureSubscribeSummaryAdapter
|
||||
import com.abbidot.tracker.alipay.PayResult
|
||||
import com.abbidot.tracker.base.BaseActivity
|
||||
import com.abbidot.tracker.bean.MenuTxtBean
|
||||
import com.abbidot.tracker.bean.PackageBean
|
||||
import com.abbidot.tracker.bean.PayResultBean
|
||||
import com.abbidot.tracker.bean.SubscriptionsOrderBean
|
||||
import com.abbidot.tracker.constant.ConstantInt
|
||||
import com.abbidot.tracker.constant.ConstantString
|
||||
import com.abbidot.tracker.constant.GetResultCallback
|
||||
import com.abbidot.tracker.databinding.ActivitySureSubscriptionPlanBinding
|
||||
import com.abbidot.tracker.ui.activity.WebViewActivity
|
||||
import com.abbidot.tracker.util.ThirdPartyUtil
|
||||
import com.abbidot.tracker.util.Util
|
||||
import com.abbidot.tracker.util.ViewUtil
|
||||
import com.abbidot.tracker.vm.GeoCoderViewModel
|
||||
import com.abbidot.tracker.vm.GoogleLocationViewModel
|
||||
import com.abbidot.tracker.vm.SubscriptionManageViewModel
|
||||
import com.abbidot.tracker.vm.cn.PayCNViewModel
|
||||
import com.abbidot.tracker.widget.TypefaceRoundButton
|
||||
import com.alipay.sdk.app.PayTask
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
||||
import com.tencent.mm.opensdk.modelpay.PayReq
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlin.math.abs
|
||||
|
||||
class SureSubscriptionPlanActivity :
|
||||
@@ -39,6 +49,8 @@ class SureSubscriptionPlanActivity :
|
||||
private val mGoogleLocationViewModel: GoogleLocationViewModel by viewModels()
|
||||
private val mGeoCoderViewModel: GeoCoderViewModel by viewModels()
|
||||
|
||||
private val mPayCNViewModel: PayCNViewModel by viewModels()
|
||||
|
||||
private var mPackageBean: PackageBean? = null
|
||||
private var mOrderBean: SubscriptionsOrderBean? = null
|
||||
|
||||
@@ -74,6 +86,7 @@ class SureSubscriptionPlanActivity :
|
||||
|
||||
//国内支付方式
|
||||
private var mPayCnOption = ConstantInt.Type0
|
||||
private var mPayResultBean: PayResultBean? = null
|
||||
|
||||
override fun getTopBar() = mViewBinding.sureSubscribePlan1TopBar.titleTopBar
|
||||
|
||||
@@ -150,7 +163,8 @@ class SureSubscriptionPlanActivity :
|
||||
setOnClickListenerViews(
|
||||
btnSureSubscribePlan1Continue,
|
||||
ilSubscribePlanDetail.tvSureSubscribePlanTermsConditions,
|
||||
ilSubscribePlanInsurance.ivSureSubscribePlanInsurance
|
||||
ilSubscribePlanInsurance.ivSureSubscribePlanInsurance,
|
||||
svSubscribePlanLayout
|
||||
)
|
||||
|
||||
if (AppUtils.isChina(AppUtils.SWITCH_MAP_TYPE)) {
|
||||
@@ -158,7 +172,10 @@ class SureSubscriptionPlanActivity :
|
||||
} else {
|
||||
showNoCancelableLoading(true)
|
||||
setButtonEnabled(btnSureSubscribePlan1Continue, ConstantInt.Type0)
|
||||
mGoogleLocationViewModel.getLastLocation(mContext)
|
||||
// mGoogleLocationViewModel.getLastLocation(mContext)
|
||||
mSubscriptionViewModel.getTaxRateByRegionName(
|
||||
mGeoCoderViewModel.mCountryCode, mGeoCoderViewModel.mRegion
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -329,15 +346,6 @@ class SureSubscriptionPlanActivity :
|
||||
}
|
||||
|
||||
override fun liveDataObserve() {
|
||||
XEventBus.observe(this, EventName.PayBack) {
|
||||
if (isUpgrade) {
|
||||
//升级套餐成功
|
||||
MMKVUtil.putInt(MMKVKey.MealType, ConstantInt.PremiumPackage)
|
||||
}
|
||||
//通知首页刷新宠物信息,防止没有加载,显示Fragment使用老的套餐数据,升级套餐和套餐过期充值使用
|
||||
XEventBus.post(EventName.RefreshPackage)
|
||||
finish()
|
||||
}
|
||||
mSubscriptionViewModel.apply {
|
||||
mReactivationFeeLiveData.observe(this@SureSubscriptionPlanActivity) {
|
||||
dealRequestResult(it, object : GetResultCallback {
|
||||
@@ -413,16 +421,98 @@ class SureSubscriptionPlanActivity :
|
||||
}
|
||||
}
|
||||
mGoogleLocationViewModel.mGoogleLocationLiveData.observe(this) {
|
||||
// mGeoCoderViewModel.getLatLonAddress(it.latitude, it.longitude)
|
||||
mSubscriptionViewModel.getTaxRateByRegionName(
|
||||
mGeoCoderViewModel.mCountryCode, mGeoCoderViewModel.mRegion
|
||||
)
|
||||
mGeoCoderViewModel.getLatLonAddress(it.latitude, it.longitude)
|
||||
}
|
||||
mGeoCoderViewModel.mLatLonAddressLiveData.observe(this) {
|
||||
mSubscriptionViewModel.getTaxRateByRegionName(
|
||||
mGeoCoderViewModel.mCountryCode, mGeoCoderViewModel.mRegion
|
||||
)
|
||||
}
|
||||
|
||||
if (AppUtils.isChina()) {
|
||||
//微信支付宝支付成功返回
|
||||
XEventBus.observe(this, EventName.PaySuccessCn) {
|
||||
mPayResultBean?.apply {
|
||||
//通知首页刷新宠物信息,防止没有加载,显示Fragment使用老的套餐数据,升级套餐和套餐过期充值使用
|
||||
XEventBus.post(EventName.RefreshPackage)
|
||||
Intent(mContext, PaymentSuccessActivity::class.java).let { i ->
|
||||
rechargeType = mRechargeType
|
||||
mOrderBean?.let { o ->
|
||||
deviceId = o.deviceId
|
||||
}
|
||||
deviceType = mType
|
||||
i.putExtra(ConstantString.Amount, this)
|
||||
startActivityFinish(i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mPayCNViewModel.apply {
|
||||
mGetWxPayOrderLiveData.observe(this@SureSubscriptionPlanActivity) {
|
||||
dealRequestResult(it, object : GetResultCallback {
|
||||
override fun onResult(any: Any) {
|
||||
showNoCancelableLoading(false)
|
||||
val data = it.getOrNull()
|
||||
data?.let { d ->
|
||||
mPayResultBean = d.payData
|
||||
val request = PayReq()
|
||||
request.appId = d.appid
|
||||
request.partnerId = d.partnerid
|
||||
request.prepayId = d.prepayid
|
||||
request.packageValue = d.packageStr
|
||||
request.nonceStr = d.noncestr
|
||||
request.timeStamp = d.timestamp
|
||||
request.sign = d.sign
|
||||
ThirdPartyUtil.mApi.sendReq(request)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onRequestError(exceptionCode: String?) {
|
||||
showNoCancelableLoading(false)
|
||||
}
|
||||
})
|
||||
}
|
||||
mGetAlipayOrderLiveData.observe(this@SureSubscriptionPlanActivity) {
|
||||
dealRequestResult(it, object : GetResultCallback {
|
||||
override fun onResult(any: Any) {
|
||||
showNoCancelableLoading(false)
|
||||
val data = it.getOrNull()
|
||||
data?.let { d ->
|
||||
mPayResultBean = d.payData
|
||||
//支付宝支付必须异步调用
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
val alipay = PayTask(mActivity)
|
||||
//订单信息
|
||||
val result = alipay.payV2(d.orderString, true)
|
||||
val payResult = PayResult(result as Map<String, String>)
|
||||
//同步返回需要验证的信息
|
||||
LogUtil.e("支付宝支付结果回调:$payResult")
|
||||
mPayCNViewModel.alipayResultCallback(
|
||||
this@SureSubscriptionPlanActivity,
|
||||
payResult.resultStatus,
|
||||
mOrderBean?.totalAmountWithTax ?: mTotalWithTaxMoney
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onRequestError(exceptionCode: String?) {
|
||||
showNoCancelableLoading(false)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
} else {
|
||||
XEventBus.observe(this, EventName.PayBack) {
|
||||
if (isUpgrade) {
|
||||
//升级套餐成功
|
||||
MMKVUtil.putInt(MMKVKey.MealType, ConstantInt.PremiumPackage)
|
||||
}
|
||||
//通知首页刷新宠物信息,防止没有加载,显示Fragment使用老的套餐数据,升级套餐和套餐过期充值使用
|
||||
XEventBus.post(EventName.RefreshPackage)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateMoney() {
|
||||
@@ -479,7 +569,28 @@ class SureSubscriptionPlanActivity :
|
||||
mealDesc =
|
||||
mViewBinding.ilSubscribePlanDetail.tvSureSubscribePlanMoney.text.toString() + mViewBinding.ilSubscribePlanDetail.tvSureSubscribePlanPer.text.toString()
|
||||
}
|
||||
totalAmountWithTax = Utils.formatDecimal(mTotalWithTaxMoney, 2).toDouble()
|
||||
// totalAmountWithTax = Utils.formatDecimal(mTotalWithTaxMoney, 2).toDouble()
|
||||
totalAmountWithTax = 0.01
|
||||
|
||||
if (AppUtils.isChina()) {
|
||||
if (null == mRechargePayOptionsCn) {
|
||||
mRechargePayOptionsCn = ViewUtil.instance.showBottomSheet(
|
||||
mContext, R.layout.layout_recharge_pay_options_cn
|
||||
).apply {
|
||||
setCancelable(true)
|
||||
setOnClickListenerViews(findViewById<TypefaceRoundButton>(R.id.btn_pay_cn_chose_sure))
|
||||
findViewById<RadioGroup>(R.id.rg_pay_cn_chose)?.let {
|
||||
it.setOnCheckedChangeListener { _, checkedId ->
|
||||
when (checkedId) {
|
||||
R.id.rb_pay_cn_chose_alipay -> mPayCnOption = ConstantInt.Type0
|
||||
|
||||
R.id.rb_pay_cn_chose_wxpay -> mPayCnOption = ConstantInt.Type1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else mRechargePayOptionsCn?.show()
|
||||
} else {
|
||||
Intent(mContext, PaymentMethodActivity::class.java).let {
|
||||
it.putExtra(ConstantString.LkSetMeal, this)
|
||||
it.putExtra(ConstantString.Type, mType)
|
||||
@@ -488,38 +599,26 @@ class SureSubscriptionPlanActivity :
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 去支付
|
||||
*/
|
||||
private fun goPayCn() {
|
||||
mOrderBean?.apply {
|
||||
showNoCancelableLoading(true)
|
||||
when (mPayCnOption) {
|
||||
0 -> mPayCNViewModel.getAlipayOrder(this)
|
||||
1 -> mPayCNViewModel.getWxPayOrder(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
mViewBinding.apply {
|
||||
when (v!!) {
|
||||
btnSureSubscribePlan1Continue -> {
|
||||
if (AppUtils.isChina()) {
|
||||
if (null == mRechargePayOptionsCn) {
|
||||
mRechargePayOptionsCn = ViewUtil.instance.showBottomSheet(
|
||||
mContext,
|
||||
R.layout.layout_recharge_pay_options_cn
|
||||
).apply {
|
||||
setOnClickListenerViews(findViewById<TypefaceRoundButton>(R.id.btn_pay_cn_chose_sure))
|
||||
findViewById<RadioGroup>(R.id.rg_pay_cn_chose)?.let {
|
||||
it.setOnCheckedChangeListener { _, checkedId ->
|
||||
when (checkedId) {
|
||||
R.id.rb_pay_cn_chose_alipay -> mPayCnOption =
|
||||
ConstantInt.Type0
|
||||
|
||||
R.id.rb_pay_cn_chose_wxpay -> mPayCnOption =
|
||||
ConstantInt.Type1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
createOrder()
|
||||
}
|
||||
|
||||
ilSubscribePlanDetail.tvSureSubscribePlanTermsConditions ->
|
||||
ViewUtil.instance.goHtmlAssetContent(
|
||||
btnSureSubscribePlan1Continue -> createOrder()
|
||||
ilSubscribePlanDetail.tvSureSubscribePlanTermsConditions -> ViewUtil.instance.goHtmlAssetContent(
|
||||
mActivity,
|
||||
getString(R.string.txt_service_contract),
|
||||
getString(R.string.txt_subscription_terms_conditions_html)
|
||||
@@ -539,9 +638,12 @@ class SureSubscriptionPlanActivity :
|
||||
}
|
||||
|
||||
when (v!!.id) {
|
||||
R.id.btn_pay_cn_chose_sure -> {
|
||||
showToast("$mPayCnOption")
|
||||
R.id.btn_pay_cn_chose_sure -> goPayCn()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
mRechargePayOptionsCn?.dismiss()
|
||||
}
|
||||
}
|
||||
@@ -89,6 +89,10 @@ class AccountCnPhoneFragment :
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onInterceptCode() {
|
||||
setButtonEnabled(mViewBinding.btnAccountCnPhoneContinue, ConstantInt.Type1)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,11 +265,17 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
LogUtil.e("MapV2Fragment 地图加载好了${getHomeV2Activity()?.mPetList}")
|
||||
// mHomeV2Activity.mDataViewModel.getHomeBindPetList(mHomeV2Activity)
|
||||
getHomeV2Activity()?.apply {
|
||||
if (mPetList.size > 0) showPetNameAndHead(mSelectPetPosition)
|
||||
if (mPetList.isNotEmpty()) showPetNameAndHead(mSelectPetPosition)
|
||||
}
|
||||
}
|
||||
|
||||
override fun liveDataObserve() {
|
||||
//接收地图刷新位置通知
|
||||
XEventBus.observe(viewLifecycleOwner, EventName.LocationData) { any: Any ->
|
||||
if (isShowDashed) {
|
||||
mHomeMapCommon.addUserAndPetLine()
|
||||
}
|
||||
}
|
||||
//获取当前宠物位置和围栏信息
|
||||
mMapViewModel.apply {
|
||||
mMapDeviceLiveData.observe(this@MapV3Fragment) {
|
||||
@@ -1077,7 +1083,8 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
showToast(R.string.txt_pet_close, gravity = Gravity.CENTER)
|
||||
} else {
|
||||
SRBleUtil.instance.isConnectBleSendCmdData(
|
||||
pet.macID, SRBleCmdUtil.instance.refreshLocation(0x2C, userGpsLat, userGpsLon)
|
||||
pet.macID,
|
||||
SRBleCmdUtil.instance.refreshLocation(0x2C, userGpsLat, userGpsLon)
|
||||
)
|
||||
refreshLocationAnim()
|
||||
}
|
||||
|
||||
@@ -215,8 +215,8 @@ abstract class BaseBaiduMapFragment :
|
||||
.build()
|
||||
setMyLocationData(locData)
|
||||
val bdLocation = BDLocation()
|
||||
bdLocation.latitude = userGpsLat
|
||||
bdLocation.longitude = userGpsLon
|
||||
bdLocation.latitude =it.latitude
|
||||
bdLocation.longitude = it.longitude
|
||||
locationSuccess(bdLocation)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,6 +293,9 @@ class HomeMapBaiduMapFragment : BaseBaiduMapFragment() {
|
||||
*/
|
||||
fun addUserAndPetLine() {
|
||||
mBaiduMap?.apply {
|
||||
val userGpsLat = MMKVUtil.getDouble(MMKVKey.UserGpsLat)
|
||||
val userGpsLon = MMKVUtil.getDouble(MMKVKey.UserGpsLon)
|
||||
mUserLatLng = getBaiduMapLatLng(userGpsLat, userGpsLon)
|
||||
mUserLatLng?.let { u ->
|
||||
mPetLatLng?.let { p ->
|
||||
mUserAndPetLine?.remove()
|
||||
|
||||
@@ -233,6 +233,9 @@ class HomeMapGoogleMapFragmentV3 : BaseGoogleMapFragment() {
|
||||
*/
|
||||
fun addUserAndPetLine() {
|
||||
mGoogleMap?.apply {
|
||||
val userGpsLat = MMKVUtil.getDouble(MMKVKey.UserGpsLat)
|
||||
val userGpsLon = MMKVUtil.getDouble(MMKVKey.UserGpsLon)
|
||||
mUserLatLng = LatLng(userGpsLat, userGpsLon)
|
||||
mUserLatLng?.let { u ->
|
||||
mPetLatLng?.let { p ->
|
||||
mUserAndPetLine?.remove()
|
||||
|
||||
@@ -198,7 +198,7 @@ class CreditCardPaymentFragment : BaseFragment<FragmentCreditCardPaymentBinding>
|
||||
}
|
||||
|
||||
private fun setCheckAndPrimaryState(list: MutableList<CreditCardBean>) {
|
||||
if (list.size == 0) {
|
||||
if (list.isEmpty()) {
|
||||
mViewBinding.apply {
|
||||
tvCreditCardPaymentChoose.visibility = View.GONE
|
||||
btnCreditCardPaymentAdd.visibility = View.GONE
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
package com.abbidot.tracker.deprecated.ui.activity.vm
|
||||
package com.abbidot.tracker.vm.cn
|
||||
|
||||
import android.content.Intent
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.abbidot.baselibrary.constant.MMKVKey
|
||||
import com.abbidot.baselibrary.constant.EventName
|
||||
import com.abbidot.baselibrary.eventbus.XEventBus
|
||||
import com.abbidot.baselibrary.util.LogUtil
|
||||
import com.abbidot.baselibrary.util.MMKVUtil
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.base.BaseActivity
|
||||
import com.abbidot.tracker.bean.AlipayOrderBean
|
||||
import com.abbidot.tracker.bean.SetMealBean
|
||||
import com.abbidot.tracker.bean.SubscriptionsOrderBean
|
||||
import com.abbidot.tracker.bean.WXPayOrderBean
|
||||
import com.abbidot.tracker.constant.ConstantInt
|
||||
import com.abbidot.tracker.constant.ConstantString
|
||||
import com.abbidot.tracker.deprecated.ui.activity.profile.recharge.PaymentResultActivity
|
||||
import com.abbidot.tracker.retrofit2.NetworkApi
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@@ -31,12 +27,9 @@ class PayCNViewModel : ViewModel() {
|
||||
/**
|
||||
* 获取微信支付Prepay_id
|
||||
*/
|
||||
fun getWxPayOrder(activity: BaseActivity<*>, setMealBean: SetMealBean, deviceId: String) {
|
||||
activity.showLoading(true)
|
||||
fun getWxPayOrder(subscriptionsOrder: SubscriptionsOrderBean) {
|
||||
viewModelScope.launch {
|
||||
val userId = MMKVUtil.getString(MMKVKey.UserId)
|
||||
val userName = MMKVUtil.getString(MMKVKey.UserName)
|
||||
val result = NetworkApi.getWxPayOrder(setMealBean, deviceId, userId, userName)
|
||||
val result = NetworkApi.getWxPayOrder(subscriptionsOrder)
|
||||
mGetWxPayOrderLiveData.value = result
|
||||
}
|
||||
}
|
||||
@@ -44,12 +37,9 @@ class PayCNViewModel : ViewModel() {
|
||||
/**
|
||||
* 获取支付宝支付订单
|
||||
*/
|
||||
fun getAlipayOrder(activity: BaseActivity<*>, setMealBean: SetMealBean, deviceId: String) {
|
||||
activity.showLoading(true)
|
||||
fun getAlipayOrder(subscriptionsOrder: SubscriptionsOrderBean) {
|
||||
viewModelScope.launch {
|
||||
val userId = MMKVUtil.getString(MMKVKey.UserId)
|
||||
val userName = MMKVUtil.getString(MMKVKey.UserName)
|
||||
val result = NetworkApi.getAlipayOrder(setMealBean, deviceId, userId, userName)
|
||||
val result = NetworkApi.getAlipayOrder(subscriptionsOrder)
|
||||
mGetAlipayOrderLiveData.value = result
|
||||
}
|
||||
}
|
||||
@@ -63,11 +53,12 @@ class PayCNViewModel : ViewModel() {
|
||||
"9000" -> {
|
||||
activity.showToast(R.string.txt_pay_success)
|
||||
//支付成功
|
||||
LogUtil.e("WXPayEntryActivity", "支付成功")
|
||||
val intent = Intent(activity, PaymentResultActivity::class.java)
|
||||
intent.putExtra(ConstantString.Amount, price)
|
||||
intent.putExtra(ConstantString.Type, ConstantInt.Type1)
|
||||
activity.startActivity(intent)
|
||||
LogUtil.Companion.e("WXPayEntryActivity", "支付成功")
|
||||
// val intent = Intent(activity, PaymentResultActivity::class.java)
|
||||
// intent.putExtra(ConstantString.Amount, price)
|
||||
// intent.putExtra(ConstantString.Type, ConstantInt.Type1)
|
||||
// activity.startActivity(intent)
|
||||
XEventBus.post(EventName.PaySuccessCn)
|
||||
}
|
||||
//"8000"代表支付结果因为支付渠道原因或者系统原因还在等待支付结果确认,最终交易是否成功以服务端异步通知为准
|
||||
"8000" -> activity.showToast("支付结果确认中")
|
||||
@@ -1,11 +1,9 @@
|
||||
package com.abbidot.tracker.wxapi
|
||||
|
||||
import android.content.Intent
|
||||
import com.abbidot.baselibrary.constant.EventName
|
||||
import com.abbidot.baselibrary.eventbus.XEventBus
|
||||
import com.abbidot.baselibrary.util.LogUtil
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.constant.ConstantInt
|
||||
import com.abbidot.tracker.constant.ConstantString
|
||||
import com.abbidot.tracker.deprecated.ui.activity.profile.recharge.PaymentResultActivity
|
||||
import com.hjq.toast.Toaster
|
||||
import com.tencent.mm.opensdk.modelbase.BaseResp
|
||||
|
||||
@@ -23,15 +21,18 @@ class WXPayEntryActivity : WXBaseActivity() {
|
||||
Toaster.show(R.string.txt_pay_success)
|
||||
//支付成功
|
||||
LogUtil.e("WXPayEntryActivity", "支付成功")
|
||||
val intent = Intent(this, PaymentResultActivity::class.java)
|
||||
intent.putExtra(ConstantString.Type, ConstantInt.Type1)
|
||||
startActivity(intent)
|
||||
// val intent = Intent(this, PaymentResultActivity::class.java)
|
||||
// intent.putExtra(ConstantString.Type, ConstantInt.Type1)
|
||||
// startActivity(intent)
|
||||
XEventBus.post(EventName.PaySuccessCn)
|
||||
}
|
||||
|
||||
BaseResp.ErrCode.ERR_USER_CANCEL -> {
|
||||
Toaster.show(R.string.txt_cancel_pay)
|
||||
//取消支付
|
||||
LogUtil.e("WXPayEntryActivity", "取消支付")
|
||||
}
|
||||
|
||||
else -> {
|
||||
Toaster.show(R.string.txt_pay_fail)
|
||||
//支付失败
|
||||
|
||||
BIN
app/src/main/res/drawable-xhdpi/icon_device_high_battery_bg.png
Normal file
|
After Width: | Height: | Size: 300 B |
BIN
app/src/main/res/drawable-xhdpi/icon_device_low_battery_bg.png
Normal file
|
After Width: | Height: | Size: 300 B |
|
After Width: | Height: | Size: 300 B |
BIN
app/src/main/res/drawable-xxhdpi/icon_device_high_battery_bg.png
Normal file
|
After Width: | Height: | Size: 438 B |
BIN
app/src/main/res/drawable-xxhdpi/icon_device_low_battery_bg.png
Normal file
|
After Width: | Height: | Size: 443 B |
|
After Width: | Height: | Size: 438 B |
|
After Width: | Height: | Size: 530 B |
BIN
app/src/main/res/drawable-xxxhdpi/icon_device_low_battery_bg.png
Normal file
|
After Width: | Height: | Size: 530 B |
|
After Width: | Height: | Size: 530 B |
@@ -1,18 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:strokeWidth="1"
|
||||
android:pathData="M2,12C2,9.172 2,7.757 2.879,6.879C3.757,6 5.172,6 8,6H13C15.828,6 17.243,6 18.121,6.879C19,7.757 19,9.172 19,12C19,14.828 19,16.243 18.121,17.121C17.243,18 15.828,18 13,18H8C5.172,18 3.757,18 2.879,17.121C2,16.243 2,14.828 2,12Z"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#0F1719"
|
||||
android:strokeLineCap="round"/>
|
||||
<path
|
||||
android:strokeWidth="1"
|
||||
android:pathData="M19,9.5L20.027,9.671C20.708,9.785 21.049,9.842 21.308,10.007C21.562,10.169 21.761,10.404 21.88,10.682C22,10.964 22,11.309 22,12C22,12.691 22,13.036 21.88,13.318C21.761,13.596 21.562,13.831 21.308,13.993C21.049,14.158 20.708,14.215 20.027,14.329L19,14.5"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#0F1719"
|
||||
android:strokeLineCap="round"/>
|
||||
</vector>
|
||||
@@ -7,6 +7,13 @@
|
||||
android:orientation="vertical"
|
||||
tools:context=".ui.activity.map.LiveActivityV3">
|
||||
|
||||
<include
|
||||
android:id="@+id/ll_live_v2_map_top_pet"
|
||||
layout="@layout/layout_top_pet_data_small"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/dp_8" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
@@ -28,19 +35,11 @@
|
||||
layout="@layout/layout_map_device_battery" />
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<include
|
||||
android:id="@+id/ll_live_v2_map_top_pet"
|
||||
layout="@layout/layout_top_pet_data_small"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="@dimen/dp_8"
|
||||
android:layout_marginTop="@dimen/dp_40" />
|
||||
|
||||
<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout
|
||||
android:id="@+id/ll_live_v2_state_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_34"
|
||||
android:layout_below="@id/ll_live_v2_map_top_pet"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:gravity="center_vertical"
|
||||
@@ -72,8 +71,7 @@
|
||||
layout="@layout/item_home_map_device_msg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/ll_live_v2_state_layout"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/dp_6"
|
||||
android:visibility="gone" />
|
||||
|
||||
@@ -81,7 +79,6 @@
|
||||
android:id="@+id/rv_map_live_v2_device_state"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/ll_live_v2_map_top_pet"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginTop="@dimen/dp_18"
|
||||
android:layout_marginEnd="@dimen/dp_12"
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
style="@style/my_TextView_style_v2"
|
||||
android:layout_marginStart="@dimen/dp_12"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:background="@drawable/icon_device_battery_bg_svg"
|
||||
android:background="@drawable/icon_device_high_battery_bg"
|
||||
android:text="0 "
|
||||
android:textColor="@color/select_color"
|
||||
android:textSize="@dimen/textSize8" />
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<string name="pet_manage_weight">%d lb</string>
|
||||
<string name="txt_about_version">Version%s</string>
|
||||
<string name="txt_service_contract">Allgemeine Geschäftsbedingungen</string>
|
||||
<string name="txt_read_and_accept">Datenschutzrichtlinie & Nutzungsbedingungen akzeptieren</string>
|
||||
<string name="txt_read_and_accept">Ich akzeptiere die Datenschutzrichtlinie und Bedingungen.</string>
|
||||
<string name="txt_device_has_bind">Der Tracker ist mit %s gekoppelt.</string>
|
||||
<string name="txt_activity_goal">Aktivitätsziel</string>
|
||||
<string name="txt_end_time">Endzeit</string>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<string name="pet_manage_weight">%d lb</string>
|
||||
<string name="txt_about_version">Version%s</string>
|
||||
<string name="txt_service_contract">Conditions générales</string>
|
||||
<string name="txt_read_and_accept">Accepter la politique de confidentialité & Tles conditions.</string>
|
||||
<string name="txt_read_and_accept">J’accepte la Politique de confidentialité et les Conditions.</string>
|
||||
<string name="txt_device_has_bind">Le traceur est associé à %s</string>
|
||||
<string name="txt_activity_goal">Objectif d’activité</string>
|
||||
<string name="txt_end_time">Heure de fin</string>
|
||||
|
||||
@@ -35,6 +35,7 @@ import androidx.annotation.StringDef
|
||||
EventName.LiveAutoEnd,
|
||||
EventName.LiveOpenTimeOut,
|
||||
EventName.SetGoal,
|
||||
EventName.PaySuccessCn,
|
||||
EventName.LocationData,
|
||||
EventName.BluetoothSwitch,
|
||||
EventName.PostValue,
|
||||
@@ -70,6 +71,7 @@ annotation class EventName {
|
||||
|
||||
//支付成功返回
|
||||
const val PayBack = "payBack"
|
||||
const val PaySuccessCn = "paySuccessCn"
|
||||
const val HistoryDataSnapshot = "historyDataSnapshot"
|
||||
const val ActiveGoal = "activeGoal"
|
||||
const val UpdateReportInterval = "updateReportInterval"
|
||||
|
||||
@@ -94,7 +94,7 @@ class AppUtils {
|
||||
* 是否是国内
|
||||
*/
|
||||
fun isChina(type: String = SWITCH_PAGE_TYPE): Boolean {
|
||||
return false
|
||||
return true
|
||||
if (isDebug()) {
|
||||
if (type == SWITCH_MAP_TYPE && MMKVUtil.getBoolean(MMKVKey.OnlyGoogleMap, false)) {
|
||||
//只启用谷歌地图
|
||||
|
||||