Compare commits
6 Commits
Diagnostic
...
api
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e9f7513c85 | ||
|
|
229f79fe24 | ||
|
|
2bd9f79795 | ||
|
|
e97d533998 | ||
|
|
b461fa0710 | ||
|
|
2e0b0be7f4 |
@@ -14,7 +14,7 @@ android {
|
|||||||
namespace 'in.sminnovations.hpostesting'
|
namespace 'in.sminnovations.hpostesting'
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "in.sminnovations.hpostesting"
|
applicationId "in.sminnovations.hpostesting.prod"
|
||||||
minSdk 21
|
minSdk 21
|
||||||
targetSdk 33
|
targetSdk 33
|
||||||
versionCode 2
|
versionCode 2
|
||||||
|
|||||||
@@ -30,7 +30,11 @@ object DataHolder {
|
|||||||
|
|
||||||
var selectedTest: UserData? = null
|
var selectedTest: UserData? = null
|
||||||
|
|
||||||
|
var kitSerial: String = ""
|
||||||
|
|
||||||
var location: UserData.Location? = null
|
var location: UserData.Location? = null
|
||||||
|
|
||||||
var testExp: Boolean = true
|
var testExp: Boolean = true
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
package com.example.hpostesting.data
|
|
||||||
|
|
||||||
import android.util.Log
|
|
||||||
import com.example.hpostesting.data.model.Response
|
|
||||||
import com.example.hpostesting.data.repository.DatabaseRepository
|
|
||||||
import com.example.hpostesting.util.MyUtils
|
|
||||||
import kotlinx.coroutines.GlobalScope
|
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
|
|
||||||
class FileUploader {
|
|
||||||
|
|
||||||
private val TAG = "FileUploader"
|
|
||||||
val repository = DatabaseRepository()
|
|
||||||
|
|
||||||
suspend fun start() {
|
|
||||||
|
|
||||||
val listOfFiles = repository.getAllFromPendingQueue()
|
|
||||||
|
|
||||||
for (each in listOfFiles){
|
|
||||||
// Checking internet connectivity & mobile as same or not
|
|
||||||
if (MyUtils.isInternetConnected() && each.mobileId == DataHolder.mobileUniqueId) {
|
|
||||||
|
|
||||||
Log.d(TAG, "uploading file ${each.pendingId}")
|
|
||||||
GlobalScope.launch {
|
|
||||||
val response = repository.uploadFileToStorage(each.patientId, each.filePath)
|
|
||||||
|
|
||||||
when (response) {
|
|
||||||
is Response.Success -> {
|
|
||||||
Log.d(TAG, "File Uploaded ${each.pendingId}")
|
|
||||||
repository.removeFromPendingQueue(each.pendingId)
|
|
||||||
}
|
|
||||||
|
|
||||||
is Response.Error -> {
|
|
||||||
Log.d(TAG, response.exception.toString())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.join()
|
|
||||||
|
|
||||||
} else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
8
app/src/main/java/com/example/hpostesting/data/Result.kt
Normal file
8
app/src/main/java/com/example/hpostesting/data/Result.kt
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
package com.example.hpostesting.data
|
||||||
|
|
||||||
|
sealed class Result<out T : Any> {
|
||||||
|
|
||||||
|
data class Success<out T : Any>(val data: T) : Result<T>()
|
||||||
|
data class Error(val exception: Exception) : Result<Nothing>()
|
||||||
|
class Loading<T : Any> : Result<T>()
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.example.hpostesting.data.api
|
||||||
|
|
||||||
|
import com.example.hpostesting.data.model.patient.MolbioLogin
|
||||||
|
import com.example.hpostesting.data.model.patient.UploadResponse
|
||||||
|
import com.google.gson.JsonObject
|
||||||
|
import okhttp3.MultipartBody
|
||||||
|
import okhttp3.RequestBody
|
||||||
|
import retrofit2.Call
|
||||||
|
import retrofit2.http.Body
|
||||||
|
import retrofit2.http.Header
|
||||||
|
import retrofit2.http.Headers
|
||||||
|
import retrofit2.http.Multipart
|
||||||
|
import retrofit2.http.POST
|
||||||
|
import retrofit2.http.PUT
|
||||||
|
import retrofit2.http.Part
|
||||||
|
|
||||||
|
interface MolbioApi {
|
||||||
|
@Headers("Content-Type: application/json")
|
||||||
|
@POST("devices/login")
|
||||||
|
suspend fun login(@Body jsonObject: JsonObject): MolbioLogin
|
||||||
|
|
||||||
|
|
||||||
|
@Multipart
|
||||||
|
@PUT("results/upload")
|
||||||
|
fun uploadPdf(@Header("Authorization") auth:String, @Part file: MultipartBody.Part, @Part("DeviceId") name: RequestBody): Call<JsonObject>
|
||||||
|
|
||||||
|
@Multipart
|
||||||
|
@PUT("results/upload")
|
||||||
|
suspend fun uploadNewPdf(@Header("Authorization") auth:String,@Part("") count:RequestBody,@Part("") userId:RequestBody,@Part file_csv: MultipartBody.Part,@Part file_log:MultipartBody.Part,@Part("DeviceId") name:RequestBody): UploadResponse
|
||||||
|
|
||||||
|
}
|
||||||
@@ -32,27 +32,14 @@ object Constants {
|
|||||||
const val USER_ID = "usernameId"
|
const val USER_ID = "usernameId"
|
||||||
|
|
||||||
val STATICID = listOf(
|
val STATICID = listOf(
|
||||||
"VIZ-1000-0001",
|
|
||||||
"VIZ-1000-0002",
|
|
||||||
"VIZ-1000-0003",
|
|
||||||
"VIZ-1000-0004",
|
"VIZ-1000-0004",
|
||||||
"VIZ-1000-0005",
|
"VIZ-1000-0005",
|
||||||
"VIZ-1000-0006",
|
"VIZ-1000-0006",
|
||||||
"VIZ-1000-0007",
|
|
||||||
"VIZ-1000-0008",
|
|
||||||
"VIZ-1000-0009",
|
|
||||||
"VIZ-1000-0010",
|
|
||||||
"VIZ-1000-0011",
|
|
||||||
"VIZ-1000-0012",
|
|
||||||
"VIZ-1000-0013",
|
|
||||||
"VIZ-1000-0014",
|
|
||||||
"VIZ-1000-0015",
|
|
||||||
"VIZ-1000-0016",
|
|
||||||
"VIZ-1000-0017",
|
|
||||||
"VIZ-1000-0018",
|
|
||||||
"VIZ-1000-0019"
|
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const val password = "SMI@12345"
|
const val password = "SMI@12345"
|
||||||
|
|
||||||
|
const val BASE_URL = "https://datacollection.micropcr.com/v1/"
|
||||||
|
|
||||||
|
const val TOKEN = "molbioToken"
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package com.example.hpostesting.data.model.patient
|
||||||
|
|
||||||
|
data class MolbioLogin(
|
||||||
|
val token: String
|
||||||
|
)
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package com.example.hpostesting.data.model.patient
|
||||||
|
|
||||||
|
data class UploadResponse(
|
||||||
|
val success: Boolean
|
||||||
|
)
|
||||||
@@ -23,7 +23,8 @@ data class UserData(
|
|||||||
var csvPath: String = "",
|
var csvPath: String = "",
|
||||||
var reportPath: String = "",
|
var reportPath: String = "",
|
||||||
var result: TestRightResultType? = null,
|
var result: TestRightResultType? = null,
|
||||||
var resultRatio: Double? = null
|
var resultRatio: Double? = null,
|
||||||
|
var uploadFlag: Boolean? = false
|
||||||
) {
|
) {
|
||||||
enum class Gender {
|
enum class Gender {
|
||||||
MALE,
|
MALE,
|
||||||
|
|||||||
@@ -1,21 +1,63 @@
|
|||||||
package com.example.hpostesting.data.repository
|
package com.example.hpostesting.data.repository
|
||||||
|
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
|
import com.example.hpostesting.data.api.MolbioApi
|
||||||
import com.example.hpostesting.data.model.PendingUploads
|
import com.example.hpostesting.data.model.PendingUploads
|
||||||
import com.example.hpostesting.data.model.Response
|
import com.example.hpostesting.data.model.Response
|
||||||
|
import com.example.hpostesting.data.model.patient.MolbioLogin
|
||||||
|
import com.example.hpostesting.data.model.patient.UploadResponse
|
||||||
import com.example.hpostesting.data.model.patient.UserData
|
import com.example.hpostesting.data.model.patient.UserData
|
||||||
import com.google.firebase.firestore.FirebaseFirestore
|
import com.google.firebase.firestore.FirebaseFirestore
|
||||||
import com.google.firebase.firestore.ktx.firestore
|
import com.google.firebase.firestore.ktx.firestore
|
||||||
import com.google.firebase.ktx.Firebase
|
import com.google.firebase.ktx.Firebase
|
||||||
import com.google.firebase.storage.ktx.storage
|
import com.google.firebase.storage.ktx.storage
|
||||||
|
import com.google.gson.JsonObject
|
||||||
import kotlinx.coroutines.tasks.await
|
import kotlinx.coroutines.tasks.await
|
||||||
|
import okhttp3.MultipartBody
|
||||||
|
import okhttp3.RequestBody
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
import java.net.ConnectException
|
||||||
|
import java.net.SocketTimeoutException
|
||||||
|
import javax.inject.Inject
|
||||||
|
import javax.inject.Singleton
|
||||||
|
|
||||||
class DatabaseRepository : Repository {
|
|
||||||
|
class NetworkException(message: String, cause: Throwable) : Exception(message, cause)
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
class DatabaseRepository @Inject constructor(
|
||||||
|
private val molbioApi: MolbioApi
|
||||||
|
) : Repository {
|
||||||
|
|
||||||
private val db: FirebaseFirestore = Firebase.firestore
|
private val db: FirebaseFirestore = Firebase.firestore
|
||||||
private val storage = Firebase.storage
|
private val storage = Firebase.storage
|
||||||
|
|
||||||
|
private suspend fun <T : Any> safeApiCall(apiCall: suspend () -> T): com.example.hpostesting.data.Result<T> {
|
||||||
|
return try {
|
||||||
|
val response = apiCall.invoke()
|
||||||
|
com.example.hpostesting.data.Result.Success(response)
|
||||||
|
} catch (e: SocketTimeoutException) {
|
||||||
|
com.example.hpostesting.data.Result.Error(NetworkException("Network timeout", e))
|
||||||
|
} catch (e: ConnectException) {
|
||||||
|
com.example.hpostesting.data.Result.Error(
|
||||||
|
NetworkException(
|
||||||
|
"Network connection failed",
|
||||||
|
e
|
||||||
|
)
|
||||||
|
)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
com.example.hpostesting.data.Result.Error(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun login(jsonObject: JsonObject): com.example.hpostesting.data.Result<MolbioLogin> {
|
||||||
|
return safeApiCall { molbioApi.login(jsonObject) }
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun uploadPdf(token:String,count:RequestBody,userId:RequestBody,file_csv:MultipartBody.Part,log_csv:MultipartBody.Part,deviceId:RequestBody): com.example.hpostesting.data.Result<UploadResponse> {
|
||||||
|
return safeApiCall { molbioApi.uploadNewPdf(token,count,userId,file_csv,log_csv,deviceId) }
|
||||||
|
}
|
||||||
|
|
||||||
suspend fun addTestToDatabase(data: UserData): Response<String> {
|
suspend fun addTestToDatabase(data: UserData): Response<String> {
|
||||||
return try {
|
return try {
|
||||||
val userdata = db.collection("patientData").whereEqualTo("_id", data._id).get().await()
|
val userdata = db.collection("patientData").whereEqualTo("_id", data._id).get().await()
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package com.example.hpostesting.domain
|
||||||
|
|
||||||
|
import android.app.job.JobParameters
|
||||||
|
import android.app.job.JobService
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.SharedPreferences
|
||||||
|
import android.util.Log
|
||||||
|
import androidx.lifecycle.ViewModelProvider
|
||||||
|
import com.example.hpostesting.data.constant.Constants
|
||||||
|
import com.example.hpostesting.presentation.testRight.TestRightViewModel
|
||||||
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@AndroidEntryPoint
|
||||||
|
class MyJobScheduler : JobService(){
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
lateinit var sharedPreference: SharedPreferences
|
||||||
|
private lateinit var viewModel: TestRightViewModel
|
||||||
|
|
||||||
|
override fun onCreate() {
|
||||||
|
super.onCreate()
|
||||||
|
viewModel = ViewModelProvider.AndroidViewModelFactory.getInstance(application)
|
||||||
|
.create(TestRightViewModel::class.java)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onStartJob(p0: JobParameters?): Boolean {
|
||||||
|
Log.d("jober","job started")
|
||||||
|
sharedPreference = this.getSharedPreferences("PREFERENCE_NAME", Context.MODE_PRIVATE)
|
||||||
|
viewModel.networkStatusLiveData.observeForever {
|
||||||
|
if (it) {
|
||||||
|
fetchInternalDataAndUpload()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun fetchInternalDataAndUpload() {
|
||||||
|
val token = sharedPreference.getString(Constants.TOKEN,"")
|
||||||
|
viewModel.allUserData.observeForever {userList ->
|
||||||
|
userList.forEach {user ->
|
||||||
|
if (user.uploadFlag == false) {
|
||||||
|
viewModel.bulkUploadResultToDatabase(user, token)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun onStopJob(p0: JobParameters?): Boolean {
|
||||||
|
Log.d("jober_stop","Job stopped")
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,11 +2,14 @@ package com.example.hpostesting.domain.di
|
|||||||
|
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.content.SharedPreferences
|
||||||
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import androidx.room.Room
|
import androidx.room.Room
|
||||||
|
import com.example.hpostesting.data.api.MolbioApi
|
||||||
|
import com.example.hpostesting.data.constant.Constants
|
||||||
import com.example.hpostesting.data.dao.MyDatabase
|
import com.example.hpostesting.data.dao.MyDatabase
|
||||||
import com.example.hpostesting.data.dao.UserDao
|
import com.example.hpostesting.data.dao.UserDao
|
||||||
import com.example.hpostesting.data.datasource.LocalFileDataSource
|
import com.example.hpostesting.data.datasource.LocalFileDataSource
|
||||||
import com.example.hpostesting.data.repository.DatabaseRepository
|
|
||||||
import com.example.hpostesting.data.repository.LocalFileRepository
|
import com.example.hpostesting.data.repository.LocalFileRepository
|
||||||
import com.example.hpostesting.domain.SaveRawData
|
import com.example.hpostesting.domain.SaveRawData
|
||||||
import com.example.hpostesting.domain.SaveRawDataTest
|
import com.example.hpostesting.domain.SaveRawDataTest
|
||||||
@@ -15,6 +18,8 @@ import dagger.Provides
|
|||||||
import dagger.hilt.InstallIn
|
import dagger.hilt.InstallIn
|
||||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||||
import dagger.hilt.components.SingletonComponent
|
import dagger.hilt.components.SingletonComponent
|
||||||
|
import retrofit2.Retrofit
|
||||||
|
import retrofit2.converter.gson.GsonConverterFactory
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
@@ -57,7 +62,28 @@ object AppModule {
|
|||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
fun provideDatabaseRepository(): DatabaseRepository {
|
fun provideRetrofit(): Retrofit =
|
||||||
return DatabaseRepository()
|
Retrofit
|
||||||
|
.Builder()
|
||||||
|
.baseUrl(Constants.BASE_URL)
|
||||||
|
.addConverterFactory(GsonConverterFactory.create())
|
||||||
|
.build()
|
||||||
|
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
fun provideMolbioApi(retrofit: Retrofit): MolbioApi =
|
||||||
|
retrofit.create(MolbioApi::class.java)
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
fun provideSharedPreferences(@ApplicationContext context: Context): SharedPreferences {
|
||||||
|
return context.getSharedPreferences("my_preferences", Context.MODE_PRIVATE)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
fun provideViewModelFactory(application: Application): ViewModelProvider.Factory {
|
||||||
|
return ViewModelProvider.AndroidViewModelFactory.getInstance(application)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -42,9 +42,12 @@ class KitScanActivity : AppCompatActivity() {
|
|||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
|
|
||||||
if (DataHolder.sampleReadCounter <= Constants.MAXIMUM_TEST_ALLOWED_BEFORE_REFERENCE && DataHolder.isReferenceTaken){
|
if (DataHolder.sampleReadCounter <= Constants.MAXIMUM_TEST_ALLOWED_BEFORE_REFERENCE && DataHolder.isReferenceTaken){
|
||||||
|
DataHolder.selectedTest!!.kitSerial = DataHolder.kitSerial
|
||||||
moveToNext()
|
moveToNext()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
binding.nameEditText.setText("SMI/SC/")
|
||||||
|
|
||||||
setSupportActionBar(binding.toolbar)
|
setSupportActionBar(binding.toolbar)
|
||||||
|
|
||||||
binding.btnScanNow.setOnClickListener {
|
binding.btnScanNow.setOnClickListener {
|
||||||
@@ -55,7 +58,8 @@ class KitScanActivity : AppCompatActivity() {
|
|||||||
binding.btnGo.setOnClickListener {
|
binding.btnGo.setOnClickListener {
|
||||||
val serialNumber = binding.nameEditText.text.toString().trim()
|
val serialNumber = binding.nameEditText.text.toString().trim()
|
||||||
if (serialNumber.isNotEmpty() && checkDataNotNull() && isSerialValid(serialNumber)) {
|
if (serialNumber.isNotEmpty() && checkDataNotNull() && isSerialValid(serialNumber)) {
|
||||||
DataHolder.selectedTest!!.kitSerial = binding.nameEditText.text.toString()
|
DataHolder.kitSerial = binding.nameEditText.text.toString()
|
||||||
|
DataHolder.selectedTest?.kitSerial = binding.nameEditText.text.toString()
|
||||||
moveToNext()
|
moveToNext()
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(this, "Invalid KIT Number", Toast.LENGTH_LONG).show()
|
Toast.makeText(this, "Invalid KIT Number", Toast.LENGTH_LONG).show()
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
locationCallback = object : LocationCallback() {
|
locationCallback = object : LocationCallback() {
|
||||||
override fun onLocationResult(locationResult: LocationResult) {
|
override fun onLocationResult(locationResult: LocationResult) {
|
||||||
locationResult.lastLocation?.let { location ->
|
locationResult.lastLocation?.let { location ->
|
||||||
DataHolder.location = UserData.Location(location.latitude, location.longitude)
|
DataHolder.selectedTest!!.location = UserData.Location(location.latitude, location.longitude)
|
||||||
Log.i("Location", DataHolder.location.toString())
|
Log.i("Location", DataHolder.location.toString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -81,10 +81,16 @@ class MainActivity : AppCompatActivity() {
|
|||||||
val availableDrivers = UsbSerialProber.getDefaultProber()
|
val availableDrivers = UsbSerialProber.getDefaultProber()
|
||||||
.findAllDrivers(getSystemService(Context.USB_SERVICE) as UsbManager)
|
.findAllDrivers(getSystemService(Context.USB_SERVICE) as UsbManager)
|
||||||
if (availableDrivers.isNotEmpty() && availableDrivers[0].device.productId == Constants.DEVICE_PRODUCT_ID && availableDrivers[0].device.vendorId == Constants.DEVICE_VENDOR_ID) {
|
if (availableDrivers.isNotEmpty() && availableDrivers[0].device.productId == Constants.DEVICE_PRODUCT_ID && availableDrivers[0].device.vendorId == Constants.DEVICE_VENDOR_ID) {
|
||||||
Log.d(TAG, "Device matched -> product = ${availableDrivers[0].device.productId}, vendor = ${availableDrivers[0].device.vendorId}")
|
Log.d(
|
||||||
|
TAG,
|
||||||
|
"Device matched -> product = ${availableDrivers[0].device.productId}, vendor = ${availableDrivers[0].device.vendorId}"
|
||||||
|
)
|
||||||
DataHolder.usbConnected.value = true
|
DataHolder.usbConnected.value = true
|
||||||
} else if (availableDrivers.isNotEmpty()) {
|
} else if (availableDrivers.isNotEmpty()) {
|
||||||
Log.d(TAG, "Device NOT matched -> product = ${availableDrivers[0].device.productId}, vendor = ${availableDrivers[0].device.vendorId}")
|
Log.d(
|
||||||
|
TAG,
|
||||||
|
"Device NOT matched -> product = ${availableDrivers[0].device.productId}, vendor = ${availableDrivers[0].device.vendorId}"
|
||||||
|
)
|
||||||
Toast.makeText(this, "Device Not Compatible", Toast.LENGTH_SHORT).show()
|
Toast.makeText(this, "Device Not Compatible", Toast.LENGTH_SHORT).show()
|
||||||
DataHolder.usbConnected.value = false
|
DataHolder.usbConnected.value = false
|
||||||
} else {
|
} else {
|
||||||
@@ -108,9 +114,11 @@ class MainActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
DataHolder.usbConnected.observe(this) {
|
DataHolder.usbConnected.observe(this) {
|
||||||
if (it) {
|
if (it) {
|
||||||
myMenu?.get(0)?.icon = ContextCompat.getDrawable(this, R.drawable.ic_baseline_usb_24)
|
myMenu?.get(0)?.icon =
|
||||||
|
ContextCompat.getDrawable(this, R.drawable.ic_baseline_usb_24)
|
||||||
} else {
|
} else {
|
||||||
myMenu?.get(0)?.icon = ContextCompat.getDrawable(this, R.drawable.ic_baseline_usb_off_24)
|
myMenu?.get(0)?.icon =
|
||||||
|
ContextCompat.getDrawable(this, R.drawable.ic_baseline_usb_off_24)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -127,14 +135,11 @@ class MainActivity : AppCompatActivity() {
|
|||||||
val coarseLocationPermissionRequestCode = 101
|
val coarseLocationPermissionRequestCode = 101
|
||||||
|
|
||||||
if (ContextCompat.checkSelfPermission(
|
if (ContextCompat.checkSelfPermission(
|
||||||
this,
|
this, coarseLocationPermission
|
||||||
coarseLocationPermission
|
|
||||||
) != PackageManager.PERMISSION_GRANTED
|
) != PackageManager.PERMISSION_GRANTED
|
||||||
) {
|
) {
|
||||||
ActivityCompat.requestPermissions(
|
ActivityCompat.requestPermissions(
|
||||||
this,
|
this, arrayOf(coarseLocationPermission), coarseLocationPermissionRequestCode
|
||||||
arrayOf(coarseLocationPermission),
|
|
||||||
coarseLocationPermissionRequestCode
|
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
getLocation()
|
getLocation()
|
||||||
@@ -146,14 +151,11 @@ class MainActivity : AppCompatActivity() {
|
|||||||
val fineLocationPermissionRequestCode = 102
|
val fineLocationPermissionRequestCode = 102
|
||||||
|
|
||||||
if (ContextCompat.checkSelfPermission(
|
if (ContextCompat.checkSelfPermission(
|
||||||
this,
|
this, fineLocationPermission
|
||||||
fineLocationPermission
|
|
||||||
) != PackageManager.PERMISSION_GRANTED
|
) != PackageManager.PERMISSION_GRANTED
|
||||||
) {
|
) {
|
||||||
ActivityCompat.requestPermissions(
|
ActivityCompat.requestPermissions(
|
||||||
this,
|
this, arrayOf(fineLocationPermission), fineLocationPermissionRequestCode
|
||||||
arrayOf(fineLocationPermission),
|
|
||||||
fineLocationPermissionRequestCode
|
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
getLocation()
|
getLocation()
|
||||||
@@ -165,12 +167,9 @@ class MainActivity : AppCompatActivity() {
|
|||||||
val fineLocationPermission = Manifest.permission.ACCESS_FINE_LOCATION
|
val fineLocationPermission = Manifest.permission.ACCESS_FINE_LOCATION
|
||||||
|
|
||||||
if (ActivityCompat.checkSelfPermission(
|
if (ActivityCompat.checkSelfPermission(
|
||||||
this,
|
this, coarseLocationPermission
|
||||||
coarseLocationPermission
|
) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(
|
||||||
) != PackageManager.PERMISSION_GRANTED &&
|
this, fineLocationPermission
|
||||||
ActivityCompat.checkSelfPermission(
|
|
||||||
this,
|
|
||||||
fineLocationPermission
|
|
||||||
) != PackageManager.PERMISSION_GRANTED
|
) != PackageManager.PERMISSION_GRANTED
|
||||||
) {
|
) {
|
||||||
// Handle location permission request if needed
|
// Handle location permission request if needed
|
||||||
@@ -180,16 +179,14 @@ class MainActivity : AppCompatActivity() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
fusedLocationClient.lastLocation
|
fusedLocationClient.lastLocation.addOnSuccessListener { location: Location? ->
|
||||||
.addOnSuccessListener { location: Location? ->
|
|
||||||
location?.let {
|
location?.let {
|
||||||
DataHolder.location = UserData.Location(location.latitude, location.longitude)
|
DataHolder.selectedTest!!.location =
|
||||||
Log.i("Location", DataHolder.location.toString())
|
UserData.Location(location.latitude, location.longitude)
|
||||||
} ?: run {
|
} ?: run {
|
||||||
requestLocationUpdates()
|
requestLocationUpdates()
|
||||||
}
|
}
|
||||||
}
|
}.addOnFailureListener { exception: Exception ->
|
||||||
.addOnFailureListener { exception: Exception ->
|
|
||||||
exception.printStackTrace()
|
exception.printStackTrace()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -202,12 +199,9 @@ class MainActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ActivityCompat.checkSelfPermission(
|
if (ActivityCompat.checkSelfPermission(
|
||||||
this,
|
this, Manifest.permission.ACCESS_COARSE_LOCATION
|
||||||
Manifest.permission.ACCESS_COARSE_LOCATION
|
) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(
|
||||||
) != PackageManager.PERMISSION_GRANTED &&
|
this, Manifest.permission.ACCESS_FINE_LOCATION
|
||||||
ActivityCompat.checkSelfPermission(
|
|
||||||
this,
|
|
||||||
Manifest.permission.ACCESS_FINE_LOCATION
|
|
||||||
) != PackageManager.PERMISSION_GRANTED
|
) != PackageManager.PERMISSION_GRANTED
|
||||||
) {
|
) {
|
||||||
return
|
return
|
||||||
@@ -226,9 +220,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onRequestPermissionsResult(
|
override fun onRequestPermissionsResult(
|
||||||
requestCode: Int,
|
requestCode: Int, permissions: Array<String>, grantResults: IntArray
|
||||||
permissions: Array<String>,
|
|
||||||
grantResults: IntArray
|
|
||||||
) {
|
) {
|
||||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||||
when (requestCode) {
|
when (requestCode) {
|
||||||
@@ -238,16 +230,19 @@ class MainActivity : AppCompatActivity() {
|
|||||||
requestFineLocationPermission()
|
requestFineLocationPermission()
|
||||||
} else {
|
} else {
|
||||||
// Coarse location permission denied
|
// Coarse location permission denied
|
||||||
Toast.makeText(this, "Coarse location permission denied", Toast.LENGTH_SHORT).show()
|
Toast.makeText(this, "Coarse location permission denied", Toast.LENGTH_SHORT)
|
||||||
|
.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
102 -> {
|
102 -> {
|
||||||
if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||||
// Fine location permission granted
|
// Fine location permission granted
|
||||||
getLocation()
|
getLocation()
|
||||||
} else {
|
} else {
|
||||||
// Fine location permission denied
|
// Fine location permission denied
|
||||||
Toast.makeText(this, "Fine location permission denied", Toast.LENGTH_SHORT).show()
|
Toast.makeText(this, "Fine location permission denied", Toast.LENGTH_SHORT)
|
||||||
|
.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ class DashboardActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
private lateinit var appBarConfiguration: AppBarConfiguration
|
private lateinit var appBarConfiguration: AppBarConfiguration
|
||||||
private lateinit var binding: ActivityDashboardBinding
|
private lateinit var binding: ActivityDashboardBinding
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import android.view.View
|
|||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import com.example.hpostesting.presentation.dashboard.ui.gallery.GalleryViewModel
|
|
||||||
import `in`.sminnovations.hpostesting.databinding.FragmentGalleryBinding
|
import `in`.sminnovations.hpostesting.databinding.FragmentGalleryBinding
|
||||||
|
|
||||||
class GalleryFragment : Fragment() {
|
class GalleryFragment : Fragment() {
|
||||||
@@ -22,8 +21,6 @@ class GalleryFragment : Fragment() {
|
|||||||
container: ViewGroup?,
|
container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View {
|
): View {
|
||||||
val galleryViewModel =
|
|
||||||
ViewModelProvider(this).get(GalleryViewModel::class.java)
|
|
||||||
|
|
||||||
_binding = FragmentGalleryBinding.inflate(inflater, container, false)
|
_binding = FragmentGalleryBinding.inflate(inflater, container, false)
|
||||||
val root: View = binding.root
|
val root: View = binding.root
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ 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.DataHolder
|
import com.example.hpostesting.data.DataHolder
|
||||||
|
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.model.patient.UserData
|
import com.example.hpostesting.data.model.patient.UserData
|
||||||
import com.example.hpostesting.presentation.adapter.UserListAdapter
|
import com.example.hpostesting.presentation.adapter.UserListAdapter
|
||||||
@@ -21,6 +22,7 @@ import com.example.hpostesting.presentation.testRight.TestRightViewModel
|
|||||||
import com.firebase.ui.firestore.FirestoreRecyclerOptions
|
import com.firebase.ui.firestore.FirestoreRecyclerOptions
|
||||||
import com.google.firebase.firestore.ktx.firestore
|
import com.google.firebase.firestore.ktx.firestore
|
||||||
import com.google.firebase.ktx.Firebase
|
import com.google.firebase.ktx.Firebase
|
||||||
|
import com.google.gson.JsonObject
|
||||||
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
|
||||||
@@ -34,11 +36,13 @@ class HomeFragment : Fragment() {
|
|||||||
private val viewModel: TestRightViewModel by activityViewModels()
|
private val viewModel: TestRightViewModel by activityViewModels()
|
||||||
private lateinit var rvAdapter: UserListAdapter
|
private lateinit var rvAdapter: UserListAdapter
|
||||||
private lateinit var sharedPreference: SharedPreferences
|
private lateinit var sharedPreference: SharedPreferences
|
||||||
|
private var loginCount = 1
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
||||||
): View {
|
): View {
|
||||||
_binding = FragmentHomeBinding.inflate(inflater, container, false)
|
_binding = FragmentHomeBinding.inflate(inflater, container, false)
|
||||||
sharedPreference = requireContext().getSharedPreferences("PREFERENCE_NAME", Context.MODE_PRIVATE)
|
sharedPreference =
|
||||||
|
requireContext().getSharedPreferences("PREFERENCE_NAME", Context.MODE_PRIVATE)
|
||||||
DataHolder.selectedTest = null
|
DataHolder.selectedTest = null
|
||||||
|
|
||||||
return binding.root
|
return binding.root
|
||||||
@@ -53,9 +57,10 @@ class HomeFragment : Fragment() {
|
|||||||
if (isConnected) {
|
if (isConnected) {
|
||||||
binding.internetAvailableCL.visibility = View.VISIBLE
|
binding.internetAvailableCL.visibility = View.VISIBLE
|
||||||
binding.internetNotAvailableCL.visibility = View.GONE
|
binding.internetNotAvailableCL.visibility = View.GONE
|
||||||
|
login()
|
||||||
loadUserData()
|
loadUserData()
|
||||||
setSearch()
|
setSearch()
|
||||||
checkForLocalDBData()
|
// checkForLocalDBData()
|
||||||
} else {
|
} else {
|
||||||
binding.internetAvailableCL.visibility = View.GONE
|
binding.internetAvailableCL.visibility = View.GONE
|
||||||
binding.internetNotAvailableCL.visibility = View.VISIBLE
|
binding.internetNotAvailableCL.visibility = View.VISIBLE
|
||||||
@@ -66,8 +71,56 @@ class HomeFragment : Fragment() {
|
|||||||
logoutUser(requireContext())
|
logoutUser(requireContext())
|
||||||
}
|
}
|
||||||
binding.uploadData.setOnClickListener {
|
binding.uploadData.setOnClickListener {
|
||||||
showUploadDialog(requireContext())
|
showUploadDialog()
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
// val jobScheduler = getSystemService(Context.JOB_SCHEDULER_SERVICE) as JobScheduler
|
||||||
|
//
|
||||||
|
// val jobInfo = JobInfo.Builder(1, ComponentName(this, MyJobScheduler::class.java))
|
||||||
|
// .setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)
|
||||||
|
// .setPersisted(true)
|
||||||
|
// .setPeriodic(30 * 60 * 1000)
|
||||||
|
// .build()
|
||||||
|
// jobScheduler.schedule(jobInfo)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onStart() {
|
||||||
|
super.onStart()
|
||||||
|
val jsonObject = JsonObject()
|
||||||
|
jsonObject.addProperty("Username", "hposdevice")
|
||||||
|
jsonObject.addProperty("Password", "sickle")
|
||||||
|
viewModel.loginResponse.observe(viewLifecycleOwner) { response ->
|
||||||
|
when (response) {
|
||||||
|
is Result.Success -> {
|
||||||
|
val editor = sharedPreference.edit()
|
||||||
|
editor.putString(Constants.TOKEN, response.data.token)
|
||||||
|
editor.apply()
|
||||||
|
Log.d("login_api", "called")
|
||||||
|
// showUploadDialog()
|
||||||
|
}
|
||||||
|
|
||||||
|
is Result.Error -> {
|
||||||
|
if (loginCount < 3) {
|
||||||
|
viewModel.login(jsonObject)
|
||||||
|
loginCount++
|
||||||
|
}
|
||||||
|
Log.d("API Error", response.exception.message.toString())
|
||||||
|
}
|
||||||
|
|
||||||
|
is Result.Loading -> {
|
||||||
|
Toast.makeText(requireContext(), "Loading", Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun login() {
|
||||||
|
val jsonObject = JsonObject()
|
||||||
|
jsonObject.addProperty("Username", "hposdevice")
|
||||||
|
jsonObject.addProperty("Password", "sickle")
|
||||||
|
viewModel.login(jsonObject)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setUserId() {
|
private fun setUserId() {
|
||||||
@@ -101,6 +154,7 @@ class HomeFragment : Fragment() {
|
|||||||
apply()
|
apply()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun logoutUser(context: Context) {
|
private fun logoutUser(context: Context) {
|
||||||
val builder = AlertDialog.Builder(context)
|
val builder = AlertDialog.Builder(context)
|
||||||
builder.setTitle("Log Out")
|
builder.setTitle("Log Out")
|
||||||
@@ -123,7 +177,6 @@ class HomeFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private fun getData(search: String?, field: String) {
|
private fun getData(search: String?, field: String) {
|
||||||
val capitalizedSearch = search?.replaceFirstChar {
|
val capitalizedSearch = search?.replaceFirstChar {
|
||||||
if (search.lowercase()
|
if (search.lowercase()
|
||||||
@@ -188,8 +241,8 @@ class HomeFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showUploadDialog(context: Context) {
|
private fun showUploadDialog() {
|
||||||
val builder = AlertDialog.Builder(context)
|
val builder = AlertDialog.Builder(requireContext())
|
||||||
builder.setTitle(R.string.upload_db_registration_title)
|
builder.setTitle(R.string.upload_db_registration_title)
|
||||||
builder.setMessage(R.string.upload_db_registration_message)
|
builder.setMessage(R.string.upload_db_registration_message)
|
||||||
|
|
||||||
@@ -206,19 +259,17 @@ class HomeFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun uploadLocalDBData(dialog: DialogInterface) {
|
private fun uploadLocalDBData(dialog: DialogInterface) {
|
||||||
|
val token = sharedPreference.getString(Constants.TOKEN, "")
|
||||||
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, token!!)
|
||||||
viewModel.deleteById(userData._id)
|
|
||||||
}
|
}
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
requireContext(),
|
requireContext(), R.string.upload_success_message, Toast.LENGTH_SHORT
|
||||||
R.string.upload_success_message,
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
).show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ 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
|
||||||
|
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.DataHolder
|
import com.example.hpostesting.data.DataHolder
|
||||||
@@ -79,18 +80,29 @@ class TestRightExpSample : Fragment() {
|
|||||||
// if (details != null) {
|
// if (details != null) {
|
||||||
// viewModel.patientDetails = details
|
// viewModel.patientDetails = details
|
||||||
|
|
||||||
UIUtils.createAlertDialog(
|
UIUtils.createAlertDialog(
|
||||||
requireContext(),
|
requireContext(),
|
||||||
getString(R.string.have_you_placed_sample),
|
"WARNING",
|
||||||
getString(R.string.please_place_sample),
|
"Please check if you have placed the sample of this person ${viewModel.testDetails?._id}",
|
||||||
getString(R.string.no),
|
getString(R.string.no),
|
||||||
getString(R.string.yes_and_run),
|
"Yes",
|
||||||
object : MyDialogListener {
|
object : MyDialogListener {
|
||||||
override fun onClickNegativeButton() {}
|
override fun onClickNegativeButton() {}
|
||||||
override fun onClickPositiveButton() {
|
override fun onClickPositiveButton() {
|
||||||
startAcquiring()
|
UIUtils.createAlertDialog(
|
||||||
}
|
requireContext(),
|
||||||
})
|
getString(R.string.have_you_placed_sample),
|
||||||
|
getString(R.string.please_place_sample),
|
||||||
|
getString(R.string.no),
|
||||||
|
getString(R.string.yes_and_run),
|
||||||
|
object : MyDialogListener {
|
||||||
|
override fun onClickNegativeButton() {}
|
||||||
|
override fun onClickPositiveButton() {
|
||||||
|
startAcquiring()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,10 +248,13 @@ class TestRightExpSample : Fragment() {
|
|||||||
// viewModel.mapWavelengthToAbsorbance()
|
// viewModel.mapWavelengthToAbsorbance()
|
||||||
// viewModel.calculateResults()
|
// viewModel.calculateResults()
|
||||||
|
|
||||||
viewModel.progressBar.postValue(false)
|
if (viewModel.calculationData.absorbanceOne!! < 0 || viewModel.calculationData.absorbanceTwo!! < 0) {
|
||||||
// binding.progressBar.visibility = View.GONE
|
Toast.makeText(requireContext(), " ", Toast.LENGTH_SHORT).show()
|
||||||
parentFragmentManager.beginTransaction().replace(R.id.fl_main, TestRightResults())
|
viewModel.progressBar.postValue(false)
|
||||||
.commit()
|
} else {
|
||||||
|
parentFragmentManager.beginTransaction().replace(R.id.fl_main, TestRightResults())
|
||||||
|
.commit()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun saveDataLocally() {
|
private fun saveDataLocally() {
|
||||||
|
|||||||
@@ -16,9 +16,17 @@ import com.example.hpostesting.data.model.test.TestRightResultType
|
|||||||
import com.example.hpostesting.data.model.test.TestType
|
import com.example.hpostesting.data.model.test.TestType
|
||||||
import com.example.hpostesting.presentation.dashboard.DashboardActivity
|
import com.example.hpostesting.presentation.dashboard.DashboardActivity
|
||||||
import com.example.hpostesting.util.MyUtils.calculateAgeFromYOB
|
import com.example.hpostesting.util.MyUtils.calculateAgeFromYOB
|
||||||
|
import com.google.firebase.firestore.FirebaseFirestore
|
||||||
|
import com.google.firebase.firestore.ktx.firestore
|
||||||
|
import com.google.firebase.ktx.Firebase
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import `in`.sminnovations.hpostesting.R
|
import `in`.sminnovations.hpostesting.R
|
||||||
import `in`.sminnovations.hpostesting.databinding.FragmentTestRightResultsBinding
|
import `in`.sminnovations.hpostesting.databinding.FragmentTestRightResultsBinding
|
||||||
|
import kotlinx.coroutines.CoroutineScope
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlinx.coroutines.tasks.await
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
|
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
class TestRightResults : Fragment() {
|
class TestRightResults : Fragment() {
|
||||||
@@ -43,20 +51,29 @@ class TestRightResults : Fragment() {
|
|||||||
updateResults()
|
updateResults()
|
||||||
|
|
||||||
viewModel.fireBaseUpload.observe(viewLifecycleOwner) {
|
viewModel.fireBaseUpload.observe(viewLifecycleOwner) {
|
||||||
if (it == "Success") {
|
when (it) {
|
||||||
Toast.makeText(
|
"Success" -> {
|
||||||
requireContext(), "Test Results Upload Successfully", Toast.LENGTH_SHORT
|
Toast.makeText(
|
||||||
).show()
|
requireContext(), "Test Results Upload Successfully", Toast.LENGTH_SHORT
|
||||||
|
).show()
|
||||||
|
binding.progressBar.visibility = View.GONE
|
||||||
|
}
|
||||||
|
"Loading" -> {
|
||||||
|
binding.progressBar.visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
Toast.makeText(requireContext(), "Test upload failed, please try again $it", Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
binding.progressBar.visibility = View.GONE
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupListeners() {
|
private fun setupListeners() {
|
||||||
binding.ivHome.setOnClickListener {
|
binding.ivHome.setOnClickListener {
|
||||||
val i = Intent(requireContext().applicationContext, DashboardActivity::class.java)
|
CoroutineScope(Dispatchers.IO).launch {
|
||||||
startActivity(i)
|
checkBloodGroup()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
binding.ivNext.setOnClickListener {
|
binding.ivNext.setOnClickListener {
|
||||||
val i = Intent(requireContext().applicationContext, DashboardActivity::class.java)
|
val i = Intent(requireContext().applicationContext, DashboardActivity::class.java)
|
||||||
@@ -65,6 +82,29 @@ class TestRightResults : Fragment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private suspend fun checkBloodGroup() {
|
||||||
|
binding.apply {
|
||||||
|
val bloodGroup = etBloodGroup.text.toString()
|
||||||
|
if (bloodGroup.isEmpty()) {
|
||||||
|
etBloodGroup.error = "Please enter your blood group"
|
||||||
|
} else {
|
||||||
|
val db: FirebaseFirestore = Firebase.firestore
|
||||||
|
val userdata =
|
||||||
|
db.collection("patientData").whereEqualTo("_id", viewModel.testDetails?._id)
|
||||||
|
.get().await()
|
||||||
|
if (userdata.documents.isNotEmpty()) {
|
||||||
|
userdata.documents.forEach {
|
||||||
|
db.collection("patientData").document(it.id).update("bloodGroup", bloodGroup)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
withContext(Dispatchers.Main) {
|
||||||
|
val i = Intent(requireContext().applicationContext, DashboardActivity::class.java)
|
||||||
|
startActivity(i)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun updateResults() {
|
private fun updateResults() {
|
||||||
if (viewModel.testDetails?.name == "" && viewModel.testDetails?.birthYear == "") {
|
if (viewModel.testDetails?.name == "" && viewModel.testDetails?.birthYear == "") {
|
||||||
binding.tvName.visibility = View.GONE
|
binding.tvName.visibility = View.GONE
|
||||||
@@ -81,37 +121,37 @@ class TestRightResults : Fragment() {
|
|||||||
|
|
||||||
|
|
||||||
if (DataHolder.selectedTestType == TestType.SICKLECERT) {
|
if (DataHolder.selectedTestType == TestType.SICKLECERT) {
|
||||||
when (viewModel.testDetails?.result) {
|
// when (viewModel.testDetails?.result) {
|
||||||
TestRightResultType.NORMAL -> {
|
// TestRightResultType.NORMAL -> {
|
||||||
binding.resultNormal.visibility = View.VISIBLE
|
// binding.resultNormal.visibility = View.VISIBLE
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
TestRightResultType.SICKLECELLDISEASE -> {
|
// TestRightResultType.SICKLECELLDISEASE -> {
|
||||||
binding.resultDisease.visibility = View.VISIBLE
|
// binding.resultDisease.visibility = View.VISIBLE
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
TestRightResultType.SICKLECELLTRAIT -> {
|
// TestRightResultType.SICKLECELLTRAIT -> {
|
||||||
binding.resultTrait.visibility = View.VISIBLE
|
// binding.resultTrait.visibility = View.VISIBLE
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
TestRightResultType.POSITIVEBORDERLINE -> {
|
// TestRightResultType.POSITIVEBORDERLINE -> {
|
||||||
binding.resultPositiveBorderline.visibility = View.VISIBLE
|
// binding.resultPositiveBorderline.visibility = View.VISIBLE
|
||||||
binding.tvRecommended.visibility = View.VISIBLE
|
// binding.tvRecommended.visibility = View.VISIBLE
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
TestRightResultType.NEGATIVEBORDERLINE -> {
|
// TestRightResultType.NEGATIVEBORDERLINE -> {
|
||||||
binding.resultNegativeBorderline.visibility = View.VISIBLE
|
// binding.resultNegativeBorderline.visibility = View.VISIBLE
|
||||||
binding.tvRecommended.visibility = View.VISIBLE
|
// binding.tvRecommended.visibility = View.VISIBLE
|
||||||
}
|
// }
|
||||||
|
// else -> {
|
||||||
else -> {
|
//// binding.resultUndefined.visibility = View.VISIBLE
|
||||||
// binding.resultUndefined.visibility = View.VISIBLE
|
// Toast.makeText(
|
||||||
Toast.makeText(
|
// requireContext().applicationContext, "Please Test Again", Toast.LENGTH_LONG
|
||||||
requireContext().applicationContext, "Please Test Again", Toast.LENGTH_LONG
|
// ).show()
|
||||||
).show()
|
// moveToSamplePage()
|
||||||
moveToSamplePage()
|
// }
|
||||||
}
|
// }
|
||||||
}
|
binding.resultNormal.visibility = View.VISIBLE
|
||||||
} else {
|
} else {
|
||||||
when (viewModel.testDetails?.result) {
|
when (viewModel.testDetails?.result) {
|
||||||
TestRightResultType.SICKLECELLDISEASE -> {
|
TestRightResultType.SICKLECELLDISEASE -> {
|
||||||
@@ -134,11 +174,16 @@ class TestRightResults : Fragment() {
|
|||||||
}
|
}
|
||||||
viewModel.networkStatusLiveData.observe(viewLifecycleOwner) { isNetworkAvailable ->
|
viewModel.networkStatusLiveData.observe(viewLifecycleOwner) { isNetworkAvailable ->
|
||||||
val deviceStaticId = sharedPreference.getString(Constants.USER_ID, "")
|
val deviceStaticId = sharedPreference.getString(Constants.USER_ID, "")
|
||||||
|
val token = sharedPreference.getString(Constants.TOKEN,"")
|
||||||
if (isNetworkAvailable) {
|
if (isNetworkAvailable) {
|
||||||
viewModel.uploadResultToDatabase(requireContext(), true, deviceStaticId!!)
|
if (token != null) {
|
||||||
|
viewModel.uploadResultToDatabase(requireContext(), true, deviceStaticId!!,token)
|
||||||
|
}
|
||||||
binding.progressBar.visibility = View.VISIBLE
|
binding.progressBar.visibility = View.VISIBLE
|
||||||
} else {
|
} else {
|
||||||
viewModel.uploadResultToDatabase(requireContext(), false, deviceStaticId!!)
|
if (token != null) {
|
||||||
|
viewModel.uploadResultToDatabase(requireContext(), false, deviceStaticId!!,token)
|
||||||
|
}
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
requireContext(),
|
requireContext(),
|
||||||
"Internet not available, Test Data added to Local DB",
|
"Internet not available, Test Data added to Local DB",
|
||||||
|
|||||||
@@ -2,18 +2,19 @@ package com.example.hpostesting.presentation.testRight
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.util.Log
|
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
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.DataHolder
|
import com.example.hpostesting.data.DataHolder
|
||||||
import com.example.hpostesting.data.NetworkStatusLiveData
|
import com.example.hpostesting.data.NetworkStatusLiveData
|
||||||
|
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.UserDao
|
import com.example.hpostesting.data.dao.UserDao
|
||||||
import com.example.hpostesting.data.model.CalculationVariableForTest
|
import com.example.hpostesting.data.model.CalculationVariableForTest
|
||||||
import com.example.hpostesting.data.model.ErrorMessage
|
import com.example.hpostesting.data.model.ErrorMessage
|
||||||
import com.example.hpostesting.data.model.Response
|
import com.example.hpostesting.data.model.Response
|
||||||
|
import com.example.hpostesting.data.model.patient.MolbioLogin
|
||||||
import com.example.hpostesting.data.model.patient.UserData
|
import com.example.hpostesting.data.model.patient.UserData
|
||||||
import com.example.hpostesting.data.model.test.TestRightCalculationData
|
import com.example.hpostesting.data.model.test.TestRightCalculationData
|
||||||
import com.example.hpostesting.data.model.test.TestRightDeviceConstants
|
import com.example.hpostesting.data.model.test.TestRightDeviceConstants
|
||||||
@@ -26,9 +27,13 @@ import com.example.hpostesting.domain.SickleFindResultCaluculationWithMaxImpl
|
|||||||
import com.example.hpostesting.domain.TestRightResultCalculation
|
import com.example.hpostesting.domain.TestRightResultCalculation
|
||||||
import com.example.hpostesting.util.MyUtils
|
import com.example.hpostesting.util.MyUtils
|
||||||
import com.google.firebase.storage.FirebaseStorage
|
import com.google.firebase.storage.FirebaseStorage
|
||||||
|
import com.google.gson.JsonObject
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.tasks.await
|
import kotlinx.coroutines.tasks.await
|
||||||
|
import okhttp3.MediaType
|
||||||
|
import okhttp3.MultipartBody
|
||||||
|
import okhttp3.RequestBody
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
@@ -53,17 +58,17 @@ class TestRightViewModel @Inject constructor(
|
|||||||
val errorTriggered = MutableLiveData<ErrorMessage>()
|
val errorTriggered = MutableLiveData<ErrorMessage>()
|
||||||
var numberOfSampleRun = 0
|
var numberOfSampleRun = 0
|
||||||
|
|
||||||
|
val loginResponse = MutableLiveData<Result<MolbioLogin>>()
|
||||||
|
|
||||||
val fireBaseUpload = MutableLiveData<String>()
|
val fireBaseUpload = MutableLiveData<String>()
|
||||||
|
|
||||||
val testDetails = DataHolder.selectedTest
|
val testDetails = DataHolder.selectedTest
|
||||||
|
|
||||||
private val _networkStatusLiveData = NetworkStatusLiveData(context)
|
private val _networkStatusLiveData = NetworkStatusLiveData(context)
|
||||||
val networkStatusLiveData: LiveData<Boolean>
|
val networkStatusLiveData: LiveData<Boolean>
|
||||||
get() = _networkStatusLiveData
|
get() = _networkStatusLiveData
|
||||||
|
|
||||||
val allUserData = userDao.getAll()
|
val allUserData = userDao.getAll()
|
||||||
|
|
||||||
private lateinit var calculationData: TestRightCalculationData
|
lateinit var calculationData: TestRightCalculationData
|
||||||
|
|
||||||
/* (For exp sample) Contains pixel no. -> Intensity of light falling on that pixel */
|
/* (For exp sample) Contains pixel no. -> Intensity of light falling on that pixel */
|
||||||
val intensitySampleArray = ArrayList<Double>()
|
val intensitySampleArray = ArrayList<Double>()
|
||||||
@@ -137,7 +142,6 @@ class TestRightViewModel @Inject constructor(
|
|||||||
if (isReference) DataHolder.intensityReferenceArray.clear()
|
if (isReference) DataHolder.intensityReferenceArray.clear()
|
||||||
else intensitySampleArray.clear()
|
else intensitySampleArray.clear()
|
||||||
|
|
||||||
Log.d("SURYAKUMAR", fullString)
|
|
||||||
val listOfString = fullString.split("\n")
|
val listOfString = fullString.split("\n")
|
||||||
|
|
||||||
for (line in listOfString) {
|
for (line in listOfString) {
|
||||||
@@ -436,8 +440,7 @@ class TestRightViewModel @Inject constructor(
|
|||||||
return prefixTxt + fileExtensionTxt
|
return prefixTxt + fileExtensionTxt
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addResultTestToDb() {
|
private fun addResultTestToDb(csvFilePath: String, logTxtFilePath: String, token: String) {
|
||||||
testDetails?.location = DataHolder.location
|
|
||||||
testDetails?.testTime = SimpleDateFormat(
|
testDetails?.testTime = SimpleDateFormat(
|
||||||
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
||||||
).format(Calendar.getInstance().time)
|
).format(Calendar.getInstance().time)
|
||||||
@@ -447,15 +450,51 @@ class TestRightViewModel @Inject constructor(
|
|||||||
).format(Calendar.getInstance().time)
|
).format(Calendar.getInstance().time)
|
||||||
when (repository.addTestToDatabase(testDetails)) {
|
when (repository.addTestToDatabase(testDetails)) {
|
||||||
is Response.Success -> {
|
is Response.Success -> {
|
||||||
fireBaseUpload.postValue("Success")
|
uploadToMolbio(csvFilePath, logTxtFilePath, token)
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {}
|
else -> {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun uploadResultToDatabase(context: Context, isOnline: Boolean,deviceSerialNumber: String) = viewModelScope.launch {
|
private fun uploadToMolbio(csvFilePath: String, logTxtFilePath: String, token: String) = viewModelScope.launch {
|
||||||
|
val csv_file = File(csvFilePath)
|
||||||
|
val log_file=File(logTxtFilePath)
|
||||||
|
|
||||||
|
val csv_reqBody = RequestBody.create(MediaType.parse("text/csv"), csv_file)
|
||||||
|
val log_reqBody = RequestBody.create(MediaType.parse("text/txt"), log_file)
|
||||||
|
val deviceId= testDetails?.deviceSerialNumber?.let {
|
||||||
|
RequestBody.create(MediaType.parse("text/plain"),
|
||||||
|
it
|
||||||
|
)
|
||||||
|
}
|
||||||
|
val userId= testDetails?._id?.let { RequestBody.create(MediaType.parse("text/plain"), it) }
|
||||||
|
val csv_formData = MultipartBody.Part.createFormData("csv_file", csv_file.name, csv_reqBody)
|
||||||
|
val log_formData = MultipartBody.Part.createFormData("csv_file", log_file.name, log_reqBody)
|
||||||
|
val count = "1".let {
|
||||||
|
RequestBody.create(MediaType.parse("text/plain"),
|
||||||
|
it
|
||||||
|
)
|
||||||
|
}
|
||||||
|
repository.uploadPdf(token, count, userId!!, csv_formData, log_formData, deviceId!!).let { upload ->
|
||||||
|
when(upload) {
|
||||||
|
is Result.Success -> {
|
||||||
|
fireBaseUpload.postValue("Success")
|
||||||
|
}
|
||||||
|
is Result.Error -> {
|
||||||
|
fireBaseUpload.postValue(upload.exception.message)
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fun uploadResultToDatabase(context: Context, isOnline: Boolean, deviceSerialNumber: String, token: String) = viewModelScope.launch {
|
||||||
|
fireBaseUpload.postValue("Loading")
|
||||||
val csvFilePath = MyUtils.getAppFolderPath(context) + getCSVFileName()
|
val csvFilePath = MyUtils.getAppFolderPath(context) + getCSVFileName()
|
||||||
val logTxtFilePath = MyUtils.getAppFolderPath(context) + getLogFileName()
|
val logTxtFilePath = MyUtils.getAppFolderPath(context) + getLogFileName()
|
||||||
testDetails?.csvPath = csvFilePath
|
testDetails?.csvPath = csvFilePath
|
||||||
@@ -480,8 +519,7 @@ class TestRightViewModel @Inject constructor(
|
|||||||
val serialNumber = Constants.STATICID.firstOrNull { it == deviceSerialNumber }
|
val serialNumber = Constants.STATICID.firstOrNull { it == deviceSerialNumber }
|
||||||
testDetails?.csvPath = csvUri
|
testDetails?.csvPath = csvUri
|
||||||
testDetails?.reportPath = logUri
|
testDetails?.reportPath = logUri
|
||||||
|
addResultTestToDb(csvFilePath, logTxtFilePath, token)
|
||||||
addResultTestToDb()
|
|
||||||
} catch (exception: Exception) {
|
} catch (exception: Exception) {
|
||||||
// Handle the exception appropriately (e.g., log the error, display an error message)
|
// Handle the exception appropriately (e.g., log the error, display an error message)
|
||||||
}
|
}
|
||||||
@@ -489,11 +527,14 @@ class TestRightViewModel @Inject constructor(
|
|||||||
testDetails?.testTime = SimpleDateFormat(
|
testDetails?.testTime = SimpleDateFormat(
|
||||||
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
||||||
).format(Calendar.getInstance().time)
|
).format(Calendar.getInstance().time)
|
||||||
userDao.insertAll(testDetails!!)
|
userDao.insertAll(testDetails!!).let {
|
||||||
|
fireBaseUpload.postValue("Success")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun bulkUploadResultToDatabase(userData: UserData) = viewModelScope.launch {
|
fun bulkUploadResultToDatabase(userData: UserData, token: String?) = viewModelScope.launch {
|
||||||
|
fireBaseUpload.postValue("Loading")
|
||||||
val storageRef = FirebaseStorage.getInstance().reference
|
val storageRef = FirebaseStorage.getInstance().reference
|
||||||
val storageTestDetailsRef = storageRef.child("${testDetails?._id}/")
|
val storageTestDetailsRef = storageRef.child("${testDetails?._id}/")
|
||||||
try {
|
try {
|
||||||
@@ -510,25 +551,31 @@ class TestRightViewModel @Inject constructor(
|
|||||||
val csvUri = csvUploadTask.storage.downloadUrl.await().toString()
|
val csvUri = csvUploadTask.storage.downloadUrl.await().toString()
|
||||||
val logUri = logUploadTask.storage.downloadUrl.await().toString()
|
val logUri = logUploadTask.storage.downloadUrl.await().toString()
|
||||||
|
|
||||||
|
val csvFilePath = userData.csvPath
|
||||||
|
val logTxtFilePath = userData.reportPath
|
||||||
|
|
||||||
userData.csvPath = csvUri
|
userData.csvPath = csvUri
|
||||||
userData.reportPath = logUri
|
userData.reportPath = logUri
|
||||||
|
|
||||||
|
bulkAddResultTestToDb(userData, csvFilePath, logTxtFilePath, token)
|
||||||
bulkAddResultTestToDb(userData)
|
|
||||||
} catch (exception: Exception) {
|
} catch (exception: Exception) {
|
||||||
// Handle the exception appropriately (e.g., log the error, display an error message)
|
// Handle the exception appropriately (e.g., log the error, display an error message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun bulkAddResultTestToDb(userData: UserData) {
|
private fun bulkAddResultTestToDb(
|
||||||
userData.location = DataHolder.location
|
userData: UserData,
|
||||||
|
csvFilePath: String,
|
||||||
|
logTxtFilePath: String,
|
||||||
|
token: String?
|
||||||
|
) {
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
userData.reportUploadTime = SimpleDateFormat(
|
userData.reportUploadTime = SimpleDateFormat(
|
||||||
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
||||||
).format(Calendar.getInstance().time)
|
).format(Calendar.getInstance().time)
|
||||||
when (repository.addTestToDatabase(userData)) {
|
when (repository.addTestToDatabase(userData)) {
|
||||||
is Response.Success -> {
|
is Response.Success -> {
|
||||||
fireBaseUpload.postValue("Success")
|
uploadToMolbio(csvFilePath, logTxtFilePath, token!!)
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {}
|
else -> {}
|
||||||
@@ -540,5 +587,12 @@ class TestRightViewModel @Inject constructor(
|
|||||||
userDao.deleteById(id = userId)
|
userDao.deleteById(id = userId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun login(jsonObject: JsonObject) = viewModelScope.launch {
|
||||||
|
loginResponse.postValue(Result.Loading())
|
||||||
|
repository.login(jsonObject).let {
|
||||||
|
loginResponse.postValue(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -117,7 +117,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginHorizontal="16dp"
|
android:layout_marginHorizontal="16dp"
|
||||||
android:background="@drawable/result_background_green"
|
android:background="@drawable/result_background_green"
|
||||||
android:text="@string/normal"
|
android:text="@string/test_completed"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:drawableStartCompat="@drawable/ic_baseline_check_circle_24"
|
app:drawableStartCompat="@drawable/ic_baseline_check_circle_24"
|
||||||
@@ -241,6 +241,28 @@
|
|||||||
<!-- app:layout_constraintStart_toStartOf="@id/iv_download"-->
|
<!-- app:layout_constraintStart_toStartOf="@id/iv_download"-->
|
||||||
<!-- app:layout_constraintTop_toBottomOf="@id/iv_download" />-->
|
<!-- app:layout_constraintTop_toBottomOf="@id/iv_download" />-->
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:id="@+id/til_blood_group"
|
||||||
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="24dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/cv_sample_details">
|
||||||
|
|
||||||
|
<AutoCompleteTextView
|
||||||
|
android:id="@+id/et_blood_group"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="@string/select_blood_group"
|
||||||
|
android:inputType="none"
|
||||||
|
android:labelFor="@id/til_blood_group"
|
||||||
|
app:simpleItems="@array/blood_group" />
|
||||||
|
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_home"
|
android:id="@+id/iv_home"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@@ -250,7 +272,7 @@
|
|||||||
android:src="@drawable/ic_baseline_home_24"
|
android:src="@drawable/ic_baseline_home_24"
|
||||||
app:layout_constraintEnd_toStartOf="@id/iv_next"
|
app:layout_constraintEnd_toStartOf="@id/iv_next"
|
||||||
app:layout_constraintStart_toStartOf="@id/cv_sample_details"
|
app:layout_constraintStart_toStartOf="@id/cv_sample_details"
|
||||||
app:layout_constraintTop_toBottomOf="@id/cv_sample_details" />
|
app:layout_constraintTop_toBottomOf="@id/til_blood_group" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
style="@style/title2"
|
style="@style/title2"
|
||||||
@@ -274,7 +296,7 @@
|
|||||||
android:src="@drawable/ic_baseline_new_label_24"
|
android:src="@drawable/ic_baseline_new_label_24"
|
||||||
app:layout_constraintEnd_toEndOf="@id/cv_sample_details"
|
app:layout_constraintEnd_toEndOf="@id/cv_sample_details"
|
||||||
app:layout_constraintStart_toEndOf="@id/iv_home"
|
app:layout_constraintStart_toEndOf="@id/iv_home"
|
||||||
app:layout_constraintTop_toBottomOf="@id/cv_sample_details" />
|
app:layout_constraintTop_toBottomOf="@id/til_blood_group" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
style="@style/title2"
|
style="@style/title2"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">HPOS</string>
|
<string name="app_name">HPOS Testing</string>
|
||||||
|
|
||||||
<string-array name="instrument">
|
<string-array name="instrument">
|
||||||
<item>TestRight</item>
|
<item>TestRight</item>
|
||||||
@@ -130,7 +130,7 @@
|
|||||||
<string name="scan_now">Scan Now</string>
|
<string name="scan_now">Scan Now</string>
|
||||||
<string name="enter_abha_number_manualy">Enter ABHA number manualy</string>
|
<string name="enter_abha_number_manualy">Enter ABHA number manualy</string>
|
||||||
<string name="abha_id">ABHA ID</string>
|
<string name="abha_id">ABHA ID</string>
|
||||||
<string name="patient_id_in_tv"><b>Patient ID</b> : %1$s</string>
|
<string name="patient_id_in_tv"><b>User ID</b> : %1$s</string>
|
||||||
<string name="go">GO</string>
|
<string name="go">GO</string>
|
||||||
<string name="click_here">Click Here</string>
|
<string name="click_here">Click Here</string>
|
||||||
<string name="title_activity_dashboard">DashboardActivity</string>
|
<string name="title_activity_dashboard">DashboardActivity</string>
|
||||||
@@ -182,5 +182,7 @@
|
|||||||
<string name="upload">Upload</string>
|
<string name="upload">Upload</string>
|
||||||
<string name="cancel">Cancel</string>
|
<string name="cancel">Cancel</string>
|
||||||
<string name="upload_success_message">Upload done successfully</string>
|
<string name="upload_success_message">Upload done successfully</string>
|
||||||
|
<string name="test_completed">Test Completed</string>
|
||||||
|
<string name="select_blood_group">Select Blood Group</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
Reference in New Issue
Block a user