|
|
@ -5,15 +5,82 @@
|
|
|
|
package org.mozilla.fenix.library.history
|
|
|
|
package org.mozilla.fenix.library.history
|
|
|
|
|
|
|
|
|
|
|
|
import org.mozilla.fenix.browser.browsingmode.BrowsingMode
|
|
|
|
import org.mozilla.fenix.browser.browsingmode.BrowsingMode
|
|
|
|
|
|
|
|
import org.mozilla.fenix.selection.SelectionInteractor
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Interface for the HistoryInteractor. This interface is implemented by objects that want
|
|
|
|
|
|
|
|
* to respond to user interaction on the HistoryView
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
interface HistoryInteractor : SelectionInteractor<HistoryItem> {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Called on backpressed to exit edit mode
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
fun onBackPressed(): Boolean
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Called when the mode is switched so we can invalidate the menu
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
fun onModeSwitched()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Copies the URL of a history item to the copy-paste buffer.
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param item the history item to copy the URL from
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
fun onCopyPressed(item: HistoryItem)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Opens the share sheet for a history item.
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param item the history item to share
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
fun onSharePressed(item: HistoryItem)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Opens a history item in a new tab.
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param item the history item to open in a new tab
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
fun onOpenInNormalTab(item: HistoryItem)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Opens a history item in a private tab.
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param item the history item to open in a private tab
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
fun onOpenInPrivateTab(item: HistoryItem)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Called when delete all is tapped
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
fun onDeleteAll()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Called when multiple history items are deleted
|
|
|
|
|
|
|
|
* @param items the history items to delete
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
fun onDeleteSome(items: Set<HistoryItem>)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Called when the user requests a sync of the history
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
fun onRequestSync()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Called when the user clicks on recently closed tab button.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
fun onRecentlyClosedClicked()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Interactor for the history screen
|
|
|
|
* Interactor for the history screen
|
|
|
|
* Provides implementations for the HistoryViewInteractor
|
|
|
|
* Provides implementations for the HistoryInteractor
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@SuppressWarnings("TooManyFunctions")
|
|
|
|
@SuppressWarnings("TooManyFunctions")
|
|
|
|
class HistoryInteractor(
|
|
|
|
class DefaultHistoryInteractor(
|
|
|
|
private val historyController: HistoryController
|
|
|
|
private val historyController: HistoryController
|
|
|
|
) : HistoryViewInteractor {
|
|
|
|
) : HistoryInteractor {
|
|
|
|
override fun open(item: HistoryItem) {
|
|
|
|
override fun open(item: HistoryItem) {
|
|
|
|
historyController.handleOpen(item)
|
|
|
|
historyController.handleOpen(item)
|
|
|
|
}
|
|
|
|
}
|
|
|
|