Loading packages/SystemUI/src/com/android/systemui/statusbar/RemoteInputController.java +30 −5 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package com.android.systemui.statusbar; import com.android.internal.util.Preconditions; import com.android.systemui.Dependency; import com.android.systemui.statusbar.phone.StatusBarWindowManager; import com.android.systemui.statusbar.policy.HeadsUpManager; import com.android.systemui.statusbar.policy.RemoteInputView; import android.util.ArrayMap; Loading @@ -38,11 +37,11 @@ public class RemoteInputController { = new ArrayList<>(); private final ArrayMap<String, Object> mSpinning = new ArrayMap<>(); private final ArrayList<Callback> mCallbacks = new ArrayList<>(3); private final HeadsUpManager mHeadsUpManager; private final Delegate mDelegate; public RemoteInputController(HeadsUpManager headsUpManager) { public RemoteInputController(Delegate delegate) { addCallback(Dependency.get(StatusBarWindowManager.class)); mHeadsUpManager = headsUpManager; mDelegate = delegate; } /** Loading Loading @@ -114,7 +113,7 @@ public class RemoteInputController { } private void apply(NotificationData.Entry entry) { mHeadsUpManager.setRemoteInputActive(entry, isRemoteInputActive(entry)); mDelegate.setRemoteInputActive(entry, isRemoteInputActive(entry)); boolean remoteInputActive = isRemoteInputActive(); int N = mCallbacks.size(); for (int i = 0; i < N; i++) { Loading Loading @@ -204,9 +203,35 @@ public class RemoteInputController { } } public void requestDisallowLongPressAndDismiss() { mDelegate.requestDisallowLongPressAndDismiss(); } public void lockScrollTo(NotificationData.Entry entry) { mDelegate.lockScrollTo(entry); } public interface Callback { default void onRemoteInputActive(boolean active) {} default void onRemoteInputSent(NotificationData.Entry entry) {} } public interface Delegate { /** * Activate remote input if necessary. */ void setRemoteInputActive(NotificationData.Entry entry, boolean remoteInputActive); /** * Request that the view does not dismiss nor perform long press for the current touch. */ void requestDisallowLongPressAndDismiss(); /** * Request that the view is made visible by scrolling to it, and keep the scroll locked until * the user scrolls, or {@param v} loses focus or is detached. */ void lockScrollTo(NotificationData.Entry entry); } } packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +13 −1 Original line number Diff line number Diff line Loading @@ -3442,7 +3442,19 @@ public class StatusBar extends SystemUI implements DemoMode, private void addStatusBarWindow() { makeStatusBarView(); mStatusBarWindowManager = Dependency.get(StatusBarWindowManager.class); mRemoteInputController = new RemoteInputController(mHeadsUpManager); mRemoteInputController = new RemoteInputController(new RemoteInputController.Delegate() { public void setRemoteInputActive(NotificationData.Entry entry, boolean remoteInputActive) { mHeadsUpManager.setRemoteInputActive(entry, remoteInputActive); } public void lockScrollTo(NotificationData.Entry entry) { mStackScroller.lockScrollTo(entry.row); } public void requestDisallowLongPressAndDismiss() { mStackScroller.requestDisallowLongPress(); mStackScroller.requestDisallowDismiss(); } }); mStatusBarWindowManager.add(mStatusBarWindow, getStatusBarHeight()); } Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java +2 −31 Original line number Diff line number Diff line Loading @@ -53,11 +53,9 @@ import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.nano.MetricsProto; import com.android.systemui.Interpolators; import com.android.systemui.R; import com.android.systemui.statusbar.ExpandableView; import com.android.systemui.statusbar.NotificationData; import com.android.systemui.statusbar.RemoteInputController; import com.android.systemui.statusbar.notification.NotificationViewWrapper; import com.android.systemui.statusbar.stack.ScrollContainer; import com.android.systemui.statusbar.stack.StackStateAnimator; /** Loading @@ -82,8 +80,6 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene private NotificationData.Entry mEntry; private ScrollContainer mScrollContainer; private View mScrollContainerChild; private boolean mRemoved; private int mRevealCx; Loading Loading @@ -347,41 +343,16 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene @Override public boolean onInterceptTouchEvent(MotionEvent ev) { if (ev.getAction() == MotionEvent.ACTION_DOWN) { findScrollContainer(); if (mScrollContainer != null) { mScrollContainer.requestDisallowLongPress(); mScrollContainer.requestDisallowDismiss(); } mController.requestDisallowLongPressAndDismiss(); } return super.onInterceptTouchEvent(ev); } public boolean requestScrollTo() { findScrollContainer(); mScrollContainer.lockScrollTo(mScrollContainerChild); mController.lockScrollTo(mEntry); return true; } private void findScrollContainer() { if (mScrollContainer == null) { mScrollContainerChild = null; ViewParent p = this; while (p != null) { if (mScrollContainerChild == null && p instanceof ExpandableView) { mScrollContainerChild = (View) p; } if (p.getParent() instanceof ScrollContainer) { mScrollContainer = (ScrollContainer) p.getParent(); if (mScrollContainerChild == null) { mScrollContainerChild = (View) p; } break; } p = p.getParent(); } } } public boolean isActive() { return mEditText.isFocused() && mEditText.isEnabled(); } Loading packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +1 −6 Original line number Diff line number Diff line Loading @@ -108,8 +108,7 @@ import java.util.List; public class NotificationStackScrollLayout extends ViewGroup implements SwipeHelper.Callback, ExpandHelper.Callback, ScrollAdapter, ExpandableView.OnHeightChangedListener, NotificationGroupManager.OnGroupChangeListener, NotificationMenuRowPlugin.OnMenuEventListener, ScrollContainer, VisibilityLocationProvider { NotificationMenuRowPlugin.OnMenuEventListener, VisibilityLocationProvider { public static final float BACKGROUND_ALPHA_DIMMED = 0.7f; private static final String TAG = "StackScroller"; Loading Loading @@ -1195,7 +1194,6 @@ public class NotificationStackScrollLayout extends ViewGroup mScrollingEnabled = enable; } @Override public void lockScrollTo(View v) { if (mForcedScroll == v) { return; Loading @@ -1204,7 +1202,6 @@ public class NotificationStackScrollLayout extends ViewGroup scrollTo(v); } @Override public boolean scrollTo(View v) { ExpandableView expandableView = (ExpandableView) v; int positionInLinearLayout = getPositionInLinearLayout(v); Loading Loading @@ -3321,12 +3318,10 @@ public class NotificationStackScrollLayout extends ViewGroup } } @Override public void requestDisallowLongPress() { cancelLongPress(); } @Override public void requestDisallowDismiss() { mDisallowDismissInThisMotion = true; } Loading packages/SystemUI/src/com/android/systemui/statusbar/stack/ScrollContainer.javadeleted 100644 → 0 +0 −48 Original line number Diff line number Diff line /* * Copyright (C) 2016 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 */ package com.android.systemui.statusbar.stack; import android.view.View; /** * Interface for container layouts that scroll and listen for long presses. A child that * wants to handle long press can use this to cancel the parents long press logic or request * to be made visible by scrolling to it. */ public interface ScrollContainer { /** * Request that the view does not perform long press for the current touch. */ void requestDisallowLongPress(); /** * Request that the view is made visible by scrolling to it. * Return true if it scrolls. */ boolean scrollTo(View v); /** * Like {@link #scrollTo(View)}, but keeps the scroll locked until the user * scrolls, or {@param v} loses focus or is detached. */ void lockScrollTo(View v); /** * Request that the view does not dismiss for the current touch. */ void requestDisallowDismiss(); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/RemoteInputController.java +30 −5 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package com.android.systemui.statusbar; import com.android.internal.util.Preconditions; import com.android.systemui.Dependency; import com.android.systemui.statusbar.phone.StatusBarWindowManager; import com.android.systemui.statusbar.policy.HeadsUpManager; import com.android.systemui.statusbar.policy.RemoteInputView; import android.util.ArrayMap; Loading @@ -38,11 +37,11 @@ public class RemoteInputController { = new ArrayList<>(); private final ArrayMap<String, Object> mSpinning = new ArrayMap<>(); private final ArrayList<Callback> mCallbacks = new ArrayList<>(3); private final HeadsUpManager mHeadsUpManager; private final Delegate mDelegate; public RemoteInputController(HeadsUpManager headsUpManager) { public RemoteInputController(Delegate delegate) { addCallback(Dependency.get(StatusBarWindowManager.class)); mHeadsUpManager = headsUpManager; mDelegate = delegate; } /** Loading Loading @@ -114,7 +113,7 @@ public class RemoteInputController { } private void apply(NotificationData.Entry entry) { mHeadsUpManager.setRemoteInputActive(entry, isRemoteInputActive(entry)); mDelegate.setRemoteInputActive(entry, isRemoteInputActive(entry)); boolean remoteInputActive = isRemoteInputActive(); int N = mCallbacks.size(); for (int i = 0; i < N; i++) { Loading Loading @@ -204,9 +203,35 @@ public class RemoteInputController { } } public void requestDisallowLongPressAndDismiss() { mDelegate.requestDisallowLongPressAndDismiss(); } public void lockScrollTo(NotificationData.Entry entry) { mDelegate.lockScrollTo(entry); } public interface Callback { default void onRemoteInputActive(boolean active) {} default void onRemoteInputSent(NotificationData.Entry entry) {} } public interface Delegate { /** * Activate remote input if necessary. */ void setRemoteInputActive(NotificationData.Entry entry, boolean remoteInputActive); /** * Request that the view does not dismiss nor perform long press for the current touch. */ void requestDisallowLongPressAndDismiss(); /** * Request that the view is made visible by scrolling to it, and keep the scroll locked until * the user scrolls, or {@param v} loses focus or is detached. */ void lockScrollTo(NotificationData.Entry entry); } }
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +13 −1 Original line number Diff line number Diff line Loading @@ -3442,7 +3442,19 @@ public class StatusBar extends SystemUI implements DemoMode, private void addStatusBarWindow() { makeStatusBarView(); mStatusBarWindowManager = Dependency.get(StatusBarWindowManager.class); mRemoteInputController = new RemoteInputController(mHeadsUpManager); mRemoteInputController = new RemoteInputController(new RemoteInputController.Delegate() { public void setRemoteInputActive(NotificationData.Entry entry, boolean remoteInputActive) { mHeadsUpManager.setRemoteInputActive(entry, remoteInputActive); } public void lockScrollTo(NotificationData.Entry entry) { mStackScroller.lockScrollTo(entry.row); } public void requestDisallowLongPressAndDismiss() { mStackScroller.requestDisallowLongPress(); mStackScroller.requestDisallowDismiss(); } }); mStatusBarWindowManager.add(mStatusBarWindow, getStatusBarHeight()); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java +2 −31 Original line number Diff line number Diff line Loading @@ -53,11 +53,9 @@ import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.nano.MetricsProto; import com.android.systemui.Interpolators; import com.android.systemui.R; import com.android.systemui.statusbar.ExpandableView; import com.android.systemui.statusbar.NotificationData; import com.android.systemui.statusbar.RemoteInputController; import com.android.systemui.statusbar.notification.NotificationViewWrapper; import com.android.systemui.statusbar.stack.ScrollContainer; import com.android.systemui.statusbar.stack.StackStateAnimator; /** Loading @@ -82,8 +80,6 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene private NotificationData.Entry mEntry; private ScrollContainer mScrollContainer; private View mScrollContainerChild; private boolean mRemoved; private int mRevealCx; Loading Loading @@ -347,41 +343,16 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene @Override public boolean onInterceptTouchEvent(MotionEvent ev) { if (ev.getAction() == MotionEvent.ACTION_DOWN) { findScrollContainer(); if (mScrollContainer != null) { mScrollContainer.requestDisallowLongPress(); mScrollContainer.requestDisallowDismiss(); } mController.requestDisallowLongPressAndDismiss(); } return super.onInterceptTouchEvent(ev); } public boolean requestScrollTo() { findScrollContainer(); mScrollContainer.lockScrollTo(mScrollContainerChild); mController.lockScrollTo(mEntry); return true; } private void findScrollContainer() { if (mScrollContainer == null) { mScrollContainerChild = null; ViewParent p = this; while (p != null) { if (mScrollContainerChild == null && p instanceof ExpandableView) { mScrollContainerChild = (View) p; } if (p.getParent() instanceof ScrollContainer) { mScrollContainer = (ScrollContainer) p.getParent(); if (mScrollContainerChild == null) { mScrollContainerChild = (View) p; } break; } p = p.getParent(); } } } public boolean isActive() { return mEditText.isFocused() && mEditText.isEnabled(); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +1 −6 Original line number Diff line number Diff line Loading @@ -108,8 +108,7 @@ import java.util.List; public class NotificationStackScrollLayout extends ViewGroup implements SwipeHelper.Callback, ExpandHelper.Callback, ScrollAdapter, ExpandableView.OnHeightChangedListener, NotificationGroupManager.OnGroupChangeListener, NotificationMenuRowPlugin.OnMenuEventListener, ScrollContainer, VisibilityLocationProvider { NotificationMenuRowPlugin.OnMenuEventListener, VisibilityLocationProvider { public static final float BACKGROUND_ALPHA_DIMMED = 0.7f; private static final String TAG = "StackScroller"; Loading Loading @@ -1195,7 +1194,6 @@ public class NotificationStackScrollLayout extends ViewGroup mScrollingEnabled = enable; } @Override public void lockScrollTo(View v) { if (mForcedScroll == v) { return; Loading @@ -1204,7 +1202,6 @@ public class NotificationStackScrollLayout extends ViewGroup scrollTo(v); } @Override public boolean scrollTo(View v) { ExpandableView expandableView = (ExpandableView) v; int positionInLinearLayout = getPositionInLinearLayout(v); Loading Loading @@ -3321,12 +3318,10 @@ public class NotificationStackScrollLayout extends ViewGroup } } @Override public void requestDisallowLongPress() { cancelLongPress(); } @Override public void requestDisallowDismiss() { mDisallowDismissInThisMotion = true; } Loading
packages/SystemUI/src/com/android/systemui/statusbar/stack/ScrollContainer.javadeleted 100644 → 0 +0 −48 Original line number Diff line number Diff line /* * Copyright (C) 2016 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 */ package com.android.systemui.statusbar.stack; import android.view.View; /** * Interface for container layouts that scroll and listen for long presses. A child that * wants to handle long press can use this to cancel the parents long press logic or request * to be made visible by scrolling to it. */ public interface ScrollContainer { /** * Request that the view does not perform long press for the current touch. */ void requestDisallowLongPress(); /** * Request that the view is made visible by scrolling to it. * Return true if it scrolls. */ boolean scrollTo(View v); /** * Like {@link #scrollTo(View)}, but keeps the scroll locked until the user * scrolls, or {@param v} loses focus or is detached. */ void lockScrollTo(View v); /** * Request that the view does not dismiss for the current touch. */ void requestDisallowDismiss(); }