ilhamitubagoes vor 5 Jahren
Commit
948974a796
81 geänderte Dateien mit 2491 neuen und 0 gelöschten Zeilen
  1. 14 0
      .gitignore
  2. 1 0
      .idea/.name
  3. 116 0
      .idea/codeStyles/Project.xml
  4. 16 0
      .idea/gradle.xml
  5. 9 0
      .idea/misc.xml
  6. 12 0
      .idea/runConfigurations.xml
  7. 1 0
      app/.gitignore
  8. 69 0
      app/build.gradle
  9. BIN
      app/libs/android-async-http-1.4.9.jar
  10. BIN
      app/libs/httpclient-4.4.1.1.jar
  11. BIN
      app/libs/serialport.jar
  12. 21 0
      app/proguard-rules.pro
  13. 27 0
      app/src/androidTest/java/com/fusi24/rfid/ExampleInstrumentedTest.java
  14. 27 0
      app/src/main/AndroidManifest.xml
  15. 74 0
      app/src/main/java/com/fusi24/rfid/MainActivity.java
  16. 89 0
      app/src/main/java/com/fusi24/rfid/adapter/ScanResultAdapter.java
  17. 45 0
      app/src/main/java/com/fusi24/rfid/base/BaseActivity.java
  18. 42 0
      app/src/main/java/com/fusi24/rfid/base/BasePresenter.java
  19. 7 0
      app/src/main/java/com/fusi24/rfid/base/BaseView.java
  20. 8 0
      app/src/main/java/com/fusi24/rfid/base/Presenter.java
  21. 44 0
      app/src/main/java/com/fusi24/rfid/config/Constant.java
  22. 20 0
      app/src/main/java/com/fusi24/rfid/data/DataManager.java
  23. 18 0
      app/src/main/java/com/fusi24/rfid/data/api/RestService.java
  24. 63 0
      app/src/main/java/com/fusi24/rfid/data/api/RestServiceFactory.java
  25. 36 0
      app/src/main/java/com/fusi24/rfid/data/model/DataCommon.java
  26. 32 0
      app/src/main/java/com/fusi24/rfid/data/model/DataCompany.java
  27. 41 0
      app/src/main/java/com/fusi24/rfid/data/model/DataDocumentType.java
  28. 77 0
      app/src/main/java/com/fusi24/rfid/data/model/DataEmployee.java
  29. 32 0
      app/src/main/java/com/fusi24/rfid/data/model/DataFunctionalPosition.java
  30. 34 0
      app/src/main/java/com/fusi24/rfid/data/model/DataProblems.java
  31. 43 0
      app/src/main/java/com/fusi24/rfid/data/model/DataResultRfid.java
  32. 32 0
      app/src/main/java/com/fusi24/rfid/data/model/DataStructuralPosition.java
  33. 67 0
      app/src/main/java/com/fusi24/rfid/ui/ScanActivity.java
  34. 158 0
      app/src/main/java/com/fusi24/rfid/ui/scanresult/ScanResultActivity.java
  35. 36 0
      app/src/main/java/com/fusi24/rfid/ui/scanresult/ScanResultPresenter.java
  36. 10 0
      app/src/main/java/com/fusi24/rfid/ui/scanresult/ScanResultView.java
  37. 25 0
      app/src/main/java/com/fusi24/rfid/util/DateHelper.java
  38. 37 0
      app/src/main/java/com/fusi24/rfid/util/LFScanProcessing.java
  39. 132 0
      app/src/main/java/com/fusi24/rfid/util/LFSerialPortActivity.java
  40. 18 0
      app/src/main/java/com/fusi24/rfid/util/PowerUtil.java
  41. BIN
      app/src/main/jniLibs/arm64-v8a/libserial_port.so
  42. BIN
      app/src/main/jniLibs/armeabi-v7a/libserial_port.so
  43. BIN
      app/src/main/jniLibs/armeabi/libserial_port.so
  44. BIN
      app/src/main/jniLibs/x86/libserial_port.so
  45. BIN
      app/src/main/jniLibs/x86_64/libserial_port.so
  46. 34 0
      app/src/main/res/drawable-v24/ic_launcher_foreground.xml
  47. 5 0
      app/src/main/res/drawable/bg_green.xml
  48. BIN
      app/src/main/res/drawable/chevron_down.png
  49. 18 0
      app/src/main/res/drawable/ic_dropdown_spinner.xml
  50. 170 0
      app/src/main/res/drawable/ic_launcher_background.xml
  51. BIN
      app/src/main/res/drawable/ic_profile_default.png
  52. BIN
      app/src/main/res/drawable/logo_hse_autimation.png
  53. 5 0
      app/src/main/res/drawable/my_btn_toggle.xml
  54. 87 0
      app/src/main/res/layout/activity_main.xml
  55. 37 0
      app/src/main/res/layout/activity_scan.xml
  56. 131 0
      app/src/main/res/layout/activity_scan_result.xml
  57. 38 0
      app/src/main/res/layout/row_document.xml
  58. 5 0
      app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
  59. 5 0
      app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
  60. BIN
      app/src/main/res/mipmap-hdpi/ic_launcher.png
  61. BIN
      app/src/main/res/mipmap-hdpi/ic_launcher_round.png
  62. BIN
      app/src/main/res/mipmap-mdpi/ic_launcher.png
  63. BIN
      app/src/main/res/mipmap-mdpi/ic_launcher_round.png
  64. BIN
      app/src/main/res/mipmap-xhdpi/ic_launcher.png
  65. BIN
      app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
  66. BIN
      app/src/main/res/mipmap-xxhdpi/ic_launcher.png
  67. BIN
      app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
  68. BIN
      app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
  69. BIN
      app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
  70. BIN
      app/src/main/res/raw/rfid_beep.ogg
  71. 17 0
      app/src/main/res/values/colors.xml
  72. 20 0
      app/src/main/res/values/strings.xml
  73. 58 0
      app/src/main/res/values/styles.xml
  74. 17 0
      app/src/test/java/com/fusi24/rfid/ExampleUnitTest.java
  75. 27 0
      build.gradle
  76. 20 0
      gradle.properties
  77. BIN
      gradle/wrapper/gradle-wrapper.jar
  78. 6 0
      gradle/wrapper/gradle-wrapper.properties
  79. 172 0
      gradlew
  80. 84 0
      gradlew.bat
  81. 2 0
      settings.gradle

+ 14 - 0
.gitignore

@@ -0,0 +1,14 @@
1
+*.iml
2
+.gradle
3
+/local.properties
4
+/.idea/caches
5
+/.idea/libraries
6
+/.idea/modules.xml
7
+/.idea/workspace.xml
8
+/.idea/navEditor.xml
9
+/.idea/assetWizardSettings.xml
10
+.DS_Store
11
+/build
12
+/captures
13
+.externalNativeBuild
14
+.cxx

+ 1 - 0
.idea/.name

@@ -0,0 +1 @@
1
+HSE-RFID

+ 116 - 0
.idea/codeStyles/Project.xml

@@ -0,0 +1,116 @@
1
+<component name="ProjectCodeStyleConfiguration">
2
+  <code_scheme name="Project" version="173">
3
+    <codeStyleSettings language="XML">
4
+      <indentOptions>
5
+        <option name="CONTINUATION_INDENT_SIZE" value="4" />
6
+      </indentOptions>
7
+      <arrangement>
8
+        <rules>
9
+          <section>
10
+            <rule>
11
+              <match>
12
+                <AND>
13
+                  <NAME>xmlns:android</NAME>
14
+                  <XML_ATTRIBUTE />
15
+                  <XML_NAMESPACE>^$</XML_NAMESPACE>
16
+                </AND>
17
+              </match>
18
+            </rule>
19
+          </section>
20
+          <section>
21
+            <rule>
22
+              <match>
23
+                <AND>
24
+                  <NAME>xmlns:.*</NAME>
25
+                  <XML_ATTRIBUTE />
26
+                  <XML_NAMESPACE>^$</XML_NAMESPACE>
27
+                </AND>
28
+              </match>
29
+              <order>BY_NAME</order>
30
+            </rule>
31
+          </section>
32
+          <section>
33
+            <rule>
34
+              <match>
35
+                <AND>
36
+                  <NAME>.*:id</NAME>
37
+                  <XML_ATTRIBUTE />
38
+                  <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
39
+                </AND>
40
+              </match>
41
+            </rule>
42
+          </section>
43
+          <section>
44
+            <rule>
45
+              <match>
46
+                <AND>
47
+                  <NAME>.*:name</NAME>
48
+                  <XML_ATTRIBUTE />
49
+                  <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
50
+                </AND>
51
+              </match>
52
+            </rule>
53
+          </section>
54
+          <section>
55
+            <rule>
56
+              <match>
57
+                <AND>
58
+                  <NAME>name</NAME>
59
+                  <XML_ATTRIBUTE />
60
+                  <XML_NAMESPACE>^$</XML_NAMESPACE>
61
+                </AND>
62
+              </match>
63
+            </rule>
64
+          </section>
65
+          <section>
66
+            <rule>
67
+              <match>
68
+                <AND>
69
+                  <NAME>style</NAME>
70
+                  <XML_ATTRIBUTE />
71
+                  <XML_NAMESPACE>^$</XML_NAMESPACE>
72
+                </AND>
73
+              </match>
74
+            </rule>
75
+          </section>
76
+          <section>
77
+            <rule>
78
+              <match>
79
+                <AND>
80
+                  <NAME>.*</NAME>
81
+                  <XML_ATTRIBUTE />
82
+                  <XML_NAMESPACE>^$</XML_NAMESPACE>
83
+                </AND>
84
+              </match>
85
+              <order>BY_NAME</order>
86
+            </rule>
87
+          </section>
88
+          <section>
89
+            <rule>
90
+              <match>
91
+                <AND>
92
+                  <NAME>.*</NAME>
93
+                  <XML_ATTRIBUTE />
94
+                  <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
95
+                </AND>
96
+              </match>
97
+              <order>ANDROID_ATTRIBUTE_ORDER</order>
98
+            </rule>
99
+          </section>
100
+          <section>
101
+            <rule>
102
+              <match>
103
+                <AND>
104
+                  <NAME>.*</NAME>
105
+                  <XML_ATTRIBUTE />
106
+                  <XML_NAMESPACE>.*</XML_NAMESPACE>
107
+                </AND>
108
+              </match>
109
+              <order>BY_NAME</order>
110
+            </rule>
111
+          </section>
112
+        </rules>
113
+      </arrangement>
114
+    </codeStyleSettings>
115
+  </code_scheme>
116
+</component>

+ 16 - 0
.idea/gradle.xml

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

+ 9 - 0
.idea/misc.xml

@@ -0,0 +1,9 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
4
+    <output url="file://$PROJECT_DIR$/build/classes" />
5
+  </component>
6
+  <component name="ProjectType">
7
+    <option name="id" value="Android" />
8
+  </component>
9
+</project>

+ 12 - 0
.idea/runConfigurations.xml

@@ -0,0 +1,12 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="RunConfigurationProducerService">
4
+    <option name="ignoredProducers">
5
+      <set>
6
+        <option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
7
+        <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
8
+        <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
9
+      </set>
10
+    </option>
11
+  </component>
12
+</project>

+ 1 - 0
app/.gitignore

@@ -0,0 +1 @@
1
+/build

+ 69 - 0
app/build.gradle

