-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v6 settings reorganization #986
base: fields_modifications
Are you sure you want to change the base?
Conversation
|
@chaneylc Should all be addressed now, ready for re-review or merge. Most of the xml arrays were already starting at 0, I moved the rest to 0 for consistency, and because 0 as default/disabled seemed more intuitive as well. But yeah unfortunately missed some hardcoded config and theme activity references, thanks for catching the resulting bugs. |
|
The visibility problem was because I'd changed the order/indexes of the collection level options, but not realized they were also hardcoded in the companion object |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't refactor preference keys, this will cause existing preference choices to be erased after the update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, yeah it seems best to avoid erasing settings if possible. But I'm not sure how best to reconcile that with last instruction in the ticket to Swap disable sharing for enable file sharing
Seems either we don't swap, or we do and the pref key has to change as well, or we have to treat the Enable File Sharing checkbox value as a dummy value and then manually set the DisableShare pref key to the opposite of the checkbox value in the pref code.
I'm not a fan of the third solution, and if we still want the swap I don't think having the share pref reset to enabled for whatever users had disabled it isn't too bad of an update side effect. @trife any thoughts?
@@ -39,23 +39,36 @@ class GeoNavPreferencesFragment : PreferenceFragmentCompat(), | |||
SharedPreferences.OnSharedPreferenceChangeListener { sharedPreferences, key -> | |||
updateUi() | |||
} | |||
companion object { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know I've done this similarly in the past but I think it would be more descriptive to use enum classes here and in the future instead. This is relevant for any array resources with integer values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha. I copied those over from the old generalpreferences fragment when merging location prefs into the new location preferences fragment. But I see what you/re saying. Not sure if it makes sense to add the enum conversions to the scope of this PR though, maybe it'd be better to make it a separate ticket?
And if we want to convert all array resources with integer vlaues, what would that look like? Something like this?
package com.fieldbook.tracker.enums
import com.fieldbook.tracker.R
enum class LocationCollectionMode(val value: Int, val labelResId: Int) {
OFF(0, R.string.location_level_off),
STUDY(1, R.string.location_level_study),
OBS_UNIT(2, R.string.location_level_observation_unit),
OBS(3, R.string.location_level_observation);
companion object {
fun fromValue(value: Int): LocationCollectionMode? = values().find { it.value == value }
}
}
Then the enums could used to populate preferences programatically like this (in addition to checking preference values in other parts of the app)
val locationModePreference = findPreference<ListPreference>("com.fieldbook.tracker.GENERAL_LOCATION_COLLECTION")
val locationModes = LocationCollectionMode.values()
locationModePreference?.entries = locationModes.map { getString(it.labelResId) }.toTypedArray()
locationModePreference?.entryValues = locationModes.map { it.value.toString() }.toTypedArray()
app/src/main/java/com/fieldbook/tracker/preferences/BrapiPreferencesFragment.java
Show resolved
Hide resolved
Addressed most of these in the latest commits. For the location collection format question, yes, from what I see it applies just to what gets stored in the observation table's geoCoordinates column for each observation, not to the observation values for location or gnss traits. For the two unchecked items: 1- Whats the ideal interaction of the person prefs? The overlap between the 3 prefs is a bit confusing to me. What about reducing to two prefs? Just the person name entry, and if a name is entered also show the verification interval with no verificiation, every time app opens, 12 hr, and 24hr as the options (default to no verification?). Require seems uncessary since once person is set it does not get unset, the main issue is to ensure it switches when the actual operator switches, which the verification interval pref handles well. Some other thoughts that are probably out of scope here but I think would be useful enhancements
2- Not sure what needs addressing here, aren't all the boolean settings like that (sounds for example) handled with checkboxes, not dialogs? Is the idea that the sound checkbox preferences don't need summaries, just titles? |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Move directory definition and database settings to a Storage section below BrAPI and use this icon
- Add new section Features above Appearance
- Move Datagrid, Next Entry, Move to Unique ID, Tutorial to Features
- Merge Collect Toolbar into Collect Screen section
- Move crashlytics to System
- Change location provider icon
- Rename Toolbar Features to Toolbar Actions
- Replace swap navigation icon
- Update dialogs to use action words for positive buttons (e.g. Enable vs OK)
- Move System to below BrAPI, above Storage
Description
Provide a summary of your changes including motivation and context.
If these changes fix a bug or resolves a feature request, be sure to link to that issue.
Reorganizes settings according to #850 checklist
Closes #850
Type of change
What type of changes does your code introduce? Put an
x
in boxes that apply.CHANGE
(fix or feature that would cause existing functionality to not work as expected)FEATURE
(non-breaking change which adds functionality)BUGFIX
(non-breaking change which fixes an issue)ENHANCEMENT
(non-breaking change which improves existing functionality)NONE
(if none of the other choices apply. Example, tooling, build system, CI, docs, etc.)Checklist:
Changelog entry
Please add a one-line changelog entry below. This will be copied to the changelog file during the release process.