|
@@ -425,39 +425,35 @@ class AddDailyPaymentActivity : BaseActivity<ActivityAddDailyPaymentBinding>() {
|
|
|
}
|
|
|
|
|
|
binding.addPaymentItem.setOnClickListener {
|
|
|
- if (itemCount == 20) {
|
|
|
- showMessage(resources.getString(R.string.max_daily_payment_size_hint))
|
|
|
- } else {
|
|
|
- initPopupWindow {
|
|
|
+ initPopupWindow {
|
|
|
|
|
|
- paymentItemPrice.filters = arrayOf(MoneyInputFilter())
|
|
|
+ paymentItemPrice.filters = arrayOf(MoneyInputFilter())
|
|
|
|
|
|
- commit.setOnClickListener {
|
|
|
- if (paymentItemName.text.trim().isEmpty() || paymentItemCount.text.trim()
|
|
|
- .isEmpty() || paymentItemPrice.text.trim().isEmpty()
|
|
|
- ) {
|
|
|
- showMessage(resources.getString(R.string.payment_item_hint))
|
|
|
+ commit.setOnClickListener {
|
|
|
+ if (paymentItemName.text.trim().isEmpty() || paymentItemCount.text.trim()
|
|
|
+ .isEmpty() || paymentItemPrice.text.trim().isEmpty()
|
|
|
+ ) {
|
|
|
+ showMessage(resources.getString(R.string.payment_item_hint))
|
|
|
+ } else {
|
|
|
+ val regex = Regex("^-?\\d+(\\.\\d{1,2})?\$")
|
|
|
+ if (!paymentItemPrice.text.toString().matches(regex)) {
|
|
|
+ showMessage(resources.getString(R.string.payment_price_hint))
|
|
|
} else {
|
|
|
- val regex = Regex("^-?\\d+(\\.\\d{1,2})?\$")
|
|
|
- if (!paymentItemPrice.text.toString().matches(regex)) {
|
|
|
- showMessage(resources.getString(R.string.payment_price_hint))
|
|
|
- } else {
|
|
|
- dailyPaymentList.add(
|
|
|
- DailyPaymentListItem(
|
|
|
- paymentItemName.text.toString(),
|
|
|
- paymentItemCount.text.toString().toInt(),
|
|
|
- paymentItemPrice.text.toString().toFloat(),
|
|
|
- paymentItemCount.text.toString()
|
|
|
- .toInt() * paymentItemPrice.text.toString().toDouble(),
|
|
|
- paymentItemRemark.getText().trim()
|
|
|
- )
|
|
|
+ dailyPaymentList.add(
|
|
|
+ DailyPaymentListItem(
|
|
|
+ paymentItemName.text.toString(),
|
|
|
+ paymentItemCount.text.toString().toInt(),
|
|
|
+ paymentItemPrice.text.toString().toFloat(),
|
|
|
+ paymentItemCount.text.toString()
|
|
|
+ .toInt() * paymentItemPrice.text.toString().toDouble(),
|
|
|
+ paymentItemRemark.getText().trim()
|
|
|
)
|
|
|
- initList()
|
|
|
- totalPayment += dailyPaymentList[itemCount].itemTotal
|
|
|
- itemCount += 1
|
|
|
- setTotalPayment()
|
|
|
- popupWindow.dismiss()
|
|
|
- }
|
|
|
+ )
|
|
|
+ initList()
|
|
|
+ totalPayment += dailyPaymentList[itemCount].itemTotal
|
|
|
+ itemCount += 1
|
|
|
+ setTotalPayment()
|
|
|
+ popupWindow.dismiss()
|
|
|
}
|
|
|
}
|
|
|
}
|