Ver código fonte

-Fixing and clean code

ilhamitubagoes 4 anos atrás
pai
commit
f11043b87f

+ 9 - 4
.idea/gradle.xml

@@ -1,15 +1,20 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <project version="4">
3
+  <component name="GradleMigrationSettings" migrationVersion="1" />
3 4
   <component name="GradleSettings">
4 5
     <option name="linkedExternalProjectsSettings">
5 6
       <GradleProjectSettings>
6
-        <compositeConfiguration>
7
-          <compositeBuild compositeDefinitionSource="SCRIPT" />
8
-        </compositeConfiguration>
7
+        <option name="delegatedBuild" value="false" />
8
+        <option name="testRunner" value="PLATFORM" />
9 9
         <option name="distributionType" value="DEFAULT_WRAPPED" />
10 10
         <option name="externalProjectPath" value="$PROJECT_DIR$" />
11
+        <option name="modules">
12
+          <set>
13
+            <option value="$PROJECT_DIR$" />
14
+            <option value="$PROJECT_DIR$/app" />
15
+          </set>
16
+        </option>
11 17
         <option name="resolveModulePerSourceSet" value="false" />
12
-        <option name="testRunner" value="PLATFORM" />
13 18
       </GradleProjectSettings>
14 19
     </option>
15 20
   </component>

+ 5 - 5
app/build.gradle

@@ -4,7 +4,7 @@ apply from: '../config/git-version.gradle'
4 4
 
5 5
 android {
6 6
     compileSdkVersion 29
7
-    buildToolsVersion "29.0.2"
7
+    buildToolsVersion "29.0.3"
8 8
     defaultConfig {
9 9
         applicationId "com.fusi24.rfid"
10 10
         minSdkVersion 21
@@ -62,18 +62,18 @@ dependencies {
62 62
     implementation 'com.squareup.retrofit2:converter-gson:2.6.0'
63 63
 
64 64
     //Circle Image
65
-    implementation 'de.hdodenhof:circleimageview:3.0.0'
65
+    implementation 'de.hdodenhof:circleimageview:3.1.0'
66 66
 
67 67
     //Glide Image Processing
68
-    implementation 'com.github.bumptech.glide:glide:4.10.0'
69
-    annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'
68
+    implementation 'com.github.bumptech.glide:glide:4.11.0'
69
+    annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
70 70
 
71 71
     //Serial Port
72 72
     implementation files('libs/serialport.jar')
73 73
     implementation files('libs/android-async-http-1.4.9.jar')
74 74
     implementation files('libs/httpclient-4.4.1.1.jar')
75 75
 
76
-    testImplementation 'junit:junit:4.12'
76
+    testImplementation 'junit:junit:4.13'
77 77
     androidTestImplementation 'androidx.test.ext:junit:1.1.1'
78 78
     androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
79 79
 }

+ 5 - 2
app/src/main/AndroidManifest.xml

@@ -11,9 +11,11 @@
11 11
         android:roundIcon="@drawable/logo_hse_autimation"
12 12
         android:supportsRtl="true"
13 13
         android:theme="@style/AppTheme">
14
-        <activity android:name=".ui.scanresult.ScanResultActivity"></activity>
14
+        <activity android:name=".ui.scanresult.ScanResultActivity"
15
+            android:screenOrientation="fullSensor"/>
15 16
         <activity
16 17
             android:name=".MainActivity"
18
+            android:screenOrientation="fullSensor"
17 19
             android:theme="@style/Theme.AppCompat.Light.NoActionBar">
18 20
             <intent-filter>
19 21
                 <action android:name="android.intent.action.MAIN" />
@@ -21,7 +23,8 @@
21 23
                 <category android:name="android.intent.category.LAUNCHER" />
22 24
             </intent-filter>
23 25
         </activity>
24
-        <activity android:name=".ui.ScanActivity" />
26
+        <activity android:name=".ui.ScanActivity"
27
+            android:screenOrientation="fullSensor"/>
25 28
     </application>
26 29
 
27 30
 </manifest>

+ 2 - 0
app/src/main/java/com/fusi24/rfid/MainActivity.java

@@ -27,6 +27,7 @@ import butterknife.ButterKnife;
27 27
 import retrofit2.Call;
28 28
 import retrofit2.Callback;
29 29
 import retrofit2.Response;
30
+import timber.log.Timber;
30 31
 
31 32
 public class MainActivity extends BaseActivity {
32 33
 
@@ -99,6 +100,7 @@ public class MainActivity extends BaseActivity {
99 100
             @Override
100 101
             public void onFailure(@NotNull Call<List<DataEntryPermit>> call, @NotNull Throwable t) {
101 102
                 Toast.makeText(MainActivity.this, "Failed to get data permit", Toast.LENGTH_SHORT).show();
103
+                Timber.i("DEVELOPER : %s", t.getMessage());
102 104
             }
103 105
         });
104 106
     }

+ 1 - 1
app/src/main/java/com/fusi24/rfid/adapter/ScanResultAdapter.java

@@ -37,7 +37,7 @@ public class ScanResultAdapter extends RecyclerView.Adapter<ScanResultAdapter.Vi
37 37
         setProblemsList(problemsList);
38 38
     }
