am 6d998b36: am da9408c8: am 984aa60e: Merge "Extend hitbox of emoji keys"
* commit '6d998b36357f974b80511fd99039ae8847b5e500': Extend hitbox of emoji keysmain
commit
16dfdf755e
|
@ -42,7 +42,6 @@ public class DynamicGridKeyboard extends Keyboard {
|
||||||
private final Object mLock = new Object();
|
private final Object mLock = new Object();
|
||||||
|
|
||||||
private final SharedPreferences mPrefs;
|
private final SharedPreferences mPrefs;
|
||||||
private final int mLeftPadding;
|
|
||||||
private final int mHorizontalStep;
|
private final int mHorizontalStep;
|
||||||
private final int mVerticalStep;
|
private final int mVerticalStep;
|
||||||
private final int mColumnsNum;
|
private final int mColumnsNum;
|
||||||
|
@ -58,7 +57,6 @@ public class DynamicGridKeyboard extends Keyboard {
|
||||||
super(templateKeyboard);
|
super(templateKeyboard);
|
||||||
final Key key0 = getTemplateKey(TEMPLATE_KEY_CODE_0);
|
final Key key0 = getTemplateKey(TEMPLATE_KEY_CODE_0);
|
||||||
final Key key1 = getTemplateKey(TEMPLATE_KEY_CODE_1);
|
final Key key1 = getTemplateKey(TEMPLATE_KEY_CODE_1);
|
||||||
mLeftPadding = key0.getX();
|
|
||||||
mHorizontalStep = Math.abs(key1.getX() - key0.getX());
|
mHorizontalStep = Math.abs(key1.getX() - key0.getX());
|
||||||
mVerticalStep = key0.getHeight() + mVerticalGap;
|
mVerticalStep = key0.getHeight() + mVerticalGap;
|
||||||
mColumnsNum = mBaseWidth / mHorizontalStep;
|
mColumnsNum = mBaseWidth / mHorizontalStep;
|
||||||
|
@ -122,9 +120,11 @@ public class DynamicGridKeyboard extends Keyboard {
|
||||||
}
|
}
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (final GridKey gridKey : mGridKeys) {
|
for (final GridKey gridKey : mGridKeys) {
|
||||||
final int keyX = getKeyX(index);
|
final int keyX0 = getKeyX0(index);
|
||||||
final int keyY = getKeyY(index);
|
final int keyY0 = getKeyY0(index);
|
||||||
gridKey.updateCorrdinates(keyX, keyY);
|
final int keyX1 = getKeyX1(index);
|
||||||
|
final int keyY1 = getKeyY1(index);
|
||||||
|
gridKey.updateCorrdinates(keyX0, keyY0, keyX1, keyY1);
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -172,14 +172,24 @@ public class DynamicGridKeyboard extends Keyboard {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getKeyX(final int index) {
|
private int getKeyX0(final int index) {
|
||||||
final int column = index % mColumnsNum;
|
final int column = index % mColumnsNum;
|
||||||
return column * mHorizontalStep + mLeftPadding;
|
return column * mHorizontalStep;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getKeyY(final int index) {
|
private int getKeyX1(final int index) {
|
||||||
|
final int column = index % mColumnsNum + 1;
|
||||||
|
return column * mHorizontalStep;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getKeyY0(final int index) {
|
||||||
final int row = index / mColumnsNum;
|
final int row = index / mColumnsNum;
|
||||||
return row * mVerticalStep + mTopPadding;
|
return row * mVerticalStep;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getKeyY1(final int index) {
|
||||||
|
final int row = index / mColumnsNum + 1;
|
||||||
|
return row * mVerticalStep;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -207,10 +217,10 @@ public class DynamicGridKeyboard extends Keyboard {
|
||||||
super(originalKey);
|
super(originalKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateCorrdinates(final int x, final int y) {
|
public void updateCorrdinates(final int x0, final int y0, final int x1, final int y1) {
|
||||||
mCurrentX = x;
|
mCurrentX = x0;
|
||||||
mCurrentY = y;
|
mCurrentY = y0;
|
||||||
getHitBox().set(x, y, x + getWidth(), y + getHeight());
|
getHitBox().set(x0, y0, x1, y1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue