优化消费模式设置
diff --git a/app/src/main/java/com/supwisdom/activities/consumeMode/ConsumeModeActivity.kt b/app/src/main/java/com/supwisdom/activities/consumeMode/ConsumeModeActivity.kt
index d7f5e32..4e0d932 100644
--- a/app/src/main/java/com/supwisdom/activities/consumeMode/ConsumeModeActivity.kt
+++ b/app/src/main/java/com/supwisdom/activities/consumeMode/ConsumeModeActivity.kt
@@ -101,13 +101,7 @@
KeyEvent.KEYCODE_DEL ->
//cancel
delValueToEdit()
- KeyEvent.KEYCODE_POUND, KeyEvent.KEYCODE_PERIOD -> {
- val str = vPayamt.text.toString()
- if (str.length < 8 && str.indexOf('.') < 0) {
- vPayamt.text = "$str."
- screenShowAmt()
- }
- }
+ KeyEvent.KEYCODE_POUND, KeyEvent.KEYCODE_PERIOD -> addDotToEdit()
KeyEvent.KEYCODE_ENTER -> {
pos.replaceControlPara(PublicDef.CONTROL_FIXAMT, getFixAmount())
jumpActivity(MenuActivity::class.java)
@@ -197,6 +191,18 @@
screenShowAmt()
}
+ private fun addDotToEdit() {
+ val str = vPayamt.text.toString()
+ if (PublicDef.CONTROL_NO_FIXPAY_FLAG == str) {
+ vPayamt.text = "0."
+ } else {
+ if (str.length < 8 && str.indexOf('.') < 0) {
+ vPayamt.text = "$str."
+ }
+ }
+ screenShowAmt()
+ }
+
private fun screenShowAmt() {
AuxScreenController.getInstance().refreshContent(
Arrays.asList<String>(
diff --git a/app/src/main/res/layout/activity_consume_mode.xml b/app/src/main/res/layout/activity_consume_mode.xml
index 99e494f..4340a35 100644
--- a/app/src/main/res/layout/activity_consume_mode.xml
+++ b/app/src/main/res/layout/activity_consume_mode.xml
@@ -1,43 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- style="@style/head_title_out_style">
+ style="@style/head_title_out_style">
<LinearLayout style="@style/head_title_inner_style">
<TextView
- style="@style/head_title_text_style"
- android:text="消费模式" />
+ style="@style/head_title_text_style"
+ android:text="消费模式"/>
<TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:padding="10dp"
- android:text="0-普通消费\n非0定额消费\n单位(分)"
- android:textColor="@color/light_blue2"
- android:textSize="20sp" />
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="horizontal">
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:padding="10dp"
- android:text="金额: "
- android:textColor="@color/light_blue2"
- android:textSize="30sp" />
-
- <TextView
- android:id="@+id/tv_consume_mode_payamt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:maxLength="6"
android:padding="10dp"
- android:text="0"
+ android:text="none-普通消费\n金额-定额消费\n单位(分)"
android:textColor="@color/light_blue2"
- android:textSize="30sp" />
+ android:textSize="20sp"/>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="horizontal">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="10dp"
+ android:text="金额: "
+ android:textColor="@color/light_blue2"
+ android:textSize="30sp"/>
+
+ <TextView
+ android:id="@+id/tv_consume_mode_payamt"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:maxLength="6"
+ android:padding="10dp"
+ android:text="0"
+ android:textColor="@color/light_blue2"
+ android:textSize="30sp"/>
</LinearLayout>
</LinearLayout>