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
class GetInfoUpdateService : Service() {
private val TAG = "eee"
private val TAG = "heart"
/**
* 心跳检测时间
*/
......@@ -287,7 +287,6 @@ class GetInfoUpdateService : Service() {
fun initSoundPool(resId: Int) {
val nowTime = System.currentTimeMillis()//當前時間減去上次播放的時間,如果超過五秒,那麼才會再次播放提示聲
if (nowTime - lastSoundTime > 5000) {
Log.e("eee", "間隔時間" + (nowTime - lastSoundTime))
putTimeLog("現在時間:$nowTime 上次播放時間:$lastSoundTime")
putTimeLog("新訂單播放:$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 @@
<dimen name="head_size">16sp</dimen>
<!-- 全局Button -->
<dimen name="button_height">35dp</dimen>
<dimen name="button_height">40dp</dimen>
<dimen name="button_margin">20dp</dimen>
<dimen name="button_margin_half">20dp</dimen>
<dimen name="button_padding">14dp</dimen>
......
......@@ -13,6 +13,8 @@ public class OrderList {
private boolean success;
private long sysTime;
private DataBeanX data;
private String errMsg;
private String errCode;
public boolean isSuccess() {
return success;
......@@ -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
.doOnSubscribe(disposable -> mRootView.showLoading("確認訂單中,請稍候..."))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> {})
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<ShipAnyOrdersNewBean>(mErrorHandler) {
......@@ -205,9 +205,10 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
.build();
mModel.updateOrderStatus(requestBody)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> {})
.doOnSubscribe(disposable -> mRootView.showLoading("確認訂單中,請稍候..."))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<UpdateOrderStatusBean>(mErrorHandler) {
......
......@@ -5,6 +5,7 @@ import android.app.Application;
import com.gingersoft.coldchain_module.mvp.constans.ColdChainConstans;
import com.gingersoft.coldchain_module.mvp.contract.OrderListContract;
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.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager;
......@@ -65,6 +66,7 @@ public class OrderListPresenter extends BasePresenter<OrderListContract.Model, O
.add("pageSize", "")
.add("status", status)
.add("type", type)
.add("appointmentType ", "0")
.build();
mModel.getOrderList(requestBody)
.subscribeOn(Schedulers.io())
......@@ -97,6 +99,9 @@ public class OrderListPresenter extends BasePresenter<OrderListContract.Model, O
mRootView.loadOrderList(orderList);
} else {
mRootView.loadOrderList(null);
if(info != null && TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())){
mRootView.showMessage(info.getErrMsg());
}
}
}
......
package com.gingersoft.coldchain_module.mvp.ui.activity;
import android.animation.ArgbEvaluator;
import android.animation.ValueAnimator;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
......@@ -52,7 +51,6 @@ import java.util.List;
import butterknife.BindView;
import butterknife.OnClick;
import static android.animation.ValueAnimator.RESTART;
import static androidx.fragment.app.FragmentStatePagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT;
import static com.jess.arms.utils.Preconditions.checkNotNull;
......@@ -247,15 +245,18 @@ public class ColdChainMainActivity extends BaseFragmentActivity<ColdChainMainPre
public void loadBalance(double price, double bond, boolean isBlink) {
tvBalance.setText("餘額:" + price + "(保證金" + bond + ")");
if (isBlink) {
tvBalance.setTextColor(ContextCompat.getColor(mContext, R.color.theme_red_color));
//提示餘額不足
int colorFrom = ContextCompat.getColor(mContext, R.color.red);
int colorTo = ContextCompat.getColor(mContext, R.color.blue);
colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo);
colorAnimation.addUpdateListener(animation -> tvBalance.setTextColor((Integer) animation.getAnimatedValue()));
colorAnimation.setDuration(200);
colorAnimation.setRepeatMode(RESTART);
colorAnimation.setRepeatCount(-1);
colorAnimation.start();
// int colorFrom = ContextCompat.getColor(mContext, R.color.red);
// int colorTo = ContextCompat.getColor(mContext, R.color.blue);
// colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo);
// colorAnimation.addUpdateListener(animation -> tvBalance.setTextColor((Integer) animation.getAnimatedValue()));
// colorAnimation.setDuration(200);
// colorAnimation.setRepeatMode(RESTART);
// colorAnimation.setRepeatCount(-1);
// colorAnimation.start();
} else {
tvBalance.setTextColor(ContextCompat.getColor(mContext, R.color.theme_333_color));
}
}
......@@ -275,6 +276,12 @@ public class ColdChainMainActivity extends BaseFragmentActivity<ColdChainMainPre
}
}
@Override
protected void onStart() {
super.onStart();
getNumByOrderTypeInvoke("loadNumber");
}
private class ClearHeartBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
......
......@@ -336,6 +336,7 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailsPresenter> im
// Start a print job, passing in a PrintDocumentAdapter implementation 启动打印作业,传入printdocumentadapter实现
// to handle the generation of a print document处理打印文档的生成
printManager.print(jobName, new MyPrintDocumentAdapter(mContext, file, (code, msg) -> {
hideLoading();
if (code != 0) {
showMessage(msg);
}
......@@ -360,4 +361,10 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailsPresenter> im
return super.onKeyDown(keyCode, event);
}
}
@Override
protected void onDestroy() {
super.onDestroy();
hideLoading();
}
}
\ No newline at end of file
......@@ -8,7 +8,7 @@ ext {
//正式版: 1.0.3 3
//內部測試版:1.2.0 20
versionCode : 7,
versionName : "1.0.72"
versionName : "1.0.73"
]
version = [
......
......@@ -13,7 +13,7 @@ android {
defaultConfig {
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"]
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
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()
.add("restaurantId", restaurantId)
.add("page", page)
......@@ -25,6 +25,7 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
.add("orderNo", orderNo)
.add("phone", phone)
.add("type", type)
.add("appointmentType", appointmentType.toString())
.build()
val heWeather = network.fetchOrderList(requestBody)
heWeather
......
package com.gingersoft.gsa.delivery_pick_mode.data.model.bean
data class AddServiceChargeBean(
val errCode: String,
val errMsg: String,
val success: Boolean,
val sysTime: Long
val errCode: String,
val errMsg: String,
val success: Boolean,
val sysTime: Long,
var paymentValue: Int
)
\ No newline at end of file
......@@ -73,6 +73,8 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
//接單超時時間
var timeOut = 0
var appointmentType = MutableLiveData(0) //0為即時單,1為預約單
var addServiceChargeBean = MutableLiveData<AddServiceChargeBean>()
/**
* 獲取訂單數量
......@@ -135,7 +137,8 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
*/
fun getOrderList(restaurantId: String, position: Int, page: String, isLoadMore: Boolean) {
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("測試獲取訂單列表異常")
if (isSuccess()) {
getOrderGroupNum(restaurantId)
......@@ -512,6 +515,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
*/
fun additionalServiceCharge(uid: String, orderId: String, paymentValue: Int) {
launch({
addServiceChargeBean.value?.paymentValue = paymentValue
addServiceChargeBean.postValue(repository.additionalServiceCharge(uid, orderId, paymentValue))
}, {
addServiceChargeBean.postValue(null)
......
package com.gingersoft.gsa.delivery_pick_mode.ui.activity
import android.animation.ArgbEvaluator
import android.animation.ValueAnimator
import android.animation.ValueAnimator.RESTART
import android.app.Dialog
import android.content.*
import android.graphics.drawable.GradientDrawable
import android.os.Build
import android.os.Bundle
import android.os.IBinder
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.widget.TextView
......@@ -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.base.BaseActivity
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.QMUIAlphaTextView
import com.qmuiteam.qmui.util.QMUIDisplayHelper
......@@ -86,22 +84,7 @@ class DeliveryOrderMainActivity : BaseActivity() {
initAppTop()
initSwitchRestStatus()
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
}
})
initViewPager()
searchMethod(view_pager)
initTabs()
//餐廳營業信息
......@@ -113,35 +96,87 @@ class DeliveryOrderMainActivity : BaseActivity() {
btn_open_or_close_info.post {
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 {
getDeliveryInfo(restaurantId.toString(), memberId.toString())
getBanlance(GsaCloudApplication.getBrandId(this@DeliveryOrderMainActivity))
balanceBean.observe(this@DeliveryOrderMainActivity, Observer {
it?.data?.let {
it?.data?.let { it ->
tv_balance.text = "餘額:${it.balance}" + "(保證金: ${it.bond} )"
if (it.balance <= it.threshold) {
//提示餘額不足
val colorFrom = ContextCompat.getColor(this@DeliveryOrderMainActivity, R.color.red)
val colorTo = ContextCompat.getColor(this@DeliveryOrderMainActivity, R.color.blue)
colorAnimation = ValueAnimator.ofObject(ArgbEvaluator(), colorFrom, colorTo)
colorAnimation?.apply {
addUpdateListener { animation ->
tv_balance.setTextColor(animation.animatedValue as Int)
}
duration = 200
repeatMode = RESTART
repeatCount = -1
start()
}
tv_balance.setTextColor(getmColor(R.color.theme_red_color))
// val colorFrom = ContextCompat.getColor(this@DeliveryOrderMainActivity, R.color.red)
// val colorTo = ContextCompat.getColor(this@DeliveryOrderMainActivity, R.color.blue)
// colorAnimation = ValueAnimator.ofObject(ArgbEvaluator(), colorFrom, colorTo)
// colorAnimation?.apply {
// addUpdateListener { animation ->
// tv_balance.setTextColor(animation.animatedValue as Int)
// }
// duration = 200
// repeatMode = RESTART
// 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
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() {
super.onResume()
colorAnimation?.let {
......@@ -196,7 +231,6 @@ class DeliveryOrderMainActivity : BaseActivity() {
*/
private fun initTabs() {
tabs.setupWithViewPager(view_pager)
for (i in 0 until ints.size) {
//获取每一个tab对象
val tabAt = tabs.getTabAt(i)
......@@ -210,7 +244,7 @@ class DeliveryOrderMainActivity : BaseActivity() {
mTvTitle.setText(ints[i])
mNumber.text = "0"
mNumber.setTextColor(this@DeliveryOrderMainActivity.resources.getColor(colors[i]))
mNumber.setTextColor(ContextCompat.getColor(this@DeliveryOrderMainActivity, colors[i]))
while (pageViewModel.mOrderNum.size <= i) {
pageViewModel.mOrderNum.add(MutableLiveData())
}
......@@ -239,6 +273,7 @@ class DeliveryOrderMainActivity : BaseActivity() {
private var restaurantPopup: QMUIPopup? = null
private var stateBg = GradientDrawable()
/**
* 切換餐廳狀態按鈕
*/
......@@ -484,14 +519,6 @@ class DeliveryOrderMainActivity : BaseActivity() {
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() {
override fun onReceive(context: Context?, intent: Intent?) {
finish()
......
......@@ -249,7 +249,7 @@ class OrderDetailsActivity : BaseActivity() {
adapter = orderBtnAdapter
var spanCount = 3
val gridLayoutManager =
if (btnList.size <= spanCount) {
if (btnList.size != 0 && btnList.size <= spanCount) {
spanCount = btnList.size
GridLayoutManager(this@OrderDetailsActivity, spanCount)
} else {
......@@ -377,7 +377,8 @@ class OrderDetailsActivity : BaseActivity() {
//添加服務費
addServiceChargeBean.observe(this@OrderDetailsActivity, Observer {
cancelDialogForLoading()
if (it != null) {
it?.let {
refreshBalance(it.paymentValue.toDouble())
finish()
if (TextUtil.isNotEmptyOrNullOrUndefined(it.errMsg)) {
ToastUtils.show(this@OrderDetailsActivity, it.errMsg)
......@@ -438,7 +439,6 @@ class OrderDetailsActivity : BaseActivity() {
private fun additionalServiceCharge(amount: Int) {
showLoading()
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) {
......@@ -523,9 +523,7 @@ class OrderDetailsActivity : BaseActivity() {
showLoading()
confirmOrder(orderDetails, trafficType, restaurantId, isPrint) { msg ->
cancelDialogForLoading()
val intent = Intent()
intent.putExtra("deliveryAmount", orderDetails.deliveryAmount)
setResult(1001, intent)
refreshBalance(orderDetails.deliveryAmount)
when (msg.code) {
Transportation.toString() -> {//修改運輸工具
finish()
......@@ -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) {
refreshState.observe(viewLifecycleOwner, Observer {
if (arguments?.getInt(INDEX) == it) {
page = 1
getOrderList(this, false)
getOrderList(false)
}
})
}
......@@ -105,7 +105,7 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) {
}
refresh_layout.setOnLoadMoreListener {
page++
getOrderList(pageViewModel, true)
getOrderList(true)
}
}
......@@ -118,10 +118,10 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) {
page = 1
pageViewModel.orderNo = ""
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)
?: 0, page.toString(), isLoadMore)
}
......
......@@ -3,6 +3,8 @@ package com.gingersoft.gsa.delivery_pick_mode.util
import android.app.Activity
import android.app.Dialog
import android.view.View
import androidx.annotation.ColorRes
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import com.gingersoft.gsa.cloud.base.R
import com.gingersoft.gsa.cloud.ui.utils.AppDialog
......@@ -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){
AppDialog().showSelectDialog(this, title, spanCount, adapter){ view, dialog->
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 ->
when (view.id) {
R.id.tv_delivery_confirm -> {
confirm.invoke(dialog)
......@@ -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 @@
app:layout_constraintTop_toBottomOf="@id/layout_today_order_info" />
</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>
......
package debug;
package order_advance_module;
import com.billy.cc.core.component.CC;
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.ui.activity.DownloadActivity;
......@@ -7,7 +7,7 @@ import com.jess.arms.di.scope.ActivityScope;
import dagger.BindsInstance;
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.model.DownloadModel;
......
......@@ -80,7 +80,7 @@ dependencies {
addComponent 'download-module'
addComponent 'table-module'
addComponent 'print-module'
addComponent 'delivery_pick_mode'
addComponent 'com.gingersoft.gsa.delivery_pick_mode'
addComponent 'manager-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"?>
<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
android:name="com.gingersoft.gsa.cloud.base.application.GsaCloudApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:networkSecurityConfig="@xml/network_android"
android:theme="@style/AppTheme">
<activity android:name="com.gingersoft.gsa.cloud.ui.activity.WebActivity"/>
<activity
android:name="com.gingersoft.gsa.cloud.zxing.MipcaCaptureActivity"
android:launchMode="singleInstance"/>
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_android">
<activity android:name=".mvp.ui.activity.DiningTableActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.VIEW" />
</intent-filter>
</activity>
<!-- arms配置 -->
<meta-data
android:name="com.gingersoft.gsa.cloud.globalconfig.GlobalConfiguration"
android:value="ConfigModule" />
<meta-data
android:name="design_width_in_dp"
android:value="360"/>
android:value="360" />
<meta-data
android:name="design_height_in_dp"
android:value="640"/>
android:value="640" />
</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>
\ 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 {
private Map<String, List<PrjBean.DataBean.Bean>> listMap = new HashMap<>();
private List<PrintCurrencyBean> printCurrencyBeans;//通用打印配置
private Context mContext;
private String TAG = "Prj";
@Override
public void onCreate() {
super.onCreate();
......@@ -181,7 +181,7 @@ public class PrjService extends Service implements ReceiveListener {
@Override
public void onNext(String s) {
Log.e("eee", "請求到PRJ數據:" + s);
Log.e(TAG, "請求到PRJ數據:" + s);
//請求到數據,停止輪詢,開始打印,在打印完之後再重新開始輪詢
// startPrint(s);
newPrint(s);
......@@ -302,7 +302,7 @@ public class PrjService extends Service implements ReceiveListener {
//// && (deviceBean.getModel() != null && deviceBean.getModel().toLowerCase().contains("TM-U220B".toLowerCase()))) {
//// //針式打印機在上面處理
//// } else {
// Log.e("eee", entry.getKey() + "開始打印IP:" + deviceBean.getIp());
// Log.e(TAG, entry.getKey() + "開始打印IP:" + deviceBean.getIp());
// printerInIt.ipDevicePrint(deviceBean, entry.getValue(), this, this);
// break;
//// }
......@@ -316,6 +316,7 @@ public class PrjService extends Service implements ReceiveListener {
listMap.clear();
PrjBean prjBean = JsonUtils.parseObject(json, PrjBean.class);
if (prjBean == null || prjBean.getData() == null) {
return;
}
//有數據,取消輪詢,等待打印結束。
......@@ -474,6 +475,7 @@ public class PrjService extends Service implements ReceiveListener {
* ip設備打印
*/
public void ipPrint(PrinterDeviceBean printerDeviceBean, List<Map<String, Bitmap>> bitmapMaps) {
Log.e("eee", "打印次數:" + bitmapMaps.size());
for (int i = 0; i < bitmapMaps.size(); i++) {
PrintExecutor executor = new PrintExecutor(printerDeviceBean);
executor.setOnPrjPrintResultListener((errorCode, ids) -> {
......@@ -481,10 +483,10 @@ public class PrjService extends Service implements ReceiveListener {
case PrintSocketHolder.ERROR_0:
//更新狀態
updatePrjSuccess(ids);
Log.e("eee", "打印成功");
Log.e(TAG, "打印成功");
break;
case PrintSocketHolder.ERROR_2:
Log.e("eee", "创建Socket失败");
Log.e(TAG, "创建Socket失败");
updatePrjFailure(ids);
break;
}
......@@ -710,7 +712,7 @@ public class PrjService extends Service implements ReceiveListener {
updateBeans.add(new UpdateBean(id, printState, time));
}
String json = JsonUtils.toJson(updateBeans);
Log.e("eee", "" + json);
Log.e(TAG, "" + json);
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), json);
//打印過後,直接再讀數據,不用管是否已更新狀態。
......@@ -727,7 +729,7 @@ public class PrjService extends Service implements ReceiveListener {
@Override
public void onNext(String s) {
Log.e("eee", "修改打印狀態:" + s);
Log.e(TAG, "修改打印狀態:" + s);
}
@Override
......@@ -776,7 +778,7 @@ public class PrjService extends Service implements ReceiveListener {
// tip = "關閉中";
// break;
// }
// Log.e("eee", "打印機狀態:" + tip);
// Log.e(TAG, "打印機狀態:" + tip);
// }
//
// @Override
......@@ -785,22 +787,22 @@ public class PrjService extends Service implements ReceiveListener {
// case PrintSocketHolder.ERROR_0:
// //更新狀態
// updatePrjState(3);
// Log.e("eee", "打印成功");
// Log.e(TAG, "打印成功");
// break;
// case PrintSocketHolder.ERROR_1:
// break;
// case PrintSocketHolder.ERROR_2:
// Log.e("eee", "创建Socket失败");
// Log.e(TAG, "创建Socket失败");
// //再次打開輪詢
// updatePrjState(1);
// case PrintSocketHolder.ERROR_3:
// Log.e("eee", "获取输出流失败");
// Log.e(TAG, "获取输出流失败");
// break;
// case PrintSocketHolder.ERROR_4:
// Log.e("eee", "写入测试页面数据失败");
// Log.e(TAG, "写入测试页面数据失败");
// break;
// case PrintSocketHolder.ERROR_5:
// Log.e("eee", "必要参数不能为空");
// Log.e(TAG, "必要参数不能为空");
// break;
// }
// }
......
......@@ -8,7 +8,8 @@
<TextView
android:id="@+id/tv_total_text"
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_marginTop="@dimen/dp_10"
tools:text="總金額:" />
......@@ -22,5 +23,5 @@
android:layout_weight="1"
android:gravity="right"
android:textStyle="bold"
tools:text="$11" />
tools:text="$1111" />
</LinearLayout>
......@@ -19,8 +19,9 @@ include 'cc-register',
'print-module',
'manager-module',
'manager-module',
'delivery_pick_mode',
'com.gingersoft.gsa.delivery_pick_mode',
'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