diff --git a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/adapter/WaybillListAdapter.kt b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/adapter/WaybillListAdapter.kt index 4f9e368..3eaf36a 100644 --- a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/adapter/WaybillListAdapter.kt +++ b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/adapter/WaybillListAdapter.kt @@ -16,28 +16,35 @@ import com.arpa.mylibrary.utils.ImageLoader * @Date 2024/1/23 16:27 * @Description TODO */ -class WaybillListAdapter(var isCap : Boolean) : +class WaybillListAdapter(var isCap: Boolean) : BaseQuickAdapter() { override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: OrderBean?) { item?.let { holder.run { - setText(R.id.tvWaybillId,it.orderNum) - setText(R.id.tvStatu,OrderUtils.getInstance().getOrderStatu(it.orderStatus)) - setText(R.id.tvType,"""${if (it.orderType == "0") "一装一卸" else "一装多卸"}""") - setText(R.id.tvTime,"""${it.loadingDeadline}装货""") - setText(R.id.tvDis,"""${it.distance}km""") - setText(R.id.tvCarNum,it.vehicleNum) - setText(R.id.tvGood,"""${it.goodItemGrossWeight}吨/${it.goodName}""") - setText(R.id.tvMoney,it.driverFreight) - setText(R.id.tvComName,it.realCompanyName) - setText(R.id.btnOk,OrderUtils.getInstance().getNextByStatu(it.orderStatus)) - setGone(R.id.btnOk,!(it.orderStatus=="102040"||it.orderStatus=="102050"||it.orderStatus=="102070"||it.orderStatus=="102090")) - if (it.orderStatus=="102070"||it.orderStatus=="102090"){ - //待结算,已完成 - setGone(R.id.btnOk,it.driverEvaluationStatus=="1") + setText(R.id.tvWaybillId, it.orderNum) + setText(R.id.tvStatu, OrderUtils.getInstance().getOrderStatu(it.orderStatus)) + setText(R.id.tvType, """${if (it.orderType == "0") "一装一卸" else "一装多卸"}""") + setText(R.id.tvTime, """${it.loadingDeadline}装货""") + setText(R.id.tvDis, """${it.distance}km""") + setText(R.id.tvCarNum, it.vehicleNum) + setText(R.id.tvGood, """${it.goodItemGrossWeight}吨/${it.goodName}""") + setText(R.id.tvMoney, it.driverFreight) + setText(R.id.tvComName, it.realCompanyName) + setText(R.id.btnOk, OrderUtils.getInstance().getNextByStatu(it.orderStatus)) + + if (isCap) { + setGone(R.id.btnOk, true) + } else { + if (it.orderStatus == "102040" || it.orderStatus == "102050") { + setGone(R.id.btnOk, false) + } else if (it.driverEvaluationStatus != "1" && (it.orderStatus == "102060" || it.orderStatus == "102070" || it.orderStatus == "102090")) { + //三种状态下 并且未评论为 true显示 + setGone(R.id.btnOk, false) + } } - setGone(R.id.btnOk,isCap) + + ImageLoader.getInstance() .loadRoundImage(context, it.avatar, 6, getView(R.id.ivHead)) @@ -45,14 +52,28 @@ class WaybillListAdapter(var isCap : Boolean) : setText( R.id.tvStart, """${ - if (it.loadingCity.length > 1) it.loadingCity.substring(0, 2) else it.loadingCity - } ${if (it.loadingArea.length > 1) it.loadingArea.substring(0, 2) else it.loadingArea}""" + if (it.loadingCity.length > 1) it.loadingCity.substring( + 0, + 2 + ) else it.loadingCity + } ${ + if (it.loadingArea.length > 1) it.loadingArea.substring( + 0, + 2 + ) else it.loadingArea + }""" ) setText( R.id.tvEnd, """${ - if (it.receiverCity.length > 1) it.receiverCity.substring(0, 2) else it.receiverCity + if (it.receiverCity.length > 1) it.receiverCity.substring( + 0, + 2 + ) else it.receiverCity } ${ - if (it.receiverArea.length > 1) it.receiverArea.substring(0, 2) else it.receiverArea + if (it.receiverArea.length > 1) it.receiverArea.substring( + 0, + 2 + ) else it.receiverArea }""" ) } diff --git a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/base/AppConfig.kt b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/base/AppConfig.kt index 047d969..84c0ad6 100644 --- a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/base/AppConfig.kt +++ b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/base/AppConfig.kt @@ -18,6 +18,7 @@ object AppConfig { const val CAR_ID = "DA_HE_CAR_ID" const val IS_SHOW = "DA_HE_IS_SHOW" const val IS_FIRST_OPEN = "DA_HE_IS_FIRST_OPEN" + const val IS_BACK = "DA_HE_IS_BACK" const val WAYBILL_ID = "DA_HE_WAYBILL_ID" const val CHILDRE_ID = "DA_HE_CHILDRE_ID" const val RATE_TYPE = "DA_HE_RATE_TYPE"//0:收到的评价 1:发表的评价 diff --git a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/bean/PushBean.kt b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/bean/PushBean.kt new file mode 100644 index 0000000..8fbcd81 --- /dev/null +++ b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/bean/PushBean.kt @@ -0,0 +1,15 @@ +package com.arpa.hndahesudintocctmsdriver.bean + +/** + * @ClassName PushBean + * @Author john + * @Date 2024/4/28 09:34 + * @Description TODO + */ +data class PushBean( + val orderId: String, + val carId: String, + val orderNum: String, + val messageType: String, + val orderStatus: String +) diff --git a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/push/PushMessageService.kt b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/push/PushMessageService.kt index 7da3320..4a2f45e 100644 --- a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/push/PushMessageService.kt +++ b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/push/PushMessageService.kt @@ -1,31 +1,70 @@ -package com.arpa.hndahesudintocctmsdriver.push; +package com.arpa.hndahesudintocctmsdriver.push -import android.content.Context; -import android.content.Intent; -import android.util.Log; +import android.content.Context +import android.content.Intent +import android.os.Bundle +import android.util.Log +import cn.jpush.android.api.CmdMessage +import cn.jpush.android.api.CustomMessage +import cn.jpush.android.api.JPushInterface +import cn.jpush.android.api.JPushMessage +import cn.jpush.android.api.NotificationMessage +import cn.jpush.android.service.JPushMessageService +import com.arpa.hndahesudintocctmsdriver.base.AppConfig +import com.arpa.hndahesudintocctmsdriver.bean.PushBean +import com.arpa.hndahesudintocctmsdriver.ui.mine.activity.CarDetailActivity +import com.arpa.hndahesudintocctmsdriver.ui.waybill.activity.WaybillDetailActivity +import com.arpa.hndahesudintocctmsdriver.ui.waybill.activity.WaybillUnlLoadActivity +import com.arpa.mylibrary.utils.ActivityUtils +import com.google.gson.Gson -import cn.jpush.android.api.CmdMessage; -import cn.jpush.android.api.CustomMessage; -import cn.jpush.android.api.JPushInterface; -import cn.jpush.android.api.JPushMessage; -import cn.jpush.android.api.NotificationMessage; -import cn.jpush.android.service.JPushMessageService; - -public class PushMessageService extends JPushMessageService { - private static final String TAG = "PushMessageService"; - - @Override - public void onMessage(Context context, CustomMessage customMessage) { - Log.e(TAG, "[onMessage] " + customMessage); - Intent intent = new Intent("com.jiguang.demo.message"); - intent.putExtra("msg", customMessage.message); - context.sendBroadcast(intent); +class PushMessageService : JPushMessageService() { + override fun onMessage(context: Context, customMessage: CustomMessage) { + Log.e(TAG, "[onMessage] $customMessage") + val intent = Intent("com.jiguang.demo.message") + intent.putExtra("msg", customMessage.message) + context.sendBroadcast(intent) } - @Override - public void onNotifyMessageOpened(Context context, NotificationMessage message) { - Log.e(TAG, "[onNotifyMessageOpened] " + message); - try{ + override fun onNotifyMessageOpened(context: Context, message: NotificationMessage) { + Log.e(TAG, "[onNotifyMessageOpened] $message") + val pushBean = Gson().fromJson( + message.notificationExtras, + PushBean::class.java + ) + println("fasdf") + try { + when (pushBean.messageType) { + "100" -> { + if (pushBean.orderStatus=="102030"){ + //接单类型 + val intent = Intent(context, WaybillDetailActivity::class.java) + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) + intent.putExtras(Bundle().apply { putString(AppConfig.ORDER_ID, pushBean.orderId) }) + context.startActivity(intent) + }else if (pushBean.orderStatus=="102050"){//卸货类型 + val intent = Intent(context, WaybillUnlLoadActivity::class.java) + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) + intent.putExtras(Bundle().apply { putString(AppConfig.ORDER_ID, pushBean.orderId) }) + context.startActivity(intent) + } + + } + + "110" -> { + //系统通知 + } + + "120" -> { + //证件到期 + val intent = Intent(context, CarDetailActivity::class.java) + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) + intent.putExtras(Bundle().apply { putString(AppConfig.CAR_ID, pushBean.carId) }) + context.startActivity(intent) + } + } + + //打开自定义的Activity // Intent i = new Intent(context, TestActivity.class); // Bundle bundle = new Bundle(); @@ -34,88 +73,79 @@ public class PushMessageService extends JPushMessageService { // i.putExtras(bundle); // i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP ); // context.startActivity(i); - }catch (Throwable throwable){ - + } catch (throwable: Throwable) { } } - @Override - public void onMultiActionClicked(Context context, Intent intent) { - Log.e(TAG, "[onMultiActionClicked] 用户点击了通知栏按钮"); - String nActionExtra = intent.getExtras().getString(JPushInterface.EXTRA_NOTIFICATION_ACTION_EXTRA); + override fun onMultiActionClicked(context: Context, intent: Intent) { + Log.e(TAG, "[onMultiActionClicked] 用户点击了通知栏按钮") + val nActionExtra = intent.extras!!.getString(JPushInterface.EXTRA_NOTIFICATION_ACTION_EXTRA) //开发者根据不同 Action 携带的 extra 字段来分配不同的动作。 if (nActionExtra == null) { - Log.d(TAG, "ACTION_NOTIFICATION_CLICK_ACTION nActionExtra is null"); - return; + Log.d(TAG, "ACTION_NOTIFICATION_CLICK_ACTION nActionExtra is null") + return } - if (nActionExtra.equals("my_extra1")) { - Log.e(TAG, "[onMultiActionClicked] 用户点击通知栏按钮一"); - } else if (nActionExtra.equals("my_extra2")) { - Log.e(TAG, "[onMultiActionClicked] 用户点击通知栏按钮二"); - } else if (nActionExtra.equals("my_extra3")) { - Log.e(TAG, "[onMultiActionClicked] 用户点击通知栏按钮三"); + if (nActionExtra == "my_extra1") { + Log.e(TAG, "[onMultiActionClicked] 用户点击通知栏按钮一") + } else if (nActionExtra == "my_extra2") { + Log.e(TAG, "[onMultiActionClicked] 用户点击通知栏按钮二") + } else if (nActionExtra == "my_extra3") { + Log.e(TAG, "[onMultiActionClicked] 用户点击通知栏按钮三") } else { - Log.e(TAG, "[onMultiActionClicked] 用户点击通知栏按钮未定义"); + Log.e(TAG, "[onMultiActionClicked] 用户点击通知栏按钮未定义") } } - @Override - public void onNotifyMessageArrived(Context context, NotificationMessage message) { - Log.e(TAG, "[onNotifyMessageArrived] " + message); + override fun onNotifyMessageArrived(context: Context, message: NotificationMessage) { + Log.e(TAG, "[onNotifyMessageArrived] $message") } - @Override - public void onNotifyMessageDismiss(Context context, NotificationMessage message) { - Log.e(TAG, "[onNotifyMessageDismiss] " + message); + override fun onNotifyMessageDismiss(context: Context, message: NotificationMessage) { + Log.e(TAG, "[onNotifyMessageDismiss] $message") } - @Override - public void onRegister(Context context, String registrationId) { - Log.e(TAG, "[onRegister] " + registrationId); - Intent intent = new Intent("com.jiguang.demo.message"); - intent.putExtra("rid", registrationId); - context.sendBroadcast(intent); + override fun onRegister(context: Context, registrationId: String) { + Log.e(TAG, "[onRegister] $registrationId") + val intent = Intent("com.jiguang.demo.message") + intent.putExtra("rid", registrationId) + context.sendBroadcast(intent) } - @Override - public void onConnected(Context context, boolean isConnected) { - Log.e(TAG, "[onConnected] " + isConnected); + override fun onConnected(context: Context, isConnected: Boolean) { + Log.e(TAG, "[onConnected] $isConnected") } - @Override - public void onCommandResult(Context context, CmdMessage cmdMessage) { - Log.e(TAG, "[onCommandResult] " + cmdMessage); + override fun onCommandResult(context: Context, cmdMessage: CmdMessage) { + Log.e(TAG, "[onCommandResult] $cmdMessage") } - @Override - public void onTagOperatorResult(Context context, JPushMessage jPushMessage) { - TagAliasOperatorHelper.getInstance().onTagOperatorResult(context,jPushMessage); - super.onTagOperatorResult(context, jPushMessage); + override fun onTagOperatorResult(context: Context, jPushMessage: JPushMessage) { + TagAliasOperatorHelper.getInstance().onTagOperatorResult(context, jPushMessage) + super.onTagOperatorResult(context, jPushMessage) } - @Override - public void onCheckTagOperatorResult(Context context, JPushMessage jPushMessage) { - TagAliasOperatorHelper.getInstance().onCheckTagOperatorResult(context,jPushMessage); - super.onCheckTagOperatorResult(context, jPushMessage); + override fun onCheckTagOperatorResult(context: Context, jPushMessage: JPushMessage) { + TagAliasOperatorHelper.getInstance().onCheckTagOperatorResult(context, jPushMessage) + super.onCheckTagOperatorResult(context, jPushMessage) } - @Override - public void onAliasOperatorResult(Context context, JPushMessage jPushMessage) { - TagAliasOperatorHelper.getInstance().onAliasOperatorResult(context,jPushMessage); - super.onAliasOperatorResult(context, jPushMessage); + override fun onAliasOperatorResult(context: Context, jPushMessage: JPushMessage) { + TagAliasOperatorHelper.getInstance().onAliasOperatorResult(context, jPushMessage) + super.onAliasOperatorResult(context, jPushMessage) } - @Override - public void onMobileNumberOperatorResult(Context context, JPushMessage jPushMessage) { - TagAliasOperatorHelper.getInstance().onMobileNumberOperatorResult(context,jPushMessage); - super.onMobileNumberOperatorResult(context, jPushMessage); + override fun onMobileNumberOperatorResult(context: Context, jPushMessage: JPushMessage) { + TagAliasOperatorHelper.getInstance().onMobileNumberOperatorResult(context, jPushMessage) + super.onMobileNumberOperatorResult(context, jPushMessage) } - @Override - public void onNotificationSettingsCheck(Context context, boolean isOn, int source) { - super.onNotificationSettingsCheck(context, isOn, source); - Log.e(TAG, "[onNotificationSettingsCheck] isOn:" + isOn + ",source:" + source); + override fun onNotificationSettingsCheck(context: Context, isOn: Boolean, source: Int) { + super.onNotificationSettingsCheck(context, isOn, source) + Log.e(TAG, "[onNotificationSettingsCheck] isOn:$isOn,source:$source") } + companion object { + private const val TAG = "PushMessageService" + } } diff --git a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/account/authperson/EditBankCardActivity.kt b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/account/authperson/EditBankCardActivity.kt index 2a4b3e0..db4bcd9 100644 --- a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/account/authperson/EditBankCardActivity.kt +++ b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/account/authperson/EditBankCardActivity.kt @@ -33,7 +33,7 @@ class EditBankCardActivity : BaseActivity() { var perInfoBean: UserDetail = UserDetail() override fun initView(savedInstanceState: Bundle?) { setStatusBarColor(R.color.white) - setTitleBar("更换银行卡"){ + setTitleBar("更换银行卡") { setResult(RESULT_OK) finish() } @@ -134,10 +134,16 @@ class EditBankCardActivity : BaseActivity() { .subscribe(BaseObserver(mContext, object : RxHttpCallBack() { override fun onSuccess(t: CommonResponseBean) { super.onSuccess(t) + val isBack = intent.extras?.getBoolean(AppConfig.IS_BACK, false) + if (isBack == true) { + setResult(RESULT_OK) + finish() + return + } showToast("修改成功") val goNextPersonInfo = UserUtils.instance.goNextPersonInfo(perInfoBean) if (goNextPersonInfo != null) { - ActivityUtils.startActivity(mContext,goNextPersonInfo) + ActivityUtils.startActivity(mContext, goNextPersonInfo) } setResult(RESULT_OK) finish() diff --git a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/mine/activity/WalletActivity.kt b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/mine/activity/WalletActivity.kt index 8f51340..21460b5 100644 --- a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/mine/activity/WalletActivity.kt +++ b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/mine/activity/WalletActivity.kt @@ -16,6 +16,7 @@ import com.arpa.hndahesudintocctmsdriver.utils.CommonPopUtils import com.arpa.glex.bean.UserDetail import com.arpa.glex.bean.WalletInfo import com.arpa.glex.bean.WaterInfo +import com.arpa.hndahesudintocctmsdriver.base.AppConfig import com.arpa.mylibrary.base.BaseActivity import com.arpa.mylibrary.callback.RefreshCallBack import com.arpa.mylibrary.net.CommonResponseBean @@ -42,7 +43,7 @@ class WalletActivity : BaseActivity(), RefreshCallBack { binding.run { setRefresh(refresh, this@WalletActivity) tvLeft.setOnClickListener { - ActivityUtils.startActivity(mContext, EditBankCardActivity::class.java) + ActivityUtils.startActivity(mContext, EditBankCardActivity::class.java,Bundle().apply { putBoolean(AppConfig.IS_BACK,true) }) } tvRight.setOnClickListener { getCurrBank() diff --git a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/waybill/activity/WaybillRateActivity.kt b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/waybill/activity/WaybillRateActivity.kt index b980207..d176961 100644 --- a/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/waybill/activity/WaybillRateActivity.kt +++ b/app/src/main/java/com/arpa/hndahesudintocctmsdriver/ui/waybill/activity/WaybillRateActivity.kt @@ -61,9 +61,7 @@ class WaybillRateActivity : BaseActivity() { private fun subMint() { var orderID = intent.extras?.getString(AppConfig.ORDER_ID,"") if (upRate.opinionsStarRating.isNullOrEmpty() || - binding.etContent.text.isNullOrEmpty() || - orderID.isNullOrEmpty() || - upRate.resourcesList.size == 0 + orderID.isNullOrEmpty() ) { showToast("请完善信息") return