1. Added demo camera scanner page.
2. Added new checkboxes for patient data collection
This commit is contained in:
2
.idea/compiler.xml
generated
2
.idea/compiler.xml
generated
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="11" />
|
||||
<bytecodeTargetLevel target="17" />
|
||||
</component>
|
||||
</project>
|
||||
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
@@ -7,6 +7,7 @@
|
||||
<option name="testRunner" value="GRADLE" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="Embedded JDK" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
|
||||
6
.idea/misc.xml
generated
6
.idea/misc.xml
generated
@@ -1,4 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DesignSurface">
|
||||
<option name="filePathToZoomLevelMap">
|
||||
@@ -22,7 +21,8 @@
|
||||
<entry key="app/src/main/res/layout/activity_test_right.xml" value="0.24375" />
|
||||
<entry key="app/src/main/res/layout/fragment_graph.xml" value="0.19791666666666666" />
|
||||
<entry key="app/src/main/res/layout/fragment_test_right_exp_reference.xml" value="0.25" />
|
||||
<entry key="app/src/main/res/layout/fragment_test_right_exp_sample.xml" value="0.25" />
|
||||
<entry key="app/src/main/res/layout/fragment_test_right_exp_sample.xml" value="0.24583333333333332" />
|
||||
<entry key="app/src/main/res/layout/fragment_test_right_exp_scanner.xml" value="0.24583333333333332" />
|
||||
<entry key="app/src/main/res/layout/fragment_test_right_process.xml" value="0.24375" />
|
||||
<entry key="app/src/main/res/layout/fragment_test_right_results.xml" value="0.30512820512820515" />
|
||||
<entry key="app/src/main/res/layout/table_item.xml" value="0.22407407407407406" />
|
||||
@@ -33,7 +33,7 @@
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
||||
@@ -35,6 +35,12 @@ android {
|
||||
dataBinding {
|
||||
enabled = true
|
||||
}
|
||||
lintOptions {
|
||||
checkReleaseBuilds false
|
||||
// Or, if you prefer, you can continue to check for errors in release builds,
|
||||
// but continue the build even when errors are found:
|
||||
abortOnError false
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -54,11 +60,11 @@ dependencies {
|
||||
|
||||
implementation "androidx.fragment:fragment-ktx:1.5.5"
|
||||
|
||||
// CSV read, write
|
||||
implementation 'com.opencsv:opencsv:4.6'
|
||||
|
||||
// implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
// implementation "androidx.core:core-ktx:+"
|
||||
// implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
// Barcode scanner
|
||||
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
|
||||
|
||||
}
|
||||
//repositories {
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
|
||||
<uses-feature android:name="android.hardware.camera" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.example.hpos.presentation.testRight
|
||||
|
||||
import android.Manifest
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import com.example.hpos.R
|
||||
import com.example.hpos.databinding.FragmentTestRightExpSampleBinding
|
||||
import com.example.hpos.databinding.FragmentTestRightExpScannerBinding
|
||||
import com.journeyapps.barcodescanner.ScanContract
|
||||
import com.journeyapps.barcodescanner.ScanIntentResult
|
||||
import com.journeyapps.barcodescanner.ScanOptions
|
||||
|
||||
class TestRightExpScanner : Fragment() {
|
||||
|
||||
private lateinit var binding: FragmentTestRightExpScannerBinding
|
||||
private val viewModel: TestRightViewModel by activityViewModels()
|
||||
|
||||
val MY_CAMERA_REQUEST_CODE = 100
|
||||
private val TAG = "TestRightExpScanner"
|
||||
|
||||
val requestCameraPermission = registerForActivityResult( ActivityResultContracts.RequestPermission()) { isGranted ->
|
||||
if (isGranted){
|
||||
startCamera()
|
||||
} else {
|
||||
Toast.makeText(requireContext(), "Camera Permission is Required to Scan", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
private val barcodeLauncher = registerForActivityResult(ScanContract()) { result: ScanIntentResult ->
|
||||
if (result.contents == null) {
|
||||
Toast.makeText(requireContext(), "Unsuccessful, Please Scan Again!! ", Toast.LENGTH_SHORT).show()
|
||||
} else {
|
||||
viewModel.processEncodedScannedData(result.contents)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
// Inflate the layout for this fragment
|
||||
binding = FragmentTestRightExpScannerBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
|
||||
setupListeners()
|
||||
|
||||
}
|
||||
|
||||
private fun setupListeners() {
|
||||
binding.btnScanAadhaar.setOnClickListener {
|
||||
scanAadhaarCard()
|
||||
}
|
||||
binding.btnScanAbha.setOnClickListener {
|
||||
scanAbhaCard()
|
||||
}
|
||||
}
|
||||
|
||||
private fun scanAadhaarCard() {
|
||||
// Toast.makeText(requireContext(), "Scan Aadhaar Clicked", Toast.LENGTH_SHORT).show();
|
||||
requestCameraPermission.launch(Manifest.permission.CAMERA)
|
||||
}
|
||||
|
||||
private fun scanAbhaCard() {
|
||||
Toast.makeText(requireContext(), "Scan Abha Clicked", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
|
||||
private fun startCamera() {
|
||||
Toast.makeText(requireContext(), "SUCESS CAMERA START", Toast.LENGTH_SHORT).show();
|
||||
|
||||
val options = ScanOptions()
|
||||
options.setDesiredBarcodeFormats(ScanOptions.QR_CODE)
|
||||
options.setPrompt("Scan a barcode")
|
||||
options.setCameraId(0) // Use a specific camera of the device
|
||||
|
||||
options.setBeepEnabled(true)
|
||||
options.setBarcodeImageEnabled(true)
|
||||
|
||||
options.setPrompt("Start Scanning")
|
||||
options.setOrientationLocked(false)
|
||||
// options.setTimeout(1000) // in ms
|
||||
|
||||
barcodeLauncher.launch(options)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -292,6 +292,7 @@ class TestRightViewModel : ViewModel() {
|
||||
} else {
|
||||
// errorTriggered.postValue("Unable to save CSV, Please try again")
|
||||
}
|
||||
|
||||
}
|
||||
// } catch (e: java.io.FileNotFoundException) {
|
||||
// errorTriggered.postValue(
|
||||
@@ -389,4 +390,11 @@ class TestRightViewModel : ViewModel() {
|
||||
}
|
||||
}
|
||||
|
||||
// Scanner Fragment Related Members
|
||||
|
||||
fun processEncodedScannedData(contents: String) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
6
app/src/main/res/drawable/ic_baseline_camera_alt_24.xml
Normal file
6
app/src/main/res/drawable/ic_baseline_camera_alt_24.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<vector android:autoMirrored="true" android:height="24dp"
|
||||
android:tint="#FFFFFF" android:viewportHeight="24"
|
||||
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M12,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0"/>
|
||||
<path android:fillColor="@android:color/white" android:pathData="M9,2L7.17,4L4,4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2L9,2zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5z"/>
|
||||
</vector>
|
||||
@@ -55,6 +55,18 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_title" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_scan_aadhaar"
|
||||
android:layout_width="216dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:clickable="false"
|
||||
android:text="@string/scan_aadhaar_card"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_subtitle1" />
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/cv_sample_details"
|
||||
android:layout_width="0dp"
|
||||
@@ -64,7 +76,7 @@
|
||||
app:cardElevation="8dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_subtitle1">
|
||||
app:layout_constraintTop_toBottomOf="@id/btn_scan_aadhaar">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
@@ -149,7 +161,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:hint="@string/gender"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/et_age">
|
||||
@@ -165,6 +176,25 @@
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.checkbox.MaterialCheckBox
|
||||
android:id="@+id/cb_item1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:text="@string/is_patient_under_any_medication"
|
||||
app:layout_constraintTop_toBottomOf="@id/dd_gender"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
|
||||
<com.google.android.material.checkbox.MaterialCheckBox
|
||||
android:id="@+id/cb_item2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:text="@string/is_patient_undergoing_any_blood_transfusion"
|
||||
app:layout_constraintTop_toBottomOf="@id/cb_item1"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
|
||||
133
app/src/main/res/layout/fragment_test_right_exp_scanner.xml
Normal file
133
app/src/main/res/layout/fragment_test_right_exp_scanner.xml
Normal file
@@ -0,0 +1,133 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context=".presentation.testRight.TestRightExpScanner">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<!-- <Button-->
|
||||
<!-- android:id="@+id/btn_update_reference"-->
|
||||
<!-- android:layout_width="216dp"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginHorizontal="24dp"-->
|
||||
<!-- android:layout_marginTop="24dp"-->
|
||||
<!-- android:clickable="false"-->
|
||||
<!-- android:text="@string/update_reference"-->
|
||||
<!-- android:textColor="@color/white"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent" />-->
|
||||
|
||||
<!-- <androidx.constraintlayout.widget.ConstraintLayout-->
|
||||
<!-- android:id="@+id/cl_instructions"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@id/btn_update_reference">-->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
style="@style/title1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/patient_details"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_scan_aadhaar"
|
||||
android:layout_width="216dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:clickable="false"
|
||||
android:drawableLeft="@drawable/ic_baseline_camera_alt_24"
|
||||
android:text="@string/scan_aadhaar_card"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_title" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_subtitle1"
|
||||
style="@style/title2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:text="@string/or"
|
||||
android:textAlignment="center"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btn_scan_aadhaar" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_scan_abha"
|
||||
android:layout_width="216dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:clickable="false"
|
||||
android:drawableLeft="@drawable/ic_baseline_camera_alt_24"
|
||||
android:text="@string/scan_abha_card"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_subtitle1" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_subtitle2"
|
||||
style="@style/title2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:text="@string/or"
|
||||
android:textAlignment="center"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btn_scan_abha" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_enter_manually"
|
||||
android:layout_width="216dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:clickable="false"
|
||||
android:text="Enter Manually"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_subtitle2" />
|
||||
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:elevation="12dp"
|
||||
android:indeterminate="true"
|
||||
android:indeterminateDrawable="@drawable/progressbar_drawable"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</layout>
|
||||
@@ -33,7 +33,6 @@
|
||||
<string name="yes_and_run">Yes, Run</string>
|
||||
|
||||
|
||||
|
||||
<!-- Instructions Text -->
|
||||
<string name="Instructions">Instructions</string>
|
||||
<string name="step1"><b><u>Step 1</u> : </b> Place the cuvette containing reference/baseline sample for referencing.</string>
|
||||
@@ -83,5 +82,11 @@
|
||||
<string name="recommended_age">\*Result to be confirmed with laboratory test as age of the patient is less than 5 years</string>
|
||||
<string name="positive_borderline">Positive Borderline</string>
|
||||
<string name="negative_borderline">Negative Borderline</string>
|
||||
<string name="is_patient_under_any_medication">Is Patient under any medication or treatment?</string>
|
||||
<string name="is_patient_undergoing_any_blood_transfusion">Is Patient undergoing any blood transfusion?</string>
|
||||
<string name="scan_aadhaar_card">Scan Aadhaar\nCard</string>
|
||||
<string name="patient_details">Patient Details</string>
|
||||
<string name="or">OR</string>
|
||||
<string name="scan_abha_card">Scan ABHA\nCard</string>
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user