@@ -0,0 +1,69 @@
1
+apply plugin: 'com.android.application'
2
+
3
+android {
4
+    compileSdkVersion 29
5
+    buildToolsVersion "29.0.2"
6
+    defaultConfig {
7
+        applicationId "com.fusi24.rfid"
8
+        minSdkVersion 21
9
+        targetSdkVersion 29
10
+        versionCode 1
11
+        versionName "1.0"
12
+        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
13
+    }
14
+    buildTypes {
15
+        release {
16
+            minifyEnabled false
17
+            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
18
+        }
19
+    }
20
+    compileOptions {
21
+        sourceCompatibility JavaVersion.VERSION_1_8
22
+        targetCompatibility JavaVersion.VERSION_1_8
23
+    }
24
+}
25
+
26
+dependencies {
27
+    implementation fileTree(dir: 'libs', include: ['*.jar'])
28
+    implementation 'androidx.appcompat:appcompat:1.1.0'
29
+    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
30
+    implementation "androidx.recyclerview:recyclerview:1.1.0"
31
+
32
+    //BUTTER KNIFE
33
+    implementation 'com.jakewharton:butterknife:10.0.0'
34
+    annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
35
+
36
+    //Timber
37
+    implementation 'com.jakewharton.timber:timber:4.7.1'
38
+
39
+    //RX JAVA
40
+    implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
41
+    implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
42
+
43
+    //GSON
44
+    implementation 'com.google.code.gson:gson:2.8.5'
45
+
46
+    //OKHTTP
47
+    implementation 'com.squareup.okio:okio:2.1.0'
48
+    implementation 'com.squareup.okhttp3:okhttp:3.12.0'
49
+    implementation 'com.squareup.okhttp3:logging-interceptor:3.11.0'
50
+
51
+    //RETROFIT
52
+    implementation 'com.squareup.retrofit2:converter-gson:2.6.0'
53
+
54
+    //Circle Image
55
+    implementation 'de.hdodenhof:circleimageview:3.0.0'
56
+
57
+    //Glide Image Processing
58
+    implementation 'com.github.bumptech.glide:glide:4.10.0'
59
+    annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'
60
+
61
+    //Serial Port
62
+    implementation files('libs/serialport.jar')
63
+    implementation files('libs/android-async-http-1.4.9.jar')
64
+    implementation files('libs/httpclient-4.4.1.1.jar')
65
+
66
+    testImplementation 'junit:junit:4.12'
67
+    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
68
+    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
69
+}

BIN
app/libs/android-async-http-1.4.9.jar


BIN
app/libs/httpclient-4.4.1.1.jar


BIN
app/libs/serialport.jar


+ 21 - 0
app/proguard-rules.pro

@@ -0,0 +1,21 @@
1
+# Add project specific ProGuard rules here.
2
+# You can control the set of applied configuration files using the
3
+# proguardFiles setting in build.gradle.
4
+#
5
+# For more details, see
6
+#   http://developer.android.com/guide/developing/tools/proguard.html
7
+
8
+# If your project uses WebView with JS, uncomment the following
9
+# and specify the fully qualified class name to the JavaScript interface
10
+# class:
11
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12
+#   public *;
13
+#}
14
+
15
+# Uncomment this to preserve the line number information for
16
+# debugging stack traces.
17
+#-keepattributes SourceFile,LineNumberTable
18
+
19
+# If you keep the line number information, uncomment this to
20
+# hide the original source file name.
21
+#-renamesourcefileattribute SourceFile

+ 27 - 0
app/src/androidTest/java/com/fusi24/rfid/ExampleInstrumentedTest.java

@@ -0,0 +1,27 @@
1
+package com.fusi24.rfid;
2
+
3
+import android.content.Context;
4
+
5
+import androidx.test.platform.app.InstrumentationRegistry;
6
+import androidx.test.ext.junit.runners.AndroidJUnit4;
7
+
8
+import org.junit.Test;
9
+import org.junit.runner.RunWith;
10
+
11
+import static org.junit.Assert.*;
12
+
13
+/**
14
+ * Instrumented test, which will execute on an Android device.
15
+ *
16
+ * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
17
+ */
18
+@RunWith(AndroidJUnit4.class)
19
+public class ExampleInstrumentedTest {
20
+    @Test
21
+    public void useAppContext() {
22
+        // Context of the app under test.
23
+        Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
24
+
25
+        assertEquals("com.fusi24.rfid", appContext.getPackageName());
26
+    }
27
+}

+ 27 - 0
app/src/main/AndroidManifest.xml

@@ -0,0 +1,27 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
+    package="com.fusi24.rfid">
4
+
5
+    <uses-permission android:name="android.permission.INTERNET" />
6
+
7
+    <application
8
+        android:allowBackup="true"
9
+        android:icon="@mipmap/ic_launcher"
10
+        android:label="@string/app_name"
11
+        android:roundIcon="@mipmap/ic_launcher_round"
12
+        android:supportsRtl="true"
13
+        android:theme="@style/AppTheme">
14
+        <activity android:name=".ui.scanresult.ScanResultActivity"></activity>
15
+        <activity
16
+            android:name=".MainActivity"
17
+            android:theme="@style/Theme.AppCompat.Light.NoActionBar">
18
+            <intent-filter>
19
+                <action android:name="android.intent.action.MAIN" />
20
+
21
+                <category android:name="android.intent.category.LAUNCHER" />
22
+            </intent-filter>
23
+        </activity>
24
+        <activity android:name=".ui.ScanActivity" />
25
+    </application>
26
+
27
+</manifest>

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

@@ -0,0 +1,74 @@
1
+package com.fusi24.rfid;
2
+
3
+import android.content.Intent;
4
+import android.os.Bundle;
5
+import android.widget.ArrayAdapter;
6
+import android.widget.Button;
7
+import android.widget.Spinner;
8
+
9
+import androidx.appcompat.app.AppCompatActivity;
10
+
11
+import com.fusi24.rfid.data.model.DataCommon;
12
+import com.fusi24.rfid.ui.ScanActivity;
13
+
14
+import java.util.ArrayList;
15
+
16
+import butterknife.BindView;
17
+import butterknife.ButterKnife;
18
+
19
+public class MainActivity extends AppCompatActivity {
20
+
21
+    @BindView(R.id.btn_scan)
22
+    Button btnScan;
23
+    @BindView(R.id.spinner_site)
24
+    Spinner spinnerSite;
25
+    @BindView(R.id.spinner_permit)
26
+    Spinner spinnerPermit;
27
+
28
+    @Override
29
+    protected void onCreate(Bundle savedInstanceState) {
30
+        super.onCreate(savedInstanceState);
31
+        setContentView(R.layout.activity_main);
32
+        ButterKnife.bind(this);
33
+
34
+        setDataSite();
35
+        setDataPermit();
36
+
37
+        initEvent();
38
+    }
39
+
40
+    private void initEvent(){
41
+        btnScan.setOnClickListener(v -> {
42
+            Intent intent = new Intent(this, ScanActivity.class);
43
+            startActivity(intent);
44
+        });
45
+    }
46
+
47
+    private void setDataSite(){
48
+        ArrayList<DataCommon> siteList = new ArrayList<>();
49
+
50
+        siteList.add(new DataCommon(111, "HO"));
51
+        siteList.add(new DataCommon(112, "BMO 1"));
52
+        siteList.add(new DataCommon(113, "BMO 2"));
53
+        siteList.add(new DataCommon(114, "LMO"));
54
+        siteList.add(new DataCommon(115, "SMO"));
55
+        siteList.add(new DataCommon(116, "MARINE"));
56
+        siteList.add(new DataCommon(117, "EKSPLORASI"));
57
+        siteList.add(new DataCommon(118, "JAKARTA"));
58
+
59
+        ArrayAdapter<DataCommon> adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, siteList);
60
+        spinnerSite.setAdapter(adapter);
61
+    }
62
+
63
+    private void setDataPermit(){
64
+        ArrayList<DataCommon> permitList = new ArrayList<>();
65
+
66
+        permitList.add(new DataCommon(1, "ID CARD"));
67
+        permitList.add(new DataCommon(2, "VISITOR"));
68
+        permitList.add(new DataCommon(3, "MAGANG"));
69
+
70
+        ArrayAdapter<DataCommon> adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, permitList);
71
+        spinnerPermit.setAdapter(adapter);
72
+    }
73
+
74
+}

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

@@ -0,0 +1,89 @@
1
+package com.fusi24.rfid.adapter;
2
+
3
+import android.content.Context;
4
+import android.view.LayoutInflater;
5
+import android.view.View;
6
+import android.view.ViewGroup;
7
+import android.widget.TextView;
8
+
9
+import androidx.annotation.NonNull;
10
+import androidx.recyclerview.widget.RecyclerView;
11
+
12
+import com.fusi24.rfid.R;
13
+import com.fusi24.rfid.data.model.DataProblems;
14
+import com.fusi24.rfid.util.DateHelper;
15
+import com.google.gson.Gson;
16
+
17
+import java.util.ArrayList;
18
+import java.util.List;
19
+
20
+import butterknife.BindView;
21
+import butterknife.ButterKnife;
22
+
23
+public class ScanResultAdapter extends RecyclerView.Adapter<ScanResultAdapter.ViewHolder>{
24
+
25
+    private Context context;
26
+    private List<DataProblems> problemsList;
27
+    private Gson gson = new Gson();
28
+
29
+    public ScanResultAdapter(Context context) {
30
+        this.context = context;
31
+        this.problemsList = new ArrayList<>();
32
+    }
33
+
34
+    public List<DataProblems> getProblemsList() {
35
+        return problemsList;
36
+    }
37
+
38
+    public void setProblemsList(List<DataProblems> problemsList) {
39
+        this.problemsList = problemsList;
40
+    }
41
+
42
+    public void updateProblemList(List<DataProblems> problemsList){
43
+        setProblemsList(problemsList);
44
+    }
45
+
46
+    class ViewHolder extends RecyclerView.ViewHolder {
47
+
48
+        @BindView(R.id.tv_document_name)
49
+        TextView tvDocumentName;
50
+        @BindView(R.id.tv_document_status)
51
+        TextView tvDocumentStatus;
52
+        @BindView(R.id.tv_document_date)
53
+        TextView tvDocumentDate;
54
+
55
+        ViewHolder(View itemView) {
56
+            super(itemView);
57
+            ButterKnife.bind(this, itemView);
58
+        }
59
+    }
60
+
61
+
62
+    @NonNull
63
+    @Override
64
+    public ScanResultAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
65
+        View itemView = LayoutInflater.from(context)
66
+                .inflate(R.layout.row_document, parent, false);
67
+        return new ViewHolder(itemView);
68
+    }
69
+
70
+    @Override
71
+    public void onBindViewHolder(@NonNull ScanResultAdapter.ViewHolder holder, int position) {
72
+
73
+        System.out.println("DEVELOPER 3 : " + gson.toJson(problemsList));
74
+
75
+        DataProblems problems = problemsList.get(position);
76
+
77
+        System.out.println("DEVELOPER 4 : " + gson.toJson(problems));
78
+
79
+        holder.tvDocumentName.setText(problems.getDataDocumentType().getName());
80
+        holder.tvDocumentStatus.setText(problems.getReason());
81
+        holder.tvDocumentDate.setText(DateHelper.convertDateToReadableDate(problems.getDataDocumentType().getUpdateDate()));
82
+
83
+    }
84
+
85
+    @Override
86
+    public int getItemCount() {
87
+        return problemsList.size();
88
+    }
89
+}

+ 45 - 0
app/src/main/java/com/fusi24/rfid/base/BaseActivity.java

