中建365-二期开发-商城开发/电子围栏

develop
wlh 1 year ago
parent eda1955a7e
commit 52075ffabc

@ -303,6 +303,13 @@
android:screenOrientation="portrait" />
<activity android:name="com.zj365.mime.act.electronicfence.ElectronicFenceSettingAct"
android:screenOrientation="portrait" />
<activity android:name="com.zj365.mime.act.electronicfence.ElectronicAddressChooseAct"
android:launchMode="singleTop"
android:screenOrientation="portrait" />
<activity android:name="com.zj365.mime.act.electronicfence.ElectronicAddOrModifyAct"
android:launchMode="singleTop"
android:screenOrientation="portrait" />

@ -53,6 +53,7 @@ class DietManagementAct : BaseVmAct<BaseVm>(){
"web_site_url",
"${BuildConfig.h5url}pages/index/index?pageId=cookbook"
)
bundle.putBoolean("isShowTitle",false)
RouteManager.goAct(ARouterUrl.H5_ACT, bundle)
}
// var url = "${BuildConfig.}"
@ -67,6 +68,7 @@ class DietManagementAct : BaseVmAct<BaseVm>(){
"web_site_url",
"${BuildConfig.h5url}pages/index/index?pageId=herbal"
)
bundle.putBoolean("isShowTitle",false)
RouteManager.goAct(ARouterUrl.H5_ACT, bundle)
}

@ -1,5 +1,6 @@
package com.zj365.dc.activity.shop
import android.content.Intent
import android.view.LayoutInflater
import android.view.View
import android.widget.ImageView
@ -7,19 +8,27 @@ import android.widget.LinearLayout
import android.widget.TextView
import com.alibaba.android.arouter.facade.annotation.Route
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.tamsiree.rxkit.RxActivityTool
import com.xty.base.act.BaseTenCentWebViewActivity
import com.xty.base.act.BaseVmAct
import com.xty.base.model.ChooseAddressBean
import com.xty.base.model.ChooseCouponBean
import com.xty.base.model.CreateOrderBean
import com.xty.base.utils.PayUtils
import com.xty.base.vm.BaseVm
import com.xty.common.arouter.ARouterUrl
import com.xty.common.arouter.RouteManager
import com.xty.common.event.ReChangeEvent
import com.xty.common.setImage
import com.xty.common.util.SpannableUtils
import com.xty.network.model.ShopGoodsOrderBean
import com.zj365.dc.BuildConfig
import com.zj365.dc.activity.DeviceChoiceAct
import com.zj365.dc.databinding.ActCreateGoodsOrderBinding
import com.zj365.dc.vm.ShopMallVm
import com.zj365.health.R
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
@Route(path = ARouterUrl.CREATE_SHOP_ORDER_ACT)
class CreateGoodsOrderAct : BaseVmAct<ShopMallVm>() {
@ -32,6 +41,10 @@ class CreateGoodsOrderAct : BaseVmAct<ShopMallVm>() {
var bottomSheetDialog: BottomSheetDialog? = null
companion object{
const val REQUEST_ADDRESS = 0x000011
const val REQUEST_COUP = 0x000012
}
override fun liveObserver() {
mViewModel.createOrderLiveData.observe(this){
@ -65,7 +78,7 @@ class CreateGoodsOrderAct : BaseVmAct<ShopMallVm>() {
binding.tvPlatformDiscounts.text = "${(bean.ori_price * bean.skuNum) - (bean.skuPrice * bean.skuNum)}"
if (bean.delivery_mode == 0){ //0,无需发货1需要发货
binding.rxAddress.visibility = View.GONE
// binding.rxAddress.visibility = View.GONE
}else{
binding.rxAddress.visibility = View.VISIBLE
}
@ -86,7 +99,7 @@ class CreateGoodsOrderAct : BaseVmAct<ShopMallVm>() {
"web_site_url",
"${BuildConfig.h5url}pages/index/index?pageId=address&type=order"
)
RouteManager.goAct(ARouterUrl.H5_ACT, bundle)
RouteManager.goActRequest(ARouterUrl.H5_ACT, this@CreateGoodsOrderAct,REQUEST_ADDRESS,bundle)
}
@ -96,11 +109,42 @@ class CreateGoodsOrderAct : BaseVmAct<ShopMallVm>() {
"web_site_url",
"${BuildConfig.h5url}pages/index/index?pageId=coupon&type=order"
)
RouteManager.goAct(ARouterUrl.H5_ACT, bundle)
RouteManager.goActRequest(ARouterUrl.H5_ACT, this@CreateGoodsOrderAct,REQUEST_COUP,bundle)
}
}
override fun setLayout()=binding.root
@Subscribe(threadMode = ThreadMode.MAIN)
fun paySuccess(event: ReChangeEvent){
RouteManager.goAct(ARouterUrl.SHOP_ORDER_LIST_ACT)
RxActivityTool.finishActivity(BaseTenCentWebViewActivity::class.java)
finish()
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if(resultCode == RESULT_OK){
when(requestCode){
REQUEST_ADDRESS ->{
var addressBean = data?.extras!!.getParcelable<ChooseAddressBean>("address")
if (addressBean != null) {
addrId = addressBean.id
binding.tvChooseAddress.text = "${addressBean.province}${addressBean.city}${addressBean.district}${addressBean.address}"
}
}
REQUEST_COUP ->{
var couponBean = data?.extras!!.getParcelable<ChooseCouponBean>("coupon")
if (couponBean != null) {
couponsId = couponBean.id
binding.tvDiscounts.text = "可优惠${couponBean.as_amount}"
}
}
}
}
}
}

@ -1,16 +1,22 @@
package com.zj365.dc.activity.shop
import android.text.TextUtils
import android.view.KeyEvent
import android.view.LayoutInflater
import android.view.View
import android.view.inputmethod.EditorInfo
import android.widget.TextView
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import com.alibaba.android.arouter.facade.annotation.Route
import com.tamsiree.rxkit.RxKeyboardTool
import com.xty.base.act.BaseListAct
import com.xty.base.act.BaseVmAct
import com.xty.common.Const
import com.xty.common.R
import com.xty.common.arouter.ARouterUrl
import com.xty.common.arouter.RouteManager
import com.xty.common.util.CommonToastUtils
import com.xty.network.model.GoodsRecordsBean
import com.xty.network.model.ShopCategoryBean
import com.zj365.dc.BuildConfig
@ -83,6 +89,7 @@ class ShopCategoryActivity : BaseVmAct<ShopMallVm>() {
"web_site_url",
"${BuildConfig.h5url}pages/index/index?pageId=commodityDetail&id=${bean.id}"
)
bundle.putBoolean("isShowTitle",false)
RouteManager.goAct(ARouterUrl.H5_ACT, bundle)
}
@ -135,6 +142,27 @@ class ShopCategoryActivity : BaseVmAct<ShopMallVm>() {
}
mViewModel.getGoodsCategory(categoryId)
binding.etSearch.setOnEditorActionListener(object : TextView.OnEditorActionListener {
override fun onEditorAction(p0: TextView?, p1: Int, p2: KeyEvent?): Boolean {
if(p1 == EditorInfo.IME_ACTION_SEARCH){
goodsName = binding.etSearch.text.toString().trim()
if(TextUtils.isEmpty(goodsName)){
CommonToastUtils.showToast("请输入搜索内容")
return true
}
page = 1
mViewModel.getGoodsList(goodsName,categoryId,0,page)
//mViewModel.getGoodsList(goodsName,0L,0,page)
RxKeyboardTool.hideSoftInput(this@ShopCategoryActivity)
return true
}
return false
}
})
}

