Browse Source

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

ilhamitubagoes 4 years ago
parent
commit
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
     private String idSite;
68
     private String idSite;
69
     private String idPermit;
69
     private String idPermit;
70
     private String numberRfid;
70
     private String numberRfid;
71
+    private String numberRfidTemp;
71
 
72
 
72
     @Override
73
     @Override
73
     protected void onCreate(Bundle savedInstanceState) {
74
     protected void onCreate(Bundle savedInstanceState) {
@@ -82,7 +83,31 @@ public class ScanResultActivity extends BaseActivity implements ScanResultView {
82
         if (getIntent() != null){
83
         if (getIntent() != null){
83
             idSite = getIntent().getStringExtra(ID_SITE);
84
             idSite = getIntent().getStringExtra(ID_SITE);
84
             idPermit = getIntent().getStringExtra(ID_PERMIT);
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
         initView();
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
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
20
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
21
             attributes = new AudioAttributes.Builder()
21
             attributes = new AudioAttributes.Builder()
22
-                    .setAllowedCapturePolicy(AudioAttributes.ALLOW_CAPTURE_BY_NONE)
23
                     .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
22
                     .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
24
                     .setUsage(AudioAttributes.USAGE_NOTIFICATION_EVENT)
23
                     .setUsage(AudioAttributes.USAGE_NOTIFICATION_EVENT)
25
                     .build();
24
                     .build();

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

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

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

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