summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIsaac Katzenelson <isaack@android.com>2011-10-03 16:46:10 -0700
committerIsaac Katzenelson <isaack@android.com>2011-10-03 17:16:44 -0700
commit0aa0c61fcd2464f034d15f33db265b6d080f4af9 (patch)
treee8b5bcd3bed06f1d60d689bc1cc4f14d3a0038af
parentb7c1fcc5c79d094ee981b3e18f6e60d11ab3ec6c (diff)
downloadandroid_packages_apps_Calendar-0aa0c61fcd2464f034d15f33db265b6d080f4af9.tar.gz
android_packages_apps_Calendar-0aa0c61fcd2464f034d15f33db265b6d080f4af9.tar.bz2
android_packages_apps_Calendar-0aa0c61fcd2464f034d15f33db265b6d080f4af9.zip
Make event info dialg box show in the middle of event
Bug: 5204879 On tablet, the way the event pop-up Change-Id: I9cc5fd75abc939699674fe82fbd46a0e2284acb9 comes out (week and day views) must be improved
-rw-r--r--src/com/android/calendar/AllInOneActivity.java2
-rw-r--r--src/com/android/calendar/DayView.java13
-rw-r--r--src/com/android/calendar/EventInfoFragment.java14
3 files changed, 21 insertions, 8 deletions
diff --git a/src/com/android/calendar/AllInOneActivity.java b/src/com/android/calendar/AllInOneActivity.java
index a86c1b20..2702c9fe 100644
--- a/src/com/android/calendar/AllInOneActivity.java
+++ b/src/com/android/calendar/AllInOneActivity.java
@@ -1091,7 +1091,7 @@ public class AllInOneActivity extends Activity implements EventHandler,
EventInfoFragment fragment = new EventInfoFragment(this,
event.id, event.startTime.toMillis(false),
event.endTime.toMillis(false), (int) event.extraLong, true);
- fragment.setDialogParams(event.x, event.y);
+ fragment.setDialogParams(event.x, event.y, mActionBar.getHeight());
FragmentManager fm = getFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
// if we have an old popup replace it
diff --git a/src/com/android/calendar/DayView.java b/src/com/android/calendar/DayView.java
index 50325b1c..dc4460ff 100644
--- a/src/com/android/calendar/DayView.java
+++ b/src/com/android/calendar/DayView.java
@@ -3656,9 +3656,18 @@ public class DayView extends View implements View.OnCreateContextMenuListener,
}
mSelectionMode = SELECTION_HIDDEN;
+
+ int yLocation =
+ (int)((mSelectedEvent.top + mSelectedEvent.bottom)/2);
+ // Y location is affected by the position of the event in the scrolling
+ // view (mViewStartY) and the presence of all day events (mFirstCell)
+ if (!mSelectedEvent.allDay) {
+ yLocation += (mFirstCell - mViewStartY);
+ }
mController.sendEventRelatedEvent(this, EventType.VIEW_EVENT, mSelectedEvent.id,
- mSelectedEvent.startMillis, mSelectedEvent.endMillis, (int) ev.getRawX(),
- (int) ev.getRawY(), getSelectedTimeInMillis());
+ mSelectedEvent.startMillis, mSelectedEvent.endMillis,
+ (int)((mSelectedEvent.left + mSelectedEvent.right)/2),
+ yLocation, getSelectedTimeInMillis());
} else {
// Select time
Time startTime = new Time(mBaseDate);
diff --git a/src/com/android/calendar/EventInfoFragment.java b/src/com/android/calendar/EventInfoFragment.java
index 2b0394b1..8961c46b 100644
--- a/src/com/android/calendar/EventInfoFragment.java
+++ b/src/com/android/calendar/EventInfoFragment.java
@@ -311,11 +311,13 @@ public class EventInfoFragment extends DialogFragment implements OnCheckedChange
private static int DIALOG_WIDTH = 500;
private static int DIALOG_HEIGHT = 600;
+ private static int DIALOG_TOP_MARGIN = 8;
private boolean mIsDialog = false;
private boolean mIsPaused = true;
private boolean mDismissOnResume = false;
private int mX = -1;
private int mY = -1;
+ private int mMinTop; // Dialog cannot be above this location
private Button mDescButton; // Button to expand/collapse the description
private String mMoreLabel; // Labels for the button
private String mLessLabel;
@@ -437,6 +439,7 @@ public class EventInfoFragment extends DialogFragment implements OnCheckedChange
if (mScale != 1) {
DIALOG_WIDTH *= mScale;
DIALOG_HEIGHT *= mScale;
+ DIALOG_TOP_MARGIN *= mScale;
}
}
mIsDialog = isDialog;
@@ -510,19 +513,20 @@ public class EventInfoFragment extends DialogFragment implements OnCheckedChange
// On phones , use the whole screen
if (mX != -1 || mY != -1) {
- a.x = mX - a.width - 64;
- if (a.x < 0) {
- a.x = mX + 64;
+ a.x = mX - DIALOG_WIDTH / 2;
+ a.y = mY - DIALOG_HEIGHT / 2;
+ if (a.y < mMinTop) {
+ a.y = mMinTop + DIALOG_TOP_MARGIN;
}
- a.y = mY - 64;
a.gravity = Gravity.LEFT | Gravity.TOP;
}
window.setAttributes(a);
}
- public void setDialogParams(int x, int y) {
+ public void setDialogParams(int x, int y, int minTop) {
mX = x;
mY = y;
+ mMinTop = minTop;
}
// Implements OnCheckedChangeListener