@@ -0,0 +1,45 @@
1
+package com.fusi24.rfid.base;
2
+
3
+import androidx.appcompat.app.AppCompatActivity;
4
+
5
+import com.fusi24.rfid.config.Constant;
6
+import com.fusi24.rfid.data.DataManager;
7
+import com.fusi24.rfid.data.api.RestService;
8
+import com.fusi24.rfid.data.api.RestServiceFactory;
9
+
10
+import io.reactivex.Scheduler;
11
+import io.reactivex.android.schedulers.AndroidSchedulers;
12
+import io.reactivex.schedulers.Schedulers;
13
+
14
+public abstract class BaseActivity extends AppCompatActivity {
15
+
16
+    private RestService restService;
17
+    private DataManager manager;
18
+
19
+    public RestService getRestService() {
20
+        if (restService == null) {
21
+            restService = RestServiceFactory.create(getJwtToken());
22
+        }
23
+        return restService;
24
+    }
25
+
26
+    public DataManager getManager() {
27
+        if (manager == null) {
28
+            manager = new DataManager(getRestService());
29
+        }
30
+        return manager;
31
+    }
32
+
33
+    protected Scheduler getAndroidScheduler() {
34
+        return AndroidSchedulers.mainThread();
35
+    }
36
+
37
+    protected Scheduler getProcessScheduler() {
38
+        return Schedulers.io();
39
+    }
40
+
41
+    private String getJwtToken() {
42
+        return Constant.JWT_TOKEN;
43
+    }
44
+
45
+}

+ 42 - 0
app/src/main/java/com/fusi24/rfid/base/BasePresenter.java

@@ -0,0 +1,42 @@
1
+package com.fusi24.rfid.base;
2
+
3
+import io.reactivex.disposables.CompositeDisposable;
4
+
5
+public class BasePresenter<T extends BaseView> implements Presenter<T> {
6
+
7
+    protected CompositeDisposable disposable;
8
+
9
+    private T view;
10
+
11
+    @Override
12
+    public void attachView(T view) {
13
+        this.view = view;
14
+        this.disposable = new CompositeDisposable();
15
+    }
16
+
17
+    @Override
18
+    public void detachView() {
19
+        this.view = null;
20
+        this.disposable.clear();
21
+    }
22
+
23
+    protected boolean isViewAttached() {
24
+        return view != null;
25
+    }
26
+
27
+    protected T getView() {
28
+        return view;
29
+    }
30
+
31
+    public void checkViewAttached() {
32
+        if (!isViewAttached()) throw new BaseViewNotAttachedException();
33
+    }
34
+
35
+    protected static class BaseViewNotAttachedException extends RuntimeException {
36
+
37
+        BaseViewNotAttachedException() {
38
+            super("Please call Presenter.attachView(MvpView) before" +
39
+                    " requesting data to the Presenter");
40
+        }
41
+    }
42
+}

+ 7 - 0
app/src/main/java/com/fusi24/rfid/base/BaseView.java

@@ -0,0 +1,7 @@
1
+package com.fusi24.rfid.base;
2
+
3
+public interface BaseView {
4
+
5
+    void showError(Throwable e);
6
+
7
+}

+ 8 - 0
app/src/main/java/com/fusi24/rfid/base/Presenter.java

@@ -0,0 +1,8 @@
1
+package com.fusi24.rfid.base;
2
+
3
+public interface Presenter<V extends BaseView> {
4
+
5
+    void attachView(V view);
6
+
7
+    void detachView();
8
+}

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

@@ -0,0 +1,44 @@
1
+package com.fusi24.rfid.config;
2
+
3
+public final class Constant {
4
+
5
+    /*===================================================================================================*/
6
+
7
+    public static final String JWT_TOKEN = "eyJhbGciOiJIUzI1NiJ9.eyJpZEthcnlhd2FuIjo0Mzg4NCwiaWQiOjIsImVtYWlsIjoiYXJpZi53aWR5YUBiZXJhdWNvYWwuY28uaWQiLCJ1c2VybmFtZSI6IkxTREVWIn0.ZgYBPYZgx5CdJAMm29T6_0Es5C199PULqOfwMwdGFz8";
8
+    public final static Integer BAUTRATE = 9600;
9
+
10
+    /*===================================================================================================*/
11
+
12
+    // API < 3.0
13
+    public final static String PATH = "/dev/ttyS2";
14
+    public final static String PATHNAME = "/proc/gpiocontrol/set_id";
15
+
16
+    // API 3.0
17
+    /*public final static String PATH = "/dev/ttyS3"; // Untuk versi 3.0
18
+    public final static String PATHNAME = "/proc/gpiocontrol/set_sam"; // untuk versi 3.0*/
19
+
20
+    /*===================================================================================================*/
21
+
22
+    //Direct ke BCUI
23
+    public final static String BASE_URL = "http://bcui2.fusi24.com";
24
+
25
+    public final static String BEATS_ENDPOINT = "/beats";
26
+    public final static String BEATS2_ENDPOINT = "/beats2";
27
+    public final static String SID_ENDPOINT = "/sid";
28
+    public final static String RFID_ENDPOINT = "/rfid";
29
+
30
+    public static final String URL_PHOTO = BASE_URL + BEATS2_ENDPOINT + "/file?path=";
31
+
32
+    //Direct ke Production
33
+    /*public final static String BASE_URL = "http://hseautomation.beraucoal.co.id";
34
+
35
+    public final static String BEATS_ENDPOINT = "/beats";
36
+    public final static String BEATS2_ENDPOINT = "/beats2";
37
+    public final static String SID_ENDPOINT = "/sid";
38
+    public final static String RFID_ENDPOINT = "/rfid";
39
+
40
+    public static final String URL_PHOTO = BASE_URL + BEATS2_ENDPOINT + "/file?path=";*/
41
+
42
+    /*===================================================================================================*/
43
+
44
+}

+ 20 - 0
app/src/main/java/com/fusi24/rfid/data/DataManager.java

@@ -0,0 +1,20 @@
1
+package com.fusi24.rfid.data;
2
+
3
+import com.fusi24.rfid.data.api.RestService;
4
+import com.fusi24.rfid.data.model.DataResultRfid;
5
+
6
+import io.reactivex.Observable;
7
+
8
+public class DataManager {
9
+
10
+    private RestService restService;
11
+
12
+    public DataManager(RestService restService) {
13
+        this.restService = restService;
14
+    }
15
+
16
+    public Observable<DataResultRfid> checkRfidCard(String numberRfid, Integer permitId, String[] expand) {
17
+        return restService.checkRfidCard(numberRfid, permitId, expand);
18
+    }
19
+
20
+}

+ 18 - 0
app/src/main/java/com/fusi24/rfid/data/api/RestService.java

@@ -0,0 +1,18 @@
1
+package com.fusi24.rfid.data.api;
2
+
3
+import com.fusi24.rfid.config.Constant;
4
+import com.fusi24.rfid.data.model.DataResultRfid;
5
+
6
+import io.reactivex.Observable;
7
+import retrofit2.http.GET;
8
+import retrofit2.http.Path;
9
+import retrofit2.http.Query;
10
+
11
+public interface RestService {
12
+
13
+    @GET(Constant.RFID_ENDPOINT + "/permit/check/{number_rfid}")
14
+    Observable<DataResultRfid> checkRfidCard(@Path("number_rfid") String numberRfid,
15
+                                             @Query("entryPermitId") Integer permitId,
16
+                                             @Query("expand") String[] expand);
17
+
18
+}

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

@@ -0,0 +1,63 @@
1
+package com.fusi24.rfid.data.api;
2
+
3
+import androidx.annotation.NonNull;
4
+
5
+import com.fusi24.rfid.BuildConfig;
6
+import com.google.gson.Gson;
7
+import com.google.gson.GsonBuilder;
8
+
9
+import okhttp3.OkHttpClient;
10
+import okhttp3.Request;
11
+import okhttp3.logging.HttpLoggingInterceptor;
12
+import retrofit2.Retrofit;
13
+import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
14
+import retrofit2.converter.gson.GsonConverterFactory;
15
+
16
+public class RestServiceFactory {
17
+
18
+    public static RestService create(String token) {
19
+        OkHttpClient client = makeClientService(makeLoggingInterceptor(), token);
20
+        return makeRestService(client, makeGson());
21
+    }
22
+
23
+    private static RestService makeRestService(OkHttpClient okHttp, Gson gson) {
24
+
25
+        Retrofit retrofit = new Retrofit.Builder()
26
+                //.baseUrl(Constant.BASE_URL)
27
+                .baseUrl("http://192.168.12.129:40002")
28
+                .client(okHttp)
29
+                .addConverterFactory(GsonConverterFactory.create(gson))
30
+                .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
31
+                .build();
32
+        return retrofit.create(RestService.class);
33
+    }
34
+
35
+    @NonNull
36
+    private static OkHttpClient makeClientService(
37
+            HttpLoggingInterceptor loggingInterceptor, String token) {
38
+        return new OkHttpClient.Builder()
39
+                .addInterceptor(chain -> {
40
+                    Request.Builder ongoing = chain.request().newBuilder();
41
+                    ongoing.addHeader("Content-Type", "application/json");
42
+                    ongoing.addHeader("x-api-key", token);
43
+                    return chain.proceed(ongoing.build());
44
+                })
45
+                .addInterceptor(loggingInterceptor)
46
+                .build();
47
+    }
48
+
49
+    @NonNull
50
+    private static HttpLoggingInterceptor makeLoggingInterceptor() {
51
+        return new HttpLoggingInterceptor()
52
+                .setLevel(BuildConfig.DEBUG ? HttpLoggingInterceptor.Level.BODY
53
+                        : HttpLoggingInterceptor.Level.NONE);
54
+    }
55
+
56
+    @NonNull
57
+    private static Gson makeGson() {
58
+        return new GsonBuilder()
59
+                .setDateFormat("yyyy-MM-dd HH:mm:ss")
60
+                .create();
61
+    }
62
+
63
+}

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

@@ -0,0 +1,36 @@
1
+package com.fusi24.rfid.data.model;
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
+}

+ 32 - 0
app/src/main/java/com/fusi24/rfid/data/model/DataCompany.java

@@ -0,0 +1,32 @@
1
+package com.fusi24.rfid.data.model;
2
+
3
+public class DataCompany {
4
+
5
+    private Integer id;
6
+    private String code;
7
+    private String name;
8
+
9
+    public Integer getId() {
10
+        return id;
11
+    }
12
+
13
+    public void setId(Integer id) {
14
+        this.id = id;
15
+    }
16
+
17
+    public String getCode() {
18
+        return code;
19
+    }
20
+
21
+    public void setCode(String code) {
22
+        this.code = code;
23
+    }
24
+
25
+    public String getName() {
26
+        return name;
27
+    }
28
+
29
+    public void setName(String name) {
30
+        this.name = name;
31
+    }
32
+}

+ 41 - 0
app/src/main/java/com/fusi24/rfid/data/model/DataDocumentType.java

@@ -0,0 +1,41 @@
1
+package com.fusi24.rfid.data.model;
2
+
3
+public class DataDocumentType {
4
+
5
+    private Integer id;
6
+    private String name;
7
+    private String description;
8
+    private String updateDate;
9
+
10
+    public Integer getId() {
11
+        return id;
12
+    }
13
+
14
+    public void setId(Integer id) {
15
+        this.id = id;
16
+    }
17
+
18
+    public String getName() {
19
+        return name;
20
+    }
21
+
22
+    public void setName(String name) {
23
+        this.name = name;
24
+    }
25
+
26
+    public String getDescription() {
27
+        return description;
28
+    }
29
+
30
+    public void setDescription(String description) {
31
+        this.description = description;
32
+    }
33
+
34
+    public String getUpdateDate() {
35
+        return updateDate;
36
+    }
37
+
38
+    public void setUpdateDate(String updateDate) {
39
+        this.updateDate = updateDate;
40
+    }
41
+}

+ 77 - 0
app/src/main/java/com/fusi24/rfid/data/model/DataEmployee.java

