Android Automotive: Limit to eight entrys on any list
See original GitHub issueI’ve noticed that AAOS only allows 8 rows in a list on any screen, dictated by the constraintManager. This means there are 3 filter settings missing and also only 8 filter profiles can be displayed.
The showcase demo app adds a “more”-button to the top right when a list contains more than 8 rows and pushes a new screen to display a new page. I understand that AAOS limits the top right Actions to two. Since those two slots are occupied by other actions it is not possible to add any actions to that area of the screen.
I would suggest to use one row int the EditFiltersScreen to go to a second page to make all filters accessible.
This would be my suggestion:
private fun buildFiltersList(filters: List<FilterWithValue<out FilterValue>>): ItemList {
var subtractor = 0
var sub_filters = filters
// check if list fits on screen
if (filters.size - start_index > maxRows) {
subtractor = 1
sub_filters = filters.subList(start_index, start_index + maxRows - subractor - 1)
}
return ItemList.Builder().apply {
if (subtractor > 0) {
// if it does not fit, insert button for next page
addItem(Row.Builder().apply {
setTitle("More Filters")
// Insert forward Icon here
setOnClickListener {
screenManager.push(EditFiltersScreen(getCarContext(), start_index + maxRows - subtractor) )
}
})
}
sub_filters.forEach {
//...
EditFiltersScreen would get a new argument to specify where to start if it is another page:
class EditFiltersScreen(ctx: CarContext, start_index: int = 0) : Screen(ctx) {
I can’t test the code myself currently so I don’t know if it works at all. Also I have next to no Kotlin experience. But it should show my train of tought.
Showing more than 8 filter profiles would propably be more complex as it is a selection list. Right now if you save a new profile others get pushed out. They are saved but not selectable and there is no info to the user about this happening.
Issue Analytics
- State:
- Created a year ago
- Comments:7 (7 by maintainers)
Top GitHub Comments
I see, I overlooked that. How about rearranging the filters in a way so that multiple choice filters are always on the first page? If I counted correctly there are currently four multiple choice filters (connector types, operators, providers and categorys). Those would fit on one page and there would be 3 more slots for possible future multiple choice filters.
And another idea: Since the search is going to be moved on the map screen you could move the delete button down one layer freeing up space for one more filter on the first page:
Edit: I completely overread that one paragraph where you essentially say exactly that … 🙈
Yep, thanks!