|
|
|
@ -89,6 +89,7 @@ import org.mozilla.fenix.ext.alreadyOnDestination
|
|
|
|
|
import org.mozilla.fenix.ext.areNotificationsEnabledSafe
|
|
|
|
|
import org.mozilla.fenix.ext.breadcrumb
|
|
|
|
|
import org.mozilla.fenix.ext.components
|
|
|
|
|
import org.mozilla.fenix.ext.hasTopDestination
|
|
|
|
|
import org.mozilla.fenix.ext.nav
|
|
|
|
|
import org.mozilla.fenix.ext.setNavigationIcon
|
|
|
|
|
import org.mozilla.fenix.ext.settings
|
|
|
|
@ -133,6 +134,7 @@ import org.mozilla.fenix.settings.search.EditCustomSearchEngineFragmentDirection
|
|
|
|
|
import org.mozilla.fenix.settings.studies.StudiesFragmentDirections
|
|
|
|
|
import org.mozilla.fenix.settings.wallpaper.WallpaperSettingsFragmentDirections
|
|
|
|
|
import org.mozilla.fenix.share.AddNewDeviceFragmentDirections
|
|
|
|
|
import org.mozilla.fenix.tabhistory.TabHistoryDialogFragment
|
|
|
|
|
import org.mozilla.fenix.tabstray.TabsTrayFragment
|
|
|
|
|
import org.mozilla.fenix.tabstray.TabsTrayFragmentDirections
|
|
|
|
|
import org.mozilla.fenix.theme.DefaultThemeManager
|
|
|
|
@ -715,9 +717,18 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
|
|
|
|
return super.onKeyDown(keyCode, event)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
final override fun onKeyUp(keyCode: Int, event: KeyEvent?): Boolean {
|
|
|
|
|
final override fun onKeyUp(keyCode: Int, event: KeyEvent): Boolean {
|
|
|
|
|
if (shouldUseCustomBackLongPress() && keyCode == KeyEvent.KEYCODE_BACK) {
|
|
|
|
|
backLongPressJob?.cancel()
|
|
|
|
|
|
|
|
|
|
// check if the key has been pressed for longer than the time needed for a press to turn into a long press
|
|
|
|
|
// and if tab history is already visible we do not want to dismiss it.
|
|
|
|
|
if (event.eventTime - event.downTime >= ViewConfiguration.getLongPressTimeout() &&
|
|
|
|
|
navHost.navController.hasTopDestination(TabHistoryDialogFragment.NAME)
|
|
|
|
|
) {
|
|
|
|
|
// returning true avoids further processing of the KeyUp event and avoids dismissing tab history.
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return super.onKeyUp(keyCode, event)
|
|
|
|
|
}
|
|
|
|
|