FileDocCategorySizeDatePackage
LayoutManager.javaAPI DocAndroid 1.5 API3450Wed May 06 22:42:46 BST 2009com.android.mms.layout

LayoutManager

public class LayoutManager extends Object
MMS presentation layout management.

Fields Summary
private static final String
TAG
private static final boolean
DEBUG
private static final boolean
LOCAL_LOGV
private final android.content.Context
mContext
private LayoutParameters
mLayoutParams
private static LayoutManager
sInstance
Constructors Summary
private LayoutManager(android.content.Context context)


       
        mContext = context;
        initLayoutParameters(context.getResources().getConfiguration());
    
Methods Summary
public static com.android.mms.layout.LayoutManagergetInstance()

        if (sInstance == null) {
            throw new IllegalStateException("Uninitialized.");
        }
        return sInstance;
    
public intgetLayoutHeight()

        return mLayoutParams.getHeight();
    
public LayoutParametersgetLayoutParameters()

        return mLayoutParams;
    
private static LayoutParametersgetLayoutParameters(int displayType)

        switch (displayType) {
            case LayoutParameters.HVGA_LANDSCAPE:
                return new HVGALayoutParameters(LayoutParameters.HVGA_LANDSCAPE);
            case LayoutParameters.HVGA_PORTRAIT:
                return new HVGALayoutParameters(LayoutParameters.HVGA_PORTRAIT);
        }

        throw new IllegalArgumentException(
                "Unsupported display type: " + displayType);
    
public intgetLayoutType()

        return mLayoutParams.getType();
    
public intgetLayoutWidth()

        return mLayoutParams.getWidth();
    
public static voidinit(android.content.Context context)

        if (LOCAL_LOGV) {
            Log.v(TAG, "DefaultLayoutManager.init()");
        }

        if (sInstance != null) {
            Log.w(TAG, "Already initialized.");
        }
        sInstance = new LayoutManager(context);
    
private voidinitLayoutParameters(android.content.res.Configuration configuration)

        mLayoutParams = getLayoutParameters(
                configuration.orientation == Configuration.ORIENTATION_PORTRAIT
                ? LayoutParameters.HVGA_PORTRAIT
                : LayoutParameters.HVGA_LANDSCAPE);

        if (LOCAL_LOGV) {
            Log.v(TAG, "LayoutParameters: " + mLayoutParams.getTypeDescription()
                    + ": " + mLayoutParams.getWidth() + "x" + mLayoutParams.getHeight());
        }
    
public voidonConfigurationChanged(android.content.res.Configuration newConfig)

        if (LOCAL_LOGV) {
            Log.v(TAG, "-> LayoutManager.onConfigurationChanged().");
        }
        initLayoutParameters(newConfig);