mirror of
https://github.com/jamessanford/kegs.git
synced 2024-06-16 12:29:28 +00:00
29 lines
630 B
Java
29 lines
630 B
Java
package com.froop.app.kegs;
|
|
|
|
import android.graphics.Rect;
|
|
import android.view.MotionEvent;
|
|
|
|
class TouchSpecialZone {
|
|
// Clicks within this rect have a special handler.
|
|
private Rect mSpecialRect;
|
|
|
|
public TouchSpecialZone(Rect zone) {
|
|
mSpecialRect = zone; // may be null
|
|
}
|
|
|
|
// Override this.
|
|
public void activate() {}
|
|
|
|
public boolean click(MotionEvent point, int index) {
|
|
if (mSpecialRect != null) {
|
|
final int x = (int)point.getX(index);
|
|
final int y = (int)point.getY(index);
|
|
if (mSpecialRect.contains(x, y)) {
|
|
activate();
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
}
|