Custom scrolling ViewGroup for QuickContact
Plus basic entrance animation
As our UX person gets to play with this, the MultiShrinkScroller's
snapToTop and snapToBottom() methods will likely be changed a lot.
Change-Id: I75adde129f5e5224e3519733f214fc638c2512ab
diff --git a/res/layout/quickcontact_activity.xml b/res/layout/quickcontact_activity.xml
index fcf348b..573890f 100644
--- a/res/layout/quickcontact_activity.xml
+++ b/res/layout/quickcontact_activity.xml
@@ -14,35 +14,45 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:ex="http://schemas.android.com/apk/res-auto"
+<com.android.contacts.widget.MultiShrinkScroller
+ xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
+ android:id="@+id/multiscroller"
android:focusable="true"
android:focusableInTouchMode="true"
- android:descendantFocusability="afterDescendants"
- android:background="@color/card_margin_color" >
+ android:descendantFocusability="afterDescendants" >
- <LinearLayout
- android:id="@android:id/content"
+ <!-- Will contain ToolBar and image behind ToolBar -->
+ <FrameLayout
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical" >
+ android:layout_height="@dimen/quickcontact_maximum_header_height"
+ android:layout_marginTop="@dimen/quickcontact_starting_empty_height"
+ android:background="@color/card_margin_color"
+ android:id="@+id/toolbar_parent">
+ <include layout="@layout/quickcontact_photo_container" />
+ </FrameLayout>
- <view
+ <com.android.contacts.widget.TouchlessScrollView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:fillViewport="true"
+ android:id="@+id/content_scroller"
+ android:background="@color/card_margin_color">
+
+ <!-- All the cards should be inserted into this LinearLayout -->
+ <LinearLayout
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- class="com.android.contacts.common.widget.ProportionalLayout"
- ex:direction="widthToHeight"
- ex:ratio="0.5" >
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:id="@+id/card_container">
+ <com.android.contacts.quickcontact.ExpandingEntryCardView
+ style="@style/ExpandingEntryCardStyle"
+ android:id="@+id/communication_card"
+ android:layout_marginTop="@dimen/communication_card_marginTop" />
+ </LinearLayout>
- <include layout="@layout/quickcontact_photo_container" />
- </view>
+ </com.android.contacts.widget.TouchlessScrollView>
- <com.android.contacts.quickcontact.ExpandingEntryCardView
- style="@style/ExpandingEntryCardStyle"
- android:id="@+id/communication_card"
- android:layout_marginTop="@dimen/communication_card_marginTop" />
- </LinearLayout>
-</ScrollView>
\ No newline at end of file
+</com.android.contacts.widget.MultiShrinkScroller>
diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml
index e72a0ee..d975093 100644
--- a/res/values-land/dimens.xml
+++ b/res/values-land/dimens.xml
@@ -17,7 +17,5 @@
<dimen name="dialpad_digits_height">66dip</dimen>
<dimen name="dialpad_digits_text_size">28sp</dimen>
<dimen name="dialpad_digits_margin_bottom">50dip</dimen>
- <!-- Center vertically -->
- <dimen name="quick_contact_top_position">-1px</dimen>
<dimen name="editor_type_label_width">120dip</dimen>
</resources>
diff --git a/res/values-sw600dp/dimens.xml b/res/values-sw600dp/dimens.xml
index 8661ddc..e99dccf 100644
--- a/res/values-sw600dp/dimens.xml
+++ b/res/values-sw600dp/dimens.xml
@@ -26,8 +26,6 @@
<dimen name="group_detail_border_padding">16dip</dimen>
<dimen name="search_view_width">400dip</dimen>
<dimen name="contact_tile_list_padding_top">16dip</dimen>
- <!-- Center vertically -->
- <dimen name="quick_contact_top_position">-1px</dimen>
<!-- Contact list (vertical scroll bar comes left) -->
<dimen name="list_visible_scrollbar_padding">32dip</dimen>
<dimen name="list_header_extra_top_padding">@dimen/contact_browser_list_top_margin</dimen>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index e60fb84..f20ff91 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -16,9 +16,17 @@
<resources>
<dimen name="account_selector_popup_width">400dip</dimen>
- <!-- Top position of quick contact. If this is -1, the vertical position is determined
- based on the source of the request -->
- <dimen name="quick_contact_top_position">48dip</dimen>
+ <!-- Initial height of transparent space above QuickContacts -->
+ <dimen name="quickcontact_starting_empty_height">150dp</dimen>
+ <!-- Initial/maximum height of QuickContact's header/avatar-photo -->
+ <dimen name="quickcontact_maximum_header_height">200dp</dimen>
+ <!-- Minimum height of QuickContact's header/avatar-photo -->
+ <dimen name="quickcontact_minimum_header_height">64dp</dimen>
+ <!-- If you scroll the QuickContact by this amount over the top of viewport,
+ the MultiShrinkScroller will smoothScroll the QuickContact to the top of the
+ viewport. This is used to give a sense of elasticity surrounding
+ the top of the viewport. -->
+ <dimen name="quickcontact_elastic_scroll_over_top_region">50dp</dimen>
<!-- Top padding of the entire contact editor -->
<dimen name="editor_padding_top">0dip</dimen>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index d282466..3584722 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -41,7 +41,14 @@
<style name="Theme">
</style>
- <style name="Theme.QuickContact" parent="@android:style/Theme.Quantum.Light">
+ <style name="Theme.QuickContact" parent="@style/PeopleTheme">
+ <item name="android:windowBackground">@android:color/transparent</item>
+ <item name="android:colorBackgroundCacheHint">@null</item>
+ <item name="android:windowFrame">@null</item>
+ <item name="android:windowContentOverlay">@null</item>
+ <item name="android:windowAnimationStyle">@null</item>
+ <item name="android:windowIsFloating">false</item>
+ <item name="android:windowIsTranslucent">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:listViewStyle">@style/ListViewStyle</item>
</style>