@@ -0,0 +1,77 @@
1
+package com.fusi24.rfid.data.model;
2
+
3
+public class DataEmployee {
4
+
5
+    private Integer id;
6
+    private String code;
7
+    private String sidCode;
8
+    private String name;
9
+    private String urlPhoto;
10
+    private DataCompany company;
11
+    private DataStructuralPosition structuralPosition;
12
+    private DataFunctionalPosition functionalPosition;
13
+
14
+    public Integer getId() {
15
+        return id;
16
+    }
17
+
18
+    public void setId(Integer id) {
19
+        this.id = id;
20
+    }
21
+
22
+    public String getCode() {
23
+        return code;
24
+    }
25
+
26
+    public void setCode(String code) {
27
+        this.code = code;
28
+    }
29
+
30
+    public String getSidCode() {
31
+        return sidCode;
32
+    }
33
+
34
+    public void setSidCode(String sidCode) {
35
+        this.sidCode = sidCode;
36
+    }
37
+
38
+    public String getName() {
39
+        return name;
40
+    }
41
+
42
+    public void setName(String name) {
43
+        this.name = name;
44
+    }
45
+
46
+    public String getUrlPhoto() {
47
+        return urlPhoto;
48
+    }
49
+
50
+    public void setUrlPhoto(String urlPhoto) {
51
+        this.urlPhoto = urlPhoto;
52
+    }
53
+
54
+    public DataCompany getCompany() {
55
+        return company;
56
+    }
57
+
58
+    public void setCompany(DataCompany company) {
59
+        this.company = company;
60
+    }
61
+
62
+    public DataStructuralPosition getStructuralPosition() {
63
+        return structuralPosition;
64
+    }
65
+
66
+    public void setStructuralPosition(DataStructuralPosition structuralPosition) {
67
+        this.structuralPosition = structuralPosition;
68
+    }
69
+
70
+    public DataFunctionalPosition getFunctionalPosition() {
71
+        return functionalPosition;
72
+    }
73
+
74
+    public void setFunctionalPosition(DataFunctionalPosition functionalPosition) {
75
+        this.functionalPosition = functionalPosition;
76
+    }
77
+}

+ 32 - 0
app/src/main/java/com/fusi24/rfid/data/model/DataFunctionalPosition.java

@@ -0,0 +1,32 @@
1
+package com.fusi24.rfid.data.model;
2
+
3
+public class DataFunctionalPosition {
4
+
5
+    private Integer id;
6
+    private String name;
7
+    private String description;
8
+
9
+    public Integer getId() {
10
+        return id;
11
+    }
12
+
13
+    public void setId(Integer id) {
14
+        this.id = id;
15
+    }
16
+
17
+    public String getName() {
18
+        return name;
19
+    }
20
+
21
+    public void setName(String name) {
22
+        this.name = name;
23
+    }
24
+
25
+    public String getDescription() {
26
+        return description;
27
+    }
28
+
29
+    public void setDescription(String description) {
30
+        this.description = description;
31
+    }
32
+}

+ 34 - 0
app/src/main/java/com/fusi24/rfid/data/model/DataProblems.java

@@ -0,0 +1,34 @@
1
+package com.fusi24.rfid.data.model;
2
+
3
+import java.io.Serializable;
4
+
5
+public class DataProblems implements Serializable {
6
+
7
+    private DataDocumentType documentType;
8
+    private String reason;
9
+    private String expiryDate;
10
+
11
+    public DataDocumentType getDataDocumentType() {
12
+        return documentType;
13
+    }
14
+
15
+    public void setDataDocumentType(DataDocumentType documentType) {
16
+        this.documentType = documentType;
17
+    }
18
+
19
+    public String getReason() {
20
+        return reason;
21
+    }
22
+
23
+    public void setReason(String reason) {
24
+        this.reason = reason;
25
+    }
26
+
27
+    public String getExpiryDate() {
28
+        return expiryDate;
29
+    }
30
+
31
+    public void setExpiryDate(String expiryDate) {
32
+        this.expiryDate = expiryDate;
33
+    }
34
+}

+ 43 - 0
app/src/main/java/com/fusi24/rfid/data/model/DataResultRfid.java

@@ -0,0 +1,43 @@
1
+package com.fusi24.rfid.data.model;
2
+
3
+import java.util.List;
4
+
5
+public class DataResultRfid {
6
+
7
+    private DataEmployee employee;
8
+    private Boolean passed;
9
+    private String message;
10
+    private List<DataProblems> problems;
11
+
12
+    public DataEmployee getEmployee() {
13
+        return employee;
14
+    }
15
+
16
+    public void setEmployee(DataEmployee employee) {
17
+        this.employee = employee;
18
+    }
19
+
20
+    public Boolean getPassed() {
21
+        return passed;
22
+    }
23
+
24
+    public void setPassed(Boolean passed) {
25
+        this.passed = passed;
26
+    }
27
+
28
+    public String getMessage() {
29
+        return message;
30
+    }
31
+
32
+    public void setMessage(String message) {
33
+        this.message = message;
34
+    }
35
+
36
+    public List<DataProblems> getProblems() {
37
+        return problems;
38
+    }
39
+
40
+    public void setProblems(List<DataProblems> problems) {
41
+        this.problems = problems;
42
+    }
43
+}

+ 32 - 0
app/src/main/java/com/fusi24/rfid/data/model/DataStructuralPosition.java

@@ -0,0 +1,32 @@
1
+package com.fusi24.rfid.data.model;
2
+
3
+public class DataStructuralPosition {
4
+
5
+    private Integer id;
6
+    private String name;
7
+    private String description;
8
+
9
+    public Integer getId() {
10
+        return id;
11
+    }
12
+
13
+    public void setId(Integer id) {
14
+        this.id = id;
15
+    }
16
+
17
+    public String getName() {
18
+        return name;
19
+    }
20
+
21
+    public void setName(String name) {
22
+        this.name = name;
23
+    }
24
+
25
+    public String getDescription() {
26
+        return description;
27
+    }
28
+
29
+    public void setDescription(String description) {
30
+        this.description = description;
31
+    }
32
+}

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

@@ -0,0 +1,67 @@
1
+package com.fusi24.rfid.ui;
2
+
3
+import android.content.Intent;
4
+import android.os.Bundle;
5
+import android.widget.ToggleButton;
6
+
7
+import com.fusi24.rfid.R;
8
+import com.fusi24.rfid.ui.scanresult.ScanResultActivity;
9
+import com.fusi24.rfid.util.LFScanProcessing;
10
+
11
+import butterknife.BindView;
12
+import butterknife.ButterKnife;
13
+import butterknife.OnCheckedChanged;
14
+import timber.log.Timber;
15
+
16
+public class ScanActivity extends LFScanProcessing {
17
+
18
+    @BindView(R.id.toggle_scan)
19
+    ToggleButton toggleScan;
20
+
21
+    @Override
22
+    protected void onCreate(Bundle savedInstanceState) {
23
+        super.onCreate(savedInstanceState);
24
+        setContentView(R.layout.activity_scan);
25
+        ButterKnife.bind(this);
26
+        initSound();
27
+    }
28
+
29
+    @OnCheckedChanged(R.id.toggle_scan)
30
+    public void statusScanner(){
31
+        if(toggleScan.isChecked()){
32
+            onStart();
33
+        } else
34
+            onStop();
35
+    }
36
+
37
+    void startInstance(String reception){
38
+        Intent intent = new Intent(this, ScanResultActivity.class);
39
+        intent.putExtra("reception", reception); //Optional parameters
40
+        startActivityForResult(intent, 1);
41
+    }
42
+
43
+    @Override
44
+    protected void onDataReceived(byte[] buffer, int size) {
45
+        runOnUiThread(() -> {
46
+            if (stringReception != null) {
47
+                if (size > 0) {
48
+                    if (size >= 5) {
49
+                        byte[] tempBuf = new byte[size - 4];
50
+                        System.arraycopy(buffer, 4, tempBuf, 0, size - 4);//discard 4 bit
51
+                        String temStr = new String(tempBuf);
52
+                        int temInt = Integer.parseInt(temStr, 16);
53
+                        soundpool.play(soundid, 1, 1, 0, 0, 1);
54
+                        stringReception = Integer.toString(temInt);
55
+
56
+                        //Toast.makeText(ScanHomepage.this, "Hasil dari RFID LF: " + stringReception, Toast.LENGTH_LONG).show();
57
+                        Timber.i("Hasil dari RFID LF: %s", stringReception);
58
+                        startInstance(stringReception);
59
+                    } else {
60
+                        // receipt data 4 digit to start
61
+                        stringReception = new String(buffer, 0, size);
62
+                    }
63
+                }
64
+            }
65
+        });
66
+    }
67
+}

+ 158 - 0
app/src/main/java/com/fusi24/rfid/ui/scanresult/ScanResultActivity.java

@@ -0,0 +1,158 @@
1
+package com.fusi24.rfid.ui.scanresult;
2
+
3
+import android.annotation.SuppressLint;
4
+import android.content.Intent;
5
+import android.os.Bundle;
6
+import android.widget.Button;
7
+import android.widget.LinearLayout;
8
+import android.widget.TextView;
9
+import android.widget.Toast;
10
+
11
+import androidx.recyclerview.widget.DefaultItemAnimator;
12
+import androidx.recyclerview.widget.DividerItemDecoration;
13
+import androidx.recyclerview.widget.LinearLayoutManager;
14
+import androidx.recyclerview.widget.RecyclerView;
15
+
16
+import com.bumptech.glide.Glide;
17
+import com.fusi24.rfid.MainActivity;
18
+import com.fusi24.rfid.R;
19
+import com.fusi24.rfid.adapter.ScanResultAdapter;
20
+import com.fusi24.rfid.base.BaseActivity;
21
+import com.fusi24.rfid.config.Constant;
22
+import com.fusi24.rfid.data.model.DataProblems;
23
+import com.fusi24.rfid.data.model.DataResultRfid;
24
+import com.google.gson.Gson;
25
+
26
+import java.util.ArrayList;
27
+import java.util.List;
28
+
29
+import butterknife.BindView;
30
+import butterknife.ButterKnife;
31
+import de.hdodenhof.circleimageview.CircleImageView;
32
+
33
+public class ScanResultActivity extends BaseActivity implements ScanResultView {
34
+
35
+    @BindView(R.id.tv_rfid_number)
36
+    TextView tvRfidNumber;
37
+
38
+    @BindView(R.id.iv_profile_image)
39
+    CircleImageView ivProfileImage;
40
+    @BindView(R.id.tv_profile_name)
41
+    TextView tvProfileName;
42
+    @BindView(R.id.tv_structural_position)
43
+    TextView tvStructuralPosition;
44
+    @BindView(R.id.tv_functional_position)
45
+    TextView tvFunctionalPosition;
46
+    @BindView(R.id.tv_company_name)
47
+    TextView tvCompanyName;
48
+
49
+    @BindView(R.id.ll_profile_status)
50
+    LinearLayout llProfileStatus;
51
+    @BindView(R.id.tv_profile_status)
52
+    TextView tvProfileStatus;
53
+
54
+    @BindView(R.id.rv_document_problem)
55
+    RecyclerView rvDocumentProblem;
56
+
57
+    @BindView(R.id.btn_home)
58
+    Button btnHome;
59
+    @BindView(R.id.btn_scan_again)
60
+    Button btnScanAgain;
61
+
62
+    private ScanResultPresenter presenter;
63
+    private ScanResultAdapter adapter;
64
+    private List<DataProblems> problemsList;
65
+    private String numberRfid;
66
+    private Gson gson = new Gson();
67
+
68
+    @Override
69
+    protected void onCreate(Bundle savedInstanceState) {
70
+        super.onCreate(savedInstanceState);
71
+        setContentView(R.layout.activity_scan_result);
72
+        ButterKnife.bind(this);
73
+
74
+        presenter = new ScanResultPresenter(
75
+                getManager(), getAndroidScheduler(), getProcessScheduler());
76
+        presenter.attachView(this);
77
+
78
+        if (getIntent() != null){
79
+            numberRfid = "000" + getIntent().getStringExtra("reception");
80
+        }
81
+
82
+        initView();
83
+        loadingdata();
84
+        initEvent();
85
+    }
86
+
87
+    @SuppressLint("SetTextI18n")
88
+    private void initView(){
89
+        tvRfidNumber.setText("Nomor RFID : " + numberRfid);
90
+
91
+        problemsList = new ArrayList<>();
92
+        adapter = new ScanResultAdapter(this);
93
+
94
+        LinearLayoutManager layoutManager = new LinearLayoutManager(this);
95
+        rvDocumentProblem.setLayoutManager(layoutManager);
96
+        rvDocumentProblem.setItemAnimator(new DefaultItemAnimator());
97
+        rvDocumentProblem.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
98
+        rvDocumentProblem.setAdapter(adapter);
99
+    }
100
+
101
+    private void loadingdata(){
102
+        problemsList.clear();
103
+        String[] expand = {"employee.company, employee.structuralPosition, employee.functionalPosition"};
104
+        presenter.checkRfidCard(numberRfid, 1, expand);
105
+    }
106
+
107
+    private void initEvent(){
108
+        btnHome.setOnClickListener(v -> {
109
+            final Intent intent = new Intent(this, MainActivity.class);
110
+            intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
111
+            startActivity(intent);
112
+        });
113
+
114
+        btnScanAgain.setOnClickListener(v -> {
115
+            finish();
116
+        });
117
+    }
118
+
119
+    @Override
120
+    public void showDataRfid(DataResultRfid dataResultRfid) {
121
+
122
+        String dataUrl = Constant.URL_PHOTO + dataResultRfid.getEmployee().getUrlPhoto().substring(14);
123
+
124
+        Glide.with(this)
125
+                .load(dataUrl)
126
+                .placeholder(R.drawable.ic_profile_default)
127
+                .error(R.drawable.ic_profile_default)
128
+                .into(ivProfileImage);
129
+
130
+        tvProfileName.setText(dataResultRfid.getEmployee().getName());
131
+        tvStructuralPosition.setText(dataResultRfid.getEmployee().getStructuralPosition().getName());
132
+        tvFunctionalPosition.setText(dataResultRfid.getEmployee().getFunctionalPosition().getName());
133
+        tvCompanyName.setText(dataResultRfid.getEmployee().getCompany().getName());
134
+
135
+        if (dataResultRfid.getPassed()){
136
+            tvProfileStatus.setText(R.string.label_status_passed);
137
+            llProfileStatus.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
138
+        } else {
139
+            tvProfileStatus.setText(R.string.label_status_not_passed);
140
+            llProfileStatus.setBackgroundColor(getResources().getColor(R.color.colorRedDark));
141
+        }
142
+
143
+        problemsList = dataResultRfid.getProblems();
144
+        adapter.updateProblemList(problemsList);
145
+        adapter.notifyDataSetChanged();
146
+    }
147
+
148
+    @Override
149
+    public void showError(Throwable e) {
150
+        Toast.makeText(this, e.toString(), Toast.LENGTH_SHORT).show();
151
+    }
152
+
153
+    @Override
154
+    protected void onDestroy() {
155
+        super.onDestroy();
156
+        presenter.detachView();
157
+    }
158
+}

