Procházet zdrojové kódy

-fixing layout after scan
-fixing bug in soundpool
-add handler when digit card <= 7

ilhamitubagoes před 4 roky
rodič
revize
31dff6ecc8

+ 26 - 1
app/src/main/java/com/fusi24/rfid/ui/scanresult/ScanResultActivity.java

@@ -68,6 +68,7 @@ public class ScanResultActivity extends BaseActivity implements ScanResultView {
68 68
     private String idSite;
69 69
     private String idPermit;
70 70
     private String numberRfid;
71
+    private String numberRfidTemp;
71 72
 
72 73
     @Override
73 74
     protected void onCreate(Bundle savedInstanceState) {
@@ -82,7 +83,31 @@ public class ScanResultActivity extends BaseActivity implements ScanResultView {
82 83
         if (getIntent() != null){
83 84
             idSite = getIntent().getStringExtra(ID_SITE);
84 85
             idPermit = getIntent().getStringExtra(ID_PERMIT);
85
-            numberRfid = "000" + getIntent().getStringExtra(RFID_CARD_NUMBER);
86
+            numberRfidTemp = getIntent().getStringExtra(RFID_CARD_NUMBER);
87
+        }
88
+
89
+        // Setting digit rfid card
90
+        if (numberRfidTemp != null){
91
+            switch (numberRfidTemp.length()){
92
+                case 5:
93
+                    numberRfid = "00000" + numberRfidTemp;
94
+                    break;
95
+                case 6:
96
+                    numberRfid = "0000" + numberRfidTemp;
97
+                    break;
98
+                case 7:
99
+                    numberRfid = "000" + numberRfidTemp;
100
+                    break;
101
+                case 8:
102
+                    numberRfid = "00" + numberRfidTemp;
103
+                    break;
104
+                case 9:
105
+                    numberRfid = "0" + numberRfidTemp;
106
+                    break;
107
+                default:
108
+                    numberRfid = numberRfidTemp;
109
+                    break;
110
+            }
86 111
         }
87 112
 
88 113
         initView();

+ 0 - 1
app/src/main/java/com/fusi24/rfid/util/LFScanProcessing.java

@@ -19,7 +19,6 @@ public abstract class LFScanProcessing extends LFSerialPortActivity {
19 19
 
20 20
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
21 21
             attributes = new AudioAttributes.Builder()
22
-                    .setAllowedCapturePolicy(AudioAttributes.ALLOW_CAPTURE_BY_NONE)
23 22
                     .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
24 23
                     .setUsage(AudioAttributes.USAGE_NOTIFICATION_EVENT)
25 24
                     .build();

+ 12 - 11
app/src/main/res/layout/row_document.xml

@@ -2,7 +2,7 @@
2 2
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 3
     xmlns:tools="http://schemas.android.com/tools"
4 4
     android:orientation="horizontal"
5
-    android:layout_width="wrap_content"
5
+    android:layout_width="match_parent"
6 6
     android:layout_height="wrap_content"
7 7
     android:background="@color/backgroundLayoutGrey"
8 8
     android:padding="16dp"
@@ -11,28 +11,29 @@
11 11
     <TextView
12 12
         android:id="@+id/tv_document_name"
13 13
         style="@style/DocumentText"
14
-        android:layout_width="match_parent"
14
+        android:layout_width="70dp"
15 15
         android:layout_height="wrap_content"
16
-        android:layout_marginStart="8dp"
17
-        android:layout_marginEnd="8dp"
16
+        android:layout_marginStart="4dp"
17
+        android:layout_marginEnd="4dp"
18 18
         tools:text="ID CARD KARYAWAN" />
19 19
 
20 20
     <TextView
21 21
         android:id="@+id/tv_document_status"
22 22
         style="@style/DocumentText"
23
-        android:layout_width="match_parent"
23
+        android:layout_width="55dp"
24 24
         android:layout_height="wrap_content"
25
-        android:layout_marginStart="8dp"
26
-        android:layout_marginEnd="8dp"
27
-        tools:text="EXPIRED" />
25
+        android:layout_marginStart="4dp"
26
+        android:layout_marginEnd="4dp"
27
+        android:gravity="center"
28
+        tools:text="NOT FOUND" />
28 29
 
29 30
     <TextView
30 31
         android:id="@+id/tv_document_date"
31 32
         style="@style/DocumentText"
32
-        android:layout_width="match_parent"
33
+        android:layout_width="wrap_content"
33 34
         android:layout_height="wrap_content"
34
-        android:layout_marginStart="8dp"
35
-        android:layout_marginEnd="8dp"
35
+        android:layout_marginStart="4dp"
36
+        android:layout_marginEnd="4dp"
36 37
         tools:text="1-Jul-2019" />
37 38
 
38 39
 </LinearLayout>

+ 1 - 1
app/src/main/res/values/styles.xml

@@ -32,7 +32,7 @@
32 32
     </style>
33 33
 
34 34
     <style name="DocumentText">
35
-        <item name="android:textSize">16sp</item>
35
+        <item name="android:textSize">12sp</item>
36 36
         <item name="android:textColor">@color/colorBlack</item>
37 37
     </style>
38 38