Ver Fonte

input code

liuzhenxing1118 há 5 meses atrás
pai
commit
fb2a4c18d2

+ 7 - 14
app/src/main/java/com/xplora/xponboarding/Activity/BaseInputActivity.java

@@ -10,10 +10,7 @@ import com.xplora.xponboarding.R;
 
 public class BaseInputActivity extends BaseActivity {
     public String mInput = "";
-    private TextView mTextView1 = null;
-    private TextView mTextView2 = null;
-    private TextView mTextView3 = null;
-    private TextView mTextView4 = null;
+    private TextView mTextView = null;
 
     protected void onSureClick() {};
 
@@ -25,10 +22,7 @@ public class BaseInputActivity extends BaseActivity {
     }
 
     private void initView() {
-        mTextView1 = findViewById(R.id.text1);
-        mTextView2 = findViewById(R.id.text2);
-        mTextView3 = findViewById(R.id.text3);
-        mTextView4 = findViewById(R.id.text4);
+        mTextView = findViewById(R.id.text);
 
         Button button1 = findViewById(R.id.button1);
         Button button2 = findViewById(R.id.button2);
@@ -40,7 +34,7 @@ public class BaseInputActivity extends BaseActivity {
         Button button8 = findViewById(R.id.button8);
         Button button9 = findViewById(R.id.button9);
         Button button0 = findViewById(R.id.button0);
-        Button buttonOK = findViewById(R.id.buttonOK);
+        ImageButton buttonOK = findViewById(R.id.buttonOK);
         ImageButton buttonBack = findViewById(R.id.buttonBack);
 
         button1.setOnClickListener(mOnClickListener);
@@ -64,7 +58,9 @@ public class BaseInputActivity extends BaseActivity {
             if (tag == 100) {
                 actionBack();
             } else if (tag == 101) {
-                onSureClick();
+                if (mInput.length() > 0) {
+                    onSureClick();
+                }
             } else {
                 if (mInput.length() >= 4)
                     return;
@@ -75,10 +71,7 @@ public class BaseInputActivity extends BaseActivity {
     };
 
     private void showInputCode() {
-        mTextView1.setText(mInput.length() >= 1 ? "*" : "");
-        mTextView2.setText(mInput.length() >= 2 ? "*" : "");
-        mTextView3.setText(mInput.length() >= 3 ? "*" : "");
-        mTextView4.setText(mInput.length() >= 4 ? "*" : "");
+        mTextView.setText(mInput);
     }
 
     private void actionBack() {

BIN
app/src/main/res/drawable-xhdpi/input_delete.png


BIN
app/src/main/res/drawable-xhdpi/input_sure.png


+ 62 - 110
app/src/main/res/layout/activity_input_code.xml

@@ -4,67 +4,20 @@
     android:layout_height="match_parent"
     android:orientation="vertical"
     android:background="@color/black"
-    android:layout_marginStart="20dp"
-    android:layout_marginEnd="20dp"
+    android:layout_marginStart="5dp"
+    android:layout_marginEnd="5dp"
     >
 
-    <LinearLayout
-        android:id="@+id/mEditLayout"
+    <TextView
+        android:id="@+id/text"
         android:layout_width="match_parent"
         android:layout_height="32dp"
-        android:layout_marginTop="34dp"
-        android:orientation="horizontal"
-        android:layout_marginStart="10dp"
-        android:layout_marginEnd="10dp"
-        >
-        <TextView
-            android:id="@+id/text1"
-            android:layout_width="30dp"
-            android:layout_height="match_parent"
-            android:background="#262626"
-            android:layout_weight="1"
-            android:gravity="center"
-            android:textFontWeight="600"
-            android:textColor="@color/white"
-            android:textSize="18sp"
-            />
-        <TextView
-            android:id="@+id/text2"
-            android:layout_width="30dp"
-            android:layout_height="match_parent"
-            android:layout_marginStart="2dp"
-            android:background="#262626"
-            android:layout_weight="1"
-            android:gravity="center"
-            android:textFontWeight="600"
-            android:textColor="@color/white"
-            android:textSize="18sp"
-            />
-        <TextView
-            android:id="@+id/text3"
-            android:layout_width="30dp"
-            android:layout_height="match_parent"
-            android:layout_marginStart="2dp"
-            android:background="#262626"
-            android:layout_weight="1"
-            android:gravity="center"
-            android:textFontWeight="600"
-            android:textColor="@color/white"
-            android:textSize="18sp"
-            />
-        <TextView
-            android:id="@+id/text4"
-            android:layout_width="30dp"
-            android:layout_height="match_parent"
-            android:layout_marginStart="2dp"
-            android:background="#262626"
-            android:layout_weight="1"
-            android:gravity="center"
-            android:textFontWeight="600"
-            android:textColor="@color/white"
-            android:textSize="18sp"
-            />
-    </LinearLayout>
+        android:layout_marginTop="10dp"
+        android:gravity="center"
+        android:textFontWeight="500"
+        android:textColor="@color/white"
+        android:textSize="17sp"
+        />
 
     <LinearLayout
         android:id="@+id/mLine1Layout"
@@ -78,33 +31,32 @@
             android:id="@+id/button1"
             android:layout_width="50dp"
             android:layout_height="wrap_content"
-            android:background="@color/transparent"
+            android:background="@drawable/bg_gray"
             android:layout_weight="1"
-            android:textFontWeight="800"
-            android:textSize="12sp"
-            android:textColor="#FBD460"
+            android:textSize="15sp"
+            android:textColor="@color/white"
             android:text="1"
             android:tag="1" />
         <Button
             android:id="@+id/button2"
             android:layout_width="50dp"
             android:layout_height="wrap_content"
-            android:background="@color/transparent"
+            android:layout_marginStart="3dp"
+            android:layout_marginEnd="3dp"
+            android:background="@drawable/bg_gray"
             android:layout_weight="1"
-            android:textFontWeight="800"
-            android:textSize="12sp"
-            android:textColor="#FBD460"
+            android:textSize="15sp"
+            android:textColor="@color/white"
             android:text="2"
             android:tag="2" />
         <Button
             android:id="@+id/button3"
             android:layout_width="50dp"
             android:layout_height="wrap_content"
-            android:background="@color/transparent"
+            android:background="@drawable/bg_gray"
             android:layout_weight="1"
-            android:textFontWeight="800"
-            android:textSize="12sp"
-            android:textColor="#FBD460"
+            android:textSize="15sp"
+            android:textColor="@color/white"
             android:text="3"
             android:tag="3" />
     </LinearLayout>
@@ -113,6 +65,7 @@
         android:id="@+id/mLine2Layout"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
+        android:layout_marginTop="3dp"
         android:orientation="horizontal"
         android:layout_weight="1"
         >
@@ -120,33 +73,32 @@
             android:id="@+id/button4"
             android:layout_width="50dp"
             android:layout_height="wrap_content"
-            android:background="@color/transparent"
+            android:background="@drawable/bg_gray"
             android:layout_weight="1"
-            android:textFontWeight="800"
-            android:textSize="12sp"
-            android:textColor="#FBD460"
+            android:textSize="15sp"
+            android:textColor="@color/white"
             android:text="4"
             android:tag="4" />
         <Button
             android:id="@+id/button5"
             android:layout_width="50dp"
             android:layout_height="wrap_content"
-            android:background="@color/transparent"
+            android:layout_marginStart="3dp"
+            android:layout_marginEnd="3dp"
+            android:background="@drawable/bg_gray"
             android:layout_weight="1"
-            android:textFontWeight="800"
-            android:textSize="12sp"
-            android:textColor="#FBD460"
+            android:textSize="15sp"
+            android:textColor="@color/white"
             android:text="5"
             android:tag="5" />
         <Button
             android:id="@+id/button6"
             android:layout_width="50dp"
             android:layout_height="wrap_content"
-            android:background="@color/transparent"
+            android:background="@drawable/bg_gray"
             android:layout_weight="1"
-            android:textFontWeight="800"
-            android:textSize="12sp"
-            android:textColor="#FBD460"
+            android:textSize="15sp"
+            android:textColor="@color/white"
             android:text="6"
             android:tag="6" />
     </LinearLayout>
@@ -155,6 +107,7 @@
         android:id="@+id/mLine3Layout"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
+        android:layout_marginTop="3dp"
         android:orientation="horizontal"
         android:layout_weight="1"
         >
@@ -162,33 +115,32 @@
             android:id="@+id/button7"
             android:layout_width="50dp"
             android:layout_height="wrap_content"
-            android:background="@color/transparent"
+            android:background="@drawable/bg_gray"
             android:layout_weight="1"
-            android:textFontWeight="800"
-            android:textSize="12sp"
-            android:textColor="#FBD460"
+            android:textSize="15sp"
+            android:textColor="@color/white"
             android:text="7"
             android:tag="7" />
         <Button
             android:id="@+id/button8"
             android:layout_width="50dp"
             android:layout_height="wrap_content"
-            android:background="@color/transparent"
+            android:layout_marginStart="3dp"
+            android:layout_marginEnd="3dp"
+            android:background="@drawable/bg_gray"
             android:layout_weight="1"
-            android:textFontWeight="800"
-            android:textSize="12sp"
-            android:textColor="#FBD460"
+            android:textSize="15sp"
+            android:textColor="@color/white"
             android:text="8"
             android:tag="8" />
         <Button
             android:id="@+id/button9"
             android:layout_width="50dp"
             android:layout_height="wrap_content"
-            android:background="@color/transparent"
+            android:background="@drawable/bg_gray"
             android:layout_weight="1"
-            android:textFontWeight="800"
-            android:textSize="12sp"
-            android:textColor="#FBD460"
+            android:textSize="15sp"
+            android:textColor="@color/white"
             android:text="9"
             android:tag="9" />
     </LinearLayout>
@@ -197,39 +149,39 @@
         android:id="@+id/mLine4Layout"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
+        android:layout_marginTop="3dp"
         android:orientation="horizontal"
         android:layout_weight="1"
         android:layout_marginBottom="10dp"
         >
         <ImageButton
-            android:id="@+id/buttonBack"
+            android:id="@+id/buttonOK"
             android:layout_width="50dp"
-            android:layout_height="wrap_content"
-            android:backgroundTint="@color/transparent"
-            android:src="@drawable/pin_delete"
+            android:layout_height="match_parent"
+            android:background="@drawable/bg_gray"
+            android:src="@drawable/input_sure"
             android:layout_weight="1"
-            android:tag="100" />
+            android:tag="101" />
         <Button
             android:id="@+id/button0"
             android:layout_width="50dp"
             android:layout_height="wrap_content"
-            android:background="@color/transparent"
+            android:layout_marginStart="3dp"
+            android:layout_marginEnd="3dp"
+            android:background="@drawable/bg_gray"
             android:layout_weight="1"
-            android:textFontWeight="800"
-            android:textSize="12sp"
-            android:textColor="#FBD460"
+            android:textSize="15sp"
+            android:textColor="@color/white"
             android:text="0"
             android:tag="0" />
-        <Button
-            android:id="@+id/buttonOK"
+        <ImageButton
+            android:id="@+id/buttonBack"
             android:layout_width="50dp"
-            android:layout_height="wrap_content"
-            android:background="@color/transparent"
+            android:layout_height="match_parent"
+            android:background="@drawable/bg_gray"
+            android:src="@drawable/input_delete"
             android:layout_weight="1"
-            android:textFontWeight="800"
-            android:textSize="12sp"
-            android:text="OK"
-            android:tag="101" />
+            android:tag="100" />
     </LinearLayout>
 
 </LinearLayout>