中建365-二期开发-优化相关页面

develop
wlh 1 year ago
parent d187dadab9
commit 423c32ae16

@ -100,6 +100,16 @@
android:usesCleartextTraffic="true"
tools:replace="android:allowBackup">
<provider
android:authorities="com.zj365.dc.fileprovider"
android:exported="false"
android:grantUriPermissions="true"
android:name="androidx.core.content.FileProvider">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths"/>
</provider>
<activity
android:name=".activity.WelcomeAct"
android:exported="true"

@ -49,11 +49,11 @@ class LoginAct : BaseVmAct<LoginVm>() {
val dialogBind by lazy {
DialogTipNew(this,"温馨提示", "恭喜您成为中健三六五大家庭的一员,为了提供更好的信息服务,请完善您的基本信息。", "前往","取消",false,{
RouteManager.goAct(ARouterUrl.BASE_INFO_CHANGE)
EventBus.getDefault().post(LoginOrRegisterEvent())
RouteManager.goAct(ARouterUrl.FAMILY_RECORD_ACT)
finish()
}){
EventBus.getDefault().post(LoginOrRegisterEvent())
finish()
}
}
@ -283,48 +283,16 @@ class LoginAct : BaseVmAct<LoginVm>() {
override fun liveObserver() {
mViewModel.mLogin.observe(this) {
loadingView.dismiss()
EventBus.getDefault().post(LoginOrRegisterEvent())
if (it.data.isPerfect == 0){
dialogBind.setContentNew("恭喜您成为中健三六五大家庭的医院,为了提供更好的信息服务,请完善您的基本信息。")
dialogBind.show()
}else{
EventBus.getDefault().post(LoginOrRegisterEvent())
// EventBus.getDefault().post(LoginOrRegisterEvent())
finish()
}
// initTab()
// mViewModel.getImUserSig("user_${it.data.id}")
// RouteManager.goAct(ARouterUrl.MAIN_ACT)
}
// mViewModel.loginWx.observe(this) {
// loadingView.dismiss()
// initTab()
// mViewModel.getImUserSig("user_${it.data}")
// }
/* mViewModel.setLoginWxId.observe(this) {
loadingView.dismiss()
initTab()
mViewModel.getImUserSig("user_${it}")
}*/
/* mViewModel.getImUserSig.observe(this) {
Log.e("simon", "login"+it.data)
TUILogin.login(
applicationContext,
1400807230,
it.paramsData,
it.data,
object : TUICallback() {
override fun onSuccess() {
Log.e("simon","onSuccess")
RouteManager.goAct(ARouterUrl.MAIN_ACT)
finish()
}
override fun onError(errorCode: Int, errorMessage: String?) {
Log.e("simon","onError")
}
})
}*/
mViewModel.codeLive.observe(this) {
timeStart()

@ -129,13 +129,8 @@ class RegisterAct : BaseVmAct<RegisterVm>() {
override fun onClick(widget: View) {
bundle.clear()
bundle.putString("title", "用户协议")
bundle.putInt("type", Const.AGREEMENT_1)
RouteManager.goActRequest(
ARouterUrl.RICH_TEXT,
this@RegisterAct,
USER_AGREEMENT,
bundle
)
bundle.putString("url", "https://dc.zhongjian365.com/agreement.html")
RouteManager.goAct(ARouterUrl.AGREEMNT_READ_WEB_ACT, bundle)
}
override fun updateDrawState(ds: TextPaint) {
@ -149,13 +144,8 @@ class RegisterAct : BaseVmAct<RegisterVm>() {
override fun onClick(widget: View) {
bundle.clear()
bundle.putString("title", "隐私政策")
bundle.putString("url", "https://auprty.com/app/static/app/privacy.html")
RouteManager.goActRequest(
ARouterUrl.AGREEMNT_READ_WEB_ACT,
this@RegisterAct,
PRIVACY,
bundle
)
bundle.putString("url", "https://dc.zhongjian365.com/privacy.html")
RouteManager.goAct(ARouterUrl.AGREEMNT_READ_WEB_ACT, bundle)
}
override fun updateDrawState(ds: TextPaint) {
@ -202,7 +192,7 @@ class RegisterAct : BaseVmAct<RegisterVm>() {
mViewModel.mLogin.observe(this){
4
RouteManager.goAct(ARouterUrl.BASE_INFO_CHANGE)
RouteManager.goAct(ARouterUrl.FAMILY_RECORD_ACT)
EventBus.getDefault().post(LoginOrRegisterEvent())
this@RegisterAct.finish()

@ -28,6 +28,7 @@ import com.xty.common.bracelet.YCBBlueConnectHelper
import com.xty.common.bracelet.checkBlueConnectPermission
import com.xty.common.getImageUrl
import com.xty.common.util.CommonUtils
import com.xty.network.utils.AppUtils
import com.zj365.dc.BuildConfig
import com.zj365.dc.databinding.ActWelcomeBinding
@ -83,6 +84,7 @@ class WelcomeAct : BaseVmAct<WelcomeVm>() {
.keyboardEnable(true)
.fullScreen(true)
.init()
getTaskAct()
binding.mCard.setOnClickListener {
job?.let {

@ -2,9 +2,11 @@ package com.zj365.dc.activity.shop
import android.content.Intent
import android.view.View
import android.widget.Toast
import com.alibaba.android.arouter.facade.annotation.Route
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.tamsiree.rxkit.RxActivityTool
import com.tencent.mm.opensdk.modelbase.BaseResp
import com.xty.base.act.BaseTenCentWebViewActivity
import com.xty.base.act.BaseVmAct
import com.xty.network.model.ChooseAddressBean
@ -14,10 +16,12 @@ 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.common.event.WxPayEvent
import com.xty.common.setImage
import com.zj365.dc.BuildConfig
import com.zj365.dc.databinding.ActCreateGoodsOrderBinding
import com.zj365.dc.vm.ShopMallVm
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
@ -34,6 +38,8 @@ class CreateGoodsOrderAct : BaseVmAct<ShopMallVm>() {
var hasCoup: Int = 2
var couponBean:ChooseCouponBean? = null
companion object{
const val REQUEST_ADDRESS = 0x000011
const val REQUEST_COUP = 0x000012
@ -59,6 +65,17 @@ class CreateGoodsOrderAct : BaseVmAct<ShopMallVm>() {
binding.tvChooseAddress.text = "${it.data.province}${it.data.city}${it.data.district}${it.data.address}"
}
mViewModel.computeAmountLiveData.observe(this){
binding.tvTotalPrice.text ="¥ ${it.data}"
couponBean?.let {
binding.tvDiscounts.text = "可优惠¥ ${it.as_amount}"
// binding.tvPlatformDiscounts.text = "${(bean!!.ori_price * bean!!.skuNum) - (it.skuPrice * it.skuNum) - couponBean.as_amount}"
}
}
}
override fun initView() {
@ -73,7 +90,10 @@ class CreateGoodsOrderAct : BaseVmAct<ShopMallVm>() {
onClickedListener()
bean?.let {
refreshUI(it)
mViewModel.computeAmount(it.skuId,it.skuNum,couponsId)
}
mViewModel.hasCoupon()
}
fun refreshUI(bean: CreateOrderBean){
@ -82,8 +102,7 @@ class CreateGoodsOrderAct : BaseVmAct<ShopMallVm>() {
binding.tvSpec.text = bean.skuName
binding.tvNum.text = "数量:${bean.skuNum}"
binding.tvPrice.text = "商品原价:¥ ${bean.ori_price}"
binding.tvTotalPrice.text ="¥ ${bean.skuPrice * bean.skuNum}"
binding.tvPlatformDiscounts.text = "${(bean.ori_price * bean.skuNum) - (bean.skuPrice * bean.skuNum)}"
binding.tvPlatformDiscounts.text = "¥ ${(bean.ori_price * bean.skuNum) - (bean.skuPrice * bean.skuNum)}"
if (bean.delivery_mode == 0){ //0,无需发货1需要发货
binding.rxAddress.visibility = View.GONE
@ -92,7 +111,7 @@ class CreateGoodsOrderAct : BaseVmAct<ShopMallVm>() {
mViewModel.getDefaultAddress()
}
mViewModel.hasCoupon()
}
@ -132,8 +151,7 @@ class CreateGoodsOrderAct : BaseVmAct<ShopMallVm>() {
@Subscribe(threadMode = ThreadMode.MAIN)
fun paySuccess(event: ReChangeEvent){
RouteManager.goAct(ARouterUrl.SHOP_ORDER_LIST_ACT)
RxActivityTool.finishActivity(BaseTenCentWebViewActivity::class.java)
finish()
}
@ -151,12 +169,13 @@ class CreateGoodsOrderAct : BaseVmAct<ShopMallVm>() {
}
REQUEST_COUP ->{
var couponBean = data?.extras!!.getParcelable<ChooseCouponBean>("coupon")
couponBean = data?.extras!!.getParcelable<ChooseCouponBean>("coupon")
if (couponBean != null) {
couponsId = couponBean.id
binding.tvDiscounts.text = "可优惠${couponBean.as_amount}"
couponsId = couponBean!!.id
bean?.let {
binding.tvPlatformDiscounts.text = "${(it.ori_price * bean!!.skuNum) - (it.skuPrice * it.skuNum) - couponBean.as_amount}"
// binding.tvTotalPrice.text ="¥ ${it.skuPrice * it.skuNum - couponBean.as_amount}"
mViewModel.computeAmount(it.skuId,it.skuNum,couponsId)
}
}
@ -165,4 +184,36 @@ class CreateGoodsOrderAct : BaseVmAct<ShopMallVm>() {
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
fun getWxPayResult(event: WxPayEvent) {
when (event.code) {
BaseResp.ErrCode.ERR_OK -> {
RouteManager.goAct(ARouterUrl.SHOP_ORDER_LIST_ACT)
Toast.makeText(
this@CreateGoodsOrderAct,
"支付成功",
Toast.LENGTH_SHORT
)
.show()
finish()
}
BaseResp.ErrCode.ERR_USER_CANCEL -> {
}
else -> {
Toast.makeText(
this@CreateGoodsOrderAct,
"支付失败,请联系客服",
Toast.LENGTH_SHORT
).show()
}
}
}
}

@ -146,10 +146,10 @@ class ShopCategoryActivity : BaseVmAct<ShopMallVm>() {
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)){
/* if(TextUtils.isEmpty(goodsName)){
CommonToastUtils.showToast("请输入搜索内容")
return true
}
}*/
page = 1
mViewModel.getGoodsList(goodsName,categoryId,0,page)
//mViewModel.getGoodsList(goodsName,0L,0,page)

@ -831,7 +831,7 @@ class DynamicManagementFrag : BaseVmFrag<DynamicManagementVm>() , EasyPermission
MMkvHelper.put(Const.DEVICE_TYPE, deviceType)
}
requestByDeviceModel()
// requestByDeviceModel()
if (healthMonitoringListData.size > 9) {
for ((index, healthMonitoringListBean) in healthMonitoringListData.withIndex()) {
if (index < 9) {
@ -924,7 +924,7 @@ class DynamicManagementFrag : BaseVmFrag<DynamicManagementVm>() , EasyPermission
// mViewModel.getWelcomeInfo(settingBean.user.id)
// mViewModel.getWarningMsg()//获取预警消息
requestByDeviceModel()
// requestByDeviceModel()
// 激活过才能开启定是我任务
//Log.e("worker", "定时任务开启")
@ -1217,45 +1217,54 @@ class DynamicManagementFrag : BaseVmFrag<DynamicManagementVm>() , EasyPermission
private var mDisposable: Disposable? = null
fun startUpdateHealthInfoLive(){
LogUtils.e("DynamicManagementFrag","刷新数据")
getHealthInfoJob = mainScope.launch (Dispatchers.IO){
if(mDisposable == null){
Observable.interval(1000 * 60,60*1000,TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread()).subscribe(object : Observer<Long>{
override fun onSubscribe(d: Disposable) {
mDisposable = d
}
LogUtils.e("DynamicManagementFrag","刷新数据 ${getHealthInfoJob} disposable:${mDisposable}")
override fun onError(e: Throwable) {
cancelTimer()
}
if(mDisposable == null){
Observable.interval(1000 * 60,60*1000,TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread()).subscribe(object : Observer<Long>{
override fun onSubscribe(d: Disposable) {
mDisposable = d
}
override fun onComplete() {
cancelTimer()
}
override fun onError(e: Throwable) {
cancelTimer()
}
override fun onNext(t: Long) {
LogUtils.e("DynamicManagementFrag","刷新数据${t}s")
isJob = true
mViewModel.getAllInfo(showIdInfo, false,true)
}
override fun onComplete() {
cancelTimer()
}
})
}
override fun onNext(t: Long) {
LogUtils.e("DynamicManagementFrag","刷新数据${t}s")
isJob = true
mViewModel.getAllInfo(showIdInfo, false,true)
}
})
}
/* if (getHealthInfoJob == null){
getHealthInfoJob = mainScope.launch (Dispatchers.IO){
}
}*/
}
fun cancelTimer(){
getHealthInfoJob?.cancel()
LogUtils.e("DynamicManagementFrag","取消定时cancelTimer")
// getHealthInfoJob?.cancel()
mDisposable?.let {
if(it.isDisposed){
if(!it.isDisposed){
LogUtils.e("DynamicManagementFrag","取消定时")
it.dispose()
}
}
mDisposable = null
// getHealthInfoJob = null
}
override fun onDestroyView() {

@ -470,10 +470,12 @@ class MineFrag : BaseVmFrag<SettingVm>() , EasyPermissions.PermissionCallbacks{
private fun refresh() {
refresh.setRefresh(binding.mRefresh) {
mViewModel.getMySetting()
mViewModel.getUserOtherInfo()
mViewModel.getAllInfo(showIdInfo,false)
mViewModel.searchInviteInfo()
if (!TextUtils.isEmpty(showIdInfo)) {
mViewModel.getMySetting()
mViewModel.getUserOtherInfo()
mViewModel.getAllInfo(showIdInfo, false)
mViewModel.searchInviteInfo()
}
}
}
@ -483,7 +485,6 @@ class MineFrag : BaseVmFrag<SettingVm>() , EasyPermissions.PermissionCallbacks{
mViewModel.getMySetting()
mViewModel.getAllInfo(showIdInfo,false)
mViewModel.searchInviteInfo()
mViewModel.getUserOtherInfo()
}
@ -594,9 +595,10 @@ class MineFrag : BaseVmFrag<SettingVm>() , EasyPermissions.PermissionCallbacks{
} else {
MMkvHelper.getLong(Const.USER_ID).toString()
}
// mViewModel.getMySetting()
// mViewModel.getScore(1)
mViewModel.getMySetting()
mViewModel.getAllInfo(showIdInfo,false)
mViewModel.searchInviteInfo()
mViewModel.getUserOtherInfo()
}
@Subscribe(threadMode = ThreadMode.MAIN)
@ -620,10 +622,10 @@ class MineFrag : BaseVmFrag<SettingVm>() , EasyPermissions.PermissionCallbacks{
}
@Subscribe(threadMode = ThreadMode.MAIN)
fun refreshUI(event: MyInfoEvent){
// mViewModel.getMySetting()
mViewModel.getMySetting()
mViewModel.getAllInfo(showIdInfo,false)
// mViewModel.getScore(1)
mViewModel.searchInviteInfo()
mViewModel.getUserOtherInfo()
}

@ -76,10 +76,10 @@ class ShopFragment: BaseFragList<ShopMallVm>() {
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)){
/*if(TextUtils.isEmpty(goodsName)){
CommonToastUtils.showToast("请输入搜索内容")
return true
}
}*/
page = 1
mViewModel.getGoodsList(goodsName,0L,0,page)

@ -21,6 +21,8 @@ class ShopMallVm : BaseVm() {
val hasCouponLiveData by lazy { MutableLiveData<RespBody<Int>> ()}
val computeAmountLiveData by lazy { MutableLiveData<RespBody<String>>() }
fun getGoodsCategory(parentId:Long){
startHttp {
var code = apiInterface().getGoodsCategory(parentId)
@ -75,4 +77,15 @@ class ShopMallVm : BaseVm() {
}
}
fun computeAmount(skuId:Long,num:Int,couponsId:Long?){
startHttp {
var json = JSONObject()
json.put("skuId",skuId)
json.put("num",num)
json.put("couponsId",couponsId)
var code = apiInterface().computeAmount(retrofits.getRequestBody(json.toString()))
code.getCodeStatus(computeAmountLiveData,nowData)
}
}
}

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
tools:ignore="MissingDefaultResource">
<external-path name="external_files" path="."/>
</paths>

@ -179,10 +179,16 @@ open class CloudJSBridge(val context: Context, val listener: IJsBridge) {
LogUtils.e("CloudJSBridge","questionFunction:${str}")
str?.let {
listener.switchView("questionFunction",it)
var bean = GsonUtils.fromJson(it, PsyTestSuccessBean::class.java)
baseActivity.bundle.clear()
baseActivity.bundle.putLong("answerId", bean.data)
RouteManager.goAct(ARouterUrl.PSYCHOLOGICAL_RESULT_ACT, baseActivity.bundle)
if (bean.type == 0){
baseActivity.finish()
}else{
baseActivity.bundle.clear()
baseActivity.bundle.putLong("answerId", bean.id)
RouteManager.goAct(ARouterUrl.PSYCHOLOGICAL_RESULT_ACT, baseActivity.bundle)
}
}
}

@ -1,5 +1,6 @@
package com.xty.base.model
data class PsyTestSuccessBean(
var data:Long
var id:Long,
var type:Int //0提交后关闭当前页 1到下一页
)

@ -250,32 +250,21 @@ open class PayUtils(var context: Context) {
bundle.putString("orderType", "1")
RouteManager.goAct(ARouterUrl.PAY_SUCCESS, bundle)*/
if(isPayGoods){
}else{
Toast.makeText(
context,
"支付成功",
Toast.LENGTH_SHORT
)
.show()
EventBus.getDefault().post(ReChangeEvent())
}
Toast.makeText(
context,
"支付成功",
Toast.LENGTH_SHORT
)
.show()
EventBus.getDefault().post(ReChangeEvent())
} else {
if(isPayGoods){
}else{
Toast.makeText(
context,
"支付失败,请联系客服",
Toast.LENGTH_SHORT
)
.show()
}
Toast.makeText(
context,
"支付失败,请联系客服",
Toast.LENGTH_SHORT
)
.show()
// 该笔订单真实的支付结果,需要依赖服务端的异步通知。
// com.alipay.sdk.pay.demo.PayDemoActivity.showAlert(
@ -293,18 +282,13 @@ open class PayUtils(var context: Context) {
bundle.putString("orderNo", orderNo)
bundle.putString("orderType", "1")
RouteManager.goAct(ARouterUrl.PAY_SUCCESS, bundle)*/
if(isPayGoods){
}else{
EventBus.getDefault().post(ReChangeEvent())
Toast.makeText(
context,
"支付成功",
Toast.LENGTH_SHORT
)
.show()
}
EventBus.getDefault().post(ReChangeEvent())
Toast.makeText(
context,
"支付成功",
Toast.LENGTH_SHORT
)
.show()
}
BaseResp.ErrCode.ERR_USER_CANCEL -> {
@ -312,16 +296,11 @@ open class PayUtils(var context: Context) {
}
else -> {
if(isPayGoods){
}else{
Toast.makeText(
context,
"支付失败,请联系客服",
Toast.LENGTH_SHORT
).show()
}
Toast.makeText(
context,
"支付失败,请联系客服",
Toast.LENGTH_SHORT
).show()
}
}
}

@ -142,6 +142,9 @@ class Const {
const val CONVERSATION_UNREAD_COUNT_ACTION = "conversation_unread_count_action"
const val UNREAD_COUNT_EXTRA = "unread_count_extra"
const val VERSION_NAME= "appVersion"
const val VERSION_CODES = "version_code"
// const val userName = "User_Name"
// const val userBean = "UserUser"
}

@ -1,8 +1,10 @@
package com.xty.common;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class Dateutils {
@ -25,7 +27,7 @@ public class Dateutils {
return dateString;
}
// 格式化日期对象为新的字符串
// 格式化日期对象为新的字符串
DateFormat newFormatter = new SimpleDateFormat("MM-dd");
String newDateString = newFormatter.format(date);
return newDateString;
@ -43,7 +45,7 @@ public class Dateutils {
return dateString;
}
// 格式化日期对象为新的字符串
// 格式化日期对象为新的字符串
DateFormat newFormatter = new SimpleDateFormat("MM");
String newDateString = newFormatter.format(date);
return newDateString+"月";
@ -67,9 +69,92 @@ public class Dateutils {
return dateString;
}
// 格式化日期对象为新的字符串
// 格式化日期对象为新的字符串
DateFormat newFormatter = new SimpleDateFormat(format);
String newDateString = newFormatter.format(date);
return newDateString;
}
/**
* 2013:10:08 11:48:07
*
*
* @param datetime
* @return
*/
public static long dateTimeToMSs(String datetime ,String format) {
if (android.text.TextUtils.isEmpty(datetime)) return 0;
SimpleDateFormat sdf = new SimpleDateFormat(format);
final Date parse;
try {
parse = sdf.parse(datetime);
} catch (ParseException e) {
e.printStackTrace();
return 0;
}
return parse.getTime();
}
/**
* getDateToString(long milSecond)
* )
* long milSecond
* String
*/
public static String getDateToString(String datetime) {
long milSecond = dateTimeToMSs(datetime,YYYY_MM_DD_HH_MM_SS);
//现在时间
String now = new SimpleDateFormat("yyyy-MM-dd ").format(milSecond);
//昨天
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, -1);
String yday = new SimpleDateFormat("yyyy-MM-dd ").format(cal.getTime());
//今天
Calendar c = Calendar.getInstance();
c.add(Calendar.DATE, 0);
String today = new SimpleDateFormat("yyyy-MM-dd ").format(c.getTime());
//其他时间段
Date date = new Date(milSecond);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
if (now.equals(today)) {
return "今天 "+ formatTime(milSecond,HH_MM_Format);
} else if (now.equals(yday)) {
return "昨天 " + formatTime(milSecond,HH_MM_Format);
} else {
return format.format(date);
}
}
/**
* getDateToString(long milSecond)
* )
* long milSecond
* String
*/
public static String getDateToString(long milSecond) {
//现在时间
String now = new SimpleDateFormat("yyyy-MM-dd ").format(milSecond);
//昨天
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, -1);
String yday = new SimpleDateFormat("yyyy-MM-dd ").format(cal.getTime());
//今天
Calendar c = Calendar.getInstance();
c.add(Calendar.DATE, 0);
String today = new SimpleDateFormat("yyyy-MM-dd ").format(c.getTime());
//其他时间段
Date date = new Date(milSecond);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
if (now.equals(today)) {
return "今天";
} else if (now.equals(yday)) {
return "昨天";
} else {
return format.format(date);
}
}
}

@ -34,6 +34,7 @@ import com.xty.common.bracelet.checkBlueConnectPermission
import com.xty.common.bracelet.getBluePermission
import com.xty.common.event.BlueToothConnectEvent
import com.xty.common.receiver.BluetoothMonitorReceiver
import com.xty.network.utils.AppUtils
import com.yucheng.ycbtsdk.Constants
import com.yucheng.ycbtsdk.YCBTClient
import com.yucheng.ycbtsdk.response.BleConnectResponse
@ -103,6 +104,9 @@ class MyApp : Application() {
)
)
.commit()
MMkvHelper.put(Const.VERSION_NAME, AppUtils.getPackageVersionName(this))
MMkvHelper.put(Const.VERSION_CODES, AppUtils.getVersionCode(this))
}
// private fun forceStopApp(){

@ -27,6 +27,7 @@ class ARouterUrl {
const val SHOP_ORDER_LIST_ACT = "/health/com/zj365/health/act/ShopOrderListAct"
const val SHOP_ORDER_DETAIL_ACT = "/health/com/zj365/health/act/ShopOrderDetailAct"
const val CREATE_SHOP_ORDER_ACT = "/com/zj365/dc/activity/shop/CreateGoodsOrderAct"
const val LOGISTICS_ACT = "/health/com/zj365/health/act/GoodsLogisticsAct"
// const val FAMILY_INFO="/com/zj365/dc/act/FamilyMainAct"

@ -0,0 +1,669 @@
package com.xty.common.util;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import androidx.core.content.FileProvider;
import com.xty.common.BuildConfig;
import com.xuexiang.xutil.app.AppUtils;
import java.io.File;
import java.util.HashMap;
public class OpenFilesUtils {
//android获取一个用于打开HTML文件的intent
public static Intent getHtmlFileIntent(File file)
{
Uri uri = Uri.parse(file.toString()).buildUpon().encodedAuthority("com.android.htmlfileprovider").scheme("content").encodedPath(file.toString()).build();
Intent intent = new Intent("android.intent.action.VIEW");
intent.setDataAndType(uri, "text/html");
return intent;
}
//android获取一个用于打开图片文件的intent
public static Intent getImageFileIntent(File file)
{
Intent intent = new Intent("android.intent.action.VIEW");
intent.addCategory("android.intent.category.DEFAULT");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Uri uri = Uri.fromFile(file);
intent.setDataAndType(uri, "image/*");
return intent;
}
//android获取一个用于打开PDF文件的intent
public static Intent getPdfFileIntent(File file)
{
Intent intent = new Intent("android.intent.action.VIEW");
intent.addCategory("android.intent.category.DEFAULT");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
Uri uri = Uri.fromFile(file);
intent.setDataAndType(uri, "application/pdf");
return intent;
}
//android获取一个用于打开文本文件的intent
public static Intent getTextFileIntent(Context context,String param)
{
Intent intent = new Intent("android.intent.action.VIEW");
intent.addCategory("android.intent.category.DEFAULT");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
Uri uri = FileProvider.getUriForFile(context, "com.zj365.dc.fileProvider",new File(param));
intent.setDataAndType(uri, "application/vnd.android.package-archive");
return intent;
}
//android获取一个用于打开音频文件的intent
public static Intent getAudioFileIntent(File file)
{
Intent intent = new Intent("android.intent.action.VIEW");
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra("oneshot", 0);
intent.putExtra("configchange", 0);
Uri uri = Uri.fromFile(file);
intent.setDataAndType(uri, "audio/*");
return intent;
}
//android获取一个用于打开视频文件的intent
public static Intent getVideoFileIntent(File file)
{
Intent intent = new Intent("android.intent.action.VIEW");
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra("oneshot", 0);
intent.putExtra("configchange", 0);
Uri uri = Uri.fromFile(file);
intent.setDataAndType(uri, "video/*");
return intent;
}
//android获取一个用于打开CHM文件的intent
public static Intent getChmFileIntent(File file)
{
Intent intent = new Intent("android.intent.action.VIEW");
intent.addCategory("android.intent.category.DEFAULT");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Uri uri = Uri.fromFile(file);
intent.setDataAndType(uri, "application/x-chm");
return intent;
}
//android获取一个用于打开Word文件的intent
public static Intent getWordFileIntent(File file)
{
Intent intent = new Intent("android.intent.action.VIEW");
intent.addCategory("android.intent.category.DEFAULT");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Uri uri = Uri.fromFile(file);
intent.setDataAndType(uri, "application/msword");
return intent;
}
//android获取一个用于打开Excel文件的intent
public static Intent getExcelFileIntent(File file)
{
Intent intent = new Intent("android.intent.action.VIEW");
intent.addCategory("android.intent.category.DEFAULT");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Uri uri = Uri.fromFile(file);
intent.setDataAndType(uri, "application/vnd.ms-excel");
return intent;
}
//android获取一个用于打开PPT文件的intent
public static Intent getPPTFileIntent(File file)
{
Intent intent = new Intent("android.intent.action.VIEW");
intent.addCategory("android.intent.category.DEFAULT");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Uri uri = Uri.fromFile(file);
intent.setDataAndType(uri, "application/vnd.ms-powerpoint");
return intent;
}
//android获取一个用于打开apk文件的intent
public static Intent getApkFileIntent(File file)
{
Intent intent = new Intent();
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setAction(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
return intent;
}
public static void openFile(Context context, File file) {
Intent intent = new Intent();
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//设置intent的Action属性
intent.setAction(Intent.ACTION_VIEW);
Uri uri = null;
//支持Android7.0Android 7.0以后用了Content Uri 替换了原本的File Uri
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
uri = FileProvider.getUriForFile(context, AppUtils.getPackageName() + ".fileProvider", file);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
} else {
uri = Uri.fromFile(file);
}
//获取文件file的MIME类型
String type = GetFileMIME(file.getName());
//设置intent的data和Type属性。
intent.setDataAndType(uri, type);
//跳转
try {
context.startActivity(intent);
} catch (Exception e) {
/* LogUtil.E("FileUtil", e.getMessage());
Toast.makeText(context, "找不到打开此文件的应用!", Toast.LENGTH_SHORT).show();*/
}
}
/**
* MIME
*/
public static String GetFileMIME(String path) {
String docType = "";
if (path.contains(".")) {
docType = path.split("\\.")[path.split("\\.").length - 1];
}
return getMimeType(docType);
}
private static String getMimeType(String docType) {
String mime = "";
HashMap<String, String> h = new HashMap<String, String>();
h.put("", "application/octet-stream");
h.put("323", "text/h323");
h.put("3gp", "video/3gpp");
h.put("aab", "application/x-authoware-bin");
h.put("aam", "application/x-authoware-map");
h.put("aas", "application/x-authoware-seg");
h.put("acx", "application/internet-property-stream");
h.put("ai", "application/postscript");
h.put("aif", "audio/x-aiff");
h.put("aifc", "audio/x-aiff");
h.put("aiff", "audio/x-aiff");
h.put("als", "audio/X-Alpha5");
h.put("amc", "application/x-mpeg");
h.put("ani", "application/octet-stream");
h.put("apk", "application/vnd.android.package-archive");
h.put("asc", "text/plain");
h.put("asd", "application/astound");
h.put("asf", "video/x-ms-asf");
h.put("asn", "application/astound");
h.put("asp", "application/x-asap");
h.put("asr", "video/x-ms-asf");
h.put("asx", "video/x-ms-asf");
h.put("au", "audio/basic");
h.put("avb", "application/octet-stream");
h.put("avi", "video/x-msvideo");
h.put("awb", "audio/amr-wb");
h.put("axs", "application/olescript");
h.put("bas", "text/plain");
h.put("bcpio", "application/x-bcpio");
h.put("bin ", "application/octet-stream");
h.put("bld", "application/bld");
h.put("bld2", "application/bld2");
h.put("bmp", "image/bmp");
h.put("bpk", "application/octet-stream");
h.put("bz2", "application/x-bzip2");
h.put("c", "text/plain");
h.put("cal", "image/x-cals");
h.put("cat", "application/vnd.ms-pkiseccat");
h.put("ccn", "application/x-cnc");
h.put("cco", "application/x-cocoa");
h.put("cdf", "application/x-cdf");
h.put("cer", "application/x-x509-ca-cert");
h.put("cgi", "magnus-internal/cgi");
h.put("chat", "application/x-chat");
h.put("class", "application/octet-stream");
h.put("clp", "application/x-msclip");
h.put("cmx", "image/x-cmx");
h.put("co", "application/x-cult3d-object");
h.put("cod", "image/cis-cod");
h.put("conf", "text/plain");
h.put("cpio", "application/x-cpio");
h.put("cpp", "text/plain");
h.put("cpt", "application/mac-compactpro");
h.put("crd", "application/x-mscardfile");
h.put("crl", "application/pkix-crl");
h.put("crt", "application/x-x509-ca-cert");
h.put("csh", "application/x-csh");
h.put("csm", "chemical/x-csml");
h.put("csml", "chemical/x-csml");
h.put("css", "text/css");
h.put("cur", "application/octet-stream");
h.put("dcm", "x-lml/x-evm");
h.put("dcr", "application/x-director");
h.put("dcx", "image/x-dcx");
h.put("der", "application/x-x509-ca-cert");
h.put("dhtml", "text/html");
h.put("dir", "application/x-director");
h.put("dll", "application/x-msdownload");
h.put("dmg", "application/octet-stream");
h.put("dms", "application/octet-stream");
h.put("doc", "application/msword");
h.put("docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
h.put("dot", "application/msword");
h.put("dvi", "application/x-dvi");
h.put("dwf", "drawing/x-dwf");
h.put("dwg", "application/x-autocad");
h.put("dxf", "application/x-autocad");
h.put("dxr", "application/x-director");
h.put("ebk", "application/x-expandedbook");
h.put("emb", "chemical/x-embl-dl-nucleotide");
h.put("embl", "chemical/x-embl-dl-nucleotide");
h.put("eps", "application/postscript");
h.put("epub", "application/epub+zip");
h.put("eri", "image/x-eri");
h.put("es", "audio/echospeech");
h.put("esl", "audio/echospeech");
h.put("etc", "application/x-earthtime");
h.put("etx", "text/x-setext");
h.put("evm", "x-lml/x-evm");
h.put("evy", "application/envoy");
h.put("exe", "application/octet-stream");
h.put("fh4", "image/x-freehand");
h.put("fh5", "image/x-freehand");
h.put("fhc", "image/x-freehand");
h.put("fif", "application/fractals");
h.put("flr", "x-world/x-vrml");
h.put("flv", "video/octet-stream" /*"flv-application/octet-stream"*/);
h.put("fm", "application/x-maker");
h.put("fpx", "image/x-fpx");
h.put("fvi", "video/isivideo");
h.put("gau", "chemical/x-gaussian-input");
h.put("gca", "application/x-gca-compressed");
h.put("gdb", "x-lml/x-gdb");
h.put("gif", "image/gif");
h.put("gps", "application/x-gps");
h.put("gtar", "application/x-gtar");
h.put("gz", "application/x-gzip");
h.put("h", "text/plain");
h.put("hdf", "application/x-hdf");
h.put("hdm", "text/x-hdml");
h.put("hdml", "text/x-hdml");
h.put("hlp", "application/winhlp");
h.put("hqx", "application/mac-binhex40");
h.put("hta", "application/hta");
h.put("htc", "text/x-component");
h.put("htm", "text/html");
h.put("html", "text/html");
h.put("hts", "text/html");
h.put("htt", "text/webviewhtml");
h.put("ice", "x-conference/x-cooltalk");
h.put("ico", "image/x-icon");
h.put("ief", "image/ief");
h.put("ifm", "image/gif");
h.put("ifs", "image/ifs");
h.put("iii", "application/x-iphone");
h.put("imy", "audio/melody");
h.put("ins", "application/x-internet-signup");
h.put("ips", "application/x-ipscript");
h.put("ipx", "application/x-ipix");
h.put("isp", "application/x-internet-signup");
h.put("it", "audio/x-mod");
h.put("itz", "audio/x-mod");
h.put("ivr", "i-world/i-vrml");
h.put("j2k", "image/j2k");
h.put("jad", "text/vnd.sun.j2me.app-descriptor");
h.put("jam", "application/x-jam");
h.put("jar", "application/java-archive");
h.put("java", "text/plain");
h.put("jfif", "image/pipeg");
h.put("jnlp", "application/x-java-jnlp-file");
h.put("jpe", "image/jpeg");
h.put("jpeg", "image/jpeg");
h.put("jpg", "image/jpeg");
h.put("jpz", "image/jpeg");
h.put("js", "application/x-javascript");
h.put("json", "application/json");
h.put("jwc", "application/jwc");
h.put("kjx", "application/x-kjx");
h.put("lak", "x-lml/x-lak");
h.put("latex", "application/x-latex");
h.put("lcc", "application/fastman");
h.put("lcl", "application/x-digitalloca");
h.put("lcr", "application/x-digitalloca");
h.put("lgh", "application/lgh");
h.put("lha", "application/octet-stream");
h.put("lml", "x-lml/x-lml");
h.put("lmlpack", "x-lml/x-lmlpack");
h.put("log", "text/plain");
h.put("lsf", "video/x-la-asf");
h.put("lsx", "video/x-la-asf");
h.put("lzh", "application/octet-stream");
h.put("m13", "application/x-msmediaview");
h.put("m14", "application/x-msmediaview");
h.put("m15", "audio/x-mod");
h.put("m3u", "audio/x-mpegurl");
h.put("m3u8", "application/x-mpegURL");//XXX 待测
h.put("m3url", "audio/x-mpegurl");
h.put("m4a", "audio/mp4a-latm");
h.put("m4b", "audio/mp4a-latm");
h.put("m4p", "audio/mp4a-latm");
h.put("m4u", "video/vnd.mpegurl");
h.put("m4v", "video/x-m4v");
h.put("ma1", "audio/ma1");
h.put("ma2", "audio/ma2");
h.put("ma3", "audio/ma3");
h.put("ma5", "audio/ma5");
h.put("man", "application/x-troff-man");
h.put("map", "magnus-internal/imagemap");
h.put("mbd", "application/mbedlet");
h.put("mct", "application/x-mascot");
h.put("mdb", "application/x-msaccess");
h.put("mdz", "audio/x-mod");
h.put("me", "application/x-troff-me");
h.put("mel", "text/x-vmel");
h.put("mht", "message/rfc822");
h.put("mhtml", "message/rfc822");
h.put("mi", "application/x-mif");
h.put("mid", "audio/mid");
h.put("midi", "audio/midi");
h.put("mif", "application/x-mif");
h.put("mil", "image/x-cals");
h.put("mio", "audio/x-mio");
h.put("mmf", "application/x-skt-lbs");
h.put("mng", "video/x-mng");
h.put("mny", "application/x-msmoney");
h.put("moc", "application/x-mocha");
h.put("mocha", "application/x-mocha");
h.put("mod", "audio/x-mod");
h.put("mof", "application/x-yumekara");
h.put("mol", "chemical/x-mdl-molfile");
h.put("mop", "chemical/x-mopac-input");
h.put("mov", "video/quicktime");
h.put("movie", "video/x-sgi-movie");
h.put("mp2", "video/mpeg");
h.put("mp3", "audio/mpeg");
h.put("mp4", "video/mp4");
h.put("mpa", "video/mpeg");
h.put("mpc", "application/vnd.mpohun.certificate");
h.put("mpe", "video/mpeg");
h.put("mpeg", "video/mpeg");
h.put("mpg", "video/mpeg");
h.put("mpg4", "video/mp4");
h.put("mpga", "audio/mpeg");
h.put("mpn", "application/vnd.mophun.application");
h.put("mpp", "application/vnd.ms-project");
h.put("mps", "application/x-mapserver");
h.put("mpv2", "video/mpeg");
h.put("mrl", "text/x-mrml");
h.put("mrm", "application/x-mrm");
h.put("ms", "application/x-troff-ms");
h.put("msg", "application/vnd.ms-outlook");
h.put("mts", "application/metastream");
h.put("mtx", "application/metastream");
h.put("mtz", "application/metastream");
h.put("mvb", "application/x-msmediaview");
h.put("mzv", "application/metastream");
h.put("nar", "application/zip");
h.put("nbmp", "image/nbmp");
h.put("nc", "application/x-netcdf");
h.put("ndb", "x-lml/x-ndb");
h.put("ndwn", "application/ndwn");
h.put("nif", "application/x-nif");
h.put("nmz", "application/x-scream");
h.put("nokia-op-logo", "image/vnd.nok-oplogo-color");
h.put("npx", "application/x-netfpx");
h.put("nsnd", "audio/nsnd");
h.put("nva", "application/x-neva1");
h.put("nws", "message/rfc822");
h.put("oda", "application/oda");
h.put("ogg", "audio/ogg");
h.put("oom", "application/x-AtlasMate-Plugin");
h.put("p10", "application/pkcs10");
h.put("p12", "application/x-pkcs12");
h.put("p7b", "application/x-pkcs7-certificates");
h.put("p7c", "application/x-pkcs7-mime");
h.put("p7m", "application/x-pkcs7-mime");
h.put("p7r", "application/x-pkcs7-certreqresp");
h.put("p7s", "application/x-pkcs7-signature");
h.put("pac", "audio/x-pac");
h.put("pae", "audio/x-epac");
h.put("pan", "application/x-pan");
h.put("pbm", "image/x-portable-bitmap");
h.put("pcx", "image/x-pcx");
h.put("pda", "image/x-pda");
h.put("pdb", "chemical/x-pdb");
h.put("pdf", "application/pdf");
h.put("pfr", "application/font-tdpfr");
h.put("pfx", "application/x-pkcs12");
h.put("pgm", "image/x-portable-graymap");
h.put("pict", "image/x-pict");
h.put("pko", "application/ynd.ms-pkipko");
h.put("pm", "application/x-perl");
h.put("pma", "application/x-perfmon");
h.put("pmc", "application/x-perfmon");
h.put("pmd", "application/x-pmd");
h.put("pml", "application/x-perfmon");
h.put("pmr", "application/x-perfmon");
h.put("pmw", "application/x-perfmon");
h.put("png", "image/png");
h.put("pnm", "image/x-portable-anymap");
h.put("pnz", "image/png");
h.put("pot,", "application/vnd.ms-powerpoint");
h.put("ppm", "image/x-portable-pixmap");
h.put("pps", "application/vnd.ms-powerpoint");
h.put("ppt", "application/vnd.ms-powerpoint");
h.put("pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation");
h.put("pqf", "application/x-cprplayer");
h.put("pqi", "application/cprplayer");
h.put("prc", "application/x-prc");
h.put("prf", "application/pics-rules");
h.put("prop", "text/plain");
h.put("proxy", "application/x-ns-proxy-autoconfig");
h.put("ps", "application/postscript");
h.put("ptlk", "application/listenup");
h.put("pub", "application/x-mspublisher");
h.put("pvx", "video/x-pv-pvx");
h.put("qcp", "audio/vnd.qcelp");
h.put("qt", "video/quicktime");
h.put("qti", "image/x-quicktime");
h.put("qtif", "image/x-quicktime");
h.put("r3t", "text/vnd.rn-realtext3d");
h.put("ra", "audio/x-pn-realaudio");
h.put("ram", "audio/x-pn-realaudio");
h.put("rar", "application/octet-stream");
h.put("ras", "image/x-cmu-raster");
h.put("rc", "text/plain");
h.put("rdf", "application/rdf+xml");
h.put("rf", "image/vnd.rn-realflash");
h.put("rgb", "image/x-rgb");
h.put("rlf", "application/x-richlink");
h.put("rm", "audio/x-pn-realaudio");
h.put("rmf", "audio/x-rmf");
h.put("rmi", "audio/mid");
h.put("rmm", "audio/x-pn-realaudio");
h.put("rmvb", "audio/x-pn-realaudio");
h.put("rnx", "application/vnd.rn-realplayer");
h.put("roff", "application/x-troff");
h.put("rp", "image/vnd.rn-realpix");
h.put("rpm", "audio/x-pn-realaudio-plugin");
h.put("rt", "text/vnd.rn-realtext");
h.put("rte", "x-lml/x-gps");
h.put("rtf", "application/rtf");
h.put("rtg", "application/metastream");
h.put("rtx", "text/richtext");
h.put("rv", "video/vnd.rn-realvideo");
h.put("rwc", "application/x-rogerwilco");
h.put("s3m", "audio/x-mod");
h.put("s3z", "audio/x-mod");
h.put("sca", "application/x-supercard");
h.put("scd", "application/x-msschedule");
h.put("sct", "text/scriptlet");
h.put("sdf", "application/e-score");
h.put("sea", "application/x-stuffit");
h.put("setpay", "application/set-payment-initiation");
h.put("setreg", "application/set-registration-initiation");
h.put("sgm", "text/x-sgml");
h.put("sgml", "text/x-sgml");
h.put("sh", "application/x-sh");
h.put("shar", "application/x-shar");
h.put("shtml", "magnus-internal/parsed-html");
h.put("shw", "application/presentations");
h.put("si6", "image/si6");
h.put("si7", "image/vnd.stiwap.sis");
h.put("si9", "image/vnd.lgtwap.sis");
h.put("sis", "application/vnd.symbian.install");
h.put("sit", "application/x-stuffit");
h.put("skd", "application/x-Koan");
h.put("skm", "application/x-Koan");
h.put("skp", "application/x-Koan");
h.put("skt", "application/x-Koan");
h.put("slc", "application/x-salsa");
h.put("smd", "audio/x-smd");
h.put("smi", "application/smil");
h.put("smil", "application/smil");
h.put("smp", "application/studiom");
h.put("smz", "audio/x-smd");
h.put("snd", "audio/basic");
h.put("spc", "application/x-pkcs7-certificates");
h.put("spl", "application/futuresplash");
h.put("spr", "application/x-sprite");
h.put("sprite", "application/x-sprite");
h.put("sdp", "application/sdp");
h.put("spt", "application/x-spt");
h.put("src", "application/x-wais-source");
h.put("sst", "application/vnd.ms-pkicertstore");
h.put("stk", "application/hyperstudio");
h.put("stl", "application/vnd.ms-pkistl");
h.put("stm", "text/html");
h.put("svg", "image/svg+xml");
h.put("sv4cpio", "application/x-sv4cpio");
h.put("sv4crc", "application/x-sv4crc");
h.put("svf", "image/vnd");
h.put("svh", "image/svh");
h.put("svr", "x-world/x-svr");
h.put("swf", "application/x-shockwave-flash");
h.put("swfl", "application/x-shockwave-flash");
h.put("t", "application/x-troff");
h.put("tad", "application/octet-stream");
h.put("talk", "text/x-speech");
h.put("tar", "application/x-tar");
h.put("taz", "application/x-tar");
h.put("tbp", "application/x-timbuktu");
h.put("tbt", "application/x-timbuktu");
h.put("tcl", "application/x-tcl");
h.put("tex", "application/x-tex");
h.put("texi", "application/x-texinfo");
h.put("texinfo", "application/x-texinfo");
h.put("tgz", "application/x-compressed");
h.put("thm", "application/vnd.eri.thm");
h.put("tif", "image/tiff");
h.put("tiff", "image/tiff");
h.put("tki", "application/x-tkined");
h.put("tkined", "application/x-tkined");
h.put("toc", "application/toc");
h.put("toy", "image/toy");
h.put("tr", "application/x-troff");
h.put("trk", "x-lml/x-gps");
h.put("trm", "application/x-msterminal");
h.put("tsi", "audio/tsplayer");
h.put("tsp", "application/dsptype");
h.put("tsv", "text/tab-separated-values");
h.put("ttf", "application/octet-stream");
h.put("ttz", "application/t-time");
h.put("txt", "text/plain");
h.put("uls", "text/iuls");
h.put("ult", "audio/x-mod");
h.put("ustar", "application/x-ustar");
h.put("uu", "application/x-uuencode");
h.put("uue", "application/x-uuencode");
h.put("vcd", "application/x-cdlink");
h.put("vcf", "text/x-vcard");
h.put("vdo", "video/vdo");
h.put("vib", "audio/vib");
h.put("viv", "video/vivo");
h.put("vivo", "video/vivo");
h.put("vmd", "application/vocaltec-media-desc");
h.put("vmf", "application/vocaltec-media-file");
h.put("vmi", "application/x-dreamcast-vms-info");
h.put("vms", "application/x-dreamcast-vms");
h.put("vox", "audio/voxware");
h.put("vqe", "audio/x-twinvq-plugin");
h.put("vqf", "audio/x-twinvq");
h.put("vql", "audio/x-twinvq");
h.put("vre", "x-world/x-vream");
h.put("vrml", "x-world/x-vrml");
h.put("vrt", "x-world/x-vrt");
h.put("vrw", "x-world/x-vream");
h.put("vts", "workbook/formulaone");
h.put("wav", "audio/x-wav");
h.put("wax", "audio/x-ms-wax");
h.put("wbmp", "image/vnd.wap.wbmp");
h.put("wcm", "application/vnd.ms-works");
h.put("wdb", "application/vnd.ms-works");
h.put("web", "application/vnd.xara");
h.put("wi", "image/wavelet");
h.put("wis", "application/x-InstallShield");
h.put("wks", "application/vnd.ms-works");
h.put("wm", "video/x-ms-wm");
h.put("wma", "audio/x-ms-wma");
h.put("wmd", "application/x-ms-wmd");
h.put("wmf", "application/x-msmetafile");
h.put("wml", "text/vnd.wap.wml");
h.put("wmlc", "application/vnd.wap.wmlc");
h.put("wmls", "text/vnd.wap.wmlscript");
h.put("wmlsc", "application/vnd.wap.wmlscriptc");
h.put("wmlscript", "text/vnd.wap.wmlscript");
h.put("wmv", "audio/x-ms-wmv");
h.put("wmx", "video/x-ms-wmx");
h.put("wmz", "application/x-ms-wmz");
h.put("wpng", "image/x-up-wpng");
h.put("wps", "application/vnd.ms-works");
h.put("wpt", "x-lml/x-gps");
h.put("wri", "application/x-mswrite");
h.put("wrl", "x-world/x-vrml");
h.put("wrz", "x-world/x-vrml");
h.put("ws", "text/vnd.wap.wmlscript");
h.put("wsc", "application/vnd.wap.wmlscriptc");
h.put("wv", "video/wavelet");
h.put("wvx", "video/x-ms-wvx");
h.put("wxl", "application/x-wxl");
h.put("x-gzip", "application/x-gzip");
h.put("xaf", "x-world/x-vrml");
h.put("xar", "application/vnd.xara");
h.put("xbm", "image/x-xbitmap");
h.put("xdm", "application/x-xdma");
h.put("xdma", "application/x-xdma");
h.put("xdw", "application/vnd.fujixerox.docuworks");
h.put("xht", "application/xhtml+xml");
h.put("xhtm", "application/xhtml+xml");
h.put("xhtml", "application/xhtml+xml");
h.put("xla", "application/vnd.ms-excel");
h.put("xlc", "application/vnd.ms-excel");
h.put("xll", "application/x-excel");
h.put("xlm", "application/vnd.ms-excel");
h.put("xls", "application/vnd.ms-excel");
h.put("xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
h.put("xlt", "application/vnd.ms-excel");
h.put("xlw", "application/vnd.ms-excel");
h.put("xm", "audio/x-mod");
h.put("xml", "text/plain");
h.put("xml", "application/xml");
h.put("xmz", "audio/x-mod");
h.put("xof", "x-world/x-vrml");
h.put("xpi", "application/x-xpinstall");
h.put("xpm", "image/x-xpixmap");
h.put("xsit", "text/xml");
h.put("xsl", "text/xml");
h.put("xul", "text/xul");
h.put("xwd", "image/x-xwindowdump");
h.put("xyz", "chemical/x-pdb");
h.put("yz1", "application/x-yz1");
h.put("z", "application/x-compress");
h.put("zac", "application/x-zaurus-zac");
h.put("zip", "application/zip");
mime = h.get(docType);
if (mime == null) {
mime = "application/octet-stream";
}
return mime;
}
// public static void
}

@ -207,4 +207,5 @@
<color name="col_04f">#FFD04F</color>
<color name="col_C53">#FFAC53</color>
<color name="col_D42">#F04D42</color>
<color name="col_c8c8">#CBC8C8</color>
</resources>

@ -149,6 +149,11 @@
android:name="com.zj365.health.act.ShopOrderListAct"
android:launchMode="singleTop"
android:screenOrientation="portrait" />
<activity
android:name="com.zj365.health.act.GoodsLogisticsAct"
android:launchMode="singleTop"
android:screenOrientation="portrait" />
<activity
android:name="com.zj365.health.act.OrderDetailAct"
android:launchMode="singleTop"

@ -0,0 +1,57 @@
package com.zj365.health.act
import android.graphics.Rect
import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.alibaba.android.arouter.facade.annotation.Route
import com.xty.base.act.BaseVmAct
import com.xty.base.vm.BaseVm
import com.xty.common.arouter.ARouterUrl
import com.zj365.health.adapter.GoodsLogisticsAdapter
import com.zj365.health.databinding.ActGoodsLogisticsBinding
import com.zj365.health.vm.GoodsLogisticsVm
@Route(path = ARouterUrl.LOGISTICS_ACT)
class GoodsLogisticsAct : BaseVmAct<GoodsLogisticsVm>() {
val binding by lazy { ActGoodsLogisticsBinding.inflate(layoutInflater) }
val adapter by lazy { GoodsLogisticsAdapter() }
var orderId:Long = 0
override fun liveObserver() {
mViewModel.goodsLogisticsLiveData.observe(this){
binding.tvTrackingNumber.text = "${it.data.express_name} ${it.data.express_sn}"
binding.tvShippingAddress.text = it.data.address
adapter.setNewInstance(it.data.data)
}
}
override fun initView() {
super.initView()
statusBar(binding.title.mView)
binding.title.mTvTitle.text = "物流信息"
binding.title.mIvBack.setOnClickListener {
finish()
}
orderId = intent.getLongExtra("orderId",0)
mViewModel.getShippingTracking(orderId)
binding.recycler.layoutManager = LinearLayoutManager(this)
binding.recycler.addItemDecoration(object : RecyclerView.ItemDecoration(){
override fun getItemOffsets(outRect: Rect, itemPosition: Int, parent: RecyclerView) {
super.getItemOffsets(outRect, itemPosition, parent)
}
})
binding.recycler.adapter = adapter
}
override fun setLayout() = binding.root
}

@ -34,6 +34,7 @@ import com.zj365.health.databinding.ActXtangOpenOrRenewBinding
import com.zj365.health.model.PayResult
import com.zj365.health.vm.XTangVm
import com.xty.network.model.OpenOrRenewBean
import com.zj365.health.weight.HealthDialog
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
@ -58,6 +59,13 @@ class OpenOrRenewAct : BaseVmAct<XTangVm>() {
private val SDK_PAY_FLAG = 1
private val WEIXIN_PAY_FLAG = 2
private var tips = ""
val tipDialog by lazy {
HealthDialog(this, true, tips) {
mViewModel.firstOpen(userId, pageType)
}
}
@SuppressLint("SimpleDateFormat")
override fun initData() {
super.initData()
@ -127,7 +135,28 @@ class OpenOrRenewAct : BaseVmAct<XTangVm>() {
if (!TextUtils.isEmpty(stringExtra)) {
bottomSheetDialog?.show()
} else {
mViewModel.firstOpen(userId, pageType)
if (pageType == 1) {
tips = "血糖建模出值重要提示:\n" +
"1、建模期间累计有效佩戴满72小时\n" +
"2、最少确保一天0-24点有完整佩戴数据\n" +
"3、高血糖用户在建模完成之后须做个人血糖模型校准\n" +
"4、APP所出血糖值为前一个小时血糖平均值。"
tipDialog.setContent(tips)
tipDialog.show()
}else if (pageType == 2){
tips = "尿酸建模出值重要提示:\n" +
"1、建模期间累计有效佩戴满72小时\n" +
"2、建模完成后每天18:00至第二天6:00期间佩戴时长累计满6小时APP出具尿酸值\n" +
"3、尿酸值每天700出值。本次值为前一天18:00到当天早上6:00尿酸平均值。"
tipDialog.setContent(tips)
tipDialog.show()
} else {
tips = "1、建模期间累计有效佩戴满72小时\n" +
"2、建模完成后每天18:00至第二天6:00期间佩戴时长累计满6小时APP出具血脂值\n" +
"3、血脂值每天700出值。本次值为前一天18:00到当天早上6:00血脂平均值。"
tipDialog.setContent(tips)
tipDialog.show()
}
}
}

@ -4,15 +4,18 @@ import android.Manifest
import android.content.Intent
import android.graphics.Rect
import android.net.Uri
import android.widget.Toast
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.alibaba.android.arouter.facade.annotation.Route
import com.androidkun.xtablayout.XTabLayout
import com.tencent.mm.opensdk.modelbase.BaseResp
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.common.event.WxPayEvent
import com.xty.network.model.ShopOrderListBean
import com.zj365.health.R
import com.zj365.health.adapter.GoodsOrderAdapter
@ -100,7 +103,9 @@ class ShopOrderListAct : BaseListAct<ShopOrderVm>() {
dialogCancel.show()
}else if(it.status == 3){
bundle.clear()
bundle.putLong("orderId",it.id)
RouteManager.goAct(ARouterUrl.LOGISTICS_ACT,bundle)
}else{
if(EasyPermissions.hasPermissions(this,
Manifest.permission.CALL_PHONE)){
@ -113,7 +118,7 @@ class ShopOrderListAct : BaseListAct<ShopOrderVm>() {
}
}
R.id.tv_refund ->{
if (it.status == 3 || it.status == 2){
if ( it.status == 2){
dialogReturn.setContentNew("您是否确认对此订单进行退款申请,申请完成" +
"后会在1~3个工作日对订单进行审核请及时" +
"关注订单状态")
@ -121,6 +126,15 @@ class ShopOrderListAct : BaseListAct<ShopOrderVm>() {
}else if (it.status == 1){
PayUtils(this).payForGoods(it.pay_price.toFloat(),it.order_no)
}else{
if(EasyPermissions.hasPermissions(this,
Manifest.permission.CALL_PHONE)){
startActivity(Intent(Intent.ACTION_CALL, Uri.parse("tel:4000063365")))
}else{
EasyPermissions.requestPermissions(this,"",
0x00011,
Manifest.permission.CALL_PHONE)
}
}
}
}
@ -217,4 +231,34 @@ class ShopOrderListAct : BaseListAct<ShopOrderVm>() {
page = 1
loadData()
}
@Subscribe(threadMode = ThreadMode.MAIN)
fun getWxPayResult(event: WxPayEvent) {
when (event.code) {
BaseResp.ErrCode.ERR_OK -> {
Toast.makeText(
this@ShopOrderListAct,
"支付成功",
Toast.LENGTH_SHORT
)
.show()
page = 1
loadData()
}
BaseResp.ErrCode.ERR_USER_CANCEL -> {
}
else -> {
Toast.makeText(
this@ShopOrderListAct,
"支付失败,请联系客服",
Toast.LENGTH_SHORT
).show()
}
}
}
}

@ -19,7 +19,9 @@ import com.xty.common.arouter.ARouterUrl
import com.xty.common.arouter.RouteManager
import com.xty.common.onEventObject
import com.xty.common.setImageUser
import com.xty.common.util.CommonUtils
import com.xty.common.weight.HealthBodyView
import com.xty.network.model.HealthArchiveBean
import com.zj365.health.BuildConfig
import com.zj365.health.adapter.familyhealth.HealthFamilyTargetAdapter
import com.zj365.health.databinding.ActHealthRecordMainBinding
@ -46,6 +48,8 @@ class HealthRecordMainAct : BaseVmAct<HealthRecordMainVm>() {
private var isScrollTable = false
private var launch: Job? = null
var mSurveysList = ArrayList<HealthArchiveBean.SurveysInfoBean>()
override fun liveObserver() {
@ -66,7 +70,13 @@ class HealthRecordMainAct : BaseVmAct<HealthRecordMainVm>() {
binding.tvBmiDesc.setTextColor(Color.parseColor("#02C191"))
}
binding.tvBmr.text = "${it.data.bmr}"
binding.tvBodyFat.text = if(it.data.bodyFat.isNullOrEmpty()) { "--"} else it.data.bodyFat
binding.mProgress.progress = it.data.userSchedule * 10
binding.clBody.tvScore.text = "${it.data.surveys.score}"
mSurveysList = it.data.surveys.list
initSurvey(mSurveysList)
mAdapter.setNewInstance(it.data.healData)
}
}
@ -84,10 +94,23 @@ class HealthRecordMainAct : BaseVmAct<HealthRecordMainVm>() {
mViewModel.getHealthArchive()
initTab()
initSurvey()
// initSurvey()
initAdapter()
initClickListener()
Const.mainLiveData.observe(this){
binding.tvName.text = it.user.name
if (it.user.avatarUrl.isNullOrEmpty()) {
binding.imgAvatar.setImageResource(R.mipmap.icon_default_avator)
} else {
binding.imgAvatar.setImageUser(
this,
it.user.avatarUrl,
it.user.sex.toString()
)
}
}
Const.mainLiveData.value?.let {
binding.tvName.text = it.user.name
if (it.user.avatarUrl.isNullOrEmpty()) {
@ -145,8 +168,8 @@ class HealthRecordMainAct : BaseVmAct<HealthRecordMainVm>() {
}
}
fun initSurvey(){
var surveyList = ArrayList<String>()
fun initSurvey(surveysList: ArrayList<HealthArchiveBean.SurveysInfoBean>){
/* var surveyList = ArrayList<String>()
surveyList.add("免疫系统")
surveyList.add("神经系统")
@ -156,13 +179,18 @@ class HealthRecordMainAct : BaseVmAct<HealthRecordMainVm>() {
surveyList.add("运动系统")
surveyList.add("心脑血管")
surveyList.add("消化系统")
surveyList.add("呼吸系统")
surveyList.add("呼吸系统")*/
binding.clBody.surveyView.setMenuItemTexts(surveyList)
binding.clBody.surveyView.setMenuItemTexts(surveysList)
binding.clBody.surveyView.setOnClicklisteners(object : HealthSurveyView.onItemClicked{
override fun onPositionClicked(postion: Int) {
var bean = mSurveysList[postion]
bundle.clear()
bundle.putString("web_site_url","${BuildConfig.url}shareApi/H5_question/${CommonUtils.getMyUserId()}/${bean.surveysId}/android/0")
bundle.putBoolean("isShowTitle",true)
bundle.putString("title",bean.name)
RouteManager.goAct(ARouterUrl.H5_ACT,bundle)
}
})
}

@ -39,7 +39,7 @@ class PsychologicalTestMainAct : BaseListAct<PsychologicalTestMainVm>() {
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.putString("web_site_url","${BuildConfig.url}shareApi/H5_question/${CommonUtils.getMyUserId()}/${bean.id}/android/1")
bundle.putBoolean("isShowTitle",true)
bundle.putString("title",bean.surveyName)
RouteManager.goAct(ARouterUrl.H5_ACT,bundle)

@ -0,0 +1,63 @@
package com.zj365.health.adapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.xty.base.adapter.BaseAdapter
import com.xty.common.Dateutils
import com.xty.common.LogUtils
import com.xty.network.model.GoodsLogisticsBean
import com.zj365.health.R
class GoodsLogisticsAdapter : BaseAdapter<GoodsLogisticsBean.LogisticsBean>(R.layout.item_goods_logistics) {
override fun convert(holder: BaseViewHolder, item: GoodsLogisticsBean.LogisticsBean) {
var statusDesc = ""
when(item.status){
101->{
statusDesc = "已揽件"
}
102->{
statusDesc = "在途中"
}
103->{
statusDesc = "派送中"
}
104 ->{
statusDesc = "已签收"
}
105->{
statusDesc = "用户拒签"
}
106->{
statusDesc = "疑难件"
}
107->{
statusDesc = "无效单"
}
108->{
statusDesc = "超时单"
}
109->{
statusDesc = "签收失败"
}
110->{
statusDesc = "退回"
}
111->{
statusDesc = "转投"
}
112->{
statusDesc = "待签"
}
}
holder.setText(R.id.tv_status_time,"${statusDesc} ${Dateutils.getDateToString(item.time)}")
holder.setText(R.id.tv_desc,item.context)
LogUtils.e("GoodsLogisticsAdapter","size:${data.size} position:${holder.layoutPosition}")
if (data.size -1 == holder.layoutPosition){
holder.setGone(R.id.line,true)
}else{
holder.setGone(R.id.line,false)
}
}
}

@ -49,6 +49,7 @@ class GoodsOrderAdapter : BaseAdapter<ShopOrderListBean.ShopOrderBean>(R.layout.
holder.setGone(R.id.tv_refund,false)
}
2 ->{
status.setTextColor(context.getColor(R.color.col_9BD))
holder.setGone(R.id.tv_confirm_receive_goods,true)
holder.setText(R.id.tv_logistics,"联系客服")
holder.setText(R.id.tv_refund,"申请退款")
@ -61,7 +62,7 @@ class GoodsOrderAdapter : BaseAdapter<ShopOrderListBean.ShopOrderBean>(R.layout.
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.setText(R.id.tv_refund,"联系客服")
holder.setGone(R.id.tv_logistics,false)
holder.setGone(R.id.tv_refund,false)

@ -0,0 +1,17 @@
package com.zj365.health.vm
import androidx.lifecycle.MutableLiveData
import com.xty.base.vm.BaseVm
import com.xty.network.model.GoodsLogisticsBean
import com.xty.network.model.RespBody
class GoodsLogisticsVm : BaseVm() {
val goodsLogisticsLiveData by lazy { MutableLiveData<RespBody<GoodsLogisticsBean>> ()}
fun getShippingTracking(orderId:Long){
startHttp {
val body = apiInterface().getLogistics(orderId)
body.getCodeStatus(goodsLogisticsLiveData, nowData)
}
}
}

@ -11,6 +11,7 @@ import android.widget.ImageView
import android.widget.TextView
import com.google.android.exoplayer2.util.ColorParser
import com.xty.common.LogUtils
import com.xty.network.model.HealthArchiveBean
import com.zj365.health.R
import kotlin.math.cos
import kotlin.math.roundToInt
@ -33,7 +34,7 @@ class HealthSurveyView(context: Context, attrs: AttributeSet?) : ViewGroup(conte
var mStartAngle = 270.0
//文本
var mSurveyText = ArrayList<String>()
var mSurveyText = ArrayList<HealthArchiveBean.SurveysInfoBean>()
var colors = arrayOf("#20C387","#FD830B","#1ECAFC")
@ -44,7 +45,7 @@ class HealthSurveyView(context: Context, attrs: AttributeSet?) : ViewGroup(conte
var mItemLayoutId: Int = R.layout.layout_health_survey_child
var mOnClicklistener: onItemClicked? = null
fun setMenuItemTexts( texts: ArrayList<String>) {
fun setMenuItemTexts( texts: ArrayList<HealthArchiveBean.SurveysInfoBean>) {
require(!( texts == null)) { "菜单文本和图标至少设置其一" }
mSurveyText = texts
//初始化mMenucount
@ -77,7 +78,7 @@ class HealthSurveyView(context: Context, attrs: AttributeSet?) : ViewGroup(conte
private fun initMenuItem(itemView: View, index: Int) {
val tv = itemView.findViewById<TextView>(R.id.tv_survey)
tv.text = mSurveyText[index]
tv.text = mSurveyText[index].name
when(index){
0,2,4,6 ->{
tv.setTextColor(Color.parseColor(colors[0]))

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

@ -20,7 +20,7 @@
app:layout_constraintTop_toBottomOf="@id/title"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintBottom_toTopOf="@+id/tvSubmit"
>
<ImageView
android:id="@+id/ivBg"

@ -0,0 +1,59 @@
<?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"
android:background="@color/col_6f7">
<include layout="@layout/title_white_bar"
android:id="@+id/title"/>
<com.ruffian.library.widget.RLinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_14"
android:layout_marginTop="@dimen/dp_14"
android:layout_marginRight="@dimen/dp_14"
android:paddingTop="@dimen/dp_20"
android:paddingBottom="@dimen/dp_20"
android:paddingLeft="@dimen/dp_22"
android:paddingRight="@dimen/dp_22"
android:orientation="vertical"
app:corner_radius="@dimen/dp_8"
app:background_normal="@color/white"
android:background="@color/white">
<TextView
android:id="@+id/tv_tracking_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/sp_15"
android:textColor="@color/col_313"
tools:text="顺丰速运 SC20230117BROHJ6"/>
<TextView
android:id="@+id/tv_shipping_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/sp_14"
android:textColor="@color/col_c7c"
android:layout_marginTop="@dimen/dp_12"
tools:text="收货地址:湖南省长沙市开福区四方坪长城万富 汇金座21007"/>
</com.ruffian.library.widget.RLinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/shape_round_white"
android:paddingTop="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_12"
android:layout_marginLeft="@dimen/dp_14"
android:layout_marginRight="@dimen/dp_14"
android:layout_marginBottom="@dimen/dp_14"/>
</LinearLayout>

@ -36,12 +36,14 @@
android:layout_marginRight="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_25">
<TextView
android:id="@+id/tv_order_no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="订单编号202307114545412"
android:textSize="@dimen/sp_15"
android:textColor="@color/col_c7c"/>
<TextView
android:id="@+id/tv_order_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="下单时间2023-07-11 22:02:03"
@ -58,6 +60,7 @@
android:textColor="@color/col_c7c"/>
<TextView
android:id="@+id/tv_tel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="预留电话18611375035"

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:paddingLeft="@dimen/dp_15"
android:paddingRight="@dimen/dp_15"
>
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/img_circle"
android:layout_width="@dimen/dp_10"
android:layout_height="@dimen/dp_10"
android:background="@drawable/shape_oval_c9c9"
app:layout_constraintTop_toTopOf="@+id/tv_status_time"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toBottomOf="@+id/tv_status_time"/>
<View
android:id="@+id/line"
android:layout_width="@dimen/dp_0_5"
android:layout_height="0dp"
android:minHeight="@dimen/dp_81"
android:background="@color/col_c8c8"
app:layout_constraintTop_toBottomOf="@+id/img_circle"
app:layout_constraintLeft_toLeftOf="@+id/img_circle"
app:layout_constraintRight_toRightOf="@+id/img_circle"
app:layout_constraintBottom_toBottomOf="@+id/ll_right"/>
<TextView
android:id="@+id/tv_status_time"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="@dimen/sp_15"
android:textColor="@color/col_313"
android:layout_marginLeft="@dimen/dp_14"
tools:text="今天01:32"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toRightOf="@+id/img_circle"
app:layout_constraintRight_toRightOf="parent"/>
<LinearLayout
android:id="@+id/ll_right"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_14"
app:layout_constraintTop_toBottomOf="@+id/tv_status_time"
app:layout_constraintLeft_toRightOf="@+id/img_circle"
android:gravity="left"
app:layout_constraintRight_toRightOf="parent"
android:orientation="vertical">
<TextView
android:id="@+id/tv_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/sp_14"
android:textColor="@color/col_c7c"
android:layout_marginTop="@dimen/dp_11"
android:layout_marginBottom="@dimen/dp_25"
tools:text="快件离开[鹰潭市寄递事业部邮区中心局快件处 理中心],正在发往下一站"/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:gravity="center"
android:layout_width="@dimen/dp_80"
android:layout_width="@dimen/dp_82"
android:layout_height="@dimen/dp_71">
<ImageView

@ -25,6 +25,10 @@
android:textSize="@dimen/sp_23"
android:textColor="@color/white"
android:textStyle="bold"
android:singleLine="true"
android:ellipsize="end"
android:paddingLeft="@dimen/dp_15"
android:paddingRight="@dimen/dp_15"
tools:text="性格测试"
android:layout_gravity="center"
/>

@ -14,6 +14,7 @@
android:background="@mipmap/bg_health_record_test">
<TextView
android:id="@+id/tv_score"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/sp_25"

@ -1,13 +1,29 @@
package com.zj365.mime.act
import android.os.Bundle
import android.text.TextUtils
import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import com.alibaba.android.arouter.facade.annotation.Route
import com.liulishuo.filedownloader.BaseDownloadTask
import com.liulishuo.filedownloader.FileDownloadSampleListener
import com.liulishuo.filedownloader.FileDownloader
import com.liulishuo.filedownloader.util.FileDownloadUtils
import com.tencent.smtt.sdk.QbSdk
import com.tencent.smtt.sdk.ValueCallback
import com.xty.base.act.BaseListAct
import com.xty.common.LogUtils
import com.xty.common.arouter.ARouterUrl
import com.xty.common.arouter.RouteManager
import com.xty.common.audioUtils.RecordAudio
import com.xty.common.util.OpenFilesUtils
import com.xty.network.model.EnterpriseInfoHomeBean
import com.zj365.mime.BuildConfig
import com.zj365.mime.adapter.EnterpriseInformationChildAdapter
import com.zj365.mime.databinding.ActEnterpriseInformationTypeBinding
import com.zj365.mime.vm.EnterpriseInformationVm
import java.io.File
@Route(path = ARouterUrl.ENTERPRISE_TYPE_INFO)
class EnterpriseInformationForTypeAct : BaseListAct<EnterpriseInformationVm>() {
@ -16,10 +32,103 @@ class EnterpriseInformationForTypeAct : BaseListAct<EnterpriseInformationVm>() {
val mAdapter by lazy { EnterpriseInformationChildAdapter(1) }
var type = 0
val audioUtils by lazy { RecordAudio() }
var isAudioPlay = false
override fun initAdapter() {
binding.mRecycle.adapter = mAdapter
binding.mRecycle.layoutManager = LinearLayoutManager(this@EnterpriseInformationForTypeAct)
mAdapter.setOnItemClickListener { adapter, view, position ->
var bean = adapter.data[position] as EnterpriseInfoHomeBean.EnterpriseInfoChildBean
when(bean.fileFormat){ // 格式1,word,2,pdf,3.文本4.excel,5.音频。6.链接
1->{
if (!TextUtils.isEmpty(bean.fileUrl)){
var filePath = FileDownloadUtils.getDefaultSaveRootPath() + File.separator + "zj365" + File.separator + "${bean.title}.word"
var file = File(filePath)
if (file.exists()){
file.delete()
}
createDownloadTask(filePath,bean.fileUrl,bean.fileFormat)!!.start()
}
}
2->{
if (!TextUtils.isEmpty(bean.fileUrl)){
var filePath = FileDownloadUtils.getDefaultSaveRootPath() + File.separator + "zj365" + File.separator + "${bean.title}.pdf"
var file = File(filePath)
if (file.exists()){
file.delete()
}
LogUtils.e("EnterpriseInformationForTypeAct","filePath${filePath}")
createDownloadTask(filePath,bean.fileUrl,bean.fileFormat)!!.start()
}
}
3 ->{
if (!TextUtils.isEmpty(bean.fileUrl)){
var filePath = FileDownloadUtils.getDefaultSaveRootPath() + File.separator + "zj365" + File.separator + "${bean.title}.txt"
var file = File(filePath)
if (file.exists()){
file.delete()
}
LogUtils.e("EnterpriseInformationForTypeAct","filePath${filePath}")
createDownloadTask(filePath,bean.fileUrl,bean.fileFormat)!!.start()
}
}
4->{
if (!TextUtils.isEmpty(bean.fileUrl)){
var filePath = FileDownloadUtils.getDefaultSaveRootPath() + File.separator + "zj365" + File.separator + "${bean.title}.xlsx"
var file = File(filePath)
if (file.exists()){
file.delete()
}
LogUtils.e("EnterpriseInformationForTypeAct","filePath${filePath}")
createDownloadTask(filePath,bean.fileUrl,bean.fileFormat)!!.start()
}
}
5->{
if (!TextUtils.isEmpty(bean.fileUrl)){
var filePath = FileDownloadUtils.getDefaultSaveRootPath() + File.separator + "zj365" + File.separator + "${bean.title}.mp3"
var file = File(filePath)
if (file.exists()){
file.delete()
}
LogUtils.e("EnterpriseInformationForTypeAct","filePath${filePath}")
createDownloadTask(filePath,bean.fileUrl,bean.fileFormat)!!.start()
}
}
6->{
if (!TextUtils.isEmpty(bean.fileUrl)){
bundle.clear()
bundle.putString(
"web_site_url",
"${bean.fileUrl}"
)
bundle.putBoolean("isShowTitle",true)
bundle.putString("title",bean.title)
RouteManager.goAct(ARouterUrl.H5_ACT,bundle)
}
}
}
}
setRecycleRefresh(binding.mRecycle,binding.mRefresh,true)
}
@ -31,8 +140,65 @@ class EnterpriseInformationForTypeAct : BaseListAct<EnterpriseInformationVm>() {
binding.title.mIvBack.setOnClickListener {
finish()
}
}
private fun createDownloadTask(filePath: String,url:String,fileFormat:Int): BaseDownloadTask? {
var isDir = false
return FileDownloader.getImpl().create(url)
.setPath(filePath, false)
.setCallbackProgressTimes(300)
.setMinIntervalUpdateSpeed(400)
.setTag(this)
.setListener(object : FileDownloadSampleListener() {
override fun pending(task: BaseDownloadTask, soFarBytes: Int, totalBytes: Int) {
super.pending(task, soFarBytes, totalBytes)
loadingView.show()
LogUtils.e("EnterpriseInformationForTypeAct","pending${soFarBytes}")
}
override fun progress(task: BaseDownloadTask, soFarBytes: Int, totalBytes: Int) {
super.progress(task, soFarBytes, totalBytes)
LogUtils.e("EnterpriseInformationForTypeAct","progress${soFarBytes}")
}
override fun error(task: BaseDownloadTask, e: Throwable) {
super.error(task, e)
}
override fun connected(
task: BaseDownloadTask,
etag: String,
isContinue: Boolean,
soFarBytes: Int,
totalBytes: Int
) {
super.connected(task, etag, isContinue, soFarBytes, totalBytes)
LogUtils.e("EnterpriseInformationForTypeAct","connected${soFarBytes}")
}
override fun paused(task: BaseDownloadTask, soFarBytes: Int, totalBytes: Int) {
super.paused(task, soFarBytes, totalBytes)
}
override fun completed(task: BaseDownloadTask) {
super.completed(task)
loadingView.dismiss()
OpenFilesUtils.openFile(this@EnterpriseInformationForTypeAct, File(filePath))
}
override fun warn(task: BaseDownloadTask) {
super.warn(task)
}
})
}
override fun onDestroy() {
audioUtils.stopPlay()
super.onDestroy()
}
override fun loadData() {

@ -137,9 +137,10 @@ class SettingNewAct: BaseVmAct<SettingVm>() {
// stopService(noneIntent)
MyWorkManger.cancelWork()
Const.mainLiveData?.value?.apply {
Const.mainLiveData.value = null
/* Const.mainLiveData?.value?.apply {
user?.bluetooth = ""//将蓝牙信息清空
}
}*/
MMkvHelper.remove(Const.Watch_Device_Type)//清除手表型号
Const.watchType = -1//将手表型号恢复初始值

@ -96,12 +96,14 @@ class ElectronicAddOrModifyAct : BaseVmAct<ElectronicFenceSettingVm>() {
binding.llData.visibility = View.GONE
binding.llSetting.visibility = View.VISIBLE
binding.tvCancel.visibility = View.VISIBLE
binding.tvConfirm.text = "确定"
initSettingData()
}else {
binding.llData.visibility = View.GONE
binding.llSetting.visibility = View.VISIBLE
binding.tvCancel.visibility = View.VISIBLE
binding.tvCancel.text = "删除"
binding.tvConfirm.text = "确定"
initModifyData()
}
@ -129,7 +131,7 @@ class ElectronicAddOrModifyAct : BaseVmAct<ElectronicFenceSettingVm>() {
bean?.let {
mViewModel.deleteBtFence(it.id)
}
}
}.show()
}else{
finish()

@ -62,6 +62,7 @@ class ElectronicFenceSettingAct : BaseVmAct<ElectronicFenceSettingVm>() {
mAdapter.setNewInstance(it.data.list)
total = it.data.count
binding.tvCount.text ="${it.data.count}/5"
aMap?.clear()
var boundsBuilder = LatLngBounds.Builder()
it.data.list.forEach {
@ -97,7 +98,7 @@ class ElectronicFenceSettingAct : BaseVmAct<ElectronicFenceSettingVm>() {
}
}
aMap?.animateCamera(CameraUpdateFactory.newLatLngBounds(boundsBuilder.build(),50))
aMap?.animateCamera(CameraUpdateFactory.newLatLngBounds(boundsBuilder.build(),300))
}
}

@ -1,11 +1,23 @@
package com.zj365.mime.adapter
import android.graphics.Rect
import android.os.Bundle
import android.text.TextUtils
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.liulishuo.filedownloader.BaseDownloadTask
import com.liulishuo.filedownloader.FileDownloadSampleListener
import com.liulishuo.filedownloader.FileDownloader
import com.liulishuo.filedownloader.util.FileDownloadUtils
import com.xty.base.adapter.BaseAdapter
import com.xty.common.LogUtils
import com.xty.common.arouter.ARouterUrl
import com.xty.common.arouter.RouteManager
import com.xty.common.util.OpenFilesUtils
import com.xty.network.model.EnterpriseInfoHomeBean
import com.zj365.mime.R
import java.io.File
class EnterpriseInformationAdapter : BaseAdapter<EnterpriseInfoHomeBean>(R.layout.item_enterprise_info) {
@ -18,8 +30,158 @@ class EnterpriseInformationAdapter : BaseAdapter<EnterpriseInfoHomeBean>(R.layou
recyclerView.layoutManager = LinearLayoutManager(context)
recyclerView.adapter = mAdapter
recyclerView.addItemDecoration(object : RecyclerView.ItemDecoration() {
override fun getItemOffsets(outRect: Rect, itemPosition: Int, parent: RecyclerView) {
super.getItemOffsets(outRect, itemPosition, parent)
outRect.bottom = 12
}
})
mAdapter.setOnItemClickListener { adapter, view, position ->
LogUtils.e("EnterpriseInformationAdapter","position:${position}")
var bean = adapter.data[position] as EnterpriseInfoHomeBean.EnterpriseInfoChildBean
var filePath: String? = null
when(bean.fileFormat){ // 格式1,word,2,pdf,3.文本4.excel,5.音频。6.链接
1->{
if (!TextUtils.isEmpty(bean.fileUrl)){
filePath = FileDownloadUtils.getDefaultSaveRootPath() + File.separator + "zj365" + File.separator + "${bean.title}.word"
var file = File(filePath)
if (file.exists()){
file.delete()
}
createDownloadTask(filePath,bean.fileUrl,bean.fileFormat)!!.start()
}
}
2->{
if (!TextUtils.isEmpty(bean.fileUrl)){
filePath = FileDownloadUtils.getDefaultSaveRootPath() + File.separator + "zj365" + File.separator + "${bean.title}.pdf"
var file = File(filePath)
if (file.exists()){
file.delete()
}
LogUtils.e("EnterpriseInformationForTypeAct","filePath${filePath}")
createDownloadTask(filePath,bean.fileUrl,bean.fileFormat)!!.start()
}
}
3 ->{
if (!TextUtils.isEmpty(bean.fileUrl)){
filePath = FileDownloadUtils.getDefaultSaveRootPath() + File.separator + "zj365" + File.separator + "${bean.title}.txt"
var file = File(filePath)
if (file.exists()){
file.delete()
}
LogUtils.e("EnterpriseInformationForTypeAct","filePath${filePath}")
createDownloadTask(filePath,bean.fileUrl,bean.fileFormat)!!.start()
}
}
4->{
if (!TextUtils.isEmpty(bean.fileUrl)){
filePath = FileDownloadUtils.getDefaultSaveRootPath() + File.separator + "zj365" + File.separator + "${bean.title}.xlsx"
var file = File(filePath)
if (file.exists()){
file.delete()
}
LogUtils.e("EnterpriseInformationForTypeAct","filePath${filePath}")
createDownloadTask(filePath,bean.fileUrl,bean.fileFormat)!!.start()
}
}
5->{
if (!TextUtils.isEmpty(bean.fileUrl)){
filePath = FileDownloadUtils.getDefaultSaveRootPath() + File.separator + "zj365" + File.separator + "${bean.title}.mp3"
var file = File(filePath)
if (file.exists()){
file.delete()
}
LogUtils.e("EnterpriseInformationForTypeAct","filePath${filePath}")
createDownloadTask(filePath,bean.fileUrl,bean.fileFormat)!!.start()
}
}
6->{
if (!TextUtils.isEmpty(bean.fileUrl)){
var bundle = Bundle()
bundle.putString(
"web_site_url",
"${bean.fileUrl}"
)
RouteManager.goAct(ARouterUrl.H5_ACT,bundle)
}
}
}
}
mAdapter.setNewInstance(item.list)
}
private fun createDownloadTask(filePath: String,url:String,fileFormat:Int): BaseDownloadTask? {
var isDir = false
return FileDownloader.getImpl().create(url)
.setPath(filePath, false)
.setCallbackProgressTimes(300)
.setMinIntervalUpdateSpeed(400)
.setTag(this)
.setListener(object : FileDownloadSampleListener() {
override fun pending(task: BaseDownloadTask, soFarBytes: Int, totalBytes: Int) {
super.pending(task, soFarBytes, totalBytes)
LogUtils.e("EnterpriseInformationForTypeAct","pending${soFarBytes}")
}
override fun progress(task: BaseDownloadTask, soFarBytes: Int, totalBytes: Int) {
super.progress(task, soFarBytes, totalBytes)
LogUtils.e("EnterpriseInformationForTypeAct","progress${soFarBytes}")
}
override fun error(task: BaseDownloadTask, e: Throwable) {
super.error(task, e)
}
override fun connected(
task: BaseDownloadTask,
etag: String,
isContinue: Boolean,
soFarBytes: Int,
totalBytes: Int
) {
super.connected(task, etag, isContinue, soFarBytes, totalBytes)
LogUtils.e("EnterpriseInformationForTypeAct","connected${soFarBytes}")
}
override fun paused(task: BaseDownloadTask, soFarBytes: Int, totalBytes: Int) {
super.paused(task, soFarBytes, totalBytes)
}
override fun completed(task: BaseDownloadTask) {
super.completed(task)
OpenFilesUtils.openFile(context, File(filePath))
}
override fun warn(task: BaseDownloadTask) {
super.warn(task)
}
})
}
}

@ -24,8 +24,9 @@
android:layout_marginTop="@dimen/dp_10"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_20"
android:layout_marginRight="@dimen/dp_20"
android:layout_marginLeft="@dimen/dp_15"
android:background="@drawable/shape_round_white"
android:layout_marginRight="@dimen/dp_15"
android:overScrollMode="never" />
<com.scwang.smart.refresh.footer.ClassicsFooter

@ -1933,7 +1933,7 @@ interface ApiInterface {
/**
* 申请退款
*/
@GET("customer/mall/order/getOrderInfo")
@GET("customer/mall/order/refund")
suspend fun applyReturn(@Query("orderId") orderId:Long):RespBody<Any>
/**
@ -1947,4 +1947,16 @@ interface ApiInterface {
*/
@POST("customer/user/getIsCoupons")
suspend fun hasCoupons() : RespBody<Int>
/**
* 订单物流
*/
@GET("customer/mall/order/experss")
suspend fun getLogistics(@Query ("orderId") orderId:Long): RespBody<GoodsLogisticsBean>
/**
* 计算订单金额
*/
@POST("customer/mall/order/computeAmount")
suspend fun computeAmount(@Body rb: RequestBody): RespBody<String>
}

@ -1,7 +1,9 @@
package com.xty.network
import android.os.Build
import android.util.Log
import com.tencent.mmkv.MMKV
import com.xty.network.utils.AppUtils
import com.xty.network.utils.NetWorkLogUtils
import com.youth.banner.util.LogUtils
import okhttp3.Interceptor
@ -22,7 +24,12 @@ class TokenIntercept:Interceptor {
newBuilder.header("auth-token",mmkv!!.decodeString("Auth-Token")!!)
newBuilder.header("auth-id",mmkv!!.decodeString("Auth-Id")!!)
newBuilder.header("mark",MyRetrofit.get().BLUETOOTH_MAC)
newBuilder.header("appVersion", "${mmkv!!.decodeString("appVersion")!!}")
newBuilder.header("versionCode", "${mmkv!!.decodeInt("version_code")!!}")
}
newBuilder.header("sourceBazaar","Android")
//newBuilder.header("company", Const.COMPANY)
newBuilder.addHeader("Content-Type", "application/json; charset=utf-8")
val build = newBuilder.build()

@ -12,10 +12,10 @@ data class EnterpriseInfoHomeBean(
data class EnterpriseInfoChildBean(
var title:String,
var id:Long,
var fileFormat:Int,
var fileFormat:Int,// 格式1,word,2,pdf,3.文本4.excel,5.音频。6.链接
var type:Int,
var pic:String,
var fileUrl:String,
var fileUrl:String,//附件地址或链接
var contentText:String,
var createTime:String
)

@ -0,0 +1,19 @@
package com.xty.network.model
data class GoodsLogisticsBean (
var express_sn:String,
var address:String,
var express_name:String,
var data:ArrayList<LogisticsBean>
){
data class LogisticsBean(
var address:String,
var context:String,
var location:String,
var time:String,
var status:Int
)
}

@ -3,8 +3,20 @@ package com.xty.network.model
data class HealthArchiveBean(
var bmiInfo:BMIInfo,
var healData:ArrayList<FamilyHealthBean.FamilyTargetBean>,
var bmr:String,
var bmi:String){
var bmr:String, //bmr值
var bmi:String,
var userSchedule:Int,//完善进度
var bodyFat:String, //体脂率
var surveys:SurveysBean
){
data class BMIInfo(var levelName:String,var bmi:Float)
data class SurveysBean(
var score:Int,
var list:ArrayList<SurveysInfoBean>)
data class SurveysInfoBean(var id:Long,var type:Int,var surveysId:Long,var name:String,var status:Int)
}

@ -0,0 +1,37 @@
package com.xty.network.utils
import android.content.Context
import android.content.pm.PackageInfo
import android.content.pm.PackageManager
object AppUtils {
fun getVersionCode( context: Context) :Int{
var packageInfo = getPackagesInfo(context)
if (packageInfo != null){
return packageInfo!!.versionCode
}else{
return -1
}
}
fun getPackagesInfo( context:Context) : PackageInfo ?{
try {
return context.packageManager.getPackageInfo(context.packageName, 0);
} catch ( e: PackageManager.NameNotFoundException) {
e.printStackTrace();
}
return null;
}
fun getPackageVersionName(context:Context):String {
var packageInfo = getPackagesInfo(context)
if (packageInfo != null){
return packageInfo!!.versionName
}else{
return ""
}
}
}
Loading…
Cancel
Save