forked from mozilla-mobile/fenix
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
For mozilla-mobile#24040 - Open search page in portrait mode
When the search event is from the search widget, the search fragment opens after the screen is unlocked. This avoids the issue of the search page opening in landscape mode
- Loading branch information
Showing
3 changed files
with
58 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
app/src/main/java/org/mozilla/fenix/browser/BrowserStore.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.mozilla.fenix.browser | ||
|
||
import mozilla.components.browser.state.action.BrowserAction | ||
import mozilla.components.browser.state.state.BrowserState | ||
import mozilla.components.browser.state.store.BrowserStore | ||
import mozilla.components.feature.media.ext.findActiveMediaTab | ||
import mozilla.components.lib.state.Store | ||
|
||
fun BrowserStore.waitForPIPToClose( | ||
block: () -> Unit | ||
) { | ||
|
||
if (state.findActiveMediaTab() == null || !state.findActiveMediaTab()?.mediaSessionState?.fullscreen!!) { | ||
block() | ||
return | ||
} | ||
|
||
var subscription: Store.Subscription<BrowserState, BrowserAction>? = null | ||
subscription = observeManually { state -> | ||
if (state.findActiveMediaTab() == null || !state.findActiveMediaTab()?.mediaSessionState?.fullscreen!!) { | ||
block() | ||
subscription!!.unsubscribe() | ||
} | ||
} | ||
subscription.resume() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters