Refactor TaskbarActivityContext#applyDeviceProfile
Test: presubmit Bug: 308024141 Flag: LEGACY ENABLE_TASKBAR_PINNING DISABLED Change-Id: Ic0ecc80f9b61910a917b93cbe62139e2c5d0d9d2
This commit is contained in:
1 parent
24231d9994
commit
b10f2a3d03
1 file changed
+14
-20
@@ -129,6 +129,7 @@ import com.android.systemui.unfold.util.ScopedUnfoldTransitionProgressProvider;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.Collections;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* The {@link ActivityContext} with which we inflate Taskbar-related Views. This allows UI elements
|
||||
@@ -299,38 +300,31 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
* the icon size
|
||||
*/
|
||||
private void applyDeviceProfile(DeviceProfile originDeviceProfile) {
|
||||
mDeviceProfile = originDeviceProfile.toBuilder(this)
|
||||
.withDimensionsOverride(deviceProfile -> {
|
||||
// Taskbar should match the number of icons of hotseat
|
||||
deviceProfile.numShownHotseatIcons = originDeviceProfile.numShownHotseatIcons;
|
||||
// Same QSB width to have a smooth animation
|
||||
deviceProfile.hotseatQsbWidth = originDeviceProfile.hotseatQsbWidth;
|
||||
Consumer<DeviceProfile> overrideProvider = deviceProfile -> {
|
||||
// Taskbar should match the number of icons of hotseat
|
||||
deviceProfile.numShownHotseatIcons = originDeviceProfile.numShownHotseatIcons;
|
||||
// Same QSB width to have a smooth animation
|
||||
deviceProfile.hotseatQsbWidth = originDeviceProfile.hotseatQsbWidth;
|
||||
|
||||
// Update icon size
|
||||
deviceProfile.iconSizePx = deviceProfile.taskbarIconSize;
|
||||
deviceProfile.updateIconSize(1f, getResources());
|
||||
}).build();
|
||||
// Update icon size
|
||||
deviceProfile.iconSizePx = deviceProfile.taskbarIconSize;
|
||||
deviceProfile.updateIconSize(1f, getResources());
|
||||
};
|
||||
mDeviceProfile = originDeviceProfile.toBuilder(this)
|
||||
.withDimensionsOverride(overrideProvider).build();
|
||||
|
||||
if (DisplayController.isTransientTaskbar(this)) {
|
||||
mTransientTaskbarDeviceProfile = mDeviceProfile;
|
||||
mPersistentTaskbarDeviceProfile = mDeviceProfile
|
||||
.toBuilder(this)
|
||||
.withDimensionsOverride(deviceProfile -> {
|
||||
// Update icon size
|
||||
deviceProfile.iconSizePx = deviceProfile.taskbarIconSize;
|
||||
deviceProfile.updateIconSize(1f, getResources());
|
||||
})
|
||||
.withDimensionsOverride(overrideProvider)
|
||||
.setIsTransientTaskbar(false)
|
||||
.build();
|
||||
} else {
|
||||
mPersistentTaskbarDeviceProfile = mDeviceProfile;
|
||||
mTransientTaskbarDeviceProfile = mDeviceProfile
|
||||
.toBuilder(this)
|
||||
.withDimensionsOverride(deviceProfile -> {
|
||||
// Update icon size
|
||||
deviceProfile.iconSizePx = deviceProfile.taskbarIconSize;
|
||||
deviceProfile.updateIconSize(1f, getResources());
|
||||
})
|
||||
.withDimensionsOverride(overrideProvider)
|
||||
.setIsTransientTaskbar(true)
|
||||
.build();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user