+ 36 - 0
app/src/main/java/com/fusi24/rfid/ui/scanresult/ScanResultPresenter.java

@@ -0,0 +1,36 @@
1
+package com.fusi24.rfid.ui.scanresult;
2
+
3
+import com.fusi24.rfid.base.BasePresenter;
4
+import com.fusi24.rfid.data.DataManager;
5
+
6
+import io.reactivex.Scheduler;
7
+
8
+public class ScanResultPresenter extends BasePresenter<ScanResultView> {
9
+
10
+    private DataManager manager;
11
+
12
+    private Scheduler androidScheduler;
13
+    private Scheduler processScheduler;
14
+
15
+    ScanResultPresenter(DataManager manager, Scheduler androidScheduler, Scheduler processScheduler) {
16
+        this.manager = manager;
17
+        this.androidScheduler = androidScheduler;
18
+        this.processScheduler = processScheduler;
19
+    }
20
+
21
+    void checkRfidCard(String numberRfid, Integer permitId, String[] expand) {
22
+        disposable.add(manager.checkRfidCard(numberRfid, permitId, expand)
23
+                .observeOn(androidScheduler)
24
+                .subscribeOn(processScheduler)
25
+                .subscribe(dataRfid -> {
26
+                    if (isViewAttached()) {
27
+                        getView().showDataRfid(dataRfid);
28
+                    }
29
+                }, throwable -> {
30
+                    if (isViewAttached()) {
31
+                        getView().showError(throwable);
32
+                    }
33
+                }));
34
+    }
35
+
36
+}

+ 10 - 0
app/src/main/java/com/fusi24/rfid/ui/scanresult/ScanResultView.java

@@ -0,0 +1,10 @@
1
+package com.fusi24.rfid.ui.scanresult;
2
+
3
+import com.fusi24.rfid.base.BaseView;
4
+import com.fusi24.rfid.data.model.DataResultRfid;
5
+
6
+public interface ScanResultView extends BaseView {
7
+
8
+    void showDataRfid(DataResultRfid dataResultRfid);
9
+
10
+}

+ 25 - 0
app/src/main/java/com/fusi24/rfid/util/DateHelper.java

@@ -0,0 +1,25 @@
1
+package com.fusi24.rfid.util;
2
+
3
+import androidx.annotation.NonNull;
4
+
5
+import java.text.ParseException;
6
+import java.text.SimpleDateFormat;
7
+import java.util.Date;
8
+import java.util.Locale;
9
+
10
+public class DateHelper {
11
+
12
+    @NonNull
13
+    public static String convertDateToReadableDate(String stringTime) {
14
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.getDefault());
15
+        SimpleDateFormat output = new SimpleDateFormat("dd-MMM-yyyy", Locale.getDefault());
16
+        Date d = null;
17
+        try {
18
+            d = sdf.parse(stringTime);
19
+        } catch (ParseException e) {
20
+            e.printStackTrace();
21
+        }
22
+        return output.format(d);
23
+    }
24
+
25
+}

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

@@ -0,0 +1,37 @@
1
+package com.fusi24.rfid.util;
2
+
3
+import android.media.AudioManager;
4
+import android.media.SoundPool;
5
+
6
+import com.fusi24.rfid.R;
7
+
8
+public abstract class LFScanProcessing extends LFSerialPortActivity {
9
+
10
+    protected int soundid;
11
+    protected SoundPool soundpool = null;
12
+
13
+    public String stringReception = "";
14
+
15
+    protected void initSound(){
16
+        soundpool = new SoundPool(1, AudioManager.STREAM_NOTIFICATION, 100);
17
+        soundid = soundpool.load(this, R.raw.rfid_beep, 1);
18
+    }
19
+
20
+    @Override
21
+    protected void onStart() {
22
+        super.onStart();
23
+
24
+        // Start Reception
25
+        PowerUtil.power("1");
26
+        this.open();
27
+    }
28
+
29
+    @Override
30
+    protected void onStop() {
31
+        super.onStop();
32
+
33
+        // Stop Reception
34
+        this.close();
35
+        PowerUtil.power("0");
36
+    }
37
+}

+ 132 - 0
app/src/main/java/com/fusi24/rfid/util/LFSerialPortActivity.java

@@ -0,0 +1,132 @@
1
+/*
2
+ * Copyright 2009 Cedric Priscal
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+package com.fusi24.rfid.util;
18
+
19
+import android.app.AlertDialog;
20
+import android.os.Bundle;
21
+
22
+import androidx.appcompat.app.AppCompatActivity;
23
+
24
+import com.fusi24.rfid.R;
25
+import com.fusi24.rfid.config.Constant;
26
+
27
+import java.io.IOException;
28
+import java.io.InputStream;
29
+import java.io.OutputStream;
30
+import java.security.InvalidParameterException;
31
+
32
+import android_serialport_api.SerialPort;
33
+import android_serialport_api.SerialPortTool;
34
+
35
+public abstract class LFSerialPortActivity extends AppCompatActivity {
36
+
37
+  public static final String PATH = Constant.PATH;
38
+  public static final int BAUTRATE = Constant.BAUTRATE;
39
+
40
+  protected SerialPortTool serialPortTool;
41
+  protected SerialPort mSerialPort;
42
+  protected OutputStream mOutputStream;
43
+  private InputStream mInputStream;
44
+  private ReadThread mReadThread;
45
+
46
+  private class ReadThread extends Thread {
47
+
48
+    @Override
49
+    public void run() {
50
+      super.run();
51
+      while (!isInterrupted()) {
52
+        int size;
53
+        try {
54
+          byte[] buffer = new byte[64];
55
+          if (mInputStream == null) {
56
+            return;
57
+          }
58
+          size = mInputStream.read(buffer);
59
+          if (size > 0) {
60
+            onDataReceived(buffer, size);
61
+          }
62
+        } catch (IOException e) {
63
+          e.printStackTrace();
64
+          return;
65
+        }
66
+      }
67
+    }
68
+  }
69
+
70
+  private void DisplayError(int resourceId) {
71
+    AlertDialog.Builder b = new AlertDialog.Builder(this);
72
+    b.setTitle("ERROR");
73
+    b.setMessage(resourceId);
74
+    b.setPositiveButton("OK", (dialog, which) -> LFSerialPortActivity.this.finish());
75
+    b.show();
76
+  }
77
+
78
+  @Override
79
+  protected void onCreate(Bundle savedInstanceState) {
80
+    super.onCreate(savedInstanceState);
81
+  }
82
+
83
+  protected abstract void onDataReceived(final byte[] buffer, final int size);
84
+
85
+  @Override
86
+  protected void onDestroy() {
87
+    close();
88
+    super.onDestroy();
89
+  }
90
+
91
+  public boolean open() {
92
+    boolean bret = false;
93
+    if (serialPortTool == null) {
94
+      serialPortTool = new SerialPortTool();
95
+    }
96
+
97
+    try {
98
+
99
+      mSerialPort = serialPortTool.getSerialPort(PATH, BAUTRATE);
100
+      mOutputStream = mSerialPort.getOutputStream();
101
+      mInputStream = mSerialPort.getInputStream();
102
+
103
+      /* Create a receiving thread */
104
+      if (mReadThread == null) {
105
+        mReadThread = new ReadThread();
106
+        mReadThread.start();
107
+      }
108
+      bret = true;
109
+    } catch (SecurityException e) {
110
+      DisplayError(R.string.error_security);
111
+    } catch (IOException e) {
112
+      DisplayError(R.string.error_unknown);
113
+    } catch (InvalidParameterException e) {
114
+      DisplayError(R.string.error_configuration);
115
+    } catch (Exception e) {
116
+      DisplayError(R.string.error_unknown);
117
+    }
118
+
119
+    return bret;
120
+  }
121
+
122
+  public void close() {
123
+    if (mReadThread != null) {
124
+      mReadThread.interrupt();
125
+      mReadThread = null;
126
+    }
127
+    if (serialPortTool != null) {
128
+      serialPortTool.closeSerialPort();
129
+    }
130
+    mSerialPort = null;
131
+  }
132
+}

+ 18 - 0
app/src/main/java/com/fusi24/rfid/util/PowerUtil.java

@@ -0,0 +1,18 @@
1
+package com.fusi24.rfid.util;
2
+
3
+import com.fusi24.rfid.config.Constant;
4
+
5
+import java.io.File;
6
+import java.io.FileWriter;
7
+
8
+public class PowerUtil {
9
+  public static void power(String id) {
10
+    try {
11
+      FileWriter localFileWriterOn = new FileWriter(new File(Constant.PATHNAME));
12
+      localFileWriterOn.write(id);
13
+      localFileWriterOn.close();
14
+    } catch (Exception e) {
15
+      e.printStackTrace();
16
+    }
17
+  }
18
+}

BIN
app/src/main/jniLibs/arm64-v8a/libserial_port.so


BIN
app/src/main/jniLibs/armeabi-v7a/libserial_port.so


BIN
app/src/main/jniLibs/armeabi/libserial_port.so


BIN
app/src/main/jniLibs/x86/libserial_port.so


BIN
app/src/main/jniLibs/x86_64/libserial_port.so


Datei-Diff unterdrückt, da er zu groß ist
+ 34 - 0
app/src/main/res/drawable-v24/ic_launcher_foreground.xml


+ 5 - 0
app/src/main/res/drawable/bg_green.xml

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<shape xmlns:android="http://schemas.android.com/apk/res/android" >
3
+    <solid android:color="@color/colorPrimary" />
4
+    <corners android:radius="15dp"/>
5
+</shape>

BIN
app/src/main/res/drawable/chevron_down.png


+ 18 - 0
app/src/main/res/drawable/ic_dropdown_spinner.xml

@@ -0,0 +1,18 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
3
+
4
+    <item><layer-list>
5
+        <item><shape>
6
+            <!--<gradient android:angle="90" android:endColor="#B3BBCC" android:startColor="#E8EBEF" android:type="linear" />-->
7
+
8
+            <stroke android:width="1dp" android:color="#000000" />
9
+
10
+            <corners android:radius="4dp" />
11
+
12
+            <padding android:bottom="3dp" android:left="3dp" android:right="3dp" android:top="3dp" />
13
+        </shape></item>
14
+        <item ><bitmap android:gravity="center|right" android:src="@drawable/chevron_down" />
15
+        </item>
16
+    </layer-list></item>
17
+
18
+</selector>

+ 170 - 0
app/src/main/res/drawable/ic_launcher_background.xml

@@ -0,0 +1,170 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
3
+    android:width="108dp"
4
+    android:height="108dp"
5
+    android:viewportWidth="108"
6
+    android:viewportHeight="108">
7
+    <path
8
+        android:fillColor="#008577"
9
+        android:pathData="M0,0h108v108h-108z" />
10
+    <path
11
+        android:fillColor="#00000000"
12
+        android:pathData="M9,0L9,108"
13
+        android:strokeWidth="0.8"
14
+        android:strokeColor="#33FFFFFF" />
15
+    <path
16
+        android:fillColor="#00000000"
17
+        android:pathData="M19,0L19,108"
18
+        android:strokeWidth="0.8"
19
+        android:strokeColor="#33FFFFFF" />
20
+    <path
21
+        android:fillColor="#00000000"
22
+        android:pathData="M29,0L29,108"
23
+        android:strokeWidth="0.8"
24
+        android:strokeColor="#33FFFFFF" />
25
+    <path
26
+        android:fillColor="#00000000"
27
+        android:pathData="M39,0L39,108"
28
+        android:strokeWidth="0.8"
29
+        android:strokeColor="#33FFFFFF" />
30
+    <path
31
+        android:fillColor="#00000000"
32
+        android:pathData="M49,0L49,108"
33
+        android:strokeWidth="0.8"
34
+        android:strokeColor="#33FFFFFF" />
35
+    <path
36
+        android:fillColor="#00000000"
37
+        android:pathData="M59,0L59,108"
38
+        android:strokeWidth="0.8"
39
+        android:strokeColor="#33FFFFFF" />
40
+    <path
41
+        android:fillColor="#00000000"
42
+        android:pathData="M69,0L69,108"
43
+        android:strokeWidth="0.8"
44
+        android:strokeColor="#33FFFFFF" />
45
+    <path
46
+        android:fillColor="#00000000"
47
+        android:pathData="M79,0L79,108"
48
+        android:strokeWidth="0.8"
49
+        android:strokeColor="#33FFFFFF" />
50
+    <path
51
+        android:fillColor="#00000000"
52
+        android:pathData="M89,0L89,108"
53
+        android:strokeWidth="0.8"
54
+        android:strokeColor="#33FFFFFF" />
55
+    <path
56
+        android:fillColor="#00000000"
57
+        android:pathData="M99,0L99,108"
58
+        android:strokeWidth="0.8"
59
+        android:strokeColor="#33FFFFFF" />
60
+    <path
61
+        android:fillColor="#00000000"
62
+        android:pathData="M0,9L108,9"
63
+        android:strokeWidth="0.8"
64
+        android:strokeColor="#33FFFFFF" />
65
+    <path
66
+        android:fillColor="#00000000"
67
+        android:pathData="M0,19L108,19"
68
+        android:strokeWidth="0.8"
69
+        android:strokeColor="#33FFFFFF" />
70
+    <path
71
+        android:fillColor="#00000000"
72
+        android:pathData="M0,29L108,29"
73
+        android:strokeWidth="0.8"
74
+        android:strokeColor="#33FFFFFF" />
75
+    <path
76
+        android:fillColor="#00000000"
77
+        android:pathData="M0,39L108,39"
78
+        android:strokeWidth="0.8"
79
+        android:strokeColor="#33FFFFFF" />
80
+    <path
81
+        android:fillColor="#00000000"
82
+        android:pathData="M0,49L108,49"
83
+        android:strokeWidth="0.8"
84
+        android:strokeColor="#33FFFFFF" />
85
+    <path
86
+        android:fillColor="#00000000"
87
+        android:pathData="M0,59L108,59"
88
+        android:strokeWidth="0.8"
89
+        android:strokeColor="#33FFFFFF" />
90
+    <path
91
+        android:fillColor="#00000000"
92
+        android:pathData="M0,69L108,69"
93
+        android:strokeWidth="0.8"
94
+        android:strokeColor="#33FFFFFF" />
95
+    <path
96
+        android:fillColor="#00000000"
97
+        android:pathData="M0,79L108,79"
98
+        android:strokeWidth="0.8"
99
+        android:strokeColor="#33FFFFFF" />
100
+    <path
101
+        android:fillColor="#00000000"
102
+        android:pathData="M0,89L108,89"
103
+        android:strokeWidth="0.8"
104
+        android:strokeColor="#33FFFFFF" />
105
+    <path
106
+        android:fillColor="#00000000"
107
+        android:pathData="M0,99L108,99"
108
+        android:strokeWidth="0.8"
109
+        android:strokeColor="#33FFFFFF" />
110
+    <path
111
+        android:fillColor="#00000000"
112
+        android:pathData="M19,29L89,29"
113
+        android:strokeWidth="0.8"
114
+        android:strokeColor="#33FFFFFF" />
115
+    <path
116
+        android:fillColor="#00000000"
117
+        android:pathData="M19,39L89,39"
118
+        android:strokeWidth="0.8"
119
+        android:strokeColor="#33FFFFFF" />
120
+    <path
121
+        android:fillColor="#00000000"
122
+        android:pathData="M19,49L89,49"
123
+        android:strokeWidth="0.8"
124
+        android:strokeColor="#33FFFFFF" />
125
+    <path
126
+        android:fillColor="#00000000"
127
+        android:pathData="M19,59L89,59"
128
+        android:strokeWidth="0.8"
129
+        android:strokeColor="#33FFFFFF" />
130
+    <path
131
+        android:fillColor="#00000000"
132
+        android:pathData="M19,69L89,69"
133
+        android:strokeWidth="0.8"
134
+        android:strokeColor="#33FFFFFF" />
135
+    <path
136
+        android:fillColor="#00000000"
137
+        android:pathData="M19,79L89,79"
138
+        android:strokeWidth="0.8"
139
+        android:strokeColor="#33FFFFFF" />
140
+    <path
141
+        android:fillColor="#00000000"
142
+        android:pathData="M29,19L29,89"
143
+        android:strokeWidth="0.8"
144
+        android:strokeColor="#33FFFFFF" />
145
+    <path
146
+        android:fillColor="#00000000"
147
+        android:pathData="M39,19L39,89"
148
+        android:strokeWidth="0.8"
149
+        android:strokeColor="#33FFFFFF" />
150
+    <path
151
+        android:fillColor="#00000000"
152
+        android:pathData="M49,19L49,89"
153
+        android:strokeWidth="0.8"
154
+        android:strokeColor="#33FFFFFF" />
155
+    <path
156
+        android:fillColor="#00000000"
157
+        android:pathData="M59,19L59,89"
158
+        android:strokeWidth="0.8"
159
+        android:strokeColor="#33FFFFFF" />
160
+    <path
161
+        android:fillColor="#00000000"
162
+        android:pathData="M69,19L69,89"
163
+        android:strokeWidth="0.8"
164
+        android:strokeColor="#33FFFFFF" />
165
+    <path
166
+        android:fillColor="#00000000"
167
+        android:pathData="M79,19L79,89"
168
+        android:strokeWidth="0.8"
169
+        android:strokeColor="#33FFFFFF" />
170
+</vector>

BIN
app/src/main/res/drawable/ic_profile_default.png


BIN
app/src/main/res/drawable/logo_hse_autimation.png


+ 5 - 0
app/src/main/res/drawable/my_btn_toggle.xml

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
3
+    <item android:state_checked="false" android:drawable="@color/colorRedDark"  />
4
+    <item android:state_checked="true" android:drawable="@color/colorGreenDark"  />
5
+</selector>

+ 87 - 0
app/src/main/res/layout/activity_main.xml

@@ -0,0 +1,87 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+    xmlns:tools="http://schemas.android.com/tools"
4
+    android:layout_width="match_parent"
5
+    android:layout_height="match_parent"
6
+    tools:context=".MainActivity">
7
+
8
+    <ImageView
9
+        android:id="@+id/iv_logo_hse"
10
+        android:layout_width="64dp"
11
+        android:layout_height="64dp"
12
+        android:layout_alignParentStart="true"
13
+        android:layout_alignParentTop="true"
14
+        android:layout_alignParentEnd="true"
15
+        android:layout_marginStart="0dp"
16
+        android:layout_marginTop="32dp"
17
+        android:layout_marginEnd="0dp"
18
+        android:src="@drawable/logo_hse_autimation" />
19
+
20
+    <TextView
21
+        android:id="@+id/tv_title_label"
22
+        android:layout_width="match_parent"
23
+        android:layout_height="wrap_content"
24
+        android:layout_below="@+id/iv_logo_hse"
25
+        android:layout_alignParentStart="true"
26
+        android:layout_alignParentEnd="true"
27
+        android:layout_marginTop="16dp"
28
+        android:layout_marginStart="0dp"
29
+        android:layout_marginEnd="0dp"
30
+        android:gravity="center"
31
+        style="@style/HeaderText"
32
+        android:text="@string/label_header_app"/>
33
+
34
+    <androidx.appcompat.widget.AppCompatSpinner
35
+        android:id="@+id/spinner_site"
36
+        android:layout_width="match_parent"
37
+        android:layout_height="wrap_content"
38
+        android:layout_below="@+id/tv_title_label"
39
+        android:layout_alignParentStart="true"
40
+        android:layout_alignParentEnd="true"
41
+        android:layout_marginStart="16dp"
42
+        android:layout_marginTop="32dp"
43
+        android:layout_marginEnd="16dp"
44
+        android:layout_marginBottom="0dp"
45
+        style="@style/spinner_style" />
46
+
47
+    <androidx.appcompat.widget.AppCompatSpinner
48
+        android:id="@+id/spinner_permit"
49
+        android:layout_width="match_parent"
50
+        android:layout_height="wrap_content"
51
+        android:layout_below="@+id/spinner_site"
52
+        android:layout_alignParentStart="true"
53
+        android:layout_alignParentEnd="true"
54
+        android:layout_marginStart="16dp"
55
+        android:layout_marginTop="32dp"
56
+        android:layout_marginEnd="16dp"
57
+        android:layout_marginBottom="0dp"
58
+        style="@style/spinner_style" />
59
+
60
+    <Button
61
+        android:id="@+id/btn_scan"
62
+        style="@style/ButtonCommon"
63
+        android:layout_width="match_parent"
64
+        android:layout_height="wrap_content"
65
+        android:layout_below="@+id/spinner_permit"
66
+        android:layout_alignParentStart="true"
67
+        android:layout_alignParentEnd="true"
68
+        android:layout_marginStart="16dp"
69
+        android:layout_marginTop="32dp"
70
+        android:layout_marginEnd="16dp"
71
+        android:text="@string/label_btn_scan" />
72
+
73
+    <TextView
74
+        android:id="@+id/tv_company_label"
75
+        style="@style/BottomText"
76
+        android:layout_width="match_parent"
77
+        android:layout_height="wrap_content"
78
+        android:layout_alignParentStart="true"
79
+        android:layout_alignParentEnd="true"
80
+        android:layout_alignParentBottom="true"
81
+        android:layout_marginStart="0dp"
82
+        android:layout_marginEnd="0dp"
83
+        android:layout_marginBottom="16dp"
84
+        android:gravity="center"
85
+        android:text="@string/label_company_app" />
86
+
87
+</RelativeLayout>

