diff options
author | Andrew Lee <anwlee@google.com> | 2014-06-11 17:02:21 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-06-11 17:02:21 +0000 |
commit | d2777cefe658ceccafa853c7c3ae9a4fd5d9898c (patch) | |
tree | f57ccd0ce7622e4b5c62fc486ddfee8c69f6cc63 /src/com/android/contacts | |
parent | ba1570270d04f1e34d070e6e66ca3a92ec6be463 (diff) | |
parent | 84f6ef0cfd5ef768b14119952df7b8f2fa0a02ee (diff) | |
download | android_packages_apps_ContactsCommon-d2777cefe658ceccafa853c7c3ae9a4fd5d9898c.tar.gz android_packages_apps_ContactsCommon-d2777cefe658ceccafa853c7c3ae9a4fd5d9898c.tar.bz2 android_packages_apps_ContactsCommon-d2777cefe658ceccafa853c7c3ae9a4fd5d9898c.zip |
am 84f6ef0c: Merge "Add support for full-bleed selection of contact list items." into lmp-preview-dev
* commit '84f6ef0cfd5ef768b14119952df7b8f2fa0a02ee':
Add support for full-bleed selection of contact list items.
Diffstat (limited to 'src/com/android/contacts')
4 files changed, 32 insertions, 15 deletions
diff --git a/src/com/android/contacts/common/list/ContactEntryListAdapter.java b/src/com/android/contacts/common/list/ContactEntryListAdapter.java index a3cd71a9..e14ff246 100644 --- a/src/com/android/contacts/common/list/ContactEntryListAdapter.java +++ b/src/com/android/contacts/common/list/ContactEntryListAdapter.java @@ -60,6 +60,7 @@ public abstract class ContactEntryListAdapter extends IndexerListAdapter { private boolean mDisplayPhotos; private boolean mCircularPhotos = true; private boolean mQuickContactEnabled; + private boolean mAdjustSelectionBoundsEnabled; /** * indicates if contact queries include profile @@ -104,6 +105,7 @@ public abstract class ContactEntryListAdapter extends IndexerListAdapter { Context context, int partition, Cursor cursor, int position, ViewGroup parent) { final ContactListItemView view = new ContactListItemView(context, null); view.setIsSectionHeaderEnabled(isSectionHeaderDisplayEnabled()); + view.setAdjustSelectionBoundsEnabled(isAdjustSelectionBoundsEnabled()); return view; } @@ -328,6 +330,14 @@ public abstract class ContactEntryListAdapter extends IndexerListAdapter { mQuickContactEnabled = quickContactEnabled; } + public boolean isAdjustSelectionBoundsEnabled() { + return mAdjustSelectionBoundsEnabled; + } + + public void setAdjustSelectionBoundsEnabled(boolean enabled) { + mAdjustSelectionBoundsEnabled = enabled; + } + public boolean shouldIncludeProfile() { return mIncludeProfile; } diff --git a/src/com/android/contacts/common/list/ContactEntryListFragment.java b/src/com/android/contacts/common/list/ContactEntryListFragment.java index 8543da3c..7e6f8662 100644 --- a/src/com/android/contacts/common/list/ContactEntryListFragment.java +++ b/src/com/android/contacts/common/list/ContactEntryListFragment.java @@ -68,6 +68,8 @@ public abstract class ContactEntryListFragment<T extends ContactEntryListAdapter private static final String KEY_SECTION_HEADER_DISPLAY_ENABLED = "sectionHeaderDisplayEnabled"; private static final String KEY_PHOTO_LOADER_ENABLED = "photoLoaderEnabled"; private static final String KEY_QUICK_CONTACT_ENABLED = "quickContactEnabled"; + private static final String KEY_ADJUST_SELECTION_BOUNDS_ENABLED = + "adjustSelectionBoundsEnabled"; private static final String KEY_INCLUDE_PROFILE = "includeProfile"; private static final String KEY_SEARCH_MODE = "searchMode"; private static final String KEY_VISIBLE_SCROLLBAR_ENABLED = "visibleScrollbarEnabled"; @@ -92,6 +94,7 @@ public abstract class ContactEntryListFragment<T extends ContactEntryListAdapter private boolean mSectionHeaderDisplayEnabled; private boolean mPhotoLoaderEnabled; private boolean mQuickContactEnabled = true; + private boolean mAdjustSelectionBoundsEnabled = true; private boolean mIncludeProfile; private boolean mSearchMode; private boolean mVisibleScrollbarEnabled; @@ -225,6 +228,7 @@ public abstract class ContactEntryListFragment<T extends ContactEntryListAdapter outState.putBoolean(KEY_SECTION_HEADER_DISPLAY_ENABLED, mSectionHeaderDisplayEnabled); outState.putBoolean(KEY_PHOTO_LOADER_ENABLED, mPhotoLoaderEnabled); outState.putBoolean(KEY_QUICK_CONTACT_ENABLED, mQuickContactEnabled); + outState.putBoolean(KEY_ADJUST_SELECTION_BOUNDS_ENABLED, mAdjustSelectionBoundsEnabled); outState.putBoolean(KEY_INCLUDE_PROFILE, mIncludeProfile); outState.putBoolean(KEY_SEARCH_MODE, mSearchMode); outState.putBoolean(KEY_VISIBLE_SCROLLBAR_ENABLED, mVisibleScrollbarEnabled); @@ -257,6 +261,7 @@ public abstract class ContactEntryListFragment<T extends ContactEntryListAdapter mSectionHeaderDisplayEnabled = savedState.getBoolean(KEY_SECTION_HEADER_DISPLAY_ENABLED); mPhotoLoaderEnabled = savedState.getBoolean(KEY_PHOTO_LOADER_ENABLED); mQuickContactEnabled = savedState.getBoolean(KEY_QUICK_CONTACT_ENABLED); + mAdjustSelectionBoundsEnabled = savedState.getBoolean(KEY_ADJUST_SELECTION_BOUNDS_ENABLED); mIncludeProfile = savedState.getBoolean(KEY_INCLUDE_PROFILE); mSearchMode = savedState.getBoolean(KEY_SEARCH_MODE); mVisibleScrollbarEnabled = savedState.getBoolean(KEY_VISIBLE_SCROLLBAR_ENABLED); @@ -515,17 +520,6 @@ public abstract class ContactEntryListFragment<T extends ContactEntryListAdapter mListView.setFastScrollAlwaysVisible(hasScrollbar); mListView.setVerticalScrollbarPosition(mVerticalScrollbarPosition); mListView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY); - int leftPadding = 0; - int rightPadding = 0; - if (mVerticalScrollbarPosition == View.SCROLLBAR_POSITION_LEFT) { - leftPadding = mContext.getResources().getDimensionPixelOffset( - R.dimen.list_visible_scrollbar_padding); - } else { - rightPadding = mContext.getResources().getDimensionPixelOffset( - R.dimen.list_visible_scrollbar_padding); - } - mListView.setPadding(leftPadding, mListView.getPaddingTop(), - rightPadding, mListView.getPaddingBottom()); } } @@ -553,6 +547,10 @@ public abstract class ContactEntryListFragment<T extends ContactEntryListAdapter this.mQuickContactEnabled = flag; } + public void setAdjustSelectionBoundsEnabled(boolean flag) { + mAdjustSelectionBoundsEnabled = flag; + } + public void setIncludeProfile(boolean flag) { mIncludeProfile = flag; if(mAdapter != null) { @@ -761,6 +759,7 @@ public abstract class ContactEntryListFragment<T extends ContactEntryListAdapter } mAdapter.setQuickContactEnabled(mQuickContactEnabled); + mAdapter.setAdjustSelectionBoundsEnabled(mAdjustSelectionBoundsEnabled); mAdapter.setIncludeProfile(mIncludeProfile); mAdapter.setQueryString(mQueryString); mAdapter.setDirectorySearchMode(mDirectorySearchMode); diff --git a/src/com/android/contacts/common/list/ContactListAdapter.java b/src/com/android/contacts/common/list/ContactListAdapter.java index d1ef9011..70ab0cf9 100644 --- a/src/com/android/contacts/common/list/ContactListAdapter.java +++ b/src/com/android/contacts/common/list/ContactListAdapter.java @@ -199,6 +199,7 @@ public abstract class ContactListAdapter extends ContactEntryListAdapter { ContactListItemView view = super.newView(context, partition, cursor, position, parent); view.setUnknownNameText(mUnknownNameText); view.setQuickContactEnabled(isQuickContactEnabled()); + view.setAdjustSelectionBoundsEnabled(isAdjustSelectionBoundsEnabled()); view.setActivatedStateSupported(isSelectionVisible()); if (mPhotoPosition != null) { view.setPhotoPosition(mPhotoPosition); diff --git a/src/com/android/contacts/common/list/ContactListItemView.java b/src/com/android/contacts/common/list/ContactListItemView.java index 04acfb52..4abdf7ec 100644 --- a/src/com/android/contacts/common/list/ContactListItemView.java +++ b/src/com/android/contacts/common/list/ContactListItemView.java @@ -210,6 +210,7 @@ public class ContactListItemView extends ViewGroup private final CharArrayBuffer mPhoneticNameBuffer = new CharArrayBuffer(128); private boolean mActivatedStateSupported; + private boolean mAdjustSelectionBoundsEnabled = true; private Rect mBoundsWithoutHeader = new Rect(); @@ -635,10 +636,12 @@ public class ContactListItemView extends ViewGroup @Override public void adjustListItemSelectionBounds(Rect bounds) { - bounds.top += mBoundsWithoutHeader.top; - bounds.bottom = bounds.top + mBoundsWithoutHeader.height(); - bounds.left = mBoundsWithoutHeader.left; - bounds.right = mBoundsWithoutHeader.right; + if (mAdjustSelectionBoundsEnabled) { + bounds.top += mBoundsWithoutHeader.top; + bounds.bottom = bounds.top + mBoundsWithoutHeader.height(); + bounds.left = mBoundsWithoutHeader.left; + bounds.right = mBoundsWithoutHeader.right; + } } protected boolean isVisible(View view) { @@ -1390,6 +1393,10 @@ public class ContactListItemView extends ViewGroup this.mActivatedStateSupported = flag; } + public void setAdjustSelectionBoundsEnabled(boolean enabled) { + mAdjustSelectionBoundsEnabled = enabled; + } + @Override public void requestLayout() { // We will assume that once measured this will not need to resize |