Issue #18774: Move SelectionInteractor to new package
The interactor and holder are useful outside of the `library` package, so let's move it up a package level for other components.upstream-sync
parent
233b909b81
commit
499aa858b2
@ -0,0 +1,12 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.fenix.selection
|
||||
|
||||
/**
|
||||
* Contains the selection of items added or removed using the [SelectionInteractor].
|
||||
*/
|
||||
interface SelectionHolder<T> {
|
||||
val selectedItems: Set<T>
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.fenix.selection
|
||||
|
||||
/**
|
||||
* Interactor for items that can be selected on the bookmarks and history screens.
|
||||
*/
|
||||
interface SelectionInteractor<T> {
|
||||
/**
|
||||
* Called when an item is tapped to open it.
|
||||
* @param item the tapped item to open.
|
||||
*/
|
||||
fun open(item: T)
|
||||
|
||||
/**
|
||||
* Called when an item is long pressed and selection mode is started,
|
||||
* or when selection mode has already started an an item is tapped.
|
||||
* @param item the item to select.
|
||||
*/
|
||||
fun select(item: T)
|
||||
|
||||
/**
|
||||
* Called when a selected item is tapped in selection mode and should no longer be selected.
|
||||
* @param item the item to deselect.
|
||||
*/
|
||||
fun deselect(item: T)
|
||||
}
|
Loading…
Reference in New Issue