39 39
 
40
-    class ViewHolder extends RecyclerView.ViewHolder {
40
+    static class ViewHolder extends RecyclerView.ViewHolder {
41 41
 
42 42
         @BindView(R.id.tv_document_name)
43 43
         TextView tvDocumentName;

+ 4 - 4
app/src/main/java/com/fusi24/rfid/config/Constant.java

@@ -20,7 +20,7 @@ public final class Constant {
20 20
     /*===================================================================================================*/
21 21
 
22 22
     //Direct ke BCUI
23
-    public final static String BASE_URL = "http://bcui2.fusi24.com";
23
+    /*public final static String BASE_URL = "http://bcui2.fusi24.com";
24 24
 
25 25
     public final static String BEATS_ENDPOINT = "/beats";
26 26
     public final static String BEATS2_ENDPOINT = "/beats2";
@@ -28,10 +28,10 @@ public final class Constant {
28 28
     public final static String SID2_ENDPOINT = "/sid2";
29 29
     public final static String RFID_ENDPOINT = "/rfid";
30 30
 
31
-    public static final String URL_PHOTO = BASE_URL + BEATS2_ENDPOINT + "/file?path=";
31
+    public static final String URL_PHOTO = BASE_URL + BEATS2_ENDPOINT + "/file?path=";*/
32 32
 
33 33
     //Direct ke Production
34
-    /*public final static String BASE_URL = "http://hseautomation.beraucoal.co.id";
34
+    public final static String BASE_URL = "http://hseautomation.beraucoal.co.id";
35 35
 
36 36
     public final static String BEATS_ENDPOINT = "/beats";
37 37
     public final static String BEATS2_ENDPOINT = "/beats2";
@@ -39,7 +39,7 @@ public final class Constant {
39 39
     public final static String SID2_ENDPOINT = "/sid2";
40 40
     public final static String RFID_ENDPOINT = "/rfid";
41 41
 
42
-    public static final String URL_PHOTO = BASE_URL + BEATS2_ENDPOINT + "/file?path=";*/
42
+    public static final String URL_PHOTO = BASE_URL + BEATS2_ENDPOINT + "/file?path=";
43 43
 
44 44
     /*===================================================================================================*/
45 45
 

+ 0 - 1
app/src/main/java/com/fusi24/rfid/data/api/RestServiceFactory.java

@@ -24,7 +24,6 @@ public class RestServiceFactory {
24 24
     private static RestService makeRestService(OkHttpClient okHttp, Gson gson) {
25 25
 
26 26
         Retrofit retrofit = new Retrofit.Builder()
27
-                //.baseUrl(Constant.BASE_URL)
28 27
                 .baseUrl(Constant.BASE_URL)
29 28
                 .client(okHttp)
30 29
                 .addConverterFactory(GsonConverterFactory.create(gson))

+ 0 - 36
app/src/main/java/com/fusi24/rfid/data/entity/DataCommon.java

@@ -1,36 +0,0 @@
1
-package com.fusi24.rfid.data.entity;
2
-
3
-import org.jetbrains.annotations.NotNull;
4
-
5
-public class DataCommon {
6
-
7
-    private Integer id;
8
-    private String name;
9
-
10
-    public DataCommon(Integer id, String name) {
11
-        this.id = id;
12
-        this.name = name;
13
-    }
14
-
15
-    public Integer getId() {
16
-        return id;
17
-    }
18
-
19
-    public void setId(Integer id) {
20
-        this.id = id;
21
-    }
22
-
23
-    public String getName() {
24
-        return name;
25
-    }
26
-
27
-    public void setName(String name) {
28
-        this.name = name;
29
-    }
30
-
31
-    @NotNull
32
-    @Override
33
-    public String toString() {
34
-        return name;
35
-    }
36
-}

+ 1 - 0
app/src/main/java/com/fusi24/rfid/ui/ScanActivity.java

@@ -56,6 +56,7 @@ public class ScanActivity extends LFScanProcessing {
56 56
         startActivityForResult(intent, 1);
57 57
     }
58 58
 
59
+    // This method for read chip number in the card
59 60
     @Override
60 61
     protected void onDataReceived(byte[] buffer, int size) {
61 62
         runOnUiThread(() -> {

+ 1 - 1
gradle/wrapper/gradle-wrapper.properties

@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
3 3
 distributionPath=wrapper/dists
4 4
 zipStoreBase=GRADLE_USER_HOME
5 5
 zipStorePath=wrapper/dists
6
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
6
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip