Skip to content

Commit

Permalink
refactor: Rename PidDefinitionWrapper to PidDefinitionDetails
Browse files Browse the repository at this point in the history
  • Loading branch information
tzebrowski committed Aug 29, 2023
1 parent 449bc0e commit 4fa3e65
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ private const val FILTER_BY_ECU_SUPPORTED_PIDS_PREF = "pref.pids.registry.filter
private const val FILTER_BY_STABLE_PIDS_PREF = "pref.pids.registry.filter_pids_stable"


data class PidDefinitionWrapper(val source: PidDefinition, var checked: Boolean = false, var supported: Boolean = true)
data class PidDefinitionDetails(val source: PidDefinition, var checked: Boolean = false, var supported: Boolean = true)


class PIDsListPreferenceDialog(private val key: String, private val priority: String) : DialogFragment() {
Expand Down Expand Up @@ -89,7 +89,7 @@ class PIDsListPreferenceDialog(private val key: String, private val priority: St
.map { it.source.id.toString() }.toList()


private fun findPidDefinitionByPriority(predicate: (PidDefinition) -> Boolean): List<PidDefinitionWrapper> {
private fun findPidDefinitionByPriority(predicate: (PidDefinition) -> Boolean): List<PidDefinitionDetails> {

val ecuSupportedPIDs = vehicleCapabilitiesManager.getCapabilities()
val ecuSupportedPIDsEnabled = Prefs.getBoolean(FILTER_BY_ECU_SUPPORTED_PIDS_PREF, false)
Expand All @@ -100,7 +100,7 @@ class PIDsListPreferenceDialog(private val key: String, private val priority: St
.filter { p -> p.group == PIDsGroup.LIVEDATA }
.filter { p -> if (!stablePIDsEnabled) p.stable!! else true }
.filter { p -> predicate.invoke(p) }
.map { p -> PidDefinitionWrapper(source=p, supported=isSupported(ecuSupportedPIDs, p))}
.map { p -> PidDefinitionDetails(source=p, supported=isSupported(ecuSupportedPIDs, p))}
.filter { p-> if (ecuSupportedPIDsEnabled) true else p.supported }
.toList()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import org.obd.graphs.ui.common.setText

class PIDsViewAdapter internal constructor(
context: Context?,
var data: List<PidDefinitionWrapper>
var data: List<PidDefinitionDetails>
) : RecyclerView.Adapter<PIDsViewAdapter.ViewHolder>() {

private val mInflater: LayoutInflater = LayoutInflater.from(context)
Expand All @@ -37,7 +37,7 @@ class PIDsViewAdapter internal constructor(
) {
data.elementAt(position).run {
holder.mode.setText(source.resourceFile, COLOR_PHILIPPINE_GREEN, Typeface.NORMAL, 0.7f)
holder.name.setText(source.description, Color.GRAY, Typeface.NORMAL, 1f)
holder.name.setText(source.description, COLOR_RAINBOW_INDIGO, Typeface.NORMAL, 1f)

if (source.stable) {
holder.status.setText("Yes", Color.GRAY, Typeface.NORMAL, 0.8f)
Expand All @@ -46,7 +46,7 @@ class PIDsViewAdapter internal constructor(
}

if (supported) {
holder.supported.setText("Yes", COLOR_RAINBOW_INDIGO, Typeface.NORMAL, 0.8f)
holder.supported.setText("Yes", Color.GRAY, Typeface.NORMAL, 0.8f)
} else {
holder.supported.setText("No", COLOR_DYNAMIC_SELECTOR_SPORT, Typeface.NORMAL, 0.8f)
}
Expand Down
Binary file modified res/aa_1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/aa_2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/aa_3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4fa3e65

Please sign in to comment.