+ 37 - 0
app/src/main/res/layout/activity_scan.xml

@@ -0,0 +1,37 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+    xmlns:tools="http://schemas.android.com/tools"
4
+    android:layout_width="match_parent"
5
+    android:layout_height="match_parent"
6
+    tools:context=".ui.ScanActivity">
7
+
8
+    <androidx.appcompat.widget.AppCompatToggleButton
9
+        android:id="@+id/toggle_scan"
10
+        android:layout_width="wrap_content"
11
+        android:layout_height="wrap_content"
12
+        style="@style/ToggleCommon"
13
+        android:checked="true"
14
+        android:textOff="@string/label_scanner_off"
15
+        android:textOn="@string/label_scanner_on"
16
+        android:layout_alignParentStart="true"
17
+        android:layout_alignParentTop="true"
18
+        android:layout_marginStart="16dp"
19
+        android:layout_marginTop="16dp"/>
20
+
21
+    <TextView
22
+        android:id="@+id/tv_title_label"
23
+        style="@style/BodyText"
24
+        android:layout_width="match_parent"
25
+        android:layout_height="wrap_content"
26
+        android:layout_alignParentStart="true"
27
+        android:layout_alignParentTop="true"
28
+        android:layout_alignParentEnd="true"
29
+        android:layout_alignParentBottom="true"
30
+        android:layout_marginStart="0dp"
31
+        android:layout_marginTop="0dp"
32
+        android:layout_marginEnd="0dp"
33
+        android:layout_marginBottom="0dp"
34
+        android:gravity="center"
35
+        android:text="@string/label_info_scan" />
36
+
37
+</RelativeLayout>

+ 131 - 0
app/src/main/res/layout/activity_scan_result.xml

@@ -0,0 +1,131 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<ScrollView
3
+    xmlns:android="http://schemas.android.com/apk/res/android"
4
+    xmlns:tools="http://schemas.android.com/tools"
5
+    android:layout_width="match_parent"
6
+    android:layout_height="match_parent"
7
+    tools:context=".ui.scanresult.ScanResultActivity">
8
+
9
+    <RelativeLayout
10
+        android:layout_width="match_parent"
11
+        android:layout_height="wrap_content">
12
+
13
+    <TextView
14
+        android:id="@+id/tv_rfid_number"
15
+        android:layout_width="match_parent"
16
+        android:layout_height="wrap_content"
17
+        android:layout_margin="8dp"
18
+        tools:text="@string/app_name" />
19
+
20
+    <de.hdodenhof.circleimageview.CircleImageView
21
+        android:id="@+id/iv_profile_image"
22
+        android:layout_width="80dp"
23
+        android:layout_height="80dp"
24
+        android:layout_below="@+id/tv_rfid_number"
25
+        android:layout_alignParentStart="true"
26
+        android:layout_alignParentEnd="true"
27
+        android:layout_marginStart="0dp"
28
+        android:layout_marginEnd="0dp"
29
+        android:layout_marginTop="16dp"
30
+        android:src="@drawable/ic_profile_default"/>
31
+
32
+    <LinearLayout
33
+        android:id="@+id/ll_profile_bio"
34
+        android:layout_width="match_parent"
35
+        android:layout_height="wrap_content"
36
+        android:layout_margin="16dp"
37
+        android:layout_below="@id/iv_profile_image"
38
+        android:orientation="vertical"
39
+        android:background="@drawable/bg_green">
40
+
41
+        <TextView
42
+            android:id="@+id/tv_profile_name"
43
+            style="@style/CommonText"
44
+            android:layout_width="match_parent"
45
+            android:layout_height="wrap_content"
46
+            android:gravity="center"
47
+            android:layout_margin="8dp"
48
+            tools:text="HADYAN EL AUFAR" />
49
+
50
+        <TextView
51
+            android:id="@+id/tv_structural_position"
52
+            style="@style/CommonText"
53
+            android:layout_width="match_parent"
54
+            android:layout_height="wrap_content"
55
+            android:gravity="center"
56
+            android:layout_margin="8dp"
57
+            tools:text="IT System Development Specialist" />
58
+
59
+        <TextView
60
+            android:id="@+id/tv_functional_position"
61
+            style="@style/CommonText"
62
+            android:layout_width="match_parent"
63
+            android:layout_height="wrap_content"
64
+            android:gravity="center"
65
+            android:layout_margin="8dp"
66
+            tools:text="Engineer/Specialist" />
67
+
68
+        <TextView
69
+            android:id="@+id/tv_company_name"
70
+            style="@style/CommonText"
71
+            android:layout_width="match_parent"
72
+            android:layout_height="wrap_content"
73
+            android:gravity="center"
74
+            android:layout_margin="8dp"
75
+            tools:text="PT. Berau Coal Energy" />
76
+
77
+    </LinearLayout>
78
+
79
+    <LinearLayout
80
+        android:id="@+id/ll_profile_status"
81
+        android:layout_width="160dp"
82
+        android:layout_height="wrap_content"
83
+        android:layout_below="@id/ll_profile_bio"
84
+        android:layout_alignParentStart="true"
85
+        android:layout_alignParentEnd="true"
86
+        android:layout_marginTop="16dp"
87
+        android:layout_marginStart="100dp"
88
+        android:layout_marginEnd="100dp"
89
+        android:background="@color/colorPrimary">
90
+
91
+        <TextView
92
+            android:id="@+id/tv_profile_status"
93
+            style="@style/CommonText"
94
+            android:layout_width="match_parent"
95
+            android:layout_height="wrap_content"
96
+            android:padding="8dp"
97
+            android:gravity="center"
98
+            tools:text="PASSED" />
99
+
100
+    </LinearLayout>
101
+
102
+    <androidx.recyclerview.widget.RecyclerView
103
+        android:id="@+id/rv_document_problem"
104
+        android:layout_width="match_parent"
105
+        android:layout_height="wrap_content"
106
+        android:layout_margin="16dp"
107
+        android:layout_below="@+id/ll_profile_status"
108
+        tools:listitem="@layout/row_document" />
109
+
110
+        <Button
111
+            android:id="@+id/btn_home"
112
+            style="@style/ButtonCommon"
113
+            android:layout_width="120dp"
114
+            android:layout_height="wrap_content"
115
+            android:layout_below="@id/rv_document_problem"
116
+            android:layout_alignParentStart="true"
117
+            android:layout_margin="16dp"
118
+            android:text="@string/label_home" />
119
+
120
+        <Button
121
+            android:id="@+id/btn_scan_again"
122
+            style="@style/ButtonCommon"
123
+            android:layout_width="120dp"
124
+            android:layout_height="wrap_content"
125
+            android:layout_below="@+id/rv_document_problem"
126
+            android:layout_alignParentEnd="true"
127
+            android:layout_margin="16dp"
128
+            android:text="@string/label_scan_other" />
129
+    </RelativeLayout>
130
+
131
+</ScrollView>

+ 38 - 0
app/src/main/res/layout/row_document.xml

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

+ 5 - 0
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3
+    <background android:drawable="@drawable/ic_launcher_background" />
4
+    <foreground android:drawable="@drawable/ic_launcher_foreground" />
5
+</adaptive-icon>

+ 5 - 0
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3
+    <background android:drawable="@drawable/ic_launcher_background" />
4
+    <foreground android:drawable="@drawable/ic_launcher_foreground" />
5
+</adaptive-icon>

BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png


BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.png


BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png


BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.png


BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png


BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.png


BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png


BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png


BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png


BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png


BIN
app/src/main/res/raw/rfid_beep.ogg


+ 17 - 0
app/src/main/res/values/colors.xml

@@ -0,0 +1,17 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<resources>
3
+    <color name="colorPrimary">#3d9b35</color>
4
+    <color name="colorPrimaryDark">#000000</color>
5
+    <color name="colorAccent">#4caf50</color>
6
+
7
+    <color name="colorRedDark">#C51616</color>
8
+    <color name="colorGreenDark">#19771D</color>
9
+
10
+    <color name="backgroundInner">#FFFFFF</color>
11
+    <color name="backgroundOuter">#F5F5F5</color>
12
+    <color name="backgroundCanvas">#f2f2f9</color>
13
+    <color name="backgroundLayoutGrey">#E3E3E9</color>
14
+
15
+    <color name="colorWhite">#FFFFFF</color>
16
+    <color name="colorBlack">#000000</color>
17
+</resources>

+ 20 - 0
app/src/main/res/values/strings.xml

@@ -0,0 +1,20 @@
1
+<resources>
2
+    <string name="app_name">Entry Permit Scanner</string>
3
+    <string name="label_scanner_off">Scanner Mati</string>
4
+    <string name="label_scanner_on">Scanner Hidup</string>
5
+    <string name="label_header_app">HSE AUTOMATION \n ENTRY PERMIT SCANNER</string>
6
+    <string name="label_company_app">PT. Berau Coal</string>
7
+    <string name="label_btn_scan">Start Scanning</string>
8
+    <string name="label_info_scan">Tempelkan RFID Gun \n pada RFID Card</string>
9
+
10
+    //Error
11
+    <string name="error_configuration">Please configure your serial port first.</string>
12
+    <string name="error_security">You do not have read/write permission to the serialport.</string>
13
+    <string name="error_unknown">The serial port can not be opened for an unknown reason.</string>
14
+    <string name="error_scan_id">Mohon maaf sistem sedang sibuk</string>
15
+    <string name="label_home">Home</string>
16
+    <string name="label_scan_other">Scan Other</string>
17
+    <string name="label_status_passed">PASSED</string>
18
+    <string name="label_status_not_passed">NOT PASSED</string>
19
+
20
+</resources>

+ 58 - 0
app/src/main/res/values/styles.xml

