title: Navigation with Remote on EPG
body: <p>this is the method to scroll and navigate on my EPG, but i need to navigate with Remote on AndroidTV.</p>
  
  <p>I've read few things about setClickable, setFocusable but its working only on the main screen and i need to give inside to access each cells. </p>
  
  <p>So basically, i need to navigate between cells inside the EPG. </p>
  
  <p>Anyone has any ideas how?</p>
  
  <p>The EPG project is there -> <a href="https://github.com/korre/android-tv-epg" rel="nofollow noreferrer">https://github.com/korre/android-tv-epg</a></p>
  
  <pre><code>private class OnGestureListener extends GestureDetector.SimpleOnGestureListener {
  
      @Override
      public boolean onSingleTapUp(MotionEvent e) {
  
          // This is absolute coordinate on screen not taking scroll into account.
          int x = (int) e.getX();
          int y = (int) e.getY();
  
          // Adding scroll to clicked coordinate
          int scrollX = getScrollX() + x;
          int scrollY = getScrollY() + y;
  
          int channelPosition = getChannelPosition(scrollY);
          if (channelPosition != -1 &amp;&amp; mClickListener != null) {
              if (calculateResetButtonHitArea().contains(scrollX,scrollY)) {
                  // Reset button clicked
                  mClickListener.onResetButtonClicked();
              } else if (calculateChannelsHitArea().contains(x, y)) {
                  // Channel area is clicked
                  /*mClickListener.onChannelClicked(channelPosition, epgData.getChannel(channelPosition));*/
              } else if (calculateProgramsHitArea().contains(x, y)) {
                  // Event area is clicked
                  int programPosition = getProgramPosition(channelPosition, getTimeFrom(getScrollX() + x - calculateProgramsHitArea().left));
                  if (programPosition != -1) {
                      /*mClickListener.onEventClicked(channelPosition, programPosition, epgData.getEvent(channelPosition, programPosition));*/
  
                  }
              }
          }
  
          return true;
      }
  
      @Override
      public boolean onScroll(MotionEvent e1, MotionEvent e2,
                              float distanceX, float distanceY) {
          int dx = (int) distanceX;
          int dy = (int) distanceY;
          int x = getScrollX();
          int y = getScrollY();
  
  
          // Avoid over scrolling
          if (x + dx &lt; 0) {
              dx = 0 - x;
          }
          if (y + dy &lt; 0) {
              dy = 0 - y;
          }
          if (x + dx &gt; mMaxHorizontalScroll) {
              dx = mMaxHorizontalScroll - x;
          }
          if (y + dy &gt; mMaxVerticalScroll) {
              dy = mMaxVerticalScroll - y;
          }
  
          scrollBy(dx, dy);
          return true;
      }
  
      @Override
      public boolean onFling(MotionEvent e1, MotionEvent e2,
                             float vX, float vY) {
  
          mScroller.fling(getScrollX(), getScrollY(), -(int) vX,
                  -(int) vY, 0, mMaxHorizontalScroll, 0, mMaxVerticalScroll);
  
          redraw();
          return true;
      }
  
      @Override
      public boolean onDown(MotionEvent e) {
          if (!mScroller.isFinished()) {
              mScroller.forceFinished(true);
              return true;
          }
          return true;
      }
  }
  }
  </code></pre>