diff options
-rw-r--r-- | res/drawable/item_background_material_borderless_dark.xml | 19 | ||||
-rw-r--r-- | res/drawable/item_background_material_dark.xml | 23 | ||||
-rw-r--r-- | res/layout/quickcontact_header.xml | 9 | ||||
-rw-r--r-- | res/values/colors.xml | 3 | ||||
-rw-r--r-- | res/values/styles.xml | 3 | ||||
-rw-r--r-- | src/com/android/contacts/widget/MultiShrinkScroller.java | 21 |
6 files changed, 69 insertions, 9 deletions
diff --git a/res/drawable/item_background_material_borderless_dark.xml b/res/drawable/item_background_material_borderless_dark.xml new file mode 100644 index 000000000..693bcaf6a --- /dev/null +++ b/res/drawable/item_background_material_borderless_dark.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2014 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<!-- Based on the Theme.Material's default selectableItemBackgroundBorderless --> +<ripple xmlns:android="http://schemas.android.com/apk/res/android" + android:color="@color/ripple_material_dark" />
\ No newline at end of file diff --git a/res/drawable/item_background_material_dark.xml b/res/drawable/item_background_material_dark.xml new file mode 100644 index 000000000..87b1e1747 --- /dev/null +++ b/res/drawable/item_background_material_dark.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2014 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<!-- Based on the Theme.Material's default selectableItemBackground --> +<ripple xmlns:android="http://schemas.android.com/apk/res/android" + android:color="@color/ripple_material_dark" > + <item android:id="@android:id/mask"> + <color android:color="@android:color/white" /> + </item> +</ripple>
\ No newline at end of file diff --git a/res/layout/quickcontact_header.xml b/res/layout/quickcontact_header.xml index 0c51746cb..50c4af0a2 100644 --- a/res/layout/quickcontact_header.xml +++ b/res/layout/quickcontact_header.xml @@ -28,7 +28,14 @@ android:id="@+id/photo" android:layout_width="match_parent" android:layout_height="match_parent" - android:scaleType="centerCrop" + android:clickable="false" + android:scaleType="centerCrop" /> + + <View + android:id="@+id/photo_touch_intercept_overlay" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@drawable/item_background_material_dark" android:contentDescription="@string/description_contact_photo" /> <!-- Need to set a non null background on Toolbar in order for MenuItem ripples to be drawn on diff --git a/res/values/colors.xml b/res/values/colors.xml index 89f39b8b3..76de472cb 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -52,4 +52,7 @@ <color name="call_arrow_green">#2aad6f</color> <color name="call_arrow_red">#ff2e58</color> + + <!-- Color of ripples use by Theme.Material. Taken from res/values/colors_material.xml --> + <color name="ripple_material_dark">#20ffffff</color> </resources> diff --git a/res/values/styles.xml b/res/values/styles.xml index ef66126d7..d29074bff 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -43,6 +43,9 @@ <item name="android:windowIsTranslucent">true</item> <item name="android:windowNoTitle">true</item> <item name="android:listViewStyle">@style/ListViewStyle</item> + <!-- We need to use a light ripple behind ActionBar items in order for them to + be visible when using some of the darker ActionBar tints --> + <item name="android:actionBarItemBackground">@drawable/item_background_material_borderless_dark</item> </style> <style name="PeopleTheme" parent="@android:style/Theme.Material.Light"> diff --git a/src/com/android/contacts/widget/MultiShrinkScroller.java b/src/com/android/contacts/widget/MultiShrinkScroller.java index 18f032acb..156c4bdcd 100644 --- a/src/com/android/contacts/widget/MultiShrinkScroller.java +++ b/src/com/android/contacts/widget/MultiShrinkScroller.java @@ -79,6 +79,7 @@ public class MultiShrinkScroller extends LinearLayout { private View mTransparentView; private MultiShrinkScrollerListener mListener; private TextView mLargeTextView; + private View mPhotoTouchInterceptOverlay; /** Contains desired location/size of the title, once the header is fully compressed */ private TextView mInvisiblePlaceholderTextView; private int mHeaderTintColor; @@ -134,7 +135,7 @@ public class MultiShrinkScroller extends LinearLayout { private final AnimatorListener mHeaderExpandAnimationListener = new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { - mPhotoView.setClickable(true); + mPhotoTouchInterceptOverlay.setClickable(true); } }; @@ -219,12 +220,16 @@ public class MultiShrinkScroller extends LinearLayout { mListener = listener; mPhotoView = (QuickContactImageView) findViewById(R.id.photo); - mPhotoView.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - expandCollapseHeader(); - } - }); + + if (!mIsTwoPanel) { + mPhotoTouchInterceptOverlay = findViewById(R.id.photo_touch_intercept_overlay); + mPhotoTouchInterceptOverlay.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + expandCollapseHeader(); + } + }); + } final WindowManager windowManager = (WindowManager) getContext().getSystemService( Context.WINDOW_SERVICE); @@ -375,7 +380,7 @@ public class MultiShrinkScroller extends LinearLayout { * complete. */ private void expandCollapseHeader() { - mPhotoView.setClickable(false); + mPhotoTouchInterceptOverlay.setClickable(false); if (getHeaderHeight() != mMaximumHeaderHeight) { // Expand header final ObjectAnimator animator = ObjectAnimator.ofInt(this, "headerHeight", |