Skip to content

Commit

Permalink
Allow certain fields to be copied (#776)
Browse files Browse the repository at this point in the history
  • Loading branch information
dshokouhi committed Aug 16, 2020
1 parent 0e885e7 commit b24574c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,11 @@ class SensorDetailFragment(
val sensorData = sensorManager.getEnabledSensorData(requireContext(), basicSensor.id)

findPreference<Preference>("unique_id")?.let {
it.isCopyingEnabled = true
it.summary = basicSensor.id
}
findPreference<Preference>("state")?.let {
it.isCopyingEnabled = true
when {
sensorData == null ->
it.summary = "Disabled"
Expand All @@ -84,9 +86,11 @@ class SensorDetailFragment(
}
}
findPreference<Preference>("device_class")?.let {
it.isCopyingEnabled = true
it.summary = basicSensor.deviceClass
}
findPreference<Preference>("icon")?.let {
it.isCopyingEnabled = true
it.summary = sensorData?.icon ?: ""
}

Expand All @@ -96,6 +100,7 @@ class SensorDetailFragment(
else {
sensorData?.attributes?.keys?.forEach { key ->
val pref = findPreference("attribute_$key") ?: Preference(requireContext())
pref.isCopyingEnabled = true
pref.key = "attribute_$key"
pref.title = key
pref.summary = sensorData.attributes[key]?.toString() ?: ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ class SettingsFragment : PreferenceFragmentCompat(), SettingsView {
}

findPreference<Preference>("version")?.let {
it.isCopyingEnabled = true
it.summary = BuildConfig.VERSION_NAME
}

Expand Down

0 comments on commit b24574c

Please sign in to comment.