Loading quickstep/src/com/android/launcher3/taskbar/TaskbarRecentAppsController.kt +5 −2 Original line number Diff line number Diff line Loading @@ -46,8 +46,11 @@ class TaskbarRecentAppsController( enableDesktopWindowingMode() && enableDesktopWindowingTaskbarRunningApps() // TODO(b/343532825): Add a setting to disable Recents even when the flag is on. var isEnabled: Boolean = enableRecentsInTaskbar() || canShowRunningApps @VisibleForTesting var isEnabled = enableRecentsInTaskbar() || canShowRunningApps set(isEnabledFromTest){ field = isEnabledFromTest } // Initialized in init. private lateinit var controllers: TaskbarControllers Loading quickstep/src/com/android/launcher3/taskbar/customization/TaskbarContainer.kt 0 → 100644 +27 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 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.launcher3.taskbar.customization /** Enums for all feature container that taskbar supports. */ enum class TaskbarContainer { ALL_APPS, DIVIDER, APP_ICONS, RECENTS, NAV_BUTTONS, BUBBLES, } quickstep/src/com/android/launcher3/taskbar/customization/TaskbarFeatureEvaluator.kt 0 → 100644 +44 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 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.launcher3.taskbar.customization import com.android.launcher3.config.FeatureFlags.enableTaskbarPinning import com.android.launcher3.taskbar.TaskbarActivityContext import com.android.launcher3.taskbar.TaskbarControllers import com.android.launcher3.taskbar.TaskbarRecentAppsController import com.android.launcher3.util.DisplayController /** Evaluates all the features taskbar can have. */ class TaskbarFeatureEvaluator( private val taskbarActivityContext: TaskbarActivityContext, private val taskbarControllers: TaskbarControllers, ) { val hasAllApps = true val hasAppIcons = true val hasBubbles = false val hasNavButtons = taskbarActivityContext.isThreeButtonNav val hasRecents: Boolean get() = taskbarControllers.taskbarRecentAppsController.isEnabled val hasDivider: Boolean get() = enableTaskbarPinning() || hasRecents val isTransient: Boolean get() = DisplayController.isTransientTaskbar(taskbarActivityContext) } quickstep/src/com/android/launcher3/taskbar/customization/TaskbarIconSpecs.kt 0 → 100644 +41 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 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.launcher3.taskbar.customization /** Taskbar Icon Specs */ object TaskbarIconSpecs { val iconSize40dp = TaskbarIconSize(40) val iconSize44dp = TaskbarIconSize(44) val iconSize48dp = TaskbarIconSize(48) val iconSize52dp = TaskbarIconSize(52) val transientTaskbarIconSizes = arrayOf(iconSize44dp, iconSize48dp, iconSize52dp) val defaultPersistentIconSize = iconSize40dp val defaultTransientIconSize = iconSize44dp // defined as row, columns val transientTaskbarIconSizeByGridSize = mapOf( Pair(6, 5) to iconSize52dp, Pair(4, 5) to iconSize48dp, Pair(5, 4) to iconSize48dp, Pair(4, 4) to iconSize48dp, Pair(5, 6) to iconSize44dp, ) } quickstep/src/com/android/launcher3/taskbar/customization/TaskbarSpecsEvaluator.kt 0 → 100644 +60 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 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.launcher3.taskbar.customization /** Evaluates the taskbar specs based on the taskbar grid size and the taskbar icon size. */ class TaskbarSpecsEvaluator(private val taskbarFeatureEvaluator: TaskbarFeatureEvaluator) { fun getIconSizeByGrid(row: Int, column: Int): TaskbarIconSize { return if (taskbarFeatureEvaluator.isTransient) { TaskbarIconSpecs.transientTaskbarIconSizeByGridSize.getOrDefault( Pair(row, column), TaskbarIconSpecs.defaultTransientIconSize, ) } else { TaskbarIconSpecs.defaultPersistentIconSize } } fun getIconSizeStepDown(iconSize: TaskbarIconSize): TaskbarIconSize { if (!taskbarFeatureEvaluator.isTransient) return TaskbarIconSpecs.defaultPersistentIconSize val currentIconSizeIndex = TaskbarIconSpecs.transientTaskbarIconSizes.indexOf(iconSize) // return the current icon size if supplied icon size is unknown or we have reached the // min icon size. return if (currentIconSizeIndex == -1 || currentIconSizeIndex == 0) iconSize else TaskbarIconSpecs.transientTaskbarIconSizes[currentIconSizeIndex - 1] } fun getIconSizeStepUp(iconSize: TaskbarIconSize): TaskbarIconSize { if (!taskbarFeatureEvaluator.isTransient) return TaskbarIconSpecs.defaultPersistentIconSize val currentIconSizeIndex = TaskbarIconSpecs.transientTaskbarIconSizes.indexOf(iconSize) // return the current icon size if supplied icon size is unknown or we have reached the // max icon size. return if ( currentIconSizeIndex == -1 || currentIconSizeIndex == TaskbarIconSpecs.transientTaskbarIconSizes.size - 1 ) { iconSize } else { TaskbarIconSpecs.transientTaskbarIconSizes.get(currentIconSizeIndex + 1) } } } data class TaskbarIconSize(val size: Int) Loading
quickstep/src/com/android/launcher3/taskbar/TaskbarRecentAppsController.kt +5 −2 Original line number Diff line number Diff line Loading @@ -46,8 +46,11 @@ class TaskbarRecentAppsController( enableDesktopWindowingMode() && enableDesktopWindowingTaskbarRunningApps() // TODO(b/343532825): Add a setting to disable Recents even when the flag is on. var isEnabled: Boolean = enableRecentsInTaskbar() || canShowRunningApps @VisibleForTesting var isEnabled = enableRecentsInTaskbar() || canShowRunningApps set(isEnabledFromTest){ field = isEnabledFromTest } // Initialized in init. private lateinit var controllers: TaskbarControllers Loading
quickstep/src/com/android/launcher3/taskbar/customization/TaskbarContainer.kt 0 → 100644 +27 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 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.launcher3.taskbar.customization /** Enums for all feature container that taskbar supports. */ enum class TaskbarContainer { ALL_APPS, DIVIDER, APP_ICONS, RECENTS, NAV_BUTTONS, BUBBLES, }
quickstep/src/com/android/launcher3/taskbar/customization/TaskbarFeatureEvaluator.kt 0 → 100644 +44 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 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.launcher3.taskbar.customization import com.android.launcher3.config.FeatureFlags.enableTaskbarPinning import com.android.launcher3.taskbar.TaskbarActivityContext import com.android.launcher3.taskbar.TaskbarControllers import com.android.launcher3.taskbar.TaskbarRecentAppsController import com.android.launcher3.util.DisplayController /** Evaluates all the features taskbar can have. */ class TaskbarFeatureEvaluator( private val taskbarActivityContext: TaskbarActivityContext, private val taskbarControllers: TaskbarControllers, ) { val hasAllApps = true val hasAppIcons = true val hasBubbles = false val hasNavButtons = taskbarActivityContext.isThreeButtonNav val hasRecents: Boolean get() = taskbarControllers.taskbarRecentAppsController.isEnabled val hasDivider: Boolean get() = enableTaskbarPinning() || hasRecents val isTransient: Boolean get() = DisplayController.isTransientTaskbar(taskbarActivityContext) }
quickstep/src/com/android/launcher3/taskbar/customization/TaskbarIconSpecs.kt 0 → 100644 +41 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 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.launcher3.taskbar.customization /** Taskbar Icon Specs */ object TaskbarIconSpecs { val iconSize40dp = TaskbarIconSize(40) val iconSize44dp = TaskbarIconSize(44) val iconSize48dp = TaskbarIconSize(48) val iconSize52dp = TaskbarIconSize(52) val transientTaskbarIconSizes = arrayOf(iconSize44dp, iconSize48dp, iconSize52dp) val defaultPersistentIconSize = iconSize40dp val defaultTransientIconSize = iconSize44dp // defined as row, columns val transientTaskbarIconSizeByGridSize = mapOf( Pair(6, 5) to iconSize52dp, Pair(4, 5) to iconSize48dp, Pair(5, 4) to iconSize48dp, Pair(4, 4) to iconSize48dp, Pair(5, 6) to iconSize44dp, ) }
quickstep/src/com/android/launcher3/taskbar/customization/TaskbarSpecsEvaluator.kt 0 → 100644 +60 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 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.launcher3.taskbar.customization /** Evaluates the taskbar specs based on the taskbar grid size and the taskbar icon size. */ class TaskbarSpecsEvaluator(private val taskbarFeatureEvaluator: TaskbarFeatureEvaluator) { fun getIconSizeByGrid(row: Int, column: Int): TaskbarIconSize { return if (taskbarFeatureEvaluator.isTransient) { TaskbarIconSpecs.transientTaskbarIconSizeByGridSize.getOrDefault( Pair(row, column), TaskbarIconSpecs.defaultTransientIconSize, ) } else { TaskbarIconSpecs.defaultPersistentIconSize } } fun getIconSizeStepDown(iconSize: TaskbarIconSize): TaskbarIconSize { if (!taskbarFeatureEvaluator.isTransient) return TaskbarIconSpecs.defaultPersistentIconSize val currentIconSizeIndex = TaskbarIconSpecs.transientTaskbarIconSizes.indexOf(iconSize) // return the current icon size if supplied icon size is unknown or we have reached the // min icon size. return if (currentIconSizeIndex == -1 || currentIconSizeIndex == 0) iconSize else TaskbarIconSpecs.transientTaskbarIconSizes[currentIconSizeIndex - 1] } fun getIconSizeStepUp(iconSize: TaskbarIconSize): TaskbarIconSize { if (!taskbarFeatureEvaluator.isTransient) return TaskbarIconSpecs.defaultPersistentIconSize val currentIconSizeIndex = TaskbarIconSpecs.transientTaskbarIconSizes.indexOf(iconSize) // return the current icon size if supplied icon size is unknown or we have reached the // max icon size. return if ( currentIconSizeIndex == -1 || currentIconSizeIndex == TaskbarIconSpecs.transientTaskbarIconSizes.size - 1 ) { iconSize } else { TaskbarIconSpecs.transientTaskbarIconSizes.get(currentIconSizeIndex + 1) } } } data class TaskbarIconSize(val size: Int)