Commit 182fcbd9 by Wyh

9.11 1、餘額顯示修改 2、刷新餘額 3、新建預點餐模塊

Signed-off-by: Wyh <1239658231>
parent b5ccc516
<resources>
<!-- &lt;!&ndash; Base application theme. &ndash;&gt;-->
<!-- <style name="table_AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">-->
<!-- &lt;!&ndash; Customize your theme here. &ndash;&gt;-->
<!-- <item name="colorPrimary">@color/table_colorPrimary</item>-->
<!-- <item name="colorPrimaryDark">@color/table_colorPrimaryDark</item>-->
<!-- <item name="colorAccent">@color/table_colorAccent</item>-->
<!-- </style>-->
</resources>
...@@ -39,7 +39,7 @@ import java.util.concurrent.TimeUnit ...@@ -39,7 +39,7 @@ import java.util.concurrent.TimeUnit
class GetInfoUpdateService : Service() { class GetInfoUpdateService : Service() {
private val TAG = "eee" private val TAG = "heart"
/** /**
* 心跳检测时间 * 心跳检测时间
*/ */
...@@ -287,7 +287,6 @@ class GetInfoUpdateService : Service() { ...@@ -287,7 +287,6 @@ class GetInfoUpdateService : Service() {
fun initSoundPool(resId: Int) { fun initSoundPool(resId: Int) {
val nowTime = System.currentTimeMillis()//當前時間減去上次播放的時間,如果超過五秒,那麼才會再次播放提示聲 val nowTime = System.currentTimeMillis()//當前時間減去上次播放的時間,如果超過五秒,那麼才會再次播放提示聲
if (nowTime - lastSoundTime > 5000) { if (nowTime - lastSoundTime > 5000) {
Log.e("eee", "間隔時間" + (nowTime - lastSoundTime))
putTimeLog("現在時間:$nowTime 上次播放時間:$lastSoundTime") putTimeLog("現在時間:$nowTime 上次播放時間:$lastSoundTime")
putTimeLog("新訂單播放:$nowTime") putTimeLog("新訂單播放:$nowTime")
lastSoundTime = nowTime lastSoundTime = nowTime
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners
android:bottomLeftRadius="@dimen/dp_8"
android:bottomRightRadius="@dimen/dp_0"
android:topLeftRadius="@dimen/dp_8"
android:topRightRadius="@dimen/dp_0" />
<solid android:color="@color/theme_color" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners
android:bottomLeftRadius="@dimen/dp_8"
android:bottomRightRadius="@dimen/dp_0"
android:topLeftRadius="@dimen/dp_8"
android:topRightRadius="@dimen/dp_0" />
<solid android:color="@color/white" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners
android:bottomRightRadius="@dimen/dp_8"
android:bottomLeftRadius="@dimen/dp_0"
android:topRightRadius="@dimen/dp_8"
android:topLeftRadius="@dimen/dp_0" />
<solid android:color="@color/theme_color" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners
android:bottomRightRadius="@dimen/dp_8"
android:bottomLeftRadius="@dimen/dp_0"
android:topRightRadius="@dimen/dp_8"
android:topLeftRadius="@dimen/dp_0" />
<solid android:color="@color/white" />
</shape>
\ No newline at end of file
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<dimen name="head_size">16sp</dimen> <dimen name="head_size">16sp</dimen>
<!-- 全局Button --> <!-- 全局Button -->
<dimen name="button_height">35dp</dimen> <dimen name="button_height">40dp</dimen>
<dimen name="button_margin">20dp</dimen> <dimen name="button_margin">20dp</dimen>
<dimen name="button_margin_half">20dp</dimen> <dimen name="button_margin_half">20dp</dimen>
<dimen name="button_padding">14dp</dimen> <dimen name="button_padding">14dp</dimen>
......
...@@ -13,6 +13,8 @@ public class OrderList { ...@@ -13,6 +13,8 @@ public class OrderList {
private boolean success; private boolean success;
private long sysTime; private long sysTime;
private DataBeanX data; private DataBeanX data;
private String errMsg;
private String errCode;
public boolean isSuccess() { public boolean isSuccess() {
return success; return success;
...@@ -486,4 +488,20 @@ public class OrderList { ...@@ -486,4 +488,20 @@ public class OrderList {
} }
} }
} }
public String getErrCode() {
return errCode;
}
public void setErrCode(String errCode) {
this.errCode = errCode;
}
public String getErrMsg() {
return errMsg;
}
public void setErrMsg(String errMsg) {
this.errMsg = errMsg;
}
} }
...@@ -161,7 +161,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -161,7 +161,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
.doOnSubscribe(disposable -> mRootView.showLoading("確認訂單中,請稍候...")) .doOnSubscribe(disposable -> mRootView.showLoading("確認訂單中,請稍候..."))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> {}) .doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView)) .compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<ShipAnyOrdersNewBean>(mErrorHandler) { .subscribe(new ErrorHandleSubscriber<ShipAnyOrdersNewBean>(mErrorHandler) {
...@@ -205,9 +205,10 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -205,9 +205,10 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
.build(); .build();
mModel.updateOrderStatus(requestBody) mModel.updateOrderStatus(requestBody)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> {}) .doOnSubscribe(disposable -> mRootView.showLoading("確認訂單中,請稍候..."))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView)) .compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<UpdateOrderStatusBean>(mErrorHandler) { .subscribe(new ErrorHandleSubscriber<UpdateOrderStatusBean>(mErrorHandler) {
......
...@@ -5,6 +5,7 @@ import android.app.Application; ...@@ -5,6 +5,7 @@ import android.app.Application;
import com.gingersoft.coldchain_module.mvp.constans.ColdChainConstans; import com.gingersoft.coldchain_module.mvp.constans.ColdChainConstans;
import com.gingersoft.coldchain_module.mvp.contract.OrderListContract; import com.gingersoft.coldchain_module.mvp.contract.OrderListContract;
import com.gingersoft.coldchain_module.mvp.model.bean.OrderList; import com.gingersoft.coldchain_module.mvp.model.bean.OrderList;
import com.gingersoft.gsa.cloud.base.utils.other.TextUtil;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.http.imageloader.ImageLoader; import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager; import com.jess.arms.integration.AppManager;
...@@ -65,6 +66,7 @@ public class OrderListPresenter extends BasePresenter<OrderListContract.Model, O ...@@ -65,6 +66,7 @@ public class OrderListPresenter extends BasePresenter<OrderListContract.Model, O
.add("pageSize", "") .add("pageSize", "")
.add("status", status) .add("status", status)
.add("type", type) .add("type", type)
.add("appointmentType ", "0")
.build(); .build();
mModel.getOrderList(requestBody) mModel.getOrderList(requestBody)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
...@@ -97,6 +99,9 @@ public class OrderListPresenter extends BasePresenter<OrderListContract.Model, O ...@@ -97,6 +99,9 @@ public class OrderListPresenter extends BasePresenter<OrderListContract.Model, O
mRootView.loadOrderList(orderList); mRootView.loadOrderList(orderList);
} else { } else {
mRootView.loadOrderList(null); mRootView.loadOrderList(null);
if(info != null && TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())){
mRootView.showMessage(info.getErrMsg());
}
} }
} }
......
package com.gingersoft.coldchain_module.mvp.ui.activity; package com.gingersoft.coldchain_module.mvp.ui.activity;
import android.animation.ArgbEvaluator;
import android.animation.ValueAnimator; import android.animation.ValueAnimator;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.ComponentName; import android.content.ComponentName;
...@@ -52,7 +51,6 @@ import java.util.List; ...@@ -52,7 +51,6 @@ import java.util.List;
import butterknife.BindView; import butterknife.BindView;
import butterknife.OnClick; import butterknife.OnClick;
import static android.animation.ValueAnimator.RESTART;
import static androidx.fragment.app.FragmentStatePagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT; import static androidx.fragment.app.FragmentStatePagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT;
import static com.jess.arms.utils.Preconditions.checkNotNull; import static com.jess.arms.utils.Preconditions.checkNotNull;
...@@ -247,15 +245,18 @@ public class ColdChainMainActivity extends BaseFragmentActivity<ColdChainMainPre ...@@ -247,15 +245,18 @@ public class ColdChainMainActivity extends BaseFragmentActivity<ColdChainMainPre
public void loadBalance(double price, double bond, boolean isBlink) { public void loadBalance(double price, double bond, boolean isBlink) {
tvBalance.setText("餘額:" + price + "(保證金" + bond + ")"); tvBalance.setText("餘額:" + price + "(保證金" + bond + ")");
if (isBlink) { if (isBlink) {
tvBalance.setTextColor(ContextCompat.getColor(mContext, R.color.theme_red_color));
//提示餘額不足 //提示餘額不足
int colorFrom = ContextCompat.getColor(mContext, R.color.red); // int colorFrom = ContextCompat.getColor(mContext, R.color.red);
int colorTo = ContextCompat.getColor(mContext, R.color.blue); // int colorTo = ContextCompat.getColor(mContext, R.color.blue);
colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo); // colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo);
colorAnimation.addUpdateListener(animation -> tvBalance.setTextColor((Integer) animation.getAnimatedValue())); // colorAnimation.addUpdateListener(animation -> tvBalance.setTextColor((Integer) animation.getAnimatedValue()));
colorAnimation.setDuration(200); // colorAnimation.setDuration(200);
colorAnimation.setRepeatMode(RESTART); // colorAnimation.setRepeatMode(RESTART);
colorAnimation.setRepeatCount(-1); // colorAnimation.setRepeatCount(-1);
colorAnimation.start(); // colorAnimation.start();
} else {
tvBalance.setTextColor(ContextCompat.getColor(mContext, R.color.theme_333_color));
} }
} }
...@@ -275,6 +276,12 @@ public class ColdChainMainActivity extends BaseFragmentActivity<ColdChainMainPre ...@@ -275,6 +276,12 @@ public class ColdChainMainActivity extends BaseFragmentActivity<ColdChainMainPre
} }
} }
@Override
protected void onStart() {
super.onStart();
getNumByOrderTypeInvoke("loadNumber");
}
private class ClearHeartBroadcastReceiver extends BroadcastReceiver { private class ClearHeartBroadcastReceiver extends BroadcastReceiver {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
......
...@@ -336,6 +336,7 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailsPresenter> im ...@@ -336,6 +336,7 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailsPresenter> im
// Start a print job, passing in a PrintDocumentAdapter implementation 启动打印作业,传入printdocumentadapter实现 // Start a print job, passing in a PrintDocumentAdapter implementation 启动打印作业,传入printdocumentadapter实现
// to handle the generation of a print document处理打印文档的生成 // to handle the generation of a print document处理打印文档的生成
printManager.print(jobName, new MyPrintDocumentAdapter(mContext, file, (code, msg) -> { printManager.print(jobName, new MyPrintDocumentAdapter(mContext, file, (code, msg) -> {
hideLoading();
if (code != 0) { if (code != 0) {
showMessage(msg); showMessage(msg);
} }
...@@ -360,4 +361,10 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailsPresenter> im ...@@ -360,4 +361,10 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailsPresenter> im
return super.onKeyDown(keyCode, event); return super.onKeyDown(keyCode, event);
} }
} }
@Override
protected void onDestroy() {
super.onDestroy();
hideLoading();
}
} }
\ No newline at end of file
...@@ -8,7 +8,7 @@ ext { ...@@ -8,7 +8,7 @@ ext {
//正式版: 1.0.3 3 //正式版: 1.0.3 3
//內部測試版:1.2.0 20 //內部測試版:1.2.0 20
versionCode : 7, versionCode : 7,
versionName : "1.0.72" versionName : "1.0.73"
] ]
version = [ version = [
......
...@@ -13,7 +13,7 @@ android { ...@@ -13,7 +13,7 @@ android {
defaultConfig { defaultConfig {
if (project.ext.runAsApp) { if (project.ext.runAsApp) {
applicationId "com.gingersoft.gsa.delivery_pick_mode" applicationId "com.gingersoft.gsa.com.gingersoft.gsa.delivery_pick_mode"
} }
minSdkVersion rootProject.ext.android["minSdkVersion"] minSdkVersion rootProject.ext.android["minSdkVersion"]
targetSdkVersion rootProject.ext.android["targetSdkVersion"] targetSdkVersion rootProject.ext.android["targetSdkVersion"]
......
package com.gingersoft.gsa.delivery_pick_mode;
import com.billy.cc.core.component.CC;
import com.jess.arms.base.BaseApplication;
/**
* Created by Wyh on 2020/1/7.
*/
public class MyApp extends BaseApplication {
@Override
public void onCreate() {
super.onCreate();
CC.enableVerboseLog(true);
CC.enableDebug(true);
CC.enableRemoteCC(true);
}
}
...@@ -17,7 +17,7 @@ import kotlin.Pair as Pair1 ...@@ -17,7 +17,7 @@ import kotlin.Pair as Pair1
class WeatherRepository private constructor(private val network: CoolWeatherNetwork) { class WeatherRepository private constructor(private val network: CoolWeatherNetwork) {
suspend fun requestOrderList(restaurantId: String, status: String, type: String, page: String, orderNo: String, phone: String) = withContext(Dispatchers.IO) { suspend fun requestOrderList(restaurantId: String, status: String, type: String, page: String, orderNo: String, phone: String, appointmentType: Int) = withContext(Dispatchers.IO) {
val requestBody = FormBody.Builder() val requestBody = FormBody.Builder()
.add("restaurantId", restaurantId) .add("restaurantId", restaurantId)
.add("page", page) .add("page", page)
...@@ -25,6 +25,7 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw ...@@ -25,6 +25,7 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
.add("orderNo", orderNo) .add("orderNo", orderNo)
.add("phone", phone) .add("phone", phone)
.add("type", type) .add("type", type)
.add("appointmentType", appointmentType.toString())
.build() .build()
val heWeather = network.fetchOrderList(requestBody) val heWeather = network.fetchOrderList(requestBody)
heWeather heWeather
......
package com.gingersoft.gsa.delivery_pick_mode.data.model.bean package com.gingersoft.gsa.delivery_pick_mode.data.model.bean
data class AddServiceChargeBean( data class AddServiceChargeBean(
val errCode: String, val errCode: String,
val errMsg: String, val errMsg: String,
val success: Boolean, val success: Boolean,
val sysTime: Long val sysTime: Long,
var paymentValue: Int
) )
\ No newline at end of file
...@@ -73,6 +73,8 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -73,6 +73,8 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
//接單超時時間 //接單超時時間
var timeOut = 0 var timeOut = 0
var appointmentType = MutableLiveData(0) //0為即時單,1為預約單
var addServiceChargeBean = MutableLiveData<AddServiceChargeBean>() var addServiceChargeBean = MutableLiveData<AddServiceChargeBean>()
/** /**
* 獲取訂單數量 * 獲取訂單數量
...@@ -135,7 +137,8 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -135,7 +137,8 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
*/ */
fun getOrderList(restaurantId: String, position: Int, page: String, isLoadMore: Boolean) { fun getOrderList(restaurantId: String, position: Int, page: String, isLoadMore: Boolean) {
launch({ launch({
repository.requestOrderList(restaurantId, fragmentStatus[position], fragmentType[position], page, orderNo, phone).apply { repository.requestOrderList(restaurantId, fragmentStatus[position], fragmentType[position], page, orderNo, phone, appointmentType.value
?: 0).apply {
// throw NullPointerException("測試獲取訂單列表異常") // throw NullPointerException("測試獲取訂單列表異常")
if (isSuccess()) { if (isSuccess()) {
getOrderGroupNum(restaurantId) getOrderGroupNum(restaurantId)
...@@ -512,6 +515,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -512,6 +515,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
*/ */
fun additionalServiceCharge(uid: String, orderId: String, paymentValue: Int) { fun additionalServiceCharge(uid: String, orderId: String, paymentValue: Int) {
launch({ launch({
addServiceChargeBean.value?.paymentValue = paymentValue
addServiceChargeBean.postValue(repository.additionalServiceCharge(uid, orderId, paymentValue)) addServiceChargeBean.postValue(repository.additionalServiceCharge(uid, orderId, paymentValue))
}, { }, {
addServiceChargeBean.postValue(null) addServiceChargeBean.postValue(null)
......
package com.gingersoft.gsa.delivery_pick_mode.ui.activity package com.gingersoft.gsa.delivery_pick_mode.ui.activity
import android.animation.ArgbEvaluator
import android.animation.ValueAnimator import android.animation.ValueAnimator
import android.animation.ValueAnimator.RESTART
import android.app.Dialog import android.app.Dialog
import android.content.* import android.content.*
import android.graphics.drawable.GradientDrawable import android.graphics.drawable.GradientDrawable
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.os.IBinder import android.os.IBinder
import android.util.Log
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.widget.TextView import android.widget.TextView
...@@ -35,6 +32,7 @@ import com.gingersoft.gsa.delivery_pick_mode.model.viewModel.PageViewModel ...@@ -35,6 +32,7 @@ import com.gingersoft.gsa.delivery_pick_mode.model.viewModel.PageViewModel
import com.gingersoft.gsa.delivery_pick_mode.ui.adapter.SectionsPagerAdapter import com.gingersoft.gsa.delivery_pick_mode.ui.adapter.SectionsPagerAdapter
import com.gingersoft.gsa.delivery_pick_mode.ui.base.BaseActivity import com.gingersoft.gsa.delivery_pick_mode.ui.base.BaseActivity
import com.gingersoft.gsa.delivery_pick_mode.util.InjectorUtil import com.gingersoft.gsa.delivery_pick_mode.util.InjectorUtil
import com.gingersoft.gsa.delivery_pick_mode.util.getmColor
import com.qmuiteam.qmui.alpha.QMUIAlphaImageButton import com.qmuiteam.qmui.alpha.QMUIAlphaImageButton
import com.qmuiteam.qmui.alpha.QMUIAlphaTextView import com.qmuiteam.qmui.alpha.QMUIAlphaTextView
import com.qmuiteam.qmui.util.QMUIDisplayHelper import com.qmuiteam.qmui.util.QMUIDisplayHelper
...@@ -86,22 +84,7 @@ class DeliveryOrderMainActivity : BaseActivity() { ...@@ -86,22 +84,7 @@ class DeliveryOrderMainActivity : BaseActivity() {
initAppTop() initAppTop()
initSwitchRestStatus() initSwitchRestStatus()
val sectionsPagerAdapter = SectionsPagerAdapter(this, supportFragmentManager, ints) initViewPager()
view_pager.adapter = sectionsPagerAdapter
view_pager.offscreenPageLimit = 4
view_pager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
override fun onPageScrollStateChanged(state: Int) {
}
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
}
override fun onPageSelected(position: Int) {
selectPosition = position
}
})
searchMethod(view_pager) searchMethod(view_pager)
initTabs() initTabs()
//餐廳營業信息 //餐廳營業信息
...@@ -113,35 +96,87 @@ class DeliveryOrderMainActivity : BaseActivity() { ...@@ -113,35 +96,87 @@ class DeliveryOrderMainActivity : BaseActivity() {
btn_open_or_close_info.post { btn_open_or_close_info.post {
btnHeight = btn_open_or_close_info.height.toFloat() btnHeight = btn_open_or_close_info.height.toFloat()
} }
layout_immediate_order.setOnClickListener {
it.background = ContextCompat.getDrawable(this, R.drawable.shape_left_themecolor_radius_btn)
layout_booking_order.background = ContextCompat.getDrawable(this, R.drawable.shape_right_white_radius_btn)
tv_immediate_order.setTextColor(ContextCompat.getColor(this, R.color.white))
tv_booking_order.setTextColor(ContextCompat.getColor(this, R.color.theme_333_color))
}
layout_booking_order.setOnClickListener {
it.background = ContextCompat.getDrawable(this, R.drawable.shape_right_themecolor_radius_btn)
layout_immediate_order.background = ContextCompat.getDrawable(this, R.drawable.shape_left_white_radius_btn)
tv_booking_order.setTextColor(ContextCompat.getColor(this, R.color.white))
tv_immediate_order.setTextColor(ContextCompat.getColor(this, R.color.theme_333_color))
}
pageViewModel.apply { pageViewModel.apply {
getDeliveryInfo(restaurantId.toString(), memberId.toString()) getDeliveryInfo(restaurantId.toString(), memberId.toString())
getBanlance(GsaCloudApplication.getBrandId(this@DeliveryOrderMainActivity)) getBanlance(GsaCloudApplication.getBrandId(this@DeliveryOrderMainActivity))
balanceBean.observe(this@DeliveryOrderMainActivity, Observer { balanceBean.observe(this@DeliveryOrderMainActivity, Observer {
it?.data?.let { it?.data?.let { it ->
tv_balance.text = "餘額:${it.balance}" + "(保證金: ${it.bond} )" tv_balance.text = "餘額:${it.balance}" + "(保證金: ${it.bond} )"
if (it.balance <= it.threshold) { if (it.balance <= it.threshold) {
//提示餘額不足 //提示餘額不足
val colorFrom = ContextCompat.getColor(this@DeliveryOrderMainActivity, R.color.red) tv_balance.setTextColor(getmColor(R.color.theme_red_color))
val colorTo = ContextCompat.getColor(this@DeliveryOrderMainActivity, R.color.blue) // val colorFrom = ContextCompat.getColor(this@DeliveryOrderMainActivity, R.color.red)
colorAnimation = ValueAnimator.ofObject(ArgbEvaluator(), colorFrom, colorTo) // val colorTo = ContextCompat.getColor(this@DeliveryOrderMainActivity, R.color.blue)
colorAnimation?.apply { // colorAnimation = ValueAnimator.ofObject(ArgbEvaluator(), colorFrom, colorTo)
addUpdateListener { animation -> // colorAnimation?.apply {
tv_balance.setTextColor(animation.animatedValue as Int) // addUpdateListener { animation ->
} // tv_balance.setTextColor(animation.animatedValue as Int)
duration = 200 // }
repeatMode = RESTART // duration = 200
repeatCount = -1 // repeatMode = RESTART
start() // repeatCount = -1
} // start()
// }
} else {
tv_balance.setTextColor(getmColor(R.color.theme_333_color))
} }
} }
}) })
} }
} }
private fun initViewPager() {
val sectionsPagerAdapter = SectionsPagerAdapter(this, supportFragmentManager, ints)
view_pager.adapter = sectionsPagerAdapter
view_pager.offscreenPageLimit = 4
view_pager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
override fun onPageScrollStateChanged(state: Int) {
}
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
}
override fun onPageSelected(position: Int) {
selectPosition = position
if (position != 0 && position != 1) {
layout_order_type.visibility = View.GONE
} else {
layout_order_type.visibility = View.VISIBLE
}
}
})
}
private var colorAnimation: ValueAnimator? = null private var colorAnimation: ValueAnimator? = null
override fun onStart() {
super.onStart()
if (ServiceCreator.ROOT_URL == HttpsConstans.ROOT_HK_TEST_URL) {
//測試
qm_other_order_bar.setTitle("(Beta) " + GsaCloudApplication.getRestaurantName(this))
}
pageViewModel.getBanlance(GsaCloudApplication.getBrandId(this@DeliveryOrderMainActivity))
}
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
colorAnimation?.let { colorAnimation?.let {
...@@ -196,7 +231,6 @@ class DeliveryOrderMainActivity : BaseActivity() { ...@@ -196,7 +231,6 @@ class DeliveryOrderMainActivity : BaseActivity() {
*/ */
private fun initTabs() { private fun initTabs() {
tabs.setupWithViewPager(view_pager) tabs.setupWithViewPager(view_pager)
for (i in 0 until ints.size) { for (i in 0 until ints.size) {
//获取每一个tab对象 //获取每一个tab对象
val tabAt = tabs.getTabAt(i) val tabAt = tabs.getTabAt(i)
...@@ -210,7 +244,7 @@ class DeliveryOrderMainActivity : BaseActivity() { ...@@ -210,7 +244,7 @@ class DeliveryOrderMainActivity : BaseActivity() {
mTvTitle.setText(ints[i]) mTvTitle.setText(ints[i])
mNumber.text = "0" mNumber.text = "0"
mNumber.setTextColor(this@DeliveryOrderMainActivity.resources.getColor(colors[i])) mNumber.setTextColor(ContextCompat.getColor(this@DeliveryOrderMainActivity, colors[i]))
while (pageViewModel.mOrderNum.size <= i) { while (pageViewModel.mOrderNum.size <= i) {
pageViewModel.mOrderNum.add(MutableLiveData()) pageViewModel.mOrderNum.add(MutableLiveData())
} }
...@@ -239,6 +273,7 @@ class DeliveryOrderMainActivity : BaseActivity() { ...@@ -239,6 +273,7 @@ class DeliveryOrderMainActivity : BaseActivity() {
private var restaurantPopup: QMUIPopup? = null private var restaurantPopup: QMUIPopup? = null
private var stateBg = GradientDrawable() private var stateBg = GradientDrawable()
/** /**
* 切換餐廳狀態按鈕 * 切換餐廳狀態按鈕
*/ */
...@@ -484,14 +519,6 @@ class DeliveryOrderMainActivity : BaseActivity() { ...@@ -484,14 +519,6 @@ class DeliveryOrderMainActivity : BaseActivity() {
qm_other_order_bar.setBackgroundColor(ContextCompat.getColor(this, R.color.theme_color)) qm_other_order_bar.setBackgroundColor(ContextCompat.getColor(this, R.color.theme_color))
} }
override fun onStart() {
super.onStart()
if (ServiceCreator.ROOT_URL == HttpsConstans.ROOT_HK_TEST_URL) {
//測試
qm_other_order_bar.setTitle("(Beta) " + GsaCloudApplication.getRestaurantName(this))
}
}
inner class ClearHeartBroadcastReceiver : BroadcastReceiver() { inner class ClearHeartBroadcastReceiver : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) { override fun onReceive(context: Context?, intent: Intent?) {
finish() finish()
......
...@@ -249,7 +249,7 @@ class OrderDetailsActivity : BaseActivity() { ...@@ -249,7 +249,7 @@ class OrderDetailsActivity : BaseActivity() {
adapter = orderBtnAdapter adapter = orderBtnAdapter
var spanCount = 3 var spanCount = 3
val gridLayoutManager = val gridLayoutManager =
if (btnList.size <= spanCount) { if (btnList.size != 0 && btnList.size <= spanCount) {
spanCount = btnList.size spanCount = btnList.size
GridLayoutManager(this@OrderDetailsActivity, spanCount) GridLayoutManager(this@OrderDetailsActivity, spanCount)
} else { } else {
...@@ -377,7 +377,8 @@ class OrderDetailsActivity : BaseActivity() { ...@@ -377,7 +377,8 @@ class OrderDetailsActivity : BaseActivity() {
//添加服務費 //添加服務費
addServiceChargeBean.observe(this@OrderDetailsActivity, Observer { addServiceChargeBean.observe(this@OrderDetailsActivity, Observer {
cancelDialogForLoading() cancelDialogForLoading()
if (it != null) { it?.let {
refreshBalance(it.paymentValue.toDouble())
finish() finish()
if (TextUtil.isNotEmptyOrNullOrUndefined(it.errMsg)) { if (TextUtil.isNotEmptyOrNullOrUndefined(it.errMsg)) {
ToastUtils.show(this@OrderDetailsActivity, it.errMsg) ToastUtils.show(this@OrderDetailsActivity, it.errMsg)
...@@ -438,7 +439,6 @@ class OrderDetailsActivity : BaseActivity() { ...@@ -438,7 +439,6 @@ class OrderDetailsActivity : BaseActivity() {
private fun additionalServiceCharge(amount: Int) { private fun additionalServiceCharge(amount: Int) {
showLoading() showLoading()
pageViewModel.additionalServiceCharge(GsaCloudApplication.getMemberId(this@OrderDetailsActivity).toString(), orderId, amount) pageViewModel.additionalServiceCharge(GsaCloudApplication.getMemberId(this@OrderDetailsActivity).toString(), orderId, amount)
} }
private fun PageViewModel.selectLalaMove(orderDetails: OrderDetails.DataBean, isPrint: Boolean, black: (it: List<TransportationBean.DataX.Transportation>, orderDetails: OrderDetails.DataBean) -> Unit) { private fun PageViewModel.selectLalaMove(orderDetails: OrderDetails.DataBean, isPrint: Boolean, black: (it: List<TransportationBean.DataX.Transportation>, orderDetails: OrderDetails.DataBean) -> Unit) {
...@@ -523,9 +523,7 @@ class OrderDetailsActivity : BaseActivity() { ...@@ -523,9 +523,7 @@ class OrderDetailsActivity : BaseActivity() {
showLoading() showLoading()
confirmOrder(orderDetails, trafficType, restaurantId, isPrint) { msg -> confirmOrder(orderDetails, trafficType, restaurantId, isPrint) { msg ->
cancelDialogForLoading() cancelDialogForLoading()
val intent = Intent() refreshBalance(orderDetails.deliveryAmount)
intent.putExtra("deliveryAmount", orderDetails.deliveryAmount)
setResult(1001, intent)
when (msg.code) { when (msg.code) {
Transportation.toString() -> {//修改運輸工具 Transportation.toString() -> {//修改運輸工具
finish() finish()
...@@ -562,6 +560,12 @@ class OrderDetailsActivity : BaseActivity() { ...@@ -562,6 +560,12 @@ class OrderDetailsActivity : BaseActivity() {
} }
} }
private fun refreshBalance(deliveryAmount: Double) {
val intent = Intent()
intent.putExtra("deliveryAmount", deliveryAmount)
setResult(1001, intent)
}
/** /**
* 取消訂單,獲取取消原因 * 取消訂單,獲取取消原因
*/ */
......
...@@ -36,7 +36,7 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) { ...@@ -36,7 +36,7 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) {
refreshState.observe(viewLifecycleOwner, Observer { refreshState.observe(viewLifecycleOwner, Observer {
if (arguments?.getInt(INDEX) == it) { if (arguments?.getInt(INDEX) == it) {
page = 1 page = 1
getOrderList(this, false) getOrderList(false)
} }
}) })
} }
...@@ -105,7 +105,7 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) { ...@@ -105,7 +105,7 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) {
} }
refresh_layout.setOnLoadMoreListener { refresh_layout.setOnLoadMoreListener {
page++ page++
getOrderList(pageViewModel, true) getOrderList(true)
} }
} }
...@@ -118,10 +118,10 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) { ...@@ -118,10 +118,10 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) {
page = 1 page = 1
pageViewModel.orderNo = "" pageViewModel.orderNo = ""
pageViewModel.phone = "" pageViewModel.phone = ""
getOrderList(pageViewModel, false) getOrderList(false)
} }
private fun getOrderList(pageViewModel: PageViewModel, isLoadMore: Boolean) { fun getOrderList(isLoadMore: Boolean) {
pageViewModel.getOrderList(GsaCloudApplication.getRestaurantId(activity).toString(), arguments?.getInt(INDEX) pageViewModel.getOrderList(GsaCloudApplication.getRestaurantId(activity).toString(), arguments?.getInt(INDEX)
?: 0, page.toString(), isLoadMore) ?: 0, page.toString(), isLoadMore)
} }
......
...@@ -3,6 +3,8 @@ package com.gingersoft.gsa.delivery_pick_mode.util ...@@ -3,6 +3,8 @@ package com.gingersoft.gsa.delivery_pick_mode.util
import android.app.Activity import android.app.Activity
import android.app.Dialog import android.app.Dialog
import android.view.View import android.view.View
import androidx.annotation.ColorRes
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.gingersoft.gsa.cloud.base.R import com.gingersoft.gsa.cloud.base.R
import com.gingersoft.gsa.cloud.ui.utils.AppDialog import com.gingersoft.gsa.cloud.ui.utils.AppDialog
...@@ -29,8 +31,8 @@ fun Activity.showWaringDialog(title: String, confirm: (Dialog) -> Unit, cancel: ...@@ -29,8 +31,8 @@ fun Activity.showWaringDialog(title: String, confirm: (Dialog) -> Unit, cancel:
} }
} }
fun Activity.showSelectDialog(title: String, spanCount:Int,adapter: RecyclerView.Adapter<RecyclerView.ViewHolder>, confirm: (Dialog) -> Unit, cancel: (Dialog) -> Unit){ fun Activity.showSelectDialog(title: String, spanCount: Int, adapter: RecyclerView.Adapter<RecyclerView.ViewHolder>, confirm: (Dialog) -> Unit, cancel: (Dialog) -> Unit) {
AppDialog().showSelectDialog(this, title, spanCount, adapter){ view, dialog-> AppDialog().showSelectDialog(this, title, spanCount, adapter) { view, dialog ->
when (view.id) { when (view.id) {
R.id.tv_delivery_confirm -> { R.id.tv_delivery_confirm -> {
confirm.invoke(dialog) confirm.invoke(dialog)
...@@ -42,5 +44,9 @@ fun Activity.showSelectDialog(title: String, spanCount:Int,adapter: RecyclerView ...@@ -42,5 +44,9 @@ fun Activity.showSelectDialog(title: String, spanCount:Int,adapter: RecyclerView
} }
} }
fun Activity.getmColor(@ColorRes colorId: Int): Int {
return ContextCompat.getColor(this, colorId)
}
...@@ -422,6 +422,83 @@ ...@@ -422,6 +422,83 @@
app:layout_constraintTop_toBottomOf="@id/layout_today_order_info" /> app:layout_constraintTop_toBottomOf="@id/layout_today_order_info" />
</LinearLayout> </LinearLayout>
<LinearLayout
android:id="@+id/layout_order_type"
android:layout_width="match_parent"
android:layout_height="@dimen/button_height"
android:layout_marginLeft="@dimen/dp_6"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_6"
android:orientation="horizontal">
<RelativeLayout
android:id="@+id/layout_immediate_order"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/shape_left_themecolor_radius_btn"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_immediate_order"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center_horizontal"
android:text="即時單"
android:textColor="@color/white"
android:textSize="@dimen/dp_16" />
<TextView
android:id="@+id/tv_immediate_order_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="@dimen/dp_5"
android:layout_toRightOf="@id/tv_immediate_order"
android:background="@drawable/ui_shape_red_oval"
android:padding="@dimen/dp_2"
android:text="10"
android:textColor="@color/white"
android:textSize="@dimen/dp_12" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/layout_booking_order"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/shape_right_white_radius_btn"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_booking_order"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center_horizontal"
android:text="預約單"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_16" />
<TextView
android:id="@+id/tv_booking_order_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="@dimen/dp_5"
android:layout_toRightOf="@id/tv_booking_order"
android:background="@drawable/ui_shape_red_oval"
android:padding="@dimen/dp_2"
android:text="10"
android:textColor="@color/white"
android:textSize="@dimen/dp_12" />
</RelativeLayout>
</LinearLayout>
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
......
package debug; package order_advance_module;
import com.billy.cc.core.component.CC; import com.billy.cc.core.component.CC;
import com.jess.arms.base.BaseApplication; import com.jess.arms.base.BaseApplication;
......
package debug.di.component; package order_advance_module.di.component;
import com.gingersoft.gsa.cloud.download.mvp.contract.DownloadContract; import com.gingersoft.gsa.cloud.download.mvp.contract.DownloadContract;
import com.gingersoft.gsa.cloud.download.mvp.ui.activity.DownloadActivity; import com.gingersoft.gsa.cloud.download.mvp.ui.activity.DownloadActivity;
...@@ -7,7 +7,7 @@ import com.jess.arms.di.scope.ActivityScope; ...@@ -7,7 +7,7 @@ import com.jess.arms.di.scope.ActivityScope;
import dagger.BindsInstance; import dagger.BindsInstance;
import dagger.Component; import dagger.Component;
import debug.di.module.DownloadModule; import order_advance_module.di.module.DownloadModule;
/** /**
......
package debug.di.module; package order_advance_module.di.module;
import com.gingersoft.gsa.cloud.download.mvp.contract.DownloadContract; import com.gingersoft.gsa.cloud.download.mvp.contract.DownloadContract;
import com.gingersoft.gsa.cloud.download.mvp.model.DownloadModel; import com.gingersoft.gsa.cloud.download.mvp.model.DownloadModel;
......
...@@ -80,7 +80,7 @@ dependencies { ...@@ -80,7 +80,7 @@ dependencies {
addComponent 'download-module' addComponent 'download-module'
addComponent 'table-module' addComponent 'table-module'
addComponent 'print-module' addComponent 'print-module'
addComponent 'delivery_pick_mode' addComponent 'com.gingersoft.gsa.delivery_pick_mode'
addComponent 'manager-module' addComponent 'manager-module'
addComponent 'coldchain-module' addComponent 'coldchain-module'
......
apply from: rootProject.file("cc-settings.gradle")
apply plugin: 'com.jakewharton.butterknife'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
// 避免 lint 检测出错时停止构建
lintOptions {
abortOnError false
}
defaultConfig {
if (project.ext.runAsApp) {
applicationId "com.gingersoft.orderAdvance"
}
minSdkVersion rootProject.ext.android["minSdkVersion"]
targetSdkVersion rootProject.ext.android["targetSdkVersion"]
versionCode rootProject.ext.android["versionCode"]
versionName rootProject.ext.android["versionName"]
multiDexEnabled true
}
dataBinding {
enabled = true
}
resourcePrefix "order-advance"
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
kapt rootProject.ext.dependencies["dagger2-compiler"]
kapt rootProject.ext.dependencies["butterknife-compiler"]
implementation 'androidx.appcompat:appcompat:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gingersoft.order_advance_module">
<application>
<activity android:name=".mvp.ui.activity.DiningTableActivity" />
<!-- arms配置 -->
<meta-data
android:name="com.gingersoft.gsa.cloud.globalconfig.GlobalConfiguration"
android:value="ConfigModule" />
</application>
</manifest>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gingersoft.gsa.cloud.table"> package="com.gingersoft.order_advance_module">
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
<uses-permission android:name="android.permission.INTERNET" />
<application <application
android:name="com.gingersoft.gsa.cloud.base.application.GsaCloudApplication" android:name="com.gingersoft.gsa.cloud.base.application.GsaCloudApplication"
android:allowBackup="true" android:allowBackup="true"
android:icon="@mipmap/ic_launcher" android:label="@string/app_name"
android:supportsRtl="true" android:networkSecurityConfig="@xml/network_android">
android:networkSecurityConfig="@xml/network_android"
android:theme="@style/AppTheme"> <activity android:name=".mvp.ui.activity.DiningTableActivity">
<activity android:name="com.gingersoft.gsa.cloud.ui.activity.WebActivity"/> <intent-filter>
<activity <action android:name="android.intent.action.MAIN" />
android:name="com.gingersoft.gsa.cloud.zxing.MipcaCaptureActivity"
android:launchMode="singleInstance"/>
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.VIEW" />
</intent-filter>
</activity>
<!-- arms配置 -->
<meta-data <meta-data
android:name="com.gingersoft.gsa.cloud.globalconfig.GlobalConfiguration" android:name="com.gingersoft.gsa.cloud.globalconfig.GlobalConfiguration"
android:value="ConfigModule" /> android:value="ConfigModule" />
<meta-data <meta-data
android:name="design_width_in_dp" android:name="design_width_in_dp"
android:value="360"/> android:value="360" />
<meta-data <meta-data
android:name="design_height_in_dp" android:name="design_height_in_dp"
android:value="640"/> android:value="640" />
</application> </application>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
</manifest> </manifest>
\ No newline at end of file
<resources>
<string name="app_name">預點餐</string>
</resources>
package com.gingersoft.order_advance_module;
import com.billy.cc.core.component.CC;
import com.billy.cc.core.component.IComponent;
public class ComponentOrderAdvance implements IComponent {
@Override
public String getName() {
//组件的名称,调用此组件的方式:
// CC.obtainBuilder("ComponentA")...build().callAsync()
return "Component.OrderAdvance";
}
/**
* 组件被调用时的入口
* 要确保每个逻辑分支都会调用到CC.sendCCResult,
* 包括try-catch,if-else,switch-case-default,startActivity
* @param cc 组件调用对象,可从此对象中获取相关信息
* @return true:将异步调用CC.sendCCResult(...),用于异步实现相关功能,例如:文件加载、网络请求等
* false:会同步调用CC.sendCCResult(...),即在onCall方法return之前调用,否则将被视为不合法的实现
*/
@Override
public boolean onCall(CC cc) {
String actionName = cc.getActionName();
switch (actionName) {
default:
//这个逻辑分支上没有调用CC.sendCCResult(...),是一种错误的示例
//并且方法的返回值为false,代表不会异步调用CC.sendCCResult(...)
//在LocalCCInterceptor中将会返回错误码为-10的CCResult
break;
}
return false;
}
}
package com.gingersoft.order_advance_module.di.component;
import dagger.Component;
import com.jess.arms.di.component.AppComponent;
import com.gingersoft.order_advance_module.di.module.DiningTableModule;
import com.jess.arms.di.scope.ActivityScope;
import com.gingersoft.order_advance_module.mvp.ui.activity.DiningTableActivity;
@ActivityScope
@Component(modules = DiningTableModule.class, dependencies = AppComponent.class)
public interface DiningTableComponent {
void inject(DiningTableActivity activity);
}
\ No newline at end of file
package com.gingersoft.order_advance_module.di.module;
import com.jess.arms.di.scope.ActivityScope;
import dagger.Module;
import dagger.Provides;
import com.gingersoft.order_advance_module.mvp.contract.DiningTableContract;
import com.gingersoft.order_advance_module.mvp.model.DiningTableModel;
@Module
public class DiningTableModule {
private DiningTableContract.View view;
/**
* 构建DiningTableModule时,将View的实现类传进来,这样就可以提供View的实现类给presenter
*
* @param view
*/
public DiningTableModule(DiningTableContract.View view) {
this.view = view;
}
@ActivityScope
@Provides
DiningTableContract.View provideDiningTableView() {
return this.view;
}
@ActivityScope
@Provides
DiningTableContract.Model provideDiningTableModel(DiningTableModel model) {
return model;
}
}
\ No newline at end of file
package com.gingersoft.order_advance_module.mvp.contract;
import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
public interface DiningTableContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel {
}
}
package com.gingersoft.order_advance_module.mvp.model;
import android.app.Application;
import com.google.gson.Gson;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import com.jess.arms.di.scope.ActivityScope;
import javax.inject.Inject;
import com.gingersoft.order_advance_module.mvp.contract.DiningTableContract;
@ActivityScope
public class DiningTableModel extends BaseModel implements DiningTableContract.Model {
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public DiningTableModel(IRepositoryManager repositoryManager) {
super(repositoryManager);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mGson = null;
this.mApplication = null;
}
}
\ No newline at end of file
package com.gingersoft.order_advance_module.mvp.presenter;
import android.app.Application;
import com.gingersoft.order_advance_module.mvp.contract.DiningTableContract;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter;
import javax.inject.Inject;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
@ActivityScope
public class DiningTablePresenter extends BasePresenter<DiningTableContract.Model, DiningTableContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
@Inject
public DiningTablePresenter(DiningTableContract.Model model, DiningTableContract.View rootView) {
super(model, rootView);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mErrorHandler = null;
this.mAppManager = null;
this.mImageLoader = null;
this.mApplication = null;
}
}
package com.gingersoft.order_advance_module.mvp.ui.activity;
import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.jess.arms.base.BaseActivity;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
import com.gingersoft.order_advance_module.di.component.DaggerDiningTableComponent;
import com.gingersoft.order_advance_module.di.module.DiningTableModule;
import com.gingersoft.order_advance_module.mvp.contract.DiningTableContract;
import com.gingersoft.order_advance_module.mvp.presenter.DiningTablePresenter;
import com.gingersoft.order_advance_module.R;
import static com.jess.arms.utils.Preconditions.checkNotNull;
public class DiningTableActivity extends BaseActivity<DiningTablePresenter> implements DiningTableContract.View {
@Override
public void setupActivityComponent(@NonNull AppComponent appComponent) {
DaggerDiningTableComponent //如找不到该类,请编译一下项目
.builder()
.appComponent(appComponent)
.diningTableModule(new DiningTableModule(this))
.build()
.inject(this);
}
@Override
public int initView(@Nullable Bundle savedInstanceState) {
return R.layout.activity_dining_table; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
}
@Override
public void initData(@Nullable Bundle savedInstanceState) {
}
@Override
public void initIntent() {
}
@Override
public void initTopBar() {
}
@Override
public void initLanguage() {
}
@Override
public void initLayoutParams() {
}
@Override
public void initLayoutVisible() {
}
@Override
public void showLoading(String message) {
}
@Override
public void hideLoading() {
}
@Override
public void showMessage(@NonNull String message) {
checkNotNull(message);
ArmsUtils.snackbarText(message);
}
@Override
public void launchActivity(@NonNull Intent intent) {
checkNotNull(intent);
ArmsUtils.startActivity(intent);
}
@Override
public void killMyself() {
finish();
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
</LinearLayout>
\ No newline at end of file
<resources>
<!-- <string name="app_name">預點餐</string>-->
</resources>
...@@ -76,7 +76,7 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -76,7 +76,7 @@ public class PrjService extends Service implements ReceiveListener {
private Map<String, List<PrjBean.DataBean.Bean>> listMap = new HashMap<>(); private Map<String, List<PrjBean.DataBean.Bean>> listMap = new HashMap<>();
private List<PrintCurrencyBean> printCurrencyBeans;//通用打印配置 private List<PrintCurrencyBean> printCurrencyBeans;//通用打印配置
private Context mContext; private Context mContext;
private String TAG = "Prj";
@Override @Override
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
...@@ -181,7 +181,7 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -181,7 +181,7 @@ public class PrjService extends Service implements ReceiveListener {
@Override @Override
public void onNext(String s) { public void onNext(String s) {
Log.e("eee", "請求到PRJ數據:" + s); Log.e(TAG, "請求到PRJ數據:" + s);
//請求到數據,停止輪詢,開始打印,在打印完之後再重新開始輪詢 //請求到數據,停止輪詢,開始打印,在打印完之後再重新開始輪詢
// startPrint(s); // startPrint(s);
newPrint(s); newPrint(s);
...@@ -302,7 +302,7 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -302,7 +302,7 @@ public class PrjService extends Service implements ReceiveListener {
//// && (deviceBean.getModel() != null && deviceBean.getModel().toLowerCase().contains("TM-U220B".toLowerCase()))) { //// && (deviceBean.getModel() != null && deviceBean.getModel().toLowerCase().contains("TM-U220B".toLowerCase()))) {
//// //針式打印機在上面處理 //// //針式打印機在上面處理
//// } else { //// } else {
// Log.e("eee", entry.getKey() + "開始打印IP:" + deviceBean.getIp()); // Log.e(TAG, entry.getKey() + "開始打印IP:" + deviceBean.getIp());
// printerInIt.ipDevicePrint(deviceBean, entry.getValue(), this, this); // printerInIt.ipDevicePrint(deviceBean, entry.getValue(), this, this);
// break; // break;
//// } //// }
...@@ -316,6 +316,7 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -316,6 +316,7 @@ public class PrjService extends Service implements ReceiveListener {
listMap.clear(); listMap.clear();
PrjBean prjBean = JsonUtils.parseObject(json, PrjBean.class); PrjBean prjBean = JsonUtils.parseObject(json, PrjBean.class);
if (prjBean == null || prjBean.getData() == null) { if (prjBean == null || prjBean.getData() == null) {
return; return;
} }
//有數據,取消輪詢,等待打印結束。 //有數據,取消輪詢,等待打印結束。
...@@ -474,6 +475,7 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -474,6 +475,7 @@ public class PrjService extends Service implements ReceiveListener {
* ip設備打印 * ip設備打印
*/ */
public void ipPrint(PrinterDeviceBean printerDeviceBean, List<Map<String, Bitmap>> bitmapMaps) { public void ipPrint(PrinterDeviceBean printerDeviceBean, List<Map<String, Bitmap>> bitmapMaps) {
Log.e("eee", "打印次數:" + bitmapMaps.size());
for (int i = 0; i < bitmapMaps.size(); i++) { for (int i = 0; i < bitmapMaps.size(); i++) {
PrintExecutor executor = new PrintExecutor(printerDeviceBean); PrintExecutor executor = new PrintExecutor(printerDeviceBean);
executor.setOnPrjPrintResultListener((errorCode, ids) -> { executor.setOnPrjPrintResultListener((errorCode, ids) -> {
...@@ -481,10 +483,10 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -481,10 +483,10 @@ public class PrjService extends Service implements ReceiveListener {
case PrintSocketHolder.ERROR_0: case PrintSocketHolder.ERROR_0:
//更新狀態 //更新狀態
updatePrjSuccess(ids); updatePrjSuccess(ids);
Log.e("eee", "打印成功"); Log.e(TAG, "打印成功");
break; break;
case PrintSocketHolder.ERROR_2: case PrintSocketHolder.ERROR_2:
Log.e("eee", "创建Socket失败"); Log.e(TAG, "创建Socket失败");
updatePrjFailure(ids); updatePrjFailure(ids);
break; break;
} }
...@@ -710,7 +712,7 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -710,7 +712,7 @@ public class PrjService extends Service implements ReceiveListener {
updateBeans.add(new UpdateBean(id, printState, time)); updateBeans.add(new UpdateBean(id, printState, time));
} }
String json = JsonUtils.toJson(updateBeans); String json = JsonUtils.toJson(updateBeans);
Log.e("eee", "" + json); Log.e(TAG, "" + json);
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), json); RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), json);
//打印過後,直接再讀數據,不用管是否已更新狀態。 //打印過後,直接再讀數據,不用管是否已更新狀態。
...@@ -727,7 +729,7 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -727,7 +729,7 @@ public class PrjService extends Service implements ReceiveListener {
@Override @Override
public void onNext(String s) { public void onNext(String s) {
Log.e("eee", "修改打印狀態:" + s); Log.e(TAG, "修改打印狀態:" + s);
} }
@Override @Override
...@@ -776,7 +778,7 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -776,7 +778,7 @@ public class PrjService extends Service implements ReceiveListener {
// tip = "關閉中"; // tip = "關閉中";
// break; // break;
// } // }
// Log.e("eee", "打印機狀態:" + tip); // Log.e(TAG, "打印機狀態:" + tip);
// } // }
// //
// @Override // @Override
...@@ -785,22 +787,22 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -785,22 +787,22 @@ public class PrjService extends Service implements ReceiveListener {
// case PrintSocketHolder.ERROR_0: // case PrintSocketHolder.ERROR_0:
// //更新狀態 // //更新狀態
// updatePrjState(3); // updatePrjState(3);
// Log.e("eee", "打印成功"); // Log.e(TAG, "打印成功");
// break; // break;
// case PrintSocketHolder.ERROR_1: // case PrintSocketHolder.ERROR_1:
// break; // break;
// case PrintSocketHolder.ERROR_2: // case PrintSocketHolder.ERROR_2:
// Log.e("eee", "创建Socket失败"); // Log.e(TAG, "创建Socket失败");
// //再次打開輪詢 // //再次打開輪詢
// updatePrjState(1); // updatePrjState(1);
// case PrintSocketHolder.ERROR_3: // case PrintSocketHolder.ERROR_3:
// Log.e("eee", "获取输出流失败"); // Log.e(TAG, "获取输出流失败");
// break; // break;
// case PrintSocketHolder.ERROR_4: // case PrintSocketHolder.ERROR_4:
// Log.e("eee", "写入测试页面数据失败"); // Log.e(TAG, "写入测试页面数据失败");
// break; // break;
// case PrintSocketHolder.ERROR_5: // case PrintSocketHolder.ERROR_5:
// Log.e("eee", "必要参数不能为空"); // Log.e(TAG, "必要参数不能为空");
// break; // break;
// } // }
// } // }
......
...@@ -8,7 +8,8 @@ ...@@ -8,7 +8,8 @@
<TextView <TextView
android:id="@+id/tv_total_text" android:id="@+id/tv_total_text"
style="@style/print_other_order_thirty_bold_style" style="@style/print_other_order_thirty_bold_style"
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
tools:text="總金額:" /> tools:text="總金額:" />
...@@ -22,5 +23,5 @@ ...@@ -22,5 +23,5 @@
android:layout_weight="1" android:layout_weight="1"
android:gravity="right" android:gravity="right"
android:textStyle="bold" android:textStyle="bold"
tools:text="$11" /> tools:text="$1111" />
</LinearLayout> </LinearLayout>
...@@ -19,8 +19,9 @@ include 'cc-register', ...@@ -19,8 +19,9 @@ include 'cc-register',
'print-module', 'print-module',
'manager-module', 'manager-module',
'manager-module', 'manager-module',
'delivery_pick_mode', 'com.gingersoft.gsa.delivery_pick_mode',
'tracker', 'tracker',
'coldchain-module' 'coldchain-module',
'order-advance-module'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment