am c0bc3369: Merge "Fix more suggestions text width calculation" into jb-mr1-dev

* commit 'c0bc3369555435c677804b652b5fb36faf3602e5':
  Fix more suggestions text width calculation
main
Tadashi G. Takaoka 2012-10-16 17:26:59 -07:00 committed by Android Git Automerger
commit 658e935ba1
3 changed files with 9 additions and 2 deletions

View File

@ -105,7 +105,7 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
private static final String TAG = KeyboardView.class.getSimpleName();
// XML attributes
private final KeyVisualAttributes mKeyVisualAttributes;
protected final KeyVisualAttributes mKeyVisualAttributes;
private final int mKeyLabelHorizontalPadding;
private final float mKeyHintLetterPadding;
private final float mKeyPopupHintLetterPadding;
@ -733,6 +733,7 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
return width;
}
// TODO: Remove this method.
public float getLabelWidth(final String label, final Paint paint) {
paint.getTextBounds(label, 0, label.length(), mTextBounds);
return mTextBounds.width();

View File

@ -51,10 +51,11 @@ public final class MoreSuggestions extends Keyboard {
super();
}
// TODO: Remove {@link MoreSuggestionsView} argument.
public int layout(final SuggestedWords suggestions, final int fromPos, final int maxWidth,
final int minWidth, final int maxRow, final MoreSuggestionsView view) {
clearKeys();
final Resources res = view.getContext().getResources();
final Resources res = view.getResources();
mDivider = res.getDrawable(R.drawable.more_suggestions_divider);
mDividerWidth = mDivider.getIntrinsicWidth();
final int padding = (int) res.getDimension(
@ -181,6 +182,7 @@ public final class MoreSuggestions extends Keyboard {
load(xmlId, keyboard.mId);
mParams.mVerticalGap = mParams.mTopPadding = keyboard.mVerticalGap / 2;
mPaneView.updateKeyboardGeometry(mParams.mDefaultRowHeight);
final int count = mParams.layout(suggestions, fromPos, maxWidth, minWidth, maxRow,
mPaneView);
mFromPos = fromPos;

View File

@ -105,6 +105,10 @@ public final class MoreSuggestionsView extends KeyboardView implements MoreKeysP
}
}
public void updateKeyboardGeometry(final int keyHeight) {
mKeyDrawParams.updateParams(keyHeight, mKeyVisualAttributes);
}
@Override
public void setKeyboard(Keyboard keyboard) {
super.setKeyboard(keyboard);