@@ -0,0 +1,58 @@
1
+<resources>
2
+
3
+    <!-- Base application theme. -->
4
+    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
5
+        <!-- Customize your theme here. -->
6
+        <item name="colorPrimary">@color/colorPrimary</item>
7
+        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
8
+        <item name="colorAccent">@color/colorAccent</item>
9
+    </style>
10
+
11
+    <style name="HeaderText">
12
+        <item name="android:textSize">20sp</item>
13
+        <item name="android:textColor">@color/colorGreenDark</item>
14
+        <item name="android:textStyle">bold</item>
15
+    </style>
16
+
17
+    <style name="BodyText">
18
+        <item name="android:textSize">28sp</item>
19
+        <item name="android:textColor">@color/colorGreenDark</item>
20
+        <item name="android:textStyle">bold</item>
21
+    </style>
22
+
23
+    <style name="BottomText">
24
+        <item name="android:textSize">16sp</item>
25
+        <item name="android:textColor">@color/colorGreenDark</item>
26
+        <item name="android:textStyle">bold</item>
27
+    </style>
28
+
29
+    <style name="CommonText">
30
+        <item name="android:textSize">16sp</item>
31
+        <item name="android:textColor">@color/colorWhite</item>
32
+    </style>
33
+
34
+    <style name="DocumentText">
35
+        <item name="android:textSize">16sp</item>
36
+        <item name="android:textColor">@color/colorBlack</item>
37
+    </style>
38
+
39
+    <style name="spinner_style">
40
+        <item name="android:layout_width">match_parent</item>
41
+        <item name="android:layout_height">wrap_content</item>
42
+        <item name="android:background">@drawable/ic_dropdown_spinner</item>
43
+        <item name="android:popupBackground">#DFFFFFFF</item>
44
+    </style>
45
+
46
+    <style name="ButtonCommon">
47
+        <item name="android:background">@color/colorPrimary</item>
48
+        <item name="android:textColor">@color/colorWhite</item>
49
+        <item name="android:textAppearance">@style/TextAppearance.AppCompat.Button</item>
50
+    </style>
51
+
52
+    <style name="ToggleCommon">
53
+        <item name="android:background">@drawable/my_btn_toggle</item>
54
+        <item name="android:textColor">@color/colorWhite</item>
55
+        <item name="android:padding">8dp</item>
56
+    </style>
57
+
58
+</resources>

+ 17 - 0
app/src/test/java/com/fusi24/rfid/ExampleUnitTest.java

@@ -0,0 +1,17 @@
1
+package com.fusi24.rfid;
2
+
3
+import org.junit.Test;
4
+
5
+import static org.junit.Assert.*;
6
+
7
+/**
8
+ * Example local unit test, which will execute on the development machine (host).
9
+ *
10
+ * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
11
+ */
12
+public class ExampleUnitTest {
13
+    @Test
14
+    public void addition_isCorrect() {
15
+        assertEquals(4, 2 + 2);
16
+    }
17
+}

+ 27 - 0
build.gradle

@@ -0,0 +1,27 @@
1
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
2
+
3
+buildscript {
4
+    repositories {
5
+        google()
6
+        jcenter()
7
+        
8
+    }
9
+    dependencies {
10
+        classpath 'com.android.tools.build:gradle:3.5.2'
11
+        
12
+        // NOTE: Do not place your application dependencies here; they belong
13
+        // in the individual module build.gradle files
14
+    }
15
+}
16
+
17
+allprojects {
18
+    repositories {
19
+        google()
20
+        jcenter()
21
+        
22
+    }
23
+}
24
+
25
+task clean(type: Delete) {
26
+    delete rootProject.buildDir
27
+}

+ 20 - 0
gradle.properties

@@ -0,0 +1,20 @@
1
+# Project-wide Gradle settings.
2
+# IDE (e.g. Android Studio) users:
3
+# Gradle settings configured through the IDE *will override*
4
+# any settings specified in this file.
5
+# For more details on how to configure your build environment visit
6
+# http://www.gradle.org/docs/current/userguide/build_environment.html
7
+# Specifies the JVM arguments used for the daemon process.
8
+# The setting is particularly useful for tweaking memory settings.
9
+org.gradle.jvmargs=-Xmx1536m
10
+# When configured, Gradle will run in incubating parallel mode.
11
+# This option should only be used with decoupled projects. More details, visit
12
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13
+# org.gradle.parallel=true
14
+# AndroidX package structure to make it clearer which packages are bundled with the
15
+# Android operating system, and which are packaged with your app's APK
16
+# https://developer.android.com/topic/libraries/support-library/androidx-rn
17
+android.useAndroidX=true
18
+# Automatically convert third-party libraries to use AndroidX
19
+android.enableJetifier=true
20
+

BIN
gradle/wrapper/gradle-wrapper.jar


+ 6 - 0
gradle/wrapper/gradle-wrapper.properties

@@ -0,0 +1,6 @@
1
+#Fri Nov 29 09:35:35 ICT 2019
2
+distributionBase=GRADLE_USER_HOME
3
+distributionPath=wrapper/dists
4
+zipStoreBase=GRADLE_USER_HOME
5
+zipStorePath=wrapper/dists
6
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

+ 172 - 0
gradlew

@@ -0,0 +1,172 @@
1
+#!/usr/bin/env sh
2
+
3
+##############################################################################
4
+##
5
+##  Gradle start up script for UN*X
6
+##
7
+##############################################################################
8
+
9
+# Attempt to set APP_HOME
10
+# Resolve links: $0 may be a link
11
+PRG="$0"
12
+# Need this for relative symlinks.
13
+while [ -h "$PRG" ] ; do
14
+    ls=`ls -ld "$PRG"`
15
+    link=`expr "$ls" : '.*-> \(.*\)$'`
16
+    if expr "$link" : '/.*' > /dev/null; then
17
+        PRG="$link"
18
+    else
19
+        PRG=`dirname "$PRG"`"/$link"
20
+    fi
21
+done
22
+SAVED="`pwd`"
23
+cd "`dirname \"$PRG\"`/" >/dev/null
24
+APP_HOME="`pwd -P`"
25
+cd "$SAVED" >/dev/null
26
+
27
+APP_NAME="Gradle"
28
+APP_BASE_NAME=`basename "$0"`
29
+
30
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31
+DEFAULT_JVM_OPTS=""
32
+
33
+# Use the maximum available, or set MAX_FD != -1 to use that value.
34
+MAX_FD="maximum"
35
+
36
+warn () {
37
+    echo "$*"
38
+}
39
+
40
+die () {
41
+    echo
42
+    echo "$*"
43
+    echo
44
+    exit 1
45
+}
46
+
47
+# OS specific support (must be 'true' or 'false').
48
+cygwin=false
49
+msys=false
50
+darwin=false
51
+nonstop=false
52
+case "`uname`" in
53
+  CYGWIN* )
54
+    cygwin=true
55
+    ;;
56
+  Darwin* )
57
+    darwin=true
58
+    ;;
59
+  MINGW* )
60
+    msys=true
61
+    ;;
62
+  NONSTOP* )
63
+    nonstop=true
64
+    ;;
65
+esac
66
+
67
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68
+
69
+# Determine the Java command to use to start the JVM.
70
+if [ -n "$JAVA_HOME" ] ; then
71
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72
+        # IBM's JDK on AIX uses strange locations for the executables
73
+        JAVACMD="$JAVA_HOME/jre/sh/java"
74
+    else
75
+        JAVACMD="$JAVA_HOME/bin/java"
76
+    fi
77
+    if [ ! -x "$JAVACMD" ] ; then
78
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79
+
80
+Please set the JAVA_HOME variable in your environment to match the
81
+location of your Java installation."
82
+    fi
83
+else
84
+    JAVACMD="java"
85
+    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86
+
87
+Please set the JAVA_HOME variable in your environment to match the
88
+location of your Java installation."
89
+fi
90
+
91
+# Increase the maximum file descriptors if we can.
92
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93
+    MAX_FD_LIMIT=`ulimit -H -n`
94
+    if [ $? -eq 0 ] ; then
95
+        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96
+            MAX_FD="$MAX_FD_LIMIT"
97
+        fi
98
+        ulimit -n $MAX_FD
99
+        if [ $? -ne 0 ] ; then
100
+            warn "Could not set maximum file descriptor limit: $MAX_FD"
101
+        fi
102
+    else
103
+        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104
+    fi
105
+fi
106
+
107
+# For Darwin, add options to specify how the application appears in the dock
108
+if $darwin; then
109
+    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110
+fi
111
+
112
+# For Cygwin, switch paths to Windows format before running java
113
+if $cygwin ; then
114
+    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115
+    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116
+    JAVACMD=`cygpath --unix "$JAVACMD"`
117
+
118
+    # We build the pattern for arguments to be converted via cygpath
119
+    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120
+    SEP=""
121
+    for dir in $ROOTDIRSRAW ; do
122
+        ROOTDIRS="$ROOTDIRS$SEP$dir"
123
+        SEP="|"
124
+    done
125
+    OURCYGPATTERN="(^($ROOTDIRS))"
126
+    # Add a user-defined pattern to the cygpath arguments
127
+    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128
+        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129
+    fi
130
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
131
+    i=0
132
+    for arg in "$@" ; do
133
+        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134
+        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
135
+
136
+        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
137
+            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138
+        else
139
+            eval `echo args$i`="\"$arg\""
140
+        fi
141
+        i=$((i+1))
142
+    done
143
+    case $i in
144
+        (0) set -- ;;
145
+        (1) set -- "$args0" ;;
146
+        (2) set -- "$args0" "$args1" ;;
147
+        (3) set -- "$args0" "$args1" "$args2" ;;
148
+        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149
+        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150
+        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151
+        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152
+        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153
+        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154
+    esac
155
+fi
156
+
157
+# Escape application args
158
+save () {
159
+    for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160
+    echo " "
161
+}
162
+APP_ARGS=$(save "$@")
163
+
164
+# Collect all arguments for the java command, following the shell quoting and substitution rules
165
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166
+
167
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169
+  cd "$(dirname "$0")"
170
+fi
171
+
172
+exec "$JAVACMD" "$@"

+ 84 - 0
gradlew.bat

@@ -0,0 +1,84 @@
1
+@if "%DEBUG%" == "" @echo off
2
+@rem ##########################################################################
3
+@rem
4
+@rem  Gradle startup script for Windows
5
+@rem
6
+@rem ##########################################################################
7
+
8
+@rem Set local scope for the variables with windows NT shell
9
+if "%OS%"=="Windows_NT" setlocal
10
+
11
+set DIRNAME=%~dp0
12
+if "%DIRNAME%" == "" set DIRNAME=.
13
+set APP_BASE_NAME=%~n0
14
+set APP_HOME=%DIRNAME%
15
+
16
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17
+set DEFAULT_JVM_OPTS=
18
+
19
+@rem Find java.exe
20
+if defined JAVA_HOME goto findJavaFromJavaHome
21
+
22
+set JAVA_EXE=java.exe
23
+%JAVA_EXE% -version >NUL 2>&1
24
+if "%ERRORLEVEL%" == "0" goto init
25
+
26
+echo.
27
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28
+echo.
29
+echo Please set the JAVA_HOME variable in your environment to match the
30
+echo location of your Java installation.
31
+
32
+goto fail
33
+
34
+:findJavaFromJavaHome
35
+set JAVA_HOME=%JAVA_HOME:"=%
36
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37
+
38
+if exist "%JAVA_EXE%" goto init
39
+
40
+echo.
41
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42
+echo.
43
+echo Please set the JAVA_HOME variable in your environment to match the
44
+echo location of your Java installation.
45
+
46
+goto fail
47
+
48
+:init
49
+@rem Get command-line arguments, handling Windows variants
50
+
51
+if not "%OS%" == "Windows_NT" goto win9xME_args
52
+
53
+:win9xME_args
54
+@rem Slurp the command line arguments.
55
+set CMD_LINE_ARGS=
56
+set _SKIP=2
57
+
58
+:win9xME_args_slurp
59
+if "x%~1" == "x" goto execute
60
+
61
+set CMD_LINE_ARGS=%*
62
+
63
+:execute
64
+@rem Setup the command line
65
+
66
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67
+
68
+@rem Execute Gradle
69
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70
+
71
+:end
72
+@rem End local scope for the variables with windows NT shell
73
+if "%ERRORLEVEL%"=="0" goto mainEnd
74
+
75
+:fail
76
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77
+rem the _cmd.exe /c_ return code!
78
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79
+exit /b 1
80
+
81
+:mainEnd
82
+if "%OS%"=="Windows_NT" endlocal
83
+
84
+:omega

+ 2 - 0
settings.gradle

@@ -0,0 +1,2 @@
1
+include ':app'
2
+rootProject.name='HSE-RFID'