Compare commits

..

8 Commits

Author SHA1 Message Date
tanx
304f413364 changes Ui and attributes of panel, auto DAC, Calibration and device Diagnostics screens. 2024-03-28 16:29:55 +05:30
tanx
f1b03c93a2 chenges buttons and text inputs attributes. 2024-03-25 12:40:59 +05:30
tanx
dded6976f6 chenges buttons and text inputs attributes. 2024-03-19 18:08:46 +05:30
tanx
b1d10d5403 created new drawable and changed all buttons style 2024-03-18 16:24:37 +05:30
tanx
9cf7fae2ec changed normal FAB to extended FAB 2024-03-07 16:14:56 +05:30
tanx
ef419d8a71 Changed Nav header color at all places.
nav header text color changed.
text alignment.
2024-03-06 17:40:31 +05:30
tanx
3317df4f70 Updated scanner icon.
Changed header color.
Fixed letter casing.
2024-03-04 12:33:10 +05:30
tanx
6bdd1da9da icon aspect ratio changed in nav_header_dashboard.xml 2024-03-02 13:51:01 +05:30
114 changed files with 977 additions and 1059 deletions

View File

@@ -19,8 +19,8 @@ android {
applicationId "in.sminnovations.hpostesting.dev" applicationId "in.sminnovations.hpostesting.dev"
minSdk 21 minSdk 21
targetSdk 34 targetSdk 34
versionCode 120 versionCode 114
versionName "2.1.120" versionName "2.1.114"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }

View File

@@ -25,7 +25,6 @@
<application <application
android:name="com.example.hpostesting.HPOSTestingApplication" android:name="com.example.hpostesting.HPOSTestingApplication"
android:largeHeap="true"
android:allowBackup="true" android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules" android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules" android:fullBackupContent="@xml/backup_rules"

View File

@@ -1,4 +1,4 @@
package com.example.hpostesting.util package com.example.hpostesting.data
import android.content.Context import android.content.Context
import android.os.Environment import android.os.Environment

View File

@@ -1,4 +1,4 @@
package com.example.hpostesting.data.constant package com.example.hpostesting.data
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import com.example.hpostesting.data.model.patient.HemoCubeTestData import com.example.hpostesting.data.model.patient.HemoCubeTestData

View File

@@ -1,4 +1,4 @@
package com.example.hpostesting.util package com.example.hpostesting.data
import android.content.Context import android.content.Context

View File

@@ -1,4 +1,4 @@
package com.example.hpostesting.util package com.example.hpostesting.data
import android.content.Context import android.content.Context
import android.content.SharedPreferences import android.content.SharedPreferences

View File

