in PoC/android/app/src/main/java/com/epam/crowdresitance/ui/ScanResultAdapter.kt [51:71]
override fun getView(position: Int, currentView: View?, parent: ViewGroup?): View? {
var view: View? = currentView
if (view == null) {
view = inflater.inflate(R.layout.listitem_scanresult, null)
}
val deviceNameView = view!!.findViewById(R.id.device_name) as TextView
val deviceAddressView = view.findViewById(R.id.device_address) as TextView
val lastSeenView = view.findViewById(R.id.last_seen) as TextView
val scanResult: BtScanResult = btScanResults[position]
var name: String? = scanResult.userId
if (name.isNullOrBlank()) {
name = context.resources.getString(R.string.no_name)
}
deviceNameView.text = name
deviceAddressView.text = scanResult.macAddress
lastSeenView.text = getTimeSinceString(
context,
scanResult.lastSeen
)
return view
}