Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
*
* Copyright (C) OpenMRS, LLC. All Rights Reserved.
*/
@file:Suppress("DEPRECATION")

package com.openmrs.android_sdk.utilities

import android.content.Context
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ActiveVisitsRecyclerViewAdapter(private val mContext: Context, private val
}

override fun onBindViewHolder(visitViewHolder: VisitViewHolder, position: Int) {
val adapterPos = visitViewHolder.adapterPosition
val adapterPos = visitViewHolder.absoluteAdapterPosition
val visit = this.mVisits?.get(adapterPos)
val patient = PatientDAO().findPatientByID(visit?.patient?.id.toString())
visitViewHolder.mVisitPlace.text = mContext.getString(R.string.visit_in, visit?.location?.display)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
* Copyright (C) OpenMRS, LLC. All Rights Reserved.
*/
package org.openmrs.mobile.activities.formentrypatientlist

import android.content.res.Resources
import android.graphics.drawable.Drawable
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.cardview.widget.CardView
import androidx.core.content.res.ResourcesCompat
import androidx.recyclerview.widget.RecyclerView
import com.openmrs.android_sdk.library.models.Patient
import com.openmrs.android_sdk.library.models.Visit
Expand All @@ -33,15 +35,15 @@ class FormEntryPatientListAdapter(private val mContext: FormEntryPatientListFrag
return PatientViewHolder(itemView)
}

override fun onBindViewHolder(holder: PatientViewHolder, position: Int) {
val adapterPos = holder.adapterPosition
override fun onBindViewHolder(holder: PatientViewHolder, position: Int){
val adapterPos = holder.absoluteAdapterPosition
val patient = this.mItems?.get(position)
VisitDAO().getActiveVisitByPatientId(patient?.id)
.observeOn(AndroidSchedulers.mainThread())
.subscribe { visit: Visit? ->
if (visit != null) {
val icon = mContext.resources.getDrawable(R.drawable.active_visit_dot)
icon.setBounds(0, 0, icon.intrinsicHeight, icon.intrinsicWidth)
val icon:Drawable? = ResourcesCompat.getDrawable(Resources.getSystem(),R.drawable.active_visit_dot,null)
icon?.setBounds(0, 0, icon.intrinsicHeight, icon.intrinsicWidth)
holder.mVisitStatus.setCompoundDrawables(icon, null, null, null)
holder.mVisitStatus.text = mContext.getString(R.string.active_visit_label_capture_vitals)
holder.mRowLayout.setOnClickListener { mContext.startEncounterForPatient(mItems?.get(adapterPos)?.id) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@
*/
package org.openmrs.mobile.utilities

import android.annotation.SuppressLint
import com.openmrs.android_sdk.utilities.DateUtils.getDateFromString
import com.github.mikephil.charting.components.AxisBase
import com.github.mikephil.charting.formatter.IAxisValueFormatter
import com.github.mikephil.charting.formatter.ValueFormatter
import java.text.DateFormat
import java.text.SimpleDateFormat
import kotlin.collections.ArrayList
import kotlin.math.abs

class DayAxisValueFormatter(private val dates: ArrayList<String>) : ValueFormatter(), IAxisValueFormatter {
@Suppress("NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS")
class DayAxisValueFormatter(private val dates: ArrayList<String>) : ValueFormatter() {
@SuppressLint("SimpleDateFormat")
override fun getFormattedValue(value: Float, axis: AxisBase): String {
val intValue = value.toInt()
val vitalDate = getDateFromString(dates[abs(intValue)])
Expand Down