summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2013-08-13 10:10:57 -0700
committerYorke Lee <yorkelee@google.com>2013-08-16 10:56:25 -0700
commit11ee58b1b8711c6d3b2ade6a71835b6c102a08a7 (patch)
tree5d12046a569043637fba7fbd72d1adeed570dc3d /res
parentba6b3366f21c47454b3ba5189e94bb6bf58fd11d (diff)
Use swipe helper for swiping
* Use SwipeHelper for swiping, in SwipeableListView for regular favorites. SwipeHelper and SwipeableListView are copied from DeskClock, with minor modifications (to prevent swiping or call log items, and all contact buttons). * Make ContactTileRow implement SwipeHelperCallback so that tiled favorites can be swiped. * Remove PhoneFavoriteGestureListener * Add selectable item backgrounds to undo buttons on removal dialog * Moved common code shared by PhoneFavoriteRegularRowView and PhoneFavoriteSquareTileView to PhoneFavoriteTileView * Standardize layout ids for phone_favorite_regular_row_view and phone_favorite_tile_view * Add long click listener to PhoneFavoriteTileView to trigger the start of a drag and drop operation * Remove any contact entries that are in the removal dialog phase if the app is paused Bug: 10257340 Bug: 10341201 Bug: 10328093 Bug: 10290239 Bug: 10262721 Bug: 10257340 Change-Id: I20448048b658759f6de75d643d2150be5a6ba8af
Diffstat (limited to 'res')
-rw-r--r--res/layout/phone_favorite_regular_row_view.xml8
-rw-r--r--res/layout/phone_favorite_tile_view.xml12
-rw-r--r--res/layout/phone_favorites_fragment.xml2
-rw-r--r--res/values/animation_constants.xml30
-rw-r--r--res/values/ids.xml22
5 files changed, 65 insertions, 9 deletions
diff --git a/res/layout/phone_favorite_regular_row_view.xml b/res/layout/phone_favorite_regular_row_view.xml
index 137d3da60..8ac01d666 100644
--- a/res/layout/phone_favorite_regular_row_view.xml
+++ b/res/layout/phone_favorite_regular_row_view.xml
@@ -17,7 +17,7 @@
<!-- Layout parameters are set programmatically. -->
<view
xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/contact_tile_frequent_phone"
+ android:id="@+id/contact_tile"
class="com.android.dialer.list.PhoneFavoriteRegularRowView">
<RelativeLayout
@@ -33,7 +33,7 @@
android:layout_height="64dip"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
- android:nextFocusRight="@id/contact_tile_frequent_phone"
+ android:nextFocusRight="@id/contact_tile"
android:scaleType="centerCrop"
android:focusable="true" />
@@ -88,7 +88,9 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:clickable="true"
- android:layout_marginRight="30dp"
+ android:paddingStart="30dp"
+ android:paddingEnd="30dp"
+ android:background="?android:attr/selectableItemBackground"
android:gravity="center_vertical">
<ImageView
diff --git a/res/layout/phone_favorite_tile_view.xml b/res/layout/phone_favorite_tile_view.xml
index 6242b96a2..a0ef1af0e 100644
--- a/res/layout/phone_favorite_tile_view.xml
+++ b/res/layout/phone_favorite_tile_view.xml
@@ -18,11 +18,11 @@
android:paddingBottom="1dip"
android:paddingRight="1dip"
android:paddingEnd="1dip"
- android:background="@color/background_dialer_light"
+ android:id="@+id/contact_tile"
class="com.android.dialer.list.PhoneFavoriteSquareTileView" >
<RelativeLayout
- android:id="@+id/contact_tile_favorite_card"
+ android:id="@+id/contact_favorite_card"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true">
@@ -86,18 +86,19 @@
</RelativeLayout>
<LinearLayout
- android:id="@+id/favorite_tile_remove_dialogue"
+ android:id="@+id/favorite_remove_dialogue"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:gravity="center_horizontal"
+ android:background="@color/background_dialer_light"
android:alpha="0.0"
android:visibility="gone">
<TextView
- android:id="@+id/favorite_tile_remove_dialogue_text"
+ android:id="@+id/favorite_remove_dialogue_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/favorite_hidden"
@@ -112,11 +113,12 @@
android:textAlignment="center" />
<LinearLayout
- android:id="@+id/favorite_tile_remove_undo_button"
+ android:id="@+id/favorite_remove_undo_button"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
+ android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:layout_weight="1"
android:layout_gravity="bottom">
diff --git a/res/layout/phone_favorites_fragment.xml b/res/layout/phone_favorites_fragment.xml
index 2b6bbe447..6a3320bb7 100644
--- a/res/layout/phone_favorites_fragment.xml
+++ b/res/layout/phone_favorites_fragment.xml
@@ -28,7 +28,7 @@
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
- <ListView
+ <com.android.dialer.list.SwipeableListView
android:id="@+id/contact_tile_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/res/values/animation_constants.xml b/res/values/animation_constants.xml
new file mode 100644
index 000000000..77b762739
--- /dev/null
+++ b/res/values/animation_constants.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2012 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
+ -->
+<resources>
+ <integer name="fade_duration">250</integer>
+
+ <!-- Swipe constants -->
+ <integer name="swipe_escape_velocity">100</integer>
+ <integer name="escape_animation_duration">200</integer>
+ <integer name="max_escape_animation_duration">400</integer>
+ <integer name="max_dismiss_velocity">2000</integer>
+ <integer name="snap_animation_duration">350</integer>
+ <integer name="swipe_scroll_slop">2</integer>
+ <dimen name="min_swipe">5dip</dimen>
+ <dimen name="min_vert">10dip</dimen>
+ <dimen name="min_lock">20dip</dimen>
+</resources> \ No newline at end of file
diff --git a/res/values/ids.xml b/res/values/ids.xml
new file mode 100644
index 000000000..2b095043a
--- /dev/null
+++ b/res/values/ids.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2012 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
+ -->
+<resources>
+ <item type="id"
+ name="is_swipeable_tag" />
+ <item type="id"
+ name="contact_entry_index_tag" />
+</resources> \ No newline at end of file