refactor(ui): consolidate keyboard shortcut handling in collection adapter

This commit is contained in:
2026-03-28 20:48:54 +01:00
parent c3f37092de
commit d79d5e15fa

View File

@@ -419,16 +419,14 @@ class CollectionAdapter(
return@setOnKeyListener true return@setOnKeyListener true
} }
} }
KeyEvent.KEYCODE_BACK -> { KeyEvent.KEYCODE_NUMPAD_1, KeyEvent.KEYCODE_1, KeyEvent.KEYCODE_BACK -> {
if (expandedStationPosition == stationViewHolder.bindingAdapterPosition) { if (expandedStationPosition == stationViewHolder.bindingAdapterPosition) {
toggleEditViews(stationViewHolder.bindingAdapterPosition, station.uuid) val position: Int = stationViewHolder.bindingAdapterPosition
toggleEditViews(position, station.uuid)
return@setOnKeyListener true return@setOnKeyListener true
} }
} }
KeyEvent.KEYCODE_NUMPAD_0, KeyEvent.KEYCODE_0, KeyEvent.KEYCODE_DEL -> { KeyEvent.KEYCODE_NUMPAD_0, KeyEvent.KEYCODE_0, KeyEvent.KEYCODE_DEL -> {
if (expandedStationPosition == stationViewHolder.bindingAdapterPosition) {
toggleEditViews(stationViewHolder.bindingAdapterPosition, station.uuid)
}
removeStation(context, stationViewHolder.bindingAdapterPosition) removeStation(context, stationViewHolder.bindingAdapterPosition)
return@setOnKeyListener true return@setOnKeyListener true
} }