Hacked a workaround for buggy Galaxy Note stylus

This commit is contained in:
pelya
2012-06-18 13:35:24 +03:00
parent 65ab75a635
commit d36833ddd8
2 changed files with 19 additions and 1 deletions

View File

@@ -109,7 +109,11 @@ abstract class DifferentTouchInput
}
try {
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH && IcsTouchInput.Holder.sInstance != null )
{
if(android.os.Build.MODEL.equals("GT-N7000") || android.os.Build.MODEL.equals("SGH-I717"))
return GalaxyNoteIcsTouchInput.Holder.sInstance;
return IcsTouchInput.Holder.sInstance;
}
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD && XperiaPlayTouchpadTouchInput.Holder.sInstance != null )
return XperiaPlayTouchpadTouchInput.Holder.sInstance;
if (multiTouchAvailable1 && multiTouchAvailable2)
@@ -406,6 +410,20 @@ abstract class DifferentTouchInput
}
}
}
private static class GalaxyNoteIcsTouchInput extends IcsTouchInput
{
private static class Holder
{
private static final GalaxyNoteIcsTouchInput sInstance = new GalaxyNoteIcsTouchInput();
}
public void process(final MotionEvent event)
{
// HACK for Galaxy Note stylus, which pushes the cursor to the lower-right part of the screen, when you lift the stylus.
// Also it reports the stylus as the mouse
if(! (event.getSource() == InputDevice.SOURCE_MOUSE && (int)event.getX() == 0 && (int)event.getY() == 799))
super.process(event);
}
}
}