OSDN Git Service

b/2113463 Fixed Flickering of screen when we move from month view to day view and...
authorMichael Chan <mchan@android.com>
Mon, 28 Sep 2009 23:50:46 +0000 (16:50 -0700)
committerMichael Chan <mchan@android.com>
Tue, 29 Sep 2009 00:02:53 +0000 (17:02 -0700)
Change-Id: I2f96578f2697225182f85c49efe499337151a039

res/layout/contact_item.xml
src/com/android/calendar/AgendaActivity.java
src/com/android/calendar/CalendarActivity.java
src/com/android/calendar/MonthActivity.java
src/com/android/calendar/MonthView.java
src/com/android/calendar/Navigator.java
src/com/android/calendar/WeekActivity.java

index 5aa76f6..b1b55b0 100644 (file)
@@ -59,7 +59,7 @@
     <View
         android:id="@+id/separator"
         android:layout_width="fill_parent"
-        android:layout_height="1dip"
+        android:layout_height="1px"
         android:layout_alignParentBottom="true"
         android:background="@android:drawable/divider_horizontal_bright" />
 
index 82ec55b..b414033 100644 (file)
@@ -81,7 +81,7 @@ public class AgendaActivity extends Activity implements Navigator {
     @Override
     protected void onCreate(Bundle icicle) {
         super.onCreate(icicle);
-
+        
         // Eliminate extra GCs during startup by setting the initial heap size to 4MB.
         // TODO: We should restore the old heap size once the activity reaches the idle state
         VMRuntime.getRuntime().setMinimumHeapSize(INITIAL_HEAP_SIZE);
@@ -127,7 +127,7 @@ public class AgendaActivity extends Activity implements Navigator {
         long time = Utils.timeFromIntentInMillis(intent);
         if (time > 0) {
             mTime.set(time);
-            goTo(mTime);
+            goTo(mTime, false);
         }
     }
 
@@ -216,10 +216,10 @@ public class AgendaActivity extends Activity implements Navigator {
     public void goToToday() {
         Time now = new Time();
         now.set(System.currentTimeMillis());
-        goTo(now);
+        goTo(now, true);
     }
 
-    public void goTo(Time time) {
+    public void goTo(Time time, boolean animate) {
         mAgendaListView.goTo(time, false);
     }
 
index f5b1743..b44d519 100644 (file)
@@ -130,7 +130,7 @@ public class CalendarActivity extends Activity implements Navigator {
         if (timeMillis > 0) {
             Time time = new Time();
             time.set(timeMillis);
-            goTo(time);
+            goTo(time, false);
         }
     }
 
@@ -183,15 +183,16 @@ public class CalendarActivity extends Activity implements Navigator {
     }
 
     /* Navigator interface methods */
-    public void goTo(Time time) {
-        CalendarView current = (CalendarView) mViewSwitcher.getCurrentView();
-
-        if (current.getSelectedTime().before(time)) {
-            mViewSwitcher.setInAnimation(mInAnimationForward);
-            mViewSwitcher.setOutAnimation(mOutAnimationForward);
-        } else {
-            mViewSwitcher.setInAnimation(mInAnimationBackward);
-            mViewSwitcher.setOutAnimation(mOutAnimationBackward);
+    public void goTo(Time time, boolean animate) {
+        if (animate) {
+            CalendarView current = (CalendarView) mViewSwitcher.getCurrentView();
+            if (current.getSelectedTime().before(time)) {
+                mViewSwitcher.setInAnimation(mInAnimationForward);
+                mViewSwitcher.setOutAnimation(mOutAnimationForward);
+            } else {
+                mViewSwitcher.setInAnimation(mInAnimationBackward);
+                mViewSwitcher.setOutAnimation(mOutAnimationBackward);
+            }
         }
 
         CalendarView next = (CalendarView) mViewSwitcher.getNextView();
index e186875..7bb80c4 100644 (file)
@@ -84,7 +84,7 @@ public class MonthActivity extends Activity implements ViewSwitcher.ViewFactory,
     }
 
     /* Navigator interface methods */
-    public void goTo(Time time) {
+    public void goTo(Time time, boolean animate) {
         TextView title = (TextView) findViewById(R.id.title);
         title.setText(Utils.formatMonthYear(time));
 
@@ -97,14 +97,16 @@ public class MonthActivity extends Activity implements ViewSwitcher.ViewFactory,
         // two adjacent months.
         // This is faster than calling getSelectedTime() because we avoid
         // a call to Time#normalize().
-        int currentMonth = currentTime.month + currentTime.year * 12;
-        int nextMonth = time.month + time.year * 12;
-        if (nextMonth < currentMonth) {
-            mSwitcher.setInAnimation(mInAnimationPast);
-            mSwitcher.setOutAnimation(mOutAnimationPast);
-        } else {
-            mSwitcher.setInAnimation(mInAnimationFuture);
-            mSwitcher.setOutAnimation(mOutAnimationFuture);
+        if (animate) {
+            int currentMonth = currentTime.month + currentTime.year * 12;
+            int nextMonth = time.month + time.year * 12;
+            if (nextMonth < currentMonth) {
+                mSwitcher.setInAnimation(mInAnimationPast);
+                mSwitcher.setOutAnimation(mOutAnimationPast);
+            } else {
+                mSwitcher.setInAnimation(mInAnimationFuture);
+                mSwitcher.setOutAnimation(mOutAnimationFuture);
+            }
         }
 
         MonthView next = (MonthView) mSwitcher.getNextView();
@@ -264,7 +266,7 @@ public class MonthActivity extends Activity implements ViewSwitcher.ViewFactory,
         if (timeMillis > 0) {
             Time time = new Time();
             time.set(timeMillis);
-            goTo(time);
+            goTo(time, false);
         }
     }
 
index 311dcfe..13f6abc 100644 (file)
@@ -302,7 +302,7 @@ public class MonthView extends View implements View.OnCreateContextMenuListener
                     time.month -= 1;
                 }
                 time.normalize(true);
-                mParentActivity.goTo(time);
+                mParentActivity.goTo(time, true);
 
                 return true;
             }
@@ -1346,7 +1346,7 @@ public class MonthView extends View implements View.OnCreateContextMenuListener
 
         if (other != null) {
             other.normalize(true /* ignore DST */);
-            mNavigator.goTo(other);
+            mNavigator.goTo(other, true);
         } else if (redraw) {
             mRedrawScreen = true;
             invalidate();
index e05a603..c8de34b 100644 (file)
@@ -28,8 +28,9 @@ public interface Navigator {
     /**
      * Changes the view to include the given time.
      * @param time the desired time to view.
+     * @animate enable animation
      */
-    void goTo(Time time);
+    void goTo(Time time, boolean animate);
     
     /**
      * Changes the view to include today's date.
index 54bee5d..43015f6 100644 (file)
@@ -62,7 +62,7 @@ public class WeekActivity extends CalendarActivity implements ViewSwitcher.ViewF
         if (timeMillis > 0) {
             Time time = new Time();
             time.set(timeMillis);
-            goTo(time);
+            goTo(time, false);
         }
     }