From ca6234e084a71e0c968cff404620298bcd971fcc Mon Sep 17 00:00:00 2001 From: Will Haldean Brown Date: Wed, 12 Feb 2014 10:23:41 -0800 Subject: Add swipe-to-dismiss support to PhoneWindow. This adds a new window feature -- FEATURE_SWIPE_TO_DISMISS -- and a theme attribute to activate that feature. When the feature is activated, a SwipeDismissLayout is inflated as the DecorView layout. SwipeDismissLayout intercepts touch events and steals ones that are large swipes to the right if its children don't. PhoneWindow registers handlers that listen for these swipe events, translate the window when necessary, and finish the activity at the end of the gesture. Change-Id: I512e758f3c3ffd3b353dba3b911c0e80a88d6f5f --- core/res/res/anim/swipe_window_enter.xml | 26 ++++++++++++++++++++++++++ core/res/res/anim/swipe_window_exit.xml | 26 ++++++++++++++++++++++++++ core/res/res/layout/screen_swipe_dismiss.xml | 27 +++++++++++++++++++++++++++ core/res/res/values/attrs.xml | 5 +++++ core/res/res/values/styles.xml | 8 ++++++++ core/res/res/values/symbols.xml | 1 + core/res/res/values/themes_micro.xml | 20 ++++++++++++++++++++ 7 files changed, 113 insertions(+) create mode 100644 core/res/res/anim/swipe_window_enter.xml create mode 100644 core/res/res/anim/swipe_window_exit.xml create mode 100644 core/res/res/layout/screen_swipe_dismiss.xml (limited to 'core/res') diff --git a/core/res/res/anim/swipe_window_enter.xml b/core/res/res/anim/swipe_window_enter.xml new file mode 100644 index 0000000..e1617e2 --- /dev/null +++ b/core/res/res/anim/swipe_window_enter.xml @@ -0,0 +1,26 @@ + + + + + + diff --git a/core/res/res/anim/swipe_window_exit.xml b/core/res/res/anim/swipe_window_exit.xml new file mode 100644 index 0000000..ed0c5d3 --- /dev/null +++ b/core/res/res/anim/swipe_window_exit.xml @@ -0,0 +1,26 @@ + + + + + + diff --git a/core/res/res/layout/screen_swipe_dismiss.xml b/core/res/res/layout/screen_swipe_dismiss.xml new file mode 100644 index 0000000..90e970f --- /dev/null +++ b/core/res/res/layout/screen_swipe_dismiss.xml @@ -0,0 +1,27 @@ + + + + + + diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index 42e3b50..24ebff3 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -447,6 +447,10 @@ to {@link android.view.WindowManager.LayoutParams#FLAG_TRANSLUCENT_NAVIGATION}. --> + + + @@ -1604,6 +1608,7 @@ + + + -- cgit v1.1