diff options
author | Isaac Katzenelson <isaack@android.com> | 2011-11-07 11:19:32 -0800 |
---|---|---|
committer | Isaac Katzenelson <isaack@android.com> | 2011-11-16 10:04:48 -0800 |
commit | c1fae4df6202ac82c3facd76e5f33c7cbacb39d1 (patch) | |
tree | 7ed3455158125d19d7de1e5ea277c10f0aacbbd5 /src/com/android/calendar/StickyHeaderListView.java | |
parent | 24c479e861d5eb455bdb25d8feade8ed9e8c2261 (diff) | |
download | android_packages_apps_Calendar-c1fae4df6202ac82c3facd76e5f33c7cbacb39d1.tar.gz android_packages_apps_Calendar-c1fae4df6202ac82c3facd76e5f33c7cbacb39d1.tar.bz2 android_packages_apps_Calendar-c1fae4df6202ac82c3facd76e5f33c7cbacb39d1.zip |
Fix agenda list view location
Changed AgendaWindowAdapter to move to a specific time/event id instead
of moving to the day of the event.
Stop fling motion when the today button is pressed.
Bug 5424040 ICS: On opening, Agenda view should scroll to
nearest upcoming or in progress event
5547705 AgendaListView keeps scrolling after pressing
the "today" button.
Change-Id: I8982b4d9254a077e83df48c857c418063b9ea691
Diffstat (limited to 'src/com/android/calendar/StickyHeaderListView.java')
-rw-r--r-- | src/com/android/calendar/StickyHeaderListView.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/com/android/calendar/StickyHeaderListView.java b/src/com/android/calendar/StickyHeaderListView.java index 7a691ecf..25955a05 100644 --- a/src/com/android/calendar/StickyHeaderListView.java +++ b/src/com/android/calendar/StickyHeaderListView.java @@ -56,6 +56,7 @@ public class StickyHeaderListView extends FrameLayout implements OnScrollListene protected Context mContext = null; protected Adapter mAdapter = null; protected HeaderIndexer mIndexer = null; + protected HeaderHeightListener mHeaderHeightListener = null; protected View mStickyHeader = null; protected View mDummyHeader = null; // A invisible header used when a section has no header protected ListView mListView = null; @@ -63,6 +64,7 @@ public class StickyHeaderListView extends FrameLayout implements OnScrollListene private int mSeparatorWidth; private View mSeparatorView; + private int mLastStickyHeaderHeight = 0; // This code is needed only if dataset changes do not force a call to OnScroll // protected DataSetObserver mListDataObserver = null; @@ -103,6 +105,21 @@ public class StickyHeaderListView extends FrameLayout implements OnScrollListene int getHeaderItemsNumber(int headerPosition); } + /*** + * + * Interface that is used to update the sticky header's height + * + */ + public interface HeaderHeightListener { + + /*** + * Updated a change in the sticky header's size + * + * @param height - new height of sticky header + */ + void OnHeaderHeightChanged(int height); + } + /** * Sets the adapter to be used by the class to get views of headers * @@ -158,6 +175,10 @@ public class StickyHeaderListView extends FrameLayout implements OnScrollListene mListener = listener; } + public void setHeaderHeightListener(HeaderHeightListener listener) { + mHeaderHeightListener = listener; + } + // This code is needed only if dataset changes do not force a call to OnScroll // protected void createDataListener() { // mListDataObserver = new DataSetObserver() { @@ -282,6 +303,14 @@ public class StickyHeaderListView extends FrameLayout implements OnScrollListene if (stickyHeaderHeight == 0) { stickyHeaderHeight = mStickyHeader.getMeasuredHeight(); } + + // Update new header height + if (mHeaderHeightListener != null && + mLastStickyHeaderHeight != stickyHeaderHeight) { + mLastStickyHeaderHeight = stickyHeaderHeight; + mHeaderHeightListener.OnHeaderHeightChanged(stickyHeaderHeight); + } + View SectionLastView = mListView.getChildAt(sectionLastItemPosition); if (SectionLastView != null && SectionLastView.getBottom() <= stickyHeaderHeight) { int lastViewBottom = SectionLastView.getBottom(); |