Methods Summary |
---|
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.");
}
}
|
private void | createDefaultImageRegion()
if (mRootLayout == null) {
throw new IllegalStateException("Root-Layout uninitialized.");
}
mImageRegion = new RegionModel(IMAGE_REGION_ID, 0, 0,
mRootLayout.getWidth(), mLayoutParams.getImageHeight());
|
private void | createDefaultRootLayout()
mRootLayout = new RegionModel(null, 0, 0, mLayoutParams.getWidth(),
mLayoutParams.getHeight());
|
private void | createDefaultTextRegion()
if (mRootLayout == null) {
throw new IllegalStateException("Root-Layout uninitialized.");
}
mTextRegion = new RegionModel(
TEXT_REGION_ID, 0, mLayoutParams.getImageHeight(),
mRootLayout.getWidth(), mLayoutParams.getTextHeight());
|
public RegionModel | findRegionById(java.lang.String rId)
if (IMAGE_REGION_ID.equals(rId)) {
return mImageRegion;
} else if (TEXT_REGION_ID.equals(rId)) {
return mTextRegion;
} else {
for (RegionModel r : mNonStdRegions) {
if (r.getRegionId().equals(rId)) {
return r;
}
}
if (LOCAL_LOGV) {
Log.v(TAG, "Region not found: " + rId);
}
return null;
}
|
public java.lang.String | getBackgroundColor()
return mRootLayout.getBackgroundColor();
|
public RegionModel | getImageRegion()
return mImageRegion;
|
public int | getLayoutHeight()
return mRootLayout.getHeight();
|
public int | getLayoutType()
return mLayoutType;
|
public int | getLayoutWidth()
return mRootLayout.getWidth();
|
public java.util.ArrayList | getRegions()Get all regions except root-layout. The result is READ-ONLY.
ArrayList<RegionModel> regions = new ArrayList<RegionModel>();
if (mImageRegion != null) {
regions.add(mImageRegion);
}
if (mTextRegion != null) {
regions.add(mTextRegion);
}
return regions;
|
public RegionModel | getRootLayout()
return mRootLayout;
|
public RegionModel | getTextRegion()
return mTextRegion;
|
public boolean | hasNonStdRegions()
return mNonStdRegions.size() > 0;
|
protected void | registerModelChangedObserverInDescendants(IModelChangedObserver observer)
if (mRootLayout != null) {
mRootLayout.registerModelChangedObserver(observer);
}
if (mImageRegion != null) {
mImageRegion.registerModelChangedObserver(observer);
}
if (mTextRegion != null) {
mTextRegion.registerModelChangedObserver(observer);
}
|
public void | setImageRegion(RegionModel imageRegion)
mImageRegion = imageRegion;
|
public void | setRootLayout(RegionModel rootLayout)
mRootLayout = rootLayout;
|
public void | setTextRegion(RegionModel textRegion)
mTextRegion = textRegion;
|
protected void | unregisterAllModelChangedObserversInDescendants()
if (mRootLayout != null) {
mRootLayout.unregisterAllModelChangedObservers();
}
if (mImageRegion != null) {
mImageRegion.unregisterAllModelChangedObservers();
}
if (mTextRegion != null) {
mTextRegion.unregisterAllModelChangedObservers();
}
|
protected void | unregisterModelChangedObserverInDescendants(IModelChangedObserver observer)
if (mRootLayout != null) {
mRootLayout.unregisterModelChangedObserver(observer);
}
if (mImageRegion != null) {
mImageRegion.unregisterModelChangedObserver(observer);
}
if (mTextRegion != null) {
mTextRegion.unregisterModelChangedObserver(observer);
}
|
private void | validateLayouts()
if (mRootLayout == null) {
createDefaultRootLayout();
}
if (mImageRegion == null) {
createDefaultImageRegion();
}
if (mTextRegion == null) {
createDefaultTextRegion();
}
|