Bug 831781 - Some touchups to the code to make it more consistent and robust. r=Cwiiis

This commit is contained in:
Kartikaya Gupta 2013-03-01 22:50:49 -05:00
parent 71282129b7
commit 4689b105c7

View File

@ -207,7 +207,9 @@ public class LayerView extends FrameLayout {
}
public void abortPanning() {
mLayerClient.getPanZoomController().abortPanning();
if (mPanZoomController != null) {
mPanZoomController.abortPanning();
}
}
public PointF convertViewPointToLayerPoint(PointF viewPoint) {
@ -249,38 +251,44 @@ public class LayerView extends FrameLayout {
@Override
public boolean onKeyPreIme(int keyCode, KeyEvent event) {
if (mInputConnectionHandler != null)
return mInputConnectionHandler.onKeyPreIme(keyCode, event);
if (mInputConnectionHandler != null && mInputConnectionHandler.onKeyPreIme(keyCode, event)) {
return true;
}
return false;
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (mPanZoomController != null && mPanZoomController.onKeyEvent(event))
if (mPanZoomController != null && mPanZoomController.onKeyEvent(event)) {
return true;
if (mInputConnectionHandler != null)
return mInputConnectionHandler.onKeyDown(keyCode, event);
}
if (mInputConnectionHandler != null && mInputConnectionHandler.onKeyDown(keyCode, event)) {
return true;
}
return false;
}
@Override
public boolean onKeyLongPress(int keyCode, KeyEvent event) {
if (mInputConnectionHandler != null)
return mInputConnectionHandler.onKeyLongPress(keyCode, event);
if (mInputConnectionHandler != null && mInputConnectionHandler.onKeyLongPress(keyCode, event)) {
return true;
}
return false;
}
@Override
public boolean onKeyMultiple(int keyCode, int repeatCount, KeyEvent event) {
if (mInputConnectionHandler != null)
return mInputConnectionHandler.onKeyMultiple(keyCode, repeatCount, event);
if (mInputConnectionHandler != null && mInputConnectionHandler.onKeyMultiple(keyCode, repeatCount, event)) {
return true;
}
return false;
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (mInputConnectionHandler != null)
return mInputConnectionHandler.onKeyUp(keyCode, event);
if (mInputConnectionHandler != null && mInputConnectionHandler.onKeyUp(keyCode, event)) {
return true;
}
return false;
}
@ -480,14 +488,16 @@ public class LayerView extends FrameLayout {
@Override
public void setOverScrollMode(int overscrollMode) {
super.setOverScrollMode(overscrollMode);
if (mLayerClient != null)
mLayerClient.getPanZoomController().setOverScrollMode(overscrollMode);
if (mPanZoomController != null) {
mPanZoomController.setOverScrollMode(overscrollMode);
}
}
@Override
public int getOverScrollMode() {
if (mLayerClient != null)
return mLayerClient.getPanZoomController().getOverScrollMode();
if (mPanZoomController != null) {
return mPanZoomController.getOverScrollMode();
}
return super.getOverScrollMode();
}