// --------------------------------------------------------------------------------------------------------------------
  // Layout
  @Override
  protected void onLayout(boolean changed, int l, int t, int r, int b) {
    if (AphidLog.ENABLE_DEBUG) {
      AphidLog.d("onLayout: %d, %d, %d, %d; child %d", l, t, r, b, bufferedViews.size());
    }

    for (View child : bufferedViews) {
      child.layout(0, 0, r - l, b - t);
    }

    if (changed || contentWidth == 0) {
      int w = r - l;
      int h = b - t;
      surfaceView.layout(0, 0, w, h);

      if (contentWidth != w || contentHeight != h) {
        contentWidth = w;
        contentHeight = h;
      }
    }

    if (bufferedViews.size() >= 1) {
      View frontView = bufferedViews.get(bufferIndex);
      View backView = null;
      if (bufferIndex < bufferedViews.size() - 1) {
        backView = bufferedViews.get(bufferIndex + 1);
      }
      renderer.updateTexture(
          adapterIndex, frontView, backView == null ? -1 : adapterIndex + 1, backView);
    }
  }
Beispiel #2
0
 public void postDestroy() {
   renderer.postDestroyTexture(this);
 }