Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 568628dc authored by Will Haldean Brown's avatar Will Haldean Brown
Browse files

Manually merge commit '2faf28cf' into master

Original commit message:

  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.

Conflicts:
	core/java/android/view/Window.java
	core/res/res/values/attrs.xml

Change-Id: I943290b436864ca4a1bd401b88d696e08c921cdd
parents 0a5500a8 2faf28cf
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -3120,6 +3120,7 @@ package android.app {
    method public void onUserInteraction();
    method protected void onUserLeaveHint();
    method public void onWindowAttributesChanged(android.view.WindowManager.LayoutParams);
    method public void onWindowDismissed();
    method public void onWindowFocusChanged(boolean);
    method public android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback);
    method public void openContextMenu(android.view.View);
@@ -3641,6 +3642,7 @@ package android.app {
    method public boolean onTouchEvent(android.view.MotionEvent);
    method public boolean onTrackballEvent(android.view.MotionEvent);
    method public void onWindowAttributesChanged(android.view.WindowManager.LayoutParams);
    method public void onWindowDismissed();
    method public void onWindowFocusChanged(boolean);
    method public android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback);
    method public void openContextMenu(android.view.View);
@@ -23741,6 +23743,7 @@ package android.service.dreams {
    method public boolean onPreparePanel(int, android.view.View, android.view.Menu);
    method public boolean onSearchRequested();
    method public void onWindowAttributesChanged(android.view.WindowManager.LayoutParams);
    method public void onWindowDismissed();
    method public void onWindowFocusChanged(boolean);
    method public android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback);
    method public void setContentView(int);
@@ -29905,6 +29908,7 @@ package android.view {
    field public static final int FEATURE_OPTIONS_PANEL = 0; // 0x0
    field public static final int FEATURE_PROGRESS = 2; // 0x2
    field public static final int FEATURE_RIGHT_ICON = 4; // 0x4
    field public static final int FEATURE_SWIPE_TO_DISMISS = 11; // 0xb
    field public static final int ID_ANDROID_CONTENT = 16908290; // 0x1020002
    field public static final int PROGRESS_END = 10000; // 0x2710
    field public static final int PROGRESS_INDETERMINATE_OFF = -4; // 0xfffffffc
@@ -29936,6 +29940,7 @@ package android.view {
    method public abstract boolean onPreparePanel(int, android.view.View, android.view.Menu);
    method public abstract boolean onSearchRequested();
    method public abstract void onWindowAttributesChanged(android.view.WindowManager.LayoutParams);
    method public abstract void onWindowDismissed();
    method public abstract void onWindowFocusChanged(boolean);
    method public abstract android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback);
  }
+7 −0
Original line number Diff line number Diff line
@@ -2463,6 +2463,13 @@ public class Activity extends ContextThemeWrapper
        return false;
    }

    /**
     * Called when the main window associated with the activity has been dismissed.
     */
    public void onWindowDismissed() {
        finish();
    }
    
    /**
     * Called to process key events.  You can override this to intercept all 
     * key events before they are dispatched to the window.  Be sure to call 
+4 −0
Original line number Diff line number Diff line
@@ -708,6 +708,10 @@ public class Dialog implements DialogInterface, Window.Callback,
    public void onDetachedFromWindow() {
    }

    public void onWindowDismissed() {
        dismiss();
    }
    
    /**
     * Called to process key events.  You can override this to intercept all 
     * key events before they are dispatched to the window.  Be sure to call 
+4 −0
Original line number Diff line number Diff line
@@ -300,6 +300,10 @@ public class DreamService extends Service implements Window.Callback {
    public void onDetachedFromWindow() {
    }

    @Override
    public void onWindowDismissed() {
    }

    /** {@inheritDoc} */
    @Override
    public void onPanelClosed(int featureId, Menu menu) {
+11 −1
Original line number Diff line number Diff line
@@ -97,6 +97,10 @@ public abstract class Window {
     * If overlay is enabled, the action mode UI will be allowed to cover existing window content.
     */
    public static final int FEATURE_ACTION_MODE_OVERLAY = 10;
    /**
     * Flag for requesting a decoration-free window that is dismissed by swiping from the left.
     */
    public static final int FEATURE_SWIPE_TO_DISMISS = 11;
    /**
     * Flag for requesting that window content changes should be represented
     * with scenes and transitions.
@@ -105,7 +109,7 @@ public abstract class Window {
     *
     * @see #setContentView
     */
    public static final int FEATURE_CONTENT_TRANSITIONS = 11;
    public static final int FEATURE_CONTENT_TRANSITIONS = 12;

    /**
     * Max value used as a feature ID
@@ -404,6 +408,12 @@ public abstract class Window {
         * @param mode The mode that was just finished.
         */
        public void onActionModeFinished(ActionMode mode);

        /**
         * Called when a window is dismissed. This informs the callback that the
         * window is gone, and it should finish itself.
         */
        public void onWindowDismissed();
    }

    public Window(Context context) {
Loading