1616
1717public class PagedScrollPane extends ScrollPane {
1818
19+ private static final int CONTENT_SPACING = 50 ;
20+
1921 private boolean wasPanDragFling = false ;
2022
2123 private float lastScrollX = 0 ;
@@ -58,7 +60,7 @@ public void setHomeScreen(HomeScreen homeScreen) {
5860
5961 private void setup () {
6062 content = new Table ();
61- content .defaults ().space (50 );
63+ content .defaults ().space (CONTENT_SPACING );
6264 super .setWidget (content );
6365 Button .debugCellColor = new Color (1 , 1 , 1 , 1.0f );
6466 }
@@ -209,7 +211,7 @@ public int getNumOfPages() {
209211 public int getCurrentPageNumber () {
210212 int pageNumber = 0 ;
211213 if (content .getChildren ().notEmpty ()) {
212- int pageWidth = (int )(content .getChild (0 ).getWidth () + 50 );
214+ int pageWidth = (int )(content .getChild (0 ).getWidth () + CONTENT_SPACING );
213215 pageNumber = Math .round (getScrollX () / pageWidth );
214216 }
215217 return pageNumber ;
@@ -386,6 +388,15 @@ public void prevProgramPage() {
386388 updateSelection (currentSelectionIndex - getProgramsPerPage (), false );
387389 }
388390
391+ /**
392+ * Gets the number of pixels gap between pages.
393+ *
394+ * @return The number of pixels gap between pages.
395+ */
396+ public int getContentSpacing () {
397+ return CONTENT_SPACING ;
398+ }
399+
389400 /**
390401 * This method is used by the key navigation, i.e. when it has calculated a specific
391402 * program index to move to. The navigation keys are used to navigation +/- one
@@ -397,7 +408,8 @@ public void prevProgramPage() {
397408 private void showProgramPage (int programIndex ) {
398409 // Work out how far to move from far left to get to program's page.
399410 int programsPerPage = getProgramsPerPage ();
400- float pageWidth = ViewportManager .getInstance ().isPortrait ()? 1130.0f : 1970.0f ;
411+ float pageWidth = ViewportManager .getInstance ().isPortrait ()?
412+ 1080.0f + CONTENT_SPACING : 1920.0f + CONTENT_SPACING ;
401413 float newScrollX = pageWidth * (programIndex / programsPerPage ) + pageWidth ;
402414
403415 setScrollX (newScrollX );
0 commit comments