@ -4,6 +4,7 @@ import android.Manifest
import android.content.Intent
import android.net.Uri
import android.os.Build
import android.text.TextUtils
import android.view.View
import androidx.annotation.RequiresApi
import cn.jpush.android.api.JPushInterface
@ -24,6 +25,7 @@ import com.xty.common.xqr_code.XQRCodeAct
import com.xty.network.model.InviteCustodyBean
import com.xty.network.model.SettingBean
import com.xty.network.model.UserOtherInfo
import com.zj365.dc.BuildConfig
import com.zj365.dc.activity.MainActivity
import com.zj365.dc.databinding.FragMineBinding
@ -55,6 +57,8 @@ class MineFrag : BaseVmFrag<SettingVm>() , EasyPermissions.PermissionCallbacks{
}
var isDemonstrate: Boolean = false
var otherInfo: UserOtherInfo? = null
override fun setLayout(): View = binding.root
private val defaultIcon by lazy {
@ -278,7 +282,22 @@ class MineFrag : BaseVmFrag<SettingVm>() , EasyPermissions.PermissionCallbacks{
if(MMkvHelper.getLong(Const.USER_ID).toString() == "0"){
RouteManager.goAct(ARouterUrl.LOGIN_ACT)
}else {
CommonToastUtils.showToast("敬请期待")
otherInfo?.let {
if (!TextUtils.isEmpty(it.start_business)){
bundle.clear()
bundle.putString(
"web_site_url",
"${it.start_business}"
)
RouteManager.goAct(ARouterUrl.H5_ACT, bundle)
}else{
CommonToastUtils.showToast("敬请期待")
}
}?:{
CommonToastUtils.showToast("敬请期待")
}
}
}
@ -286,7 +305,23 @@ class MineFrag : BaseVmFrag<SettingVm>() , EasyPermissions.PermissionCallbacks{
if(MMkvHelper.getLong(Const.USER_ID).toString() == "0"){
RouteManager.goAct(ARouterUrl.LOGIN_ACT)
}else {
CommonToastUtils.showToast("敬请期待")
otherInfo?.let {
if (!TextUtils.isEmpty(it.placard)){
bundle.clear()
bundle.putString(
"web_site_url",
"${it.placard}"
)
RouteManager.goAct(ARouterUrl.H5_ACT, bundle)
}else{
CommonToastUtils.showToast("敬请期待")
}
}?:{
CommonToastUtils.showToast("敬请期待")
}
}
}
@ -352,11 +387,22 @@ class MineFrag : BaseVmFrag<SettingVm>() , EasyPermissions.PermissionCallbacks{
if(MMkvHelper.getLong(Const.USER_ID).toString() == "0"){
RouteManager.goAct(ARouterUrl.LOGIN_ACT)
}else {
bundle.clear()
bundle.putString("title", "操作手册")
bundle.putBoolean("isAgree", false)
bundle.putString("url", "https://mp.weixin.qq.com/s?__biz=MzkxMzI0NzU3NA==&mid=2247487161&idx=1&sn=ed2fca4f04beb00b16f1b7e6c922d40a&chksm=c101d280f6765b967665df1c3e3c5cc609f1fcf7f0434c3bb26fbc13f7806cd9a2b37048f9e8#rd")
RouteManager.goAct(ARouterUrl.AGREEMNT_READ_WEB_ACT, bundle)
otherInfo?.let {
if (!TextUtils.isEmpty(it.placard)){
bundle.clear()
bundle.putString("title", "操作手册")
bundle.putBoolean("isAgree", false)
bundle.putString("url", "${it.operation_guide}")
RouteManager.goAct(ARouterUrl.AGREEMNT_READ_WEB_ACT, bundle)
}else{
CommonToastUtils.showToast("敬请期待")
}
}?:{
CommonToastUtils.showToast("敬请期待")
}
}
}
@ -425,7 +471,7 @@ class MineFrag : BaseVmFrag<SettingVm>() , EasyPermissions.PermissionCallbacks{
private fun refresh() {
refresh.setRefresh(binding.mRefresh) {
mViewModel.getMySetting()
mViewModel.getUserEquity()
mViewModel.getUserOtherInfo()
mViewModel.getAllInfo(showIdInfo,false)
mViewModel.searchInviteInfo()
}
@ -444,7 +490,7 @@ class MineFrag : BaseVmFrag<SettingVm>() , EasyPermissions.PermissionCallbacks{
// mViewModel.getScore(1)
mViewModel.searchInviteInfo()
mViewModel.getUserEquity()
mViewModel.getUserOtherInfo()
// }
}
@ -452,8 +498,26 @@ class MineFrag : BaseVmFrag<SettingVm>() , EasyPermissions.PermissionCallbacks{
/* mViewModel.familyLive.observe(this) {
binding.mFamily.text = it.data.size.toString()
}*/
mViewModel.userEqualityLiveData.observe(this){
binding.tvMemberValidity.text ="有效期至:${it.data}"
mViewModel.useOtherInfoLiveData.observe(this){
otherInfo = it.data
binding.tvMemberValidity.text ="有效期至:${it.data.vip_end_time}"
binding.mCoupon.text = "${it.data.coupons_count}"
binding.mTvWallet.text = "${it.data.money}"
binding.tvOrder.text = "${it.data.order_count}"
if(TextUtils.isEmpty(it.data.start_business)){
binding.llStartBs.visibility = View.GONE
}else{
binding.llStartBs.visibility = View.VISIBLE
}
if(TextUtils.isEmpty(it.data.placard)){
binding.llDailyPoster.visibility = View.GONE
}else{
binding.llDailyPoster.visibility = View.VISIBLE
}
}
mViewModel.scoreLive.observe(this) {
binding.mIntegral.text = (if (it.data.num.isNullOrEmpty()) "0" else it.data.num!!)

@ -78,7 +78,7 @@ class ShopFragment: BaseFragList<ShopMallVm>() {
CommonToastUtils.showToast("请输入搜索内容")
return true
}
page = 1
mViewModel.getGoodsList(goodsName,0L,0,page)
RxKeyboardTool.hideSoftInput(requireActivity())

@ -135,7 +135,7 @@
android:layout_height="wrap_content"
android:paddingTop="@dimen/dp_25"
android:orientation="horizontal"
android:weightSum="4"
android:weightSum="3"
android:background="@color/white"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
@ -636,6 +636,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="4"
android:orientation="horizontal">
<LinearLayout
@ -662,53 +663,55 @@
</LinearLayout>
<LinearLayout
android:id="@+id/ll_wearable_device"
android:id="@+id/ll_daily_poster"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:visibility="gone"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/icon_wearable_device"
android:background="@mipmap/icon_daily_poster"
android:scaleType="centerCrop"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="穿戴设备"
android:text="今日海报"
android:textSize="@dimen/sp_14"
android:textStyle="bold"
android:layout_marginTop="@dimen/dp_12"
android:textColor="@color/col_7c7"/>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_daily_poster"
android:id="@+id/ll_wearable_device"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:visibility="invisible"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/icon_daily_poster"
android:background="@mipmap/icon_wearable_device"
android:scaleType="centerCrop"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="今日海报"
android:text="穿戴设备"
android:textSize="@dimen/sp_14"
android:textStyle="bold"
android:layout_marginTop="@dimen/dp_12"
android:textColor="@color/col_7c7"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"

@ -8,6 +8,7 @@ import android.os.Build
import android.os.Bundle
import android.text.TextUtils
import android.view.KeyEvent
import android.view.View
import android.view.WindowManager
import com.alibaba.android.arouter.facade.annotation.Route
import com.tencent.smtt.sdk.WebChromeClient
@ -38,6 +39,9 @@ import org.json.JSONObject
val cloudJSBridge by lazy { CloudJSBridge(this@BaseTenCentWebViewActivity,this) }
var isShowTitle= false
companion object{
val WEB_SITE_URL = "web_site_url"
val WEB_SITE_TITLE = "web_title"
@ -76,14 +80,20 @@ import org.json.JSONObject
MMkvHelper.getLong(Const.USER_ID).toString()
}
/* val jsonObject = JSONObject()
jsonObject.put("statuHeight", WebUtils.getStatesBar())
jsonObject.put("token", MMkvHelper.getString(Const.Auth_Token))
if(intent.hasExtra("isShowTitle")){
isShowTitle = intent.getBooleanExtra("isShowTitle",false)
}
if(isShowTitle){
binding.title.root.visibility = View.VISIBLE
jsonObject.put("userId", userId)
jsonObject.put("isAPP", 1)
LogUtils.e("CloudJSBridge",jsonObject.toString())
sendDataToJS("sendBaseInfo", jsonObject.toString())*/
statusBar(binding.title.mView)
binding.title.mIvBack.setOnClickListener {
finish()
}
}else{
binding.title.root.visibility = View.GONE
}
}
override fun liveObserver() {

@ -41,14 +41,17 @@ class DialogActivities (context:Context,var bannerBean: BannerBean?): BaseDialog
binding.imgClose.setOnClickListener { dismiss() }
binding.imgActivies.setOnClickListener {
bannerBean?.let {
if(it.bannerType != 5 &&it.linkAddress.startsWith("http")){
var bundle = Bundle()
bundle.putString("title", it.title)
bundle.putString("url", it.linkAddress)
RouteManager.goAct(ARouterUrl.WEB_ACT, bundle)
bannerBean?.let { bean->
bean.linkAddress?.let {
if(bean.bannerType != 5 &&it.startsWith("http")){
var bundle = Bundle()
bundle.putString("title", bean.title)
bundle.putString("url", it)
RouteManager.goAct(ARouterUrl.WEB_ACT, bundle)
}
}
}
}

@ -1,12 +1,21 @@
package com.xty.base.h5
import android.Manifest
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.webkit.JavascriptInterface
import androidx.appcompat.app.AppCompatActivity
import com.blankj.utilcode.util.GsonUtils
import com.google.gson.Gson
import com.tencent.mm.opensdk.modelbiz.WXLaunchMiniProgram
import com.tencent.mm.opensdk.openapi.WXAPIFactory
import com.xty.base.act.BaseVmAct
import com.xty.base.model.ChooseAddressBean
import com.xty.base.model.ChooseCouponBean
import com.xty.base.model.CreateOrderBean
import com.xty.base.model.OpenWXBean
import com.xty.base.model.ScienceDetailBean
import com.xty.base.model.WatchReChangeBean
import com.xty.base.utils.PayUtils
@ -17,6 +26,7 @@ import com.xty.common.arouter.ARouterUrl
import com.xty.common.arouter.RouteManager
import com.xty.common.util.ToastUtils
import org.json.JSONObject
import pub.devrel.easypermissions.EasyPermissions
open class CloudJSBridge(val context: Context, val listener: IJsBridge) {
private var baseActivity: BaseVmAct<*> = context as BaseVmAct<*>
@ -87,24 +97,81 @@ open class CloudJSBridge(val context: Context, val listener: IJsBridge) {
@JavascriptInterface
fun createOrder(str: String?){
str?.let {
var orderBean = GsonUtils.fromJson(it, CreateOrderBean::class.java)
var bundle = Bundle()
bundle.putParcelable("bean",orderBean)
RouteManager.goAct(ARouterUrl.CREATE_SHOP_ORDER_ACT,bundle)
if(MMkvHelper.getLong(Const.USER_ID).toString() == "0"){
RouteManager.goAct(ARouterUrl.LOGIN_ACT)
}else {
var orderBean = GsonUtils.fromJson(it, CreateOrderBean::class.java)
var bundle = Bundle()
bundle.putParcelable("bean", orderBean)
RouteManager.goAct(ARouterUrl.CREATE_SHOP_ORDER_ACT, bundle)
}
}
}
@JavascriptInterface
fun selectAdd(str: String?){
str?.let {
var addressBean = GsonUtils.fromJson(it, ChooseAddressBean::class.java)
baseActivity.bundle.clear()
baseActivity.bundle.putParcelable("address", addressBean)
baseActivity.intent.putExtras( baseActivity.bundle)
baseActivity.setResult(AppCompatActivity.RESULT_OK, baseActivity.intent)
baseActivity.finish()
}
}
@JavascriptInterface
fun selectCoupon(str: String?){
str?.let {
var couponBean = GsonUtils.fromJson(it, ChooseCouponBean::class.java)
baseActivity.bundle.clear()
baseActivity.bundle.putParcelable("coupon", couponBean)
baseActivity.intent.putExtras( baseActivity.bundle)
baseActivity.setResult(AppCompatActivity.RESULT_OK, baseActivity.intent)
baseActivity.finish()
}
}
@JavascriptInterface
fun toHome(str: String?){
baseActivity.finish()
}
@JavascriptInterface
fun callTell(str: String?){
if(EasyPermissions.hasPermissions(baseActivity,
Manifest.permission.CALL_PHONE)){
baseActivity.startActivity(Intent(Intent.ACTION_CALL, Uri.parse("tel:4000063365")))
}else{
EasyPermissions.requestPermissions(baseActivity,"",
0x00011,
Manifest.permission.CALL_PHONE)
}
}
@JavascriptInterface
fun jumpWallet(str: String?){
str?.let {
var wxBean = GsonUtils.fromJson(it, OpenWXBean::class.java)
val appId = "wx032bacb749c0dcb0" // 填移动应用(App)的 AppId非小程序的 AppID
val api = WXAPIFactory.createWXAPI(baseActivity, appId)
val req = WXLaunchMiniProgram.Req()
req.userName = wxBean.id // 填小程序原始id
req.path = wxBean.path ////拉起小程序页面的可带参路径,不填默认拉起小程序首页,对于小游戏,可以只传入 query 部分,来实现传参效果,如:传入 "?foo=bar"。
if(wxBean.type == 3){
req.miniprogramType =
WXLaunchMiniProgram.Req.MINIPTOGRAM_TYPE_RELEASE // 可选打开 开发版,体验版和正式版
}else{
req.miniprogramType =
WXLaunchMiniProgram.Req.MINIPROGRAM_TYPE_PREVIEW // 可选打开 开发版,体验版和正式版
}
api.sendReq(req)
}
}

@ -0,0 +1,16 @@
package com.xty.base.model
import android.os.Parcelable
import kotlinx.android.parcel.Parcelize
@Parcelize
data class ChooseAddressBean(
var id:Long,
var username:String,
var mobile:String,
var province:String,
var city:String,
var district:String,
var address:String,
var is_default:Int
):Parcelable

@ -0,0 +1,19 @@
package com.xty.base.model
import android.os.Parcelable
import io.reactivex.observers.DefaultObserver
import kotlinx.android.parcel.Parcelize
@Parcelize
data class ChooseCouponBean(
var id:Long,
var card_type:Int,
var status:Int,
var is_share:Int,
var share_user_id:Long,
var share_user_name:String,
var as_amount:Double,
var discount:Double,
var card_name:String
) : Parcelable {
}

@ -0,0 +1,8 @@
package com.xty.base.model
data class OpenWXBean(
var path:String,
var id:String,
var type:Int
) {
}

@ -173,8 +173,8 @@ object UserInfoDefin {
arrayOf(
R.color.col_7b8,
R.color.col_7b8,
R.color.col_48d,
R.color.col_e6b,
R.color.col_9BDd,
R.color.col_96D,
R.color.col_FDA481
)
}

@ -4,6 +4,11 @@
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/title_white_bar"
android:id= "@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<com.tencent.smtt.sdk.WebView
android:layout_width="match_parent"
android:layout_height="match_parent"

@ -41,4 +41,6 @@
<color name="col_6ea">#6EA8F6</color>
<color name="col_481">#FDA481</color>
<color name="col_91d">#F7891D</color>
<color name="col_6FA">#F5F6FA</color>
</resources>

@ -148,6 +148,7 @@ class ARouterUrl {
//心理测试
const val PSYCHOLOGICAL_TEST_LIST_ACT = "/health/com/zj365/health/act/psychological/PsychologicalTestMainAct"
const val PSYCHOLOGICAL_QUESTION_ACT = "/health/com/zj365/health/act/psychological/PsychologicalQuestionnaireAct"
//设备绑定相关
@ -228,7 +229,8 @@ class ARouterUrl {
//地理围栏
const val ELECTRONIC_FENCE_SET_ACT = "/mine/com/zj365/dc/mime/act/electronicfence/ElectronicFenceSettingAct"
const val ELECTRONIC_ADDRESS_CHOOSE_ACT = "/mine/com/zj365/dc/mime/act/electronicfence/ElectronicAddressChooseAct"
const val ELECTRONIC_ADD_MODIFY_ACT ="/mine/com/zj365/dc/mime/act/electronicfence/ElectronicAddOrModifyAct"
const val CHANGE_PHONE = "/mine/com/zj365/dc/mime/act/ChangePhoneAct"

@ -0,0 +1,4 @@
package com.xty.common.event
class BtFenceSettingSuccessEvent {
}

@ -0,0 +1,15 @@
package com.xty.common.util
import java.math.BigDecimal
object NumUtils {
fun divide(valueOne: Int, valueTwo: Int, scale: Int): Double {
if (scale < 0) {
throw IllegalArgumentException("The scale must be a positive integer or zero")
}
val b1 = BigDecimal(java.lang.Double.toString(valueOne.toDouble()))
val b2 = BigDecimal(java.lang.Double.toString(valueTwo.toDouble()))
return b1.divide(b2, scale, BigDecimal.ROUND_HALF_UP).toDouble()
}
}

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<solid android:color="#EEEEEE" />
<corners android:radius="3dp"/>
</shape>
</item>
<item android:id="@android:id/secondaryProgress">
<clip>
<shape>
<solid android:color="#EEEEEE" />
<corners android:radius="3dp"/>
</shape>
</clip>
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<solid android:color="#02C191" />
<corners android:radius="3dp"/>
</shape>
</clip>
</item>
</layer-list>

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/col_C53"/>
<stroke android:width="@dimen/dp_1" android:color="@color/white"/>
<corners android:radius="@dimen/dp_4"/>
</shape>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/col_D42"/>
<stroke android:width="@dimen/dp_1" android:color="@color/white"/>
<corners android:radius="@dimen/dp_4"/>
</shape>

Before

Width:  |  Height:  |  Size: 997 B

After

Width:  |  Height:  |  Size: 997 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

@ -205,4 +205,6 @@
<color name="col_e3f">#E3FCF6</color>
<color name="col_f15">#F15C42</color>
<color name="col_04f">#FFD04F</color>
<color name="col_C53">#FFAC53</color>
<color name="col_D42">#F04D42</color>
</resources>

@ -107,6 +107,7 @@ ext {
gd_location : 'com.amap.api:location:latest.integration',
gd_map : 'com.amap.api:3dmap:8.0.1',
gd_search : 'com.amap.api:search:latest.integration',
wixin : 'com.tencent.mm.opensdk:wechat-sdk-android:+',
//

@ -312,6 +312,10 @@
<activity android:name=".act.psychological.PsychologicalTestMainAct"
android:launchMode="singleTop"
android:screenOrientation="portrait" />
<activity android:name=".act.psychological.PsychologicalQuestionnaireAct"
android:launchMode="singleTop"
android:screenOrientation="portrait" />
<activity android:name=".act.healthrecord.UploadHealthRecordAct"
android:launchMode="singleTop"
android:screenOrientation="portrait" />
@ -331,6 +335,10 @@
android:launchMode="singleTop"
android:screenOrientation="portrait" />
<activity android:name=".act.OrderListAct"
android:launchMode="singleTop"
android:screenOrientation="portrait" />
</application>
</manifest>

@ -25,9 +25,15 @@ class OrderListAct : BaseListAct<PayCancerVm>() {
var userId: String? = null
val mAdapter by lazy { OrderListAdapter() }
var type:Int = 0 //默认全部 1 是从糖医进来
override fun initData() {
super.initData()
userId = intent.getStringExtra("id")
type = intent.getIntExtra("type",0)
if(intent.hasExtra("id")){
userId = intent.getStringExtra("id")
}
}
override fun initView() {
@ -55,7 +61,13 @@ class OrderListAct : BaseListAct<PayCancerVm>() {
}
override fun loadData() {
mViewModel.getOrderList(userId, page)
if (type == 1){
mViewModel.getSugarMedicineOrderList( page)
}else {
mViewModel.getOrderList(userId, page)
}
}
@SuppressLint("SetTextI18n")
@ -70,5 +82,16 @@ class OrderListAct : BaseListAct<PayCancerVm>() {
}
}
}
mViewModel.sugarMedicalListLiveData.observe(this){
it.data?.let { listData ->
setDate(mAdapter, listData)
/*if (listData.size <= 0){
binding.title.mTvTitle.text = "我的订单"
}else{
binding.title.mTvTitle.text = "我的订单(${listData.size})"
}*/
}
}
}
}

@ -6,13 +6,18 @@ import androidx.recyclerview.widget.RecyclerView
import com.alibaba.android.arouter.facade.annotation.Route
import com.androidkun.xtablayout.XTabLayout
import com.xty.base.act.BaseListAct
import com.xty.base.utils.PayUtils
import com.xty.common.arouter.ARouterUrl
import com.xty.common.arouter.RouteManager
import com.xty.common.event.ReChangeEvent
import com.xty.network.model.ShopOrderListBean
import com.zj365.health.R
import com.zj365.health.adapter.GoodsOrderAdapter
import com.zj365.health.databinding.ActShopOrderListBinding
import com.zj365.health.vm.ShopOrderVm
import com.zj365.health.weight.DialogTipNew
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
@Route(path = ARouterUrl.SHOP_ORDER_LIST_ACT)
class ShopOrderListAct : BaseListAct<ShopOrderVm>() {
@ -25,6 +30,34 @@ class ShopOrderListAct : BaseListAct<ShopOrderVm>() {
private val mTitles = mutableListOf<String>()
var bean : ShopOrderListBean.ShopOrderBean? = null
val dialogCancel by lazy {
DialogTipNew(this, "取消订单","", "确认","取消",false,{
bean?.let {
mViewModel.cancelOrder(it.id)
}
}){
}
}
val dialogReturn by lazy {
DialogTipNew(this, "退款申请","", "确认","取消",false,{
bean?.let {
mViewModel.applyReturn(it.id)
}
}){
}
}
override fun initAdapter() {
binding.mRecycle.adapter = mAdapter
binding.mRecycle.layoutManager = LinearLayoutManager(this)
@ -50,20 +83,36 @@ class ShopOrderListAct : BaseListAct<ShopOrderVm>() {
mAdapter.setOnItemChildClickListener { adapter, view, position ->
var bean = adapter.data[position] as ShopOrderListBean.ShopOrderBean
when(view.id){
R.id.tv_confirm_receive_goods ->{
mViewModel.receiveGoods(bean.id)
}
R.id.tv_logistics->{
if (bean.status == 1){
mViewModel.cancelOrder(bean.id)
bean = adapter.data[position] as ShopOrderListBean.ShopOrderBean
bean?.let {
when(view.id){
R.id.tv_confirm_receive_goods ->{
mViewModel.receiveGoods(it.id)
}
}
R.id.tv_refund ->{
R.id.tv_logistics->{
if (it.status == 1){
dialogCancel.setContentNew("您是否确认取消订单,取消订单后如涉及退款" +
",请注意查收")
dialogCancel.show()
}else{
}
}
R.id.tv_refund ->{
if (it.status == 3 || it.status == 2){
dialogReturn.setContentNew("您是否确认对此订单进行退款申请,申请完成" +
"后会在1~3个工作日对订单进行审核请及时" +
"关注订单状态")
dialogReturn.show()
}else if (it.status == 1){
PayUtils(this).payForGoods(it.pay_price.toFloat(),it.order_no)
}
}
}
}
}
}
@ -149,4 +198,10 @@ class ShopOrderListAct : BaseListAct<ShopOrderVm>() {
}
override fun setLayout() = binding.root
@Subscribe(threadMode = ThreadMode.MAIN)
fun paySuccess(event: ReChangeEvent){
page = 1
loadData()
}
}

@ -1,5 +1,6 @@
package com.zj365.health.act.healthrecord
import android.graphics.Color
import android.util.Log
import android.view.View
import androidx.core.view.get
@ -60,6 +61,10 @@ class HealthRecordMainAct : BaseVmAct<HealthRecordMainVm>() {
mViewModel.healthArchiveLiveData.observe(this){
binding.tvBmi.text = "${it.data.bmiInfo.bmi}"
binding.tvBmiDesc.text = it.data.bmiInfo.levelName
if (it.data.bmiInfo.levelName.equals("理想")){
binding.tvBmiDesc.setTextColor(Color.parseColor("#02C191"))
}
binding.tvBmr.text = "${it.data.bmr}"
mAdapter.setNewInstance(it.data.healData)
}

@ -1,10 +1,28 @@
package com.zj365.health.act.psychological
import android.annotation.SuppressLint
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.os.Build
import android.view.View
import android.webkit.WebChromeClient
import android.webkit.WebSettings
import android.webkit.WebView
import android.webkit.WebViewClient
import com.alibaba.android.arouter.facade.annotation.Route
import com.tamsiree.rxkit.RxNetTool
import com.tamsiree.rxkit.RxTool
import com.xty.base.act.BaseVmAct
import com.xty.base.vm.BaseVm
import com.xty.common.LogUtils
import com.xty.common.arouter.ARouterUrl
import com.xty.common.arouter.RouteManager
import com.xty.common.util.CommonUtils
import com.zj365.health.BuildConfig
import com.zj365.health.databinding.ActPsychologicalQuestionnaireBinding
import com.zj365.health.weight.QuestionDialog
@Route(path = ARouterUrl.PSYCHOLOGICAL_QUESTION_ACT)
class PsychologicalQuestionnaireAct : BaseVmAct<BaseVm>() {
val binding by lazy { ActPsychologicalQuestionnaireBinding.inflate(layoutInflater) }
@ -14,4 +32,134 @@ class PsychologicalQuestionnaireAct : BaseVmAct<BaseVm>() {
}
override fun setLayout() = binding.root
var surveyId: Long = 0
override fun initData() {
super.initData()
surveyId = intent.getLongExtra("surveyId",0)
}
override fun initView() {
super.initView()
statusBar(binding.title.mView)
binding.title.mTvTitle.text = "心理测试 "
binding.title.mIvBack.setOnClickListener { finish() }
initWebSettings()
var userId = CommonUtils.getMyUserId()
binding.wvContent.loadUrl(BuildConfig.url+"shareApi/H5_question/${userId}/${surveyId}/android")
}
@SuppressLint("SetJavaScriptEnabled")
private fun initWebSettings() {
binding.wvContent.isHorizontalScrollBarEnabled = false //水平不显示
binding.wvContent.isVerticalScrollBarEnabled = false //垂直不显示
var webViewClient = MyClient()
binding.wvContent.apply {
isHorizontalScrollBarEnabled = false //水平不显示
isVerticalScrollBarEnabled = false //垂直不显示
val webSetting: WebSettings = settings
webSetting.apply {
setRenderPriority(WebSettings.RenderPriority.HIGH)
cacheMode = if (RxNetTool.isConnected(RxTool.getContext())) {
WebSettings.LOAD_DEFAULT // 设置缓存模式
} else {
WebSettings.LOAD_CACHE_ELSE_NETWORK // 设置缓存模式
}
loadWithOverviewMode = true
domStorageEnabled = true//不添加可能加载H5的页面时候出现一片空白
databaseEnabled = true
setAppCacheEnabled(true)
allowFileAccess = true
javaScriptEnabled = true
textZoom = 110
useWideViewPort = false//设置此属性,可任意比例缩放
setLayerType(View.LAYER_TYPE_HARDWARE, null) // 启用硬件加速
layoutAlgorithm = WebSettings.LayoutAlgorithm.NORMAL
builtInZoomControls = false //设置内置的缩放控件。若为false则该WebView不可缩放
displayZoomControls = false //隐藏原生的缩放控件
defaultTextEncodingName = "utf-8" //设置编码格式
blockNetworkImage = false //解决图片不显示
loadsImagesAutomatically = true //支持自动加载图片
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
setAllowFileAccessFromFileURLs(true)
setAllowUniversalAccessFromFileURLs(true)
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {//解决视频加载不出来的问题
mixedContentMode = WebSettings.MIXED_CONTENT_ALWAYS_ALLOW;
}
}
settings.domStorageEnabled = true
this.webViewClient = webViewClient
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
}
webChromeClient = object : WebChromeClient() {
override fun getDefaultVideoPoster(): Bitmap? {
try {
//这个地方是加载h5的视频列表 默认图 点击前的视频图
LogUtils.d("WebView---------加载视频默认图片");
return BitmapFactory.decodeResource(
context.getResources(),
com.xty.common.R.mipmap.ic_chat_picture
);
} catch (e: Exception) {
LogUtils.e("WebView---------默认图片加载失败");
}
return null
}
}
}
}
override fun onPause() {
super.onPause()
//暂停WebView在后台的所有活动
binding.wvContent.onPause()
//暂停WebView在后台的JS活动
binding.wvContent.pauseTimers()
}
override fun onResume() {
super.onResume()
binding.wvContent.onResume();
binding.wvContent.resumeTimers();
}
override fun onDestroy() {
super.onDestroy()
binding.root.removeView(binding.wvContent)
binding.wvContent.destroy()
}
val tipDialog by lazy {
QuestionDialog(this, false, "温馨提示", {
/* bundle.clear()
bundle.putString("orderNo", orderNo)
RouteManager.goAct(ARouterUrl.UPLOAD_CHECK, bundle)*/
})
}
inner class MyClient : WebViewClient() {
override fun shouldOverrideUrlLoading(p0: WebView?, p1: String): Boolean {
if (p1.contains("code:0")) {
showDialog()
} else {
p0?.loadUrl(p1)
}
return true
}
}
private fun showDialog() {
tipDialog.show()
}
}

@ -6,6 +6,10 @@ import com.xty.base.act.BaseListAct
import com.xty.base.act.BaseVmAct
import com.xty.base.vm.BaseVm
import com.xty.common.arouter.ARouterUrl
import com.xty.common.arouter.RouteManager
import com.xty.common.util.CommonUtils
import com.xty.network.model.PsychologicalListBean
import com.zj365.health.BuildConfig
import com.zj365.health.adapter.psychological.PsychologicalTestMainAdapter
import com.zj365.health.databinding.ActPsychologicalTestMainBinding
import com.zj365.health.vm.PsychologicalTestMainVm
@ -32,7 +36,13 @@ class PsychologicalTestMainAct : BaseListAct<PsychologicalTestMainVm>() {
binding.mRecycle.layoutManager = LinearLayoutManager(this)
binding.mRecycle.adapter = mAdapter
mAdapter.setOnItemChildClickListener { adapter, view, position ->
mAdapter.setOnItemClickListener { adapter, view, position ->
var bean = adapter.data[position] as PsychologicalListBean.PsychologicalBean
bundle.clear()
bundle.putString("web_site_url","${BuildConfig.url}shareApi/H5_question/${CommonUtils.getMyUserId()}/${bean.id}/android")
bundle.putBoolean("isShowTitle",true)
RouteManager.goAct(ARouterUrl.H5_ACT,bundle)
}

@ -105,10 +105,20 @@ class SkinMeasurementMainAct : BaseVmAct<SkinMeasurementVm>() {
binding.title.mTvRight.visibility = View.VISIBLE
}else{
binding.title.mTvTitle.text ="AI糖医"
binding.title.mTvRight.text ="购买记录"
binding.title.mTvRight.setTextColor(resources.getColor(R.color.col_02c))
binding.title.mTvRight.visibility = View.VISIBLE
mViewModel.getAIGoods()
}
binding.title.mTvRight.setOnClickListener {
if(type == 0){
}else{
bundle.clear()
bundle.putInt("type",1)
RouteManager.goAct(ARouterUrl.ORDER_LIST,bundle)
}
}

@ -43,12 +43,19 @@ class GoodsOrderAdapter : BaseAdapter<ShopOrderListBean.ShopOrderBean>(R.layout.
holder.setGone(R.id.tv_confirm_receive_goods,true)
holder.setText(R.id.tv_logistics,"取消订单")
holder.setText(R.id.tv_refund,"立即支付")
holder.setGone(R.id.tv_logistics,false)
holder.setGone(R.id.tv_refund,false)
}
3->{
status.setTextColor(context.getColor(R.color.col_9BD))
holder.setGone(R.id.tv_confirm_receive_goods,false)
holder.setText(R.id.tv_logistics,"查看物流")
holder.setText(R.id.tv_refund,"申请退款")
holder.setGone(R.id.tv_logistics,false)
holder.setGone(R.id.tv_refund,false)
}
4->{

@ -23,6 +23,8 @@ class PayCancerVm : BaseVm() {
val isCanReservationOb by lazy { MutableLiveData<RespBody<String>>() }
val orderListData by lazy { MutableLiveData<RespBody<PaingBean<CancerGoodsBean>>>() }
val sugarMedicalListLiveData by lazy { MutableLiveData<RespBody<MutableList<CancerGoodsBean>>>() }
fun payUrl(goodsId: String?, channelName: String, exchangeCode: String) {
if (goodsId.isNullOrEmpty()) {
return
@ -129,6 +131,18 @@ class PayCancerVm : BaseVm() {
}
}
fun getSugarMedicineOrderList(pageNum:Int){
startHttp {
var json = JSONObject()
json.put("pageNum",pageNum)
json.put("pageSize",20)
var response =
apiInterface().getSugarMedicineOrderList(retrofits.getRequestBody(json.toString()))
response.getCodeStatus(sugarMedicalListLiveData, nowData)
}
}
fun getEstimateRecord() {
startHttp {
var json = JSONObject()
@ -198,4 +212,6 @@ class PayCancerVm : BaseVm() {
response.getCodeStatus(isCanReservationOb, nowData)
}
}
}

@ -54,4 +54,12 @@ class ShopOrderVm : BaseVm() {
}
}
fun applyReturn(id:Long){
startHttp {
val response = apiInterface().applyReturn(id)
response.getCodeStatus(cancelOrderLiveData, nowData)
}
}
}

@ -53,4 +53,8 @@ class DialogTipNew(
fun setContentNew(content:String){
binding.mTitle.text= content
}
fun setTitleNew(title:String){
binding.tvTitle.text = title
}
}

@ -12,9 +12,12 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/title"
android:layout_margin="@dimen/dp_14"
android:layout_marginStart="@dimen/dp_14"
android:layout_marginTop="@dimen/dp_14"
android:layout_marginEnd="@dimen/dp_14"
android:layout_marginBottom="@dimen/dp_14"
android:background="@drawable/shape_white_8radius"
android:padding="@dimen/dp_10"/>
android:padding="@dimen/dp_10" />
<TextView
android:id="@+id/tv_submit"
@ -26,6 +29,7 @@
android:background="@drawable/shape_r25_02c"
android:text="提 交"
android:textColor="@color/white"
android:visibility="gone"
android:textSize="@dimen/sp_18"
android:textStyle="bold"
android:layout_alignParentBottom="true"

@ -150,7 +150,7 @@
android:layout_gravity="center_vertical"
android:paddingStart="@dimen/dp_9"
android:text="立即续费"
android:textColor="@color/red_ff"
android:textColor="@color/col_02c"
android:textSize="@dimen/sp_15"
android:textStyle="bold"
android:visibility="gone"

@ -0,0 +1,321 @@
package com.zj365.mime.act.electronicfence
import android.annotation.SuppressLint
import android.graphics.Color
import android.os.Bundle
import android.view.View
import android.widget.SeekBar
import androidx.recyclerview.widget.LinearLayoutManager
import com.alibaba.android.arouter.facade.annotation.Route
import com.amap.api.maps.AMap
import com.amap.api.maps.AMapOptions
import com.amap.api.maps.CameraUpdateFactory
import com.amap.api.maps.model.BitmapDescriptorFactory
import com.amap.api.maps.model.CameraPosition
import com.amap.api.maps.model.CircleOptions
import com.amap.api.maps.model.LatLng
import com.amap.api.maps.model.MarkerOptions
import com.amap.api.maps.model.MyLocationStyle
import com.amap.api.services.core.PoiItem
import com.xty.base.act.BaseVmAct
import com.xty.common.arouter.ARouterUrl
import com.xty.common.arouter.RouteManager
import com.xty.common.event.BtFenceSettingSuccessEvent
import com.xty.network.model.EtFenceListBean
import com.zj365.mime.R
import com.zj365.mime.adapter.ElectronicFenceAdapter
import com.zj365.mime.databinding.ActivityElectronicFenceSettingBinding
import com.zj365.mime.vm.ElectronicFenceSettingVm
import org.greenrobot.eventbus.EventBus
@Route(path = ARouterUrl.ELECTRONIC_ADD_MODIFY_ACT)
class ElectronicAddOrModifyAct : BaseVmAct<ElectronicFenceSettingVm>() {
val binding by lazy { ActivityElectronicFenceSettingBinding.inflate(layoutInflater) }
val mAdapter by lazy { ElectronicFenceAdapter() }
var type: Int = 0 //0 列表页 1 设置页 2 修改已设计的电子围栏
private var aMap: AMap? = null
var poiItem: PoiItem? = null
var settingType :Int =2 // 1-禁入 2-禁出
var radius:Int = 500
var title:String = ""
var latitude:Double = 0.00
var longitude:Double = 0.00
var markerOptionsList = ArrayList<MarkerOptions>()
var bean: EtFenceListBean.EtFenceChildBean? = null
override fun liveObserver() {
mViewModel.addOrDeleteLiveData.observe(this){
EventBus.getDefault().post(BtFenceSettingSuccessEvent())
finish()
}
}
override fun initView() {
super.initView()
statusBar(binding.title.mView)
binding.title.mTvTitle.text = "电子围栏设置"
binding.title.mIvBack.setOnClickListener {
finish()
}
aMap = binding.map.map
initLocation()
if (intent.hasExtra("type")){
type = intent.getIntExtra("type",0)
}
if(intent.hasExtra("poiItem")){
poiItem = intent.getParcelableExtra("poiItem")
}
if(intent.hasExtra("bean")){
bean = intent.getParcelableExtra("bean")
}
if(type == 0){
binding.llData.visibility = View.VISIBLE
binding.llSetting.visibility = View.GONE
mViewModel.getElectronicFenceList()
binding.tvCancel.visibility = View.GONE
}else if(type == 1){
binding.llData.visibility = View.GONE
binding.llSetting.visibility = View.VISIBLE
binding.tvCancel.visibility = View.VISIBLE
initSettingData()
}else {
binding.llData.visibility = View.GONE
binding.llSetting.visibility = View.VISIBLE
binding.tvCancel.visibility = View.VISIBLE
binding.tvCancel.text = "删除"
initModifyData()
}
binding.recycler.adapter = mAdapter
binding.recycler.layoutManager = LinearLayoutManager(this)
binding.tvConfirm.setOnClickListener {
if (type == 0){
RouteManager.goAct(ARouterUrl.ELECTRONIC_ADDRESS_CHOOSE_ACT)
}else if(type == 1){
poiItem?.let {
mViewModel.setBtFence(title,radius,settingType,longitude,latitude,null)
}
}else if(type == 2){
bean?.let {
mViewModel.setBtFence(title,radius,settingType,longitude,latitude,it.id)
}
}
}
binding.tvCancel.setOnClickListener {
if(type == 2){
bean?.let {
mViewModel.deleteBtFence(it.id)
}
}else{
finish()
}
}
binding.clSetting.skbRadius.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener{
override fun onProgressChanged(p0: SeekBar?, p1: Int, p2: Boolean) {
radius = p1
}
override fun onStartTrackingTouch(p0: SeekBar?) {
}
override fun onStopTrackingTouch(p0: SeekBar?) {
}
})
binding.clSetting.rbType.setOnCheckedChangeListener { radioGroup, checkedId ->
when(radioGroup.checkedRadioButtonId){
R.id.rb_leave ->{
settingType = 2
aMap?.let {
it.clear()
var markerOptions = MarkerOptions().position(LatLng(latitude,longitude)).icon(
BitmapDescriptorFactory.fromView(View.inflate(this,
R.layout.layout_bt_fence_leave,null)))
var marker = it.addMarker(markerOptions)
it.addCircle(CircleOptions().center(LatLng(latitude,longitude))
.radius(radius.toDouble()).fillColor(Color.parseColor("#61FFAC53"))
.strokeColor(Color.parseColor("#FFFFFF"))
.strokeWidth(1.0f)
)
}
}
R.id.rb_enter ->{
settingType = 1
aMap?.let {
it.clear()
var markerOptions = MarkerOptions().position(LatLng(latitude,longitude)).icon(
BitmapDescriptorFactory.fromView(View.inflate(this,
R.layout.layout_bt_fence_enter,null)))
var marker = it.addMarker(markerOptions)
it.addCircle(CircleOptions().center(LatLng(latitude,longitude))
.radius(radius.toDouble()).fillColor(Color.parseColor("#66F04D42"))
.strokeColor(Color.parseColor("#FFFFFF"))
.strokeWidth(1.0f)
)
}
}
}
}
}
fun initLocation(){
var locationStyle = MyLocationStyle()
locationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_LOCATE)
aMap?.let {
it.clear()
it.myLocationStyle = locationStyle
it.uiSettings.isMyLocationButtonEnabled = false
it.isMyLocationEnabled = false
it.moveCamera(CameraUpdateFactory.zoomTo(20f))
var uiSettings = it.uiSettings
uiSettings.isZoomControlsEnabled = false
uiSettings.isMyLocationButtonEnabled = false
uiSettings.isScaleControlsEnabled = false
uiSettings.logoPosition = AMapOptions.LOGO_MARGIN_LEFT
}
}
fun initModifyData(){
bean?.let {
title = "${it.title}"
binding.clSetting.tvAddress.text = "${it.title}"
latitude = it.lat
longitude = it.log
radius = it.radius
settingType = it.type
binding.clSetting.skbRadius.progress = radius
if (settingType == 1){
binding.clSetting.rbType.check(R.id.rb_enter)
}else{
binding.clSetting.rbType.check(R.id.rb_leave)
}
}
aMap?.let {
if(settingType == 1){
var markerOptions = MarkerOptions().position(LatLng(latitude,longitude)).icon(
BitmapDescriptorFactory.fromView(View.inflate(this,
R.layout.layout_bt_fence_enter,null)))
var marker = it.addMarker(markerOptions)
it.addCircle(CircleOptions().center(LatLng(latitude,longitude))
.radius(radius.toDouble()).fillColor(Color.parseColor("#66F04D42"))
.strokeColor(Color.parseColor("#FFFFFF"))
.strokeWidth(1.0f)
)
}else{
var markerOptions = MarkerOptions().position(LatLng(latitude,longitude)).icon(
BitmapDescriptorFactory.fromView(View.inflate(this,
R.layout.layout_bt_fence_leave,null)))
var marker = it.addMarker(markerOptions)
it.addCircle(CircleOptions().center(LatLng(latitude,longitude))
.radius(radius.toDouble()).fillColor(Color.parseColor("#61FFAC53"))
.strokeColor(Color.parseColor("#FFFFFF"))
.strokeWidth(1.0f))
}
it.moveCamera(CameraUpdateFactory.newCameraPosition(CameraPosition(LatLng(latitude,longitude),14f,0f,0f)))
}
}
fun initSettingData(){
poiItem?.let {
title = "${it.provinceName}${it.cityName}${it.adName}${it.title}"
binding.clSetting.tvAddress.text = "${it.provinceName}${it.cityName}${it.adName}${it.title}"
latitude = it.latLonPoint.latitude
longitude = it.latLonPoint.longitude
}
binding.clSetting.skbRadius.progress = radius
binding.clSetting.rbType.check(R.id.rb_leave)
aMap?.let {
var markerOptions = MarkerOptions().position(LatLng(latitude,longitude)).icon(
BitmapDescriptorFactory.fromView(View.inflate(this,
R.layout.layout_bt_fence_leave,null)))
var marker = it.addMarker(markerOptions)
it.animateCamera(CameraUpdateFactory.newCameraPosition(CameraPosition(LatLng(latitude,longitude),15f,0f,0f)))
it.addCircle(CircleOptions().center(LatLng(latitude,longitude))
.radius(radius.toDouble()).fillColor(Color.parseColor("#61FFAC53"))
.strokeColor(Color.parseColor("#FFFFFF"))
.strokeWidth(1.0f)
)
}
}
override fun setLayout() = binding.root
override fun onDestroy() {
super.onDestroy()
binding.map.onDestroy()
}
override fun onPause() {
super.onPause()
binding.map.onPause()
}
override fun onResume() {
super.onResume()
binding.map.onResume()
}
@SuppressLint("MissingSuperCall")
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
binding.map.onSaveInstanceState(outState)
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding.map.onCreate(savedInstanceState)
}
}

@ -0,0 +1,341 @@
package com.zj365.mime.act.electronicfence
import android.animation.AnimatorSet
import android.animation.ObjectAnimator
import android.annotation.SuppressLint
import android.graphics.BitmapFactory
import android.graphics.Color
import android.os.Bundle
import android.text.TextUtils
import android.text.method.KeyListener
import android.view.KeyEvent
import android.view.View
import android.view.inputmethod.EditorInfo
import android.widget.TextView
import androidx.recyclerview.widget.LinearLayoutManager
import com.alibaba.android.arouter.facade.annotation.Route
import com.amap.api.location.AMapLocation
import com.amap.api.location.AMapLocationClient
import com.amap.api.location.AMapLocationClientOption
import com.amap.api.location.AMapLocationListener
import com.amap.api.maps.AMap
import com.amap.api.maps.AMapOptions
import com.amap.api.maps.CameraUpdateFactory
import com.amap.api.maps.model.BitmapDescriptorFactory
import com.amap.api.maps.model.CameraPosition
import com.amap.api.maps.model.LatLng
import com.amap.api.maps.model.MarkerOptions
import com.amap.api.maps.model.MyLocationStyle
import com.amap.api.services.core.LatLonPoint
import com.amap.api.services.core.PoiItem
import com.amap.api.services.core.PoiItemV2
import com.amap.api.services.geocoder.GeocodeResult
import com.amap.api.services.geocoder.GeocodeSearch
import com.amap.api.services.geocoder.RegeocodeQuery
import com.amap.api.services.geocoder.RegeocodeResult
import com.amap.api.services.poisearch.PoiResult
import com.amap.api.services.poisearch.PoiResultV2
import com.amap.api.services.poisearch.PoiSearch
import com.amap.api.services.poisearch.PoiSearchV2
import com.tamsiree.rxkit.RxKeyboardTool
import com.xty.base.act.BaseVmAct
import com.xty.base.vm.BaseVm
import com.xty.common.LogUtils
import com.xty.common.arouter.ARouterUrl
import com.xty.common.arouter.RouteManager
import com.xty.common.event.BtFenceSettingSuccessEvent
import com.xty.common.util.CommonToastUtils
import com.zj365.mime.R
import com.zj365.mime.adapter.ElectronicAddressAdapter
import com.zj365.mime.databinding.ActElectronicAddressChooseBinding
import com.zj365.mime.model.CustomerPOItem
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
@Route(path = ARouterUrl.ELECTRONIC_ADDRESS_CHOOSE_ACT)
class ElectronicAddressChooseAct : BaseVmAct<BaseVm>(),AMapLocationListener ,GeocodeSearch.OnGeocodeSearchListener
,PoiSearch.OnPoiSearchListener{
val binding by lazy { ActElectronicAddressChooseBinding.inflate(layoutInflater) }
private var aMap: AMap? = null
var mLocationClient:AMapLocationClient? = null
var mLocationOption:AMapLocationClientOption? = null
var geocodeSearch: GeocodeSearch? = null
val mAdapter by lazy { ElectronicAddressAdapter() }
var searchAddress:String = ""
var latitude:Double=0.00
var longitude:Double = 0.00
var cityName :String = ""
var poiList = ArrayList<CustomerPOItem>()
var choosePoiItem: PoiItem? = null
var isHandDrag:Boolean = false
var page:Int = 1
override fun liveObserver() {
}
override fun initView() {
super.initView()
binding.tvCancel.setOnClickListener {
finish()
}
binding.tvConfirm.setOnClickListener {
choosePoiItem?.let {
bundle.clear()
bundle.putParcelable("poiItem",it)
bundle.putInt("type",1)
RouteManager.goAct(ARouterUrl.ELECTRONIC_ADD_MODIFY_ACT,bundle)
}
}
aMap = binding.mapView.map
initLocation()
binding.recycler.adapter = mAdapter
binding.recycler.layoutManager = LinearLayoutManager(this)
binding.etSearch.setOnEditorActionListener(object : TextView.OnEditorActionListener {
override fun onEditorAction(p0: TextView?, p1: Int, p2: KeyEvent?): Boolean {
if(p1 == EditorInfo.IME_ACTION_SEARCH){
searchAddress = binding.etSearch.text.toString()
page = 1
searchPOI()
RxKeyboardTool.hideSoftInput(this@ElectronicAddressChooseAct)
return true
}
return false
}
})
mAdapter.setOnItemClickListener { adapter, view, position ->
var bean = adapter.data[position] as CustomerPOItem
(adapter.data as ArrayList<CustomerPOItem>).forEachIndexed { index, customerPOItem ->
customerPOItem.isChecked = false
}
bean.isChecked = true
choosePoiItem = bean.poiItem
mAdapter.notifyDataSetChanged()
}
binding.mRefresh.setOnRefreshListener {
page = 1
searchPOI()
binding.mRefresh.finishRefresh(1000)
}
binding.mRefresh.setEnableLoadMore(true)
binding.mRefresh.setOnLoadMoreListener {
page++
searchPOI()
binding.mRefresh.finishLoadMore(1000)
}
}
fun searchPOI(){
LogUtils.e("ElectronicAddressChooseAct","keyword${searchAddress}")
var query = PoiSearch.Query(searchAddress,"",cityName)
query.pageNum = page
query.pageSize = 20
var poisearch = PoiSearch(this,query)
poisearch.bound = PoiSearch.SearchBound(LatLonPoint(latitude,longitude),50000)
poisearch.setOnPoiSearchListener(this)
poisearch.searchPOIAsyn()
}
fun initLocation(){
var locationStyle = MyLocationStyle()
locationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_LOCATE)
aMap?.let {
it.myLocationStyle = locationStyle
it.uiSettings.isMyLocationButtonEnabled = false
it.isMyLocationEnabled = false
it.moveCamera(CameraUpdateFactory.zoomTo(30f))
var uiSettings = it.uiSettings
uiSettings.isZoomControlsEnabled = false
uiSettings.isMyLocationButtonEnabled = false
uiSettings.isScaleControlsEnabled = false
uiSettings.logoPosition= AMapOptions.LOGO_MARGIN_LEFT
goLocation()
it.setOnCameraChangeListener(object :AMap.OnCameraChangeListener{
override fun onCameraChange(p0: CameraPosition?) {
}
override fun onCameraChangeFinish(cameraPosition: CameraPosition) {
LogUtils.e("ElectronicAddressChooseAct","onCameraChangeFinish")
if(isHandDrag && TextUtils.isEmpty(searchAddress)){
getGeocodeSearch(cameraPosition.target)
}
isHandDrag = true
}
})
}
}
fun goLocation(){
mLocationClient = AMapLocationClient(this)
mLocationOption = AMapLocationClientOption()
mLocationClient?.setLocationListener(this)
mLocationOption?.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy)
mLocationOption?.setInterval(1000)
mLocationOption?.setOnceLocation(false)
mLocationOption?.setGpsFirst(true)
mLocationOption?.setNeedAddress(true)
mLocationOption?.setOnceLocationLatest(false)
mLocationOption?.setSensorEnable(true)
mLocationClient?.setLocationOption(mLocationOption)
mLocationClient?.startLocation()
}
fun getGeocodeSearch(targe: LatLng){
LogUtils.e("ElectronicAddressChooseAct","getGeocodeSearch ${targe.latitude},${targe.longitude},")
if(geocodeSearch == null) {
geocodeSearch = GeocodeSearch(this)
}
searchAddress = ""
latitude = targe.latitude
longitude = targe.longitude
var query = RegeocodeQuery(LatLonPoint(targe.latitude,targe.longitude),5000f,GeocodeSearch.AMAP)
geocodeSearch?.setOnGeocodeSearchListener(this)
geocodeSearch?.getFromLocationAsyn(query)
}
fun setMapCenter(amapLocation:AMapLocation){
aMap?.let {
var locationMark = it.addMarker(MarkerOptions().position(LatLng(amapLocation.latitude,amapLocation.longitude)).icon(
BitmapDescriptorFactory.fromResource(R.mipmap.icon_address_location)
))
locationMark.setPositionByPixels(binding.mapView.width / 2,binding.mapView.height /2)
it.animateCamera(CameraUpdateFactory.newCameraPosition(CameraPosition(LatLng(amapLocation.latitude,amapLocation.longitude),30f,0f,0f)))
}
}
override fun setLayout() = binding.root
override fun onDestroy() {
super.onDestroy()
binding.mapView.onDestroy()
}
override fun onPause() {
super.onPause()
binding.mapView.onPause()
}
override fun onResume() {
super.onResume()
binding.mapView.onResume()
}
@SuppressLint("MissingSuperCall")
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
binding.mapView.onSaveInstanceState(outState)
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding.mapView.onCreate(savedInstanceState)
}
override fun onLocationChanged(amapLocation: AMapLocation?) {
LogUtils.e("ElectronicAddressChooseAct","onLocationChanged${amapLocation?.errorCode!!}")
amapLocation?.let {
if (it.errorCode == AMapLocation.LOCATION_SUCCESS){
mLocationClient?.stopLocation()
mLocationClient?.onDestroy()
setMapCenter(it)
latitude = it.latitude
longitude = it.longitude
var latLng = LatLng(latitude,longitude)
cityName =it.city
}else{
}
}
}
override fun onRegeocodeSearched(regeocodeResult: RegeocodeResult?, code: Int) {
LogUtils.e("ElectronicAddressChooseAct","onRegeocodeSearched${code}")
if(code == 1000){
if(regeocodeResult != null && regeocodeResult?.regeocodeAddress != null && regeocodeResult?.regeocodeAddress?.formatAddress != null){
var split = regeocodeResult!!.regeocodeAddress!!.province +regeocodeResult!!.regeocodeAddress!!.city + regeocodeResult!!.regeocodeAddress!!.district + regeocodeResult!!.regeocodeAddress!!.township
LogUtils.e("ElectronicAddressChooseAct","split:${split}")
searchPOI()
}
}
}
override fun onGeocodeSearched(geocodeResult: GeocodeResult?, code: Int) {
LogUtils.e("ElectronicAddressChooseAct","onGeocodeSearched${code}")
}
override fun onPoiSearched(result: PoiResult?, code: Int) {
if(code == 1000){
if(result != null && result?.query != null){
LogUtils.e("ElectronicAddressChooseAct","query${result!!.pois.size}")
if(page == 1){
mAdapter.data.clear()
poiList.clear()
choosePoiItem = null
if (result!!.pois.size > 0){
aMap?.moveCamera(CameraUpdateFactory.newCameraPosition(CameraPosition(LatLng(result!!.pois[0].latLonPoint.latitude,result!!.pois[0].latLonPoint.longitude),15f,0f,30f)))
}
result!!.pois.forEach {
poiList.add(CustomerPOItem(it,false))
}
mAdapter.setList(poiList)
}else{
result!!.pois.forEach {
poiList.add(CustomerPOItem(it,false))
}
mAdapter.addData(poiList)
}
}
}
}
override fun onPoiItemSearched(p0: PoiItem?, p1: Int) {
}
@Subscribe(threadMode = ThreadMode.MAIN)
fun settingSuccess(event: BtFenceSettingSuccessEvent){
this.finish()
}
}

@ -1,15 +1,32 @@
package com.zj365.mime.act.electronicfence
import android.annotation.SuppressLint
import android.graphics.Color
import android.os.Bundle
import android.view.View
import android.widget.SeekBar
import androidx.core.view.isVisible
import androidx.recyclerview.widget.LinearLayoutManager
import com.alibaba.android.arouter.facade.annotation.Route
import com.amap.api.maps.AMap
import com.amap.api.maps.AMapOptions
import com.amap.api.maps.CameraUpdateFactory
import com.amap.api.maps.model.BitmapDescriptorFactory
import com.amap.api.maps.model.CameraPosition
import com.amap.api.maps.model.CircleOptions
import com.amap.api.maps.model.LatLng
import com.amap.api.maps.model.LatLngBounds
import com.amap.api.maps.model.MarkerOptions
import com.amap.api.maps.model.MyLocationStyle
import com.amap.api.services.core.PoiItem
import com.hjq.toast.ToastUtils
import com.xty.base.act.BaseVmAct
import com.xty.base.vm.BaseVm
import com.xty.common.arouter.ARouterUrl
import com.xty.common.arouter.RouteManager
import com.xty.common.util.CommonToastUtils
import com.xty.network.model.EtFenceListBean
import com.zj365.mime.R
import com.zj365.mime.adapter.ElectronicFenceAdapter
import com.zj365.mime.databinding.ActivityElectronicFenceSettingBinding
import com.zj365.mime.vm.ElectronicFenceSettingVm
@ -21,21 +38,72 @@ class ElectronicFenceSettingAct : BaseVmAct<ElectronicFenceSettingVm>() {
val mAdapter by lazy { ElectronicFenceAdapter() }
var type: Int = 0 //0 列表页 1 设置页
var type: Int = 0 //0 列表页 1 设置页 2 修改已设计的电子围栏
private var aMap: AMap? = null
var poiItem:PoiItem? = null
var bean: EtFenceListBean.EtFenceChildBean? = null
var total :Int = 0
override fun liveObserver() {
mViewModel.electronicFenceListLiveDate.observe(this){
if(it.data.count == 0){
binding.inEmpty.root.visibility = View.VISIBLE
binding.recycler.visibility = View.GONE
binding.rxData.visibility = View.GONE
}else{
binding.recycler.visibility = View.VISIBLE
binding.inEmpty.root.visibility = View.VISIBLE
binding.rxData.visibility = View.VISIBLE
binding.inEmpty.root.visibility = View.GONE
mAdapter.setNewInstance(it.data.list)
total = it.data.count
binding.tvCount.text ="${it.data.count}/5"
var boundsBuilder = LatLngBounds.Builder()
it.data.list.forEach {
var latLng = LatLng(it.lat,it.log)
var options = MarkerOptions().position(latLng)
var radius = it.radius.toDouble()
boundsBuilder.include(latLng)
options.visible(true)
if(it.type == 1){
aMap?.let {
var markerOptions = MarkerOptions().position(latLng)
.icon(BitmapDescriptorFactory.fromView(View.inflate(this,R.layout.layout_bt_fence_enter,null)))
var marker = it.addMarker(markerOptions)
it.addCircle(CircleOptions().center(latLng)
.radius(radius).fillColor(Color.parseColor("#66F04D42"))
.strokeColor(Color.parseColor("#FFFFFF"))
.strokeWidth(1.0f)
)
}
}else{
aMap?.let {
var markerOptions = MarkerOptions().position(latLng).icon(BitmapDescriptorFactory.fromView(View.inflate(this,R.layout.layout_bt_fence_leave,null)))
var marker = it.addMarker(markerOptions)
it.addCircle(CircleOptions().center(latLng)
.radius(radius.toDouble()).fillColor(Color.parseColor("#61FFAC53"))
.strokeColor(Color.parseColor("#FFFFFF"))
.strokeWidth(1.0f)
)
}
}
}
aMap?.animateCamera(CameraUpdateFactory.newLatLngBounds(boundsBuilder.build(),50))
}
}
mViewModel.addOrDeleteLiveData.observe(this){
finish()
}
}
override fun initView() {
@ -46,24 +114,64 @@ class ElectronicFenceSettingAct : BaseVmAct<ElectronicFenceSettingVm>() {
finish()
}
aMap = binding.map.map
binding.llData.visibility = View.VISIBLE
binding.llSetting.visibility = View.GONE
mViewModel.getElectronicFenceList()
binding.tvCancel.visibility = View.GONE
binding.recycler.adapter = mAdapter
binding.recycler.layoutManager = LinearLayoutManager(this)
binding.tvCancel.visibility = View.GONE
mAdapter.setOnItemClickListener { adapter, view, position ->
var bean = adapter.data[position] as EtFenceListBean.EtFenceChildBean
bundle.clear()
bundle.putParcelable("bean",bean)
bundle.putInt("type",2)
RouteManager.goAct(ARouterUrl.ELECTRONIC_ADD_MODIFY_ACT,bundle)
}
binding.tvConfirm.setOnClickListener {
if (type == 0){
binding.llData.visibility = View.GONE
type = 1
}else{
binding.llData.visibility = View.VISIBLE
type = 0
}
if(total < 5){
RouteManager.goAct(ARouterUrl.ELECTRONIC_ADDRESS_CHOOSE_ACT)
}else{
CommonToastUtils.showToast("最多可添加5个围栏")
}
}
binding.tvCancel.setOnClickListener {
if(type == 2){
bean?.let {
mViewModel.deleteBtFence(it.id)
}
}else{
finish()
}
}
initLocation()
}
fun initLocation(){
var locationStyle = MyLocationStyle()
locationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_LOCATE)
locationStyle.interval(2000)
aMap?.let {
it.clear()
it.myLocationStyle = locationStyle
it.uiSettings.isMyLocationButtonEnabled = false
it.isMyLocationEnabled = false
var uiSettings = it.uiSettings
uiSettings.isZoomControlsEnabled = false
uiSettings.isMyLocationButtonEnabled = false
uiSettings.isScaleControlsEnabled = false
uiSettings.logoPosition = AMapOptions.LOGO_MARGIN_LEFT
}
}
@ -83,6 +191,9 @@ class ElectronicFenceSettingAct : BaseVmAct<ElectronicFenceSettingVm>() {
override fun onResume() {
super.onResume()
binding.map.onResume()
if(type == 0){
mViewModel.getElectronicFenceList()
}
}
@SuppressLint("MissingSuperCall")

@ -0,0 +1,22 @@
package com.zj365.mime.adapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.xty.base.adapter.BaseAdapter
import com.xty.common.util.NumUtils
import com.zj365.mime.R
import com.zj365.mime.model.CustomerPOItem
class ElectronicAddressAdapter : BaseAdapter<CustomerPOItem>(R.layout.item_electronic_address_search) {
override fun convert(holder: BaseViewHolder, item: CustomerPOItem) {
holder.setText(R.id.tv_address,"${ item.poiItem.title}")
holder.setText(R.id.tv_distance,"${item.poiItem.distance}m | ${item.poiItem.adName}${item.poiItem.snippet}附近")
if (item.isChecked){
holder.setGone(R.id.img_checked,false)
}else{
holder.setGone(R.id.img_checked,true)
}
}
}

@ -1,5 +1,6 @@
package com.zj365.mime.adapter
import android.graphics.Color
import android.widget.TextView
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.xty.base.adapter.BaseAdapter
@ -16,14 +17,15 @@ class ElectronicFenceAdapter : BaseAdapter<EtFenceListBean.EtFenceChildBean> (R.
var drawableLeft = context.getDrawable(R.mipmap.icon_forbid_enter)
tvForbid.setCompoundDrawablesWithIntrinsicBounds(drawableLeft,null,null,null)
tvForbid.compoundDrawablePadding = 5
tvForbid.text = "禁入"
tvForbid.setTextColor(Color.parseColor("#F04D42"))
}else{
var drawableLeft = context.getDrawable(R.mipmap.icon_forbid_leave)
tvForbid.setCompoundDrawablesWithIntrinsicBounds(drawableLeft,null,null,null)
tvForbid.compoundDrawablePadding = 5
tvForbid.text = "禁出"
tvForbid.setTextColor(Color.parseColor("#F09C42"))
}

@ -102,7 +102,7 @@ class MessageAdapter():BaseAdapter<Any>(R.layout.item_message) {
fun choiceAll(){
data.forEachIndexed { pos, any ->
val item = any as MessageBean.SysMsg
val item = any as MessageTypeDataBean.MessageTypeBean
if (!item.isChoice){
item.isChoice = true
deletePos.add(pos)

@ -0,0 +1,8 @@
package com.zj365.mime.model
import android.os.Parcelable
import com.amap.api.services.core.PoiItem
data class CustomerPOItem (var poiItem: PoiItem,var isChecked:Boolean = false){
}

@ -4,14 +4,46 @@ import androidx.lifecycle.MutableLiveData
import com.xty.base.vm.BaseVm
import com.xty.network.model.EtFenceListBean
import com.xty.network.model.RespBody
import org.json.JSONObject
class ElectronicFenceSettingVm : BaseVm() {
val electronicFenceListLiveDate by lazy { MutableLiveData<RespBody<EtFenceListBean>>() }
val addOrDeleteLiveData by lazy { MutableLiveData<RespBody<Any>>() }
fun getElectronicFenceList(){
startHttp {
var response = apiInterface().getBtFenceList()
response.getCodeStatus(electronicFenceListLiveDate, nowData)
}
}
fun setBtFence(title:String,radius:Int, type:Int, log:Double,lat:Double,id:Long?){
startHttp {
var json = JSONObject()
json.put("title",title)
json.put("radius",radius)
json.put("type",type)
json.put("log",log)
json.put("lat",lat)
id?.let {
json.put("id",id)
}
var response = apiInterface().setBtFence(retrofits.getRequestBody(json.toString()))
response.getCodeStatus(addOrDeleteLiveData, nowData)
}
}
fun deleteBtFence(id:Long){
startHttp {
var json = JSONObject()
json.put("id",id)
var response = apiInterface().deleteBtFence(retrofits.getRequestBody(json.toString()))
response.getCodeStatus(addOrDeleteLiveData, nowData)
}
}
}

@ -13,6 +13,7 @@ import com.xty.network.model.SettingBean
import com.xty.network.model.UnReadMessageBean
import com.xty.network.model.Update
import com.xty.network.model.UserEquipmentInformationizationBean
import com.xty.network.model.UserOtherInfo
import org.json.JSONObject
class SettingVm : BaseVm() {
@ -34,7 +35,7 @@ class SettingVm : BaseVm() {
val confirmInviteLiveData by lazy { MutableLiveData<RespBody<Any>>() }
val userEqualityLiveData by lazy { MutableLiveData<RespBody<String>>() }
val useOtherInfoLiveData by lazy { MutableLiveData<RespBody<UserOtherInfo>>() }
fun getNesProg(id: String) {
@ -187,10 +188,10 @@ class SettingVm : BaseVm() {
}
fun getUserEquity(){
fun getUserOtherInfo(){
startHttp {
val response = apiInterface().getUserEquity()
response.getCodeStatus(userEqualityLiveData,nowData)
val response = apiInterface().getUserOtherInfo()
response.getCodeStatus(useOtherInfoLiveData,nowData)
}
}
}

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
<solid android:color="#66F04D42"/>
</shape>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
<solid android:color="#61FFAC53"/>
</shape>

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_0"
android:layout_weight="0.55">
<com.amap.api.maps.MapView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/mapView"/>
<TextView
android:id="@+id/tv_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="取消"
android:textColor="@color/col_333"
android:textSize="@dimen/sp_14"
android:textStyle="bold"
android:drawableLeft="@mipmap/ic_back_arrow"
android:drawablePadding="@dimen/dp_5"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_53"/>
<com.ruffian.library.widget.RTextView
android:id="@+id/tv_confirm"
android:layout_width="@dimen/dp_44"
android:layout_height="@dimen/dp_25"
app:corner_radius="@dimen/dp_4"
app:background_normal="@color/col_02c"
android:text="确定"
android:gravity="center"
android:textColor="@color/white"
android:textSize="@dimen/sp_12"
android:layout_gravity="end"
android:layout_marginRight="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_53"/>
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_0"
android:layout_weight="0.45"
android:orientation="vertical"
android:background="@color/white"
>
<com.ruffian.library.widget.RRelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_38"
android:background="@color/col_6FA"
android:layout_margin="@dimen/dp_10">
<ImageView
android:id="@+id/img_search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/ic_search"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/dp_21"/>
<EditText
android:id="@+id/et_search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="搜索地点"
android:layout_toRightOf="@+id/img_search"
android:layout_centerVertical="true"
android:textColor="@color/col_313"
android:background="@null"
android:textColorHint="@color/col_C7C"
android:imeOptions="actionSearch"
android:singleLine="true"
android:inputType="text"
android:textSize="@dimen/sp_13"
android:layout_marginLeft="@dimen/dp_7"/>
</com.ruffian.library.widget.RRelativeLayout>
<com.scwang.smart.refresh.layout.SmartRefreshLayout
android:id="@+id/mRefresh"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:layout_marginLeft="@dimen/dp_9"
android:layout_marginRight="@dimen/dp_13"
app:srlAccentColor="@color/white">
<com.scwang.smart.refresh.header.ClassicsHeader
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:foregroundTint="@color/white"
app:srlAccentColor="@color/black"
app:srlPrimaryColor="@color/white" />
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_17"
android:layout_marginRight="@dimen/dp_17"
android:id="@+id/recycler"/>
<com.scwang.smart.refresh.footer.ClassicsFooter
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.scwang.smart.refresh.layout.SmartRefreshLayout>
</LinearLayout>
</LinearLayout>

@ -1,23 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/title_white_bar"
android:id="@+id/title"/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.amap.api.maps.MapView
android:layout_width="match_parent"
android:layout_height="@dimen/dp_355"
android:layout_height="0dp"
android:layout_weight="0.5"
android:id="@+id/map"/>
<com.ruffian.library.widget.RRelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_338"
android:layout_height="0dp"
android:layout_weight="0.5"
app:corner_radius_top_left="@dimen/dp_12"
app:corner_radius_top_right="@dimen/dp_12"
app:background_normal="@color/white"
@ -28,23 +29,55 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/ll_data">
android:id="@+id/ll_data"
android:layout_above="@+id/ll_btn">
<include layout="@layout/layout_empyt_no_data"
android:id="@+id/in_empty"
android:layout_above="@+id/ll_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
android:layout_height="match_parent"
/>
<androidx.recyclerview.widget.RecyclerView
android:visibility="gone"
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/recycler"/>
android:layout_height="match_parent"
android:id="@+id/rx_data"
android:visibility="gone">
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/recycler"
android:layout_above="@+id/tv_count"/>
<TextView
android:id="@+id/tv_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/sp_12"
android:textColor="@color/col_333"
tools:text="2/5"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="@dimen/dp_12"/>
</RelativeLayout>
</LinearLayout>
<include layout="@layout/layout_ele_fence_setting"
android:id="@+id/cl_setting"
android:visibility="gone"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/ll_setting"
android:orientation="vertical"
android:layout_above="@+id/ll_btn"
android:visibility="gone">
<include layout="@layout/layout_ele_fence_setting"
android:id="@+id/cl_setting"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_btn"
@ -84,7 +117,6 @@
</LinearLayout>
</com.ruffian.library.widget.RRelativeLayout>
</FrameLayout>

@ -1,14 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_80"
android:layout_height="wrap_content"
android:padding="@dimen/dp_16"
xmlns:tools="http://schemas.android.com/tools">
<LinearLayout
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/img_arrow"
android:orientation="vertical">
<TextView
android:id="@+id/tv_address"
@ -16,6 +17,8 @@
android:layout_height="wrap_content"
android:textColor="@color/col_333"
android:textSize="@dimen/sp_16"
android:maxLines="1"
android:ellipsize="end"
tools:text="长沙市开福区东辰19公馆"/>
<LinearLayout
@ -53,9 +56,11 @@
</LinearLayout>
<ImageView
android:id="@+id/img_arrow"
android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_20"
android:background="@mipmap/icon_arrow_rigth_black"
android:layout_marginLeft="@dimen/dp_15"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"/>

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_56">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_centerVertical="true"
android:gravity="left"
android:layout_toLeftOf="@+id/img_checked">
<TextView
android:id="@+id/tv_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/col_333"
android:maxLines="1"
android:ellipsize="end"
android:textSize="@dimen/sp_14"
tools:text="长沙市田家炳中学长沙市田家炳中学长沙市" />
<TextView
android:id="@+id/tv_distance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/col_C7C"
android:maxLines="1"
android:ellipsize="end"
android:textSize="@dimen/sp_12"
android:layout_below="@+id/tv_address"
tools:text="1.5km | 开福区乐古巷9号附近"/>
</RelativeLayout>
<ImageView
android:id="@+id/img_checked"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/dp_15"
android:background="@mipmap/icon_address_checked"/>
</RelativeLayout>

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="@dimen/dp_90"
android:layout_height="@dimen/dp_90"
app:civ_circle_background_color="@color/col_D42"
app:civ_border_width="@dimen/dp_1"
app:civ_border_color="@color/white"
android:visibility="gone"
android:background="@drawable/shape_radius_66f04d42"/>
<com.ruffian.library.widget.RTextView
android:layout_width="@dimen/dp_32"
android:layout_height="@dimen/dp_18"
app:corner_radius="5dp"
android:layout_gravity="center"
android:text="禁入"
android:textColor="@color/white"
android:textSize="@dimen/sp_10"
android:gravity="center"
app:background_normal="@drawable/shape_stroke_white_d42"/>
</FrameLayout>

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="@dimen/dp_90"
android:layout_height="@dimen/dp_90"
app:civ_circle_background_color="@color/col_C53"
app:civ_border_width="@dimen/dp_1"
app:civ_border_color="@color/white"
android:visibility="gone"
android:background="@drawable/shape_raduis_61ffac53"/>
<com.ruffian.library.widget.RTextView
android:layout_width="@dimen/dp_32"
android:layout_height="@dimen/dp_18"
app:corner_radius="5dp"
android:layout_gravity="center"
android:text="禁出"
android:textColor="@color/white"
android:textSize="@dimen/sp_10"
android:gravity="center"
app:background_normal="@drawable/shape_storke_white_c53"/>
</FrameLayout>

@ -3,7 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:padding="@dimen/dp_16">
<TextView
@ -15,6 +15,7 @@
android:textStyle="bold"/>
<TextView
android:id="@+id/tv_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/sp_14"
@ -34,10 +35,12 @@
<SeekBar
android:id="@+id/skb_radius"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_6"
android:layout_height="12dp"
android:layout_marginTop="@dimen/dp_19"
android:layout_marginRight="@dimen/dp_24"
android:progressDrawable="@mipmap/icon_seekbar_drawer"/>
android:max="1000"
android:progress="50"
android:progressDrawable="@drawable/seek_bar"
android:thumb="@mipmap/icon_seekbar_drawer"/>
<TextView
android:layout_width="wrap_content"

@ -1537,6 +1537,9 @@ interface ApiInterface {
@POST("customer/order/orderPageList")
suspend fun getOrderList(@Body rb: RequestBody):RespBody<PaingBean<CancerGoodsBean>>
@POST("customer/sugarMedicine/orderList")
suspend fun getSugarMedicineOrderList(@Body rb: RequestBody):RespBody<MutableList<CancerGoodsBean>>
@POST("customer/tumor/order/orderList")
suspend fun getEstimateRecord(@Body rb: RequestBody): RespBody<MutableList<CancerGoodsBean>>
@ -1825,9 +1828,24 @@ interface ApiInterface {
@POST("customer/watch/realmeas")
suspend fun measureWatchData(@Body rb: RequestBody):RespBody<Any>
/**
* 获取电子围栏
*/
@POST("customer/watch/getBtfenceList")
suspend fun getBtFenceList():RespBody<EtFenceListBean>
/**
* 设置电子围栏
*/
@POST("customer/watch/setBtfence")
suspend fun setBtFence(@Body rb: RequestBody):RespBody<Any>
/**
* 删除电子围栏
*/
@POST("customer/watch/delBtfence")
suspend fun deleteBtFence(@Body rb: RequestBody):RespBody<Any>
/**
* 获取演示模式
@ -1849,8 +1867,8 @@ interface ApiInterface {
/**
* 获取用户权益
*/
@POST("customer/user/getUserEquity")
suspend fun getUserEquity():RespBody<String>
@POST("customer/user/getUserInfo")
suspend fun getUserOtherInfo():RespBody<UserOtherInfo>
/**
* 获取设备型号
@ -1911,4 +1929,10 @@ interface ApiInterface {
*/
@GET("customer/mall/order/cancelOrder")
suspend fun cancelOrder(@Query("orderId") orderId:Long): RespBody<Any>
/**
* 申请退款
*/
@GET("customer/mall/order/getOrderInfo")
suspend fun applyReturn(@Query("orderId") orderId:Long):RespBody<Any>
}

@ -3,11 +3,11 @@ package com.xty.network.model
import java.io.Serializable
data class BannerBean(
val title: String,
val content: String,
val title: String?,
val content: String?,
val bannerType: Int,//1:图文展示, 5app内部打开 10web外部跳转 15视频播放20 小程序跳转】imgUrl 图片地址linkAddress连接地址
val imgUrl: String,
val linkAddress: String,
val linkAddress: String?,
val wxId:String, //小程序ID
val wxType:Int //1.开发版2.体验版 3.正式版
):Serializable

@ -1,13 +1,18 @@
package com.xty.network.model
data class EtFenceListBean(var count:Int,var list:ArrayList<EtFenceChildBean>){
import android.os.Parcelable
import kotlinx.android.parcel.Parcelize
@Parcelize
data class EtFenceListBean(var count:Int,var list:ArrayList<EtFenceChildBean>):Parcelable{
@Parcelize
data class EtFenceChildBean(
var id:Long,
var user_id:Long,
var title:String,
var radius:Int,
var type:Int,
var log:String,
var lat:String
)
var log:Double,
var lat:Double
):Parcelable
}

@ -1,6 +1,10 @@
package com.xty.network.model
data class HealthArchiveBean(var bmiInfo:BMIInfo,var healData:ArrayList<FamilyHealthBean.FamilyTargetBean>){
data class HealthArchiveBean(
var bmiInfo:BMIInfo,
var healData:ArrayList<FamilyHealthBean.FamilyTargetBean>,
var bmr:String,
var bmi:String){
data class BMIInfo(var levelName:String,var bmi:Float)
}

@ -0,0 +1,10 @@
package com.xty.network.model
data class UserOtherInfo(
var vip_end_time:String,
var order_count:Int,
var money:Double,
var start_business:String,
var operation_guide:String,
var coupons_count:Int,
var placard:String)
Loading…
Cancel
Save