Adding left and top padding to the contact list
Change-Id: Ib694507bd4a5897776e4f6262544b74bd07072dd
diff --git a/res/drawable-hdpi/list_activated_holo.9.png b/res/drawable-hdpi/list_activated_holo.9.png
index 545f9aa..36ccb79 100644
--- a/res/drawable-hdpi/list_activated_holo.9.png
+++ b/res/drawable-hdpi/list_activated_holo.9.png
Binary files differ
diff --git a/res/drawable-hdpi/list_focused_holo.9.png b/res/drawable-hdpi/list_focused_holo.9.png
index ef52862..54c5c2d 100644
--- a/res/drawable-hdpi/list_focused_holo.9.png
+++ b/res/drawable-hdpi/list_focused_holo.9.png
Binary files differ
diff --git a/res/drawable-hdpi/list_pressed_holo.9.png b/res/drawable-hdpi/list_pressed_holo.9.png
index 2be2784..f0742d0 100644
--- a/res/drawable-hdpi/list_pressed_holo.9.png
+++ b/res/drawable-hdpi/list_pressed_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/list_activated_holo.9.png b/res/drawable-mdpi/list_activated_holo.9.png
index 88f7318..f7cd24e 100644
--- a/res/drawable-mdpi/list_activated_holo.9.png
+++ b/res/drawable-mdpi/list_activated_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/list_focused_holo.9.png b/res/drawable-mdpi/list_focused_holo.9.png
index 76dbb4b..32cb628 100644
--- a/res/drawable-mdpi/list_focused_holo.9.png
+++ b/res/drawable-mdpi/list_focused_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/list_pressed_holo.9.png b/res/drawable-mdpi/list_pressed_holo.9.png
index 1bc87d6..aa4dab8 100644
--- a/res/drawable-mdpi/list_pressed_holo.9.png
+++ b/res/drawable-mdpi/list_pressed_holo.9.png
Binary files differ
diff --git a/res/layout-xlarge/contact_browser.xml b/res/layout-xlarge/contact_browser.xml
index 075b248..4e20171 100644
--- a/res/layout-xlarge/contact_browser.xml
+++ b/res/layout-xlarge/contact_browser.xml
@@ -26,16 +26,29 @@
android:layout_height="match_parent"
android:splitMotionEvents="true">
- <FrameLayout
- android:id="@+id/list_container"
- android:layout_height="match_parent"
+ <LinearLayout
android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_marginTop="40dip"
+ android:orientation="vertical"
android:minWidth="100dip"
- android:background="@drawable/list_background_holo"
ex:layout_narrowParentWidth="800dip"
ex:layout_narrowWidth="310dip"
ex:layout_wideParentWidth="1280dip"
- ex:layout_wideWidth="430dip" />
+ ex:layout_wideWidth="430dip">
+
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="2dip"
+ android:layout_marginLeft="64dip"
+ android:background="#7e7e87" />
+
+ <FrameLayout
+ android:id="@+id/list_container"
+ android:layout_height="match_parent"
+ android:layout_width="match_parent"
+ android:background="@drawable/list_background_holo" />
+ </LinearLayout>
<view
class="com.android.contacts.widget.TransitionAnimationView"
diff --git a/res/layout-xlarge/contacts_list_content.xml b/res/layout-xlarge/contacts_list_content.xml
index b305b15..8deeaa1 100644
--- a/res/layout-xlarge/contacts_list_content.xml
+++ b/res/layout-xlarge/contacts_list_content.xml
@@ -22,14 +22,6 @@
android:orientation="vertical"
>
- <View
- android:layout_width="match_parent"
- android:layout_height="2dip"
- android:layout_marginTop="1dip"
- android:layout_marginBottom="1dip"
- android:background="#7e7e87"
- />
-
<view
class="com.android.contacts.list.ContactEntryListView"
android:id="@android:id/list"
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index c63451a..5e4e085 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -45,4 +45,7 @@
<!-- Minimum height of a row in the Editor -->
<dimen name="editor_min_line_item_height">48dip</dimen>
+
+ <!-- Padding to be used between a visible scrollbar and the contact list -->
+ <dimen name="list_visible_scrollbar_padding">34dip</dimen>
</resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 04d2dd6..87f7b94 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -87,6 +87,7 @@
<declare-styleable name="ContactListItemView">
<attr name="list_item_height" format="dimension"/>
+ <attr name="list_section_header_height" format="dimension"/>
<attr name="activated_background" format="reference"/>
<attr name="section_header_background" format="reference"/>
<attr name="list_item_divider" format="reference"/>
@@ -110,6 +111,7 @@
<item name="list_item_height">?android:attr/listPreferredItemHeight</item>
<item name="activated_background">@drawable/list_item_activated_background</item>
<item name="section_header_background">@drawable/section_header</item>
+ <item name="list_section_header_height">32dip</item>
<item name="list_item_divider">@drawable/list_item_divider</item>
<item name="list_item_padding_top">4dip</item>
<item name="list_item_padding_right">11dip</item>
diff --git a/src/com/android/contacts/list/ContactEntryListFragment.java b/src/com/android/contacts/list/ContactEntryListFragment.java
index c638682..558a715 100644
--- a/src/com/android/contacts/list/ContactEntryListFragment.java
+++ b/src/com/android/contacts/list/ContactEntryListFragment.java
@@ -79,6 +79,7 @@
private static final String KEY_QUICK_CONTACT_ENABLED = "quickContactEnabled";
private static final String KEY_SEARCH_MODE = "searchMode";
private static final String KEY_VISIBLE_SCROLLBAR_ENABLED = "visibleScrollbarEnabled";
+ private static final String KEY_SCROLLBAR_POSITION = "scrollbarPosition";
private static final String KEY_QUERY_STRING = "queryString";
private static final String KEY_DIRECTORY_SEARCH_MODE = "directorySearchMode";
private static final String KEY_SELECTION_VISIBLE = "selectionVisible";
@@ -235,6 +236,7 @@
outState.putBoolean(KEY_QUICK_CONTACT_ENABLED, mQuickContactEnabled);
outState.putBoolean(KEY_SEARCH_MODE, mSearchMode);
outState.putBoolean(KEY_VISIBLE_SCROLLBAR_ENABLED, mVisibleScrollbarEnabled);
+ outState.putInt(KEY_SCROLLBAR_POSITION, mVerticalScrollbarPosition);
outState.putInt(KEY_DIRECTORY_SEARCH_MODE, mDirectorySearchMode);
outState.putBoolean(KEY_SELECTION_VISIBLE, mSelectionVisible);
outState.putBoolean(KEY_LEGACY_COMPATIBILITY, mLegacyCompatibility);
@@ -265,6 +267,7 @@
mQuickContactEnabled = savedState.getBoolean(KEY_QUICK_CONTACT_ENABLED);
mSearchMode = savedState.getBoolean(KEY_SEARCH_MODE);
mVisibleScrollbarEnabled = savedState.getBoolean(KEY_VISIBLE_SCROLLBAR_ENABLED);
+ mVerticalScrollbarPosition = savedState.getInt(KEY_SCROLLBAR_POSITION);
mDirectorySearchMode = savedState.getInt(KEY_DIRECTORY_SEARCH_MODE);
mSelectionVisible = savedState.getBoolean(KEY_SELECTION_VISIBLE);
mLegacyCompatibility = savedState.getBoolean(KEY_LEGACY_COMPATIBILITY);
@@ -522,6 +525,13 @@
mListView.setScrollBarStyle(
hasScrollbar ? View.SCROLLBARS_INSIDE_INSET : View.SCROLLBARS_INSIDE_OVERLAY);
mListView.setVerticalScrollbarPosition(mVerticalScrollbarPosition);
+ int leftPadding = 0;
+ if (mVerticalScrollbarPosition == View.SCROLLBAR_POSITION_LEFT) {
+ leftPadding = mContext.getResources().getDimensionPixelOffset(
+ R.dimen.list_visible_scrollbar_padding);
+ }
+ mListView.setPadding(leftPadding, mListView.getPaddingTop(),
+ mListView.getPaddingRight(), mListView.getPaddingBottom());
}
}