am d6f9451b: Merge change I6d696a98 into eclair

Merge commit 'd6f9451be96d013cd640535cfc14dfc1585bb9b3' into eclair-plus-aosp

* commit 'd6f9451be96d013cd640535cfc14dfc1585bb9b3':
  b/2123455 Single tap on an event will always launch the event details.
diff --git a/src/com/android/calendar/CalendarActivity.java b/src/com/android/calendar/CalendarActivity.java
index b8078be..f5b1743 100644
--- a/src/com/android/calendar/CalendarActivity.java
+++ b/src/com/android/calendar/CalendarActivity.java
@@ -343,12 +343,6 @@
         }
 
         @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 3710cc9..6716edf 100644
--- a/src/com/android/calendar/CalendarView.java
+++ b/src/com/android/calendar/CalendarView.java
@@ -149,7 +149,6 @@
     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 @@
         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 @@
 
         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 @@
     }
 
     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.