Merge "Introduce QsFrameTranslateController."
This commit is contained in:
@@ -52,6 +52,7 @@ import com.android.systemui.shared.system.smartspace.SmartspaceTransitionControl
|
||||
import com.android.systemui.statusbar.CommandQueue;
|
||||
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
|
||||
import com.android.systemui.statusbar.NotificationShadeWindowController;
|
||||
import com.android.systemui.statusbar.QsFrameTranslateModule;
|
||||
import com.android.systemui.statusbar.notification.NotifPipelineFlags;
|
||||
import com.android.systemui.statusbar.notification.NotificationEntryManager;
|
||||
import com.android.systemui.statusbar.notification.collection.NotifPipeline;
|
||||
@@ -112,6 +113,7 @@ import dagger.Provides;
|
||||
LogModule.class,
|
||||
PeopleHubModule.class,
|
||||
PluginModule.class,
|
||||
QsFrameTranslateModule.class,
|
||||
ScreenshotModule.class,
|
||||
SensorModule.class,
|
||||
SettingsModule.class,
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import com.android.systemui.plugins.qs.QS;
|
||||
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController;
|
||||
import com.android.systemui.statusbar.phone.StatusBar;
|
||||
|
||||
/**
|
||||
* Calculates and moves the QS frame vertically.
|
||||
*/
|
||||
public abstract class QsFrameTranslateController {
|
||||
|
||||
protected StatusBar mStatusBar;
|
||||
|
||||
public QsFrameTranslateController(StatusBar statusBar) {
|
||||
mStatusBar = statusBar;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate and translate the QS Frame on the Y-axis.
|
||||
*/
|
||||
public abstract void translateQsFrame(View qsFrame, QS qs, float overExpansion,
|
||||
float qsTranslationForFullShadeTransition);
|
||||
|
||||
/**
|
||||
* Calculate the top padding for notifications panel. This could be the supplied
|
||||
* @param expansionHeight or recalculate it for a different value.
|
||||
*/
|
||||
public abstract float getNotificationsTopPadding(float expansionHeight,
|
||||
NotificationStackScrollLayoutController controller);
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import com.android.systemui.dagger.SysUISingleton;
|
||||
import com.android.systemui.plugins.qs.QS;
|
||||
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController;
|
||||
import com.android.systemui.statusbar.phone.StatusBar;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* Default implementation of QS Translation. This by default does not do much.
|
||||
*/
|
||||
@SysUISingleton
|
||||
public class QsFrameTranslateImpl extends QsFrameTranslateController {
|
||||
|
||||
@Inject
|
||||
public QsFrameTranslateImpl(StatusBar statusBar) {
|
||||
super(statusBar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateQsFrame(View qsFrame, QS qs, float overExpansion,
|
||||
float qsTranslationForFullShadeTransition) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getNotificationsTopPadding(float expansionHeight,
|
||||
NotificationStackScrollLayoutController controller) {
|
||||
|
||||
return expansionHeight;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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;
|
||||
|
||||
import com.android.systemui.dagger.SysUISingleton;
|
||||
|
||||
import dagger.Binds;
|
||||
import dagger.Module;
|
||||
|
||||
@Module
|
||||
public interface QsFrameTranslateModule {
|
||||
|
||||
@Binds
|
||||
@SysUISingleton
|
||||
QsFrameTranslateController bindQsFrameTranslateController(QsFrameTranslateImpl impl);
|
||||
}
|
||||
@@ -157,6 +157,7 @@ import com.android.systemui.statusbar.NotificationRemoteInputManager;
|
||||
import com.android.systemui.statusbar.NotificationShadeDepthController;
|
||||
import com.android.systemui.statusbar.NotificationShelfController;
|
||||
import com.android.systemui.statusbar.PulseExpansionHandler;
|
||||
import com.android.systemui.statusbar.QsFrameTranslateController;
|
||||
import com.android.systemui.statusbar.RemoteInputController;
|
||||
import com.android.systemui.statusbar.StatusBarState;
|
||||
import com.android.systemui.statusbar.SysuiStatusBarStateController;
|
||||
@@ -339,6 +340,7 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
private KeyguardStatusBarViewController mKeyguardStatusBarViewController;
|
||||
@VisibleForTesting QS mQs;
|
||||
private FrameLayout mQsFrame;
|
||||
private QsFrameTranslateController mQsFrameTranslateController;
|
||||
@Nullable
|
||||
private CommunalHostViewController mCommunalViewController;
|
||||
private KeyguardStatusViewController mKeyguardStatusViewController;
|
||||
@@ -775,7 +777,8 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
NotificationRemoteInputManager remoteInputManager,
|
||||
Optional<SysUIUnfoldComponent> unfoldComponent,
|
||||
ControlsComponent controlsComponent,
|
||||
InteractionJankMonitor interactionJankMonitor) {
|
||||
InteractionJankMonitor interactionJankMonitor,
|
||||
QsFrameTranslateController qsFrameTranslateController) {
|
||||
super(view,
|
||||
falsingManager,
|
||||
dozeLog,
|
||||
@@ -900,7 +903,6 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
|
||||
mMaxKeyguardNotifications = resources.getInteger(R.integer.keyguard_max_notification_count);
|
||||
mKeyguardUnfoldTransition = unfoldComponent.map(c -> c.getKeyguardUnfoldTransition());
|
||||
|
||||
mCommunalSourceCallback = () -> {
|
||||
mUiExecutor.execute(() -> setCommunalSource(null /*source*/));
|
||||
};
|
||||
@@ -908,7 +910,7 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
mCommunalSourceMonitorCallback = (source) -> {
|
||||
mUiExecutor.execute(() -> setCommunalSource(source));
|
||||
};
|
||||
|
||||
mQsFrameTranslateController = qsFrameTranslateController;
|
||||
updateUserSwitcherFlags();
|
||||
onFinishInflate();
|
||||
}
|
||||
@@ -2667,7 +2669,8 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
(float) (mQsMaxExpansionHeight),
|
||||
computeQsExpansionFraction());
|
||||
} else {
|
||||
return mQsExpansionHeight;
|
||||
return mQsFrameTranslateController.getNotificationsTopPadding(mQsExpansionHeight,
|
||||
mNotificationStackScrollLayoutController);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3251,8 +3254,8 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
}
|
||||
|
||||
private void updateQsFrameTranslation() {
|
||||
float translation = mOverExpansion / 2.0f + mQsTranslationForFullShadeTransition;
|
||||
mQsFrame.setTranslationY(translation);
|
||||
mQsFrameTranslateController.translateQsFrame(mQsFrame, mQs, mOverExpansion,
|
||||
mQsTranslationForFullShadeTransition);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -120,6 +120,7 @@ import com.android.systemui.statusbar.NotificationRemoteInputManager;
|
||||
import com.android.systemui.statusbar.NotificationShadeDepthController;
|
||||
import com.android.systemui.statusbar.NotificationShelfController;
|
||||
import com.android.systemui.statusbar.PulseExpansionHandler;
|
||||
import com.android.systemui.statusbar.QsFrameTranslateController;
|
||||
import com.android.systemui.statusbar.StatusBarStateControllerImpl;
|
||||
import com.android.systemui.statusbar.SysuiStatusBarStateController;
|
||||
import com.android.systemui.statusbar.VibratorHelper;
|
||||
@@ -354,6 +355,8 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
|
||||
private InteractionJankMonitor mInteractionJankMonitor;
|
||||
@Mock
|
||||
private NotificationsQSContainerController mNotificationsQSContainerController;
|
||||
@Mock
|
||||
private QsFrameTranslateController mQsFrameTranslateController;
|
||||
private Optional<SysUIUnfoldComponent> mSysUIUnfoldComponent = Optional.empty();
|
||||
private SysuiStatusBarStateController mStatusBarStateController;
|
||||
private NotificationPanelViewController mNotificationPanelViewController;
|
||||
@@ -530,7 +533,8 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
|
||||
mNotificationRemoteInputManager,
|
||||
mSysUIUnfoldComponent,
|
||||
mControlsComponent,
|
||||
mInteractionJankMonitor);
|
||||
mInteractionJankMonitor,
|
||||
mQsFrameTranslateController);
|
||||
mNotificationPanelViewController.initDependencies(
|
||||
mStatusBar,
|
||||
() -> {},
|
||||
|
||||
Reference in New Issue
Block a user