Browse Source

-Fixing and clean code

ilhamitubagoes 4 years ago
parent
commit
f11043b87f

+ 9 - 4
.idea/gradle.xml

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

+ 5 - 5
app/build.gradle

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

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

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

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

@@ -27,6 +27,7 @@ import butterknife.ButterKnife;
27
 import retrofit2.Call;
27
 import retrofit2.Call;
28
 import retrofit2.Callback;
28
 import retrofit2.Callback;
29
 import retrofit2.Response;
29
 import retrofit2.Response;
30
+import timber.log.Timber;
30
 
31
 
31
 public class MainActivity extends BaseActivity {
32
 public class MainActivity extends BaseActivity {
32
 
33
 
@@ -99,6 +100,7 @@ public class MainActivity extends BaseActivity {
99
             @Override
100
             @Override
100
             public void onFailure(@NotNull Call<List<DataEntryPermit>> call, @NotNull Throwable t) {
101
             public void onFailure(@NotNull Call<List<DataEntryPermit>> call, @NotNull Throwable t) {
101
                 Toast.makeText(MainActivity.this, "Failed to get data permit", Toast.LENGTH_SHORT).show();
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
         setProblemsList(problemsList);
37
         setProblemsList(problemsList);
38
     }
38
     }
39
 
39
 
40
-    class ViewHolder extends RecyclerView.ViewHolder {
40
+    static class ViewHolder extends RecyclerView.ViewHolder {
41
 
41
 
42
         @BindView(R.id.tv_document_name)
42
         @BindView(R.id.tv_document_name)
43
         TextView tvDocumentName;
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
     //Direct ke BCUI
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
     public final static String BEATS_ENDPOINT = "/beats";
25
     public final static String BEATS_ENDPOINT = "/beats";
26
     public final static String BEATS2_ENDPOINT = "/beats2";
26
     public final static String BEATS2_ENDPOINT = "/beats2";
@@ -28,10 +28,10 @@ public final class Constant {
28
     public final static String SID2_ENDPOINT = "/sid2";
28
     public final static String SID2_ENDPOINT = "/sid2";
29
     public final static String RFID_ENDPOINT = "/rfid";
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
     //Direct ke Production
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
     public final static String BEATS_ENDPOINT = "/beats";
36
     public final static String BEATS_ENDPOINT = "/beats";
37
     public final static String BEATS2_ENDPOINT = "/beats2";
37
     public final static String BEATS2_ENDPOINT = "/beats2";
@@ -39,7 +39,7 @@ public final class Constant {
39
     public final static String SID2_ENDPOINT = "/sid2";
39
     public final static String SID2_ENDPOINT = "/sid2";
40
     public final static String RFID_ENDPOINT = "/rfid";
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
     private static RestService makeRestService(OkHttpClient okHttp, Gson gson) {
24
     private static RestService makeRestService(OkHttpClient okHttp, Gson gson) {
25
 
25
 
26
         Retrofit retrofit = new Retrofit.Builder()
26
         Retrofit retrofit = new Retrofit.Builder()
27
-                //.baseUrl(Constant.BASE_URL)
28
                 .baseUrl(Constant.BASE_URL)
27
                 .baseUrl(Constant.BASE_URL)
29
                 .client(okHttp)
28
                 .client(okHttp)
30
                 .addConverterFactory(GsonConverterFactory.create(gson))
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
         startActivityForResult(intent, 1);
56
         startActivityForResult(intent, 1);
57
     }
57
     }
58
 
58
 
59
+    // This method for read chip number in the card
59
     @Override
60
     @Override
60
     protected void onDataReceived(byte[] buffer, int size) {
61
     protected void onDataReceived(byte[] buffer, int size) {
61
         runOnUiThread(() -> {
62
         runOnUiThread(() -> {

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

@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
3
 distributionPath=wrapper/dists
3
 distributionPath=wrapper/dists
4
 zipStoreBase=GRADLE_USER_HOME
4
 zipStoreBase=GRADLE_USER_HOME
5
 zipStorePath=wrapper/dists
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