Exemple #1
0
  private void createDefaultImageRegion() {
    if (mRootLayout == null) {
      throw new IllegalStateException("Root-Layout uninitialized.");
    }

    mImageRegion =
        new RegionModel(
            IMAGE_REGION_ID, 0, 0, mRootLayout.getWidth(), mLayoutParams.getImageHeight());
  }
Exemple #2
0
  public void changeTo(int layout) {
    if (mRootLayout == null) {
      throw new IllegalStateException("Root-Layout uninitialized.");
    }

    if (mLayoutParams == null) {
      mLayoutParams = LayoutManager.getInstance().getLayoutParameters();
    }

    if (mLayoutType != layout) {
      switch (layout) {
        case LAYOUT_BOTTOM_TEXT:
          {
            mImageRegion.setTop(0);
            mTextRegion.setTop(mLayoutParams.getImageHeight());
            mLayoutType = layout;
            notifyModelChanged(true);
          }
          break;
        case LAYOUT_TOP_TEXT:
          {
            mImageRegion.setTop(mLayoutParams.getTextHeight());
            mTextRegion.setTop(0);
            mLayoutType = layout;
            notifyModelChanged(true);
          }
          break;
        default:
          {
            Log.w(TAG, "Unknown layout type: " + layout);
          }
      }
    } else {
      if (LOCAL_LOGV) {
        Log.v(TAG, "Skip changing layout.");
      }
    }
  }