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

Commit b10f2a3d authored by Jagrut Desai's avatar Jagrut Desai
Browse files

Refactor TaskbarActivityContext#applyDeviceProfile

Test: presubmit
Bug: 308024141
Flag: LEGACY ENABLE_TASKBAR_PINNING DISABLED
Change-Id: Ic0ecc80f9b61910a917b93cbe62139e2c5d0d9d2
parent 24231d99
Loading
Loading
Loading
Loading
+14 −20
Original line number Diff line number Diff line
@@ -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,8 +300,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
     * the icon size
     */
    private void applyDeviceProfile(DeviceProfile originDeviceProfile) {
        mDeviceProfile = originDeviceProfile.toBuilder(this)
                .withDimensionsOverride(deviceProfile -> {
        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
@@ -309,28 +309,22 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
            // Update icon size
            deviceProfile.iconSizePx = deviceProfile.taskbarIconSize;
            deviceProfile.updateIconSize(1f, getResources());
                }).build();
        };
        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();
        }