summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-09-28 20:02:10 -0400
committerAndroid (Google) Code Review <android-gerrit@google.com>2009-09-28 20:02:10 -0400
commitd6f9451be96d013cd640535cfc14dfc1585bb9b3 (patch)
treed2e30cc3eaa279e26e7c499dbab3e5a27d4af88d
parent668b7111b25e97339a906ddfb6f8e84f59e8e885 (diff)
parent80bbecfb183210ccbe53ec99e8b3d9aab323da2b (diff)
downloadCalendar-d6f9451be96d013cd640535cfc14dfc1585bb9b3.tar.gz
Merge change I6d696a98 into eclair
* changes: b/2123455 Single tap on an event will always launch the event details.
-rw-r--r--src/com/android/calendar/CalendarActivity.java6
-rw-r--r--src/com/android/calendar/CalendarView.java49
2 files changed, 24 insertions, 31 deletions
diff --git a/src/com/android/calendar/CalendarActivity.java b/src/com/android/calendar/CalendarActivity.java
index b8078bef..f5b17432 100644
--- a/src/com/android/calendar/CalendarActivity.java
+++ b/src/com/android/calendar/CalendarActivity.java
@@ -343,12 +343,6 @@ public class CalendarActivity extends Activity implements Navigator {
}
@Override
- public void onShowPress(MotionEvent ev) {
- CalendarView view = (CalendarView) mViewSwitcher.getCurrentView();
- view.doShowPress(ev);
- }
-
- @Override
public void onLongPress(MotionEvent ev) {
CalendarView view = (CalendarView) mViewSwitcher.getCurrentView();
view.doLongPress(ev);
diff --git a/src/com/android/calendar/CalendarView.java b/src/com/android/calendar/CalendarView.java
index 3710cc9e..6716edf9 100644
--- a/src/com/android/calendar/CalendarView.java
+++ b/src/com/android/calendar/CalendarView.java
@@ -149,7 +149,6 @@ public class CalendarView extends View
boolean mSelectionAllDay;
private int mCellWidth;
- private boolean mLaunchNewView;
// Pre-allocate these objects and re-use them
private Rect mRect = new Rect();
@@ -2336,21 +2335,10 @@ public class CalendarView extends View
mTouchMode = TOUCH_MODE_DOWN;
mViewStartX = 0;
mOnFlingCalled = false;
- mLaunchNewView = false;
getHandler().removeCallbacks(mContinueScroll);
}
void doSingleTapUp(MotionEvent ev) {
- mSelectionMode = SELECTION_SELECTED;
- mRedrawScreen = true;
- invalidate();
- if (mLaunchNewView) {
- mLaunchNewView = false;
- switchViews(false /* not the trackball */);
- }
- }
-
- void doShowPress(MotionEvent ev) {
int x = (int) ev.getX();
int y = (int) ev.getY();
Event selectedEvent = mSelectedEvent;
@@ -2359,29 +2347,41 @@ public class CalendarView extends View
boolean validPosition = setSelectionFromPosition(x, y);
if (!validPosition) {
+ // return if the touch wasn't on an area of concern
return;
}
- mSelectionMode = SELECTION_PRESSED;
+ mSelectionMode = SELECTION_SELECTED;
mRedrawScreen = true;
invalidate();
- // If the tap is on an already selected event or hour slot,
- // then launch a new view. Otherwise, just select the event.
- if (selectedEvent != null && selectedEvent == mSelectedEvent) {
- // Launch the "View event" view when the finger lifts up,
- // unless the finger moves before lifting up.
- mLaunchNewView = true;
- } else if (selectedEvent == null && selectedDay == mSelectionDay
+ boolean launchNewView = false;
+ if (mSelectedEvent != null) {
+ // If the tap is on an event, launch the "View event" view
+ launchNewView = true;
+ } else if (mSelectedEvent == null && selectedDay == mSelectionDay
&& selectedHour == mSelectionHour) {
- // Launch the Day/Agenda view when the finger lifts up,
- // unless the finger moves before lifting up.
- mLaunchNewView = true;
+ // If the tap is on an already selected hour slot,
+ // then launch the Day/Agenda view. Otherwise, just select the hour
+ // slot.
+ launchNewView = true;
+ }
+
+ if (launchNewView) {
+ switchViews(false /* not the trackball */);
}
}
void doLongPress(MotionEvent ev) {
- mLaunchNewView = false;
+ int x = (int) ev.getX();
+ int y = (int) ev.getY();
+
+ boolean validPosition = setSelectionFromPosition(x, y);
+ if (!validPosition) {
+ // return if the touch wasn't on an area of concern
+ return;
+ }
+
mSelectionMode = SELECTION_LONGPRESS;
mRedrawScreen = true;
invalidate();
@@ -2389,7 +2389,6 @@ public class CalendarView extends View
}
void doScroll(MotionEvent e1, MotionEvent e2, float deltaX, float deltaY) {
- mLaunchNewView = false;
// Use the distance from the current point to the initial touch instead
// of deltaX and deltaY to avoid accumulating floating-point rounding
// errors. Also, we don't need floats, we can use ints.