Cockpit watch face: Double-tap opens MainMenuActivity
This commit is contained in:
parent
aff0e6f5a8
commit
02e7752c3e
1 changed files with 6 additions and 14 deletions
|
@ -27,21 +27,13 @@ public class Cockpit extends BaseWatchFace {
|
||||||
@Override
|
@Override
|
||||||
protected void onTapCommand(int tapType, int x, int y, long eventTime) {
|
protected void onTapCommand(int tapType, int x, int y, long eventTime) {
|
||||||
|
|
||||||
if (mSgv != null) {
|
if (tapType == TAP_TYPE_TAP ) {
|
||||||
|
if (eventTime - sgvTapTime < 800) {
|
||||||
int extra = (mSgv.getRight() - mSgv.getLeft()) / 2;
|
Intent intent = new Intent(this, MainMenuActivity.class);
|
||||||
if (tapType == TAP_TYPE_TAP &&
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
x + extra >= mSgv.getLeft() &&
|
startActivity(intent);
|
||||||
x - extra <= mSgv.getRight() &&
|
|
||||||
y >= mSgv.getTop() &&
|
|
||||||
y <= mSgv.getBottom()) {
|
|
||||||
if (eventTime - sgvTapTime < 800) {
|
|
||||||
Intent intent = new Intent(this, MainMenuActivity.class);
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
|
||||||
sgvTapTime = eventTime;
|
|
||||||
}
|
}
|
||||||
|
sgvTapTime = eventTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue