Commit 88987323 authored by jiangjiantao's avatar jiangjiantao

UI 验收

parent df5f03e0
......@@ -81,4 +81,5 @@ dependencies {
implementation 'com.github.ybq:Android-SpinKit:1.4.0'
implementation 'com.github.d-max:spots-dialog:1.1@aar'
implementation 'com.elvishew:xlog:1.10.1'
implementation 'com.squareup.leakcanary:leakcanary-android:2.7'
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ import android.os.Bundle
import androidx.multidex.MultiDexApplication
import com.elvishew.xlog.LogConfiguration
import com.elvishew.xlog.LogLevel
import com.elvishew.xlog.LogUtils
import com.elvishew.xlog.XLog
import com.elvishew.xlog.printer.AndroidPrinter
import com.elvishew.xlog.printer.ConsolePrinter
......
......@@ -49,14 +49,12 @@ class AliPayCodeActivity : AppCompatActivity() {
viewModel = ViewModelProvider(this).get(PayViewModel::class.java)
val ivPayCode = binding.ivPayCode
val tvBack = binding.tvBack
val ivBack = binding.ivBack
val llBack = binding.llBack
val tvPrice = binding.tvPrice
val kv = MMKV.defaultMMKV()
tvBack.clickWithTrigger { finish() }
ivBack.clickWithTrigger { finish() }
llBack.clickWithTrigger { finish() }
val extra = intent.getSerializableExtra("payServiceResponse")
extra?.let {
......
......@@ -83,12 +83,23 @@ class LoginActivity : AppCompatActivity() {
}
})
username.afterTextChanged {
username.apply {
afterTextChanged {
loginViewModel.loginDataChanged(
username.text.toString(),
password.text.toString()
)
}
setOnEditorActionListener { _, actionId, _ ->
when (actionId) {
EditorInfo.IME_ACTION_NEXT ->{
password.requestFocus()
password.text?.let { password.setSelection(it.length) };
}
}
false
}
}
password.apply {
afterTextChanged {
......
......@@ -10,14 +10,18 @@ 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.ui.dialog.MessageDialog
import com.miya.fastcashier.utils.CenterToasty
import com.miya.fastcashier.utils.clickWithTrigger
import com.miya.fastcashier.viewmodel.MainViewModel
import com.sdy.miya.moblie.component.pay.platform.bean.PayServiceResponse
import com.tencent.mmkv.MMKV
import java.lang.Exception
class MainActivity : BaseActivity() {
//退出登录 二次确认弹窗
private var alertDialog: MessageDialog? = null
private lateinit var binding: ActivityMainBinding
private lateinit var viewModel: MainViewModel
......@@ -57,7 +61,17 @@ class MainActivity : BaseActivity() {
ivLoginOut.clickWithTrigger{
loginOut()
}
}
private fun loginOut() {
if (null == alertDialog) {
alertDialog = MessageDialog(this)
.setCustomMessage("是否确认退出登录账号")
.setPositiveButton("确认退出") { _, _ ->
run {
MMKV.defaultMMKV().clearAll()
AccountService.setAccountInfo(null)
......@@ -67,7 +81,8 @@ class MainActivity : BaseActivity() {
finish()
}
}
}
alertDialog?.show()
}
}
\ No newline at end of file
......@@ -32,8 +32,7 @@ class PriceInputActivity : BaseActivity() {
val tvGeneratePayCode = binding.tvGeneratePayCode
val tvScanPayCode = binding.tvScanPayCode
val tvBack = binding.tvBack
val ivBack = binding.ivBack
val llBack = binding.llBack
val etPrice = binding.etPrice
val numKeyboard = binding.numKeyboard
......@@ -66,8 +65,7 @@ class PriceInputActivity : BaseActivity() {
payChooseDialog!!.show()
}
tvBack.clickWithTrigger { finish() }
ivBack.clickWithTrigger { finish() }
llBack.clickWithTrigger { finish() }
numKeyboard.setKeyboardClickListener {
when (it) {
......
......@@ -62,11 +62,9 @@ class RefundActivity : BaseActivity() {
finish()
}
})
val tvBack = binding.tvBack
val ivBack = binding.ivBack
val llBack = binding.llBack
tvBack.clickWithTrigger { finish() }
ivBack.clickWithTrigger { finish() }
llBack.clickWithTrigger { finish() }
val ivRefundManualInput = binding.ivRefundManualInput
ivRefundManualInput.clickWithTrigger {
......
......@@ -49,14 +49,12 @@ class WxPayCodeActivity : AppCompatActivity() {
viewModel = ViewModelProvider(this).get(PayViewModel::class.java)
val ivPayCode = binding.ivPayCode
val tvBack = binding.tvBack
val ivBack = binding.ivBack
val llBack = binding.llBack
val tvPrice = binding.tvPrice
val kv = MMKV.defaultMMKV()
tvBack.clickWithTrigger { finish() }
ivBack.clickWithTrigger { finish() }
llBack.clickWithTrigger { finish() }
val extra = intent.getSerializableExtra("payServiceResponse")
extra?.let {
......
......@@ -55,12 +55,22 @@ class PayChooseDialog(context: Context) : Dialog(context){
ivWxPayChoose.isSelected = true
ibAliPayChoose.isSelected = false
}
ivWxPayChoose.setOnClickListener{
payType = "2"
ivWxPayChoose.isSelected = true
ibAliPayChoose.isSelected = false
}
cAliPay.setOnClickListener{
payType = "1"
ivWxPayChoose.isSelected = false
ibAliPayChoose.isSelected = true
}
ibAliPayChoose.setOnClickListener{
payType = "1"
ivWxPayChoose.isSelected = false
ibAliPayChoose.isSelected = true
}
tvGeneratePayCode.setOnClickListener {
generatePayCodeClickListener.choose(payType)
......
......@@ -45,7 +45,7 @@ class LoginViewModel : ViewModel() {
if (!isUserNameValid(username)) {
_loginForm.value = LoginFormState(usernameError = R.string.username_not_empty)
} else if (!isPasswordValid(password)) {
_loginForm.value = LoginFormState(passwordError = R.string.invalid_password)
_loginForm.value = LoginFormState(passwordError = R.string.password_not_empty)
} else {
_loginForm.value = LoginFormState(isDataValid = true)
}
......@@ -56,7 +56,7 @@ class LoginViewModel : ViewModel() {
}
private fun isPasswordValid(password: String): Boolean {
return password.length > 5
return password.isNotBlank()
}
}
\ No newline at end of file
......@@ -4,5 +4,4 @@
android:startColor="#D73672"
android:endColor="#FF4B8A"
android:angle="90" />
<corners android:radius="8dp" />
</shape>
\ No newline at end of file
......@@ -10,32 +10,40 @@
android:focusableInTouchMode="true"
android:keepScreenOn="true"
tools:context=".ui.PriceInputActivity">
<TextView
android:id="@+id/tvBack"
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/llBack"
android:layout_width="200dp"
android:layout_height="87dp"
android:orientation="horizontal"
android:gravity="center_vertical"
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"/>
app:layout_constraintTop_toTopOf="parent">
<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:layout_marginLeft="32dp"
android:padding="6dp"
android:src="@mipmap/ic_left_arrow"
android:contentDescription="@string/back" />
<TextView
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:textColor="@color/white"
android:text="@string/back"
android:textSize="24sp"/>
</androidx.appcompat.widget.LinearLayoutCompat>
<TextView
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
......
......@@ -14,8 +14,10 @@
android:layout_marginStart="46dp"
android:layout_marginTop="475dp"
android:layout_marginEnd="46dp"
android:singleLine="true"
android:hint="请输入用户名"
android:textSize="32sp"
android:imeOptions="actionNext"
android:selectAllOnFocus="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
......@@ -29,7 +31,7 @@
android:layout_marginTop="50dp"
android:layout_marginEnd="46dp"
android:hint="请输入密码"
android:imeActionLabel="@string/action_sign_in_short"
android:imeActionLabel="登录"
android:textSize="32sp"
android:imeOptions="actionDone"
android:inputType="textPassword"
......
......@@ -9,31 +9,40 @@
android:focusableInTouchMode="true"
tools:context=".ui.PriceInputActivity">
<TextView
android:id="@+id/tvBack"
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/llBack"
android:layout_width="200dp"
android:layout_height="87dp"
android:orientation="horizontal"
android:gravity="center_vertical"
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"/>
app:layout_constraintTop_toTopOf="parent">
<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:layout_marginLeft="32dp"
android:padding="6dp"
android:src="@mipmap/ic_left_arrow"
android:contentDescription="@string/back" />
<TextView
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:textColor="@color/white"
android:text="@string/back"
android:textSize="24sp"/>
</androidx.appcompat.widget.LinearLayoutCompat>
<TextView
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
......@@ -48,12 +57,12 @@
<TextView
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvBack"
app:layout_constraintTop_toBottomOf="@+id/llBack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginLeft="32dp"
android:layout_marginTop="80dp"
android:layout_marginTop="48dp"
android:textColor="@color/white"
android:text="收款金额"
android:textSize="24sp"/>
......@@ -61,11 +70,11 @@
<ImageView
android:id="@+id/ivRmb"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvBack"
app:layout_constraintTop_toBottomOf="@+id/llBack"
android:layout_width="42dp"
android:layout_height="96dp"
android:layout_marginStart="32dp"
android:layout_marginTop="145dp"
android:layout_marginTop="113dp"
android:src="@mipmap/ic_rmb"
android:layout_marginLeft="32dp" />
......@@ -74,8 +83,8 @@
android:layout_width="match_parent"
android:layout_height="2dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvBack"
android:layout_marginTop="263dp"
app:layout_constraintTop_toBottomOf="@+id/llBack"
android:layout_marginTop="231dp"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
android:background="#89889A"
......
......@@ -9,30 +9,40 @@
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"
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/llBack"
android:layout_width="200dp"
android:layout_height="87dp"
android:orientation="horizontal"
android:gravity="center_vertical"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent">
<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:contentDescription="@string/back"
android:layout_marginLeft="32dp"
android:padding="6dp"
android:src="@mipmap/ic_left_arrow"
app:layout_constraintBottom_toBottomOf="@+id/tvBack"
app:layout_constraintEnd_toStartOf="@+id/tvBack"
android:contentDescription="@string/back" />
<TextView
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/tvBack" />
app:layout_constraintTop_toTopOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:textColor="@color/white"
android:text="@string/back"
android:textSize="24sp"/>
</androidx.appcompat.widget.LinearLayoutCompat>
<ImageView
android:layout_width="195dp"
......@@ -40,9 +50,9 @@
android:layout_marginEnd="32dp"
android:layout_marginRight="32dp"
android:src="@mipmap/ic_logo_white"
app:layout_constraintBottom_toBottomOf="@+id/tvBack"
app:layout_constraintBottom_toBottomOf="@+id/llBack"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/tvBack" />
app:layout_constraintTop_toTopOf="@+id/llBack" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
......
......@@ -11,31 +11,41 @@
android:focusableInTouchMode="true"
tools:context=".ui.PriceInputActivity">
<TextView
android:id="@+id/tvBack"
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/llBack"
android:layout_width="200dp"
android:layout_height="87dp"
android:orientation="horizontal"
android:gravity="center_vertical"
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"/>
app:layout_constraintTop_toTopOf="parent">
<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:layout_marginLeft="32dp"
android:padding="6dp"
android:src="@mipmap/ic_left_arrow"
android:contentDescription="@string/back" />
<TextView
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:textColor="@color/white"
android:text="@string/back"
android:textSize="24sp"/>
</androidx.appcompat.widget.LinearLayoutCompat>
<TextView
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
......
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