am 4f7f6173: Make Keyboard.setShifted return void
* commit '4f7f61730cbd45871c1e9044da84b494831f97c3': Make Keyboard.setShifted return voidmain
commit
c7e0281a09
|
@ -167,20 +167,14 @@ public class Keyboard {
|
||||||
return !mShiftLockKeys.isEmpty();
|
return !mShiftLockKeys.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean setShiftLocked(boolean newShiftLockState) {
|
public void setShiftLocked(boolean newShiftLockState) {
|
||||||
for (final Key key : mShiftLockKeys) {
|
for (final Key key : mShiftLockKeys) {
|
||||||
// To represent "shift locked" state. The highlight is handled by background image that
|
// To represent "shift locked" state. The highlight is handled by background image that
|
||||||
// might be a StateListDrawable.
|
// might be a StateListDrawable.
|
||||||
key.setHighlightOn(newShiftLockState);
|
key.setHighlightOn(newShiftLockState);
|
||||||
// To represent "shifted" state. The key might have a shifted icon.
|
key.setIcon(newShiftLockState ? mShiftedIcons.get(key) : mUnshiftedIcons.get(key));
|
||||||
if (newShiftLockState && mShiftedIcons.containsKey(key)) {
|
|
||||||
key.setIcon(mShiftedIcons.get(key));
|
|
||||||
} else {
|
|
||||||
key.setIcon(mUnshiftedIcons.get(key));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
mShiftState.setShiftLocked(newShiftLockState);
|
mShiftState.setShiftLocked(newShiftLockState);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isShiftLocked() {
|
public boolean isShiftLocked() {
|
||||||
|
@ -191,15 +185,13 @@ public class Keyboard {
|
||||||
return mShiftState.isShiftLockShifted();
|
return mShiftState.isShiftLockShifted();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean setShifted(boolean newShiftState) {
|
public void setShifted(boolean newShiftState) {
|
||||||
|
if (!mShiftState.isShiftLocked()) {
|
||||||
for (final Key key : mShiftKeys) {
|
for (final Key key : mShiftKeys) {
|
||||||
if (!newShiftState && !mShiftState.isShiftLocked()) {
|
key.setIcon(newShiftState ? mShiftedIcons.get(key) : mUnshiftedIcons.get(key));
|
||||||
key.setIcon(mUnshiftedIcons.get(key));
|
|
||||||
} else if (newShiftState && !mShiftState.isShiftedOrShiftLocked()) {
|
|
||||||
key.setIcon(mShiftedIcons.get(key));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return mShiftState.setShifted(newShiftState);
|
mShiftState.setShifted(newShiftState);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isShiftedOrShiftLocked() {
|
public boolean isShiftedOrShiftLocked() {
|
||||||
|
|
|
@ -421,7 +421,6 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
return;
|
return;
|
||||||
if (shiftMode == AUTOMATIC_SHIFT) {
|
if (shiftMode == AUTOMATIC_SHIFT) {
|
||||||
latinKeyboard.setAutomaticTemporaryUpperCase();
|
latinKeyboard.setAutomaticTemporaryUpperCase();
|
||||||
mKeyboardView.invalidateAllKeys();
|
|
||||||
} else {
|
} else {
|
||||||
final boolean shifted = (shiftMode == MANUAL_SHIFT);
|
final boolean shifted = (shiftMode == MANUAL_SHIFT);
|
||||||
// On non-distinct multi touch panel device, we should also turn off the shift locked
|
// On non-distinct multi touch panel device, we should also turn off the shift locked
|
||||||
|
@ -431,15 +430,15 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
if (!hasDistinctMultitouch() && !shifted && latinKeyboard.isShiftLocked()) {
|
if (!hasDistinctMultitouch() && !shifted && latinKeyboard.isShiftLocked()) {
|
||||||
latinKeyboard.setShiftLocked(false);
|
latinKeyboard.setShiftLocked(false);
|
||||||
}
|
}
|
||||||
if (latinKeyboard.setShifted(shifted)) {
|
latinKeyboard.setShifted(shifted);
|
||||||
|
}
|
||||||
mKeyboardView.invalidateAllKeys();
|
mKeyboardView.invalidateAllKeys();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setShiftLocked(boolean shiftLocked) {
|
private void setShiftLocked(boolean shiftLocked) {
|
||||||
LatinKeyboard latinKeyboard = getLatinKeyboard();
|
LatinKeyboard latinKeyboard = getLatinKeyboard();
|
||||||
if (latinKeyboard != null && latinKeyboard.setShiftLocked(shiftLocked)) {
|
if (latinKeyboard != null) {
|
||||||
|
latinKeyboard.setShiftLocked(shiftLocked);
|
||||||
mKeyboardView.invalidateAllKeys();
|
mKeyboardView.invalidateAllKeys();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,10 +132,9 @@ public class MiniKeyboardView extends KeyboardView implements MoreKeysPanel {
|
||||||
@Override
|
@Override
|
||||||
public void setShifted(boolean shifted) {
|
public void setShifted(boolean shifted) {
|
||||||
final Keyboard keyboard = getKeyboard();
|
final Keyboard keyboard = getKeyboard();
|
||||||
if (keyboard.setShifted(shifted)) {
|
keyboard.setShifted(shifted);
|
||||||
invalidateAllKeys();
|
invalidateAllKeys();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showMoreKeysPanel(View parentView, Controller controller, int pointX, int pointY,
|
public void showMoreKeysPanel(View parentView, Controller controller, int pointX, int pointY,
|
||||||
|
|
|
@ -24,6 +24,7 @@ public interface MoreKeysPanel extends PointerTracker.KeyEventHandler {
|
||||||
public boolean dismissMoreKeysPanel();
|
public boolean dismissMoreKeysPanel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Remove this method.
|
||||||
public void setShifted(boolean shifted);
|
public void setShifted(boolean shifted);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class KeyboardShiftState {
|
||||||
|
|
||||||
private int mState = NORMAL;
|
private int mState = NORMAL;
|
||||||
|
|
||||||
public boolean setShifted(boolean newShiftState) {
|
public void setShifted(boolean newShiftState) {
|
||||||
final int oldState = mState;
|
final int oldState = mState;
|
||||||
if (newShiftState) {
|
if (newShiftState) {
|
||||||
switch (oldState) {
|
switch (oldState) {
|
||||||
|
@ -61,7 +61,6 @@ public class KeyboardShiftState {
|
||||||
}
|
}
|
||||||
if (DEBUG)
|
if (DEBUG)
|
||||||
Log.d(TAG, "setShifted(" + newShiftState + "): " + toString(oldState) + " > " + this);
|
Log.d(TAG, "setShifted(" + newShiftState + "): " + toString(oldState) + " > " + this);
|
||||||
return mState != oldState;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setShiftLocked(boolean newShiftLockState) {
|
public void setShiftLocked(boolean newShiftLockState) {
|
||||||
|
|
Loading…
Reference in New Issue