mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
am 0a57156c
: Don\'t use KeyDrawParams as argument of Key#selectTextSize
* commit '0a57156c07990b024b69100f1729997e61cb86c1': Don't use KeyDrawParams as argument of Key#selectTextSize
This commit is contained in:
commit
b710ca158e
@ -493,21 +493,21 @@ public class Key {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int selectTextSize(KeyboardView.KeyDrawParams params) {
|
public int selectTextSize(int letterSize, int largeLetterSize, int labelSize,
|
||||||
|
int largeLabelSize, int hintLabelSize) {
|
||||||
switch (mLabelFlags & LABEL_FLAGS_FOLLOW_KEY_TEXT_RATIO_MASK) {
|
switch (mLabelFlags & LABEL_FLAGS_FOLLOW_KEY_TEXT_RATIO_MASK) {
|
||||||
case LABEL_FLAGS_FOLLOW_KEY_LARGE_LETTER_RATIO:
|
|
||||||
return params.mKeyLargeLetterSize;
|
|
||||||
case LABEL_FLAGS_FOLLOW_KEY_LETTER_RATIO:
|
case LABEL_FLAGS_FOLLOW_KEY_LETTER_RATIO:
|
||||||
return params.mKeyLetterSize;
|
return letterSize;
|
||||||
|
case LABEL_FLAGS_FOLLOW_KEY_LARGE_LETTER_RATIO:
|
||||||
|
return largeLetterSize;
|
||||||
case LABEL_FLAGS_FOLLOW_KEY_LABEL_RATIO:
|
case LABEL_FLAGS_FOLLOW_KEY_LABEL_RATIO:
|
||||||
return params.mKeyLabelSize;
|
return labelSize;
|
||||||
case LABEL_FLAGS_FOLLOW_KEY_LARGE_LABEL_RATIO:
|
case LABEL_FLAGS_FOLLOW_KEY_LARGE_LABEL_RATIO:
|
||||||
return params.mKeyLargeLabelSize;
|
return largeLabelSize;
|
||||||
case LABEL_FLAGS_FOLLOW_KEY_HINT_LABEL_RATIO:
|
case LABEL_FLAGS_FOLLOW_KEY_HINT_LABEL_RATIO:
|
||||||
return params.mKeyHintLabelSize;
|
return hintLabelSize;
|
||||||
default: // No follow key ratio flag specified.
|
default: // No follow key ratio flag specified.
|
||||||
return StringUtils.codePointCount(mLabel) == 1
|
return StringUtils.codePointCount(mLabel) == 1 ? letterSize : labelSize;
|
||||||
? params.mKeyLetterSize : params.mKeyLabelSize;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -573,7 +573,9 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
|
|||||||
final String label = key.mLabel;
|
final String label = key.mLabel;
|
||||||
// For characters, use large font. For labels like "Done", use smaller font.
|
// For characters, use large font. For labels like "Done", use smaller font.
|
||||||
paint.setTypeface(key.selectTypeface(params.mKeyTextStyle));
|
paint.setTypeface(key.selectTypeface(params.mKeyTextStyle));
|
||||||
final int labelSize = key.selectTextSize(params);
|
final int labelSize = key.selectTextSize(params.mKeyLetterSize,
|
||||||
|
params.mKeyLargeLetterSize, params.mKeyLabelSize, params.mKeyLargeLabelSize,
|
||||||
|
params.mKeyHintLabelSize);
|
||||||
paint.setTextSize(labelSize);
|
paint.setTextSize(labelSize);
|
||||||
final float labelCharHeight = getCharHeight(KEY_LABEL_REFERENCE_CHAR, paint);
|
final float labelCharHeight = getCharHeight(KEY_LABEL_REFERENCE_CHAR, paint);
|
||||||
final float labelCharWidth = getCharWidth(KEY_LABEL_REFERENCE_CHAR, paint);
|
final float labelCharWidth = getCharWidth(KEY_LABEL_REFERENCE_CHAR, paint);
|
||||||
|
Loading…
Reference in New Issue
Block a user