Automated import from //branches/cupcake/...@142821,142821

main
Amith Yamasani 2009-03-25 18:04:14 -07:00 committed by The Android Open Source Project
parent 6a4fcadae3
commit e1d8c2e67a
1 changed files with 21 additions and 10 deletions

View File

@ -102,12 +102,6 @@ public class Tutorial implements OnTouchListener {
window.setFocusable(false); window.setFocusable(false);
window.setTouchable(true); window.setTouchable(true);
window.setOutsideTouchable(false); window.setOutsideTouchable(false);
textView.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View view, MotionEvent me) {
Tutorial.this.next();
return true;
}
});
} }
private int chooseSize(PopupWindow pop, View parentView, CharSequence text, TextView tv) { private int chooseSize(PopupWindow pop, View parentView, CharSequence text, TextView tv) {
@ -143,6 +137,12 @@ public class Tutorial implements OnTouchListener {
try { try {
if ((gravity & Gravity.BOTTOM) == Gravity.BOTTOM) offy -= window.getHeight(); if ((gravity & Gravity.BOTTOM) == Gravity.BOTTOM) offy -= window.getHeight();
if ((gravity & Gravity.RIGHT) == Gravity.RIGHT) offx -= window.getWidth(); if ((gravity & Gravity.RIGHT) == Gravity.RIGHT) offx -= window.getWidth();
textView.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View view, MotionEvent me) {
Tutorial.this.next();
return true;
}
});
window.showAtLocation(inputView, Gravity.NO_GRAVITY, x + offx, y + offy); window.showAtLocation(inputView, Gravity.NO_GRAVITY, x + offx, y + offy);
} catch (Exception e) { } catch (Exception e) {
// Input view is not valid // Input view is not valid
@ -151,11 +151,15 @@ public class Tutorial implements OnTouchListener {
} }
void hide() { void hide() {
textView.setOnTouchListener(null);
if (window.isShowing()) { if (window.isShowing()) {
textView.setOnTouchListener(null);
window.dismiss(); window.dismiss();
} }
} }
boolean isShowing() {
return window.isShowing();
}
} }
public Tutorial(LatinIME ime, LatinKeyboardView inputView) { public Tutorial(LatinIME ime, LatinKeyboardView inputView) {
@ -201,7 +205,14 @@ public class Tutorial implements OnTouchListener {
boolean next() { boolean next() {
if (mBubbleIndex >= 0) { if (mBubbleIndex >= 0) {
mBubbles.get(mBubbleIndex).hide(); // If the bubble is not yet showing, don't move to the next.
if (!mBubbles.get(mBubbleIndex).isShowing()) {
return true;
}
// Hide all previous bubbles as well, as they may have had a delayed show
for (int i = 0; i <= mBubbleIndex; i++) {
mBubbles.get(i).hide();
}
} }
mBubbleIndex++; mBubbleIndex++;
if (mBubbleIndex >= mBubbles.size()) { if (mBubbleIndex >= mBubbles.size()) {
@ -214,7 +225,7 @@ public class Tutorial implements OnTouchListener {
mIme.mKeyboardSwitcher.toggleSymbols(); mIme.mKeyboardSwitcher.toggleSymbols();
} }
mHandler.sendMessageDelayed( mHandler.sendMessageDelayed(
mHandler.obtainMessage(MSG_SHOW_BUBBLE, mBubbles.get(mBubbleIndex)), 200); mHandler.obtainMessage(MSG_SHOW_BUBBLE, mBubbles.get(mBubbleIndex)), 500);
return true; return true;
} }
@ -232,7 +243,7 @@ public class Tutorial implements OnTouchListener {
} }
public boolean onTouch(View v, MotionEvent event) { public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_UP) { if (event.getAction() == MotionEvent.ACTION_DOWN) {
next(); next();
} }
return true; return true;