Skip to content
This repository has been archived by the owner on Apr 17, 2021. It is now read-only.

Commit

Permalink
Issue #1664 - Different split behavior for homescreen and webpage
Browse files Browse the repository at this point in the history
  • Loading branch information
liuche committed Feb 23, 2019
1 parent 9cb2bee commit 53b648a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/src/main/java/org/mozilla/tv/firefox/ScreenController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,13 @@ class ScreenController {
transaction.show(overlayFragment)
MenuInteractionMonitor.menuOpened()
overlayFragment.navUrlInput.requestFocus()
overlayFragment.navOverlayScrollView.updateOverlayForHomescreen(isOnHomeUrl(fragmentManager))
} else {
transaction.hide(overlayFragment)
MenuInteractionMonitor.menuClosed()
renderFragment.view?.requestFocus()
}

transaction.commit()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import android.view.ViewGroup
import android.widget.ScrollView
import android.widget.Toast
import kotlinx.android.synthetic.main.fragment_navigation_overlay.*
import kotlinx.android.synthetic.main.fragment_navigation_overlay.view.*
import kotlinx.android.synthetic.main.fragment_navigation_overlay_top_nav.*
import kotlinx.android.synthetic.main.pocket_video_mega_tile.*
import kotlinx.coroutines.Job
Expand Down Expand Up @@ -410,6 +411,8 @@ class NavigationOverlayFragment : Fragment() {
* clicks up twice quickly), it will skip and not scroll smoothly. Since we don't scroll often,
* this seems fine.
*/
private const val OVERLAY_SPACER_HOMESCREEN_HEIGHT = 393
private const val OVERLAY_SPACER_WEBRENDER_HEIGHT = 800
class BrowserNavigationOverlayScrollView(
context: Context,
attrs: AttributeSet
Expand All @@ -426,4 +429,13 @@ class BrowserNavigationOverlayScrollView(
val deltaScrollForOnScreen = super.computeScrollDeltaToGetChildRectOnScreen(rect)
return deltaScrollForOnScreen + deltaScrollPadding * Integer.signum(deltaScrollForOnScreen)
}

fun updateOverlayForHomescreen(isHomescreen: Boolean) {
val windowSpacerHeight = if (isHomescreen) OVERLAY_SPACER_HOMESCREEN_HEIGHT else OVERLAY_SPACER_WEBRENDER_HEIGHT
overlayWindowSpacer.apply {
layoutParams.height = windowSpacerHeight
requestLayout()
}
scrollY = 0
}
}
3 changes: 2 additions & 1 deletion app/src/main/res/layout/fragment_navigation_overlay.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@
android:orientation="vertical">

<View
android:id="@+id/overlayWindowSpacer"
android:layout_width="match_parent"
android:layout_height="412dp"/>
android:layout_height="196dp"/>

<LinearLayout
android:id="@+id/overlayBottomHalf"
Expand Down

0 comments on commit 53b648a

Please sign in to comment.