Updated package name from refactored app to -> hpos [working]
This commit is contained in:
2
.idea/.name
generated
2
.idea/.name
generated
@@ -1 +1 @@
|
||||
Refactored App
|
||||
hpos
|
||||
17
.idea/deploymentTargetDropDown.xml
generated
17
.idea/deploymentTargetDropDown.xml
generated
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetDropDown">
|
||||
<runningDeviceTargetSelectedWithDropDown>
|
||||
<Target>
|
||||
<type value="RUNNING_DEVICE_TARGET" />
|
||||
<deviceKey>
|
||||
<Key>
|
||||
<type value="SERIAL_NUMBER" />
|
||||
<value value="192.168.0.135:5555" />
|
||||
</Key>
|
||||
</deviceKey>
|
||||
</Target>
|
||||
</runningDeviceTargetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2023-01-30T07:49:19.748240Z" />
|
||||
</component>
|
||||
</project>
|
||||
20
.idea/jarRepositories.xml
generated
Normal file
20
.idea/jarRepositories.xml
generated
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="MavenRepo" />
|
||||
<option name="name" value="MavenRepo" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
||||
@@ -2,12 +2,13 @@ plugins {
|
||||
id 'com.android.application'
|
||||
id 'org.jetbrains.kotlin.android'
|
||||
}
|
||||
//apply plugin: 'kotlin-android'
|
||||
|
||||
android {
|
||||
compileSdk 32
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.example.refactoredapp"
|
||||
applicationId "com.example.hpos"
|
||||
minSdk 21
|
||||
targetSdk 32
|
||||
versionCode 1
|
||||
@@ -44,8 +45,6 @@ dependencies {
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||
|
||||
// androidTestImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.1'
|
||||
|
||||
|
||||
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1"
|
||||
implementation 'com.opencsv:opencsv:4.6'
|
||||
@@ -55,4 +54,11 @@ dependencies {
|
||||
|
||||
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"
|
||||
|
||||
}
|
||||
//repositories {
|
||||
// mavenCentral()
|
||||
//}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.example.refactoredapp
|
||||
package com.example.hpos
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.example.refactoredapp">
|
||||
package="com.example.hpos">
|
||||
|
||||
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
@@ -15,16 +15,16 @@
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.RefactoredApp"
|
||||
android:theme="@style/Theme.HPOS"
|
||||
tools:targetApi="31">
|
||||
|
||||
<service
|
||||
android:name=".presentation.testRight.UsbService"
|
||||
android:name="com.example.hpos.presentation.testRight.UsbService"
|
||||
android:enabled="true"
|
||||
android:exported="false" />
|
||||
|
||||
<activity
|
||||
android:name=".presentation.SplashActivity"
|
||||
android:name="com.example.hpos.presentation.SplashActivity"
|
||||
android:exported="true"
|
||||
android:noHistory="true"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
@@ -35,7 +35,7 @@
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".presentation.testRight.TestRightActivity"
|
||||
android:name="com.example.hpos.presentation.testRight.TestRightActivity"
|
||||
android:exported="false"
|
||||
android:windowSoftInputMode="adjustPan">
|
||||
<!-- <intent-filter>-->
|
||||
@@ -47,7 +47,7 @@
|
||||
<!-- android:resource="@xml/device_filter" />-->
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".presentation.MainActivity"
|
||||
android:name="com.example.hpos.presentation.MainActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.example.refactoredapp
|
||||
package com.example.hpos
|
||||
|
||||
import android.app.Application
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.example.refactoredapp.data
|
||||
package com.example.hpos.data
|
||||
|
||||
import com.example.refactoredapp.data.model.TestRightDeviceConstants
|
||||
import com.example.hpos.data.model.TestRightDeviceConstants
|
||||
|
||||
object DataHolder {
|
||||
var isStoragePermissionGranted = false
|
||||
7
app/src/main/java/com/example/hpos/data/Repository.kt
Normal file
7
app/src/main/java/com/example/hpos/data/Repository.kt
Normal file
@@ -0,0 +1,7 @@
|
||||
package com.example.hpos.data
|
||||
|
||||
import com.example.hpos.data.model.TestInfo
|
||||
|
||||
interface Repository {
|
||||
suspend fun saveToDatabase(info: TestInfo)
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.example.refactoredapp.data
|
||||
package com.example.hpos.data
|
||||
|
||||
import com.example.refactoredapp.data.model.TestInfo
|
||||
import com.example.hpos.data.model.TestInfo
|
||||
|
||||
class RepositoryImpl : Repository {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.example.refactoredapp.data.constant
|
||||
package com.example.hpos.data.constant
|
||||
|
||||
object Constants {
|
||||
const val ACTION_USB_PERMISSION = "shanmukha.in.sickle_cell.USB_PERMISSION"
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.example.refactoredapp.data.constant
|
||||
package com.example.hpos.data.constant
|
||||
|
||||
enum class TestRightCommands(val command: String) {
|
||||
led2Set50("led2 50\r"),
|
||||
@@ -8,4 +8,5 @@ enum class TestRightCommands(val command: String) {
|
||||
run("run\r"),
|
||||
printInRange("print 239 339\r"),
|
||||
printAll("print\r"),
|
||||
testByEnter("\n\r")
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.example.HPOS.data.model
|
||||
package com.example.hpos.data.model
|
||||
|
||||
data class CalculationVariableForTest(
|
||||
var pixelNo: Int,
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.example.refactoredapp.data.model
|
||||
package com.example.hpos.data.model
|
||||
|
||||
enum class DeviceType {
|
||||
Denovix,
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.example.refactoredapp.data.model
|
||||
package com.example.hpos.data.model
|
||||
|
||||
data class PatientData(
|
||||
val name: String,
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.example.refactoredapp.data.model
|
||||
package com.example.hpos.data.model
|
||||
|
||||
data class TestInfo(
|
||||
val value: String,
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.example.refactoredapp.data.model
|
||||
package com.example.hpos.data.model
|
||||
|
||||
data class TestRightCalculationData(
|
||||
var absorbanceOne: Double?,
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.example.refactoredapp.data.model
|
||||
package com.example.hpos.data.model
|
||||
|
||||
data class TestRightDeviceConstants(
|
||||
var a: String,
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.example.refactoredapp.data.model
|
||||
package com.example.hpos.data.model
|
||||
|
||||
enum class TestRightResultType {
|
||||
NORMAL,
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.example.refactoredapp.domain
|
||||
package com.example.hpos.domain
|
||||
|
||||
import com.example.refactoredapp.data.constant.Constants
|
||||
import com.example.refactoredapp.data.model.TestRightCalculationData
|
||||
import com.example.refactoredapp.data.model.TestRightResultType
|
||||
import com.example.hpos.data.constant.Constants
|
||||
import com.example.hpos.data.model.TestRightCalculationData
|
||||
import com.example.hpos.data.model.TestRightResultType
|
||||
|
||||
class ResultCalculationWithAvgImpl : TestRightResultCalculation {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.example.refactoredapp.domain
|
||||
package com.example.hpos.domain
|
||||
|
||||
import android.util.Log
|
||||
import com.example.refactoredapp.data.constant.Constants
|
||||
import com.example.refactoredapp.data.model.TestRightResultType
|
||||
import com.example.hpos.data.constant.Constants
|
||||
import com.example.hpos.data.model.TestRightResultType
|
||||
import kotlin.math.log10
|
||||
|
||||
class ResultCalculationWithFirstImpl {
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.example.refactoredapp.domain
|
||||
package com.example.hpos.domain
|
||||
|
||||
import com.example.refactoredapp.data.constant.Constants
|
||||
import com.example.refactoredapp.data.model.TestRightCalculationData
|
||||
import com.example.refactoredapp.data.model.TestRightResultType
|
||||
import com.example.hpos.data.constant.Constants
|
||||
import com.example.hpos.data.model.TestRightCalculationData
|
||||
import com.example.hpos.data.model.TestRightResultType
|
||||
|
||||
class ResultCalculationWithMaxImpl : TestRightResultCalculation {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.example.refactoredapp.domain
|
||||
package com.example.hpos.domain
|
||||
|
||||
import com.example.refactoredapp.data.model.TestRightCalculationData
|
||||
import com.example.hpos.data.model.TestRightCalculationData
|
||||
import com.opencsv.CSVWriter
|
||||
import java.io.File
|
||||
import java.io.FileWriter
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.example.HPOS.domain
|
||||
package com.example.hpos.domain
|
||||
|
||||
import com.example.HPOS.data.model.CalculationVariableForTest
|
||||
import com.example.hpos.data.model.CalculationVariableForTest
|
||||
import com.opencsv.CSVWriter
|
||||
import java.io.File
|
||||
import java.io.FileWriter
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.example.hpos.domain
|
||||
|
||||
import com.example.hpos.data.model.TestRightCalculationData
|
||||
|
||||
interface TestRightResultCalculation {
|
||||
fun getResults(
|
||||
wavelengthToAbsorbance: ArrayList<ArrayList<Double>>
|
||||
): TestRightCalculationData
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
package com.example.refactoredapp.presentation
|
||||
package com.example.hpos.presentation
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import com.example.refactoredapp.databinding.ActivityMainBinding
|
||||
import com.example.refactoredapp.presentation.testRight.TestRightActivity
|
||||
import com.example.refactoredapp.util.MyViewModelFactory
|
||||
import com.example.hpos.databinding.ActivityMainBinding
|
||||
import com.example.hpos.presentation.testRight.TestRightActivity
|
||||
import com.example.hpos.util.MyViewModelFactory
|
||||
|
||||
|
||||
class MainActivity : AppCompatActivity()
|
||||
@@ -45,17 +45,4 @@ class MainActivity : AppCompatActivity()
|
||||
}
|
||||
|
||||
|
||||
|
||||
private fun setupObservers() {
|
||||
// viewModel.isStoragePermission.observe(this) {
|
||||
// if (it) {
|
||||
// createFolder()
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.example.hpos.presentation
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
|
||||
class MainViewModel : ViewModel() {
|
||||
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.example.refactoredapp.presentation
|
||||
package com.example.hpos.presentation
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.example.refactoredapp.R
|
||||
import com.example.refactoredapp.data.model.PatientData
|
||||
import com.example.hpos.R
|
||||
import com.example.hpos.data.model.PatientData
|
||||
|
||||
class RVAdapter : RecyclerView.Adapter<RVAdapter.ViewHolder>() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.example.refactoredapp.presentation
|
||||
package com.example.hpos.presentation
|
||||
|
||||
import android.Manifest
|
||||
import android.content.Intent
|
||||
@@ -13,11 +13,9 @@ import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.example.refactoredapp.R
|
||||
import com.example.refactoredapp.data.DataHolder
|
||||
import com.example.refactoredapp.databinding.ActivitySplashBinding
|
||||
import com.example.refactoredapp.util.MyUtils
|
||||
import java.io.File
|
||||
import com.example.hpos.data.DataHolder
|
||||
import com.example.hpos.databinding.ActivitySplashBinding
|
||||
import com.example.hpos.util.MyUtils
|
||||
|
||||
/**
|
||||
* Splash Activity
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.example.refactoredapp.presentation
|
||||
package com.example.hpos.presentation
|
||||
|
||||
interface UsbServiceListener {
|
||||
fun onUsbRead(data: ByteArray?)
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.example.refactoredapp.presentation.testRight
|
||||
package com.example.hpos.presentation.testRight
|
||||
|
||||
import android.R
|
||||
import android.app.PendingIntent
|
||||
import android.content.*
|
||||
import android.hardware.usb.UsbDevice
|
||||
@@ -8,13 +9,16 @@ import android.hardware.usb.UsbManager
|
||||
import android.os.Bundle
|
||||
import android.os.IBinder
|
||||
import android.util.Log
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import com.example.refactoredapp.data.constant.Constants
|
||||
import com.example.refactoredapp.data.DataHolder
|
||||
import com.example.refactoredapp.databinding.ActivityTestRightBinding
|
||||
import com.example.refactoredapp.util.MyViewModelFactory
|
||||
import com.example.hpos.data.DataHolder
|
||||
import com.example.hpos.data.constant.Constants
|
||||
import com.example.hpos.databinding.ActivityTestRightBinding
|
||||
import com.example.hpos.util.MyViewModelFactory
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.hoho.android.usbserial.driver.UsbSerialDriver
|
||||
import com.hoho.android.usbserial.driver.UsbSerialProber
|
||||
|
||||
@@ -1,23 +1,21 @@
|
||||
package com.example.refactoredapp.presentation.testRight
|
||||
package com.example.hpos.presentation.testRight
|
||||
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import com.example.refactoredapp.R
|
||||
import com.example.refactoredapp.data.DataHolder
|
||||
import com.example.refactoredapp.data.constant.Constants
|
||||
import com.example.refactoredapp.data.constant.TestRightCommands
|
||||
import com.example.refactoredapp.databinding.FragmentTestRightExpReferenceBinding
|
||||
import com.example.refactoredapp.presentation.UsbServiceListener
|
||||
import com.example.refactoredapp.presentation.utils.MyDialogListener
|
||||
import com.example.refactoredapp.presentation.utils.UIUtils
|
||||
import com.example.hpos.R
|
||||
import com.example.hpos.data.DataHolder
|
||||
import com.example.hpos.data.constant.TestRightCommands
|
||||
import com.example.hpos.databinding.FragmentTestRightExpReferenceBinding
|
||||
import com.example.hpos.presentation.UsbServiceListener
|
||||
import com.example.hpos.presentation.utils.MyDialogListener
|
||||
import com.example.hpos.presentation.utils.UIUtils
|
||||
|
||||
|
||||
class TestRightExpReference : Fragment() {
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.example.refactoredapp.presentation.testRight
|
||||
package com.example.hpos.presentation.testRight
|
||||
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
@@ -9,14 +9,12 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import com.example.refactoredapp.R
|
||||
import com.example.refactoredapp.data.DataHolder
|
||||
import com.example.refactoredapp.data.constant.Constants
|
||||
import com.example.refactoredapp.data.constant.TestRightCommands
|
||||
import com.example.refactoredapp.data.model.PatientData
|
||||
import com.example.refactoredapp.data.model.TestRightResultType
|
||||
import com.example.refactoredapp.databinding.FragmentTestRightExpSampleBinding
|
||||
import com.example.refactoredapp.presentation.UsbServiceListener
|
||||
import com.example.hpos.R
|
||||
import com.example.hpos.data.constant.TestRightCommands
|
||||
import com.example.hpos.data.model.PatientData
|
||||
import com.example.hpos.data.model.TestRightResultType
|
||||
import com.example.hpos.databinding.FragmentTestRightExpSampleBinding
|
||||
import com.example.hpos.presentation.UsbServiceListener
|
||||
|
||||
class TestRightExpSample : Fragment() {
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.example.refactoredapp.presentation.testRight
|
||||
package com.example.hpos.presentation.testRight
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
@@ -8,13 +8,13 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import com.example.refactoredapp.R
|
||||
import com.example.refactoredapp.data.DataHolder
|
||||
import com.example.refactoredapp.data.constant.Constants
|
||||
import com.example.refactoredapp.data.model.TestRightResultType
|
||||
import com.example.refactoredapp.databinding.FragmentTestRightResultsBinding
|
||||
import com.example.refactoredapp.presentation.MainActivity
|
||||
import com.example.refactoredapp.util.MyUtils
|
||||
import com.example.hpos.R
|
||||
import com.example.hpos.data.DataHolder
|
||||
import com.example.hpos.data.constant.Constants
|
||||
import com.example.hpos.data.model.TestRightResultType
|
||||
import com.example.hpos.databinding.FragmentTestRightResultsBinding
|
||||
import com.example.hpos.presentation.MainActivity
|
||||
import com.example.hpos.util.MyUtils
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
package com.example.refactoredapp.presentation.testRight
|
||||
package com.example.hpos.presentation.testRight
|
||||
|
||||
import android.util.Log
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.example.refactoredapp.data.constant.Constants
|
||||
import com.example.refactoredapp.data.DataHolder
|
||||
import com.example.refactoredapp.data.model.PatientData
|
||||
import com.example.refactoredapp.data.model.TestRightCalculationData
|
||||
import com.example.refactoredapp.data.model.TestRightDeviceConstants
|
||||
import com.example.refactoredapp.domain.ResultCalculationWithMaxImpl
|
||||
import com.example.refactoredapp.domain.SaveRawData
|
||||
import com.example.refactoredapp.domain.TestRightResultCalculation
|
||||
import com.example.hpos.data.constant.Constants
|
||||
import com.example.hpos.data.DataHolder
|
||||
import com.example.hpos.data.model.CalculationVariableForTest
|
||||
import com.example.hpos.data.model.PatientData
|
||||
import com.example.hpos.data.model.TestRightCalculationData
|
||||
import com.example.hpos.data.model.TestRightDeviceConstants
|
||||
import com.example.hpos.domain.ResultCalculationWithMaxImpl
|
||||
import com.example.hpos.domain.SaveRawData
|
||||
import com.example.hpos.domain.SaveRawDataTest
|
||||
import com.example.hpos.domain.TestRightResultCalculation
|
||||
import java.lang.Exception
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
@@ -41,7 +43,7 @@ class TestRightViewModel : ViewModel() {
|
||||
// private val intensityReferenceArray = ArrayList<Double>()
|
||||
|
||||
/* (For exp sample) Contains pixel no. -> Intensity of light falling on that pixel */
|
||||
private val intensitySampleArray = ArrayList<Double>()
|
||||
val intensitySampleArray = ArrayList<Double>()
|
||||
|
||||
val wavelengthToAbsorbance = ArrayList<ArrayList<Double>>()
|
||||
|
||||
@@ -186,7 +188,6 @@ class TestRightViewModel : ViewModel() {
|
||||
// for ((index,wavelength) in wavelengthToPixelArray.withIndex()) {
|
||||
for (index in 0 until DataHolder.wavelengthToPixelArray.size) {
|
||||
|
||||
|
||||
// Todo: handle indexInIntensityArrays <0
|
||||
|
||||
val invertedPixelIndex = (Constants.TEST_RIGHT_TOTAL_PIXEL) - (index + 1)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.example.refactoredapp.presentation.testRight
|
||||
package com.example.hpos.presentation.testRight
|
||||
|
||||
import android.app.Service
|
||||
import android.content.Intent
|
||||
@@ -6,9 +6,9 @@ import android.hardware.usb.UsbDeviceConnection
|
||||
import android.os.Binder
|
||||
import android.os.IBinder
|
||||
import android.util.Log
|
||||
import com.example.refactoredapp.data.constant.Constants
|
||||
import com.example.refactoredapp.data.constant.TestRightCommands
|
||||
import com.example.refactoredapp.presentation.UsbServiceListener
|
||||
import com.example.hpos.data.constant.Constants
|
||||
import com.example.hpos.data.constant.TestRightCommands
|
||||
import com.example.hpos.presentation.UsbServiceListener
|
||||
import com.hoho.android.usbserial.driver.UsbSerialDriver
|
||||
import com.hoho.android.usbserial.driver.UsbSerialPort
|
||||
import com.hoho.android.usbserial.util.SerialInputOutputManager
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.example.refactoredapp.presentation.utils
|
||||
package com.example.hpos.presentation.utils
|
||||
|
||||
interface MyDialogListener {
|
||||
fun onClickBtnOne()
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.example.refactoredapp.presentation.utils
|
||||
package com.example.hpos.presentation.utils
|
||||
|
||||
import android.content.Context
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
@@ -1,11 +1,9 @@
|
||||
package com.example.refactoredapp.util
|
||||
package com.example.hpos.util
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Environment
|
||||
import android.widget.Toast
|
||||
import com.example.refactoredapp.R
|
||||
import com.example.refactoredapp.data.DataHolder
|
||||
import com.example.refactoredapp.data.model.DeviceType
|
||||
import com.example.hpos.R
|
||||
import com.example.hpos.data.model.DeviceType
|
||||
import java.io.File
|
||||
|
||||
class MyUtils {
|
||||
@@ -1,18 +1,16 @@
|
||||
package com.example.refactoredapp.util
|
||||
package com.example.hpos.util
|
||||
|
||||
import android.content.Context
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import com.example.refactoredapp.domain.ParseDenovixUseCase
|
||||
import com.example.refactoredapp.domain.ParseTestRightCSVUseCase
|
||||
import com.example.refactoredapp.presentation.MainViewModel
|
||||
import com.example.refactoredapp.presentation.testRight.TestRightViewModel
|
||||
import com.example.hpos.presentation.MainViewModel
|
||||
import com.example.hpos.presentation.testRight.TestRightViewModel
|
||||
|
||||
class MyViewModelFactory(private val context: Context) : ViewModelProvider.Factory {
|
||||
|
||||
override fun <T : ViewModel> create(modelClass: Class<T>): T {
|
||||
if (modelClass.isAssignableFrom(MainViewModel::class.java))
|
||||
return MainViewModel(ParseDenovixUseCase(), ParseTestRightCSVUseCase()) as T
|
||||
return MainViewModel() as T
|
||||
else if (modelClass.isAssignableFrom(TestRightViewModel::class.java))
|
||||
return TestRightViewModel() as T
|
||||
else
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.example.refactoredapp.data
|
||||
|
||||
import com.example.refactoredapp.data.model.TestInfo
|
||||
import java.io.File
|
||||
|
||||
interface Repository {
|
||||
suspend fun saveToDatabase(info: TestInfo)
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package com.example.refactoredapp.domain
|
||||
|
||||
import com.example.refactoredapp.data.model.TestRightCalculationData
|
||||
import com.example.refactoredapp.data.model.TestRightResultType
|
||||
|
||||
interface TestRightResultCalculation {
|
||||
fun getResults(
|
||||
wavelengthToAbsorbance: ArrayList<ArrayList<Double>>
|
||||
): TestRightCalculationData
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.example.refactoredapp.presentation
|
||||
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.example.refactoredapp.data.model.DeviceType
|
||||
import com.example.refactoredapp.domain.ParseCSV
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import java.io.File
|
||||
|
||||
class MainViewModel(private val parseDenovix: ParseCSV, private val parseTestRight: ParseCSV) : ViewModel() {
|
||||
|
||||
var device = DeviceType.TestRight
|
||||
var isStoragePermission = MutableLiveData<Boolean>(false)
|
||||
|
||||
// val resultsLiveData = MutableLiveData<ArrayList<DenovixData>>()
|
||||
|
||||
fun parseCSV(file: File){
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
parseDenovix.parseCSV(file)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.RefactoredApp" parent="Theme.MaterialComponents.Light.DarkActionBar">
|
||||
<style name="Theme.HPOS" parent="Theme.MaterialComponents.Light.NoActionBar">
|
||||
<!-- <style name="Theme.RefactoredApp" parent="Theme.MaterialComponents.Light.DarkActionBar">-->
|
||||
<!-- Primary brand color. -->
|
||||
|
||||
<!-- <item name="colorPrimary">@color/purple_200</item>-->
|
||||
|
||||
@@ -67,5 +67,6 @@
|
||||
<string name="sicklecell_nconfirmatory">Sicklecell\nConfirmatory</string>
|
||||
<string name="sicklecell_screening">Sicklecell Screening</string>
|
||||
<string name="thalassemia">Thalassemia</string>
|
||||
<string name="usb_connection">USB Connection</string>
|
||||
|
||||
</resources>
|
||||
@@ -1,6 +1,7 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.RefactoredApp" parent="Theme.MaterialComponents.Light.DarkActionBar">
|
||||
<style name="Theme.HPOS" parent="Theme.MaterialComponents.Light.NoActionBar">
|
||||
<!-- <style name="Theme.RefactoredApp" parent="Theme.MaterialComponents.Light.DarkActionBar">-->
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/blue_app</item>
|
||||
<!-- <item name="colorPrimaryVariant">@color/purple_700</item>-->
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.example.refactoredapp
|
||||
package com.example.hpos
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.example.refactoredapp
|
||||
package com.example.hpos
|
||||
|
||||
class InputData {
|
||||
val inputRead = "0,1.69989422e-06,1.60642711e-01, 3.85754470e+02,0,0,1,0, FFF-EEEE-PPP-WW-YY-NNNN\nОК [01]"
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.example.refactoredapp
|
||||
package com.example.hpos
|
||||
|
||||
import com.example.refactoredapp.data.Constants
|
||||
import com.example.refactoredapp.data.model.PatientData
|
||||
import com.example.refactoredapp.presentation.testRight.TestRightViewModel
|
||||
import com.example.hpos.data.constant.Constants
|
||||
import com.example.hpos.data.DataHolder
|
||||
import com.example.hpos.data.model.PatientData
|
||||
import com.example.hpos.data.model.TestRightResultType
|
||||
import com.example.hpos.presentation.testRight.TestRightViewModel
|
||||
import junit.framework.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
@@ -13,10 +15,10 @@ class TestRightViewModelTest {
|
||||
@Test
|
||||
fun testRightViewModel_mapDeviceConstants() {
|
||||
viewModel.mapDeviceConstants(data.inputRead)
|
||||
assertEquals("0", viewModel.deviceConstant!!.a)
|
||||
assertEquals("1.69989422e-06", viewModel.deviceConstant!!.b)
|
||||
assertEquals("1.60642711e-01", viewModel.deviceConstant!!.c)
|
||||
assertEquals("3.85754470e+02", viewModel.deviceConstant!!.d)
|
||||
assertEquals("0", DataHolder.deviceConstant!!.a)
|
||||
assertEquals("1.69989422e-06", DataHolder.deviceConstant!!.b)
|
||||
assertEquals("1.60642711e-01", DataHolder.deviceConstant!!.c)
|
||||
assertEquals("3.85754470e+02", DataHolder.deviceConstant!!.d)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -24,13 +26,15 @@ class TestRightViewModelTest {
|
||||
viewModel.mapDeviceConstants(data.inputRead)
|
||||
viewModel.mapPixelNumberToWavelength()
|
||||
|
||||
for (each in viewModel.wavelengthToPixelArray){
|
||||
System.out.print(each[0])
|
||||
var i = 1
|
||||
for (each in DataHolder.wavelengthToPixelArray){
|
||||
System.out.print(i)
|
||||
System.out.print(" -> ")
|
||||
System.out.println(each[1])
|
||||
System.out.println(each)
|
||||
i++
|
||||
}
|
||||
|
||||
assertEquals(Constants.TEST_RIGHT_TOTAL_PIXEL, viewModel.wavelengthToPixelArray.size)
|
||||
assertEquals(Constants.TEST_RIGHT_TOTAL_PIXEL, DataHolder.wavelengthToPixelArray.size)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -40,7 +44,7 @@ class TestRightViewModelTest {
|
||||
viewModel.mapPixelNumberToWavelength()
|
||||
viewModel.mapIntensityValues(data.printForReference, true)
|
||||
viewModel.mapIntensityValues(data.printForSample, false)
|
||||
viewModel.patientDetails = PatientData("Surya", 2, "Male", null)
|
||||
viewModel.patientDetails = PatientData("Surya", 2, "Male", TestRightResultType.UNDEFINED)
|
||||
viewModel.calculateResults()
|
||||
|
||||
}
|
||||
@@ -55,27 +59,13 @@ class TestRightViewModelTest {
|
||||
viewModel.mapIntensityValues(data.printForSample, false)
|
||||
// viewModel.patientDetails = PatientData("Surya", 2, "Male", null)
|
||||
// viewModel.calculateResults()
|
||||
viewModel.calculateDataForCSV()
|
||||
viewModel.mapWavelengthToAbsorbance()
|
||||
|
||||
for (each in viewModel.wavelengthToAbsorbance){
|
||||
println(each[0].toString() + " -> " + each[1])
|
||||
}
|
||||
}
|
||||
|
||||
// @Test
|
||||
// fun testRightViewModel_mapIntensityValues() {
|
||||
//
|
||||
// viewModel.mapIntensityValues(data.fullStringPrint, true)
|
||||
//
|
||||
// for (each in viewModel.intensityReferenceArray){
|
||||
// System.out.print(each[0])
|
||||
// System.out.print(" -> ")
|
||||
// System.out.println(each[1])
|
||||
// }
|
||||
//
|
||||
// assertEquals(23, viewModel.intensityReferenceArray.size)
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
10
build.gradle
10
build.gradle
@@ -1,3 +1,13 @@
|
||||
//buildscript {
|
||||
// ext.kotlin_version = '1.6.21'
|
||||
// dependencies {
|
||||
// classpath 'com.android.tools.build:gradle:3.4.0'
|
||||
// classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
// }
|
||||
// repositories {
|
||||
// mavenCentral()
|
||||
// }
|
||||
//}
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
//buildscript {
|
||||
|
||||
@@ -13,5 +13,5 @@ dependencyResolutionManagement {
|
||||
maven { url 'https://jitpack.io' }
|
||||
}
|
||||
}
|
||||
rootProject.name = "Refactored App"
|
||||
rootProject.name = "hpos"
|
||||
include ':app'
|
||||
|
||||
Reference in New Issue
Block a user