@@ -1,4 +1,4 @@
package com.example.hpostesting.util package com.example.hpostesting.data
sealed class Result<out T : Any> { sealed class Result<out T : Any> {
data class Success<out T : Any>(val data: T) : Result<T>() data class Success<out T : Any>(val data: T) : Result<T>()

View File

@@ -1,6 +1,12 @@
package com.example.hpostesting.presentation.utils package com.example.hpostesting.data.api
import com.example.hpostesting.data.constant.HemoCubeCommands import com.example.hpostesting.data.constant.HemoCubeCommands
import com.example.hpostesting.presentation.UsbServiceListener
interface PropertyProvider {
fun getProperty(key: String): String
}
interface DeviceCommunicationHandler { interface DeviceCommunicationHandler {
fun sendAndListenToDevice(command: HemoCubeCommands, listener: UsbServiceListener) fun sendAndListenToDevice(command: HemoCubeCommands, listener: UsbServiceListener)

View File

@@ -8,7 +8,7 @@ object Constants {
const val DOCUMENT_ID_FOR_UPDATE ="2o71vBKLqdgEKYtFG8Lb" 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 = true const val MOLBIO_INTEGRATION = false
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"

View File

@@ -5,7 +5,6 @@ import androidx.room.Dao
import androidx.room.Insert import androidx.room.Insert
import androidx.room.OnConflictStrategy import androidx.room.OnConflictStrategy
import androidx.room.Query import androidx.room.Query
import androidx.room.Update
import com.example.hpostesting.data.model.patient.HemoCubeTestData import com.example.hpostesting.data.model.patient.HemoCubeTestData
import com.example.hpostesting.data.model.patient.UserData import com.example.hpostesting.data.model.patient.UserData
@Dao @Dao
@@ -31,7 +30,7 @@ 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 localFlag = 0") @Query("SELECT * from hemo_cube_test_table WHERE molbioFlag = :status")
fun getPendingUser(): LiveData<List<HemoCubeTestData>> 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 = 29, version = 27,
exportSchema = false exportSchema = false
) )
@TypeConverters(Converters::class) @TypeConverters(Converters::class)

View File

@@ -89,9 +89,8 @@ class LocalFileDataSourceImpl @Inject constructor() : LocalFileDataSource {
) )
csvWriter.writeNext(header) csvWriter.writeNext(header)
// Filter and write data rows where testStatus is true // Write data rows
val filteredDataList = dataList.filter { it.testStatus == true } for (data in dataList) {
for (data in filteredDataList) {
val row = arrayOf( val row = arrayOf(
data._id, data._id,
data.name, data.name,

View File

@@ -5,8 +5,7 @@ import androidx.room.PrimaryKey
@Entity(tableName = "hemo_cube_test_table") @Entity(tableName = "hemo_cube_test_table")
data class HemoCubeTestData( data class HemoCubeTestData(
@PrimaryKey(autoGenerate = true) @PrimaryKey
var sampleid: Int = 0,
var _id: String = "", var _id: String = "",
var name: String = "", var name: String = "",
var incubationTime: String = "", var incubationTime: String = "",

View File

@@ -1,7 +1,7 @@
package com.example.hpostesting.data.repository package com.example.hpostesting.data.repository
import android.net.Uri import android.net.Uri
import com.example.hpostesting.util.Result import com.example.hpostesting.data.Result
import com.example.hpostesting.data.api.MolbioAuthApi import com.example.hpostesting.data.api.MolbioAuthApi
import com.example.hpostesting.data.api.MolbioResultApi import com.example.hpostesting.data.api.MolbioResultApi
import com.example.hpostesting.data.model.PendingUploads import com.example.hpostesting.data.model.PendingUploads
@@ -109,7 +109,20 @@ class DatabaseRepository @Inject constructor(
} }
override suspend fun addTestToDatabase(data: UserData?): Response<String> { override suspend fun addTestToDatabase(data: UserData?): Response<String> {
TODO("Not yet implemented") return try {
val userdata =
db.collection("patientData").whereEqualTo("_id", data!!._id).get().await()
if (userdata.documents.isNotEmpty()) {
userdata.documents.forEach {
db.collection("patientData").document(it.id).update("testStatus", true)
}
}
db.collection("testData").add(data).await()
Response.Success(data._id)
} catch (e: Exception) {
Firebase.crashlytics.recordException(e)
Response.Error(e)
}
} }
override suspend fun addTestToDatabaseforBufferCheck(data: BufferCheckData?): Response<String> { override suspend fun addTestToDatabaseforBufferCheck(data: BufferCheckData?): Response<String> {
@@ -234,22 +247,4 @@ class DatabaseRepository @Inject constructor(
override fun <UserData> addTestToDatabase(testDetails: UserData): Any { override fun <UserData> addTestToDatabase(testDetails: UserData): Any {
TODO("Not yet implemented") TODO("Not yet implemented")
} }
override suspend fun addTestToDatabasefornew(data: HemoCubeTestData?): Response<String> {
return try {
val userdata =
db.collection("patientData").whereEqualTo("_id", data!!._id).get().await()
if (userdata.documents.isNotEmpty()) {
userdata.documents.forEach {
db.collection("patientData").document(it.id).update("testStatus", true)
}
}
db.collection("testData").add(data).await()
Response.Success(data._id)
} catch (e: Exception) {
Firebase.crashlytics.recordException(e)
Response.Error(e)
}
}
} }

View File

@@ -1,6 +1,6 @@
package com.example.hpostesting.data.repository package com.example.hpostesting.data.repository
import com.example.hpostesting.util.Result import com.example.hpostesting.data.Result
import com.example.hpostesting.data.model.Response import com.example.hpostesting.data.model.Response
import com.example.hpostesting.data.model.devicediagnostics.DeviceDiagnosticsRequest import com.example.hpostesting.data.model.devicediagnostics.DeviceDiagnosticsRequest
import com.example.hpostesting.data.model.devicediagnostics.DeviceDiagnosticsResponse import com.example.hpostesting.data.model.devicediagnostics.DeviceDiagnosticsResponse
@@ -25,7 +25,6 @@ import okhttp3.ResponseBody
interface Repository { interface Repository {
suspend fun addTestToDatabase(data: HemoCubeTestData?): Response<String> suspend fun addTestToDatabase(data: HemoCubeTestData?): Response<String>
suspend fun addTestToDatabasefornew(data: HemoCubeTestData?): Response<String>
suspend fun addTestToDatabase(data: UserData?): Response<String> suspend fun addTestToDatabase(data: UserData?): Response<String>

View File

@@ -1,4 +1,4 @@
package com.example.hpostesting.di package com.example.hpostesting.domain.di
import android.app.Application import android.app.Application
import android.content.Context import android.content.Context
@@ -7,7 +7,7 @@ import android.content.res.AssetManager
import androidx.room.Room import androidx.room.Room
import com.example.hpostesting.data.api.MolbioAuthApi import com.example.hpostesting.data.api.MolbioAuthApi
import com.example.hpostesting.data.api.MolbioResultApi import com.example.hpostesting.data.api.MolbioResultApi
import com.example.hpostesting.util.PropertyProvider import com.example.hpostesting.data.api.PropertyProvider
import com.example.hpostesting.data.dao.HemoCubeBufferDao import com.example.hpostesting.data.dao.HemoCubeBufferDao
import com.example.hpostesting.data.dao.HemoCubeDao import com.example.hpostesting.data.dao.HemoCubeDao
import com.example.hpostesting.data.dao.MyDatabase import com.example.hpostesting.data.dao.MyDatabase
@@ -22,8 +22,8 @@ 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.utils.UsbServiceListener import com.example.hpostesting.presentation.UsbServiceListener
import com.example.hpostesting.presentation.utils.UsbServiceListenerImpl 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

View File

@@ -10,7 +10,7 @@ import android.view.View
import android.widget.EditText import android.widget.EditText
import android.widget.Toast import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import com.example.hpostesting.data.constant.DataHolder import com.example.hpostesting.data.DataHolder
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.presentation.dashboard.DashboardActivity import com.example.hpostesting.presentation.dashboard.DashboardActivity

View File

@@ -17,7 +17,7 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.core.view.get import androidx.core.view.get
import com.example.hpostesting.data.constant.DataHolder import com.example.hpostesting.data.DataHolder
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.UserData import com.example.hpostesting.data.model.patient.UserData

View File

@@ -0,0 +1,7 @@
package com.example.hpostesting.presentation
import androidx.lifecycle.ViewModel
class MainViewModel : ViewModel() {
}

View File

@@ -1,4 +1,4 @@
package com.example.hpostesting.presentation.utils package com.example.hpostesting.presentation
import android.content.Context import android.content.Context
import android.os.Build import android.os.Build

View File

@@ -13,7 +13,7 @@ import androidx.activity.result.contract.ActivityResultContracts
import androidx.annotation.RequiresApi import androidx.annotation.RequiresApi
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import com.example.hpostesting.data.constant.DataHolder import com.example.hpostesting.data.DataHolder
import com.example.hpostesting.data.constant.LanguageManager import com.example.hpostesting.data.constant.LanguageManager
import com.example.hpostesting.presentation.dashboard.DashboardActivity import com.example.hpostesting.presentation.dashboard.DashboardActivity
import com.example.hpostesting.util.MyUtils import com.example.hpostesting.util.MyUtils

View File

@@ -1,4 +1,4 @@
package com.example.hpostesting.presentation.utils package com.example.hpostesting.presentation
interface UsbServiceListener { interface UsbServiceListener {
fun onUsbRead(data: ByteArray?) fun onUsbRead(data: ByteArray?)

View File

@@ -1,9 +1,8 @@
package com.example.hpostesting.presentation.utils package com.example.hpostesting.presentation
import android.content.Context import android.content.Context
import android.util.Log import android.util.Log
import android.widget.Toast import android.widget.Toast
import com.example.hpostesting.presentation.utils.UsbServiceListener
class UsbServiceListenerImpl(private val context: Context): UsbServiceListener { class UsbServiceListenerImpl(private val context: Context): UsbServiceListener {
override fun onUsbRead(data: ByteArray?) { override fun onUsbRead(data: ByteArray?) {

View File

@@ -11,7 +11,7 @@ import androidx.navigation.findNavController
import androidx.recyclerview.widget.AsyncListDiffer import androidx.recyclerview.widget.AsyncListDiffer
import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.example.hpostesting.data.constant.DataHolder import com.example.hpostesting.data.DataHolder
import com.example.hpostesting.data.constant.Constants import com.example.hpostesting.data.constant.Constants
import com.example.hpostesting.data.model.patient.HemoCubeTestData import com.example.hpostesting.data.model.patient.HemoCubeTestData
import com.example.hpostesting.data.model.patient.UserData import com.example.hpostesting.data.model.patient.UserData

View File

@@ -14,7 +14,7 @@ import androidx.fragment.app.FragmentActivity
import androidx.navigation.findNavController import androidx.navigation.findNavController
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.example.hpostesting.data.constant.DataHolder import com.example.hpostesting.data.DataHolder
import com.example.hpostesting.data.model.patient.UserData import com.example.hpostesting.data.model.patient.UserData
import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel
import com.firebase.ui.firestore.FirestoreRecyclerAdapter import com.firebase.ui.firestore.FirestoreRecyclerAdapter

View File

@@ -13,8 +13,9 @@ import android.widget.AdapterView
import android.widget.ArrayAdapter import android.widget.ArrayAdapter
import android.widget.Spinner import android.widget.Spinner
import android.widget.Toast import android.widget.Toast
import androidx.core.view.isVisible
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import com.example.hpostesting.data.constant.DataHolder import com.example.hpostesting.data.DataHolder
import com.example.hpostesting.data.constant.Constants import com.example.hpostesting.data.constant.Constants
import com.example.hpostesting.data.model.patient.UserData import com.example.hpostesting.data.model.patient.UserData
import com.example.hpostesting.presentation.hemocube.HemocubeActivity import com.example.hpostesting.presentation.hemocube.HemocubeActivity

View File

@@ -20,7 +20,7 @@ import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.core.view.get import androidx.core.view.get
import com.example.hpostesting.data.constant.DataHolder import com.example.hpostesting.data.DataHolder
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.presentation.testRight.UsbService import com.example.hpostesting.presentation.testRight.UsbService

View File

@@ -14,7 +14,7 @@ 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.model.diagnostics.DiagnosticsData import com.example.hpostesting.data.model.diagnostics.DiagnosticsData
import com.example.hpostesting.data.model.patient.DeviceData import com.example.hpostesting.data.model.patient.DeviceData
import com.example.hpostesting.presentation.utils.UsbServiceListener import com.example.hpostesting.presentation.UsbServiceListener
import com.google.firebase.crashlytics.ktx.crashlytics import com.google.firebase.crashlytics.ktx.crashlytics
import com.google.firebase.ktx.Firebase import com.google.firebase.ktx.Firebase
import `in`.sminnovations.hpostesting.databinding.FragmentAutoDacBinding import `in`.sminnovations.hpostesting.databinding.FragmentAutoDacBinding

View File

@@ -0,0 +1,4 @@
package com.example.hpostesting.presentation.blank
class BlankActivity {
}

View File

@@ -0,0 +1,4 @@
package com.example.hpostesting.presentation.blank
class BlankFragment {
}

View File

@@ -0,0 +1,4 @@
package com.example.hpostesting.presentation.blank
class BlankViewModel {
}

View File

@@ -15,7 +15,7 @@ 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.model.patient.BufferCheckData import com.example.hpostesting.data.model.patient.BufferCheckData
import com.example.hpostesting.data.model.patient.DeviceData import com.example.hpostesting.data.model.patient.DeviceData
import com.example.hpostesting.presentation.utils.UsbServiceListener import com.example.hpostesting.presentation.UsbServiceListener
import com.example.hpostesting.presentation.dashboard.DashboardActivity import com.example.hpostesting.presentation.dashboard.DashboardActivity
import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel
import com.google.firebase.crashlytics.ktx.crashlytics import com.google.firebase.crashlytics.ktx.crashlytics

View File

@@ -20,7 +20,7 @@ import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.core.view.get import androidx.core.view.get
import com.example.hpostesting.data.constant.DataHolder import com.example.hpostesting.data.DataHolder
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.presentation.hemocube.HemoCubeViewModel import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel

View File

@@ -20,7 +20,7 @@ import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.core.view.get import androidx.core.view.get
import com.example.hpostesting.data.constant.DataHolder import com.example.hpostesting.data.DataHolder
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.presentation.testRight.UsbService import com.example.hpostesting.presentation.testRight.UsbService

View File

@@ -17,7 +17,7 @@ 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.model.calibration.CalibrationData import com.example.hpostesting.data.model.calibration.CalibrationData
import com.example.hpostesting.data.model.patient.DeviceData import com.example.hpostesting.data.model.patient.DeviceData
import com.example.hpostesting.presentation.utils.UsbServiceListener import com.example.hpostesting.presentation.UsbServiceListener
import com.example.hpostesting.presentation.dashboard.DashboardActivity import com.example.hpostesting.presentation.dashboard.DashboardActivity
import com.google.firebase.crashlytics.ktx.crashlytics import com.google.firebase.crashlytics.ktx.crashlytics
import com.google.firebase.ktx.Firebase import com.google.firebase.ktx.Firebase

View File

@@ -1,63 +0,0 @@
package com.example.hpostesting.presentation.dashboard
import android.content.Context
import android.content.SharedPreferences
import android.os.BatteryManager
import android.os.Bundle
import android.util.Log
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.activityViewModels
import com.example.hpostesting.data.constant.Constants
import com.example.hpostesting.data.constant.DataHolder
import com.example.hpostesting.data.model.patient.HemoCubeTestData
import com.example.hpostesting.presentation.adapter.OfflineUserListAdapter
import com.example.hpostesting.presentation.adapter.UserListAdapter
import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel
import com.example.hpostesting.presentation.testRight.TestRightViewModel
import `in`.sminnovations.hpostesting.R
import `in`.sminnovations.hpostesting.databinding.FragmentActivitiesBinding
import `in`.sminnovations.hpostesting.databinding.FragmentHomeBinding
class ActivitiesFragment : Fragment() {
private lateinit var binding: FragmentActivitiesBinding
private val hemoCubeViewModel: HemoCubeViewModel by activityViewModels()
private lateinit var adapter: OfflineUserListAdapter
private lateinit var sharedPreference: SharedPreferences
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?,
): View {
binding = FragmentActivitiesBinding.inflate(inflater, container, false)
sharedPreference = requireContext().getSharedPreferences("HEMOCUBE", Context.MODE_PRIVATE)
DataHolder.selectedTest = null
return binding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
hemoCubeViewModel.allPendingUserToUpload.observe(viewLifecycleOwner) { userData ->
if (userData.isNotEmpty()) {
binding.rvOrderOffline.visibility = View.VISIBLE
binding.noDataText.visibility = View.GONE
val bm =
requireContext().getSystemService(Context.BATTERY_SERVICE) as BatteryManager
val batLevel: Int = bm.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY)
adapter = OfflineUserListAdapter(binding.root, batLevel)
adapter.differ.submitList(userData)
binding.rvOrderOffline.adapter = adapter
}else{
binding.rvOrderOffline.visibility = View.GONE
binding.noDataText.visibility = View.VISIBLE
Log.d("Activities","Nothing to show")
}
}
}
}

View File

@@ -1,10 +1,11 @@
package com.example.hpostesting.presentation.dashboard package com.example.hpostesting.presentation.dashboard
import android.annotation.SuppressLint import android.app.DownloadManager
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.content.pm.PackageManager
import android.net.Uri import android.net.Uri
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
@@ -20,21 +21,23 @@ import androidx.navigation.ui.AppBarConfiguration
import androidx.navigation.ui.navigateUp import androidx.navigation.ui.navigateUp
import androidx.navigation.ui.setupActionBarWithNavController import androidx.navigation.ui.setupActionBarWithNavController
import androidx.navigation.ui.setupWithNavController import androidx.navigation.ui.setupWithNavController
import com.example.hpostesting.util.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.updates.DeviceUpdateRequest import com.example.hpostesting.data.model.patient.DeviceData
import com.example.hpostesting.presentation.utils.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
import com.google.android.material.navigation.NavigationView 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.BuildConfig
import `in`.sminnovations.hpostesting.R import `in`.sminnovations.hpostesting.R
import `in`.sminnovations.hpostesting.databinding.ActivityDashboardBinding import `in`.sminnovations.hpostesting.databinding.ActivityDashboardBinding
import okhttp3.ResponseBody
import java.io.File import java.io.File
interface NatsMessageCallback { interface NatsMessageCallback {
@@ -59,7 +62,7 @@ class DashboardActivity : AppCompatActivity(), IDataCollector {
private var downloadId: Long = 0 private var downloadId: Long = 0
// TODO: Remove hemocube viewmodel // TODO: Remove hemocube viewmodel
private val hemocubeViewModel: HemoCubeViewModel by viewModels() private val hemocubeViewModel: HemoCubeViewModel by viewModels()
private lateinit var sharedPreference: SharedPreferences
override fun attachBaseContext(newBase: Context?) { override fun attachBaseContext(newBase: Context?) {
val languageCode = LanguageManager.getSavedLanguage(newBase!!) val languageCode = LanguageManager.getSavedLanguage(newBase!!)
LanguageManager.setLocale(newBase, languageCode) LanguageManager.setLocale(newBase, languageCode)
@@ -72,7 +75,6 @@ class DashboardActivity : AppCompatActivity(), IDataCollector {
Log.d(TAG, "Received message on topic $topic: $message") Log.d(TAG, "Received message on topic $topic: $message")
} }
@SuppressLint("SetWorldReadable")
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
@@ -84,9 +86,6 @@ class DashboardActivity : AppCompatActivity(), IDataCollector {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
nats.connect() nats.connect()
} }
val versionName = getAppVersion(this@DashboardActivity) + " [ " + getAppEnvironment(this@DashboardActivity) + " ]"
binding.appBarDashboard.versionName.text = versionName
val deviceId = sharedPreferences.getString(Constants.DEVICE_ID, "") val deviceId = sharedPreferences.getString(Constants.DEVICE_ID, "")
@@ -97,22 +96,15 @@ class DashboardActivity : AppCompatActivity(), IDataCollector {
when (result) { when (result) {
is Result.Success -> { is Result.Success -> {
// Handle success // Handle success
val apk = result.data val apkUrl = result.data
val file = File(getExternalFilesDir("Updates"), "update.apk") // val apkUrl = "https://dl.dropboxusercontent.com/s/fi/1c3nn7t0co431hicl3hrt/app-debug.apk?rlkey=e4uf13ty1dpcked614vy1aaqp&dl=0"
file.setReadable(true, false) // Ensure the file is readable initiateUpdate(apkUrl.toString())
apk.byteStream().use { input -> Log.d("ApI", "APK URL: $apkUrl")
file.outputStream().use { output -> // Toast.makeText(
input.copyTo(output) // this,
} // "APK UPLOAD ${result.data}",
} // Toast.LENGTH_SHORT
Log.d("Responsebodyformat", "Responsebodyformat: ") // ).show()
installApk(file)
Log.e("ApI", "APK URL: $apk")
Toast.makeText(
this,
"${result.data}",
Toast.LENGTH_SHORT
).show()
} }
is Result.Error -> { is Result.Error -> {
@@ -137,7 +129,7 @@ class DashboardActivity : AppCompatActivity(), IDataCollector {
appBarConfiguration = AppBarConfiguration( appBarConfiguration = AppBarConfiguration(
setOf( setOf(
R.id.nav_home, R.id.nav_profile, R.id.nav_activity,R.id.nav_settings R.id.nav_home, R.id.nav_profile, R.id.nav_settings
), drawerLayout ), drawerLayout
) )
setupActionBarWithNavController(navController, appBarConfiguration) setupActionBarWithNavController(navController, appBarConfiguration)
@@ -162,15 +154,55 @@ class DashboardActivity : AppCompatActivity(), IDataCollector {
return navController.navigateUp(appBarConfiguration) || super.onSupportNavigateUp() return navController.navigateUp(appBarConfiguration) || super.onSupportNavigateUp()
} }
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(this, "Updates", "update.apk")
val downloadManager = 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
registerReceiver(downloadReceiver, filter, 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(getExternalFilesDir("Updates"), "update.apk")
file.setReadable(true, false) // Ensure the file is readable
private fun installApk(file: File) {
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,
"${BuildConfig.APPLICATION_ID}.fileprovider", "in.sminnovations.hpostesting.dev.fileprovider",
file file
) )
// Create an intent to install the APK
val installIntent = Intent(Intent.ACTION_INSTALL_PACKAGE) val installIntent = Intent(Intent.ACTION_INSTALL_PACKAGE)
installIntent.data = uri installIntent.data = uri
installIntent.flags = Intent.FLAG_GRANT_READ_URI_PERMISSION or installIntent.flags = Intent.FLAG_GRANT_READ_URI_PERMISSION or
@@ -186,13 +218,14 @@ class DashboardActivity : AppCompatActivity(), IDataCollector {
} }
override fun onDestroy() { override fun onDestroy() {
if(isRegistered) {
try { try {
// unregisterReceiver(downloadReceiver) if (isRegistered){
} catch (e: Exception) { unregisterReceiver(downloadReceiver)
Log.d("HomeFragment", e.toString())
} }
}catch (e: IllegalArgumentException){
Log.e("HOmeFragment",e.toString())
} }
super.onDestroy() super.onDestroy()
} }
@@ -245,30 +278,6 @@ 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)
// if (response.contains("checkUpdate")) { Log.d("DashBoardActResponse",response)
// hemocubeViewModel.deviceUpdate(createDeviceUpdateRequestData())
// }
}
private fun createDeviceUpdateRequestData(): DeviceUpdateRequest {
return DeviceUpdateRequest(
serial_no = sharedPreference.getString(Constants.DEVICE_ID, "")
)
}
private fun getAppVersion(context: Context): String {
return try {
val pInfo = context.packageManager.getPackageInfo(context.packageName, 0)
pInfo.versionName
} catch (e: PackageManager.NameNotFoundException) {
"N/A"
}
}
private fun getAppEnvironment(context: Context): String {
return try {
val pInfo = context.packageManager.getPackageInfo(context.packageName, 0)
pInfo.packageName.substringAfterLast('.')
} catch (e: PackageManager.NameNotFoundException) {
"N/A"
}
} }
} }

View File

@@ -6,7 +6,6 @@ import android.app.DownloadManager
import android.content.BroadcastReceiver 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.Context.RECEIVER_EXPORTED
import android.content.DialogInterface import android.content.DialogInterface
import android.content.Intent import android.content.Intent
import android.content.IntentFilter import android.content.IntentFilter
@@ -21,13 +20,13 @@ 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.annotation.RequiresApi
import androidx.core.content.FileProvider 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
import com.example.hpostesting.data.constant.DataHolder import com.example.hpostesting.data.DataHolder
import com.example.hpostesting.util.Result import com.example.hpostesting.data.Result
import com.example.hpostesting.data.api.DeviceCommunicationHandler
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.model.login.LoginRequest import com.example.hpostesting.data.model.login.LoginRequest
@@ -39,9 +38,8 @@ import com.example.hpostesting.data.model.patient.HemoCubeTestData
import com.example.hpostesting.data.model.patient.UserData import com.example.hpostesting.data.model.patient.UserData
import com.example.hpostesting.data.model.updates.CheckUpdateRequest import com.example.hpostesting.data.model.updates.CheckUpdateRequest
import com.example.hpostesting.data.model.updates.DeviceUpdateRequest import com.example.hpostesting.data.model.updates.DeviceUpdateRequest
import com.example.hpostesting.presentation.utils.DeviceCommunicationHandler
import com.example.hpostesting.presentation.KitScanActivity import com.example.hpostesting.presentation.KitScanActivity
import com.example.hpostesting.presentation.utils.UsbServiceListener import com.example.hpostesting.presentation.UsbServiceListener
import com.example.hpostesting.presentation.adapter.OfflineUserListAdapter import com.example.hpostesting.presentation.adapter.OfflineUserListAdapter
import com.example.hpostesting.presentation.adapter.UserListAdapter import com.example.hpostesting.presentation.adapter.UserListAdapter
import com.example.hpostesting.presentation.assurance.AssuranceControlsActivity import com.example.hpostesting.presentation.assurance.AssuranceControlsActivity
@@ -56,6 +54,7 @@ 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
@@ -72,8 +71,8 @@ import java.util.zip.ZipInputStream
@AndroidEntryPoint @AndroidEntryPoint
class HomeFragment : Fragment() { class HomeFragment : Fragment() {
private var isRegistered = false
private var downloadId: Long = 0 private var downloadId: Long = 0
private var isRegistered = false
private lateinit var binding: FragmentHomeBinding 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()
@@ -99,12 +98,10 @@ class HomeFragment : Fragment() {
return binding.root return binding.root
} }
@RequiresApi(Build.VERSION_CODES.P)
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
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
} }
@@ -121,8 +118,6 @@ class HomeFragment : Fragment() {
userData.forEach { userData.forEach {
if (it.testStatus == false) { if (it.testStatus == false) {
userList.add(it) userList.add(it)
}else if(it.testStatus == true){
userList.removeAll(userData)
} }
} }
val bm = requireContext().getSystemService(BATTERY_SERVICE) as BatteryManager val bm = requireContext().getSystemService(BATTERY_SERVICE) as BatteryManager
@@ -151,63 +146,35 @@ class HomeFragment : Fragment() {
checkForTokenAndUpdate() checkForTokenAndUpdate()
} }
// Now re-subscribe to allUserData hemoCubeViewModel.allUserData.observe(viewLifecycleOwner) { userDataList ->
hemoCubeViewModel.allLocalData.observe(viewLifecycleOwner) { originalUserDataList -> val resultList = MolbioV2ResultRequest(mutableListOf(MolbioV2Result()))
userDataList.forEach { userData ->
Log.d("LOCAL_DB OBSERVE", "OBSERVE CALLED") if (!userData.molbioFlag && isTokenAvailable && Constants.MOLBIO_INTEGRATION) {
val resultList = MolbioV2ResultRequest(mutableListOf())
originalUserDataList.forEach { userData ->
Log.d(": USER DATA", originalUserDataList.count().toString() + " : " + userData._id)
var accessToken = sharedPreference.getString(Constants.ACCESS_TOKEN, "").toString()
// Upload results after processing all userData to avoid duplicates and ensure all modifications are done
if(accessToken.isNotEmpty()) {
if (!userData.localFlag && userData.testStatus == true) {
hemoCubeViewModel.bulkAddResultTestToDb(userData)
}
if (!userData.molbioFlag && isTokenAvailable && Constants.MOLBIO_INTEGRATION && userData.testStatus == true) {
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 = currentTimeFormatted, analysisDate = "2024-02-08 16:33:56",//userData.testTime,
analysisStatus = userData.classificationResult ?: "defaultStatus", // Handle possible nulls analysisStatus = userData.classificationResult,
thresholds = bufferIntensityThreshold, thresholds = Constants.BUFFER_INTENSITY_THRESHOLDS[userData.deviceId].toString(),
interpretation = userData.classificationResult ?: "defaultInterpretation", // Handle possible nulls interpretation = userData.classificationResult,
testId = userData._id, testId = userData._id,
testTime = currentTimeFormatted, testTime = "2024-02-08 16:33:56",//userData.testTime,
collectionTime = currentTimeFormatted, collectionTime = "2024-02-08 16:33:56",//userData.testTime,
expiryTime = currentTimeFormatted expiryTime = "2024-02-08 16:33:56"//userData.testTime,
) )
) )
} }
} if (!userData.molbioFlag && isTokenAvailable && Constants.MOLBIO_INTEGRATION) {
} userData.molbioFlag = true
Log.d("USER DATA LIST SIZE", resultList.results?.count().toString())
resultList.results?.forEach { result ->
val userData = result.rawData
Log.d("UserData", userData.toString())
}
resultList.results?.forEach { result ->
result.rawData?.let { sanitizeDoubleValues(it) }
}
// Then, check if there are any results to upload.
if (resultList.results?.isNotEmpty() == true) {
hemoCubeViewModel.uploadResult(resultList) hemoCubeViewModel.uploadResult(resultList)
Log.d("resultcount1", "Uploading sanitized results") }
if (!userData.localFlag) {
userData.localFlag = true
hemoCubeViewModel.bulkAddResultTestToDb(userData)
}
} }
} }
@@ -234,18 +201,16 @@ class HomeFragment : Fragment() {
logoutUser(requireContext()) logoutUser(requireContext())
} }
binding.btnLogout1.setOnClickListener {
logoutUser(requireContext())
}
binding.uploadData.setOnClickListener { binding.uploadData.setOnClickListener {
// showUploadDialog(requireContext()) showUploadDialog(requireContext())
} }
hemoCubeViewModel.allUserData.observe(viewLifecycleOwner) { userData -> hemoCubeViewModel.allUserData.observe(viewLifecycleOwner) { userData ->
if (sharedPreference.getString(Constants.USER_ID, "").toString() == "ADMIN") {
val btnSaveLocalVisibility = val btnSaveLocalVisibility =
if (userData.any { it.testStatus == true }) View.VISIBLE else View.GONE if (userData.any { it.testStatus == true }) View.GONE else View.GONE
binding.downloadCSV.visibility = btnSaveLocalVisibility binding.downloadCSV.visibility = btnSaveLocalVisibility
binding.downloadCSV.setOnClickListener { binding.downloadCSV.setOnClickListener {
if (btnSaveLocalVisibility == View.VISIBLE) { if (btnSaveLocalVisibility == View.VISIBLE) {
// Execute the action when the button is visible (testStatus is true for at least one user) // Execute the action when the button is visible (testStatus is true for at least one user)
@@ -259,9 +224,6 @@ class HomeFragment : Fragment() {
).show() ).show()
} }
} }
}else{
binding.downloadCSV.visibility = View.GONE
}
} }
@@ -272,17 +234,6 @@ class HomeFragment : Fragment() {
apply() apply()
} }
startActivity(Intent(requireContext(), KitScanActivity::class.java)) startActivity(Intent(requireContext(), KitScanActivity::class.java))
// requireActivity().finish()
}
binding.btnNewKitoffline.setOnClickListener {
with(sharedPreference.edit()) {
putString(Constants.KIT_NUMBER, "")
putInt(Constants.KIT_COUNT, 0)
apply()
}
startActivity(Intent(requireContext(), KitScanActivity::class.java))
requireActivity().finish() requireActivity().finish()
} }
binding.btnQuickCapture.setOnClickListener { binding.btnQuickCapture.setOnClickListener {
@@ -300,32 +251,41 @@ class HomeFragment : Fragment() {
} }
@RequiresApi(Build.VERSION_CODES.P)
private fun checkForTokenAndUpdate() { private fun checkForTokenAndUpdate() {
var accessToken = sharedPreference.getString(Constants.ACCESS_TOKEN, "").toString() var accessToken = sharedPreference.getString(Constants.ACCESS_TOKEN, "").toString()
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()
if (userID.isNotEmpty() && password.isNotEmpty()) { if (userID.isNotEmpty() && password.isNotEmpty()) {
Log.d("istoken",isTokenAvailable.toString())
if (!isTokenAvailable) { if (!isTokenAvailable) {
Log.d("istoken1",isTokenAvailable.toString())
hemoCubeViewModel.login(createLoginRequestData(userID, password)) hemoCubeViewModel.login(createLoginRequestData(userID, password))
isTokenAvailable = true
}else if(isTokenAvailable){
Log.d("istoken7",isTokenAvailable.toString())
isTokenAvailable = true
hemoCubeViewModel.startPeriodicCheckUpdate()
hemoCubeViewModel.checkUpdate(createCheckUpdateRequestData())
} else { } else {
if (isTokenExpired(accessToken)) { if (isTokenExpired(accessToken)) {
Log.d("istoken8",isTokenAvailable.toString())
hemoCubeViewModel.login(createLoginRequestData(userID, password)) hemoCubeViewModel.login(createLoginRequestData(userID, password))
} else {
isTokenAvailable = true
hemoCubeViewModel.deviceUpdate(createDeviceUpdateRequestData())
hemoCubeViewModel.uploadLogs()
hemoCubeViewModel.startPeriodicCheckUpdate()
hemoCubeViewModel.downloadClientCertificate()
} }
} }
} else if (userID == "deviceIDAPI" && password == "devicePasswordAPI" && deviceId.isNotEmpty()) { } else if (deviceId.isNotEmpty()) {
fetchDeviceCredentials() fetchDeviceCredentials()
// This code will execute after credentials have been successfully fetched and stored.
userID = sharedPreference.getString("username", "").toString()
password = sharedPreference.getString("password", "").toString()
accessToken = sharedPreference.getString(Constants.ACCESS_TOKEN, "").toString()
if (accessToken.isEmpty()) {
hemoCubeViewModel.login(createLoginRequestData(userID, password))
} else {
// Continue with your existing logic if the token is not empty.
isTokenAvailable = true
hemoCubeViewModel.deviceUpdate(createDeviceUpdateRequestData())
hemoCubeViewModel.uploadLogs()
hemoCubeViewModel.startPeriodicCheckUpdate()
}
} else { } else {
Toast.makeText( Toast.makeText(
requireContext(), requireContext(),
@@ -338,9 +298,6 @@ class HomeFragment : Fragment() {
when (response) { when (response) {
is Result.Success -> { is Result.Success -> {
updateTokens(response) updateTokens(response)
response.data.data?.accessToken
isTokenAvailable = true
Log.d("istoken2",isTokenAvailable.toString())
} }
is Result.Error -> { is Result.Error -> {
@@ -362,36 +319,6 @@ class HomeFragment : Fragment() {
} }
} }
hemoCubeViewModel.resultUpload.observe(viewLifecycleOwner) {
when (it) {
is Result.Success -> {
Log.d("success,","uploded")
it.data.data?.forEach { id ->
id.rawData?.let { it1 ->
hemoCubeViewModel.updateMolbioFlag(
it1._id
)
}
}
Toast.makeText(activity, "Molbio Result is successfully uploaded", Toast.LENGTH_LONG)
.show()
}
is Result.Error -> {
binding.btnSubmit.visibility = View.VISIBLE
//Remove this line of code while deploying to IOCL
it.exception.let { message ->
Toast.makeText(activity, "$message", Toast.LENGTH_LONG)
.show()
Log.d("resultuploadfail", message.toString())
}
}
else -> {}
}
}
hemoCubeViewModel.uploadLogs.observe(viewLifecycleOwner) { response -> hemoCubeViewModel.uploadLogs.observe(viewLifecycleOwner) { response ->
when (response) { when (response) {
is Result.Success -> { is Result.Success -> {
@@ -400,14 +327,13 @@ class HomeFragment : Fragment() {
// "Log uploaded ${response.data.data?.filename}", // "Log uploaded ${response.data.data?.filename}",
// Toast.LENGTH_SHORT // Toast.LENGTH_SHORT
// ).show() // ).show()
} }
is Result.Error -> { is Result.Error -> {
response.exception.let { message -> response.exception.let { message ->
Toast.makeText( Toast.makeText(
activity, activity,
"$message", "An error occurred in uploading logs: $message",
Toast.LENGTH_LONG Toast.LENGTH_LONG
) )
.show() .show()
@@ -422,84 +348,28 @@ class HomeFragment : Fragment() {
} }
} }
hemoCubeViewModel.checkUpdate.observe(viewLifecycleOwner) { response ->
when (response) {
is Result.Success -> {
val updatedversion = response.data.data?.version.toString()
val currentversion =
context?.let { ctx ->
val packageInfo = ctx.packageManager.getPackageInfo(ctx.packageName, 0)
val versionName = packageInfo.versionName
val versionCode: Long = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
// From Android P (API level 28), versionCode is deprecated and you should use longVersionCode instead.
packageInfo.longVersionCode
} else {
// For older Android versions, use versionCode (cast it to Long for consistency).
packageInfo.versionCode.toLong()
}
// Use versionName and versionCode as needed
Log.d("AppInfo", "Version Name: $versionName, Version Code: $versionCode")
}
Log.d("versionnow",currentversion.toString())
Log.d("versionnow",updatedversion.toString())
if(updatedversion > currentversion.toString()){
hemoCubeViewModel.deviceUpdate(createDeviceUpdateRequestData())
Toast.makeText(
activity,
"new version ${response.data.data?.version} Available",
Toast.LENGTH_LONG
)
.show()
}else{
Toast.makeText(
activity,
"App is Up to date",
Toast.LENGTH_LONG
)
.show()
}
}
is Result.Error -> {
// response.exception.let { message ->
//// Toast.makeText(
//// activity,
//// "$message",
//// Toast.LENGTH_LONG
//// )
//// .show()
// }
}
is Result.Loading -> {
}
else -> {
}
}
}
hemoCubeViewModel.downloadcertificate.observe(viewLifecycleOwner) { response -> hemoCubeViewModel.downloadcertificate.observe(viewLifecycleOwner) { response ->
when (response) { when (response) {
is Result.Success -> { is Result.Success -> {
val url = response.data val url = response.data
val downloadDirectory = "NATS"
val fileName = "nats_certificate.zip" val fileName = "nats_certificate.zip"
val unzipDirectoryPath = requireContext().getExternalFilesDir(null)?.absolutePath + "/$downloadDirectory" val downloadDirectory = "NATS"
// Check if the directory with extracted files exists.
val directory = File(unzipDirectoryPath)
if (directory.exists() && directory.isDirectory) {
// Assuming if the directory exists, the certificate has been downloaded and extracted.
// You can add more specific checks here, e.g., checking for specific files within the directory.
Toast.makeText(requireContext(), "NATS certificate already downloaded and extracted.", Toast.LENGTH_SHORT).show()
return@observe
}
val file = downloadFile(url, requireContext(), fileName, downloadDirectory) val file = downloadFile(url, requireContext(), fileName, downloadDirectory)
Toast.makeText(
requireContext(),
"NATS certificate Downloaded",
Toast.LENGTH_SHORT
).show()
val unzipDirectoryPath =
requireContext().getExternalFilesDir(null)?.absolutePath + "/$downloadDirectory"
unzip(file.absolutePath, unzipDirectoryPath) unzip(file.absolutePath, unzipDirectoryPath)
Toast.makeText(
requireContext(),
"NATS certificate Extracted",
Toast.LENGTH_SHORT
).show()
} }
is Result.Error -> { is Result.Error -> {
@@ -521,12 +391,36 @@ class HomeFragment : Fragment() {
} }
} }
hemoCubeViewModel.resultUpload.observe(viewLifecycleOwner) {
when (it) {
is Result.Success -> {
it.data.data?.forEach { id ->
id.rawData?.let { it1 ->
hemoCubeViewModel.updateMolbioFlag(
it1._id
)
}
}
}
is Result.Error -> {
binding.btnSubmit.visibility = View.VISIBLE
//Remove this line of code while deploying to IOCL
it.exception.let { message ->
Toast.makeText(activity, "An error occurred: $message", Toast.LENGTH_LONG)
.show()
}
}
else -> {}
}
}
} }
private fun isTokenExpired(token: String): Boolean { private fun isTokenExpired(token: String): Boolean {
if(token.isNotEmpty()) {
val parts = token.split("\\.".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray() val parts = token.split("\\.".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
val decodedPayload = String(Base64.decode(parts[1], Base64.DEFAULT)) val decodedPayload = String(Base64.decode(parts[1], Base64.DEFAULT))
val jsonPayload = JSONObject(decodedPayload) val jsonPayload = JSONObject(decodedPayload)
@@ -535,9 +429,6 @@ class HomeFragment : Fragment() {
val currentTimeSeconds = System.currentTimeMillis() / 1000 val currentTimeSeconds = System.currentTimeMillis() / 1000
return exp <= currentTimeSeconds return exp <= currentTimeSeconds
}else{
return false
}
} }
private fun updateTokens(response: Result.Success<LoginResponse>) { private fun updateTokens(response: Result.Success<LoginResponse>) {
@@ -550,7 +441,6 @@ class HomeFragment : Fragment() {
apply() apply()
} }
isTokenAvailable = true isTokenAvailable = true
Log.d("istoken3",isTokenAvailable.toString())
} }
private fun createLoginRequestData(userID: String, password: String): LoginRequest { private fun createLoginRequestData(userID: String, password: String): LoginRequest {
@@ -661,7 +551,6 @@ class HomeFragment : Fragment() {
} }
} }
@RequiresApi(Build.VERSION_CODES.P)
private fun fetchDeviceCredentials() { private fun fetchDeviceCredentials() {
try { try {
val db = Firebase.firestore val db = Firebase.firestore
@@ -688,16 +577,12 @@ class HomeFragment : Fragment() {
) )
// Save credentials in SharedPreferences // Save credentials in SharedPreferences
with(sharedPreference.edit()) { with(sharedPreference.edit()) {
putString(Constants.DEVICE_ID_API, username) putString("username", username)
putString(Constants.DEVICE_PASSWORD_API, password) putString("password", password)
putString(Constants.NATS_TOKEN, natsToken) putString(Constants.NATS_TOKEN, natsToken)
apply() apply()
} }
if (!isTokenAvailable ) {
Log.d("istoken0", isTokenAvailable.toString())
hemoCubeViewModel.login(createLoginRequestData(username, password)) hemoCubeViewModel.login(createLoginRequestData(username, password))
}
} ?: Log.e("fetchDeviceCredentials", "Failed to parse device data.") } ?: Log.e("fetchDeviceCredentials", "Failed to parse device data.")
} else { } else {
Log.e("fetchDeviceCredentials", "Document does not exist.") Log.e("fetchDeviceCredentials", "Document does not exist.")
@@ -860,16 +745,16 @@ class HomeFragment : Fragment() {
} }
private fun checkForLocalDBData() { private fun checkForLocalDBData() {
// viewModel.allUserData.observe(viewLifecycleOwner) { userDataList -> viewModel.allUserData.observe(viewLifecycleOwner) { userDataList ->
// val uploadDataVisibility = if (userDataList.isEmpty()) View.GONE else View.VISIBLE val uploadDataVisibility = if (userDataList.isEmpty()) View.GONE else View.VISIBLE
// binding.uploadData.visibility = uploadDataVisibility binding.uploadData.visibility = uploadDataVisibility
// } }
//
// hemoCubeViewModel.allUserData.observe(viewLifecycleOwner) { userDataList -> hemoCubeViewModel.allUserData.observe(viewLifecycleOwner) { userDataList ->
// val uploadDataVisibility = val uploadDataVisibility =
// if (userDataList.any { !it.localFlag && !it.molbioFlag && it.testStatus == true }) View.VISIBLE else View.GONE if (userDataList.any { !it.localFlag && !it.molbioFlag && it.testStatus == true }) View.VISIBLE else View.GONE
// binding.uploadData.visibility = uploadDataVisibility binding.uploadData.visibility = uploadDataVisibility
// } }
hemoCubeViewModel.allKitTestData.observe(viewLifecycleOwner) { bufferData -> hemoCubeViewModel.allKitTestData.observe(viewLifecycleOwner) { bufferData ->
val uploadDataVisibility = val uploadDataVisibility =
@@ -880,30 +765,11 @@ class HomeFragment : Fragment() {
private fun checkUnprocessedCSVData() { private fun checkUnprocessedCSVData() {
hemoCubeViewModel.allUserData.observe(viewLifecycleOwner) { userDataList -> hemoCubeViewModel.allUserData.observe(viewLifecycleOwner) { userDataList ->
if (sharedPreference.getString(Constants.USER_ID, "").toString() == "ADMIN") {
val downloadDataVisibility = val downloadDataVisibility =
if (userDataList.any { !it.isCSVCreated && it.testStatus == true }) View.VISIBLE else View.GONE if (userDataList.any { !it.isCSVCreated && it.testStatus == true }) View.GONE else View.GONE
binding.downloadCSV.visibility = downloadDataVisibility binding.downloadCSV.visibility = downloadDataVisibility
}else{
binding.downloadCSV.visibility = View.GONE
} }
} }
}
private fun sanitizeDoubleValues(hemoCubeTestData: HemoCubeTestData): HemoCubeTestData {
hemoCubeTestData::class.java.declaredFields.forEach { field ->
if (field.type == Double::class.javaObjectType || field.type == Double::class.javaPrimitiveType) {
field.isAccessible = true
val value = field.get(hemoCubeTestData) as Double?
if (value != null && (value.isInfinite() || value.isNaN())) {
field.set(hemoCubeTestData, 0.0) // Replace with a suitable default value
}
}
}
return hemoCubeTestData
}
private fun showUploadDialog(context: Context) { private fun showUploadDialog(context: Context) {
val builder = AlertDialog.Builder(context) val builder = AlertDialog.Builder(context)
@@ -911,7 +777,7 @@ class HomeFragment : Fragment() {
builder.setMessage(R.string.upload_db_registration_message) builder.setMessage(R.string.upload_db_registration_message)
builder.setPositiveButton(R.string.upload) { dialog, _ -> builder.setPositiveButton(R.string.upload) { dialog, _ ->
// uploadLocalDBData(dialog) uploadLocalDBData(dialog)
} }
builder.setNegativeButton(R.string.cancel) { dialog, _ -> builder.setNegativeButton(R.string.cancel) { dialog, _ ->
@@ -922,71 +788,71 @@ class HomeFragment : Fragment() {
dialog.show() dialog.show()
} }
private fun showDownloadDialog(context: Context) { // private fun showDownloadDialog(context: Context) {
val builder = AlertDialog.Builder(context) // val builder = AlertDialog.Builder(context)
builder.setTitle(R.string.download_db_registration_title) // builder.setTitle(R.string.download_db_registration_title)
builder.setMessage(R.string.download_db_registration_message) // builder.setMessage(R.string.download_db_registration_message)
//
builder.setPositiveButton(R.string.downloadcsv) { dialog, _ -> // builder.setPositiveButton(R.string.downloadcsv) { dialog, _ ->
downloadLocalDBData(dialog) // downloadLocalDBData(dialog)
} // }
//
builder.setNegativeButton(R.string.cancel) { dialog, _ -> // builder.setNegativeButton(R.string.cancel) { dialog, _ ->
dialog.dismiss() // dialog.dismiss()
} // }
//
val dialog = builder.create() // val dialog = builder.create()
dialog.show() // dialog.show()
} // }
private fun uploadLocalDBData(dialog: DialogInterface) { private fun uploadLocalDBData(dialog: DialogInterface) {
// viewModel.allUserData.observe(viewLifecycleOwner) { userDataList -> viewModel.allUserData.observe(viewLifecycleOwner) { userDataList ->
// if (userDataList.isEmpty()) { if (userDataList.isEmpty()) {
// dialog.dismiss() dialog.dismiss()
// } else { } else {
// userDataList.forEach { userData -> userDataList.forEach { userData ->
// viewModel.bulkUploadResultToDatabase(userData) viewModel.bulkUploadResultToDatabase(userData)
// viewModel.deleteById(userData._id) viewModel.deleteById(userData._id)
// } }
// dialog.dismiss() dialog.dismiss()
// Toast.makeText( Toast.makeText(
// requireContext(), R.string.upload_success_message, Toast.LENGTH_SHORT requireContext(), R.string.upload_success_message, Toast.LENGTH_SHORT
// ).show() ).show()
// } }
// } }
// hemoCubeViewModel.allUserData.observe(viewLifecycleOwner) { userDataList -> hemoCubeViewModel.allUserData.observe(viewLifecycleOwner) { userDataList ->
// val resultList = MolbioV2ResultRequest(mutableListOf(MolbioV2Result())) val resultList = MolbioV2ResultRequest(mutableListOf(MolbioV2Result()))
// userDataList.forEach { userData -> userDataList.forEach { userData ->
// if (!userData.molbioFlag && isTokenAvailable) { if (!userData.molbioFlag && isTokenAvailable) {
// 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.reportUploadTime, analysisDate = "2024-02-08 16:33:56", //userData.reportUploadTime,
// analysisStatus = userData.classificationResult, analysisStatus = userData.classificationResult,
// thresholds = Constants.BUFFER_INTENSITY_THRESHOLDS[userData.deviceId].toString(), thresholds = Constants.BUFFER_INTENSITY_THRESHOLDS[userData.deviceId].toString(),
// interpretation = userData.classificationResult, interpretation = userData.classificationResult,
// testId = userData._id, testId = userData._id,
// testTime = userData.testTime, testTime = userData.testTime,
// collectionTime = "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, expiryTime = "2024-02-08 16:33:56",//userData.testTime,
// ) )
// ) )
//
// }
// if (!userData.localFlag) { }
// userData.localFlag = true
// hemoCubeViewModel.bulkAddResultTestToDb(userData) if (!userData.localFlag) {
// } userData.localFlag = true
// if (!userData.molbioFlag && isTokenAvailable && Constants.MOLBIO_INTEGRATION) { hemoCubeViewModel.bulkAddResultTestToDb(userData)
// userData.molbioFlag = true }
// hemoCubeViewModel.uploadResult(resultList) if (!userData.molbioFlag && isTokenAvailable && Constants.MOLBIO_INTEGRATION) {
// } userData.molbioFlag = true
// } hemoCubeViewModel.uploadResult(resultList)
// dialog.dismiss() }
// } }
dialog.dismiss()
}
hemoCubeViewModel.allKitTestData.observe(viewLifecycleOwner) { kitDataList -> hemoCubeViewModel.allKitTestData.observe(viewLifecycleOwner) { kitDataList ->
kitDataList.forEach { userData -> kitDataList.forEach { userData ->
@@ -997,28 +863,61 @@ class HomeFragment : Fragment() {
} }
dialog.dismiss() dialog.dismiss()
} }
}
private fun downloadLocalDBData(dialog: DialogInterface) {
hemoCubeViewModel.allUserData.observe(viewLifecycleOwner) { userDataList -> hemoCubeViewModel.allUserData.observe(viewLifecycleOwner) { userDataList ->
val downloadList = mutableListOf<HemoCubeTestData>() val resultList = MolbioV2ResultRequest(mutableListOf(MolbioV2Result()))
userDataList.forEach { userData -> userDataList.forEach { userData ->
if (!userData.isCSVCreated) { if (!userData.molbioFlag && isTokenAvailable) {
downloadList.add(userData) // Add the userData to downloadList 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 (downloadList.isNotEmpty()) { if (!userData.localFlag) {
// Call ViewModel function to create CSV with filtered data userData.localFlag = true
hemoCubeViewModel.createCSV(downloadList, requireContext()) hemoCubeViewModel.bulkAddResultTestToDb(userData)
Toast.makeText(requireContext(), "Done", Toast.LENGTH_SHORT).show()
} }
}
dialog.dismiss() dialog.dismiss()
} }
} }
// private fun downloadLocalDBData(dialog: DialogInterface) {
// hemoCubeViewModel.allUserData.observe(viewLifecycleOwner) { userDataList ->
// val downloadList = mutableListOf<HemoCubeTestData>()
//
// userDataList.forEach { userData ->
// if (!userData.isCSVCreated) {
// downloadList.add(userData) // Add the userData to downloadList
// }
// }
//
// if (downloadList.isNotEmpty()) {
// // Call ViewModel function to create CSV with filtered data
// hemoCubeViewModel.createCSV(downloadList, requireContext())
// Toast.makeText(requireContext(), "Done", Toast.LENGTH_SHORT).show()
// } else {
// Toast.makeText(requireContext(), "Failed", Toast.LENGTH_SHORT).show()
// }
//
// dialog.dismiss()
// }
// }
private fun deleteIncompleteRegistrations(userDataList: List<UserData>) { private fun deleteIncompleteRegistrations(userDataList: List<UserData>) {
userDataList.forEach { userData -> userDataList.forEach { userData ->
if (userData.csvPath.isEmpty()) { if (userData.csvPath.isEmpty()) {
@@ -1053,69 +952,68 @@ class HomeFragment : Fragment() {
} }
} }
// private fun showDownloadDialog(context: Context) { private fun showDownloadDialog(context: Context) {
// val builder = AlertDialog.Builder(context) val builder = AlertDialog.Builder(context)
// builder.setTitle(R.string.download_db_registration_title) builder.setTitle(R.string.download_db_registration_title)
// builder.setMessage(R.string.download_db_registration_message) builder.setMessage(R.string.download_db_registration_message)
//
// builder.setPositiveButton(R.string.downloadcsv) { dialog, _ ->
// downloadLocalDBData(dialog)
// }
//
// builder.setNegativeButton(R.string.cancel) { dialog, _ ->
// dialog.dismiss()
// }
//
// val dialog = builder.create()
// dialog.show()
// }
// private fun downloadLocalDBData(dialog: DialogInterface) { builder.setPositiveButton(R.string.downloadcsv) { dialog, _ ->
// var csvDownloaded = false downloadLocalDBData(dialog)
// hemoCubeViewModel.allUserData.observe(viewLifecycleOwner) { userDataList -> }
// try {
// if (!csvDownloaded) { builder.setNegativeButton(R.string.cancel) { dialog, _ ->
// val downloadList = mutableListOf<HemoCubeTestData>() dialog.dismiss()
// }
// userDataList.forEach { userData ->
// if (userData.testStatus == true) { val dialog = builder.create()
//// if (!userData.isCSVCreated) { dialog.show()
// downloadList.add(userData) // Add the userData to downloadList }
// }
//// } private fun downloadLocalDBData(dialog: DialogInterface) {
// } var csvDownloaded = false
// hemoCubeViewModel.allUserData.observe(viewLifecycleOwner) { userDataList ->
// if (downloadList.isNotEmpty()) { try {
// // Call ViewModel function to create CSV with filtered data if (!csvDownloaded) {
// hemoCubeViewModel.createCSV(downloadList, requireContext()) val downloadList = mutableListOf<HemoCubeTestData>()
// csvDownloaded = true
// Toast.makeText( userDataList.forEach { userData ->
// requireContext(), if (userData.testStatus == true) {
// "CSV file downloaded successfully", // if (!userData.isCSVCreated) {
// Toast.LENGTH_SHORT downloadList.add(userData) // Add the userData to downloadList
// ).show() }
// } else {
// Toast.makeText(
// requireContext(),
// "No data to download",
// Toast.LENGTH_SHORT
// )
// .show()
// }
// }
//
// } catch (e: Exception) {
// e.printStackTrace()
// Toast.makeText(requireContext(), "Error downloading CSV file", Toast.LENGTH_SHORT)
// .show()
// } finally {
// dialog.dismiss()
// }
// }
// } // }
}
if (downloadList.isNotEmpty()) {
// Call ViewModel function to create CSV with filtered data
hemoCubeViewModel.createCSV(downloadList, requireContext())
csvDownloaded = true
Toast.makeText(
requireContext(),
"CSV file downloaded successfully",
Toast.LENGTH_SHORT
).show()
} else {
Toast.makeText(
requireContext(),
"No data to download",
Toast.LENGTH_SHORT
)
.show()
}
}
} catch (e: Exception) {
e.printStackTrace()
Toast.makeText(requireContext(), "Error downloading CSV file", Toast.LENGTH_SHORT)
.show()
} finally {
dialog.dismiss()
}
}
}
private fun getDeviceId() { private fun getDeviceId() {
Log.d("HomeFragmentUSb","getDeviceId")
val handler = activity as? DeviceCommunicationHandler val handler = activity as? DeviceCommunicationHandler
handler?.sendAndListenToDevice( handler?.sendAndListenToDevice(
HemoCubeCommands.DEVICE_CONFIGURATION_COMMAND, HemoCubeCommands.DEVICE_CONFIGURATION_COMMAND,
@@ -1123,9 +1021,9 @@ class HomeFragment : Fragment() {
override fun onUsbRead(data: ByteArray?) { override fun onUsbRead(data: ByteArray?) {
data?.let { data?.let {
val receivedData = String(it, Charset.forName("UTF-8")) val receivedData = String(it, Charset.forName("UTF-8"))
Log.d("HomeFragment","USB data"+receivedData)
// Assuming the device ID is the full content of the received data. Adjust if needed. // Assuming the device ID is the full content of the received data. Adjust if needed.
deviceId = extractDeviceId(receivedData) // Implement this method based on your data format. deviceId =
extractDeviceId(receivedData) // Implement this method based on your data format.
if (deviceId.isNotEmpty()) { if (deviceId.isNotEmpty()) {
// Store the deviceId in SharedPreferences // Store the deviceId in SharedPreferences
with(sharedPreference.edit()) { with(sharedPreference.edit()) {
@@ -1142,7 +1040,6 @@ class HomeFragment : Fragment() {
override fun onUsbError(e: Exception?) { override fun onUsbError(e: Exception?) {
// Handle USB communication error // Handle USB communication error
Log.d("HomeFragment","USB read error"+e.toString())
} }
}) })
@@ -1158,8 +1055,8 @@ class HomeFragment : Fragment() {
private fun checkForUpdate() { private fun checkForUpdate() {
try { try {
val db = Firebase.firestore val db = Firebase.firestore
//val deviceId = deviceId
val deviceId="HHH-AAA-ZZZ"
val deviceRef = db.collection("deviceUpdate").document(Constants.DOCUMENT_ID_FOR_UPDATE) val deviceRef = db.collection("deviceUpdate").document(Constants.DOCUMENT_ID_FOR_UPDATE)
deviceRef.get().addOnSuccessListener { documentSnapshot -> deviceRef.get().addOnSuccessListener { documentSnapshot ->
@@ -1174,7 +1071,7 @@ class HomeFragment : Fragment() {
val deviceUpdateAvailableGlobal= deviceData.deviceUpdateAvailable val deviceUpdateAvailableGlobal= deviceData.deviceUpdateAvailable
val updatePathGlobal= deviceData.updatePath val updatePathGlobal= deviceData.updatePath
// if(deviceUpdateAvailableGlobal){
db.collection("devices").whereEqualTo("deviceId", deviceId).get().addOnSuccessListener { documentSnapshotNew -> db.collection("devices").whereEqualTo("deviceId", deviceId).get().addOnSuccessListener { documentSnapshotNew ->
if (documentSnapshotNew.documents.isNotEmpty()) { if (documentSnapshotNew.documents.isNotEmpty()) {
documentSnapshotNew.documents.forEach{ documentSnapshotNew.documents.forEach{
@@ -1198,24 +1095,14 @@ class HomeFragment : Fragment() {
Log.d("HomeFragmentUpdate","Device update not available") Log.d("HomeFragmentUpdate","Device update not available")
} }
}else{ }else{
if(deviceUpdateAvailableGlobal) {
if(!globalUpdateDone){ if(!globalUpdateDone){
val update = val update = db.collection("devices").document(it.id).update("globalUpdateDone",true)
db.collection("devices").document(it.id)
.update("globalUpdateDone", true)
update.addOnSuccessListener { update.addOnSuccessListener {
Log.d( Log.d("HomeFragmentUpdate","Device global update done")
"HomeFragmentUpdate",
"Device global update done"
)
initiateUpdate(updatePathGlobal) initiateUpdate(updatePathGlobal)
}.addOnFailureListener{ }.addOnFailureListener{
Log.e( Log.e("fetchDeviceUpdate", "update fail.")
"fetchDeviceUpdate",
"update fail."
)
}
} }
} }
} }
@@ -1237,7 +1124,8 @@ class HomeFragment : Fragment() {
"fetchDeviceCredentials", "fetchDeviceCredentials",
"deviceVersion: $deviceVersion, Password: $deviceUpdateAvailableGlobal, updatePath: $updatePathGlobal" "deviceVersion: $deviceVersion, Password: $deviceUpdateAvailableGlobal, updatePath: $updatePathGlobal"
) )
// ?: Log.e("fetchDeviceUpdate", "Failed to parse device data.")
// } ?: Log.e("fetchDeviceUpdate", "Failed to parse device data.")
} else { } else {
Log.e("fetchDeviceUpdate", "Document does not exist.") Log.e("fetchDeviceUpdate", "Document does not exist.")
} }
@@ -1270,7 +1158,7 @@ class HomeFragment : Fragment() {
val filter = IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE) val filter = IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
isRegistered = true isRegistered = true
requireActivity().registerReceiver(downloadReceiver, filter, RECEIVER_EXPORTED) requireActivity().registerReceiver(downloadReceiver, filter, Context.RECEIVER_EXPORTED)
} }
} }
private fun extractApkUrl(responseBody: ResponseBody): String { private fun extractApkUrl(responseBody: ResponseBody): String {
@@ -1316,15 +1204,15 @@ class HomeFragment : Fragment() {
} }
override fun onDestroy() { override fun onDestroy() {
if(isRegistered) {
try { try {
if (isRegistered){
requireActivity().unregisterReceiver(downloadReceiver) requireActivity().unregisterReceiver(downloadReceiver)
} catch (e: Exception) {
Log.d("HomeFragment", e.toString())
} }
}catch (e: IllegalArgumentException){
Log.e("HOmeFragment",e.toString())
} }
super.onDestroy() super.onDestroy()
} }
} }

View File

@@ -21,12 +21,12 @@ import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.core.view.get import androidx.core.view.get
import com.example.hpostesting.data.constant.DataHolder import com.example.hpostesting.data.DataHolder
import com.example.hpostesting.data.api.DeviceCommunicationHandler
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.constant.LanguageManager import com.example.hpostesting.data.constant.LanguageManager
import com.example.hpostesting.presentation.utils.DeviceCommunicationHandler import com.example.hpostesting.presentation.UsbServiceListener
import com.example.hpostesting.presentation.utils.UsbServiceListener
import com.example.hpostesting.presentation.testRight.UsbService import com.example.hpostesting.presentation.testRight.UsbService
import com.hoho.android.usbserial.driver.UsbSerialDriver import com.hoho.android.usbserial.driver.UsbSerialDriver
import com.hoho.android.usbserial.driver.UsbSerialProber import com.hoho.android.usbserial.driver.UsbSerialProber

View File

@@ -12,7 +12,7 @@ import androidx.fragment.app.activityViewModels
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
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.presentation.utils.UsbServiceListener import com.example.hpostesting.presentation.UsbServiceListener
import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel
import com.google.firebase.crashlytics.ktx.crashlytics import com.google.firebase.crashlytics.ktx.crashlytics
import com.google.firebase.ktx.Firebase import com.google.firebase.ktx.Firebase

View File

@@ -20,12 +20,12 @@ import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.core.view.get import androidx.core.view.get
import com.example.hpostesting.data.constant.DataHolder import com.example.hpostesting.data.DataHolder
import com.example.hpostesting.data.api.DeviceCommunicationHandler
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.constant.LanguageManager import com.example.hpostesting.data.constant.LanguageManager
import com.example.hpostesting.presentation.utils.DeviceCommunicationHandler import com.example.hpostesting.presentation.UsbServiceListener
import com.example.hpostesting.presentation.utils.UsbServiceListener
import com.example.hpostesting.presentation.testRight.UsbService import com.example.hpostesting.presentation.testRight.UsbService
import com.hoho.android.usbserial.driver.UsbSerialDriver import com.hoho.android.usbserial.driver.UsbSerialDriver
import com.hoho.android.usbserial.driver.UsbSerialProber import com.hoho.android.usbserial.driver.UsbSerialProber

View File

@@ -12,12 +12,12 @@ import android.widget.Toast
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels import androidx.fragment.app.activityViewModels
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import com.example.hpostesting.util.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.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.utils.UsbServiceListener import com.example.hpostesting.presentation.UsbServiceListener
import com.example.hpostesting.presentation.dashboard.DashboardActivity import com.example.hpostesting.presentation.dashboard.DashboardActivity
import com.google.firebase.crashlytics.ktx.crashlytics import com.google.firebase.crashlytics.ktx.crashlytics
import com.google.firebase.ktx.Firebase import com.google.firebase.ktx.Firebase
@@ -116,10 +116,7 @@ class DeviceProvisionFragment : Fragment() {
password = response.data.data?.credentials?.password.toString(), password = response.data.data?.credentials?.password.toString(),
deviceProvisionResponse = response.data.data.toString(), deviceProvisionResponse = response.data.data.toString(),
natsToken = response.data.data?.device?.deviceUser?.natsToken.toString(), natsToken = response.data.data?.device?.deviceUser?.natsToken.toString(),
natsTokenExpiry = response.data.data?.device?.deviceUser?.natsTokenExpiry.toString(), natsTokenExpiry = response.data.data?.device?.deviceUser?.natsTokenExpiry.toString()
globalUpdateIgnore = false,
globalUpdateDone = false,
deviceUpdateAvailable = false
) )
) )
// viewModel.addDeviceId(DeviceData(deviceId = sharedPreferences.getString(Constants.DEVICE_ID, "").toString())) // viewModel.addDeviceId(DeviceData(deviceId = sharedPreferences.getString(Constants.DEVICE_ID, "").toString()))

View File

@@ -3,7 +3,7 @@ package com.example.hpostesting.presentation.deviceprovision
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import com.example.hpostesting.util.Result import com.example.hpostesting.data.Result
import com.example.hpostesting.data.model.Response import com.example.hpostesting.data.model.Response
import com.example.hpostesting.data.model.deviceprovision.DeviceProvisionRequest import com.example.hpostesting.data.model.deviceprovision.DeviceProvisionRequest
import com.example.hpostesting.data.model.deviceprovision.DeviceProvisionResponse import com.example.hpostesting.data.model.deviceprovision.DeviceProvisionResponse

View File

@@ -20,7 +20,7 @@ import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.core.view.get import androidx.core.view.get
import com.example.hpostesting.data.constant.DataHolder import com.example.hpostesting.data.DataHolder
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.presentation.testRight.UsbService import com.example.hpostesting.presentation.testRight.UsbService

View File

@@ -13,15 +13,15 @@ import android.widget.Toast
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels import androidx.fragment.app.activityViewModels
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import com.example.hpostesting.util.Result import com.example.hpostesting.data.Result
import com.example.hpostesting.util.Result.Success import com.example.hpostesting.data.Result.Success
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.model.devicediagnostics.AdditionalDetails import com.example.hpostesting.data.model.devicediagnostics.AdditionalDetails
import com.example.hpostesting.data.model.devicediagnostics.DeviceDiagnosticsRequest import com.example.hpostesting.data.model.devicediagnostics.DeviceDiagnosticsRequest
import com.example.hpostesting.data.model.diagnostics.DiagnosticsData import com.example.hpostesting.data.model.diagnostics.DiagnosticsData
import com.example.hpostesting.data.model.patient.DeviceData import com.example.hpostesting.data.model.patient.DeviceData
import com.example.hpostesting.presentation.utils.UsbServiceListener import com.example.hpostesting.presentation.UsbServiceListener
import com.google.firebase.crashlytics.ktx.crashlytics import com.google.firebase.crashlytics.ktx.crashlytics
import com.google.firebase.ktx.Firebase import com.google.firebase.ktx.Firebase
import `in`.sminnovations.hpostesting.databinding.FragmentDiagnosticsBinding import `in`.sminnovations.hpostesting.databinding.FragmentDiagnosticsBinding

View File

@@ -3,7 +3,7 @@ package com.example.hpostesting.presentation.diagnostics
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import com.example.hpostesting.util.Result import com.example.hpostesting.data.Result
import com.example.hpostesting.data.model.Response import com.example.hpostesting.data.model.Response
import com.example.hpostesting.data.model.devicediagnostics.DeviceDiagnosticsRequest import com.example.hpostesting.data.model.devicediagnostics.DeviceDiagnosticsRequest
import com.example.hpostesting.data.model.devicediagnostics.DeviceDiagnosticsResponse import com.example.hpostesting.data.model.devicediagnostics.DeviceDiagnosticsResponse
@@ -25,7 +25,7 @@ class DiagnosticsViewModel @Inject constructor(
val deviceData = MutableLiveData<DeviceData?>() val deviceData = MutableLiveData<DeviceData?>()
val fireBaseUpload = MutableLiveData<String>() val fireBaseUpload = MutableLiveData<String>()
val deviceDiagnosticsResponse = MutableLiveData<Result<DeviceDiagnosticsResponse>>() val deviceDiagnosticsResponse = MutableLiveData<com.example.hpostesting.data.Result<DeviceDiagnosticsResponse>>()
// private val batteryStatus: Intent? = // private val batteryStatus: Intent? =
// IntentFilter(Intent.ACTION_BATTERY_CHANGED).let { ifilter -> // IntentFilter(Intent.ACTION_BATTERY_CHANGED).let { ifilter ->
// context.registerReceiver(null, ifilter) // context.registerReceiver(null, ifilter)

View File

@@ -10,7 +10,7 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels import androidx.fragment.app.activityViewModels
import com.example.hpostesting.data.constant.DataHolder import com.example.hpostesting.data.DataHolder
import com.example.hpostesting.data.model.patient.toHemoCubeTestData import com.example.hpostesting.data.model.patient.toHemoCubeTestData
import `in`.sminnovations.hpostesting.databinding.FragmentDigitalCardBinding import `in`.sminnovations.hpostesting.databinding.FragmentDigitalCardBinding
import java.text.SimpleDateFormat import java.text.SimpleDateFormat

View File

@@ -5,7 +5,6 @@ import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.SharedPreferences import android.content.SharedPreferences
import android.os.Bundle import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
@@ -14,15 +13,15 @@ import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels import androidx.fragment.app.activityViewModels
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import com.example.hpostesting.data.constant.DataHolder import com.example.hpostesting.data.DataHolder
import com.example.hpostesting.util.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.constant.TestStatus import com.example.hpostesting.data.constant.TestStatus
import com.example.hpostesting.data.model.TestState import com.example.hpostesting.data.model.TestState
import com.example.hpostesting.data.model.patient.DeviceData import com.example.hpostesting.data.model.patient.DeviceData
import com.example.hpostesting.data.model.patient.toHemoCubeTestData import com.example.hpostesting.data.model.patient.toHemoCubeTestData
import com.example.hpostesting.presentation.utils.UsbServiceListener import com.example.hpostesting.presentation.UsbServiceListener
import com.example.hpostesting.presentation.dashboard.DashboardActivity import com.example.hpostesting.presentation.dashboard.DashboardActivity
import com.example.hpostesting.presentation.utils.MyDialogListener import com.example.hpostesting.presentation.utils.MyDialogListener
import com.example.hpostesting.presentation.utils.UIUtils import com.example.hpostesting.presentation.utils.UIUtils
@@ -150,7 +149,6 @@ class HemoCubeFragment : Fragment() {
hemoCubeViewModel.fireBaseUpload.observe(viewLifecycleOwner) { result -> hemoCubeViewModel.fireBaseUpload.observe(viewLifecycleOwner) { result ->
if (result == "Success") { if (result == "Success") {
uploadedToCloud = true uploadedToCloud = true
var accessToken = sharedPreferences.getString(Constants.ACCESS_TOKEN, "").toString()
showToast(R.string.test_upload) showToast(R.string.test_upload)
if (Constants.MOLBIO_INTEGRATION) { if (Constants.MOLBIO_INTEGRATION) {
hemoCubeViewModel.resultUpload.observe(viewLifecycleOwner) { hemoCubeViewModel.resultUpload.observe(viewLifecycleOwner) {
@@ -163,8 +161,6 @@ class HemoCubeFragment : Fragment() {
) )
} }
handleReadingFinish() handleReadingFinish()
hemoCubeViewModel.uploadLogs()
hemoCubeViewModel.downloadClientCertificate()
} }
is Result.Error -> { is Result.Error -> {
@@ -173,11 +169,10 @@ class HemoCubeFragment : Fragment() {
it.exception.let { message -> it.exception.let { message ->
Toast.makeText( Toast.makeText(
activity, activity,
"$message", "An error occurred: $message",
Toast.LENGTH_LONG Toast.LENGTH_LONG
) )
.show() .show()
Log.d("resultuploadfail1", message.toString())
} }
handleReadingFinish() handleReadingFinish()
} }

View File

@@ -12,10 +12,10 @@ import androidx.lifecycle.viewModelScope
import androidx.work.ExistingPeriodicWorkPolicy import androidx.work.ExistingPeriodicWorkPolicy
import androidx.work.PeriodicWorkRequestBuilder import androidx.work.PeriodicWorkRequestBuilder
import androidx.work.WorkManager import androidx.work.WorkManager
import com.example.hpostesting.util.CsvWriter import com.example.hpostesting.data.CsvWriter
import com.example.hpostesting.data.constant.DataHolder import com.example.hpostesting.data.DataHolder
import com.example.hpostesting.util.NetworkStatusLiveData import com.example.hpostesting.data.NetworkStatusLiveData
import com.example.hpostesting.util.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.dao.HemoCubeBufferDao import com.example.hpostesting.data.dao.HemoCubeBufferDao
import com.example.hpostesting.data.dao.HemoCubeDao import com.example.hpostesting.data.dao.HemoCubeDao
@@ -88,8 +88,7 @@ class HemoCubeViewModel @Inject constructor(
private val _networkStatusLiveData = NetworkStatusLiveData(context) private val _networkStatusLiveData = NetworkStatusLiveData(context)
val allUserData = hemoCubeDao.getAll() val allUserData = hemoCubeDao.getAll()
val allLocalData = hemoCubeDao.getAll() val allPendingUserToUpload = MutableLiveData<List<HemoCubeTestData>>()
val allPendingUserToUpload = hemoCubeDao.getPendingUser()
val allKitTestData = hemoCubeBufferDao.getAll() val allKitTestData = hemoCubeBufferDao.getAll()
val deviceData = MutableLiveData<DeviceData?>() val deviceData = MutableLiveData<DeviceData?>()
@@ -144,14 +143,6 @@ class HemoCubeViewModel @Inject constructor(
} }
} }
fun uploadResultfornew(molbioV2ResultRequest: MolbioV2ResultRequest) = viewModelScope.launch {
resultUpload.postValue(Result.Loading())
repository.uploadResults(molbioV2ResultRequest).let {
resultUpload.postValue(it)
}
}
fun checkUpdate(checkUpdateRequest: CheckUpdateRequest) = viewModelScope.launch { fun checkUpdate(checkUpdateRequest: CheckUpdateRequest) = viewModelScope.launch {
checkUpdate.postValue(Result.Loading()) checkUpdate.postValue(Result.Loading())
repository.checkUpdate(checkUpdateRequest).let { repository.checkUpdate(checkUpdateRequest).let {
@@ -196,9 +187,9 @@ class HemoCubeViewModel @Inject constructor(
} }
} }
} }
// fun getPendingUser() = viewModelScope.launch { fun uploadPendingUser() = viewModelScope.launch {
// allPendingUserToUpload.postValue(hemoCubeDao.getPendingUser(true)) allPendingUserToUpload.postValue(hemoCubeDao.getPendingUser(false))
// } }
fun uploadHemoCubeResultToDatabaseForBufferCheck( fun uploadHemoCubeResultToDatabaseForBufferCheck(
isOnline: Boolean, isOnline: Boolean,
@@ -334,24 +325,20 @@ class HemoCubeViewModel @Inject constructor(
fireBaseUpload.postValue("Success") fireBaseUpload.postValue("Success")
testDetails.localFlag = true testDetails.localFlag = true
if (Constants.MOLBIO_INTEGRATION) { if (Constants.MOLBIO_INTEGRATION) {
// Sanitize testDetails before using it in the API call
val sanitizedTestDetails = sanitizeDoubleValues(testDetails)
// Now, use sanitizedTestDetails for the API call
uploadResult( uploadResult(
MolbioV2ResultRequest( MolbioV2ResultRequest(
mutableListOf( mutableListOf(
MolbioV2Result( MolbioV2Result(
rawData = sanitizedTestDetails, rawData = testDetails,
analysisId = sanitizedTestDetails._id, analysisId = testDetails._id,
analysisDate = sanitizedTestDetails.testTime, analysisDate = testDetails.testTime,
analysisStatus = sanitizedTestDetails.classificationResult, analysisStatus = testDetails.classificationResult,
thresholds = Constants.BUFFER_INTENSITY_THRESHOLDS[sanitizedTestDetails.deviceId]?.toString(), thresholds = Constants.BUFFER_INTENSITY_THRESHOLDS[testDetails.deviceId].toString(),
interpretation = sanitizedTestDetails.classificationResult, interpretation = testDetails.classificationResult,
testId = sanitizedTestDetails._id, testId = testDetails._id,
testTime = sanitizedTestDetails.testTime, testTime = testDetails.testTime,
collectionTime = sanitizedTestDetails.testTime, collectionTime = testDetails.testTime,
expiryTime = sanitizedTestDetails.testTime, expiryTime = testDetails.testTime,
) )
) )
) )
@@ -393,19 +380,6 @@ class HemoCubeViewModel @Inject constructor(
} }
} }
fun sanitizeDoubleValues(hemoCubeTestData: HemoCubeTestData): HemoCubeTestData {
hemoCubeTestData::class.java.declaredFields.forEach { field ->
if (field.type == Double::class.javaObjectType || field.type == Double::class.javaPrimitiveType) {
field.isAccessible = true
val value = field.get(hemoCubeTestData) as Double?
if (value != null && (value.isInfinite() || value.isNaN())) {
field.set(hemoCubeTestData, 0.0) // Replace with a suitable default value
}
}
}
return hemoCubeTestData
}
private fun updateLocalFlag(userId: String) = viewModelScope.launch { private fun updateLocalFlag(userId: String) = viewModelScope.launch {
hemoCubeDao.updateFieldById(id = userId, true) hemoCubeDao.updateFieldById(id = userId, true)
} }

View File

@@ -11,18 +11,16 @@ import android.content.ServiceConnection
import android.hardware.usb.UsbDevice import android.hardware.usb.UsbDevice
import android.hardware.usb.UsbDeviceConnection import android.hardware.usb.UsbDeviceConnection
import android.hardware.usb.UsbManager import android.hardware.usb.UsbManager
import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.os.IBinder import android.os.IBinder
import android.util.Log import android.util.Log
import android.view.Menu import android.view.Menu
import android.widget.Toast import android.widget.Toast
import androidx.activity.viewModels import androidx.activity.viewModels
import androidx.annotation.RequiresApi
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.core.view.get import androidx.core.view.get
import com.example.hpostesting.data.constant.DataHolder import com.example.hpostesting.data.DataHolder
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.presentation.testRight.UsbService import com.example.hpostesting.presentation.testRight.UsbService
@@ -45,7 +43,6 @@ open class HemocubeActivity : AppCompatActivity() {
private val TAG = "HemoCube" private val TAG = "HemoCube"
private val broadcastReceiver = object : BroadcastReceiver() { private val broadcastReceiver = object : BroadcastReceiver() {
@RequiresApi(Build.VERSION_CODES.O)
override fun onReceive(context: Context, intent: Intent) { override fun onReceive(context: Context, intent: Intent) {
synchronized(this) { synchronized(this) {
@@ -85,7 +82,6 @@ open class HemocubeActivity : AppCompatActivity() {
super.attachBaseContext(newBase) super.attachBaseContext(newBase)
} }
@RequiresApi(Build.VERSION_CODES.O)
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
binding = ActivityHemocubeBinding.inflate(layoutInflater) binding = ActivityHemocubeBinding.inflate(layoutInflater)
@@ -110,7 +106,6 @@ open class HemocubeActivity : AppCompatActivity() {
} }
} }
@RequiresApi(Build.VERSION_CODES.O)
open fun connectUsb(permissionGranted: Boolean) { open fun connectUsb(permissionGranted: Boolean) {
Log.d(TAG, "connectUsb() called, permission variable = $permissionGranted") Log.d(TAG, "connectUsb() called, permission variable = $permissionGranted")
val manager = getSystemService(Context.USB_SERVICE) as UsbManager val manager = getSystemService(Context.USB_SERVICE) as UsbManager
@@ -130,7 +125,6 @@ open class HemocubeActivity : AppCompatActivity() {
} }
} }
@RequiresApi(Build.VERSION_CODES.O)
@SuppressLint("MutableImplicitPendingIntent") @SuppressLint("MutableImplicitPendingIntent")
private fun requestUserPermission(manager: UsbManager, device: UsbDevice) { private fun requestUserPermission(manager: UsbManager, device: UsbDevice) {
val mPendingIntent: PendingIntent val mPendingIntent: PendingIntent
@@ -148,21 +142,15 @@ open class HemocubeActivity : AppCompatActivity() {
} }
val filter = IntentFilter(Constants.HEMOCUBE_USB_PERMISSION) val filter = IntentFilter(Constants.HEMOCUBE_USB_PERMISSION)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
registerReceiver(broadcastReceiver, filter, RECEIVER_EXPORTED)
}else{
registerReceiver(broadcastReceiver, filter) registerReceiver(broadcastReceiver, filter)
}
manager.requestPermission(device, mPendingIntent) manager.requestPermission(device, mPendingIntent)
} }
fun setupService() { fun setupService() {
val intent = Intent(this, UsbService::class.java) val intent = Intent(this, UsbService::class.java)
bindService(intent, connection, Context.BIND_AUTO_CREATE) bindService(intent, connection, Context.BIND_AUTO_CREATE)
} }
@RequiresApi(Build.VERSION_CODES.O)
open fun reconnectDevice() { open fun reconnectDevice() {
mService.disconnect() mService.disconnect()
unbindService(connection) unbindService(connection)

View File

@@ -21,7 +21,7 @@ import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.core.view.get import androidx.core.view.get
import com.example.hpostesting.data.constant.DataHolder import com.example.hpostesting.data.DataHolder
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.presentation.testRight.UsbService import com.example.hpostesting.presentation.testRight.UsbService

View File

@@ -19,7 +19,7 @@ import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.core.view.get import androidx.core.view.get
import com.example.hpostesting.data.constant.DataHolder import com.example.hpostesting.data.DataHolder
import com.example.hpostesting.data.constant.Constants import com.example.hpostesting.data.constant.Constants
import com.hoho.android.usbserial.driver.UsbSerialDriver import com.hoho.android.usbserial.driver.UsbSerialDriver
import com.hoho.android.usbserial.driver.UsbSerialProber import com.hoho.android.usbserial.driver.UsbSerialProber
@@ -132,7 +132,7 @@ class TestRightActivity : AppCompatActivity() {
this, this,
0, 0,
Intent(Constants.ACTION_USB_PERMISSION), Intent(Constants.ACTION_USB_PERMISSION),
PendingIntent.FLAG_IMMUTABLE PendingIntent.FLAG_MUTABLE
) )
} else { } else {
mPendingIntent = PendingIntent.getBroadcast( mPendingIntent = PendingIntent.getBroadcast(

View File

@@ -10,11 +10,11 @@ import android.view.ViewGroup
import android.widget.Toast import android.widget.Toast
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels import androidx.fragment.app.activityViewModels
import com.example.hpostesting.data.constant.DataHolder import com.example.hpostesting.data.DataHolder
import com.example.hpostesting.data.constant.Constants import com.example.hpostesting.data.constant.Constants
import com.example.hpostesting.data.constant.TestRightCommands import com.example.hpostesting.data.constant.TestRightCommands
import com.example.hpostesting.data.model.ErrorMessage import com.example.hpostesting.data.model.ErrorMessage
import com.example.hpostesting.presentation.utils.UsbServiceListener import com.example.hpostesting.presentation.UsbServiceListener
import com.example.hpostesting.presentation.utils.MyDialogListener import com.example.hpostesting.presentation.utils.MyDialogListener
import com.example.hpostesting.presentation.utils.UIUtils import com.example.hpostesting.presentation.utils.UIUtils
import dagger.hilt.android.AndroidEntryPoint import dagger.hilt.android.AndroidEntryPoint

View File

@@ -10,13 +10,13 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels import androidx.fragment.app.activityViewModels
import com.example.hpostesting.data.constant.DataHolder import com.example.hpostesting.data.DataHolder
import com.example.hpostesting.data.constant.Constants import com.example.hpostesting.data.constant.Constants
import com.example.hpostesting.data.constant.TestRightCommands import com.example.hpostesting.data.constant.TestRightCommands
import com.example.hpostesting.data.model.ErrorMessage import com.example.hpostesting.data.model.ErrorMessage
import com.example.hpostesting.data.model.test.TestType import com.example.hpostesting.data.model.test.TestType
import com.example.hpostesting.presentation.MainActivity import com.example.hpostesting.presentation.MainActivity
import com.example.hpostesting.presentation.utils.UsbServiceListener import com.example.hpostesting.presentation.UsbServiceListener
import com.example.hpostesting.presentation.utils.MyDialogListener import com.example.hpostesting.presentation.utils.MyDialogListener
import com.example.hpostesting.presentation.utils.UIUtils import com.example.hpostesting.presentation.utils.UIUtils
import dagger.hilt.android.AndroidEntryPoint import dagger.hilt.android.AndroidEntryPoint

View File

@@ -11,7 +11,7 @@ import android.view.ViewGroup
import android.widget.Toast import android.widget.Toast
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels import androidx.fragment.app.activityViewModels
import com.example.hpostesting.data.constant.DataHolder import com.example.hpostesting.data.DataHolder
import com.example.hpostesting.data.constant.Constants import com.example.hpostesting.data.constant.Constants
import com.example.hpostesting.data.model.test.TestRightResultType import com.example.hpostesting.data.model.test.TestRightResultType
import com.example.hpostesting.data.model.test.TestType import com.example.hpostesting.data.model.test.TestType

View File

@@ -5,8 +5,8 @@ import android.net.Uri
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import com.example.hpostesting.data.constant.DataHolder import com.example.hpostesting.data.DataHolder
import com.example.hpostesting.util.NetworkStatusLiveData import com.example.hpostesting.data.NetworkStatusLiveData
import com.example.hpostesting.data.constant.Constants import com.example.hpostesting.data.constant.Constants
import com.example.hpostesting.data.dao.UserDao import com.example.hpostesting.data.dao.UserDao
import com.example.hpostesting.data.model.CalculationVariableForTest import com.example.hpostesting.data.model.CalculationVariableForTest

View File

@@ -9,7 +9,7 @@ import android.util.Log
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.constant.TestRightCommands import com.example.hpostesting.data.constant.TestRightCommands
import com.example.hpostesting.presentation.utils.UsbServiceListener import com.example.hpostesting.presentation.UsbServiceListener
import com.hoho.android.usbserial.driver.UsbSerialDriver import com.hoho.android.usbserial.driver.UsbSerialDriver
import com.hoho.android.usbserial.driver.UsbSerialPort import com.hoho.android.usbserial.driver.UsbSerialPort
import com.hoho.android.usbserial.util.SerialInputOutputManager import com.hoho.android.usbserial.util.SerialInputOutputManager

View File

@@ -20,7 +20,7 @@ import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.core.view.get import androidx.core.view.get
import com.example.hpostesting.data.constant.DataHolder import com.example.hpostesting.data.DataHolder
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.presentation.hemocube.HemoCubeFragment import com.example.hpostesting.presentation.hemocube.HemoCubeFragment

View File

@@ -4,7 +4,6 @@ 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
import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
@@ -14,15 +13,15 @@ import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels import androidx.fragment.app.activityViewModels
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import com.example.hpostesting.data.constant.DataHolder import com.example.hpostesting.data.DataHolder
import com.example.hpostesting.util.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.constant.TestStatus import com.example.hpostesting.data.constant.TestStatus
import com.example.hpostesting.data.model.TestState import com.example.hpostesting.data.model.TestState
import com.example.hpostesting.data.model.patient.DeviceData import com.example.hpostesting.data.model.patient.DeviceData
import com.example.hpostesting.data.model.patient.toHemoCubeTestData import com.example.hpostesting.data.model.patient.toHemoCubeTestData
import com.example.hpostesting.presentation.utils.UsbServiceListener import com.example.hpostesting.presentation.UsbServiceListener
import com.example.hpostesting.presentation.dashboard.DashboardActivity import com.example.hpostesting.presentation.dashboard.DashboardActivity
import com.example.hpostesting.presentation.hemocube.HemocubeActivity import com.example.hpostesting.presentation.hemocube.HemocubeActivity
import com.example.hpostesting.presentation.utils.MyDialogListener import com.example.hpostesting.presentation.utils.MyDialogListener
@@ -1156,8 +1155,6 @@ class TrueHemeFragment : Fragment() {
} }
private fun reconnect() { private fun reconnect() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
(activity as HemocubeActivity).reconnectDevice() (activity as HemocubeActivity).reconnectDevice()
} }
} }
}

View File

@@ -12,10 +12,10 @@ import androidx.lifecycle.viewModelScope
import androidx.work.ExistingPeriodicWorkPolicy import androidx.work.ExistingPeriodicWorkPolicy
import androidx.work.PeriodicWorkRequestBuilder import androidx.work.PeriodicWorkRequestBuilder
import androidx.work.WorkManager import androidx.work.WorkManager
import com.example.hpostesting.util.CsvWriter import com.example.hpostesting.data.CsvWriter
import com.example.hpostesting.data.constant.DataHolder import com.example.hpostesting.data.DataHolder
import com.example.hpostesting.util.NetworkStatusLiveData import com.example.hpostesting.data.NetworkStatusLiveData
import com.example.hpostesting.util.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.dao.HemoCubeBufferDao import com.example.hpostesting.data.dao.HemoCubeBufferDao
import com.example.hpostesting.data.dao.HemoCubeDao import com.example.hpostesting.data.dao.HemoCubeDao

View File

@@ -0,0 +1,11 @@
package com.example.hpostesting
import java.text.SimpleDateFormat
import java.util.Date
import java.util.Locale
fun main(){
val dateFormat = SimpleDateFormat("MM:HHddMMyyyy", Locale.getDefault())
val currentDate = Date()
print(dateFormat.format(currentDate))
}

View File

@@ -1,7 +0,0 @@
package com.example.hpostesting.util
interface PropertyProvider {
fun getProperty(key: String): String
}

View File

@@ -1,6 +1,7 @@
package com.example.hpostesting.util package com.example.hpostesting.util
import android.content.res.AssetManager import android.content.res.AssetManager
import com.example.hpostesting.data.api.PropertyProvider
import java.io.InputStream import java.io.InputStream
import java.util.Properties import java.util.Properties

View File

@@ -0,0 +1,9 @@
<?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="#EF0A0A" android:viewportHeight="24" android:tint="#FF1010" 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.

After

Width:  |  Height:  |  Size: 725 B

View File

@@ -0,0 +1,6 @@
<?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,7 +3,8 @@
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="2dp" /> android:width="1dp" />
</shape> </shape>

View File

@@ -0,0 +1,12 @@
<?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

@@ -0,0 +1,18 @@
<?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

@@ -0,0 +1,6 @@
<?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

@@ -1,5 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:autoMirrored="true" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
<path android:fillColor="@android:color/white" android:pathData="M19,3L5,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM14,17L7,17v-2h7v2zM17,13L7,13v-2h10v2zM17,9L7,9L7,7h10v2z"/>
</vector>

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="#FFFFFF" app:titleTextColor="@color/blue_text_color"
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,6 +19,7 @@
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="#FFFFFF" app:titleTextColor="@color/blue_text_color"
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,6 +32,7 @@
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" />
@@ -40,11 +41,12 @@
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" android:drawableLeft="@drawable/baseline_qr_code_scanner_24_x"
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" />
@@ -75,7 +77,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/gray" /> android:background="@color/red" />
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -83,7 +85,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/gray" /> android:background="@color/red" />
</RelativeLayout> </RelativeLayout>
@@ -96,6 +98,7 @@
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" />
@@ -121,13 +124,15 @@
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.button.MaterialButton <androidx.appcompat.widget.AppCompatButton
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="#FFFFFF" app:titleTextColor="@color/blue_text_color"
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="#FFFFFF" app:titleTextColor="@color/blue_text_color"
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

@@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
> tools:context=".presentation.dashboard.DashboardActivity">
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -14,19 +14,10 @@
<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="?attr/colorPrimary" android:background="@color/new_blue"
app:popupTheme="@style/Theme.HPOS.PopupOverlay" > app:popupTheme="@style/Theme.HPOS.PopupOverlay" />
<TextView
android:id="@+id/version_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="--"
android:textStyle="bold"
android:layout_gravity="end"
android:textSize="18sp"
android:layout_marginEnd="15dp"/>
</androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>

View File

@@ -1,39 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/titleText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:gravity="center"
android:text="Upload Pending List(Local data)"
android:layout_marginTop="5dp"
android:textSize="21sp"
android:textColor="@color/black"
/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_order_offline"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/titleText"
android:layout_alignParentStart="true"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/offline_user_list_view" />
<TextView
android:id="@+id/noDataText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="All up-to-date"
android:textSize="22sp"
android:textColor="@color/black"
/>
</RelativeLayout>

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" />
<Button <androidx.appcompat.widget.AppCompatButton
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,8 +80,9 @@
android:clickable="false" android:clickable="false"
android:gravity="center" android:gravity="center"
android:text="Continue" android:text="Continue"
android:textColor="@color/white" android:textColor="@color/red"
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,41 +47,48 @@
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="11sp" 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" />
<Button <androidx.appcompat.widget.AppCompatButton
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/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_subtitle4" /> app:layout_constraintTop_toBottomOf="@id/tv_subtitle4" />
<Button <androidx.appcompat.widget.AppCompatButton
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/white" android:textColor="@color/red"
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,38 +50,45 @@
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="11sp" 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" />
<Button <androidx.appcompat.widget.AppCompatButton
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/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_subtitle4" /> app:layout_constraintTop_toBottomOf="@id/tv_subtitle4" />
<Button <androidx.appcompat.widget.AppCompatButton
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/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/btn_submit" /> app:layout_constraintTop_toBottomOf="@id/btn_submit" />

View File

@@ -37,6 +37,8 @@
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"
@@ -70,8 +72,10 @@
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="16dp" android:layout_marginTop="36dp"
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"
@@ -104,8 +108,10 @@
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="16dp" android:layout_marginTop="36dp"
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"
@@ -138,8 +144,10 @@
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="16dp" android:layout_marginTop="36dp"
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"
@@ -174,7 +182,7 @@
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="36dp"
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" />
@@ -185,26 +193,30 @@
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="8dp" android:layout_marginTop="60dp"
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" />
<Button <androidx.appcompat.widget.AppCompatButton
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="10dp" android:layout_marginTop="60dp"
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/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_subtitle4" /> app:layout_constraintTop_toBottomOf="@id/tv_subtitle4" />

View File

@@ -13,6 +13,7 @@
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,6 +51,7 @@
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"
@@ -58,7 +59,7 @@
app:layout_constraintTop_toBottomOf="@id/tv_subtitle3" /> app:layout_constraintTop_toBottomOf="@id/tv_subtitle3" />
<Button <androidx.appcompat.widget.AppCompatButton
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"
@@ -66,8 +67,9 @@
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/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_subtitle4" /> app:layout_constraintTop_toBottomOf="@id/tv_subtitle4" />

View File

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

@@ -38,20 +38,10 @@
android:visibility="gone" android:visibility="gone"
android:padding="24dp"> android:padding="24dp">
<ImageView
android:id="@+id/btnLogout1"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginEnd="10dp"
android:src="@drawable/baseline_logout_24"
app:layout_constraintTop_toTopOf="@+id/internetNotAvailableCL"
app:layout_constraintEnd_toEndOf="parent"
/>
<TextView <TextView
android:id="@+id/tv_title_no_internet" android:id="@+id/tv_title_no_internet"
style="@style/title1" style="@style/title1"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center" android:gravity="center"
android:layout_marginTop="24dp" android:layout_marginTop="24dp"
@@ -135,35 +125,16 @@
<!-- app:layout_constraintBottom_toBottomOf="@+id/rv_order_offline"--> <!-- app:layout_constraintBottom_toBottomOf="@+id/rv_order_offline"-->
<!-- app:layout_constraintStart_toStartOf="parent" />--> <!-- app:layout_constraintStart_toStartOf="parent" />-->
<TextView
android:id="@+id/label1"
style="@style/title1_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/new_kit"
app:layout_constraintBottom_toTopOf="@+id/btnNewKitoffline"
app:layout_constraintEnd_toEndOf="parent" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/btnNewKitoffline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:backgroundTint="@color/primary"
android:contentDescription="@string/new_kit"
android:src="@drawable/ic_add"
app:elevation="1dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
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"
android:padding="24dp"> tools:layout_editor_absoluteX="162dp"
tools:layout_editor_absoluteY="-82dp">
<TextView <TextView
android:id="@+id/tv_title" android:id="@+id/tv_title"
@@ -184,6 +155,7 @@
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"
@@ -242,8 +214,9 @@
<RadioGroup <RadioGroup
android:id="@+id/radioGroup" android:id="@+id/radioGroup"
android:layout_width="0dp" android:layout_width="0dp"
android:orientation="horizontal"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone"
android:orientation="horizontal"
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">
@@ -286,46 +259,52 @@
<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.FloatingActionButton <com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
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:contentDescription="Capture measurements quickly" android:text="Quick Capture"
android:src="@drawable/flask" android:visibility="visible"
app:elevation="1dp" app:elevation="1dp"
app:layout_constraintBottom_toTopOf="@+id/label" app:icon="@drawable/flask"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintBottom_toTopOf="@+id/label"
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="wrap_content" android:layout_width="2dp"
android:layout_height="wrap_content" android:layout_height="6dp"
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.FloatingActionButton <com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
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,6 +38,7 @@
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" />
@@ -58,11 +59,12 @@
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" android:drawableLeft="@drawable/baseline_qr_code_scanner_24_x"
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" />
@@ -90,9 +92,9 @@
android:clickable="false" android:clickable="false"
android:gravity="center" android:gravity="center"
android:text="Refresh" android:text="Refresh"
android:visibility="visible"
android:textColor="@color/white" android:textColor="@color/white"
app:layout_constraintEnd_toEndOf="@id/btn_scan_now" android:visibility="visible"
app:layout_constraintEnd_toEndOf="parent"
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,6 +52,10 @@
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">
@@ -70,6 +74,10 @@
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"
@@ -84,12 +92,14 @@
android:maxLength="12" /> android:maxLength="12" />
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.button.MaterialButton <androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnLogin" android:id="@+id/btnLogin"
android:layout_width="wrap_content" android:layout_width="150dp"
android:layout_height="wrap_content" android:layout_height="match_parent"
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,6 +16,7 @@
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" />
@@ -25,11 +26,12 @@
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" android:drawableLeft="@drawable/baseline_qr_code_scanner_24_x"
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" />
@@ -60,7 +62,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/gray" /> android:background="@color/red" />
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -68,7 +70,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/gray" /> android:background="@color/red" />
</RelativeLayout> </RelativeLayout>
@@ -81,6 +83,7 @@
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" />
@@ -105,13 +108,15 @@
android:inputType="number" /> android:inputType="number" />
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.button.MaterialButton <androidx.appcompat.widget.AppCompatButton
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"
@@ -144,7 +149,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/gray" /> android:background="@color/red" />
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -152,7 +157,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/gray" /> android:background="@color/red" />
</RelativeLayout> </RelativeLayout>
@@ -164,6 +169,7 @@
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" />
@@ -177,6 +183,7 @@
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,15 +137,6 @@
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
@@ -168,6 +159,15 @@
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,6 +16,7 @@
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" />
@@ -24,11 +25,12 @@
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" android:drawableLeft="@drawable/baseline_qr_code_scanner_24_x"
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" />
@@ -59,7 +61,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/gray" /> android:background="@color/red" />
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -67,7 +69,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/gray" /> android:background="@color/red" />
</RelativeLayout> </RelativeLayout>
@@ -80,6 +82,7 @@
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" />
@@ -105,15 +108,17 @@
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.button.MaterialButton <androidx.appcompat.widget.AppCompatButton
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,14 +45,15 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_subtitle1" /> app:layout_constraintTop_toBottomOf="@id/tv_subtitle1" />
<Button <androidx.appcompat.widget.AppCompatButton
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:textColor="@color/white" android:background="@drawable/button_new"
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" />
<Button <androidx.appcompat.widget.AppCompatButton
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,7 +230,8 @@
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/white" android:background="@drawable/button_new"
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,34 +129,42 @@
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>
<com.google.android.material.button.MaterialButton <androidx.appcompat.widget.AppCompatButton
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/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"
@@ -164,7 +172,7 @@
<Button <androidx.appcompat.widget.AppCompatButton
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"
@@ -172,7 +180,8 @@
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:textColor="@color/white" 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

@@ -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/blue_app" android:background="@color/new_blue"
android:gravity="bottom" android:gravity="bottom"
android:orientation="vertical" android:orientation="vertical"
android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingLeft="@dimen/activity_horizontal_margin"
@@ -23,20 +23,24 @@
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:paddingTop="@dimen/nav_header_vertical_spacing" android:padding="6dp"
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:text="@string/nav_header_subtitle" /> android:layout_marginLeft="8sp"
android:text="@string/nav_header_subtitle"
android:textColor="@color/blue_text_color" />
</LinearLayout> </LinearLayout>

View File

@@ -24,6 +24,7 @@
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" />
@@ -82,15 +83,21 @@
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/teststatus" /> app:layout_constraintTop_toBottomOf="@id/userImage" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

Some files were not shown because too many files have changed in this diff Show More