Commit 569947bb authored by jiangjiantao's avatar jiangjiantao

dev

parent 382f9bc4
......@@ -38,7 +38,7 @@ android {
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.core:core-ktx:1.3.1'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
......@@ -62,4 +62,7 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation files('libs/miya-print-1.0.23.aar')
implementation 'com.tencent:mmkv:1.2.12'
implementation 'com.github.ybq:Android-SpinKit:1.4.0'
implementation 'com.github.d-max:spots-dialog:1.1@aar'
}
\ No newline at end of file
......@@ -9,14 +9,14 @@
<application
android:name=".BaseApplication"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true">
<activity
android:name=".ui.LoginActivity"
android:exported="true"
android:label="@string/title_activity_login"
android:label="@string/app_name"
android:theme="@style/Theme.MiYaFastCashier.Light">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
......@@ -34,9 +34,18 @@
<activity
android:name=".ui.PayCodeActivity"
android:theme="@style/Theme.MiYaFastCashier.Dark" />
<activity
android:name=".ui.AliPayCodeActivity"
android:theme="@style/Theme.MiYaFastCashier.Blue" />
<activity
android:name=".ui.WxPayCodeActivity"
android:theme="@style/Theme.MiYaFastCashier.Green" />
<activity
android:name=".ui.PayResultActivity"
android:theme="@style/Theme.MiYaFastCashier.Light" />
<activity
android:name=".ui.RefundActivity"
android:theme="@style/Theme.MiYaFastCashier.Dark" />
</application>
</manifest>
\ No newline at end of file
......@@ -7,6 +7,7 @@ import android.os.Bundle
import android.util.Log
import androidx.multidex.MultiDexApplication
import com.miya.print.PrinterManager
import com.tencent.mmkv.MMKV
class BaseApplication : MultiDexApplication() {
override fun onCreate() {
......@@ -15,6 +16,7 @@ class BaseApplication : MultiDexApplication() {
PrinterManager.getInstance().init(this)
//屏幕适配
screenAdapt()
MMKV.initialize(this);
}
private fun screenAdapt() {
......
package com.miya.fastcashier.repository
import android.text.TextUtils
import androidx.annotation.WorkerThread
import com.miya.fastcashier.service.AccountService
import com.sdy.miya.moblie.component.pay.core.constance.AppTagConstance
......@@ -89,31 +90,27 @@ object PayRepository {
*/
fun refundByOrderNo(params: Map<String, String>): PayServiceResponse {
if (params == null) {
throw RuntimeException("MiyaPayServiceComponent refundByOrderNo params is null")
}
val shopInfo = AccountService.getAccountInfo()?.shopInfo
val baseUrl = params["baseUrl"]
val signKey = params["signKey"]
val saasid = params["saasid"]
val marketid = params["marketid"]
val posId = params["posId"]
val cashierCode = params["cashierCode"]
val version = params["version"]
val baseUrl = shopInfo?.miyaPayPlatformUrl;
val signKey = shopInfo?.miyaPayPlatformSignKey
val saasid = shopInfo?.saasid
val marketid = shopInfo?.storeId
val posId = shopInfo?.posId
val cashierCode = shopInfo?.operatorId
val version = "1.5"
val oriOrderNo = params["oriOrderNo"]
val refundOrderNo = params["refundOrderNo"]
val refundPrice = params["refundPrice"]
checkNotNull(baseUrl) { "MiyaPayServiceComponent refundByOrderNo baseUrl is null" }
checkNotNull(signKey) { "MiyaPayServiceComponent refundByOrderNo signKey is null" }
checkNotNull(saasid) { "MiyaPayServiceComponent refundByOrderNo saasid is null" }
checkNotNull(marketid) { "MiyaPayServiceComponent refundByOrderNo marketid is null" }
checkNotNull(posId) { "MiyaPayServiceComponent refundByOrderNo posId is null" }
checkNotNull(cashierCode) { "MiyaPayServiceComponent refundByOrderNo cashierCode is null" }
checkNotNull(version) { "MiyaPayServiceComponent refundByOrderNo version is null" }
checkNotNull(oriOrderNo) { "MiyaPayServiceComponent refundByOrderNo oriOrderNo is null" }
checkNotNull(refundOrderNo) { "MiyaPayServiceComponent refundByOrderNo refundOrderNo is null" }
checkNotNull(refundPrice) { "MiyaPayServiceComponent refundByOrderNo refundPrice is null" }
checkNotNull(baseUrl) { "refundByOrderNo baseUrl is null" }
checkNotNull(signKey) { "refundByOrderNo signKey is null" }
checkNotNull(saasid) { "refundByOrderNo saasid is null" }
checkNotNull(marketid) { "refundByOrderNo marketid is null" }
checkNotNull(version) { "refundByOrderNo version is null" }
checkNotNull(oriOrderNo) { "refundByOrderNo oriOrderNo is null" }
checkNotNull(refundOrderNo) { "refundByOrderNo refundOrderNo is null" }
checkNotNull(refundPrice) { "refundByOrderNo refundPrice is null" }
val paramsMap: MutableMap<String, Any> = HashMap(14, 1.0f)
......@@ -121,10 +118,13 @@ object PayRepository {
paramsMap["signKey"] = signKey
paramsMap["saasId"] = saasid
paramsMap["marketId"] = marketid
paramsMap["posId"] = posId
paramsMap["cashierCode"] = cashierCode
posId?.let {
paramsMap["posId"] = it
}
cashierCode?.let {
paramsMap["cashierCode"] = it
}
paramsMap["version"] = version
paramsMap["oriOrderNo"] = oriOrderNo
paramsMap["refundOrderNo"] = refundOrderNo
paramsMap["refundPrice"] = refundPrice
......@@ -212,7 +212,6 @@ object PayRepository {
checkNotNull(marketid) { "marketid is null" }
// checkNotNull(posId) { "posId is null" }
// checkNotNull(cashierCode) { "cashierCode is null" }
checkNotNull(orderNo) { "orderNo is null" }
val paramsMap: MutableMap<String, Any?> = HashMap(14, 1.0f)
paramsMap["baseUrl"] = baseUrl
......@@ -229,8 +228,12 @@ object PayRepository {
MiYaPlatformPayService.getService().syncRequestOrderStateByOrderId(paramsMap)
if (miYaMobilePayResult != null && miYaMobilePayResult.resultCode == ResultBuilder.SUCCESS) {
return miYaMobilePayResult.payServiceResponse
} else {
throw RuntimeException(miYaMobilePayResult!!.errorMsg)
} else if(!TextUtils.isEmpty(miYaMobilePayResult.errorMsg)){
throw RuntimeException(miYaMobilePayResult.errorMsg)
}else if(miYaMobilePayResult.payServiceResponse != null && !TextUtils.isEmpty(miYaMobilePayResult.payServiceResponse.chanelErrorMsg)){
throw RuntimeException(miYaMobilePayResult.payServiceResponse.chanelErrorMsg)
}else{
throw RuntimeException("支付异常!")
}
} catch (e: Exception) {
e.printStackTrace()
......
......@@ -6,8 +6,9 @@ import com.sdy.miya.moblie.component.pay.platform.bean.MiyaOrderRefundResponse
object AccountService{
private var selfCashierAccountInfo : SelfCashierAccountInfo? = null;
private var userName : String? = ""
fun setAccountInfo(selfCashierAccountInfo : SelfCashierAccountInfo){
fun setAccountInfo(selfCashierAccountInfo : SelfCashierAccountInfo?){
this.selfCashierAccountInfo = selfCashierAccountInfo
}
......@@ -15,4 +16,11 @@ object AccountService{
return selfCashierAccountInfo;
}
fun setUserName(userName:String){
this.userName = userName
}
fun getUserName():String{
return userName.toString();
}
}
\ No newline at end of file
......@@ -2,22 +2,44 @@ package com.miya.fastcashier.service
import android.text.TextUtils
import com.miya.fastcashier.beans.SelfCashierAccountInfo
import com.miya.fastcashier.utils.DateUtils
import com.miya.fastcashier.utils.MiYaPayPlantformPayWayEnum
import com.miya.fastcashier.utils.StringPriceFormat
import com.miya.print.IPrinter
import com.miya.print.PrinterManager
import com.miya.print.utils.Page58MmPrintUtils
import com.sdy.miya.moblie.component.pay.platform.bean.PayServiceResponse
import com.tencent.mmkv.MMKV
import java.util.*
object PrintService{
private var payServiceResponse : PayServiceResponse? = null;
/**
* 退款
*/
fun refundPrint(selfCashierAccountInfo: SelfCashierAccountInfo,payServiceResponse: PayServiceResponse){
if(true){
throw RuntimeException("退款异常");
val printer = PrinterManager.getInstance().printer
printer.beginPrint()
//检查打印机状态
printer.printerStatus
printer.set58mm()
refundPrintCashier(printer,payServiceResponse,selfCashierAccountInfo)
refundPrintCustomer(printer,payServiceResponse,selfCashierAccountInfo)
printer.feedPaper()
printer.endPrint()
}
/**
* 打印上一单
*/
fun printLastOrderInfo(){
if(payServiceResponse == null){
throw java.lang.RuntimeException("暂无上一单信息")
}else{
AccountService.getAccountInfo()?.let { payInfoPrint(payServiceResponse!!, it) }
}
}
......@@ -25,31 +47,97 @@ object PrintService{
* 扣款信息打印
*/
fun payInfoPrint(payServiceResponse: PayServiceResponse,selfCashierAccountInfo: SelfCashierAccountInfo){
//保存上一单信息
this.payServiceResponse = payServiceResponse
//记录流水号,退款要用
setSerialNoByOrderNo(payServiceResponse.shopTradeNo,getSerialNumber())
val printer = PrinterManager.getInstance().printer
printer.beginPrint()
printer.set58mm()
printer.setAlign(IPrinter.ALIGN_CENTER)
//检查打印机状态
printer.printerStatus
printer.set58mm()
printCashier(printer,payServiceResponse,selfCashierAccountInfo)
printCustomer(printer,payServiceResponse,selfCashierAccountInfo)
printer.feedPaper()
printer.endPrint()
}
/**
* 打印收银员联
*/
private fun printCashier(printer:IPrinter,payServiceResponse: PayServiceResponse,selfCashierAccountInfo: SelfCashierAccountInfo){
val shopInfo = selfCashierAccountInfo.shopInfo
printer.printText(shopInfo.storeName)
printer.printText(IPrinter.ALIGN_CENTER,3, shopInfo.storeName,true)
printer.setAlign(IPrinter.ALIGN_LEFT)
printer.printText("商户编号:${shopInfo.saasid}")
printer.printText("终端编号:${shopInfo.posId}")
printer.printText("商户名称:converse")
printer.printText(Page58MmPrintUtils.printDivideLineString())
printer.printText("交易类型:")
printer.printText(IPrinter.ALIGN_LEFT,3, " ${ MiYaPayPlantformPayWayEnum.MiyaPayType.find(payServiceResponse.chanelTag).desc}",true)
printer.printText(Page58MmPrintUtils.printDivideLineString())
printer.printText("日期/时间:${DateUtils.format18(Date())}")
printer.printText("流水号:${getSerialNumber()}")
printer.printText("商户订单号:")
printer.printText(payServiceResponse.shopTradeNo)
printer.printText("支付平台交易号:")
printer.printText(payServiceResponse.chanelSerialNumber)
printer.printText("金额:")
printer.printText(IPrinter.ALIGN_LEFT,3," RMB${StringPriceFormat.transStringPriceToDecimalString(payServiceResponse.tradPrice)}",true)
printer.printText(Page58MmPrintUtils.printDivideLineString())
printer.printText("备注:")
val couponDetail: Array<String> = payServiceResponse.transformCouponMessage
if (couponDetail.size >= 2 && !TextUtils.isEmpty(couponDetail[1]) && couponDetail[1] != "0" && couponDetail[1] != "0.00") {
val shopCoupon = couponDetail[1]
//打印商家优惠
printer.printText("商家优惠:${StringPriceFormat.transStringPriceToDecimalString(shopCoupon)}元")
}
if (couponDetail.size >= 3 && !TextUtils.isEmpty(couponDetail[2]) && couponDetail[2] != "0" && couponDetail[2] != "0.00") {
//平台优惠
val platformCoupon = couponDetail[2]
val channel = MiYaPayPlantformPayWayEnum.MiyaPayType.find(payServiceResponse.chanelTag).desc
printer.printText("$channel 优惠:${StringPriceFormat.transStringPriceToDecimalString(platformCoupon)}元")
}
if (couponDetail.isNotEmpty() && !TextUtils.isEmpty(couponDetail[0])) {
val payPrice = couponDetail[0]
printer.printText("客户支付:${StringPriceFormat.transStringPriceToDecimalString(payPrice)}元")
}
printer.printText("持卡人签名:")
printer.printText(Page58MmPrintUtils.printDivideLineString())
printer.printText("同意以上支付 ")
printer.printText("\n\n")
}
/**
* 打印顾客联
*/
private fun printCustomer(printer:IPrinter,payServiceResponse: PayServiceResponse,selfCashierAccountInfo: SelfCashierAccountInfo){
val shopInfo = selfCashierAccountInfo.shopInfo
printer.printText(IPrinter.ALIGN_CENTER,3, shopInfo.storeName,true)
printer.setAlign(IPrinter.ALIGN_LEFT)
printer.printText("持卡人存根")
printer.printText(Page58MmPrintUtils.printDivideLineString())
printer.printText("商户编号:${shopInfo.appId}")
printer.printText("商户编号:${shopInfo.saasid}")
printer.printText("终端编号:${shopInfo.posId}")
printer.printText("商户名称:converse")
printer.printText(Page58MmPrintUtils.printDivideLineString())
printer.printText("交易类型:${
MiYaPayPlantformPayWayEnum.MiyaPayType.find(payServiceResponse.chanelTag).desc}")
printer.printText("交易类型:")
printer.printText(IPrinter.ALIGN_LEFT,3, " ${ MiYaPayPlantformPayWayEnum.MiyaPayType.find(payServiceResponse.chanelTag).desc}",true)
printer.printText(Page58MmPrintUtils.printDivideLineString())
printer.printText("日期/时间:${com.miya.fastcashier.utils.DateUtils.format18(Date())}")
//todo 流水号
printer.printText("日期/时间:${DateUtils.format18(Date())}")
printer.printText("流水号:${getSerialNumber()}")
printer.printText("商户订单号:")
printer.printText(payServiceResponse.shopTradeNo)
printer.printText("支付平台交易号:")
printer.printText(payServiceResponse.chanelSerialNumber)
printer.printText("金额:RMB${StringPriceFormat.transStringPriceToDecimalString(payServiceResponse.tradPrice)}")
printer.printText("金额:")
printer.printText(IPrinter.ALIGN_LEFT,3," RMB${StringPriceFormat.transStringPriceToDecimalString(payServiceResponse.tradPrice)}",true)
printer.printText(Page58MmPrintUtils.printDivideLineString())
printer.printText("备注:")
......@@ -69,7 +157,131 @@ object PrintService{
val payPrice = couponDetail[0]
printer.printText("客户支付:${StringPriceFormat.transStringPriceToDecimalString(payPrice)}元")
}
printer.endPrint()
printer.printText("\n\n")
}
/**
* 打印收银员联 - 退款
*/
private fun refundPrintCashier(printer:IPrinter,payServiceResponse: PayServiceResponse,selfCashierAccountInfo: SelfCashierAccountInfo){
val shopInfo = selfCashierAccountInfo.shopInfo
printer.printText(IPrinter.ALIGN_CENTER,3, shopInfo.storeName,true)
printer.setAlign(IPrinter.ALIGN_LEFT)
printer.printText("商户编号:${shopInfo.saasid}")
printer.printText("终端编号:${shopInfo.posId}")
printer.printText("商户名称:converse")
printer.printText(Page58MmPrintUtils.printDivideLineString())
printer.printText("交易类型:")
printer.printText(IPrinter.ALIGN_LEFT,3, " 退款(${ MiYaPayPlantformPayWayEnum.MiyaPayType.find(payServiceResponse.chanelTag).desc})",true)
printer.printText(Page58MmPrintUtils.printDivideLineString())
printer.printText("日期/时间:${DateUtils.format18(Date())}")
printer.printText("流水号:${getSerialNoByOrderNo(payServiceResponse.shopTradeNo)}")
printer.printText("商户订单号:")
printer.printText(payServiceResponse.shopTradeNo)
printer.printText("支付平台交易号:")
printer.printText(payServiceResponse.chanelSerialNumber)
printer.printText("金额:")
printer.printText(IPrinter.ALIGN_LEFT,3," RMB${StringPriceFormat.transStringPriceToDecimalString(payServiceResponse.refundPrice)}",true)
printer.printText("原订单号:")
printer.printText(payServiceResponse.shopTradeNo)
printer.printText(Page58MmPrintUtils.printDivideLineString())
printer.printText("备注:")
val couponDetail: Array<String> = payServiceResponse.transformCouponMessage
if (couponDetail.size >= 2 && !TextUtils.isEmpty(couponDetail[1]) && couponDetail[1] != "0" && couponDetail[1] != "0.00") {
val shopCoupon = couponDetail[1]
//打印商家优惠
printer.printText("商家优惠:${StringPriceFormat.transStringPriceToDecimalString(shopCoupon)}元")
}
if (couponDetail.size >= 3 && !TextUtils.isEmpty(couponDetail[2]) && couponDetail[2] != "0" && couponDetail[2] != "0.00") {
//平台优惠
val platformCoupon = couponDetail[2]
val channel = MiYaPayPlantformPayWayEnum.MiyaPayType.find(payServiceResponse.chanelTag).desc
printer.printText("$channel 优惠:${StringPriceFormat.transStringPriceToDecimalString(platformCoupon)}元")
}
if (couponDetail.isNotEmpty() && !TextUtils.isEmpty(couponDetail[0])) {
val payPrice = couponDetail[0]
printer.printText("客户支付:${StringPriceFormat.transStringPriceToDecimalString(payPrice)}元")
}
printer.printText("持卡人签名:")
printer.printText(Page58MmPrintUtils.printDivideLineString())
printer.printText("同意以上支付 ")
printer.printText("\n\n")
}
/**
* 打印顾客联-退款
*/
private fun refundPrintCustomer(printer:IPrinter,payServiceResponse: PayServiceResponse,selfCashierAccountInfo: SelfCashierAccountInfo){
val shopInfo = selfCashierAccountInfo.shopInfo
printer.printText(IPrinter.ALIGN_CENTER,3, shopInfo.storeName,true)
printer.setAlign(IPrinter.ALIGN_LEFT)
printer.printText("持卡人存根")
printer.printText(Page58MmPrintUtils.printDivideLineString())
printer.printText("商户编号:${shopInfo.saasid}")
printer.printText("终端编号:${shopInfo.posId}")
printer.printText("商户名称:converse")
printer.printText(Page58MmPrintUtils.printDivideLineString())
printer.printText("交易类型:")
printer.printText(IPrinter.ALIGN_LEFT,3, " 退款(${ MiYaPayPlantformPayWayEnum.MiyaPayType.find(payServiceResponse.chanelTag).desc})",true)
printer.printText(Page58MmPrintUtils.printDivideLineString())
printer.printText("日期/时间:${DateUtils.format18(Date())}")
printer.printText("流水号:${getSerialNoByOrderNo(payServiceResponse.shopTradeNo)}")
printer.printText("商户订单号:")
printer.printText(payServiceResponse.refundOrderNo)
printer.printText("支付平台交易号:")
printer.printText(payServiceResponse.chanelSerialNumber)
printer.printText("金额:")
printer.printText(IPrinter.ALIGN_LEFT,3," RMB${StringPriceFormat.transStringPriceToDecimalString(payServiceResponse.refundPrice)}",true)
printer.printText("原订单号:")
printer.printText(payServiceResponse.shopTradeNo)
printer.printText(Page58MmPrintUtils.printDivideLineString())
printer.printText("备注:")
val couponDetail: Array<String> = payServiceResponse.transformCouponMessage
if (couponDetail.size >= 2 && !TextUtils.isEmpty(couponDetail[1]) && couponDetail[1] != "0" && couponDetail[1] != "0.00") {
val shopCoupon = couponDetail[1]
//打印商家优惠
printer.printText("商家优惠:${StringPriceFormat.transStringPriceToDecimalString(shopCoupon)}元")
}
if (couponDetail.size >= 3 && !TextUtils.isEmpty(couponDetail[2]) && couponDetail[2] != "0" && couponDetail[2] != "0.00") {
//平台优惠
val platformCoupon = couponDetail[2]
val channel = MiYaPayPlantformPayWayEnum.MiyaPayType.find(payServiceResponse.chanelTag).desc
printer.printText("$channel 优惠:${StringPriceFormat.transStringPriceToDecimalString(platformCoupon)}元")
}
if (couponDetail.isNotEmpty() && !TextUtils.isEmpty(couponDetail[0])) {
val payPrice = couponDetail[0]
printer.printText("客户支付:${StringPriceFormat.transStringPriceToDecimalString(payPrice)}元")
}
printer.printText("\n\n")
}
private fun getSerialNumber(): String {
val today = DateUtils.format8(Date())
val kv = MMKV.defaultMMKV()
val no = kv.getInt(today, 0).toString()
var listNo = no
for (index in 1..(5 - no.length)) {
listNo = "0$listNo"
}
return listNo;
}
/**
* 根据订单号获取流水号
* //todo 定期删除机制
*/
private fun getSerialNoByOrderNo(orderNo: String): String {
return MMKV.defaultMMKV().getString(orderNo, "00000").toString();
}
private fun setSerialNoByOrderNo(orderNo: String, serialNo: String) {
MMKV.defaultMMKV().putString(orderNo, serialNo);
}
}
\ No newline at end of file
package com.miya.fastcashier.ui
import android.annotation.SuppressLint
import android.content.Intent
import android.os.Build
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.Handler
import android.widget.Toast
import androidx.annotation.RequiresApi
import androidx.appcompat.content.res.AppCompatResources
import androidx.core.content.res.ResourcesCompat
import androidx.lifecycle.ViewModelProvider
import com.alibaba.fastjson.JSON
import com.blankj.utilcode.util.LogUtils
import com.blankj.utilcode.util.SizeUtils
import com.miya.fastcashier.R
import com.miya.fastcashier.R.mipmap.ic_alipay
import com.miya.fastcashier.R.mipmap.ic_wxpay
import com.miya.fastcashier.databinding.ActivityAliPayCodeBinding
import com.miya.fastcashier.databinding.ActivityPayCodeBinding
import com.miya.fastcashier.databinding.ActivityPriceInputBinding
import com.miya.fastcashier.ui.dialog.PayChooseDialog
import com.miya.fastcashier.utils.CenterToasty
import com.miya.fastcashier.utils.DateUtils
import com.miya.fastcashier.utils.StringPriceFormat
import com.miya.fastcashier.utils.clickWithTrigger
import com.miya.fastcashier.viewmodel.PayViewModel
import com.miya.print.utils.BitmapUtils
import com.sdy.miya.moblie.component.pay.platform.bean.PayServiceResponse
import com.tencent.mmkv.MMKV
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.runBlocking
import java.util.*
import kotlin.concurrent.timerTask
/***
* 支付宝付款码
*/
class AliPayCodeActivity : AppCompatActivity() {
private lateinit var viewModel: PayViewModel
private lateinit var binding: ActivityAliPayCodeBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityAliPayCodeBinding.inflate(layoutInflater)
setContentView(binding.root)
viewModel = ViewModelProvider(this).get(PayViewModel::class.java)
val ivPayCode = binding.ivPayCode
val tvBack = binding.tvBack
val ivBack = binding.ivBack
val tvPrice = binding.tvPrice
val kv = MMKV.defaultMMKV()
tvBack.clickWithTrigger { finish() }
ivBack.clickWithTrigger { finish() }
val extra = intent.getSerializableExtra("payServiceResponse")
extra?.let {
val payServiceResponse = it as PayServiceResponse
LogUtils.e(JSON.toJSONString(payServiceResponse))
tvPrice.text = "¥".plus(StringPriceFormat.transStringPriceToDecimalString( payServiceResponse.tradPrice))
runBlocking(Dispatchers.IO) {
val qrcode = BitmapUtils.createBarcodeBitmap(payServiceResponse.payQrCode, 9, 453, 453)
runOnUiThread {
ivPayCode.setImageBitmap(qrcode)
//支付结果查询
viewModel.payResultQuery(payServiceResponse)
}
}
}
viewModel.payResultLiveData.observe(this,{ result ->
result.getOrElse {
it.message?.let { it1 -> {
if(!it1.contains("交易不存在")){
CenterToasty.error(this, it1,Toast.LENGTH_LONG).show()
}
} }
return@observe
}
result.getOrNull().also {
it?.let { it1 ->
//自增流水
val today = DateUtils.format8(Date())
var no = kv.getInt(today,0);
kv.putInt(DateUtils.format8(Date()),++no)
val intent = Intent()
intent.setClass(this@AliPayCodeActivity, PayResultActivity::class.java)
intent.putExtra("payServiceResponse",it1)
startActivity(intent)
}
}
})
}
override fun onStop() {
super.onStop()
viewModel.payResultJob.cancel()
}
}
\ No newline at end of file
package com.miya.fastcashier.ui
import android.view.KeyEvent
import androidx.appcompat.app.AppCompatActivity
import dmax.dialog.SpotsDialog
open class BaseActivity : AppCompatActivity() {
private var dialog: android.app.AlertDialog? = null
fun showProgressDialog(message:String?){
message?.let {
if(null == dialog){
dialog = SpotsDialog.Builder()
.setContext(this)
.setCancelable(false)
.build()
}
dialog?.setMessage(it)
dialog?.show()
}
}
fun dismissProgressDialog(){
dialog?.dismiss()
}
override fun onStop() {
super.onStop()
dismissProgressDialog()
}
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
return keyCode == KeyEvent.KEYCODE_BACK
}
}
\ No newline at end of file
......@@ -13,7 +13,13 @@ import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import com.miya.fastcashier.databinding.ActivityLoginBinding
import com.miya.fastcashier.service.AccountService
import com.miya.fastcashier.utils.clickWithTrigger
import com.miya.fastcashier.utils.withTrigger
import com.miya.fastcashier.viewmodel.LoginViewModel
import com.tencent.mmkv.MMKV
class LoginActivity : AppCompatActivity() {
......@@ -22,7 +28,6 @@ class LoginActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityLoginBinding.inflate(layoutInflater)
setContentView(binding.root)
......@@ -32,6 +37,8 @@ class LoginActivity : AppCompatActivity() {
val login = binding.login
val tvErrInfo = binding.tvErrInfo
val kv = MMKV.defaultMMKV()
loginViewModel = ViewModelProvider(this)
.get(LoginViewModel::class.java)
......@@ -41,11 +48,17 @@ class LoginActivity : AppCompatActivity() {
result.getOrElse {
tvErrInfo.text = it.message
tvErrInfo.visibility = View.VISIBLE
return@observe
}
result.getOrNull().also {
it?.let { it1 ->
kv.encode("username",username.text.toString())
kv.encode("password",password.text.toString())
AccountService.setUserName(username.text.toString())
AccountService.setAccountInfo(it1)
val intent = Intent()
......@@ -87,31 +100,42 @@ class LoginActivity : AppCompatActivity() {
setOnEditorActionListener { _, actionId, _ ->
when (actionId) {
EditorInfo.IME_ACTION_DONE ->
EditorInfo.IME_ACTION_DONE ->{
loading.visibility = View.VISIBLE;
loginViewModel.login(
username.text.toString(),
password.text.toString()
)
}
}
false
}
binding.login.setOnClickListener {
binding.login.clickWithTrigger {
loading.visibility = View.VISIBLE
loginViewModel.login(username.text.toString(), password.text.toString())
}
}
kv.decodeString("username")?.let {
username.setText(it)
}
kv.decodeString("password")?.let {
password.setText(it)
}
if(!TextUtils.isEmpty(username.text)
&& !TextUtils.isEmpty(password.text)){
loading.visibility = View.VISIBLE;
loginViewModel.login(username.text.toString(), password.text.toString())
}
}
/**
* Extension function to simplify setting an afterTextChanged action to EditText components.
*/
fun EditText.afterTextChanged(afterTextChanged: (String) -> Unit) {
private fun EditText.afterTextChanged(afterTextChanged: (String) -> Unit) {
this.addTextChangedListener(object : TextWatcher {
override fun afterTextChanged(editable: Editable?) {
afterTextChanged.invoke(editable.toString())
......@@ -124,3 +148,4 @@ class LoginActivity : AppCompatActivity() {
}
}
......@@ -8,8 +8,13 @@ import androidx.lifecycle.ViewModelProvider
import com.miya.fastcashier.R
import com.miya.fastcashier.databinding.ActivityLoginBinding
import com.miya.fastcashier.databinding.ActivityMainBinding
import com.miya.fastcashier.service.AccountService
import com.miya.fastcashier.service.PrintService
import com.miya.fastcashier.utils.CenterToasty
import com.miya.fastcashier.utils.clickWithTrigger
import com.miya.fastcashier.viewmodel.MainViewModel
import com.tencent.mmkv.MMKV
import java.lang.Exception
class MainActivity : BaseActivity() {
......@@ -22,21 +27,45 @@ class MainActivity : BaseActivity() {
setContentView(binding.root)
viewModel = ViewModelProvider(this).get(MainViewModel::class.java)
val llPay = binding.llPay
val llRefund = binding.llRefund
val tvPrintLast = binding.tvPrintLast
val ivLoginOut = binding.ivLoginOut
val tvStoreName = binding.tvStoreName
val tvSlog = binding.tvSlog
tvStoreName.text = AccountService.getAccountInfo()?.shopInfo?.storeName
tvSlog.text = AccountService.getUserName()
llPay.setOnClickListener{
llPay.clickWithTrigger{
val intent = Intent()
intent.setClass(this@MainActivity, PriceInputActivity::class.java)
startActivity(intent)
}
llRefund.setOnClickListener{
CenterToasty.normal(this,"暂时不支持此功能",Toast.LENGTH_SHORT).show();
llRefund.clickWithTrigger{
val intent = Intent()
intent.setClass(this@MainActivity, RefundActivity::class.java)
startActivity(intent)
}
tvPrintLast.clickWithTrigger{
try {
PrintService.printLastOrderInfo()
}catch (e:Exception){
e.message?.let { it1 -> CenterToasty.error(this, it1,Toast.LENGTH_SHORT).show() };
}
}
tvPrintLast.setOnClickListener{
CenterToasty.normal(this,"暂时不支持此功能",Toast.LENGTH_SHORT).show();
ivLoginOut.clickWithTrigger{
MMKV.defaultMMKV().clearAll()
AccountService.setAccountInfo(null)
val intent = Intent()
intent.setClass(this@MainActivity, LoginActivity::class.java)
startActivity(intent)
finish()
}
......
package com.miya.fastcashier.ui
import android.annotation.SuppressLint
import android.content.Intent
import android.os.Build
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.Handler
import android.widget.Toast
import androidx.annotation.RequiresApi
import androidx.appcompat.content.res.AppCompatResources
import androidx.core.content.res.ResourcesCompat
import androidx.lifecycle.ViewModelProvider
import com.alibaba.fastjson.JSON
import com.blankj.utilcode.util.LogUtils
import com.blankj.utilcode.util.SizeUtils
import com.miya.fastcashier.R
import com.miya.fastcashier.R.mipmap.ic_alipay
import com.miya.fastcashier.R.mipmap.ic_wxpay
import com.miya.fastcashier.databinding.ActivityPayCodeBinding
import com.miya.fastcashier.databinding.ActivityPriceInputBinding
import com.miya.fastcashier.ui.dialog.PayChooseDialog
import com.miya.fastcashier.utils.CenterToasty
import com.miya.fastcashier.utils.StringPriceFormat
import com.miya.fastcashier.utils.clickWithTrigger
import com.miya.fastcashier.viewmodel.PayViewModel
import com.miya.print.utils.BitmapUtils
import com.sdy.miya.moblie.component.pay.platform.bean.PayServiceResponse
......@@ -36,16 +45,34 @@ class PayCodeActivity : AppCompatActivity() {
val ivPayCode = binding.ivPayCode
val tvBack = binding.tvBack
val ivBack = binding.ivBack
val loading = binding.loading
val tvPrice = binding.tvPrice
val tvPayGuide = binding.tvPayGuide
val cPayCodeBg = binding.cPayCodeBg
tvBack.clickWithTrigger { finish() }
ivBack.clickWithTrigger { finish() }
val extra = intent.getSerializableExtra("payServiceResponse")
extra?.let {
val payServiceResponse = it as PayServiceResponse
LogUtils.e(JSON.toJSONString(payServiceResponse))
tvPrice.text = "¥".plus(StringPriceFormat.transStringPriceToDecimalString( payServiceResponse.tradPrice))
if(payServiceResponse.chanelTag == "1"){
//初始化微信皮肤
setTheme(R.style.Theme_MiYaFastCashier_Green)
tvPayGuide.text = "微信扫描二维码 向我付款";
tvPayGuide.setCompoundDrawables(AppCompatResources.getDrawable(this, ic_wxpay) ,null,null,null);
cPayCodeBg.setBackgroundResource(R.color.green)
}else{
//初始化支付宝皮肤
setTheme(R.style.Theme_MiYaFastCashier_Blue)
tvPayGuide.setCompoundDrawables(AppCompatResources.getDrawable(this, ic_alipay) ,null,null,null);
tvPayGuide.text = "支付宝扫描二维码 向我付款";
cPayCodeBg.setBackgroundResource(R.color.blue)
}
runBlocking(Dispatchers.IO) {
val qrcode = BitmapUtils.createBarcodeBitmap(payServiceResponse.payQrCode, 9, 303, 303)
val qrcode = BitmapUtils.createBarcodeBitmap(payServiceResponse.payQrCode, 9, 403, 403)
runOnUiThread {
ivPayCode.setImageBitmap(qrcode)
//支付结果查询
......
......@@ -10,6 +10,7 @@ import com.miya.fastcashier.databinding.ActivityPayResultBinding
import com.miya.fastcashier.utils.CenterToasty
import com.miya.fastcashier.utils.MiYaPayPlantformPayWayEnum
import com.miya.fastcashier.utils.StringPriceFormat
import com.miya.fastcashier.utils.clickWithTrigger
import com.miya.fastcashier.viewmodel.PrintViewModel
import com.sdy.miya.moblie.component.pay.platform.bean.PayServiceResponse
......@@ -65,12 +66,12 @@ class PayResultActivity : AppCompatActivity() {
}
})
tvRePrint.setOnClickListener {
tvRePrint.clickWithTrigger {
tvStatus.text = "小票打印中,请稍等…"
viewModel.printOrder(extra as PayServiceResponse)
}
tvGoHome.setOnClickListener {
tvGoHome.clickWithTrigger {
val intent = Intent()
intent.setClass(this@PayResultActivity, MainActivity::class.java)
startActivity(intent)
......
......@@ -3,15 +3,16 @@ package com.miya.fastcashier.ui
import android.content.Intent
import android.os.Bundle
import android.text.TextUtils
import android.view.View
import android.widget.Toast
import androidx.lifecycle.ViewModelProvider
import com.alibaba.fastjson.JSON
import com.miya.fastcashier.databinding.ActivityPriceInputBinding
import com.miya.fastcashier.ui.dialog.PayChooseDialog
import com.miya.fastcashier.ui.dialog.PayChooseDialog.GeneratePayCodeClickListener
import com.miya.fastcashier.utils.CenterToasty
import com.miya.fastcashier.utils.clickWithTrigger
import com.miya.fastcashier.viewmodel.PayViewModel
import com.miya.fastcashier.widget.NumKeyboard.DELETE
import com.miya.fastcashier.widget.NumKeyboard.DOT
import com.miya.fastcashier.widget.DecimalKeyboard.DELETE
import com.miya.fastcashier.widget.DecimalKeyboard.DOT
import java.math.BigDecimal
......@@ -19,6 +20,9 @@ class PriceInputActivity : BaseActivity() {
private lateinit var viewModel: PayViewModel
private lateinit var binding: ActivityPriceInputBinding
private var payChooseDialog: PayChooseDialog? = null;
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
......@@ -31,20 +35,30 @@ class PriceInputActivity : BaseActivity() {
val tvBack = binding.tvBack
val ivBack = binding.ivBack
val etPrice = binding.etPrice
val loading = binding.loading
// val loading = binding.loading
val numKeyboard = binding.numKeyboard
tvScanPayCode.setOnClickListener{
CenterToasty.normal(this,"暂时不支持此功能", Toast.LENGTH_SHORT).show();
tvScanPayCode.clickWithTrigger {
CenterToasty.normal(this, "暂时不支持此功能", Toast.LENGTH_SHORT).show();
}
tvGeneratePayCode.setOnClickListener{
loading.visibility = View.VISIBLE
viewModel.generatePayCode(etPrice.text.toString(),"1")
tvGeneratePayCode.clickWithTrigger {
if (null == payChooseDialog) {
payChooseDialog = PayChooseDialog(this)
payChooseDialog!!.setGeneratePayCodeClickListener(object :
GeneratePayCodeClickListener {
override fun choose(payType: String) {
showProgressDialog("生成付款码")
// loading.visibility = View.VISIBLE
viewModel.generatePayCode(etPrice.text.toString(),payType)
}
})
}
payChooseDialog!!.show()
}
tvBack.setOnClickListener{ finish() }
ivBack.setOnClickListener{ finish() }
tvBack.clickWithTrigger { finish() }
ivBack.clickWithTrigger { finish() }
numKeyboard.setKeyboardClickListener {
when (it) {
......@@ -66,29 +80,30 @@ class PriceInputActivity : BaseActivity() {
currentCode += "."
etPrice.setText(currentCode)
} else {
CenterToasty.error(this,"金额格式有误!",Toast.LENGTH_LONG).show()
CenterToasty.error(this, "金额格式有误!", Toast.LENGTH_LONG).show()
}
}
else -> {
var currentCode: String = etPrice.text.toString()
if (currentCode.contains(".")) {
val tmp = currentCode.substring(currentCode.indexOf("."), currentCode.length - 1)
val tmp =
currentCode.substring(currentCode.indexOf("."), currentCode.length - 1)
if (tmp.length < 2) {
if (BigDecimal(currentCode + it).compareTo(BigDecimal.ZERO) == 0 && tmp.length == 1) {
CenterToasty.error(this,"金额不能为0!",Toast.LENGTH_LONG).show()
CenterToasty.error(this, "金额不能为0!", Toast.LENGTH_LONG).show()
} else {
currentCode += it
etPrice.setText(currentCode)
}
} else {
CenterToasty.error(this,"金额最多设置2位小数!",Toast.LENGTH_LONG).show()
CenterToasty.error(this, "金额最多设置2位小数!", Toast.LENGTH_LONG).show()
}
} else {
if (currentCode.startsWith("0") && currentCode.length == 1 && it == 0) {
CenterToasty.error(this,"第二位不能输入0!",Toast.LENGTH_LONG).show()
CenterToasty.error(this, "第二位不能输入0!", Toast.LENGTH_LONG).show()
} else {
if (BigDecimal(currentCode + it).compareTo(BigDecimal("99999")) == 1) {
CenterToasty.error(this,"金额不能超过99999!",Toast.LENGTH_LONG).show()
CenterToasty.error(this, "金额不能超过99999!", Toast.LENGTH_LONG).show()
} else {
currentCode += it
etPrice.setText(currentCode)
......@@ -99,26 +114,32 @@ class PriceInputActivity : BaseActivity() {
}
}
viewModel.payServiceResponseLiveData.observe(this,{ result ->
loading.visibility = View.GONE
viewModel.payServiceResponseLiveData.observe(this, { result ->
dismissProgressDialog()
// loading.visibility = View.GONE
result.getOrElse {
it.message?.let { it1 -> CenterToasty.error(this, it1,Toast.LENGTH_LONG).show() }
it.message?.let { it1 -> CenterToasty.error(this, it1, Toast.LENGTH_LONG).show() }
return@observe
}
result.getOrNull().also {
it?.let { it1 ->
val intent = Intent()
intent.setClass(this@PriceInputActivity, PayCodeActivity::class.java)
intent.putExtra("payServiceResponse",it1)
if ("1" == it1.chanelTag){
intent.setClass(this@PriceInputActivity, WxPayCodeActivity::class.java)
}else{
intent.setClass(this@PriceInputActivity, AliPayCodeActivity::class.java)
}
intent.putExtra("payServiceResponse", it1)
startActivity(intent)
}
}
})
}
override fun onStop() {
super.onStop()
payChooseDialog?.dismiss()
}
}
\ No newline at end of file
package com.miya.fastcashier.ui
import android.os.Bundle
import android.view.KeyEvent
import android.widget.Toast
import androidx.lifecycle.ViewModelProvider
import com.miya.fastcashier.databinding.ActivityRefundBinding
import com.miya.fastcashier.ui.dialog.MessageDialog
import com.miya.fastcashier.ui.dialog.NumberManualDialog
import com.miya.fastcashier.ui.dialog.NumberManualDialog.NumberInputListener
import com.miya.fastcashier.ui.dialog.RefundInfoDialog
import com.miya.fastcashier.utils.CenterToasty
import com.miya.fastcashier.utils.ScanGunKeyEventHelper
import com.miya.fastcashier.utils.clickWithTrigger
import com.miya.fastcashier.viewmodel.PayViewModel
import com.sdy.miya.moblie.component.pay.platform.bean.PayServiceResponse
class RefundActivity : BaseActivity() {
private var alertDialog: MessageDialog? = null
private lateinit var viewModel: PayViewModel
private lateinit var binding: ActivityRefundBinding
private var refundInfoDialog: RefundInfoDialog? = null
private var numberManualDialog: NumberManualDialog? = null
private var scanGunKeyEventHelper: ScanGunKeyEventHelper = ScanGunKeyEventHelper()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityRefundBinding.inflate(layoutInflater)
setContentView(binding.root)
viewModel = ViewModelProvider(this).get(PayViewModel::class.java)
viewModel.payResultLiveData.observe(this, { payResult ->
payResult.onFailure {
dismissProgressDialog()
it.message?.let { it1 -> CenterToasty.error(this, it1,Toast.LENGTH_LONG).show() }
}
payResult.onSuccess { payServiceResponse ->
dismissProgressDialog()
//金额确认弹窗
if(null == refundInfoDialog){
refundInfoDialog = RefundInfoDialog(this)
}
refundInfoDialog?.setData(payServiceResponse) {
doubleRefundConfirm(it)
};
refundInfoDialog?.show()
}
})
viewModel.refundLiveData.observe(this, { payResult ->
payResult.onFailure {
dismissProgressDialog()
it.message?.let { it1 -> CenterToasty.error(this, it1,Toast.LENGTH_LONG).show() }
}
payResult.onSuccess {
dismissProgressDialog()
CenterToasty.success(this,"退款成功!!",Toast.LENGTH_LONG).show()
finish()
}
})
val tvBack = binding.tvBack
val ivBack = binding.ivBack
tvBack.clickWithTrigger { finish() }
ivBack.clickWithTrigger { finish() }
val ivRefundManualInput = binding.ivRefundManualInput
ivRefundManualInput.clickWithTrigger {
if (numberManualDialog == null) {
numberManualDialog = NumberManualDialog(this);
numberManualDialog!!.setNumberInputListener(object :
NumberInputListener {
override fun numberInput(number: String) {
showProgressDialog("正在为您退款..")
viewModel.payResultQuery(number)
}
})
}
numberManualDialog!!.show()
}
scanGunKeyEventHelper.setOnBarCodeCatchListener {
showProgressDialog("正在为您退款..")
viewModel.payResultQuery(it)
}
}
/**
* 二次退款确认
*/
private fun doubleRefundConfirm(payServiceResponse: PayServiceResponse) {
if (null == alertDialog) {
alertDialog = MessageDialog(this)
.setCustomMessage("是否确认退款")
.setPositiveButton("确认退款"
) { _, _ ->
run {
showProgressDialog("退款中")
viewModel.refund(payServiceResponse)
}
}
}
alertDialog?.show()
}
override fun dispatchKeyEvent(event: KeyEvent?): Boolean {
scanGunKeyEventHelper.analysisKeyEvent(event)
return super.dispatchKeyEvent(event)
}
override fun onStop() {
super.onStop()
refundInfoDialog?.dismiss()
}
}
\ No newline at end of file
package com.miya.fastcashier.ui
import android.annotation.SuppressLint
import android.content.Intent
import android.os.Build
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.Handler
import android.widget.Toast
import androidx.annotation.RequiresApi
import androidx.appcompat.content.res.AppCompatResources
import androidx.core.content.res.ResourcesCompat
import androidx.lifecycle.ViewModelProvider
import com.alibaba.fastjson.JSON
import com.blankj.utilcode.util.LogUtils
import com.blankj.utilcode.util.SizeUtils
import com.miya.fastcashier.R
import com.miya.fastcashier.R.mipmap.ic_alipay
import com.miya.fastcashier.R.mipmap.ic_wxpay
import com.miya.fastcashier.databinding.ActivityPayCodeBinding
import com.miya.fastcashier.databinding.ActivityPriceInputBinding
import com.miya.fastcashier.databinding.ActivityWxPayCodeBinding
import com.miya.fastcashier.ui.dialog.PayChooseDialog
import com.miya.fastcashier.utils.CenterToasty
import com.miya.fastcashier.utils.DateUtils
import com.miya.fastcashier.utils.StringPriceFormat
import com.miya.fastcashier.utils.clickWithTrigger
import com.miya.fastcashier.viewmodel.PayViewModel
import com.miya.print.utils.BitmapUtils
import com.sdy.miya.moblie.component.pay.platform.bean.PayServiceResponse
import com.tencent.mmkv.MMKV
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.runBlocking
import java.util.*
import kotlin.concurrent.timerTask
/**
* 微信付款码
*/
class WxPayCodeActivity : AppCompatActivity() {
private lateinit var viewModel: PayViewModel
private lateinit var binding: ActivityWxPayCodeBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityWxPayCodeBinding.inflate(layoutInflater)
setContentView(binding.root)
viewModel = ViewModelProvider(this).get(PayViewModel::class.java)
val ivPayCode = binding.ivPayCode
val tvBack = binding.tvBack
val ivBack = binding.ivBack
val tvPrice = binding.tvPrice
val kv = MMKV.defaultMMKV()
tvBack.clickWithTrigger { finish() }
ivBack.clickWithTrigger { finish() }
val extra = intent.getSerializableExtra("payServiceResponse")
extra?.let {
val payServiceResponse = it as PayServiceResponse
LogUtils.e(JSON.toJSONString(payServiceResponse))
tvPrice.text = "¥".plus(StringPriceFormat.transStringPriceToDecimalString( payServiceResponse.tradPrice))
runBlocking(Dispatchers.IO) {
val qrcode = BitmapUtils.createBarcodeBitmap(payServiceResponse.payQrCode, 9, 453, 453)
runOnUiThread {
ivPayCode.setImageBitmap(qrcode)
//支付结果查询
viewModel.payResultQuery(payServiceResponse)
}
}
}
viewModel.payResultLiveData.observe(this,{ result ->
result.getOrElse {
it.message?.let { it1 -> {
if(!it1.contains("未付款")){
CenterToasty.error(this, it1,Toast.LENGTH_LONG).show()
}
} }
return@observe
}
result.getOrNull().also {
it?.let { it1 ->
//自增流水
val today = DateUtils.format8(Date())
var no = kv.getInt(today,0);
kv.putInt(DateUtils.format8(Date()),++no)
val intent = Intent()
intent.setClass(this@WxPayCodeActivity, PayResultActivity::class.java)
intent.putExtra("payServiceResponse",it1)
startActivity(intent)
}
}
})
}
override fun onStop() {
super.onStop()
viewModel.payResultJob.cancel()
}
}
\ No newline at end of file
package com.miya.fastcashier.ui.dialog
import android.app.AlertDialog
import android.app.Dialog
import android.content.Context
import android.content.DialogInterface
import android.view.Gravity
import android.view.WindowManager
import android.widget.TextView
import com.miya.fastcashier.R
import com.miya.fastcashier.utils.clickWithTrigger
class MessageDialog(context: Context) : Dialog(context){
private lateinit var tvMessage: TextView
private lateinit var tvNegative: TextView
private lateinit var tvPositive: TextView
private lateinit var mPositiveButtonListener:DialogInterface.OnClickListener
private lateinit var mNegativeButtonListener:DialogInterface.OnClickListener
private lateinit var mPositiveButtonText:CharSequence
private lateinit var mNegativeButtonText:CharSequence
init {
initWindow()
initView()
}
private fun initView() {
setContentView(R.layout.dialog_message)
tvMessage = findViewById(R.id.tvMessage)
tvNegative = findViewById(R.id.tvNegative)
tvPositive = findViewById(R.id.tvPositive)
tvNegative.clickWithTrigger {
dismiss()
}
tvPositive.clickWithTrigger {
dismiss()
mPositiveButtonListener.onClick(null,1)
}
}
override fun setContentView(layoutResID: Int) {
super.setContentView(R.layout.dialog_message)
tvMessage = findViewById(R.id.tvMessage)
tvNegative = findViewById(R.id.tvNegative)
tvPositive = findViewById(R.id.tvPositive)
}
fun setPositiveButton(text: CharSequence, listener: DialogInterface.OnClickListener): MessageDialog {
this.mPositiveButtonText = text
this.mPositiveButtonListener = listener
return this
}
fun setNegativeButton(text: CharSequence, listener: DialogInterface.OnClickListener): MessageDialog {
this.mNegativeButtonText = text
this.mNegativeButtonListener = listener
return this
}
fun setCustomMessage(message: CharSequence?) : MessageDialog{
tvMessage.text = message
return this
}
private fun initWindow() {
val win = this.window
win!!.decorView.setPadding(0, 0, 0, 0)
val lp = win.attributes
lp.width = WindowManager.LayoutParams.MATCH_PARENT
lp.height = WindowManager.LayoutParams.WRAP_CONTENT
lp.gravity = Gravity.CENTER
lp.windowAnimations = R.style.AlphaInAndOutStyle
win.attributes = lp
win.setBackgroundDrawableResource(R.color.transparent)
}
}
\ No newline at end of file
package com.miya.fastcashier.ui.dialog
import android.app.Dialog
import android.content.Context
import android.text.TextUtils
import android.view.Gravity
import android.view.View
import android.view.WindowManager
import android.widget.Button
import android.widget.ImageView
import android.widget.TextView
import android.widget.Toast
import com.miya.fastcashier.R
import com.miya.fastcashier.utils.CenterToasty
import com.miya.fastcashier.utils.StringPriceFormat
import com.miya.fastcashier.widget.DecimalKeyboard
import com.miya.fastcashier.widget.NumKeyboard
import com.rengwuxian.materialedittext.MaterialEditText
import com.sdy.miya.moblie.component.pay.platform.bean.PayServiceResponse
import java.math.BigDecimal
/**
* 手动输入数字
*/
class NumberManualDialog(context: Context, ) : Dialog(context) {
private lateinit var ivClose: ImageView
private lateinit var etNumber: MaterialEditText
private lateinit var tvErrInfo: TextView
private lateinit var numKeyboard: NumKeyboard
private lateinit var numInputFinish: Button
private lateinit var numberInputListener: NumberInputListener
init {
initWindow()
initConfig()
initView()
}
private fun initConfig() {
setCancelable(false)
}
private fun initView() {
setContentView(R.layout.dialog_number_input)
ivClose = findViewById(R.id.ivClose)
ivClose.setOnClickListener {
dismiss()
}
etNumber = findViewById(R.id.etNumber)
tvErrInfo = findViewById(R.id.tvErrInfo)
numKeyboard = findViewById(R.id.numKeyboard)
numInputFinish = numKeyboard.okButton
numKeyboard.setKeyboardClickListener {
when (it) {
NumKeyboard.DELETE -> {
if (TextUtils.isEmpty(etNumber.text.toString())) {
return@setKeyboardClickListener
}
var currentCode: String = etNumber.text.toString()
currentCode = if (currentCode.length <= 1) {
""
} else {
currentCode.substring(0, currentCode.length - 1)
}
etNumber.setText(currentCode)
numInputFinish.isEnabled = !TextUtils.isEmpty(currentCode)
}
NumKeyboard.SURE -> {
val currentCode: String = etNumber.text.toString()
if (!TextUtils.isEmpty(currentCode)) {
dismiss()
tvErrInfo.visibility = View.GONE
etNumber.setText(currentCode)
numberInputListener.numberInput(currentCode)
} else {
tvErrInfo.visibility = View.VISIBLE
tvErrInfo.text = "内容为空"
}
}
else -> {
tvErrInfo.visibility = View.GONE
var currentCode: String = etNumber.text.toString()
if(TextUtils.isEmpty(currentCode)){
etNumber.setText(it.toString())
}else{
currentCode += it
etNumber.setText(currentCode)
}
numInputFinish.isEnabled = !TextUtils.isEmpty(currentCode)
}
}
}
}
fun setNumberInputListener(numberInputListener: NumberInputListener){
this.numberInputListener = numberInputListener
}
private fun initWindow() {
val win = this.window
win!!.decorView.setPadding(0, 0, 0, 0)
val lp = win.attributes
lp.width = WindowManager.LayoutParams.MATCH_PARENT
lp.height = WindowManager.LayoutParams.MATCH_PARENT
lp.gravity = Gravity.BOTTOM
lp.windowAnimations = R.style.BottomInAndOutStyle
win.attributes = lp
win.setBackgroundDrawableResource(R.color.transparent)
}
interface NumberInputListener {
fun numberInput(number:String);
}
}
\ No newline at end of file
package com.miya.fastcashier.ui.dialog
import android.app.Dialog
import android.content.Context
import android.view.Gravity
import android.view.WindowManager
import android.widget.ImageButton
import android.widget.ImageView
import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout
import com.miya.fastcashier.R
import com.miya.fastcashier.utils.clickWithTrigger
class PayChooseDialog(context: Context) : Dialog(context){
private lateinit var tvGeneratePayCode: TextView
private lateinit var cWxPay: ConstraintLayout
private lateinit var cAliPay: ConstraintLayout
private lateinit var ivClose: ImageView
private lateinit var ivWxPayChoose: ImageButton
private lateinit var ibAliPayChoose: ImageButton
private lateinit var generatePayCodeClickListener: GeneratePayCodeClickListener
private var payType: String = "2"
init {
initWindow()
initConfig()
initView()
}
private fun initConfig() {
setCancelable(true)
}
private fun initView() {
setContentView(R.layout.dialog_pay_choose)
ivClose = findViewById(R.id.ivClose)
cWxPay = findViewById(R.id.cWxPay)
cAliPay = findViewById(R.id.cAliPay)
ivWxPayChoose = findViewById(R.id.ivWxPayChoose)
ivWxPayChoose.isSelected = true
ibAliPayChoose = findViewById(R.id.ibAliPayChoose)
ibAliPayChoose.isSelected = false
tvGeneratePayCode = findViewById(R.id.tvGeneratePayCode)
ivClose.clickWithTrigger{
dismiss()
}
// 2是微信 1是支付宝
cWxPay.setOnClickListener{
payType = "2"
ivWxPayChoose.isSelected = true
ibAliPayChoose.isSelected = false
}
cAliPay.setOnClickListener{
payType = "1"
ivWxPayChoose.isSelected = false
ibAliPayChoose.isSelected = true
}
tvGeneratePayCode.setOnClickListener {
generatePayCodeClickListener.choose(payType)
}
}
/**
* 生成付款码
*/
fun setGeneratePayCodeClickListener(generatePayCodeClickListener: GeneratePayCodeClickListener){
this.generatePayCodeClickListener = generatePayCodeClickListener
}
interface GeneratePayCodeClickListener {
fun choose(payType:String);
}
private fun initWindow() {
val win = this.window
win!!.decorView.setPadding(0, 0, 0, 0)
val lp = win.attributes
lp.width = WindowManager.LayoutParams.MATCH_PARENT
lp.height = WindowManager.LayoutParams.WRAP_CONTENT
lp.gravity = Gravity.BOTTOM
lp.windowAnimations = R.style.BottomInAndOutStyle
win.attributes = lp
win.setBackgroundDrawableResource(R.color.transparent)
}
}
\ No newline at end of file
package com.miya.fastcashier.ui.dialog
import android.app.AlertDialog
import android.app.Dialog
import android.content.Context
import android.view.Gravity
import android.view.WindowManager
import android.widget.ImageButton
import android.widget.ImageView
import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout
import com.miya.fastcashier.R
import com.miya.fastcashier.utils.StringPriceFormat
import com.miya.fastcashier.utils.clickWithTrigger
import com.sdy.miya.moblie.component.pay.platform.bean.PayServiceResponse
/**
* 退款信息弹窗
*/
class RefundInfoDialog(context: Context) : Dialog(context) {
private lateinit var ivClose: ImageView
private lateinit var tvRefund: TextView
private lateinit var tvPrice: TextView
private lateinit var payServiceResponse: PayServiceResponse
init {
initWindow()
initConfig()
initView()
}
private fun initConfig() {
setCancelable(false)
}
private fun initView() {
setContentView(R.layout.dialog_refund_info)
ivClose = findViewById(R.id.ivClose)
ivClose.clickWithTrigger {
dismiss()
}
tvRefund = findViewById(R.id.tvRefund)
tvPrice = findViewById(R.id.tvPrice)
}
fun setData(payServiceResponse: PayServiceResponse, action: (PayServiceResponse) -> Unit) {
this.payServiceResponse = payServiceResponse
tvPrice.text =
"¥${StringPriceFormat.transStringPriceToDecimalString(payServiceResponse.tradPrice)}"
tvRefund.clickWithTrigger {
action.invoke(payServiceResponse)
}
}
private fun initWindow() {
val win = this.window
win!!.decorView.setPadding(0, 0, 0, 0)
val lp = win.attributes
lp.width = WindowManager.LayoutParams.MATCH_PARENT
lp.height = WindowManager.LayoutParams.WRAP_CONTENT
lp.gravity = Gravity.BOTTOM
lp.windowAnimations = R.style.BottomInAndOutStyle
win.attributes = lp
win.setBackgroundDrawableResource(R.color.transparent)
}
}
\ No newline at end of file
package com.miya.fastcashier.utils
import android.view.View
/***
* 设置延迟时间的View扩展
* @param delay Long 延迟时间,默认600毫秒
* @return T
*/
fun <T : View> T.withTrigger(delay: Long = 600): T {
triggerDelay = delay
return this
}
/***
* 点击事件的View扩展
* @param block: (T) -> Unit 函数
* @return Unit
*/
fun <T : View> T.click(block: (T) -> Unit) = setOnClickListener {
block(it as T)
}
/***
* 带延迟过滤的点击事件View扩展
* @param delay Long 延迟时间,默认600毫秒
* @param block: (T) -> Unit 函数
* @return Unit
*/
fun <T : View> T.clickWithTrigger(time: Long = 600, block: (T) -> Unit){
triggerDelay = time
setOnClickListener {
if (clickEnable()) {
block(it as T)
}
}
}
private var <T : View> T.triggerLastTime: Long
get() = if (getTag(1123460103) != null) getTag(1123460103) as Long else -601
set(value) {
setTag(1123460103, value)
}
private var <T : View> T.triggerDelay: Long
get() = if (getTag(1123461123) != null) getTag(1123461123) as Long else 600
set(value) {
setTag(1123461123, value)
}
private fun <T : View> T.clickEnable(): Boolean {
var flag = false
val currentClickTime = System.currentTimeMillis()
if (currentClickTime - triggerLastTime >= triggerDelay) {
flag = true
triggerLastTime = currentClickTime
}
return flag
}
/***
* 带延迟过滤的点击事件监听,见[View.OnClickListener]
* 延迟时间根据triggerDelay获取:600毫秒,不能动态设置
*/
interface OnLazyClickListener : View.OnClickListener {
override fun onClick(v: View?) {
if (v?.clickEnable() == true) {
onLazyClick(v)
}
}
fun onLazyClick(v: View)
}
\ No newline at end of file
......@@ -43,7 +43,7 @@ class LoginViewModel : ViewModel() {
fun loginDataChanged(username: String, password: String) {
if (!isUserNameValid(username)) {
_loginForm.value = LoginFormState(usernameError = R.string.invalid_username)
_loginForm.value = LoginFormState(usernameError = R.string.username_not_empty)
} else if (!isPasswordValid(password)) {
_loginForm.value = LoginFormState(passwordError = R.string.invalid_password)
} else {
......@@ -52,11 +52,7 @@ class LoginViewModel : ViewModel() {
}
private fun isUserNameValid(username: String): Boolean {
return if (username.contains('@')) {
Patterns.EMAIL_ADDRESS.matcher(username).matches()
} else {
username.isNotBlank()
}
return username.isNotBlank()
}
private fun isPasswordValid(password: String): Boolean {
......
......@@ -4,6 +4,7 @@ import android.text.TextUtils
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.alibaba.fastjson.JSON
import com.blankj.utilcode.util.LogUtils
import com.blankj.utilcode.util.NumberUtils
import com.miya.fastcashier.beans.LoginRequest
......@@ -24,59 +25,73 @@ class PayViewModel : ViewModel() {
lateinit var payResultJob: Job
val refundLiveData: MutableLiveData<Result<PayRepository>> = MutableLiveData()
val refundLiveData: MutableLiveData<Result<PayServiceResponse>> = MutableLiveData()
val payServiceResponseLiveData: MutableLiveData<Result<PayServiceResponse>> = MutableLiveData()
val payResultLiveData: MutableLiveData<Result<PayServiceResponse>> = MutableLiveData()
fun refund(payServiceResponse: PayServiceResponse) {
viewModelScope.launch(Dispatchers.IO) {
//退款
var refundPayServiceResponse: PayServiceResponse? = null
try {
val refundParams = HashMap<String, String>()
refundParams["oriOrderNo"] = payServiceResponse.shopTradeNo;
val refundOrderNo = AccountService.getAccountInfo()?.shopInfo?.saasid + System.currentTimeMillis()
refundParams["refundOrderNo"] = refundOrderNo;
refundParams["refundPrice"] = payServiceResponse.tradPrice;
refundPayServiceResponse = PayRepository.refundByOrderNo(refundParams)
refundLiveData.postValue(Result.success(refundPayServiceResponse))
} catch (e: Exception) {
refundLiveData.postValue(Result.failure(e))
}
/**
* oriOrderNo 原订单号
* refundOrderNo 退款订单号
* refundPrice 退款金额
*/
fun refund(oriOrderNo: String, refundOrderNo: String, refundPrice: String) = runBlocking {
val refundParams = HashMap<String, String>()
refundParams["oriOrderNo"] = oriOrderNo;
refundParams["refundOrderNo"] = refundOrderNo;
refundParams["refundPrice"] = refundPrice;
val refundResult = async(Dispatchers.IO) {
PayRepository.refundByOrderNo(refundParams)
}
refundResult.await()
//退款打印
try {
AccountService.getAccountInfo()
?.let { refundPayServiceResponse?.let { it1 ->
PrintService.refundPrint(it,
it1
)
} }
}catch (e: Exception){
refundLiveData.postValue(Result.failure(e))
}
val printResult = async(Dispatchers.IO) {
AccountService.getAccountInfo()
?.let { PrintService.refundPrint(it, refundResult.await()) }
}
printResult.await()
// refundLiveData.value = Result.success()
}
/**
* payType 只支持微信或者支付宝
* 2是微信 1是支付宝
*
* price 目前是元 转成分
* price 传进来要是分,整数
*/
fun generatePayCode(price: String,payType: String){
if(TextUtils.isEmpty(price)){
fun generatePayCode(price: String, payType: String) {
if (TextUtils.isEmpty(price)) {
payServiceResponseLiveData.value = Result.failure(ParamInvalidException("请输入金额!"))
return
}
//todo 检查小数字是否合法
val orderNo = System.currentTimeMillis()
viewModelScope.launch(Dispatchers.IO){
val priceFen: String
try {
priceFen = price.toDouble().times(100).toInt().toString()
} catch (e: java.lang.Exception) {
payServiceResponseLiveData.value = Result.failure(ParamInvalidException("金额有误!"))
return
}
val sassid = AccountService.getAccountInfo()?.shopInfo?.saasid
// val storeId = AccountService.getAccountInfo()?.shopInfo?.storeId
val orderNo = sassid + System.currentTimeMillis()
viewModelScope.launch(Dispatchers.IO) {
try {
val payServiceResponse = PayRepository.generatePayCode(orderNo.toString(),"1","1")
val payServiceResponse = PayRepository.generatePayCode(orderNo, priceFen, payType)
LogUtils.e("生成付款码:${JSON.toJSONString(payServiceResponse)}")
payServiceResponseLiveData.postValue(Result.success(payServiceResponse))
}catch (e:Exception){
} catch (e: Exception) {
payServiceResponseLiveData.postValue(Result.failure(e))
}
}
......@@ -86,23 +101,39 @@ class PayViewModel : ViewModel() {
/**
* 订单查询
*/
fun payResultQuery(payServiceResponse: PayServiceResponse){
payResultJob = viewModelScope.launch(Dispatchers.IO){
while (isActive){
try {
LogUtils.e("订单查询!!")
val payServiceResponseResult = PayRepository.payResultQuery(payServiceResponse.shopTradeNo)
payResultLiveData.postValue(Result.success(payServiceResponseResult))
break
}catch (e:Exception){
payResultLiveData.postValue(Result.failure(e))
Thread.sleep(3000)
}
fun payResultQuery(payServiceResponse: PayServiceResponse) {
payResultJob = viewModelScope.launch(Dispatchers.IO) {
while (isActive) {
try {
LogUtils.e("支付查询订单号:${payServiceResponse.shopTradeNo}")
val payServiceResponseResult = PayRepository.payResultQuery(payServiceResponse.shopTradeNo)
LogUtils.e("支付查询结果:${JSON.toJSONString(payServiceResponseResult)}")
payResultLiveData.postValue(Result.success(payServiceResponseResult))
break
} catch (e: Exception) {
e.printStackTrace()
payResultLiveData.postValue(Result.failure(e))
Thread.sleep(5000)
}
}
}
}
/**
* 订单查询,退款查询
*/
fun payResultQuery(orderNo: String) {
viewModelScope.launch(Dispatchers.IO){
try {
LogUtils.e("退款支付查询订单号:${orderNo}")
val payServiceResponseResult = PayRepository.payResultQuery(orderNo)
LogUtils.e("退款支付查询结果:${JSON.toJSONString(payServiceResponseResult)}")
payResultLiveData.postValue(Result.success(payServiceResponseResult))
} catch (e: Exception) {
payResultLiveData.postValue(Result.failure(e))
}
}
}
}
\ No newline at end of file
......@@ -6,17 +6,19 @@ import androidx.lifecycle.viewModelScope
import com.miya.fastcashier.service.AccountService
import com.miya.fastcashier.service.PrintService
import com.sdy.miya.moblie.component.pay.platform.bean.PayServiceResponse
import com.tencent.mmkv.MMKV
import kotlinx.coroutines.*
class PrintViewModel : ViewModel() {
val printResultLiveData: MutableLiveData<Result<Any>> = MutableLiveData()
val kv = MMKV.defaultMMKV()
fun printOrder(payServiceResponse: PayServiceResponse){
//todo 检查参数
viewModelScope.launch(Dispatchers.IO){
try {
AccountService.getAccountInfo()?.let {
AccountService.getAccountInfo()?.let {
PrintService.payInfoPrint(payServiceResponse, it)
}
printResultLiveData.postValue(Result.success(Any()))
......
package com.miya.fastcashier.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import com.miya.fastcashier.R;
import java.util.ArrayList;
import java.util.List;
public class DecimalKeyboard extends LinearLayout {
public static final int DELETE = -2;
public static final int DOT = -3;
private View btn_7, btn_8, btn_9, btn_6, btn_5, btn_4, btn_3, btn_2, btn_1, btn_0;
private View delete;
private Button btn_dot;
private List<View> buttons;
private KeyboardClickListener keyboardClickListener;
public DecimalKeyboard(Context context) {
this(context, null);
}
public DecimalKeyboard(Context context, AttributeSet attrs) {
super(context, attrs);
View view = LayoutInflater.from(context).inflate(R.layout.keyboard_decimal, this, true);
buttons = new ArrayList<>(12);
ClickListener clickListener = new ClickListener();
btn_7 = view.findViewById(R.id.btn_7);
btn_8 = view.findViewById(R.id.btn_8);
btn_9 = view.findViewById(R.id.btn_9);
btn_6 = view.findViewById(R.id.btn_6);
btn_5 = view.findViewById(R.id.btn_5);
btn_4 = view.findViewById(R.id.btn_4);
btn_3 = view.findViewById(R.id.btn_3);
btn_2 = view.findViewById(R.id.btn_2);
btn_1 = view.findViewById(R.id.btn_1);
btn_0 = view.findViewById(R.id.btn_0);
delete = view.findViewById(R.id.btn_delete);
btn_dot = view.findViewById(R.id.btn_dot);
buttons.add(btn_7);
buttons.add(btn_8);
buttons.add(btn_9);
buttons.add(btn_6);
buttons.add(btn_5);
buttons.add(btn_4);
buttons.add(btn_3);
buttons.add(btn_2);
buttons.add(btn_1);
buttons.add(btn_0);
buttons.add(delete);
buttons.add(btn_dot);
for (View btn : buttons) {
btn.setOnClickListener(clickListener);
}
}
class ClickListener implements OnClickListener {
@Override
public void onClick(View v) {
if (keyboardClickListener == null) {
return;
}
int i = v.getId();
if (i == R.id.btn_7) {
keyboardClickListener.onNumClick(7);
}
if (i == R.id.btn_8) {
keyboardClickListener.onNumClick(8);
}
if (i == R.id.btn_9) {
keyboardClickListener.onNumClick(9);
}
if (i == R.id.btn_6) {
keyboardClickListener.onNumClick(6);
}
if (i == R.id.btn_5) {
keyboardClickListener.onNumClick(5);
}
if (i == R.id.btn_4) {
keyboardClickListener.onNumClick(4);
}
if (i == R.id.btn_3) {
keyboardClickListener.onNumClick(3);
}
if (i == R.id.btn_2) {
keyboardClickListener.onNumClick(2);
}
if (i == R.id.btn_1) {
keyboardClickListener.onNumClick(1);
}
if (i == R.id.btn_0) {
keyboardClickListener.onNumClick(0);
}
if (i == R.id.btn_delete) {
keyboardClickListener.onNumClick(DELETE);
}
if (i == R.id.btn_dot) {
keyboardClickListener.onNumClick(DOT);
}
}
}
public KeyboardClickListener getKeyboardClickListener() {
return keyboardClickListener;
}
public void setKeyboardClickListener(KeyboardClickListener keyboardClickListener) {
this.keyboardClickListener = keyboardClickListener;
}
public interface KeyboardClickListener {
void onNumClick(int num);
}
}
package com.miya.fastcashier.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import com.miya.fastcashier.R;
import java.util.ArrayList;
import java.util.List;
public class NumKeyboard extends LinearLayout {
public static final int DELETE = -2;
public static final int DOT = -3;
public static final int SURE = -3;
private View btn_7, btn_8, btn_9, btn_6, btn_5, btn_4, btn_3, btn_2, btn_1, btn_0;
private View delete;
private Button btn_dot;
private Button btn_sure;
private List<View> buttons;
private KeyboardClickListener keyboardClickListener;
......@@ -41,7 +44,7 @@ public class NumKeyboard extends LinearLayout {
btn_1 = view.findViewById(R.id.btn_1);
btn_0 = view.findViewById(R.id.btn_0);
delete = view.findViewById(R.id.btn_delete);
btn_dot = view.findViewById(R.id.btn_dot);
btn_sure = view.findViewById(R.id.btn_sure);
buttons.add(btn_7);
buttons.add(btn_8);
buttons.add(btn_9);
......@@ -53,7 +56,7 @@ public class NumKeyboard extends LinearLayout {
buttons.add(btn_1);
buttons.add(btn_0);
buttons.add(delete);
buttons.add(btn_dot);
buttons.add(btn_sure);
for (View btn : buttons) {
btn.setOnClickListener(clickListener);
}
......@@ -102,12 +105,16 @@ public class NumKeyboard extends LinearLayout {
if (i == R.id.btn_delete) {
keyboardClickListener.onNumClick(DELETE);
}
if (i == R.id.btn_dot) {
keyboardClickListener.onNumClick(DOT);
if (i == R.id.btn_sure) {
keyboardClickListener.onNumClick(SURE);
}
}
}
public Button getOkButton(){
return btn_sure;
}
public KeyboardClickListener getKeyboardClickListener() {
return keyboardClickListener;
}
......
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha
android:duration="300"
android:fromAlpha="0"
android:toAlpha="1"
/>
</set>
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha
android:duration="300"
android:fromAlpha="0"
android:toAlpha="1"
/>
</set>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:endColor="@color/white"
android:startColor="@color/white" />
<corners
android:topLeftRadius="20dp"
android:topRightRadius="20dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:endColor="@color/white"
android:startColor="@color/white" />
<corners
android:radius="8dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/app_keybord_btn_normal"/>
<item android:state_pressed="false" android:drawable="@drawable/app_keybord_btn_pressed"/>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:drawable="@drawable/app_keybord_btn_sure_enable_false"/>
<item android:state_enabled="true" android:drawable="@drawable/app_keybord_btn_sure_enable_true"/>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:endColor="@color/colorPrimary_50"
android:startColor="@color/colorPrimary_50" />
<corners android:radius="8dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:endColor="@color/colorPrimary"
android:startColor="@color/colorPrimary" />
<corners android:radius="8dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#B3000000"
android:endColor="#B3000000"/>
<corners android:radius="12dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:drawable="@color/colorPrimary_50"/>
<item android:state_enabled="false" android:drawable="@color/colorPrimary_50"/>
<item android:state_enabled="true" android:drawable="@color/colorPrimary"/>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:endColor="#F7F9FC"
android:startColor="#F7F9FC" />
<corners android:radius="8dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@mipmap/ic_choose"/>
<item android:state_selected="false" android:drawable="@mipmap/ic_no_choose"/>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:endColor="@color/white"
android:startColor="@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">
<gradient
android:endColor="#E7E7EB"
android:startColor="#E7E7EB" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="false" android:drawable="@drawable/app_payway_btn_normal"/>
<item android:state_pressed="true" android:drawable="@drawable/app_payway_btn_pressed"/>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/cPayCodeBg"
android:background="@color/blue"
android:focusable="true"
android:focusableInTouchMode="true"
tools:context=".ui.PriceInputActivity">
<TextView
android:id="@+id/tvBack"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="60dp"
android:layout_marginLeft="60dp"
android:layout_marginTop="32dp"
android:textColor="@color/white"
android:text="@string/back"
android:textSize="24sp"/>
<ImageView
android:id="@+id/ivBack"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@+id/tvBack"
app:layout_constraintTop_toTopOf="@+id/tvBack"
app:layout_constraintBottom_toBottomOf="@+id/tvBack"
android:layout_width="24dp"
android:layout_height="48dp"
android:padding="6dp"
android:src="@mipmap/ic_left_arrow"
android:contentDescription="@string/back" />
<TextView
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:textColor="@color/white"
android:text="收款码"
android:textSize="36sp"/>
<androidx.constraintlayout.widget.ConstraintLayout
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_width="600dp"
android:layout_height="869dp"
android:background="@drawable/app_home_function_bg">
<TextView
android:id="@+id/tvPrice"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="88dp"
android:textColor="#141C30"
android:textStyle="bold"
android:text="¥319.00"
android:textSize="56sp"/>
<TextView
android:id="@+id/tvPayGuide"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="215dp"
android:textColor="#141C30"
android:drawableLeft="@mipmap/ic_alipay"
android:drawablePadding="10dp"
android:text="支付宝扫描二维码 向我付款"
android:textSize="32sp"/>
<TextView
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="44dp"
android:textColor="#878E9D"
android:text="请在1分钟内扫描二维码付款"
android:textSize="24sp"/>
<ImageView
android:id="@+id/ivPayCode"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvPayGuide"
android:layout_width="323dp"
android:layout_height="323dp"
android:layout_marginTop="30dp"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -15,9 +15,7 @@
android:layout_marginTop="475dp"
android:layout_marginEnd="46dp"
android:hint="请输入用户名"
android:text="miyago"
android:textSize="32sp"
android:inputType="textEmailAddress"
android:selectAllOnFocus="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
......@@ -32,7 +30,6 @@
android:layout_marginEnd="46dp"
android:hint="请输入密码"
android:imeActionLabel="@string/action_sign_in_short"
android:text="123456"
android:textSize="32sp"
android:imeOptions="actionDone"
android:inputType="textPassword"
......@@ -102,24 +99,51 @@
android:visibility="gone"
app:layout_constraintStart_toStartOf="@+id/username"
app:layout_constraintStart_toEndOf="@+id/ivLogo"
app:layout_constraintTop_toBottomOf="@+id/password"
android:layout_marginLeft="20dp"
android:layout_marginStart="20dp" />
app:layout_constraintTop_toBottomOf="@+id/password" />
<ProgressBar
android:id="@+id/loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="32dp"
android:layout_marginTop="64dp"
android:layout_marginEnd="32dp"
android:layout_marginBottom="64dp"
<!--封装成一个View-->
<androidx.constraintlayout.widget.ConstraintLayout
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/password"
app:layout_constraintStart_toStartOf="@+id/password"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.3" />
android:id="@+id/loading"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="306dp"
android:layout_height="279dp"
android:background="@drawable/app_loading_bg"
android:gravity="center_horizontal"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:layout_width="98dp"
android:layout_height="98dp"
android:layout_marginTop="30dp"
android:src="@mipmap/ic_login" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="23dp"
android:text="正在登录"
android:textColor="@color/white"
android:textSize="36sp" />
<com.github.ybq.android.spinkit.SpinKitView
android:id="@+id/spin_kit"
style="@style/SpinKitView.Large.ThreeBounce"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="18dp"
app:SpinKit_Color="@color/white" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -49,11 +49,14 @@
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:layout_width="wrap_content"
android:id="@+id/tvStoreName"
android:layout_width="360dp"
android:layout_height="wrap_content"
android:ellipsize="end"
android:layout_marginStart="23dp"
android:layout_marginLeft="26dp"
android:text="匡威-杭州滨江店!"
android:maxLines="1"
android:textColor="@color/white"
android:textSize="48sp"
app:layout_constraintStart_toEndOf="@+id/ivLogo"
......@@ -151,5 +154,17 @@
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="24dp"
android:background="@mipmap/app_home_bottom_store_logo" />
<ImageView
android:id="@+id/ivLoginOut"
app:layout_constraintTop_toTopOf="@+id/tvStoreName"
app:layout_constraintBottom_toBottomOf="@+id/tvStoreName"
app:layout_constraintStart_toEndOf="@+id/tvStoreName"
android:layout_width="50dp"
android:layout_height="50dp"
android:padding="7dp"
android:layout_marginStart="12dp"
android:src="@mipmap/app_main_login_out"
android:layout_marginLeft="12dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -4,7 +4,8 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
android:id="@+id/cPayCodeBg"
android:background="@color/green"
android:focusable="true"
android:focusableInTouchMode="true"
tools:context=".ui.PriceInputActivity">
......@@ -78,7 +79,8 @@
android:layout_height="wrap_content"
android:layout_marginTop="215dp"
android:textColor="#141C30"
android:text="扫描二维码 向我付款"
android:drawableLeft="@mipmap/ic_wxpay"
android:text="微信扫描二维码 向我付款"
android:textSize="32sp"/>
<TextView
......@@ -103,20 +105,4 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<ProgressBar
android:id="@+id/loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="32dp"
android:layout_marginTop="64dp"
android:layout_marginEnd="32dp"
android:layout_marginBottom="64dp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintVertical_bias="0.3" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -228,7 +228,6 @@
android:layout_marginStart="80dp"
android:layout_marginEnd="80dp"
android:background="@drawable/app_payresult_reprint_bg"
android:enabled="false"
android:gravity="center"
android:text="返回首页"
android:textColor="#111235"
......
......@@ -98,7 +98,7 @@
android:layout_marginRight="32dp"
android:gravity="end" />
<com.miya.fastcashier.widget.NumKeyboard
<com.miya.fastcashier.widget.DecimalKeyboard
android:id="@+id/numKeyboard"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
......@@ -132,20 +132,49 @@
android:background="@drawable/app_paycode_generate"
android:layout_width="0dp"/>
<ProgressBar
android:id="@+id/loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="32dp"
android:layout_marginTop="64dp"
android:layout_marginEnd="32dp"
android:layout_marginBottom="64dp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintVertical_bias="0.3" />
<!-- &lt;!&ndash;封装成一个View&ndash;&gt;-->
<!-- <androidx.constraintlayout.widget.ConstraintLayout-->
<!-- android:visibility="gone"-->
<!-- android:id="@+id/loading"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent">-->
<!-- <LinearLayout-->
<!-- android:layout_width="306dp"-->
<!-- android:layout_height="279dp"-->
<!-- android:background="@drawable/app_loading_bg"-->
<!-- android:gravity="center_horizontal"-->
<!-- android:orientation="vertical"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent">-->
<!-- <ImageView-->
<!-- android:layout_width="98dp"-->
<!-- android:layout_height="98dp"-->
<!-- android:layout_marginTop="30dp"-->
<!-- android:src="@mipmap/ic_qr_code" />-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginTop="23dp"-->
<!-- android:text="生成付款码中"-->
<!-- android:textColor="@color/white"-->
<!-- android:textSize="36sp" />-->
<!-- <com.github.ybq.android.spinkit.SpinKitView-->
<!-- android:id="@+id/spin_kit"-->
<!-- style="@style/SpinKitView.Large.ThreeBounce"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_gravity="center"-->
<!-- android:layout_marginTop="18dp"-->
<!-- app:SpinKit_Color="@color/white" />-->
<!-- </LinearLayout>-->
<!-- </androidx.constraintlayout.widget.ConstraintLayout>-->
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
android:focusable="true"
android:focusableInTouchMode="true"
tools:context=".ui.PriceInputActivity">
<TextView
android:id="@+id/tvBack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="60dp"
android:layout_marginLeft="60dp"
android:layout_marginTop="32dp"
android:text="@string/back"
android:textColor="@color/white"
android:textSize="24sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/ivBack"
android:layout_width="24dp"
android:layout_height="48dp"
android:contentDescription="@string/back"
android:padding="6dp"
android:src="@mipmap/ic_left_arrow"
app:layout_constraintBottom_toBottomOf="@+id/tvBack"
app:layout_constraintEnd_toStartOf="@+id/tvBack"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/tvBack" />
<ImageView
android:layout_width="195dp"
android:layout_height="20dp"
android:layout_marginEnd="32dp"
android:layout_marginRight="32dp"
android:src="@mipmap/ic_logo_white"
app:layout_constraintBottom_toBottomOf="@+id/tvBack"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/tvBack" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="87dp"
android:background="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/tvScanGuide"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="148dp"
android:text="请长按唤起红外扫描订单条码"
android:textColor="#141C30"
android:textSize="36sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:layout_width="541dp"
android:layout_height="386dp"
android:layout_marginTop="46dp"
android:src="@mipmap/app_refund_code_scan_guide"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvScanGuide" />
<LinearLayout
android:id="@+id/ivRefundManualInput"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginBottom="335dp"
android:layout_width="656dp"
android:layout_height="60dp"
android:gravity="center_vertical"
android:orientation="horizontal"
android:background="@drawable/app_number_input_bg">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginLeft="18dp"
android:src="@mipmap/ic_input"
android:layout_marginStart="18dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="手动输入订单号"
android:layout_marginLeft="16sp"
android:textSize="24sp"
android:textColor="#5C687E"/>
<View
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="match_parent"/>
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="24dp"
android:src="@mipmap/ic_arrow_right"
android:layout_marginRight="24dp" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/cPayCodeBg"
android:background="@color/green"
android:focusable="true"
android:focusableInTouchMode="true"
tools:context=".ui.PriceInputActivity">
<TextView
android:id="@+id/tvBack"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="60dp"
android:layout_marginLeft="60dp"
android:layout_marginTop="32dp"
android:textColor="@color/white"
android:text="@string/back"
android:textSize="24sp"/>
<ImageView
android:id="@+id/ivBack"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@+id/tvBack"
app:layout_constraintTop_toTopOf="@+id/tvBack"
app:layout_constraintBottom_toBottomOf="@+id/tvBack"
android:layout_width="24dp"
android:layout_height="48dp"
android:padding="6dp"
android:src="@mipmap/ic_left_arrow"
android:contentDescription="@string/back" />
<TextView
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:textColor="@color/white"
android:text="收款码"
android:textSize="36sp"/>
<androidx.constraintlayout.widget.ConstraintLayout
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_width="600dp"
android:layout_height="869dp"
android:background="@drawable/app_home_function_bg">
<TextView
android:id="@+id/tvPrice"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="88dp"
android:textColor="#141C30"
android:textStyle="bold"
android:text="¥319.00"
android:textSize="56sp"/>
<TextView
android:id="@+id/tvPayGuide"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="215dp"
android:drawablePadding="10dp"
android:textColor="#141C30"
android:drawableLeft="@mipmap/ic_wxpay"
android:text="微信扫描二维码 向我付款"
android:textSize="32sp"/>
<TextView
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="44dp"
android:textColor="#878E9D"
android:text="请在1分钟内扫描二维码付款"
android:textSize="24sp"/>
<ImageView
android:id="@+id/ivPayCode"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvPayGuide"
android:layout_width="323dp"
android:layout_height="323dp"
android:layout_marginTop="30dp"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/container"
android:background="@drawable/app_center_dialog_bg"
android:layout_width="match_parent"
android:layout_marginStart="85dp"
android:layout_marginEnd="85dp"
android:layout_marginRight="85dp"
android:layout_height="264dp"
android:layout_marginLeft="85dp">
<TextView
android:id="@+id/tvMessage"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:textColor="#323233"
android:textSize="28sp"
android:text="是否确认退款"
android:layout_marginTop="61dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<View
android:id="@+id/vHorizontalLine"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="164dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:background="#E8E8E8" />
<View
android:id="@+id/vVerticalLine"
android:layout_width="1dp"
android:layout_height="0dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/vHorizontalLine"
android:background="#E8E8E8" />
<TextView
android:id="@+id/tvNegative"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="取消"
android:textColor="#969799"
android:textSize="28sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/vVerticalLine"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/vHorizontalLine" />
<TextView
android:id="@+id/tvPositive"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/vVerticalLine"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/vHorizontalLine"
android:textColor="#111235"
android:textSize="28sp"
android:text="确定"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/container"
android:background="@drawable/app_bottom_dialog_bg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="497dp">
<TextView
android:id="@+id/tvTitle"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:textColor="#141C30"
android:textSize="36sp"
android:text="手动输入订单号"
android:layout_marginTop="38dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ImageView
android:id="@+id/ivClose"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginTop="38dp"
android:layout_marginEnd="38dp"
android:padding="7dp"
android:src="@mipmap/ic_close"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginRight="38dp" />
<com.rengwuxian.materialedittext.MaterialEditText
android:id="@+id/etNumber"
android:layout_width="510dp"
android:layout_height="wrap_content"
android:layout_marginTop="154dp"
android:layout_marginStart="46dp"
android:layout_marginEnd="46dp"
android:hint="请输入"
android:gravity="center_horizontal"
android:textSize="36sp"
android:inputType="textEmailAddress"
android:selectAllOnFocus="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvErrInfo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="输入有误,请检查后重新输入"
android:textSize="24sp"
android:textColor="#FF5A59"
android:visibility="gone"
android:layout_marginTop="24sp"
app:layout_constraintStart_toStartOf="@+id/etNumber"
app:layout_constraintTop_toBottomOf="@+id/etNumber"/>
<com.miya.fastcashier.widget.NumKeyboard
android:id="@+id/numKeyboard"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="580dp"
android:layout_height="450dp"
android:layout_marginTop="80dp"
app:layout_constraintTop_toBottomOf="@+id/etNumber" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/container"
android:background="@drawable/app_bottom_dialog_bg"
android:layout_width="match_parent"
android:layout_height="595dp">
<TextView
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:textColor="#141C30"
android:textSize="36sp"
android:text="选择收款方式"
android:layout_marginTop="38dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ImageView
android:id="@+id/ivClose"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginTop="38dp"
android:layout_marginEnd="38dp"
android:padding="7dp"
android:src="@mipmap/ic_close"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginRight="38dp" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cWxPay"
android:layout_width="match_parent"
android:layout_height="104dp"
android:layout_marginTop="150dp"
android:background="@drawable/app_payway_choose_btn"
app:layout_constraintTop_toTopOf="parent">
<ImageView
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_width="42dp"
android:layout_height="37dp"
android:src="@mipmap/ic_wxpay"
android:layout_marginStart="47dp"
android:layout_marginLeft="47dp" />
<TextView
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#333333"
android:textSize="32sp"
android:layout_marginStart="120dp"
android:layout_marginLeft="120dp"
android:text="微信收款码"/>
<ImageButton
android:id="@+id/ivWxPayChoose"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@null"
android:src="@drawable/app_pay_way_choosed"
android:layout_marginEnd="32dp"
android:layout_marginRight="32dp"
android:layout_marginStart="47dp"
android:layout_marginLeft="47dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cAliPay"
android:layout_width="match_parent"
android:layout_height="104dp"
android:layout_marginTop="254dp"
android:background="@drawable/app_payway_choose_btn"
app:layout_constraintTop_toTopOf="parent">
<ImageView
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_width="42dp"
android:layout_height="37dp"
android:src="@mipmap/ic_alipay"
android:layout_marginStart="47dp"
android:layout_marginLeft="47dp" />
<TextView
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#333333"
android:textSize="32sp"
android:layout_marginStart="120dp"
android:layout_marginLeft="120dp"
android:text="支付宝收款码"/>
<ImageButton
android:id="@+id/ibAliPayChoose"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginEnd="32dp"
android:layout_marginRight="32dp"
android:background="@null"
android:src="@drawable/app_pay_way_choosed"
android:layout_marginStart="47dp"
android:layout_marginLeft="47dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
<Button
android:id="@+id/tvGeneratePayCode"
android:layout_width="656dp"
android:layout_height="100dp"
android:layout_gravity="start"
android:layout_marginTop="142dp"
android:text="生成收款码"
android:background="@color/colorPrimary"
android:textSize="32sp"
android:layout_marginBottom="63dp"
android:textColor="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintVertical_bias="0.2" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/container"
android:background="@drawable/app_bottom_dialog_bg"
android:layout_width="match_parent"
android:layout_height="595dp">
<TextView
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:textColor="#141C30"
android:textSize="36sp"
android:text="确认退款订单金额"
android:layout_marginTop="38dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ImageView
android:id="@+id/ivClose"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginTop="38dp"
android:layout_marginEnd="38dp"
android:padding="7dp"
android:src="@mipmap/ic_close"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginRight="38dp" />
<TextView
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginTop="178dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#141C30"
android:textSize="32sp"
android:text="订单金额"/>
<TextView
android:id="@+id/tvPrice"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginTop="247dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#141C30"
android:textSize="48sp"
android:textStyle="bold"
android:text="¥319.00"/>
<Button
android:id="@+id/tvRefund"
android:layout_width="656dp"
android:layout_height="100dp"
android:layout_gravity="start"
android:layout_marginTop="142dp"
android:text="确认退款"
android:background="@color/colorPrimary"
android:textSize="32sp"
android:layout_marginBottom="63dp"
android:textColor="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintVertical_bias="0.2" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#E7E7EB"
android:orientation="vertical"
android:padding="12dp"
android:splitMotionEvents="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:splitMotionEvents="false">
<Button
android:id="@+id/btn_1"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="4dp"
android:layout_weight="1"
android:background="@drawable/app_keybord_btn"
android:text="1"
android:textColor="#333333"
android:textSize="69sp"/>
<Button
android:id="@+id/btn_2"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="4dp"
android:layout_weight="1"
android:textColor="#333333"
android:background="@drawable/app_keybord_btn"
android:text="2"
android:textSize="69sp" />
<Button
android:id="@+id/btn_3"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="4dp"
android:textColor="#333333"
android:layout_weight="1"
android:background="@drawable/app_keybord_btn"
android:text="3"
android:textSize="69sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:splitMotionEvents="false">
<Button
android:id="@+id/btn_4"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:textColor="#333333"
android:layout_height="match_parent"
android:layout_margin="4dp"
android:layout_weight="1"
android:background="@drawable/app_keybord_btn"
android:text="4"
android:textSize="69sp" />
<Button
android:id="@+id/btn_5"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:textColor="#333333"
android:layout_margin="4dp"
android:layout_weight="1"
android:background="@drawable/app_keybord_btn"
android:text="5"
android:textSize="69sp" />
<Button
android:id="@+id/btn_6"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="4dp"
android:layout_weight="1"
android:textColor="#333333"
android:background="@drawable/app_keybord_btn"
android:text="6"
android:textSize="69sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:splitMotionEvents="false">
<Button
android:id="@+id/btn_7"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="4dp"
android:textColor="#333333"
android:layout_weight="1"
android:background="@drawable/app_keybord_btn"
android:text="7"
android:textSize="69sp" />
<Button
android:id="@+id/btn_8"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="4dp"
android:layout_weight="1"
android:textColor="#333333"
android:background="@drawable/app_keybord_btn"
android:text="8"
android:textSize="69sp" />
<Button
android:id="@+id/btn_9"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="4dp"
android:layout_weight="1"
android:textColor="#333333"
android:background="@drawable/app_keybord_btn"
android:text="9"
android:textSize="69sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:splitMotionEvents="false">
<Button
android:id="@+id/btn_0"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="4dp"
android:textColor="#333333"
android:layout_weight="1"
android:background="@drawable/app_keybord_btn"
android:text="0"
android:textSize="69sp" />
<Button
android:id="@+id/btn_dot"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="4dp"
android:layout_weight="1"
android:textColor="#333333"
android:background="@drawable/app_keybord_btn"
android:text="."
android:paddingBottom="30dp"
android:textSize="69sp" />
<FrameLayout
android:id="@+id/btn_delete"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="@drawable/app_keybord_btn"
android:layout_margin="4dp"
android:layout_weight="1">
<ImageView
android:layout_width="54dp"
android:layout_height="54dp"
android:layout_gravity="center"
android:scaleType="fitXY"
android:src="@mipmap/ic_delete" />
</FrameLayout>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
......@@ -2,9 +2,9 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#E7E7EB"
android:orientation="vertical"
android:padding="12dp"
android:background="@color/white"
android:splitMotionEvents="false">
<LinearLayout
......@@ -19,36 +19,36 @@
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="4dp"
android:layout_margin="15dp"
android:layout_weight="1"
android:background="@drawable/app_keybord_btn"
android:background="@drawable/app_keybord_btn_dark"
android:text="1"
android:textColor="#333333"
android:textSize="69sp"/>
android:textColor="#141C30"
android:textSize="36sp"/>
<Button
android:id="@+id/btn_2"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="4dp"
android:layout_margin="15dp"
android:layout_weight="1"
android:textColor="#333333"
android:background="@drawable/app_keybord_btn"
android:textColor="#141C30"
android:background="@drawable/app_keybord_btn_dark"
android:text="2"
android:textSize="69sp" />
android:textSize="36sp" />
<Button
android:id="@+id/btn_3"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="4dp"
android:textColor="#333333"
android:layout_margin="15dp"
android:textColor="#141C30"
android:layout_weight="1"
android:background="@drawable/app_keybord_btn"
android:background="@drawable/app_keybord_btn_dark"
android:text="3"
android:textSize="69sp" />
android:textSize="36sp" />
</LinearLayout>
......@@ -63,37 +63,37 @@
android:id="@+id/btn_4"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:textColor="#333333"
android:textColor="#141C30"
android:layout_height="match_parent"
android:layout_margin="4dp"
android:layout_margin="15dp"
android:layout_weight="1"
android:background="@drawable/app_keybord_btn"
android:background="@drawable/app_keybord_btn_dark"
android:text="4"
android:textSize="69sp" />
android:textSize="36sp" />
<Button
android:id="@+id/btn_5"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:textColor="#333333"
android:layout_margin="4dp"
android:textColor="#141C30"
android:layout_margin="15dp"
android:layout_weight="1"
android:background="@drawable/app_keybord_btn"
android:background="@drawable/app_keybord_btn_dark"
android:text="5"
android:textSize="69sp" />
android:textSize="36sp" />
<Button
android:id="@+id/btn_6"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="4dp"
android:layout_margin="15dp"
android:layout_weight="1"
android:textColor="#333333"
android:background="@drawable/app_keybord_btn"
android:textColor="#141C30"
android:background="@drawable/app_keybord_btn_dark"
android:text="6"
android:textSize="69sp" />
android:textSize="36sp" />
</LinearLayout>
<LinearLayout
......@@ -108,36 +108,36 @@
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="4dp"
android:textColor="#333333"
android:layout_margin="15dp"
android:textColor="#141C30"
android:layout_weight="1"
android:background="@drawable/app_keybord_btn"
android:background="@drawable/app_keybord_btn_dark"
android:text="7"
android:textSize="69sp" />
android:textSize="36sp" />
<Button
android:id="@+id/btn_8"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="4dp"
android:layout_margin="15dp"
android:layout_weight="1"
android:textColor="#333333"
android:background="@drawable/app_keybord_btn"
android:textColor="#141C30"
android:background="@drawable/app_keybord_btn_dark"
android:text="8"
android:textSize="69sp" />
android:textSize="36sp" />
<Button
android:id="@+id/btn_9"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="4dp"
android:layout_margin="15dp"
android:layout_weight="1"
android:textColor="#333333"
android:background="@drawable/app_keybord_btn"
android:textColor="#141C30"
android:background="@drawable/app_keybord_btn_dark"
android:text="9"
android:textSize="69sp" />
android:textSize="36sp" />
</LinearLayout>
<LinearLayout
......@@ -147,47 +147,48 @@
android:orientation="horizontal"
android:splitMotionEvents="false">
<Button
android:id="@+id/btn_0"
<FrameLayout
android:id="@+id/btn_delete"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="4dp"
android:textColor="#333333"
android:layout_weight="1"
android:background="@drawable/app_keybord_btn"
android:text="0"
android:textSize="69sp" />
android:background="@drawable/app_keybord_btn_dark"
android:layout_margin="15dp"
android:layout_weight="1">
<ImageView
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_gravity="center"
android:scaleType="fitXY"
android:src="@mipmap/ic_delete" />
</FrameLayout>
<Button
android:id="@+id/btn_dot"
android:id="@+id/btn_0"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="4dp"
android:layout_margin="15dp"
android:textColor="#141C30"
android:layout_weight="1"
android:textColor="#333333"
android:background="@drawable/app_keybord_btn"
android:text="."
android:paddingBottom="30dp"
android:textSize="69sp" />
android:background="@drawable/app_keybord_btn_dark"
android:text="0"
android:textSize="36sp" />
<FrameLayout
android:id="@+id/btn_delete"
<Button
android:id="@+id/btn_sure"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="@drawable/app_keybord_btn"
android:layout_margin="4dp"
android:layout_weight="1">
<ImageView
android:layout_width="54dp"
android:layout_height="54dp"
android:layout_gravity="center"
android:scaleType="fitXY"
android:src="@mipmap/ic_delete" />
</FrameLayout>
android:layout_margin="15dp"
android:layout_weight="1"
android:textColor="@color/white"
android:enabled="false"
android:background="@drawable/app_keybord_btn_sure"
android:text="确定"
android:textSize="36sp" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
......@@ -6,4 +6,7 @@
<color name="transWhite">#00FFFFFF</color>
<!--50代表透明度-->
<color name="colorPrimary_50">#80111235</color>
<color name="transparent">#00000000</color>
<color name="green">#06C261</color>
<color name="blue">#2E6CFB</color>
</resources>
\ No newline at end of file
<resources>
<string name="app_name">MiYaFastCashier</string>
<string name="app_name">匡威收银宝</string>
<string name="title_activity_login">LoginActivity</string>
<string name="prompt_email">Email</string>
<string name="prompt_password">Password</string>
......@@ -7,10 +7,13 @@
<string name="action_sign_in_short">Sign in</string>
<string name="welcome">"Welcome !"</string>
<string name="invalid_username">Not a valid username</string>
<string name="invalid_password">Password must be >5 characters</string>
<string name="login_failed">"Login failed"</string>
<string name="back">返回</string>
<string name="printing">小票打印中,请稍等…</string>
<string name="print_sucesss">小票打印成功</string>
<string name="print_fail">小票打印失败,请重试~</string>
<string name="username_not_empty">用户名不能为空</string>
<string name="password_not_empty">密码不能为空</string>
<string name="invalid_password">密码位数必须得是6位以上</string>
</resources>
\ No newline at end of file
......@@ -3,4 +3,16 @@
<item name="android:windowEnterAnimation">@anim/in_bottom</item>
<item name="android:windowExitAnimation">@anim/out_bottom</item>
</style>
<style name="AlphaInAndOutStyle">
<item name="android:windowEnterAnimation">@anim/in_center_alpha</item>
<item name="android:windowExitAnimation">@anim/out_center_alpha</item>
</style>
<style name="Custom" parent="android:Theme.DeviceDefault.Dialog">
<item name="DialogTitleAppearance">@android:style/TextAppearance.Medium</item>
<item name="DialogTitleText">加载中…</item>
<item name="DialogSpotColor">@android:color/white</item>
<item name="DialogSpotCount">4</item>
</style>
</resources>
......@@ -8,4 +8,12 @@
<item name="android:statusBarColor" tools:targetApi="l">@color/transWhite</item>
</style>
<style name="Theme.MiYaFastCashier.Blue" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:statusBarColor" tools:targetApi="l">@color/blue</item>
</style>
<style name="Theme.MiYaFastCashier.Green" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:statusBarColor" tools:targetApi="l">@color/green</item>
</style>
</resources>
\ No newline at end of file
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