Fields Summary |
---|
private static final float | KEY_HEIGHT_RATIO_PORTRAITThe key height for portrait mode. It is relative to the screen height. |
private static final float | KEY_HEIGHT_RATIO_LANDSCAPEThe key height for landscape mode. It is relative to the screen height. |
private static final float | CANDIDATES_AREA_HEIGHT_RATIO_PORTRAITThe height of the candidates area for portrait mode. It is relative to
screen height. |
private static final float | CANDIDATES_AREA_HEIGHT_RATIO_LANDSCAPEThe height of the candidates area for portrait mode. It is relative to
screen height. |
private static final float | KEY_BALLOON_WIDTH_PLUS_RATIOHow much should the balloon width be larger than width of the real key.
It is relative to the smaller one of screen width and height. |
private static final float | KEY_BALLOON_HEIGHT_PLUS_RATIOHow much should the balloon height be larger than that of the real key.
It is relative to the smaller one of screen width and height. |
private static final float | NORMAL_KEY_TEXT_SIZE_RATIOThe text size for normal keys. It is relative to the smaller one of
screen width and height. |
private static final float | FUNCTION_KEY_TEXT_SIZE_RATIOThe text size for function keys. It is relative to the smaller one of
screen width and height. |
private static final float | NORMAL_BALLOON_TEXT_SIZE_RATIOThe text size balloons of normal keys. It is relative to the smaller one
of screen width and height. |
private static final float | FUNCTION_BALLOON_TEXT_SIZE_RATIOThe text size balloons of function keys. It is relative to the smaller
one of screen width and height. |
private static Environment | mInstanceThe configurations are managed in a singleton. |
private int | mScreenWidth |
private int | mScreenHeight |
private int | mKeyHeight |
private int | mCandidatesAreaHeight |
private int | mKeyBalloonWidthPlus |
private int | mKeyBalloonHeightPlus |
private int | mNormalKeyTextSize |
private int | mFunctionKeyTextSize |
private int | mNormalBalloonTextSize |
private int | mFunctionBalloonTextSize |
private android.content.res.Configuration | mConfig |
private boolean | mDebug |
Methods Summary |
---|
public int | getBalloonTextSize(boolean isFunctionKey)
if (isFunctionKey) {
return mFunctionBalloonTextSize;
} else {
return mNormalBalloonTextSize;
}
|
public android.content.res.Configuration | getConfiguration()
return mConfig;
|
public int | getHeightForCandidates()
return mCandidatesAreaHeight;
|
public static com.android.inputmethod.pinyin.Environment | getInstance()
if (null == mInstance) {
mInstance = new Environment();
}
return mInstance;
|
public int | getKeyBalloonHeightPlus()
return mKeyBalloonHeightPlus;
|
public int | getKeyBalloonWidthPlus()
return mKeyBalloonWidthPlus;
|
public int | getKeyHeight()
return mKeyHeight;
|
public int | getKeyTextSize(boolean isFunctionKey)
if (isFunctionKey) {
return mFunctionKeyTextSize;
} else {
return mNormalKeyTextSize;
}
|
public float | getKeyXMarginFactor()
return 1.0f;
|
public float | getKeyYMarginFactor()
if (Configuration.ORIENTATION_LANDSCAPE == mConfig.orientation) {
return 0.7f;
}
return 1.0f;
|
public int | getScreenHeight()
return mScreenHeight;
|
public int | getScreenWidth()
return mScreenWidth;
|
public int | getSkbHeight()
if (Configuration.ORIENTATION_PORTRAIT == mConfig.orientation) {
return mKeyHeight * 4;
} else if (Configuration.ORIENTATION_LANDSCAPE == mConfig.orientation) {
return mKeyHeight * 4;
}
return 0;
|
public boolean | hasHardKeyboard()
if (mConfig.keyboard == Configuration.KEYBOARD_NOKEYS
|| mConfig.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES) {
return false;
}
return true;
|
public boolean | needDebug()
return mDebug;
|
public void | onConfigurationChanged(android.content.res.Configuration newConfig, android.content.Context context)
if (mConfig.orientation != newConfig.orientation) {
WindowManager wm = (WindowManager) context
.getSystemService(Context.WINDOW_SERVICE);
Display d = wm.getDefaultDisplay();
mScreenWidth = d.getWidth();
mScreenHeight = d.getHeight();
int scale;
if (mScreenHeight > mScreenWidth) {
mKeyHeight = (int) (mScreenHeight * KEY_HEIGHT_RATIO_PORTRAIT);
mCandidatesAreaHeight = (int) (mScreenHeight * CANDIDATES_AREA_HEIGHT_RATIO_PORTRAIT);
scale = mScreenWidth;
} else {
mKeyHeight = (int) (mScreenHeight * KEY_HEIGHT_RATIO_LANDSCAPE);
mCandidatesAreaHeight = (int) (mScreenHeight * CANDIDATES_AREA_HEIGHT_RATIO_LANDSCAPE);
scale = mScreenHeight;
}
mNormalKeyTextSize = (int) (scale * NORMAL_KEY_TEXT_SIZE_RATIO);
mFunctionKeyTextSize = (int) (scale * FUNCTION_KEY_TEXT_SIZE_RATIO);
mNormalBalloonTextSize = (int) (scale * NORMAL_BALLOON_TEXT_SIZE_RATIO);
mFunctionBalloonTextSize = (int) (scale * FUNCTION_BALLOON_TEXT_SIZE_RATIO);
mKeyBalloonWidthPlus = (int) (scale * KEY_BALLOON_WIDTH_PLUS_RATIO);
mKeyBalloonHeightPlus = (int) (scale * KEY_BALLOON_HEIGHT_PLUS_RATIO);
}
mConfig.updateFrom(newConfig);
|