Compare commits

..

7 Commits

68 changed files with 516 additions and 1059 deletions

3
.idea/gradle.xml generated
View File

@@ -4,8 +4,9 @@
<component name="GradleSettings"> <component name="GradleSettings">
<option name="linkedExternalProjectsSettings"> <option name="linkedExternalProjectsSettings">
<GradleProjectSettings> <GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="externalProjectPath" value="$PROJECT_DIR$" /> <option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" /> <option name="gradleJvm" value="jbr-17" />
<option name="modules"> <option name="modules">
<set> <set>
<option value="$PROJECT_DIR$" /> <option value="$PROJECT_DIR$" />

View File

@@ -1,4 +0,0 @@
### Release key
key0: prime24

1
app/.gitignore vendored
View File

@@ -1,4 +1,3 @@
/build /build
/release
/google-services* /google-services*
/idea /idea

View File

@@ -80,16 +80,16 @@ dependencies {
implementation 'com.google.firebase:firebase-auth-ktx' implementation 'com.google.firebase:firebase-auth-ktx'
implementation 'com.google.firebase:firebase-storage-ktx' implementation 'com.google.firebase:firebase-storage-ktx'
implementation 'com.firebaseui:firebase-ui-firestore:8.0.2' implementation 'com.firebaseui:firebase-ui-firestore:8.0.2'
implementation 'com.google.android.gms:play-services-auth:21.0.0' implementation 'com.google.android.gms:play-services-auth:20.7.0'
implementation 'com.google.android.gms:play-services-location:21.1.0' implementation 'com.google.android.gms:play-services-location:21.1.0'
implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1' implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
implementation 'com.google.android.things:androidthings:1.0' implementation 'com.google.android.things:androidthings:1.0'
implementation 'com.google.firebase:firebase-appdistribution:16.0.0-beta12' implementation 'com.google.firebase:firebase-appdistribution:16.0.0-beta11'
implementation("com.google.firebase:firebase-appdistribution-api-ktx:16.0.0-beta12") implementation("com.google.firebase:firebase-appdistribution-api-ktx:16.0.0-beta11")
implementation 'androidx.preference:preference-ktx:1.2.1' implementation 'androidx.preference:preference-ktx:1.2.1'
implementation 'androidx.preference:preference-ktx:1.2.1' implementation 'androidx.preference:preference-ktx:1.2.1'
implementation 'com.google.android.play:core:1.10.3' implementation 'com.google.android.play:core:1.10.3'
implementation 'io.nats:jnats:2.11.4' implementation 'io.nats:jnats:2.11.2'
@@ -143,8 +143,8 @@ dependencies {
annotationProcessor 'com.github.bumptech.glide:compiler:4.13.2' annotationProcessor 'com.github.bumptech.glide:compiler:4.13.2'
// Navigation Component // Navigation Component
implementation "androidx.navigation:navigation-fragment-ktx:2.7.7" implementation "androidx.navigation:navigation-fragment-ktx:2.7.6"
implementation "androidx.navigation:navigation-ui-ktx:2.7.7" implementation "androidx.navigation:navigation-ui-ktx:2.7.6"
//Dagger - Hilt //Dagger - Hilt
implementation "com.google.dagger:hilt-android:2.46" implementation "com.google.dagger:hilt-android:2.46"

View File

@@ -116,15 +116,18 @@
android:name="com.example.hpostesting.presentation.testRight.UsbService" android:name="com.example.hpostesting.presentation.testRight.UsbService"
android:enabled="true" android:enabled="true"
android:exported="false" /> android:exported="false" />
<activity <activity
android:name="com.example.hpostesting.presentation.SplashActivity" android:name="com.example.hpostesting.presentation.SplashActivity"
android:exported="true" android:exported="true"
android:noHistory="true" android:noHistory="true"
android:theme="@style/AppTheme.NoActionBar"> android:theme="@style/AppTheme.NoActionBar">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER" />
<!-- <category android:name="android.intent.category.HOME" />-->
<!-- <category android:name="android.intent.category.DEFAULT" />-->
<!-- <category android:name="android.intent.category.MONKEY"/>-->
<!-- <category android:name="android.intent.category.LAUNCHER_APP" />-->
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
@@ -161,7 +164,7 @@
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:stateNotNeeded="true" android:stateNotNeeded="true"
tools:replace="android:screenOrientation" /> tools:replace="android:screenOrientation" />
<!-- ${applicationId}-->
<provider <provider
android:name="androidx.core.content.FileProvider" android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider" android:authorities="${applicationId}.fileprovider"

View File

@@ -5,10 +5,10 @@ object Constants {
const val HEMOCUBE_USB_PERMISSION = "shanmukha.in.sickle_cell_homocube.USB_PERMISSION" const val HEMOCUBE_USB_PERMISSION = "shanmukha.in.sickle_cell_homocube.USB_PERMISSION"
const val BASE_URL = "www.google.com" const val BASE_URL = "www.google.com"
const val DOCUMENT_ID_FOR_UPDATE ="2o71vBKLqdgEKYtFG8Lb"
const val ABHA_APP_PACKAGE = "in.ndhm.phr" const val ABHA_APP_PACKAGE = "in.ndhm.phr"
const val MOLBIO_INTEGRATION = false const val MOLBIO_INTEGRATION = true
const val deviceProvisionEmail = "HPOS_provisioner@bigtec.co.in" const val deviceProvisionEmail = "HPOS_provisioner@bigtec.co.in"
const val deviceProvisionPassword = "f2ab0e7f9d69" const val deviceProvisionPassword = "f2ab0e7f9d69"
const val DEVICE_ID_API = "deviceIDAPI" const val DEVICE_ID_API = "deviceIDAPI"
@@ -67,8 +67,6 @@ object Constants {
val STATICID = listOf( val STATICID = listOf(
"FACTORY", "FACTORY",
"ADMIN", "ADMIN",
"PQUSER",
"QCUSER",
"VIZ-1000-0004", "VIZ-1000-0004",
"VIZ-1000-0005", "VIZ-1000-0005",
"VIZ-1000-0006", "VIZ-1000-0006",

View File

@@ -29,8 +29,4 @@ interface HemoCubeDao {
@Query("UPDATE hemo_cube_test_table SET isCSVCreated = :newValue WHERE _id = :id") @Query("UPDATE hemo_cube_test_table SET isCSVCreated = :newValue WHERE _id = :id")
suspend fun updateCSVFieldById(id: String, newValue: Boolean) suspend fun updateCSVFieldById(id: String, newValue: Boolean)
@Query("SELECT * from hemo_cube_test_table WHERE molbioFlag = :status")
suspend fun getPendingUser(status: Boolean): List<HemoCubeTestData>
} }

View File

@@ -10,7 +10,7 @@ import com.example.hpostesting.data.model.patient.UserData
@Database( @Database(
entities = [UserData::class, HemoCubeTestData::class, DeviceData::class, BufferCheckData::class], entities = [UserData::class, HemoCubeTestData::class, DeviceData::class, BufferCheckData::class],
version = 27, version = 26,
exportSchema = false exportSchema = false
) )
@TypeConverters(Converters::class) @TypeConverters(Converters::class)

View File

@@ -0,0 +1,36 @@
package com.example.hpostesting.data.encryption
import android.security.keystore.KeyGenParameterSpec
import android.security.keystore.KeyProperties
import android.util.Base64
import javax.crypto.Cipher
import javax.crypto.KeyGenerator
import javax.crypto.spec.SecretKeySpec
object AESCrypt {
private const val ALGORITHM = "AES"
private const val KEY = "your_secret_key"
@Throws(Exception::class)
fun encrypt(value: String): String {
val keySpec = SecretKeySpec(KEY.toByteArray(), ALGORITHM)
val cipher = Cipher.getInstance(ALGORITHM)
cipher.init(Cipher.ENCRYPT_MODE, keySpec)
val encryptedBytes = cipher.doFinal(value.toByteArray())
return Base64.encodeToString(encryptedBytes, Base64.DEFAULT)
}
@Throws(Exception::class)
fun decrypt(encrypted: String?): String {
val keySpec = SecretKeySpec(KEY.toByteArray(), ALGORITHM)
val cipher = Cipher.getInstance(ALGORITHM)
cipher.init(Cipher.DECRYPT_MODE, keySpec)
val encryptedBytes = Base64.decode(encrypted, Base64.DEFAULT)
val decryptedBytes = cipher.doFinal(encryptedBytes)
return String(decryptedBytes)
}
//generates a secret key for the encryption functions to use
//TODO: Generating keys requires a higher API level. ask someone if this is okay.
}

View File

@@ -26,14 +26,4 @@ data class DeviceData(
var natsToken: String = "", var natsToken: String = "",
@get:PropertyName("natsTokenExpiry") @set:PropertyName("natsTokenExpiry") @get:PropertyName("natsTokenExpiry") @set:PropertyName("natsTokenExpiry")
var natsTokenExpiry: String = "", var natsTokenExpiry: String = "",
@get:PropertyName("deviceUpdateAvailable") @set:PropertyName("deviceUpdateAvailable")
var deviceUpdateAvailable: Boolean = false,
@get:PropertyName("updatePath") @set:PropertyName("updatePath")
var updatePath: String = "",
@get:PropertyName("deviceVersion") @set:PropertyName("deviceVersion")
var deviceVersion: String = "",
@get:PropertyName("globalUpdateDone") @set:PropertyName("globalUpdateDone")
var globalUpdateDone: Boolean = false,
@get:PropertyName("globalUpdateIgnore") @set:PropertyName("globalUpdateIgnore")
var globalUpdateIgnore: Boolean = false,
) )

View File

@@ -78,7 +78,6 @@ data class HemoCubeTestData(
var prdClassification: String = "", var prdClassification: String = "",
var deviceRatioClass: String = "", var deviceRatioClass: String = "",
var slopeRatioClass: String = "", var slopeRatioClass: String = "",
var borderlineMethod2Class: String = "",
var errorMessages: String = "", var errorMessages: String = "",
var batteryLevel: String = "", var batteryLevel: String = "",
var batteryCapacity: String = "", var batteryCapacity: String = "",

View File

@@ -0,0 +1,29 @@
package com.example.hpostesting.di
import android.content.Context
import com.example.hpostesting.data.repository.DatabaseRepository
import com.example.hpostesting.data.dao.UserDao
import com.example.hpostesting.domain.SaveRawData
import com.example.hpostesting.domain.SaveRawDataTest
import com.example.hpostesting.presentation.testRight.TestRightViewModel
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.components.ViewModelComponent
import dagger.hilt.android.qualifiers.ApplicationContext
@Module
@InstallIn(ViewModelComponent::class)
object ViewModelModule {
@Provides
fun provideTestRightViewModel(
saveRawData: SaveRawData,
saveRawDataTest: SaveRawDataTest,
databaseRepository: DatabaseRepository,
userDao: UserDao,
context: Context
): TestRightViewModel {
return TestRightViewModel(saveRawData, saveRawDataTest, databaseRepository, userDao, context)
}
}

View File

@@ -22,8 +22,6 @@ import com.example.hpostesting.domain.LogFileManager
import com.example.hpostesting.domain.LogFileManagerImpl import com.example.hpostesting.domain.LogFileManagerImpl
import com.example.hpostesting.domain.SaveRawData import com.example.hpostesting.domain.SaveRawData
import com.example.hpostesting.domain.SaveRawDataTest import com.example.hpostesting.domain.SaveRawDataTest
import com.example.hpostesting.presentation.UsbServiceListener
import com.example.hpostesting.presentation.UsbServiceListenerImpl
import com.example.hpostesting.util.PropertyProviderImpl import com.example.hpostesting.util.PropertyProviderImpl
import dagger.Module import dagger.Module
import dagger.Provides import dagger.Provides
@@ -181,10 +179,4 @@ object AppModule {
fun provideLocalFileDataSource(): LocalFileDataSource { fun provideLocalFileDataSource(): LocalFileDataSource {
return LocalFileDataSourceImpl() return LocalFileDataSourceImpl()
} }
@Provides
@Singleton
fun provideUsbServiceListener(context: Context): UsbServiceListener {
return UsbServiceListenerImpl(context)
}
} }

View File

@@ -125,8 +125,13 @@ class NatsManager(datacollector: DashboardActivity) {
if (nc?.status == Connection.Status.CONNECTED) { if (nc?.status == Connection.Status.CONNECTED) {
Log.d("NATSCONNECTION", "NATS is successfully connected.") Log.d("NATSCONNECTION", "NATS is successfully connected.")
val d = nc?.createDispatcher { msg: Message? ->
println("Nats dispatcher $msg")
}
nc?.subscribe("device.hpos.${deviceId}.ping") nc?.subscribe("device.hpos.${deviceId}.ping")
// Log.d(TAG, "Nats subscribed with ping-"+d)
nc?.publish( nc?.publish(
"server.hpos.${deviceId}.ping", "server.hpos.${deviceId}.ping",
"ALIVE".toByteArray(StandardCharsets.UTF_8) "ALIVE".toByteArray(StandardCharsets.UTF_8)
@@ -135,10 +140,7 @@ class NatsManager(datacollector: DashboardActivity) {
"server.hpos.${deviceId}.health", "server.hpos.${deviceId}.health",
"ALIVE".toByteArray(StandardCharsets.UTF_8) "ALIVE".toByteArray(StandardCharsets.UTF_8)
) )
val d = nc?.createDispatcher { msg: Message? ->
println("Nats dispatcher $msg")
Log.d(TAG, "Nats dispatcher--$msg")
}
d?.subscribe("device.hpos.${deviceId}.ping") { msg -> d?.subscribe("device.hpos.${deviceId}.ping") { msg ->
val response = String(msg.data, StandardCharsets.UTF_8) val response = String(msg.data, StandardCharsets.UTF_8)
datacollector.setResponse(response) datacollector.setResponse(response)
@@ -170,11 +172,10 @@ class NatsManager(datacollector: DashboardActivity) {
println("Message received (up to 100 times): $response") println("Message received (up to 100 times): $response")
} }
d?.subscribe("device.hpos.${deviceId}.checkUpdate") { msg -> d?.subscribe("device.hpos.${deviceId}.checkupdate") { msg ->
val response = String(msg.data, StandardCharsets.UTF_8) val response = String(msg.data, StandardCharsets.UTF_8)
datacollector.setResponse(response) datacollector.setResponse(response)
println("Message received (up to 100 times) on topic checkupdate: $response") println("Message received (up to 100 times): $response")
Log.d(TAG, "subscribed msg ${msg} on topic checkupdate")
} }
} else { } else {
Log.d("NATSCONNECTION", "NATS is not connected. Current status: ${nc?.status}") Log.d("NATSCONNECTION", "NATS is not connected. Current status: ${nc?.status}")

View File

@@ -1,26 +0,0 @@
package com.example.hpostesting.presentation
import android.content.Context
import android.util.Log
import android.widget.Toast
class UsbServiceListenerImpl(private val context: Context): UsbServiceListener {
override fun onUsbRead(data: ByteArray?) {
if (data != null) {
val receivedData = String(data)
logData(receivedData)
}
}
override fun onUsbError(e: Exception?) {
showToast("USB Error: ${e?.message}")
}
private fun showToast(message: String) {
Toast.makeText(context, message, Toast.LENGTH_SHORT).show()
}
private fun logData(data: String) {
Log.d("UsbServiceListener", "Received data from USB: $data")
}
}

View File

@@ -162,8 +162,8 @@ class AssuranceControlsFragment : Fragment() {
} }
DataHolder.hemoCubeTestData!!._id = currentUnixTime.toString() + "SMI" DataHolder.hemoCubeTestData!!._id = currentUnixTime.toString() + "SMI"
DataHolder.hemoCubeTestData!!.solution = binding.spinnerSolutions.selectedItem.toString() DataHolder.hemoCubeTestData!!.solution = binding.spinnerSolutions.selectedItem.toString()
DataHolder.hemoCubeTestData!!.concentration = binding.spinnerConcentration.selectedItem.toString() DataHolder.hemoCubeTestData!!.name = binding.spinnerConcentration.selectedItem.toString()
DataHolder.hemoCubeTestData!!.name = "${DataHolder.hemoCubeTestData!!.solution} ${DataHolder.hemoCubeTestData!!.concentration} ${DataHolder.hemoCubeTestData!!.volume}" "${DataHolder.hemoCubeTestData!!.solution} ${DataHolder.hemoCubeTestData!!.concentration} ${DataHolder.hemoCubeTestData!!.volume}"
DataHolder.selectedTest = UserData() DataHolder.selectedTest = UserData()
DataHolder.selectedTest?._id = DataHolder.hemoCubeTestData!!._id DataHolder.selectedTest?._id = DataHolder.hemoCubeTestData!!._id

View File

@@ -163,10 +163,10 @@ class AutoDacFragment : Fragment() {
val slData = stringData.split(" ") val slData = stringData.split(" ")
if (slData.size > 1) { if (slData.size > 1) {
val hardwareId = slData[1].trim() val hardwareId = slData[1].trim()
// with(sharedPreferences.edit()) { with(sharedPreferences.edit()) {
// putString(Constants.DEVICE_ID, hardwareId) putString(Constants.DEVICE_ID, hardwareId)
// apply() apply()
// } }
} }
activity?.runOnUiThread { activity?.runOnUiThread {
binding.btnSubmit.visibility = View.VISIBLE binding.btnSubmit.visibility = View.VISIBLE

View File

@@ -4,7 +4,6 @@ import android.app.DownloadManager
import android.content.BroadcastReceiver import android.content.BroadcastReceiver
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.IntentFilter
import android.content.SharedPreferences import android.content.SharedPreferences
import android.net.Uri import android.net.Uri
import android.os.Build import android.os.Build
@@ -24,7 +23,6 @@ import androidx.navigation.ui.setupWithNavController
import com.example.hpostesting.data.Result import com.example.hpostesting.data.Result
import com.example.hpostesting.data.constant.Constants import com.example.hpostesting.data.constant.Constants
import com.example.hpostesting.data.constant.LanguageManager import com.example.hpostesting.data.constant.LanguageManager
import com.example.hpostesting.data.model.patient.DeviceData
import com.example.hpostesting.presentation.NatsManager import com.example.hpostesting.presentation.NatsManager
import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel
import com.example.hpostesting.presentation.jig.JigActivity import com.example.hpostesting.presentation.jig.JigActivity
@@ -32,8 +30,6 @@ import com.google.android.material.navigation.NavigationView
import com.google.firebase.appdistribution.FirebaseAppDistribution import com.google.firebase.appdistribution.FirebaseAppDistribution
import com.google.firebase.appdistribution.FirebaseAppDistributionException import com.google.firebase.appdistribution.FirebaseAppDistributionException
import com.google.firebase.crashlytics.FirebaseCrashlytics import com.google.firebase.crashlytics.FirebaseCrashlytics
import com.google.firebase.firestore.ktx.firestore
import com.google.firebase.ktx.Firebase
import dagger.hilt.android.AndroidEntryPoint import dagger.hilt.android.AndroidEntryPoint
import `in`.sminnovations.hpostesting.R import `in`.sminnovations.hpostesting.R
import `in`.sminnovations.hpostesting.databinding.ActivityDashboardBinding import `in`.sminnovations.hpostesting.databinding.ActivityDashboardBinding
@@ -53,7 +49,6 @@ open interface IDataCollector: NatsMessageCallback {
class DashboardActivity : AppCompatActivity(), IDataCollector { class DashboardActivity : AppCompatActivity(), IDataCollector {
val TAG = "DashboardActivity" val TAG = "DashboardActivity"
private var isRegistered= false
private lateinit var appBarConfiguration: AppBarConfiguration private lateinit var appBarConfiguration: AppBarConfiguration
private lateinit var binding: ActivityDashboardBinding private lateinit var binding: ActivityDashboardBinding
lateinit var sharedPreferences: SharedPreferences lateinit var sharedPreferences: SharedPreferences
@@ -71,13 +66,13 @@ class DashboardActivity : AppCompatActivity(), IDataCollector {
override fun onMessageReceived(topic: String, message: String) { override fun onMessageReceived(topic: String, message: String) {
// Handle incoming messages from NATS // Handle incoming messages from NATS
Log.d(TAG, "Received message on topic $topic: $message") Log.d(TAG, "Received message on topic $topic: $message")
} }
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
binding = ActivityDashboardBinding.inflate(layoutInflater) binding = ActivityDashboardBinding.inflate(layoutInflater)
sharedPreferences = this.getSharedPreferences("HEMOCUBE", Context.MODE_PRIVATE) sharedPreferences = this.getSharedPreferences("HEMOCUBE", Context.MODE_PRIVATE)
setContentView(binding.root) setContentView(binding.root)
@@ -122,7 +117,6 @@ class DashboardActivity : AppCompatActivity(), IDataCollector {
} }
} }
val drawerLayout: DrawerLayout = binding.drawerLayout val drawerLayout: DrawerLayout = binding.drawerLayout
val navView: NavigationView = binding.navView val navView: NavigationView = binding.navView
val navController = findNavController(R.id.nav_host_fragment_content_dashboard) val navController = findNavController(R.id.nav_host_fragment_content_dashboard)
@@ -141,8 +135,6 @@ class DashboardActivity : AppCompatActivity(), IDataCollector {
} }
} }
override fun onCreateOptionsMenu(menu: Menu): Boolean { override fun onCreateOptionsMenu(menu: Menu): Boolean {
// Inflate the menu; this adds items to the action bar if it is present. // Inflate the menu; this adds items to the action bar if it is present.
menuInflater.inflate(R.menu.dashboard, menu) menuInflater.inflate(R.menu.dashboard, menu)
@@ -154,8 +146,8 @@ class DashboardActivity : AppCompatActivity(), IDataCollector {
return navController.navigateUp(appBarConfiguration) || super.onSupportNavigateUp() return navController.navigateUp(appBarConfiguration) || super.onSupportNavigateUp()
} }
private fun initiateUpdate(url: String) { private fun initiateUpdate(responseBody: String) {
val apkUrl = url val apkUrl = responseBody
if (!isValidHttpUrl(apkUrl)) { if (!isValidHttpUrl(apkUrl)) {
return return
} }
@@ -170,11 +162,8 @@ class DashboardActivity : AppCompatActivity(), IDataCollector {
downloadId = downloadManager.enqueue(request) downloadId = downloadManager.enqueue(request)
// Register a BroadcastReceiver to receive the download complete event // Register a BroadcastReceiver to receive the download complete event
val filter = IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE) // val filter = IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { // registerReceiver(downloadReceiver, filter)
isRegistered = true
registerReceiver(downloadReceiver, filter, RECEIVER_EXPORTED)
}
} }
private fun extractApkUrl(responseBody: ResponseBody): String { private fun extractApkUrl(responseBody: ResponseBody): String {
return responseBody.string() return responseBody.string()
@@ -198,7 +187,7 @@ class DashboardActivity : AppCompatActivity(), IDataCollector {
val pInfo = baseContext.packageManager.getPackageInfo(baseContext.packageName, 0) val pInfo = baseContext.packageManager.getPackageInfo(baseContext.packageName, 0)
val uri: Uri = FileProvider.getUriForFile( val uri: Uri = FileProvider.getUriForFile(
this, this,
"in.sminnovations.hpostesting.dev.fileprovider", "${pInfo}.fileprovider",
file file
) )
@@ -218,15 +207,8 @@ class DashboardActivity : AppCompatActivity(), IDataCollector {
} }
override fun onDestroy() { override fun onDestroy() {
try {
if (isRegistered){
unregisterReceiver(downloadReceiver)
}
}catch (e: IllegalArgumentException){
Log.e("HOmeFragment",e.toString())
}
super.onDestroy() super.onDestroy()
// unregisterReceiver(downloadReceiver)
} }
override fun onResume() { override fun onResume() {
@@ -276,8 +258,8 @@ class DashboardActivity : AppCompatActivity(), IDataCollector {
} }
override fun setResponse(response: String) { override fun setResponse(response: String) {
responses = responses+response+"\n" responses = responses+response+"\n"
println(responses) println(responses)
Log.d("DashBoardActResponse",response)
} }
} }

View File

@@ -1,18 +1,12 @@
package com.example.hpostesting.presentation.dashboard package com.example.hpostesting.presentation.dashboard
import android.annotation.SuppressLint
import android.app.AlertDialog import android.app.AlertDialog
import android.app.DownloadManager
import android.content.BroadcastReceiver
import android.content.Context import android.content.Context
import android.content.Context.BATTERY_SERVICE import android.content.Context.BATTERY_SERVICE
import android.content.DialogInterface import android.content.DialogInterface
import android.content.Intent import android.content.Intent
import android.content.IntentFilter
import android.content.SharedPreferences import android.content.SharedPreferences
import android.net.Uri
import android.os.BatteryManager import android.os.BatteryManager
import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.util.Base64 import android.util.Base64
import android.util.Log import android.util.Log
@@ -20,7 +14,6 @@ import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.Toast import android.widget.Toast
import androidx.core.content.FileProvider
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels import androidx.fragment.app.activityViewModels
import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.findNavController
@@ -54,7 +47,6 @@ import com.google.firebase.perf.ktx.performance
import dagger.hilt.android.AndroidEntryPoint import dagger.hilt.android.AndroidEntryPoint
import `in`.sminnovations.hpostesting.R import `in`.sminnovations.hpostesting.R
import `in`.sminnovations.hpostesting.databinding.FragmentHomeBinding import `in`.sminnovations.hpostesting.databinding.FragmentHomeBinding
import kotlinx.coroutines.tasks.await
import okhttp3.ResponseBody import okhttp3.ResponseBody
import org.json.JSONObject import org.json.JSONObject
import java.io.BufferedOutputStream import java.io.BufferedOutputStream
@@ -66,14 +58,15 @@ import java.text.SimpleDateFormat
import java.util.Calendar import java.util.Calendar
import java.util.Date import java.util.Date
import java.util.Locale import java.util.Locale
import java.util.concurrent.atomic.AtomicBoolean
import java.util.zip.ZipEntry import java.util.zip.ZipEntry
import java.util.zip.ZipInputStream import java.util.zip.ZipInputStream
@AndroidEntryPoint @AndroidEntryPoint
class HomeFragment : Fragment() { class HomeFragment : Fragment() {
private var downloadId: Long = 0 private var _binding: FragmentHomeBinding? = null
private var isRegistered = false private val binding get() = _binding!!
private lateinit var binding: FragmentHomeBinding
private val viewModel: TestRightViewModel by activityViewModels() private val viewModel: TestRightViewModel by activityViewModels()
private val hemoCubeViewModel: HemoCubeViewModel by activityViewModels() private val hemoCubeViewModel: HemoCubeViewModel by activityViewModels()
private lateinit var rvAdapter: UserListAdapter private lateinit var rvAdapter: UserListAdapter
@@ -85,12 +78,21 @@ class HomeFragment : Fragment() {
private var isTokenAvailable = false private var isTokenAvailable = false
private var natsToken: String = "" private var natsToken: String = ""
private var deviceId: String = "" private var deviceId: String = ""
private lateinit var sharedPreference: SharedPreferences
private lateinit var sharedPreference: SharedPreferences
override fun onCreateView( override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?, inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?,
): View { ): View? {
binding = FragmentHomeBinding.inflate(inflater, container, false) _binding = FragmentHomeBinding.inflate(inflater, container, false)
Log.d("OnCreate Home Fragment", "HomeFragment calls")
// Check if _binding is null
if (_binding == null) {
// Handle the case where binding could not be initialized
// You may want to log an error or return a default view in this case
return super.onCreateView(inflater, container, savedInstanceState)
}
sharedPreference = requireContext().getSharedPreferences("HEMOCUBE", Context.MODE_PRIVATE) sharedPreference = requireContext().getSharedPreferences("HEMOCUBE", Context.MODE_PRIVATE)
DataHolder.selectedTest = null DataHolder.selectedTest = null
@@ -102,12 +104,11 @@ class HomeFragment : Fragment() {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
if (sharedPreference.getString(Constants.USER_ID, "").toString() == "ADMIN") { if (sharedPreference.getString(Constants.USER_ID, "").toString() == "ADMIN") {
binding.labelQuickCapture.visibility = View.VISIBLE
binding.btnQuickCapture.visibility = View.VISIBLE binding.btnQuickCapture.visibility = View.VISIBLE
} }
getDeviceId() getDeviceId()
checkUnprocessedCSVData() checkUnprocessedCSVData()
checkForUpdate()
viewModel.allUserData.observe(viewLifecycleOwner) { userData -> viewModel.allUserData.observe(viewLifecycleOwner) { userData ->
deleteIncompleteRegistrations(userData) deleteIncompleteRegistrations(userData)
} }
@@ -127,14 +128,15 @@ class HomeFragment : Fragment() {
binding.rvOrderOffline.adapter = adapter binding.rvOrderOffline.adapter = adapter
} }
} }
// hemoCubeViewModel.deviceData.observe(viewLifecycleOwner) { deviceData -> hemoCubeViewModel.deviceData.observe(viewLifecycleOwner) { deviceData ->
// val devicelist = mutableListOf<DeviceData>() val devicelist = mutableListOf<DeviceData>()
// if (deviceData != null) { if (deviceData != null) {
// devicelist.add(DeviceData(deviceData.deviceId)) devicelist.add(DeviceData(deviceData.deviceId))
// } }
//
// } }
viewModel.networkStatusLiveData?.observe(viewLifecycleOwner) { isConnected -> viewModel.networkStatusLiveData?.observe(viewLifecycleOwner) { isConnected ->
Log.d("NETWORK OBSERVE", "OBSERVE CALLED")
if (isConnected) { if (isConnected) {
binding.internetAvailableCL.visibility = View.VISIBLE binding.internetAvailableCL.visibility = View.VISIBLE
binding.internetNotAvailableCL.visibility = View.GONE binding.internetNotAvailableCL.visibility = View.GONE
@@ -146,39 +148,62 @@ class HomeFragment : Fragment() {
checkForTokenAndUpdate() checkForTokenAndUpdate()
} }
hemoCubeViewModel.allUserData.observe(viewLifecycleOwner) { userDataList -> hemoCubeViewModel.allUserData.observe(viewLifecycleOwner) { originalUserDataList ->
val resultList = MolbioV2ResultRequest(mutableListOf(MolbioV2Result()))
userDataList.forEach { userData -> Log.d("LOCAL_DB OBSERVE", "OBSERVE CALLED")
val resultList = MolbioV2ResultRequest(mutableListOf())
originalUserDataList.forEach { userData ->
Log.d(
": USER DATA",
originalUserDataList.count().toString() + " : " + userData._id
)
if (!userData.molbioFlag && isTokenAvailable && Constants.MOLBIO_INTEGRATION) { if (!userData.molbioFlag && isTokenAvailable && Constants.MOLBIO_INTEGRATION) {
val currentTimeFormatted = SimpleDateFormat(
"yyyy-MM-dd'T'HH:mm:ssZZZZZ",
Locale.getDefault()
).format(Calendar.getInstance().time)
val bufferIntensityThreshold =
Constants.BUFFER_INTENSITY_THRESHOLDS[userData.deviceId]?.toString()
?: "defaultThreshold" // Handle possible nulls safely
resultList.results?.add( resultList.results?.add(
MolbioV2Result( MolbioV2Result(
rawData = userData, rawData = userData,
analysisId = userData._id, analysisId = userData._id,
analysisDate = "2024-02-08 16:33:56",//userData.testTime, analysisDate = currentTimeFormatted,
analysisStatus = userData.classificationResult, analysisStatus = userData.classificationResult
thresholds = Constants.BUFFER_INTENSITY_THRESHOLDS[userData.deviceId].toString(), ?: "defaultStatus", // Handle possible nulls
interpretation = userData.classificationResult, thresholds = bufferIntensityThreshold,
interpretation = userData.classificationResult
?: "defaultInterpretation", // Handle possible nulls
testId = userData._id, testId = userData._id,
testTime = "2024-02-08 16:33:56",//userData.testTime, testTime = currentTimeFormatted,
collectionTime = "2024-02-08 16:33:56",//userData.testTime, collectionTime = currentTimeFormatted,
expiryTime = "2024-02-08 16:33:56"//userData.testTime, expiryTime = currentTimeFormatted
) )
) )
} }
if (!userData.molbioFlag && isTokenAvailable && Constants.MOLBIO_INTEGRATION) {
userData.molbioFlag = true
hemoCubeViewModel.uploadResult(resultList)
}
if (!userData.localFlag) {
userData.localFlag = true
hemoCubeViewModel.bulkAddResultTestToDb(userData)
}
} }
Log.d("USER DATA LIST SIZE", resultList.results?.count().toString())
resultList.results?.forEach { result ->
val userData = result.rawData
Log.d("UserData", userData.toString())
if (userData != null) {
if (!userData.localFlag) {
hemoCubeViewModel.bulkAddResultTestToDb(userData)
userData.localFlag = true
}
}
}
// Upload results after processing all userData to avoid duplicates and ensure all modifications are done
if (resultList.results?.isNotEmpty() == true) {
hemoCubeViewModel.uploadResult(resultList)
}
} }
} else { } else {
binding.internetAvailableCL.visibility = View.GONE binding.internetAvailableCL.visibility = View.GONE
binding.pendingTest.visibility = View.GONE binding.pendingTest.visibility = View.GONE
@@ -256,6 +281,9 @@ class HomeFragment : Fragment() {
var password = sharedPreference.getString(Constants.DEVICE_PASSWORD_API, "").toString() var password = sharedPreference.getString(Constants.DEVICE_PASSWORD_API, "").toString()
var userID = sharedPreference.getString(Constants.DEVICE_ID_API, "").toString() var userID = sharedPreference.getString(Constants.DEVICE_ID_API, "").toString()
deviceId = sharedPreference.getString(Constants.DEVICE_ID, "").toString() deviceId = sharedPreference.getString(Constants.DEVICE_ID, "").toString()
Log.e("idpass", userID)
Log.e("idpass", password)
Log.e("idpass", deviceId)
if (userID.isNotEmpty() && password.isNotEmpty()) { if (userID.isNotEmpty() && password.isNotEmpty()) {
if (!isTokenAvailable) { if (!isTokenAvailable) {
hemoCubeViewModel.login(createLoginRequestData(userID, password)) hemoCubeViewModel.login(createLoginRequestData(userID, password))
@@ -286,7 +314,31 @@ class HomeFragment : Fragment() {
hemoCubeViewModel.uploadLogs() hemoCubeViewModel.uploadLogs()
hemoCubeViewModel.startPeriodicCheckUpdate() hemoCubeViewModel.startPeriodicCheckUpdate()
} }
} else { }
// } else if (fis.available()>0){
// val buffer = ByteArray(fis.available())
// fis.read(buffer)
// fis.close()
// val encryptedData = String(buffer)
// val parts = encryptedData.split(",".toRegex()).dropLastWhile { it.isEmpty() }
// .toTypedArray()
// val deviceID = parts[0]
// val decryptedUsername = decrypt(parts[1])
// val decryptedPassword = decrypt(parts[2])
// if (accessToken.isEmpty()) {
// hemoCubeViewModel.login(createLoginRequestData(decryptedUsername, decryptedPassword))
//}
// else {
// // Continue with your existing logic if the token is not empty.
// isTokenAvailable = true
// hemoCubeViewModel.deviceUpdate(createDeviceUpdateRequestData())
// hemoCubeViewModel.uploadLogs()
// hemoCubeViewModel.startPeriodicCheckUpdate()
// }
//}
else {
Toast.makeText( Toast.makeText(
requireContext(), requireContext(),
"Contact Help and get your device provision done", "Contact Help and get your device provision done",
@@ -348,6 +400,8 @@ class HomeFragment : Fragment() {
} }
} }
hemoCubeViewModel.downloadcertificate.observe(viewLifecycleOwner) { response -> hemoCubeViewModel.downloadcertificate.observe(viewLifecycleOwner) { response ->
when (response) { when (response) {
is Result.Success -> { is Result.Success -> {
@@ -394,6 +448,7 @@ class HomeFragment : Fragment() {
hemoCubeViewModel.resultUpload.observe(viewLifecycleOwner) { hemoCubeViewModel.resultUpload.observe(viewLifecycleOwner) {
when (it) { when (it) {
is Result.Success -> { is Result.Success -> {
Log.d("MOLBIO UPLOAD", "RESULT SUCCESS")
it.data.data?.forEach { id -> it.data.data?.forEach { id ->
id.rawData?.let { it1 -> id.rawData?.let { it1 ->
hemoCubeViewModel.updateMolbioFlag( hemoCubeViewModel.updateMolbioFlag(
@@ -401,18 +456,22 @@ class HomeFragment : Fragment() {
) )
} }
} }
} }
is Result.Error -> { is Result.Error -> {
binding.btnSubmit.visibility = View.VISIBLE binding.btnSubmit.visibility = View.VISIBLE
//Remove this line of code while deploying to IOCL //Remove this line of code while deploying to IOCL
it.exception.let { message -> it.exception.let { message ->
Toast.makeText(activity, "An error occurred: $message", Toast.LENGTH_LONG) Toast.makeText(activity, "An error occurred: $message", Toast.LENGTH_LONG)
.show() .show()
} }
} }
else -> {} else -> {
}
} }
} }
@@ -821,39 +880,6 @@ class HomeFragment : Fragment() {
} }
} }
hemoCubeViewModel.allUserData.observe(viewLifecycleOwner) { userDataList ->
val resultList = MolbioV2ResultRequest(mutableListOf(MolbioV2Result()))
userDataList.forEach { userData ->
if (!userData.molbioFlag && isTokenAvailable) {
resultList.results?.add(
MolbioV2Result(
rawData = userData,
analysisId = userData._id,
analysisDate = "2024-02-08 16:33:56", //userData.reportUploadTime,
analysisStatus = userData.classificationResult,
thresholds = Constants.BUFFER_INTENSITY_THRESHOLDS[userData.deviceId].toString(),
interpretation = userData.classificationResult,
testId = userData._id,
testTime = userData.testTime,
collectionTime = "2024-02-08 16:33:56",//userData.testTime,
expiryTime = "2024-02-08 16:33:56",//userData.testTime,
)
)
}
if (!userData.localFlag) {
userData.localFlag = true
hemoCubeViewModel.bulkAddResultTestToDb(userData)
}
if (!userData.molbioFlag && isTokenAvailable && Constants.MOLBIO_INTEGRATION) {
userData.molbioFlag = true
hemoCubeViewModel.uploadResult(resultList)
}
}
dialog.dismiss()
}
hemoCubeViewModel.allKitTestData.observe(viewLifecycleOwner) { kitDataList -> hemoCubeViewModel.allKitTestData.observe(viewLifecycleOwner) { kitDataList ->
kitDataList.forEach { userData -> kitDataList.forEach { userData ->
if (!userData.localFlag) { if (!userData.localFlag) {
@@ -864,36 +890,6 @@ class HomeFragment : Fragment() {
dialog.dismiss() dialog.dismiss()
} }
hemoCubeViewModel.allUserData.observe(viewLifecycleOwner) { userDataList ->
val resultList = MolbioV2ResultRequest(mutableListOf(MolbioV2Result()))
userDataList.forEach { userData ->
if (!userData.molbioFlag && isTokenAvailable) {
resultList.results?.add(
MolbioV2Result(
rawData = userData,
analysisId = userData._id,
analysisDate = "2024-02-08 16:33:56",//userData.testTime,
analysisStatus = userData.classificationResult,
thresholds = Constants.BUFFER_INTENSITY_THRESHOLDS[userData.deviceId].toString(),
interpretation = userData.classificationResult,
testId = userData._id,
testTime = "2024-02-08 16:33:56",//userData.testTime,
collectionTime = "2024-02-08 16:33:56",//userData.testTime,
expiryTime = "2024-02-08 16:33:56"//userData.testTime,
)
)
userData.molbioFlag = true
hemoCubeViewModel.uploadResult(resultList)
}
if (!userData.localFlag) {
userData.localFlag = true
hemoCubeViewModel.bulkAddResultTestToDb(userData)
}
}
dialog.dismiss()
}
} }
// private fun downloadLocalDBData(dialog: DialogInterface) { // private fun downloadLocalDBData(dialog: DialogInterface) {
@@ -936,6 +932,7 @@ class HomeFragment : Fragment() {
override fun onDestroyView() { override fun onDestroyView() {
super.onDestroyView() super.onDestroyView()
_binding = null
} }
private fun downloadCsv() { private fun downloadCsv() {
@@ -1051,168 +1048,5 @@ class HomeFragment : Fragment() {
val matchResult = regex.find(receivedData) val matchResult = regex.find(receivedData)
return matchResult?.groups?.get(1)?.value ?: "" return matchResult?.groups?.get(1)?.value ?: ""
} }
@SuppressLint("SuspiciousIndentation")
private fun checkForUpdate() {
try {
val db = Firebase.firestore
val deviceId="HHH-AAA-ZZZ"
val deviceRef = db.collection("deviceUpdate").document(Constants.DOCUMENT_ID_FOR_UPDATE)
deviceRef.get().addOnSuccessListener { documentSnapshot ->
if (documentSnapshot.exists()) {
val deviceData =
documentSnapshot.toObject(DeviceData::class.java)
// deviceData?.let { data ->
val deviceVersion = deviceData!!.deviceVersion
val deviceUpdateAvailableGlobal= deviceData.deviceUpdateAvailable
val updatePathGlobal= deviceData.updatePath
// if(deviceUpdateAvailableGlobal){
db.collection("devices").whereEqualTo("deviceId", deviceId).get().addOnSuccessListener { documentSnapshotNew ->
if (documentSnapshotNew.documents.isNotEmpty()) {
documentSnapshotNew.documents.forEach{
val documentIn = it.toObject(DeviceData::class.java)
val globalUpdateIgnore = documentIn!!.globalUpdateIgnore
val deviceUpdateAvailable = documentIn.deviceUpdateAvailable
val globalUpdateDone = documentIn.globalUpdateDone
val updatePath = documentIn.updatePath
if(globalUpdateIgnore){
if(deviceUpdateAvailable){
val update = db.collection("devices").document(it.id).update("deviceUpdateAvailable",false)
update.addOnSuccessListener {
Log.d("HomeFragmentUpdate","Device local update done")
initiateUpdate(updatePath)
}.addOnFailureListener{
Log.e("fetchDeviceUpdate", "update fail.")
}
}else{
Log.d("HomeFragmentUpdate","Device update not available")
}
}else{
if(!globalUpdateDone){
val update = db.collection("devices").document(it.id).update("globalUpdateDone",true)
update.addOnSuccessListener {
Log.d("HomeFragmentUpdate","Device global update done")
initiateUpdate(updatePathGlobal)
}.addOnFailureListener{
Log.e("fetchDeviceUpdate", "update fail.")
}
}
}
}
} else {
Log.e("fetchDeviceUpdate", "Document does not exist.")
}
}.addOnFailureListener { exception ->
Log.e("fetchDeviceUpdate", "Error fetching device data", exception)
}
// Toast.makeText(requireActivity()," true -version."+deviceVersion+"updatePath.."+updatePath,Toast.LENGTH_LONG).show()
// Log for debugging
Log.d(
"fetchDeviceCredentials",
"deviceVersion: $deviceVersion, Password: $deviceUpdateAvailableGlobal, updatePath: $updatePathGlobal"
)
// } ?: Log.e("fetchDeviceUpdate", "Failed to parse device data.")
} else {
Log.e("fetchDeviceUpdate", "Document does not exist.")
}
}
.addOnFailureListener { exception ->
Log.e("fetchDeviceUpdate", "Error fetching device data", exception)
}
} catch (e: Exception) {
Log.e("fetchDeviceUpdate", "Error in fetchDeviceUpdate", e)
}
}
private fun initiateUpdate(url: String) {
val apkUrl = url
if (!isValidHttpUrl(apkUrl)) {
return
}
val request = DownloadManager.Request(Uri.parse(apkUrl))
request.setTitle("App Update")
request.setDescription("Downloading update...")
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED)
request.setDestinationInExternalFilesDir(requireActivity(), "Updates", "update.apk")
val downloadManager = requireActivity().getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager
downloadId = downloadManager.enqueue(request)
// Register a BroadcastReceiver to receive the download complete event
val filter = IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
isRegistered = true
requireActivity().registerReceiver(downloadReceiver, filter, Context.RECEIVER_EXPORTED)
}
}
private fun extractApkUrl(responseBody: ResponseBody): String {
return responseBody.string()
}
private fun isValidHttpUrl(url: String): Boolean {
return url.startsWith("http://") || url.startsWith("https://")
}
private val downloadReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
val id = intent?.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1)
if (id == downloadId) {
installApk()
}
}
}
private fun installApk() {
val file = File(requireActivity().getExternalFilesDir("Updates"), "update.apk")
file.setReadable(true, false) // Ensure the file is readable
val pInfo = requireActivity().baseContext.packageManager.getPackageInfo(requireActivity().baseContext.packageName, 0)
Log.d("HomeFragmentShowInfo",pInfo.packageName.toString())
val uri: Uri = FileProvider.getUriForFile(
requireActivity(),
"${pInfo.packageName}.fileprovider",
file
)
// Create an intent to install the APK
val installIntent = Intent(Intent.ACTION_INSTALL_PACKAGE)
installIntent.data = uri
installIntent.flags = Intent.FLAG_GRANT_READ_URI_PERMISSION or
Intent.FLAG_ACTIVITY_NEW_TASK or
Intent.FLAG_ACTIVITY_CLEAR_TOP
installIntent.putExtra(Intent.EXTRA_NOT_UNKNOWN_SOURCE, true)
// Start the installation
startActivity(installIntent)
Log.d("InstallApk", "Install Intent URI: $uri")
Log.d("InstallApk", "Package Name: ${requireActivity().packageName}")
}
override fun onDestroy() {
try {
if (isRegistered){
requireActivity().unregisterReceiver(downloadReceiver)
}
}catch (e: IllegalArgumentException){
Log.e("HOmeFragment",e.toString())
}
super.onDestroy()
}
} }

View File

@@ -93,7 +93,6 @@ class DeviceProvisionActivity : AppCompatActivity(), DeviceCommunicationHandler
supportActionBar?.setDisplayHomeAsUpEnabled(true) supportActionBar?.setDisplayHomeAsUpEnabled(true)
setupListener() setupListener()
connectUsb(false) connectUsb(false)
} }
private fun setupListener() { private fun setupListener() {

View File

@@ -15,6 +15,7 @@ import androidx.lifecycle.MutableLiveData
import com.example.hpostesting.data.Result import com.example.hpostesting.data.Result
import com.example.hpostesting.data.constant.Constants import com.example.hpostesting.data.constant.Constants
import com.example.hpostesting.data.constant.HemoCubeCommands import com.example.hpostesting.data.constant.HemoCubeCommands
import com.example.hpostesting.data.encryption.AESCrypt
import com.example.hpostesting.data.model.deviceprovision.DeviceProvisionRequest import com.example.hpostesting.data.model.deviceprovision.DeviceProvisionRequest
import com.example.hpostesting.data.model.patient.DeviceData import com.example.hpostesting.data.model.patient.DeviceData
import com.example.hpostesting.presentation.UsbServiceListener import com.example.hpostesting.presentation.UsbServiceListener
@@ -23,6 +24,7 @@ import com.google.firebase.crashlytics.ktx.crashlytics
import com.google.firebase.ktx.Firebase import com.google.firebase.ktx.Firebase
import `in`.sminnovations.hpostesting.databinding.FragmentDeviceProvisionBinding import `in`.sminnovations.hpostesting.databinding.FragmentDeviceProvisionBinding
class DeviceProvisionFragment : Fragment() { class DeviceProvisionFragment : Fragment() {
private var resultData: String = "" private var resultData: String = ""
private lateinit var binding: FragmentDeviceProvisionBinding private lateinit var binding: FragmentDeviceProvisionBinding
@@ -123,6 +125,9 @@ class DeviceProvisionFragment : Fragment() {
Log.e("idpass", response.toString()) Log.e("idpass", response.toString())
Log.e("idpass", response.data.data?.credentials?.username.toString()) Log.e("idpass", response.data.data?.credentials?.username.toString())
Log.e("idpass", deviceProvisionResponse) Log.e("idpass", deviceProvisionResponse)
saveDataToLocalFile(response.data.data?.credentials?.username.toString(), response.data.data?.credentials?.password.toString())
} else { } else {
Toast.makeText( Toast.makeText(
activity, activity,
@@ -218,4 +223,18 @@ class DeviceProvisionFragment : Fragment() {
} }
} }
} }
//saves username and password to a local file after encrypting it.
private fun saveDataToLocalFile( username : String, password : String){
val deviceID = sharedPreferences.getString(Constants.DEVICE_ID, "").toString();
val encryptedUsername = AESCrypt.encrypt(username)
val encryptedPassword = AESCrypt.encrypt(password)
val encryptedData = deviceID + "\n" + encryptedUsername + "\n" + encryptedPassword
val fileOutputStream = requireContext().openFileOutput("credentials.txt", Context.MODE_PRIVATE)
fileOutputStream.write(encryptedData.toByteArray())
fileOutputStream.close()
}
} }

View File

@@ -1,6 +1,5 @@
package com.example.hpostesting.presentation.hemocube package com.example.hpostesting.presentation.hemocube
import android.annotation.SuppressLint
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.SharedPreferences import android.content.SharedPreferences
@@ -91,11 +90,8 @@ class HemoCubeFragment : Fragment() {
observeViewModel() observeViewModel()
} }
@SuppressLint("SetTextI18n")
private fun initViews() { private fun initViews() {
binding.btnSubmit.setOnClickListener { binding.btnSubmit.setOnClickListener {
binding.btnSubmit.isEnabled = false
binding.btnSubmit.isClickable = false
activity?.runOnUiThread { activity?.runOnUiThread {
binding.progressBar.visibility = View.VISIBLE binding.progressBar.visibility = View.VISIBLE
binding.btnSubmit.visibility = View.GONE binding.btnSubmit.visibility = View.GONE
@@ -110,6 +106,8 @@ class HemoCubeFragment : Fragment() {
binding.nameEditText.visibility = View.GONE binding.nameEditText.visibility = View.GONE
binding.tvTitle.visibility = View.GONE binding.tvTitle.visibility = View.GONE
binding.btnGo.visibility = View.GONE binding.btnGo.visibility = View.GONE
// binding.btnSubmit.isEnabled = false
// binding.btnSubmit.isClickable = false
binding.btnPlacebuffer.visibility = View.GONE binding.btnPlacebuffer.visibility = View.GONE
binding.tvName.text = "Name: ${testDetails?.name}\n ID: ${testDetails?._id}" binding.tvName.text = "Name: ${testDetails?.name}\n ID: ${testDetails?._id}"
@@ -587,7 +585,8 @@ class HemoCubeFragment : Fragment() {
led1Gain4 = resultLines[5].split(' ')[1].trim().toDoubleOrNull()!! led1Gain4 = resultLines[5].split(' ')[1].trim().toDoubleOrNull()!!
led2Gain4 = resultLines[6].split(' ')[1].trim().toDoubleOrNull()!! led2Gain4 = resultLines[6].split(' ')[1].trim().toDoubleOrNull()!!
led3Gain4 = resultLines[7].split(' ')[1].trim().toDoubleOrNull()!! led3Gain4 = resultLines[7].split(' ')[1].trim().toDoubleOrNull()!!
led4Gain4 = resultLines[8].split(' ')[1].split('\r')[0].trim().toDoubleOrNull()!! led4Gain4 =
resultLines[8].split(' ')[1].split('\r')[0].trim().toDoubleOrNull()!!
} }
finishReading() finishReading()
@@ -765,7 +764,6 @@ class HemoCubeFragment : Fragment() {
val led3Average = log10(led3BufferForDevice.div(led3SampleForDevice)) val led3Average = log10(led3BufferForDevice.div(led3SampleForDevice))
val led4Average = log10(led4BufferForDevice.div(led4SampleForDevice)) val led4Average = log10(led4BufferForDevice.div(led4SampleForDevice))
val deviceRatio = led2Average / led1Average val deviceRatio = led2Average / led1Average
val borderlineMetric = (led1Average - led2Average) / deviceRatio
if (led1BufferForDevice < Constants.BUFFER_INTENSITY_THRESHOLDS[deviceHardwareId]?.get(0) if (led1BufferForDevice < Constants.BUFFER_INTENSITY_THRESHOLDS[deviceHardwareId]?.get(0)
?.get(0)!! ?.get(0)!!
@@ -863,7 +861,7 @@ class HemoCubeFragment : Fragment() {
} }
} }
val absorbanceLowerLimit = 0.0 var absorbanceLowerLimit = 0.0
if (led1Average < absorbanceLowerLimit || led2Average < absorbanceLowerLimit || led3Average < absorbanceLowerLimit || led4Average < absorbanceLowerLimit) { if (led1Average < absorbanceLowerLimit || led2Average < absorbanceLowerLimit || led3Average < absorbanceLowerLimit || led4Average < absorbanceLowerLimit) {
validationError = true validationError = true
activity?.runOnUiThread { activity?.runOnUiThread {
@@ -910,13 +908,8 @@ class HemoCubeFragment : Fragment() {
.toString() + ", " + currentDeviceData?.coefficients?.get(1).toString() .toString() + ", " + currentDeviceData?.coefficients?.get(1).toString()
this.prdClassification = absorbanceBasedClassification(predictedDenovixRatio) this.prdClassification = absorbanceBasedClassification(predictedDenovixRatio)
this.deviceRatioClass = deviceRatioClassification(deviceRatio) this.deviceRatioClass = deviceRatioClassification(deviceRatio)
this.borderlineMethod2Class = reclassifyWithBorderlineMethod2(deviceRatio, deviceRatioBorderlineThresholds(deviceRatio), led2Average)
this.slopeRatioClass = slopeClass this.slopeRatioClass = slopeClass
this.classificationResult = findResultWithAdditionalMethods( this.classificationResult = deviceRatioClass
deviceRatio,
deviceRatioClass,
borderlineMetric
)
hemoCubeViewModel.messages.postValue( hemoCubeViewModel.messages.postValue(
"${this.classificationResult} \n Device Ratio: ${ "${this.classificationResult} \n Device Ratio: ${
"%.3f".format( "%.3f".format(
@@ -957,48 +950,17 @@ class HemoCubeFragment : Fragment() {
} }
} }
fun reclassifyWithBorderlineMethod2(deviceRatio: Double?, deviceRatioClass: String?, led2Average: Double?): String {
try {
if (deviceRatio != null && led2Average != null) {
if (deviceRatioClass == "Negative Borderline") {
return if (led2Average >= 0.15)
"Borderline. Normal"
else
"Borderline. Sickle Cell Trait"
}
if (deviceRatioClass == "Positive for Sickle Cell. HPLC for Confirmation") {
return if (led2Average >= 0.19)
"Borderline. Sickle Cell Trait"
else
"Borderline. Sickle Cell Disease"
}
}
} catch (e: Exception) {
handleException(e)
return "Error"
}
return deviceRatioClass.toString()
}
fun findResultWithAdditionalMethods( fun findResultWithAdditionalMethods(
deviceRatio: Double?, deviceRatio: Double?,
deviceRatioClass: String?, deviceRatioClass: String?,
borderlineMetric: Double?, slopeRatio: Double?,
): String { ): String {
try { try {
// hemoCubeViewModel.messages.postValue("post classification checks") // hemoCubeViewModel.messages.postValue("post classification checks")
if (deviceRatio != null && borderlineMetric != null) { if (deviceRatio != null) {
if (deviceRatioClass == "Negative Borderline") { if (slopeRatio != null) {
return if (borderlineMetric >= 2.4) if (deviceRatioClass == "Normal" && slopeRatio > 45.0)
"Borderline. Normal" return "Negative Borderline, Repeat Test"
else
"Borderline. Sickle Cell Trait"
}
if (deviceRatioClass == "Positive for Sickle Cell. HPLC for Confirmation") {
return if (borderlineMetric >= 1.34)
"Borderline. Sickle Cell Trait"
else
"Borderline. Sickle Cell Disease"
} }
} }
} catch (e: Exception) { } catch (e: Exception) {
@@ -1008,46 +970,20 @@ class HemoCubeFragment : Fragment() {
return deviceRatioClass.toString() return deviceRatioClass.toString()
} }
fun deviceRatioBorderlineThresholds(ratio: Double?): String {
try {
if (ratio != null) {
val roundedRatio = String.format("%.3f", ratio).toDouble()
if (roundedRatio >= 0.11 && roundedRatio < 0.237) {
// setSubtitleTextColor(R.color.green_2)
return "Normal"
}
if (roundedRatio in 0.237..0.242)
return "Negative Borderline"
if (roundedRatio in 0.242..0.318)
return "Sickle Cell Trait"
if (roundedRatio >= 0.318 && roundedRatio < 0.356)
return "Positive for Sickle Cell. HPLC for Confirmation"
if (roundedRatio in 0.356..0.7)
return "Sickle Cell Disease"
} else {
return "Invalid"
}
} catch (e: Exception) {
handleException(e)
return "Error"
}
return "Invalid"
}
fun deviceRatioClassification(ratio: Double?): String { fun deviceRatioClassification(ratio: Double?): String {
try { try {
if (ratio != null) { if (ratio != null) {
if (ratio in 0.16..0.23) { if (ratio in 0.016..0.22) {
// setSubtitleTextColor(R.color.green_2) // setSubtitleTextColor(R.color.green_2)
return "Normal" return "Normal"
} }
if (ratio in 0.23..0.25) if (ratio in 0.22..0.24)
return "Negative Borderline" return "Negative Borderline"
if (ratio in 0.25..0.31) if (ratio in 0.24..0.32)
return "Sickle Cell Trait" return "Sickle Cell Trait"
if (ratio in 0.31..0.36) if (ratio in 0.32..0.37)
return "Positive for Sickle Cell. HPLC for Confirmation" return "Positive for Sickle Cell. HPLC for Confirmation"
if (ratio in 0.36..0.7) if (ratio in 0.37..0.56)
return "Sickle Cell Disease" return "Sickle Cell Disease"
} else { } else {
return "Invalid" return "Invalid"

View File

@@ -88,7 +88,6 @@ class HemoCubeViewModel @Inject constructor(
private val _networkStatusLiveData = NetworkStatusLiveData(context) private val _networkStatusLiveData = NetworkStatusLiveData(context)
val allUserData = hemoCubeDao.getAll() val allUserData = hemoCubeDao.getAll()
val allPendingUserToUpload = MutableLiveData<List<HemoCubeTestData>>()
val allKitTestData = hemoCubeBufferDao.getAll() val allKitTestData = hemoCubeBufferDao.getAll()
val deviceData = MutableLiveData<DeviceData?>() val deviceData = MutableLiveData<DeviceData?>()
@@ -138,6 +137,7 @@ class HemoCubeViewModel @Inject constructor(
fun uploadResult(molbioV2ResultRequest: MolbioV2ResultRequest) = viewModelScope.launch { fun uploadResult(molbioV2ResultRequest: MolbioV2ResultRequest) = viewModelScope.launch {
resultUpload.postValue(Result.Loading()) resultUpload.postValue(Result.Loading())
Log.d("API CALL", "UPLOADED RESULT")
repository.uploadResults(molbioV2ResultRequest).let { repository.uploadResults(molbioV2ResultRequest).let {
resultUpload.postValue(it) resultUpload.postValue(it)
} }
@@ -187,9 +187,6 @@ class HemoCubeViewModel @Inject constructor(
} }
} }
} }
fun uploadPendingUser() = viewModelScope.launch {
allPendingUserToUpload.postValue(hemoCubeDao.getPendingUser(false))
}
fun uploadHemoCubeResultToDatabaseForBufferCheck( fun uploadHemoCubeResultToDatabaseForBufferCheck(
isOnline: Boolean, isOnline: Boolean,
@@ -294,7 +291,6 @@ class HemoCubeViewModel @Inject constructor(
testDetails?.prdClassification = DataHolder.hemoCubeTestData?.prdClassification.toString() testDetails?.prdClassification = DataHolder.hemoCubeTestData?.prdClassification.toString()
testDetails?.deviceRatioClass = DataHolder.hemoCubeTestData?.deviceRatioClass.toString() testDetails?.deviceRatioClass = DataHolder.hemoCubeTestData?.deviceRatioClass.toString()
testDetails?.slopeRatioClass = DataHolder.hemoCubeTestData?.slopeRatioClass.toString() testDetails?.slopeRatioClass = DataHolder.hemoCubeTestData?.slopeRatioClass.toString()
testDetails?.borderlineMethod2Class = DataHolder.hemoCubeTestData?.borderlineMethod2Class.toString()
testDetails?.errorMessages = DataHolder.hemoCubeTestData?.errorMessages.toString() testDetails?.errorMessages = DataHolder.hemoCubeTestData?.errorMessages.toString()
testDetails?.batteryLevel = DataHolder.hemoCubeTestData?.batteryLevel.toString() testDetails?.batteryLevel = DataHolder.hemoCubeTestData?.batteryLevel.toString()
testDetails?.batteryCapacity = DataHolder.hemoCubeTestData?.batteryCapacity.toString() testDetails?.batteryCapacity = DataHolder.hemoCubeTestData?.batteryCapacity.toString()
@@ -412,8 +408,6 @@ class HemoCubeViewModel @Inject constructor(
Log.e("Testdb", "Error uploading data to Firestore: $response") Log.e("Testdb", "Error uploading data to Firestore: $response")
fireBaseUpload.postValue("Error") fireBaseUpload.postValue("Error")
} }
else -> {}
} }
} catch (e: Exception) { } catch (e: Exception) {
Log.e("Testdb", "Exception during data upload: ${e.message}") Log.e("Testdb", "Exception during data upload: ${e.message}")

View File

@@ -33,53 +33,32 @@ class UsbService : Service() {
var bus: UsbServiceListener? = null var bus: UsbServiceListener? = null
fun connect(driver: UsbSerialDriver, connection: UsbDeviceConnection) { fun connect(driver: UsbSerialDriver, connection: UsbDeviceConnection) {
try { mPort = driver.ports[0] // Most devices have just one port (port 0)
mPort = driver.ports[0] mPort.open(connection)
mPort.open(connection) mPort.setParameters(9600, 8, UsbSerialPort.STOPBITS_1, UsbSerialPort.PARITY_NONE)
isUsbConnected = true
Log.d(TAG, "My Usb Connected ${mPort.driver}")
if (mPort.device.vendorId == 6790 && mPort.device.productId == 29987) val usbIoManager = SerialInputOutputManager(mPort,
mPort.setParameters(115200, 8, UsbSerialPort.STOPBITS_1, UsbSerialPort.PARITY_NONE) object : SerialInputOutputManager.Listener {
else override fun onNewData(data: ByteArray?) {
mPort.setParameters(9600, 8, UsbSerialPort.STOPBITS_1, UsbSerialPort.PARITY_NONE) listener?.onUsbRead(data)
}
isUsbConnected = true override fun onRunError(e: Exception?) {
Log.d(TAG, "Usb Connected ${mPort.driver}") Log.e(TAG, "onRunError() called inside eventDrivenWrite()")
listener?.onUsbError(e)
}
val usbIoManager = SerialInputOutputManager(mPort, })
object : SerialInputOutputManager.Listener { usbIoManager.start();
override fun onNewData(data: ByteArray?) {
listener?.onUsbRead(data)
}
override fun onRunError(e: Exception?) {
Log.e(TAG, "onRunError() called")
listener?.onUsbError(e)
}
})
usbIoManager.start()
} catch (ioException: IOException) {
Log.e(TAG, "IOException during USB connection: ${ioException.message}", ioException)
listener?.onUsbError(ioException)
} catch (e: Exception) {
Log.e(TAG, "Error connecting USB: ${e.message}", e)
listener?.onUsbError(e)
}
} }
fun disconnect() { fun disconnect() {
try { if (isUsbConnected) {
if (isUsbConnected) { mPort.close()
mPort.close() isUsbConnected = false;
isUsbConnected = false Log.d(TAG, "My Usb disconnected:: ${mPort.driver}")
Log.d(TAG, "USB Port closed successfully:: ${mPort.driver}")
} else {
Log.d(TAG, "USB Port is not connected")
}
} catch (e: IOException) {
Log.e(TAG, "Error closing USB Port: ${e.message}", e)
} catch (e: Exception) {
Log.e(TAG, "An unexpected error occurred: ${e.message}", e)
} }
} }

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/card_blue_app" />
<corners android:radius="20dp" />
</shape>
</item>
</selector>

View File

@@ -1,5 +1,5 @@
<vector android:autoMirrored="true" android:height="24dp" <vector android:autoMirrored="true" android:height="24dp"
android:tint="#FF1010" android:viewportHeight="24" android:tint="#EF0A0A" android:viewportHeight="24"
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M17,7l-1.41,1.41L18.17,11H8v2h10.17l-2.58,2.58L17,17l5,-5zM4,5h8V3H4c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h8v-2H4V5z"/> <path android:fillColor="@android:color/white" android:pathData="M17,7l-1.41,1.41L18.17,11H8v2h10.17l-2.58,2.58L17,17l5,-5zM4,5h8V3H4c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h8v-2H4V5z"/>
</vector> </vector>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 725 B

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="15dp" />
<solid android:color="#D7FF0000" />
</shape>

View File

@@ -3,8 +3,7 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
tools:ignore="ExtraText"> tools:ignore="ExtraText">
<solid android:color="@android:color/transparent" /> <solid android:color="@android:color/transparent" />
<corners android:radius="10dp" />
<stroke <stroke
android:color="#000000" android:color="#000000"
android:width="1dp" /> android:width="2dp" />
</shape> </shape>

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?attr/colorControlHighlight">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/white" />
<corners android:radius="20dp" />
<stroke android:color="@color/red" android:width="1dp" />
</shape>
</item>
</ripple>

View File

@@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Drop Shadow -->
<item>
<shape android:shape="rectangle">
<solid android:color="#4D000000" /> <!-- Semi-transparent black color -->
<corners android:radius="20dp" />
</shape>
</item>
<!-- Original Shape with Blue Color -->
<item android:top="5dp" android:right="5dp" android:left="5dp" android:bottom="5dp">
<shape android:shape="rectangle">
<solid android:color="@color/card_blue_app" />
<corners android:radius="20dp" />
</shape>
</item>
</layer-list>

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/new_blue" />
<corners android:radius="10dp" /> <!-- Adjust the radius as needed -->
</shape>

View File

@@ -15,7 +15,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" android:background="?attr/colorPrimary"
app:titleTextColor="@color/blue_text_color" app:titleTextColor="#FFFFFF"
android:elevation="4dp" android:elevation="4dp"
app:menu="@menu/my_menu" app:menu="@menu/my_menu"
android:theme="@style/ToolbarTheme" android:theme="@style/ToolbarTheme"

View File

@@ -19,7 +19,6 @@
android:layout_gravity="start" android:layout_gravity="start"
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_dashboard" app:headerLayout="@layout/nav_header_dashboard"
app:menu="@menu/activity_main_drawer" app:menu="@menu/activity_main_drawer" />
app:itemIconTint="@color/blue_text_color" />
</androidx.drawerlayout.widget.DrawerLayout> </androidx.drawerlayout.widget.DrawerLayout>

View File

@@ -13,7 +13,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" android:background="?attr/colorPrimary"
app:titleTextColor="@color/blue_text_color" app:titleTextColor="#FFFFFF"
android:elevation="4dp" android:elevation="4dp"
app:menu="@menu/my_menu" app:menu="@menu/my_menu"
android:theme="@style/ToolbarTheme" android:theme="@style/ToolbarTheme"

View File

@@ -32,7 +32,6 @@
android:layout_marginHorizontal="24dp" android:layout_marginHorizontal="24dp"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:text="@string/scan_qr_code_of_the_kit" android:text="@string/scan_qr_code_of_the_kit"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/app_bar_layout" /> app:layout_constraintTop_toBottomOf="@id/app_bar_layout" />
@@ -41,12 +40,11 @@
android:layout_width="258dp" android:layout_width="258dp"
android:layout_height="56dp" android:layout_height="56dp"
android:layout_margin="24dp" android:layout_margin="24dp"
android:drawableLeft="@drawable/baseline_qr_code_scanner_24_x" android:drawableLeft="@drawable/baseline_qr_code_scanner_24"
android:text="@string/scan_now" android:text="@string/scan_now"
android:textColor="@color/black" android:textColor="@color/black"
app:backgroundTint="@color/blue_app_light" app:backgroundTint="@color/blue_app_light"
app:cornerRadius="100dp" app:cornerRadius="100dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_title" /> app:layout_constraintTop_toBottomOf="@+id/tv_title" />
@@ -77,7 +75,7 @@
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:layout_toLeftOf="@id/tvText1" android:layout_toLeftOf="@id/tvText1"
android:background="@color/red" /> android:background="@color/gray" />
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -85,7 +83,7 @@
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:layout_toRightOf="@id/tvText1" android:layout_toRightOf="@id/tvText1"
android:background="@color/red" /> android:background="@color/gray" />
</RelativeLayout> </RelativeLayout>
@@ -98,7 +96,6 @@
android:layout_marginHorizontal="24dp" android:layout_marginHorizontal="24dp"
android:layout_marginTop="48dp" android:layout_marginTop="48dp"
android:text="@string/enter_kit_serial_number_manually" android:text="@string/enter_kit_serial_number_manually"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/seperator1" /> app:layout_constraintTop_toBottomOf="@id/seperator1" />
@@ -124,15 +121,13 @@
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<androidx.appcompat.widget.AppCompatButton <com.google.android.material.button.MaterialButton
android:id="@+id/btn_go" android:id="@+id/btn_go"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="24dp" android:layout_margin="24dp"
android:text="@string/go" android:text="@string/go"
app:cornerRadius="16dp" app:cornerRadius="16dp"
android:textColor="@color/red"
android:background="@drawable/button_new"
app:layout_constraintBottom_toBottomOf="@id/et_abha_id" app:layout_constraintBottom_toBottomOf="@id/et_abha_id"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0" app:layout_constraintHorizontal_bias="1.0"

View File

@@ -15,7 +15,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" android:background="?attr/colorPrimary"
app:titleTextColor="@color/blue_text_color" app:titleTextColor="#FFFFFF"
android:elevation="4dp" android:elevation="4dp"
app:menu="@menu/my_menu" app:menu="@menu/my_menu"
android:theme="@style/ToolbarTheme" android:theme="@style/ToolbarTheme"

View File

@@ -13,7 +13,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" android:background="?attr/colorPrimary"
app:titleTextColor="@color/blue_text_color" app:titleTextColor="#FFFFFF"
android:elevation="4dp" android:elevation="4dp"
app:menu="@menu/my_menu" app:menu="@menu/my_menu"
android:theme="@style/ToolbarTheme" android:theme="@style/ToolbarTheme"

View File

@@ -14,9 +14,8 @@
<androidx.appcompat.widget.Toolbar <androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
app:titleTextColor="@color/blue_text_color"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:background="@color/new_blue" android:background="?attr/colorPrimary"
app:popupTheme="@style/Theme.HPOS.PopupOverlay" /> app:popupTheme="@style/Theme.HPOS.PopupOverlay" />
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>

View File

@@ -71,7 +71,7 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/spinner_concentration" /> app:layout_constraintTop_toBottomOf="@id/spinner_concentration" />
<androidx.appcompat.widget.AppCompatButton <Button
android:id="@+id/btn_submit" android:id="@+id/btn_submit"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -80,9 +80,8 @@
android:clickable="false" android:clickable="false"
android:gravity="center" android:gravity="center"
android:text="Continue" android:text="Continue"
android:textColor="@color/red" android:textColor="@color/white"
app:cornerRadius="16dp" app:cornerRadius="16dp"
android:background="@drawable/button_new"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/et_readings_per_sample" /> app:layout_constraintTop_toBottomOf="@id/et_readings_per_sample" />

View File

@@ -47,48 +47,41 @@
style="@style/title1_1" style="@style/title1_1"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="380dp" android:layout_height="380dp"
android:background="@drawable/baground_auto_dac"
android:layout_marginHorizontal="24dp" android:layout_marginHorizontal="24dp"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:gravity="center" android:gravity="center"
android:text="Start" android:text="Start"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="16sp" android:textSize="11sp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_subtitle3" /> app:layout_constraintTop_toBottomOf="@id/tv_subtitle3" />
<androidx.appcompat.widget.AppCompatButton <Button
android:id="@+id/btn_submit" android:id="@+id/btn_submit"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp" android:layout_marginHorizontal="16dp"
android:layout_marginTop="24dp" android:layout_marginTop="24dp"
android:clickable="false" android:clickable="false"
android:paddingRight="5dp"
android:paddingLeft="5dp"
android:background="@drawable/button_new"
android:gravity="center" android:gravity="center"
android:text="Start Auto DAC" android:text="Start Auto DAC"
android:textColor="@color/red" android:textColor="@color/white"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_subtitle4" /> app:layout_constraintTop_toBottomOf="@id/tv_subtitle4" />
<androidx.appcompat.widget.AppCompatButton <Button
android:id="@+id/btn_read_dac" android:id="@+id/btn_read_dac"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp" android:layout_marginHorizontal="16dp"
android:paddingRight="5dp"
android:paddingLeft="5dp"
android:layout_marginTop="24dp" android:layout_marginTop="24dp"
android:clickable="false" android:clickable="false"
android:gravity="center" android:gravity="center"
android:text="Read Current DAC Values" android:text="Read Current DAC Values"
android:textColor="@color/red" android:textColor="@color/white"
android:background="@drawable/button_new"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btn_submit" /> app:layout_constraintTop_toBottomOf="@id/btn_submit" />

View File

@@ -50,45 +50,38 @@
android:layout_marginHorizontal="24dp" android:layout_marginHorizontal="24dp"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:gravity="center" android:gravity="center"
android:background="@drawable/baground_auto_dac"
android:text="Start" android:text="Start"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="16sp" android:textSize="11sp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_subtitle3" /> app:layout_constraintTop_toBottomOf="@id/tv_subtitle3" />
<androidx.appcompat.widget.AppCompatButton <Button
android:id="@+id/btn_submit" android:id="@+id/btn_submit"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp" android:layout_marginHorizontal="16dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:layout_marginTop="24dp" android:layout_marginTop="24dp"
android:clickable="false" android:clickable="false"
android:gravity="center" android:gravity="center"
android:background="@drawable/button_new"
android:text="Start Auto DAC" android:text="Start Auto DAC"
android:textColor="@color/red" android:textColor="@color/white"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_subtitle4" /> app:layout_constraintTop_toBottomOf="@id/tv_subtitle4" />
<androidx.appcompat.widget.AppCompatButton <Button
android:id="@+id/btn_read_dac" android:id="@+id/btn_read_dac"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp" android:layout_marginHorizontal="16dp"
android:layout_marginTop="24dp" android:layout_marginTop="24dp"
android:paddingRight="5dp"
android:paddingLeft="5dp"
android:clickable="false" android:clickable="false"
android:gravity="center" android:gravity="center"
android:background="@drawable/button_new"
android:text="Read Current DAC Values" android:text="Read Current DAC Values"
android:textColor="@color/red" android:textColor="@color/white"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btn_submit" /> app:layout_constraintTop_toBottomOf="@id/btn_submit" />

View File

@@ -37,8 +37,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="24dp" android:layout_marginHorizontal="24dp"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:orientation="horizontal" android:orientation="horizontal"
android:background="@drawable/border" android:background="@drawable/border"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
@@ -72,10 +70,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="24dp" android:layout_marginHorizontal="24dp"
android:layout_marginTop="36dp" android:layout_marginTop="16dp"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:background="@drawable/border" android:background="@drawable/border"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@@ -108,10 +104,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="24dp" android:layout_marginHorizontal="24dp"
android:layout_marginTop="36dp" android:layout_marginTop="16dp"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:background="@drawable/border" android:background="@drawable/border"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@@ -144,10 +138,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="24dp" android:layout_marginHorizontal="24dp"
android:layout_marginTop="36dp" android:layout_marginTop="16dp"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:background="@drawable/border" android:background="@drawable/border"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@@ -182,7 +174,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="24dp" android:layout_marginHorizontal="24dp"
android:layout_marginTop="36dp" android:layout_marginTop="16dp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/llLed4Fields" /> app:layout_constraintTop_toBottomOf="@id/llLed4Fields" />
@@ -193,30 +185,26 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="50dp" android:layout_height="50dp"
android:layout_marginHorizontal="24dp" android:layout_marginHorizontal="24dp"
android:layout_marginTop="60dp" android:layout_marginTop="8dp"
android:gravity="center" android:gravity="center"
android:text="Start" android:text="Start"
android:background="@drawable/baground_auto_dac"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="16sp" android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_subtitle3" /> app:layout_constraintTop_toBottomOf="@id/tv_subtitle3" />
<androidx.appcompat.widget.AppCompatButton <Button
android:id="@+id/btn_submit" android:id="@+id/btn_submit"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp" android:layout_marginHorizontal="16dp"
android:layout_marginTop="60dp" android:layout_marginTop="10dp"
android:clickable="false" android:clickable="false"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:gravity="center" android:gravity="center"
android:text="Save" android:text="Save"
android:background="@drawable/button_new"
app:cornerRadius="100dp" app:cornerRadius="100dp"
android:textColor="@color/red" android:textColor="@color/white"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_subtitle4" /> app:layout_constraintTop_toBottomOf="@id/tv_subtitle4" />

View File

@@ -13,7 +13,6 @@
android:layout_marginHorizontal="24dp" android:layout_marginHorizontal="24dp"
android:layout_marginTop="50dp" android:layout_marginTop="50dp"
android:gravity="center" android:gravity="center"
android:background="@drawable/baground_auto_dac"
android:text="Start" android:text="Start"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="16sp" android:textSize="16sp"

View File

@@ -51,7 +51,6 @@
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:gravity="center" android:gravity="center"
android:text="Start" android:text="Start"
android:background="@drawable/baground_auto_dac"
android:textColor="@color/red" android:textColor="@color/red"
android:textSize="22sp" android:textSize="22sp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
@@ -59,7 +58,7 @@
app:layout_constraintTop_toBottomOf="@id/tv_subtitle3" /> app:layout_constraintTop_toBottomOf="@id/tv_subtitle3" />
<androidx.appcompat.widget.AppCompatButton <Button
android:id="@+id/btn_submit" android:id="@+id/btn_submit"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -67,9 +66,8 @@
android:layout_marginTop="24dp" android:layout_marginTop="24dp"
android:clickable="false" android:clickable="false"
android:gravity="center" android:gravity="center"
android:background="@drawable/button_new"
android:text="Start" android:text="Start"
android:textColor="@color/red" android:textColor="@color/white"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_subtitle4" /> app:layout_constraintTop_toBottomOf="@id/tv_subtitle4" />

View File

@@ -26,130 +26,121 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<GridLayout
<Button
android:id="@+id/btn_submit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="24dp"
android:clickable="false"
android:text="@string/check_buffer"
android:textColor="@color/white"
app:cornerRadius="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_subtitle4" />
<Button
android:id="@+id/btn_diagnostics"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="24dp"
android:clickable="false"
android:text="@string/diagnostics"
android:textColor="@color/white"
app:cornerRadius="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btn_submit" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_auto_dac"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="24dp"
android:clickable="false"
android:text="@string/auto_dac"
android:textColor="@color/white"
app:cornerRadius="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btn_diagnostics" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_calibration"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="24dp"
android:clickable="false"
android:text="@string/calibration"
android:textColor="@color/white"
app:cornerRadius="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btn_auto_dac" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_deviceInfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="24dp"
android:clickable="false"
android:text="@string/deviceinfo"
android:textColor="@color/white"
app:cornerRadius="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btn_calibration" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_deviceProvision"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:columnCount="2" android:visibility="visible"
android:rowCount="4" android:layout_marginHorizontal="16dp"
android:layout_margin="5dp" android:layout_marginTop="24dp"
app:layout_constraintBottom_toBottomOf="parent" android:clickable="false"
android:text="@string/deviceProvision"
android:textColor="@color/white"
app:cornerRadius="16dp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_subtitle4" app:layout_constraintTop_toBottomOf="@id/btn_deviceInfo" />
>
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_firefox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="24dp"
android:clickable="false"
android:text="@string/Firefox"
android:textColor="@color/white"
app:cornerRadius="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btn_deviceProvision" />
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/btn_submit" android:id="@+id/btn_files"
android:layout_width="160dp" android:layout_width="match_parent"
android:layout_height="120dp" android:layout_height="wrap_content"
android:textSize="14dp" android:layout_marginHorizontal="16dp"
android:layout_margin="8sp" android:layout_marginTop="24dp"
android:layout_gravity="center" android:clickable="false"
android:clickable="false" android:text="@string/Files"
android:background="@drawable/pannel_button" android:textColor="@color/white"
android:text="@string/check_buffer" app:cornerRadius="16dp"
android:textColor="@color/blue_text_color" /> app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btn_firefox" />
<com.google.android.material.button.MaterialButton </androidx.constraintlayout.widget.ConstraintLayout>
android:id="@+id/btn_diagnostics"
android:layout_width="160dp"
android:layout_height="120dp"
android:layout_margin="8sp"
android:textSize="14dp"
android:layout_gravity="center"
android:text="diagnostics"
android:clickable="false"
android:background="@drawable/pannel_button"
android:textColor="@color/blue_text_color" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_auto_dac"
android:layout_width="160dp"
android:layout_height="120dp"
android:textSize="14dp"
android:layout_gravity="center"
android:layout_margin="8sp"
android:clickable="false"
android:text="@string/auto_dac"
android:background="@drawable/pannel_button"
android:textColor="@color/blue_text_color"
app:cornerRadius="16dp" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_calibration"
android:layout_width="160dp"
android:layout_height="120dp"
android:textSize="14dp"
android:layout_gravity="center"
android:layout_margin="8sp"
android:clickable="false"
android:text="@string/calibration"
android:background="@drawable/pannel_button"
android:textColor="@color/blue_text_color"
app:cornerRadius="16dp" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_deviceInfo"
android:layout_width="160dp"
android:layout_gravity="center"
android:textSize="14dp"
android:layout_height="120dp"
android:layout_margin="8sp"
android:clickable="false"
android:text="@string/deviceinfo"
android:background="@drawable/pannel_button"
android:textColor="@color/blue_text_color"
app:cornerRadius="16dp" />
<Button
android:id="@+id/btn_deviceProvision"
android:layout_width="160dp"
android:layout_height="120dp"
android:layout_margin="8sp"
android:textSize="14dp"
android:layout_gravity="center"
android:text="@string/deviceProvision"
android:background="@drawable/pannel_button"
android:textColor="@color/blue_text_color"
android:visibility="visible"
app:cornerRadius="16dp" />
<Button
android:id="@+id/btn_firefox"
android:layout_width="160dp"
android:layout_height="120dp"
android:textSize="14dp"
android:layout_margin="8sp"
android:clickable="false"
android:layout_gravity="center"
android:text="@string/Firefox"
android:background="@drawable/pannel_button"
android:textColor="@color/blue_text_color"
app:cornerRadius="16dp" />
<Button
android:id="@+id/btn_files"
android:layout_width="160dp"
android:layout_height="120dp"
android:layout_margin="8sp"
android:textSize="14dp"
android:layout_gravity="center"
android:clickable="false"
android:text="@string/Files"
android:background="@drawable/pannel_button"
android:textColor="@color/blue_text_color"
app:cornerRadius="16dp"
tools:layout_editor_absoluteX="208dp"
tools:layout_editor_absoluteY="240dp" />
</GridLayout>
</androidx.constraintlayout.widget.ConstraintLayout
>
</ScrollView> </ScrollView>

View File

@@ -98,7 +98,7 @@
<!-- app:layout_constraintTop_toBottomOf="@id/btn_submit" />--> <!-- app:layout_constraintTop_toBottomOf="@id/btn_submit" />-->
<androidx.appcompat.widget.AppCompatButton <Button
android:id="@+id/btn_submit" android:id="@+id/btn_submit"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -106,8 +106,7 @@
android:layout_marginTop="24dp" android:layout_marginTop="24dp"
android:clickable="false" android:clickable="false"
android:text="@string/submit" android:text="@string/submit"
android:textColor="@color/red" android:textColor="@color/white"
android:background="@drawable/button_new"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_subtitle4" /> app:layout_constraintTop_toBottomOf="@id/tv_subtitle4" />

View File

@@ -108,8 +108,8 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="24dp" android:layout_marginHorizontal="24dp"
android:layout_marginTop="48dp"
android:text="@string/enter_kit_serial_number_manually" android:text="@string/enter_kit_serial_number_manually"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
tools:ignore="MissingConstraints" /> tools:ignore="MissingConstraints" />
@@ -135,15 +135,13 @@
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<androidx.appcompat.widget.AppCompatButton <com.google.android.material.button.MaterialButton
android:id="@+id/btn_go" android:id="@+id/btn_go"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="24dp" android:layout_margin="24dp"
android:text="@string/go" android:text="@string/go"
app:cornerRadius="16dp" app:cornerRadius="16dp"
android:textColor="@color/red"
android:background="@drawable/button_new"
app:layout_constraintBottom_toBottomOf="@id/et_abha_id" app:layout_constraintBottom_toBottomOf="@id/et_abha_id"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0" app:layout_constraintHorizontal_bias="1.0"
@@ -166,7 +164,7 @@
<androidx.appcompat.widget.AppCompatButton <Button
android:id="@+id/btn_placebuffer" android:id="@+id/btn_placebuffer"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -174,8 +172,7 @@
android:layout_marginTop="24dp" android:layout_marginTop="24dp"
android:clickable="false" android:clickable="false"
android:text="@string/place_buffer" android:text="@string/place_buffer"
android:background="@drawable/button_new" android:textColor="@color/white"
android:textColor="@color/red"
app:cornerRadius="16dp" app:cornerRadius="16dp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@@ -220,7 +217,6 @@
android:text="no device message" android:text="no device message"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="11sp" android:textSize="11sp"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/error_message" /> app:layout_constraintTop_toBottomOf="@id/error_message" />

View File

@@ -131,10 +131,8 @@
android:id="@+id/internetAvailableCL" android:id="@+id/internetAvailableCL"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:padding="24dp"
android:visibility="visible" android:visibility="visible"
tools:layout_editor_absoluteX="162dp" android:padding="24dp">
tools:layout_editor_absoluteY="-82dp">
<TextView <TextView
android:id="@+id/tv_title" android:id="@+id/tv_title"
@@ -155,7 +153,6 @@
app:layout_constraintBottom_toBottomOf="@+id/tv_title" app:layout_constraintBottom_toBottomOf="@+id/tv_title"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/tv_title" /> app:layout_constraintTop_toTopOf="@+id/tv_title" />
<ImageView <ImageView
android:id="@+id/btnLogout" android:id="@+id/btnLogout"
android:layout_width="30dp" android:layout_width="30dp"
@@ -214,9 +211,8 @@
<RadioGroup <RadioGroup
android:id="@+id/radioGroup" android:id="@+id/radioGroup"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content"
android:visibility="gone"
android:orientation="horizontal" android:orientation="horizontal"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/cardView4"> app:layout_constraintTop_toBottomOf="@+id/cardView4">
@@ -253,58 +249,52 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/radioGroup" app:layout_constraintTop_toBottomOf="@+id/radioGroup"
tools:listitem="@layout/user_item_view" /> tools:listitem="@layout/user_item_view"/>
<TextView <TextView
android:id="@+id/labelQuickCapture" android:id="@+id/labelQuickCapture"
style="@style/title1_1" style="@style/title1_1"
android:visibility="gone"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Quick Capture" android:text="Quick Capture"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@+id/btnQuickCapture" app:layout_constraintBottom_toTopOf="@+id/btnQuickCapture"
app:layout_constraintEnd_toEndOf="parent" /> app:layout_constraintEnd_toEndOf="parent" />
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton <com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/btnQuickCapture" android:id="@+id/btnQuickCapture"
android:visibility="gone"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="8dp" android:layout_margin="8dp"
android:backgroundTint="@color/primary" android:backgroundTint="@color/primary"
android:text="Quick Capture" android:contentDescription="Capture measurements quickly"
android:visibility="visible" android:src="@drawable/flask"
app:elevation="1dp" app:elevation="1dp"
app:icon="@drawable/flask"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintBottom_toTopOf="@+id/label" app:layout_constraintBottom_toTopOf="@+id/label"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" /> app:layout_constraintEnd_toEndOf="parent" />
<TextView <TextView
android:id="@+id/label" android:id="@+id/label"
style="@style/title1_1" style="@style/title1_1"
android:layout_width="2dp" android:layout_width="wrap_content"
android:layout_height="6dp" android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:background="@drawable/rounded_corner_background"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:text="@string/new_kit" android:text="@string/new_kit"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@+id/btnNewKit" app:layout_constraintBottom_toTopOf="@+id/btnNewKit"
app:layout_constraintEnd_toEndOf="parent" /> app:layout_constraintEnd_toEndOf="parent" />
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton <com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/btnNewKit" android:id="@+id/btnNewKit"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="8dp" android:layout_margin="8dp"
android:backgroundTint="@color/primary" android:backgroundTint="@color/primary"
android:contentDescription="@string/new_kit"
android:src="@drawable/ic_add" android:src="@drawable/ic_add"
android:text="@string/new_kit"
app:elevation="1dp" app:elevation="1dp"
app:icon="@drawable/ic_add"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" /> app:layout_constraintEnd_toEndOf="parent" />

View File

@@ -38,7 +38,6 @@
android:layout_marginHorizontal="24dp" android:layout_marginHorizontal="24dp"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:text="Scan to get the code" android:text="Scan to get the code"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_subtitle2" /> app:layout_constraintTop_toBottomOf="@id/tv_subtitle2" />
@@ -59,12 +58,11 @@
android:layout_width="258dp" android:layout_width="258dp"
android:layout_height="56dp" android:layout_height="56dp"
android:layout_margin="24dp" android:layout_margin="24dp"
android:drawableLeft="@drawable/baseline_qr_code_scanner_24_x" android:drawableLeft="@drawable/baseline_qr_code_scanner_24"
android:text="@string/scan_now" android:text="@string/scan_now"
android:textColor="@color/black" android:textColor="@color/black"
app:backgroundTint="@color/blue_app_light" app:backgroundTint="@color/blue_app_light"
app:cornerRadius="100dp" app:cornerRadius="100dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_title" /> app:layout_constraintTop_toBottomOf="@+id/tv_title" />
@@ -92,9 +90,9 @@
android:clickable="false" android:clickable="false"
android:gravity="center" android:gravity="center"
android:text="Refresh" android:text="Refresh"
android:textColor="@color/white"
android:visibility="visible" android:visibility="visible"
app:layout_constraintEnd_toEndOf="parent" android:textColor="@color/white"
app:layout_constraintEnd_toEndOf="@id/btn_scan_now"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btn_scan_now" /> app:layout_constraintTop_toBottomOf="@id/btn_scan_now" />

View File

@@ -52,10 +52,6 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="24dp" android:layout_marginTop="24dp"
app:boxCornerRadiusBottomEnd="10dp"
app:boxCornerRadiusBottomStart="10dp"
app:boxCornerRadiusTopEnd="10dp"
app:boxCornerRadiusTopStart="10dp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView"> app:layout_constraintTop_toBottomOf="@+id/imageView">
@@ -74,10 +70,6 @@
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:boxCornerRadiusBottomEnd="10dp"
app:boxCornerRadiusBottomStart="10dp"
app:boxCornerRadiusTopEnd="10dp"
app:boxCornerRadiusTopStart="10dp"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@@ -92,14 +84,12 @@
android:maxLength="12" /> android:maxLength="12" />
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<androidx.appcompat.widget.AppCompatButton <com.google.android.material.button.MaterialButton
android:id="@+id/btnLogin" android:id="@+id/btnLogin"
android:layout_width="150dp" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:text="@string/login" android:text="@string/login"
android:background="@drawable/button_new"
android:textColor="@color/red"
app:cornerRadius="16dp" app:cornerRadius="16dp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"

View File

@@ -16,7 +16,6 @@
android:layout_marginHorizontal="24dp" android:layout_marginHorizontal="24dp"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:text="@string/scan_patient_abha_id_card" android:text="@string/scan_patient_abha_id_card"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
@@ -26,12 +25,11 @@
android:layout_height="56dp" android:layout_height="56dp"
android:layout_marginHorizontal="24dp" android:layout_marginHorizontal="24dp"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:drawableLeft="@drawable/baseline_qr_code_scanner_24_x" android:drawableLeft="@drawable/baseline_qr_code_scanner_24"
android:text="@string/scan_now" android:text="@string/scan_now"
android:textColor="@color/black" android:textColor="@color/black"
app:backgroundTint="@color/blue_app_light" app:backgroundTint="@color/blue_app_light"
app:cornerRadius="100dp" app:cornerRadius="100dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_title" /> app:layout_constraintTop_toBottomOf="@+id/tv_title" />
@@ -62,7 +60,7 @@
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:layout_toLeftOf="@id/tvText1" android:layout_toLeftOf="@id/tvText1"
android:background="@color/red" /> android:background="@color/gray" />
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -70,7 +68,7 @@
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:layout_toRightOf="@id/tvText1" android:layout_toRightOf="@id/tvText1"
android:background="@color/red" /> android:background="@color/gray" />
</RelativeLayout> </RelativeLayout>
@@ -83,7 +81,6 @@
android:layout_marginHorizontal="24dp" android:layout_marginHorizontal="24dp"
android:layout_marginTop="48dp" android:layout_marginTop="48dp"
android:text="@string/enter_abha_number_manualy" android:text="@string/enter_abha_number_manualy"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/seperator1" /> app:layout_constraintTop_toBottomOf="@id/seperator1" />
@@ -108,15 +105,13 @@
android:inputType="number" /> android:inputType="number" />
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<androidx.appcompat.widget.AppCompatButton <com.google.android.material.button.MaterialButton
android:id="@+id/btn_go" android:id="@+id/btn_go"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="24dp" android:layout_margin="24dp"
android:text="@string/go" android:text="@string/go"
app:cornerRadius="16dp" app:cornerRadius="16dp"
android:background="@drawable/button_new"
android:textColor="@color/red"
app:layout_constraintBottom_toBottomOf="@id/et_abha_id" app:layout_constraintBottom_toBottomOf="@id/et_abha_id"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0" app:layout_constraintHorizontal_bias="1.0"
@@ -149,7 +144,7 @@
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:layout_toLeftOf="@id/tvText2" android:layout_toLeftOf="@id/tvText2"
android:background="@color/red" /> android:background="@color/gray" />
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -157,7 +152,7 @@
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:layout_toRightOf="@id/tvText2" android:layout_toRightOf="@id/tvText2"
android:background="@color/red" /> android:background="@color/gray" />
</RelativeLayout> </RelativeLayout>
@@ -169,7 +164,6 @@
android:layout_marginHorizontal="24dp" android:layout_marginHorizontal="24dp"
android:layout_marginTop="48dp" android:layout_marginTop="48dp"
android:text="Create ABHA ID card" android:text="Create ABHA ID card"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/seperator2" /> app:layout_constraintTop_toBottomOf="@id/seperator2" />
@@ -183,7 +177,6 @@
android:textColor="@color/black" android:textColor="@color/black"
app:backgroundTint="@color/blue_app_light" app:backgroundTint="@color/blue_app_light"
app:cornerRadius="100dp" app:cornerRadius="100dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_title3" /> app:layout_constraintTop_toBottomOf="@+id/tv_title3" />

View File

@@ -137,6 +137,15 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/til_careof"> app:layout_constraintTop_toBottomOf="@id/til_careof">
<AutoCompleteTextView
android:id="@+id/et_is_married"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/is_patient_married_yes_no"
android:inputType="none"
android:labelFor="@id/til_is_married"
app:simpleItems="@array/yes_no" />
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout <com.google.android.material.textfield.TextInputLayout
@@ -159,15 +168,6 @@
android:labelFor="@id/til_category" android:labelFor="@id/til_category"
app:simpleItems="@array/category" /> app:simpleItems="@array/category" />
<AutoCompleteTextView
android:id="@+id/et_is_married"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/is_patient_married_yes_no"
android:inputType="none"
android:labelFor="@id/til_is_married"
app:simpleItems="@array/yes_no" />
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<TextView <TextView

View File

@@ -16,7 +16,6 @@
android:layout_marginHorizontal="24dp" android:layout_marginHorizontal="24dp"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:text="@string/scan_patient_aadhaar_card" android:text="@string/scan_patient_aadhaar_card"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
@@ -25,12 +24,11 @@
android:layout_width="258dp" android:layout_width="258dp"
android:layout_height="56dp" android:layout_height="56dp"
android:layout_margin="24dp" android:layout_margin="24dp"
android:drawableLeft="@drawable/baseline_qr_code_scanner_24_x" android:drawableLeft="@drawable/baseline_qr_code_scanner_24"
android:text="@string/scan_now" android:text="@string/scan_now"
android:textColor="@color/black" android:textColor="@color/black"
app:backgroundTint="@color/blue_app_light" app:backgroundTint="@color/blue_app_light"
app:cornerRadius="100dp" app:cornerRadius="100dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_title" /> app:layout_constraintTop_toBottomOf="@+id/tv_title" />
@@ -61,7 +59,7 @@
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:layout_toLeftOf="@id/tvText1" android:layout_toLeftOf="@id/tvText1"
android:background="@color/red" /> android:background="@color/gray" />
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -69,7 +67,7 @@
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:layout_toRightOf="@id/tvText1" android:layout_toRightOf="@id/tvText1"
android:background="@color/red" /> android:background="@color/gray" />
</RelativeLayout> </RelativeLayout>
@@ -82,7 +80,6 @@
android:layout_marginHorizontal="24dp" android:layout_marginHorizontal="24dp"
android:layout_marginTop="48dp" android:layout_marginTop="48dp"
android:text="@string/enter_aadhaar_number_manualy" android:text="@string/enter_aadhaar_number_manualy"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/seperator1" /> app:layout_constraintTop_toBottomOf="@id/seperator1" />
@@ -108,17 +105,15 @@
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<androidx.appcompat.widget.AppCompatButton <com.google.android.material.button.MaterialButton
android:id="@+id/btn_go" android:id="@+id/btn_go"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="24dp" android:layout_margin="24dp"
android:text="@string/go" android:text="@string/go"
android:textColor="@color/red"
app:cornerRadius="16dp" app:cornerRadius="16dp"
app:layout_constraintBottom_toBottomOf="@id/et_abha_id" app:layout_constraintBottom_toBottomOf="@id/et_abha_id"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
android:background="@drawable/button_new"
app:layout_constraintHorizontal_bias="1.0" app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="@id/et_abha_id" app:layout_constraintStart_toEndOf="@id/et_abha_id"
app:layout_constraintTop_toTopOf="@id/et_abha_id" /> app:layout_constraintTop_toTopOf="@id/et_abha_id" />

View File

@@ -45,15 +45,14 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_subtitle1" /> app:layout_constraintTop_toBottomOf="@id/tv_subtitle1" />
<androidx.appcompat.widget.AppCompatButton <Button
android:id="@+id/btn_set_reference" android:id="@+id/btn_set_reference"
android:layout_width="192dp" android:layout_width="192dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="16dp" android:layout_margin="16dp"
android:clickable="false" android:clickable="false"
android:text="@string/set_reference" android:text="@string/set_reference"
android:background="@drawable/button_new" android:textColor="@color/white"
android:textColor="@color/red"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_subtitle2" /> app:layout_constraintTop_toBottomOf="@id/tv_subtitle2" />

View File

@@ -222,7 +222,7 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_subtitle2" /> app:layout_constraintTop_toBottomOf="@id/tv_subtitle2" />
<androidx.appcompat.widget.AppCompatButton <Button
android:id="@+id/btn_submit" android:id="@+id/btn_submit"
android:layout_width="216dp" android:layout_width="216dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -230,8 +230,7 @@
android:layout_marginTop="24dp" android:layout_marginTop="24dp"
android:clickable="false" android:clickable="false"
android:text="@string/submit" android:text="@string/submit"
android:background="@drawable/button_new" android:textColor="@color/white"
android:textColor="@color/red"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_subtitle3" /> app:layout_constraintTop_toBottomOf="@id/tv_subtitle3" />

View File

@@ -108,8 +108,8 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="24dp" android:layout_marginHorizontal="24dp"
android:layout_marginTop="48dp"
android:text="@string/enter_kit_serial_number_manually" android:text="@string/enter_kit_serial_number_manually"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
tools:ignore="MissingConstraints" /> tools:ignore="MissingConstraints" />
@@ -129,42 +129,34 @@
android:id="@+id/name_edit_text" android:id="@+id/name_edit_text"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:boxCornerRadiusBottomEnd="10dp"
app:boxCornerRadiusBottomStart="10dp"
app:boxCornerRadiusTopEnd="10dp"
app:boxCornerRadiusTopStart="10dp"
android:maxLength="17" android:maxLength="17"
android:inputType="text" android:inputType="text"
android:hint="@string/serial_number" /> android:hint="@string/serial_number" />
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<androidx.appcompat.widget.AppCompatButton <com.google.android.material.button.MaterialButton
android:id="@+id/btn_go" android:id="@+id/btn_go"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="24dp" android:layout_margin="24dp"
android:text="@string/go" android:text="@string/go"
app:cornerRadius="16dp" app:cornerRadius="16dp"
android:background="@drawable/button_new"
android:textColor="@color/red"
app:layout_constraintBottom_toBottomOf="@id/et_abha_id" app:layout_constraintBottom_toBottomOf="@id/et_abha_id"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0" app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="@id/et_abha_id" app:layout_constraintStart_toEndOf="@id/et_abha_id"
app:layout_constraintTop_toTopOf="@id/et_abha_id" /> app:layout_constraintTop_toTopOf="@id/et_abha_id" />
<Button
<androidx.appcompat.widget.AppCompatButton
android:visibility="gone" android:visibility="gone"
android:id="@+id/btn_samplestart" android:id="@+id/btn_samplestart"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp" android:layout_marginHorizontal="16dp"
android:layout_marginTop="24dp" android:layout_marginTop="24dp"
android:background="@drawable/button_new"
android:clickable="false" android:clickable="false"
android:text="@string/Start_Sample" android:text="@string/Start_Sample"
android:textColor="@color/red" android:textColor="@color/white"
app:cornerRadius="16dp" app:cornerRadius="16dp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@@ -172,7 +164,7 @@
<androidx.appcompat.widget.AppCompatButton <Button
android:id="@+id/btn_placebuffer" android:id="@+id/btn_placebuffer"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -180,8 +172,7 @@
android:layout_marginTop="24dp" android:layout_marginTop="24dp"
android:clickable="false" android:clickable="false"
android:text="@string/place_buffer" android:text="@string/place_buffer"
android:background="@drawable/button_new" android:textColor="@color/white"
android:textColor="@color/red"
app:cornerRadius="16dp" app:cornerRadius="16dp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"

View File

@@ -3,7 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/nav_header_height" android:layout_height="@dimen/nav_header_height"
android:background="@color/new_blue" android:background="@color/blue_app"
android:gravity="bottom" android:gravity="bottom"
android:orientation="vertical" android:orientation="vertical"
android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingLeft="@dimen/activity_horizontal_margin"
@@ -18,29 +18,25 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:cardCornerRadius="16dp"> app:cardCornerRadius="16dp">
<ImageView <ImageView
android:id="@+id/imageView" android:id="@+id/imageView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:contentDescription="@string/nav_header_desc" android:contentDescription="@string/nav_header_desc"
android:padding="6dp" android:paddingTop="@dimen/nav_header_vertical_spacing"
app:srcCompat="@mipmap/hpos_icon" /> app:srcCompat="@mipmap/hpos_icon" />
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="8sp"
android:paddingTop="@dimen/nav_header_vertical_spacing" android:paddingTop="@dimen/nav_header_vertical_spacing"
android:text="@string/nav_header_title" android:text="@string/nav_header_title"
android:textAppearance="@style/TextAppearance.AppCompat.Body1" android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
android:textColor="@color/blue_text_color" />
<TextView <TextView
android:id="@+id/textView" android:id="@+id/textView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="8sp" android:text="@string/nav_header_subtitle" />
android:text="@string/nav_header_subtitle"
android:textColor="@color/blue_text_color" />
</LinearLayout> </LinearLayout>

View File

@@ -24,7 +24,6 @@
android:id="@+id/userImage" android:id="@+id/userImage"
android:layout_width="100dp" android:layout_width="100dp"
android:layout_height="100dp" android:layout_height="100dp"
android:layout_marginLeft="10dp"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:src="@drawable/ic_launcher_foreground" /> tools:src="@drawable/ic_launcher_foreground" />
@@ -83,21 +82,15 @@
android:textColor="@color/white" android:textColor="@color/white"
app:layout_constraintStart_toEndOf="@+id/btn_blood" app:layout_constraintStart_toEndOf="@+id/btn_blood"
app:layout_constraintBottom_toBottomOf="@+id/btn_blood" /> app:layout_constraintBottom_toBottomOf="@+id/btn_blood" />
<Button
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btn_blood" android:id="@+id/btn_blood"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp" android:layout_marginHorizontal="16dp"
android:layout_marginTop="15dp"
android:layout_marginEnd="60dp"
android:background="@drawable/bloodgroup_button"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:text="@string/blood_group" android:text="@string/blood_group"
android:textColor="@color/white" android:textColor="@color/white"
app:layout_constraintEnd_toStartOf="@+id/btn_startIncubation" app:layout_constraintEnd_toStartOf="@+id/btn_startIncubation"
app:layout_constraintTop_toBottomOf="@id/userImage" /> app:layout_constraintTop_toBottomOf="@id/teststatus" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -17,4 +17,4 @@
android:icon="@drawable/baseline_settings_24" android:icon="@drawable/baseline_settings_24"
android:title="@string/menu_settings" /> android:title="@string/menu_settings" />
</group> </group>
</menu> </menu>

View File

@@ -271,6 +271,4 @@
<string name="deviceinfo">डिवाइस जानकारी</string> <string name="deviceinfo">डिवाइस जानकारी</string>
<string name="downloadcsv">सीएसवी डाउनलोड करें</string> <string name="downloadcsv">सीएसवी डाउनलोड करें</string>
<string name="Firefox">Firefox</string>
<string name="Files">Files</string>
</resources> </resources>

View File

@@ -271,7 +271,5 @@
<string name="ok">ಸರಿ</string> <string name="ok">ಸರಿ</string>
<string name="downloadcsv">CSV ಡೌನ್ಲೋಡ್ ಮಾಡಿ</string> <string name="downloadcsv">CSV ಡೌನ್ಲೋಡ್ ಮಾಡಿ</string>
<!-- Add translations for other strings --> <!-- Add translations for other strings -->
<string name="Firefox">Firefox</string>
<string name="Files">Files</string>
</resources> </resources>

View File

@@ -8,27 +8,20 @@
<color name="black">#FF000000</color> <color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color> <color name="white">#FFFFFFFF</color>
<color name="gray">#808080</color> <color name="gray">#808080</color>
<color name="blue_text_color">#0E2347</color>
<color name="brightGreen">#00FF00</color> <color name="brightGreen">#00FF00</color>
<color name="green_2">#295F2D</color> <color name="green_2">#295F2D</color>
<color name="red">#FF0000</color> <color name="red">#FF0000</color>
<color name="red_light">#88FF0000</color>
<color name="blue_app">#4daaff</color> <color name="blue_app">#4daaff</color>
<color name="card_blue_app">#43BFE8F7</color>
<color name="blue_app_dark">#005db3</color> <color name="blue_app_dark">#005db3</color>
<color name="blue_app_light">#e5f3ff</color> <color name="blue_app_light">#e5f3ff</color>
<color name="new_blue">#A2C3FA</color>
<color name="primary">#A2C3FA</color> <color name="primary">#4daaff</color>
<color name="primary_dark">#005db3</color> <color name="primary_dark">#005db3</color>
<color name="primary_light">#e5f3ff</color> <color name="primary_light">#e5f3ff</color>
</resources> </resources>

View File

@@ -174,7 +174,7 @@
<string name="create_abha_id_card">Create ABHA ID Card</string> <string name="create_abha_id_card">Create ABHA ID Card</string>
<string name="official_abha_app">Official ABHA App</string> <string name="official_abha_app">Official ABHA App</string>
<string name="scan_patient_aadhaar_card">Scan Patient Aadhaar Card</string> <string name="scan_patient_aadhaar_card">Scan Patient Aadhaar Card</string>
<string name="enter_aadhaar_number_manualy">Enter Aadhaar Number Manually</string> <string name="enter_aadhaar_number_manualy">Enter Aadhaar number manualy</string>
<string name="aadhaar_number">Aadhaar Number</string> <string name="aadhaar_number">Aadhaar Number</string>
<string name="aadhaar_in_tv"><b>Aadhaar Number</b></string> <string name="aadhaar_in_tv"><b>Aadhaar Number</b></string>
<string name="please_use_official_abha_app_to_create_abha_id_and_come_back">Please use “Official ABHA App" to create ABHA ID, and come back.</string> <string name="please_use_official_abha_app_to_create_abha_id_and_come_back">Please use “Official ABHA App" to create ABHA ID, and come back.</string>

View File

@@ -1,7 +1,11 @@
package com.example.hpostesting package com.example.hpostesting
import android.content.Context
import android.content.SharedPreferences import android.content.SharedPreferences
import com.example.hpostesting.presentation.hemocube.HemoCubeFragment import com.example.hpostesting.presentation.hemocube.HemoCubeFragment
import com.example.hpostesting.presentation.hemocube.HemocubeActivity
import `in`.sminnovations.hpostesting.databinding.FragmentHemoCubeReferenceBinding
import junit.framework.TestCase
import junit.framework.TestCase.assertEquals import junit.framework.TestCase.assertEquals
import junit.framework.TestCase.assertNull import junit.framework.TestCase.assertNull
import org.junit.Before import org.junit.Before
@@ -13,9 +17,18 @@ import org.mockito.MockitoAnnotations
class HemoCubeFragmentTest { class HemoCubeFragmentTest {
@Mock
lateinit var mockContext: Context
@Mock @Mock
private lateinit var mockSharedPreferences: SharedPreferences private lateinit var mockSharedPreferences: SharedPreferences
@Mock
private lateinit var mockActivity: HemocubeActivity // Replace with your actual Activity class
@Mock
private lateinit var mockBinding: FragmentHemoCubeReferenceBinding // Replace with your actual Binding class
private lateinit var hemoCubeFragment: HemoCubeFragment private lateinit var hemoCubeFragment: HemoCubeFragment
@Before @Before
@@ -38,7 +51,7 @@ class HemoCubeFragmentTest {
val deviceId = hemoCubeFragment.extractV2HardwareId("SNS HPP1-9000 SNE") val deviceId = hemoCubeFragment.extractV2HardwareId("SNS HPP1-9000 SNE")
// Assert // Assert
assertEquals("HPP1-9000", deviceId) TestCase.assertEquals("HPP1-9000", deviceId)
} }
@Test @Test
@@ -58,7 +71,7 @@ class HemoCubeFragmentTest {
) )
// Assert // Assert
assertEquals("HPP1-0001", deviceId) TestCase.assertEquals("HPP1-0001", deviceId)
} }
@Test @Test
@@ -71,8 +84,8 @@ class HemoCubeFragmentTest {
val result = hemoCubeFragment.allReadingsComplete(repeatReadingCount, readingsPerSample) val result = hemoCubeFragment.allReadingsComplete(repeatReadingCount, readingsPerSample)
// Assert // Assert
assertEquals(true, result) TestCase.assertEquals(true, result)
assertEquals(hemoCubeFragment.allReadingsComplete(0, 1), false) TestCase.assertEquals(hemoCubeFragment.allReadingsComplete(0, 1), false)
} }
@Test @Test
@@ -303,13 +316,6 @@ class HemoCubeFragmentTest {
assertEquals("HPP-000-5001", result) assertEquals("HPP-000-5001", result)
} }
@Test
fun testDeviceRatioClassificationNormalWithStartRange() {
val ratio = 0.16
val result = hemoCubeFragment.deviceRatioClassification(ratio)
assertEquals("Normal", result)
}
@Test @Test
fun testDeviceRatioClassificationNormal() { fun testDeviceRatioClassificationNormal() {
val ratio = 0.22 val ratio = 0.22
@@ -325,33 +331,19 @@ class HemoCubeFragmentTest {
} }
@Test @Test
fun testDeviceRatioClassificationSickleCellTraitLowerBound() { fun testDeviceRatioClassificationSickleCellTrait() {
val ratio = 0.251 val ratio = 0.25
val result = hemoCubeFragment.deviceRatioClassification(ratio)
assertEquals("Sickle Cell Trait", result)
}
@Test
fun testDeviceRatioClassificationSickleCellTraitUpperBound() {
val ratio = 0.309
val result = hemoCubeFragment.deviceRatioClassification(ratio) val result = hemoCubeFragment.deviceRatioClassification(ratio)
assertEquals("Sickle Cell Trait", result) assertEquals("Sickle Cell Trait", result)
} }
@Test @Test
fun testDeviceRatioClassificationPositiveForSickleCell() { fun testDeviceRatioClassificationPositiveForSickleCell() {
val ratio = 0.359 val ratio = 0.37
val result = hemoCubeFragment.deviceRatioClassification(ratio) val result = hemoCubeFragment.deviceRatioClassification(ratio)
assertEquals("Positive for Sickle Cell. HPLC for Confirmation", result) assertEquals("Positive for Sickle Cell. HPLC for Confirmation", result)
} }
@Test
fun testDeviceRatioClassificationSickleCellDiseaseLowerBound() {
val ratio = 0.361
val result = hemoCubeFragment.deviceRatioClassification(ratio)
assertEquals("Sickle Cell Disease", result)
}
@Test @Test
fun testDeviceRatioClassificationSickleCellDisease() { fun testDeviceRatioClassificationSickleCellDisease() {
val ratio = 0.45 val ratio = 0.45
@@ -367,166 +359,44 @@ class HemoCubeFragmentTest {
} }
@Test @Test
fun findResultWithAdditionalMethods_ValidInput_ReturnsBorderlineNormal() { fun findResultWithAdditionalMethods_ValidInput_ReturnsNegativeBorderlineRepeatTest() {
val result = // `when`(hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Normal", 70.0)).thenReturn("Negative Borderline, Repeat Test")
hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Negative Borderline", 2.5) val result = hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Normal", 70.0)
assertEquals("Borderline. Normal", result) assertEquals("Negative Borderline, Repeat Test", result)
}
@Test
fun findResultWithAdditionalMethods_ValidInput_ReturnsBorderlineSickleCellTrait1() {
val result =
hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Negative Borderline", 2.2)
assertEquals("Borderline. Sickle Cell Trait", result)
}
@Test
fun findResultWithAdditionalMethods_ValidInput_ReturnsBorderlineSickleCellTrait2() {
val result = hemoCubeFragment.findResultWithAdditionalMethods(
0.5,
"Positive for Sickle Cell. HPLC for Confirmation",
1.35
)
assertEquals("Borderline. Sickle Cell Trait", result)
}
@Test
fun findResultWithAdditionalMethods_ValidInput_ReturnsBorderlineSickleCellDisease() {
val result = hemoCubeFragment.findResultWithAdditionalMethods(
0.5,
"Positive for Sickle Cell. HPLC for Confirmation",
1.33
)
assertEquals("Borderline. Sickle Cell Disease", result)
} }
@Test @Test
fun findResultWithAdditionalMethods_NormalDeviceRatio_ReturnsNormalBelowSlopeRatioThreshold() { fun findResultWithAdditionalMethods_NormalDeviceRatio_ReturnsNormalBelowSlopeRatioThreshold() {
// `when`(hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Normal", 70.0)).thenReturn("Negative Borderline, Repeat Test")
val result = hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Normal", 30.0) val result = hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Normal", 30.0)
assertEquals("Normal", result) assertEquals("Normal", result)
} }
@Test @Test
fun findResultWithAdditionalMethods_NBL_ReturnsNBL() { fun findResultWithAdditionalMethods_NBL_ReturnsNBL() {
val result = hemoCubeFragment.findResultWithAdditionalMethods( // `when`(hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Abnormal", 70.0)).thenReturn("Invalid")
0.5, val result = hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Negative Borderline, Repeat Test", 70.0)
"Negative Borderline, Repeat Test",
70.0
)
assertEquals("Negative Borderline, Repeat Test", result) assertEquals("Negative Borderline, Repeat Test", result)
} }
@Test @Test
fun findResultWithAdditionalMethods_SCT_ReturnsSCT() { fun findResultWithAdditionalMethods_SCT_ReturnsSCT() {
val result = // `when`(hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Abnormal", 70.0)).thenReturn("Invalid")
hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Sickle Cell Trait", 70.0) val result = hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Sickle Cell Trait", 70.0)
assertEquals("Sickle Cell Trait", result) assertEquals("Sickle Cell Trait", result)
} }
@Test @Test
fun findResultWithAdditionalMethods_PBL_ReturnsPBL() { fun findResultWithAdditionalMethods_PBL_ReturnsPBL() {
val result = hemoCubeFragment.findResultWithAdditionalMethods( // `when`(hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Abnormal", 70.0)).thenReturn("Invalid")
0.5, val result = hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Positive for Sickle Cell. HPLC for Confirmation", 70.0)
"Positive for Sickle Cell. HPLC for Confirmation", assertEquals("Positive for Sickle Cell. HPLC for Confirmation", result)
1.35
)
assertEquals("Borderline. Sickle Cell Trait", result)
} }
@Test @Test
fun findResultWithAdditionalMethods_SCD_ReturnsSCD() { fun findResultWithAdditionalMethods_SCD_ReturnsSCD() {
val result = // `when`(hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Abnormal", 70.0)).thenReturn("Invalid")
hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Sickle Cell Disease", 70.0) val result = hemoCubeFragment.findResultWithAdditionalMethods(0.5, "Sickle Cell Disease", 70.0)
assertEquals("Sickle Cell Disease", result) assertEquals("Sickle Cell Disease", result)
} }
@Test
fun testReclassifyWithBorderlineMethod2_NegativeBorderlineToNormal() {
// Arrange
val deviceRatio = 0.1
val deviceRatioClass = "Negative Borderline"
val led2Average = 0.2
// Act
val result = hemoCubeFragment.reclassifyWithBorderlineMethod2(
deviceRatio,
deviceRatioClass,
led2Average
)
// Assert
assertEquals("Borderline. Normal", result)
}
@Test
fun testReclassifyWithBorderlineMethod2_NegativeBorderlineToSCT() {
// Arrange
val deviceRatio = 0.1
val deviceRatioClass = "Negative Borderline"
val led2Average = 0.14
// Act
val result = hemoCubeFragment.reclassifyWithBorderlineMethod2(
deviceRatio,
deviceRatioClass,
led2Average
)
// Assert
assertEquals("Borderline. Sickle Cell Trait", result)
}
@Test
fun testReclassifyWithBorderlineMethod2_PositiveSickleCell() {
// Arrange
val deviceRatio = 0.2
val deviceRatioClass = "Positive for Sickle Cell. HPLC for Confirmation"
val led2Average = 0.18
// Act
val result = hemoCubeFragment.reclassifyWithBorderlineMethod2(
deviceRatio,
deviceRatioClass,
led2Average
)
// Assert
assertEquals("Borderline. Sickle Cell Disease", result)
}
@Test
fun testReclassifyWithBorderlineMethod2_PositiveSickleCellToSCT() {
// Arrange
val deviceRatio = 0.2
val deviceRatioClass = "Positive for Sickle Cell. HPLC for Confirmation"
val led2Average = 0.195
// Act
val result = hemoCubeFragment.reclassifyWithBorderlineMethod2(
deviceRatio,
deviceRatioClass,
led2Average
)
// Assert
assertEquals("Borderline. Sickle Cell Trait", result)
}
@Test
fun testReclassifyWithBorderlineMethod2_PositiveSickleCellToSCD() {
// Arrange
val deviceRatio = 0.2
val deviceRatioClass = "Positive for Sickle Cell. HPLC for Confirmation"
val led2Average = 0.189
// Act
val result = hemoCubeFragment.reclassifyWithBorderlineMethod2(
deviceRatio,
deviceRatioClass,
led2Average
)
// Assert
assertEquals("Borderline. Sickle Cell Disease", result)
}
} }

View File

@@ -3,7 +3,7 @@ buildscript {
kotlin_version = '1.8.21' kotlin_version = '1.8.21'
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:8.2.2' classpath 'com.android.tools.build:gradle:8.1.1'
classpath 'com.google.gms:google-services:4.4.0' classpath 'com.google.gms:google-services:4.4.0'
classpath 'com.google.firebase:firebase-appdistribution-gradle:4.0.1' classpath 'com.google.firebase:firebase-appdistribution-gradle:4.0.1'
} }

View File

@@ -1,6 +1,6 @@
#Mon Jun 12 17:07:47 IST 2023 #Mon Jun 12 17:07:47 IST 2023
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

Binary file not shown.