mirror of
https://github.com/jamessanford/kegs.git
synced 2024-06-03 05:29:42 +00:00
30 lines
662 B
Java
30 lines
662 B
Java
package com.froop.app.kegs;
|
|
|
|
import android.graphics.Rect;
|
|
import android.util.Log;
|
|
import android.view.MotionEvent;
|
|
|
|
class TouchSpecialZone {
|
|
// Clicks within this rect have a special handler.
|
|
private Rect mSpecialRect = null;
|
|
|
|
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;
|
|
}
|
|
}
|