From e9d4044483a7f13b49c46be7855ad4819001c18e Mon Sep 17 00:00:00 2001 From: Thales Lima Date: Fri, 7 Oct 2022 11:29:16 +0000 Subject: [PATCH] Remove KtR workaround Bug: 229947409 Test: m -j128 Launcher3QuickStep Launcher3QuickStepGo Launcher3 Launcher3Go NexusLauncherRelease NexusLauncherDebug SearchLauncherQuickStep SearchLauncher LauncherGoGoogle Change-Id: I5792cc6b30dfa856747a1576ef3cb195952c25c7 (cherry picked from commit 51e164688ec6b9b6375fe03fb1f09ae59f817776) Merged-In: I5792cc6b30dfa856747a1576ef3cb195952c25c7 --- .../taskbar/TaskbarInsetsController.kt | 5 +-- quickstep/src/com/android/quickstep/KtR.java | 41 ------------------- .../quickstep/views/TaskMenuViewWithArrow.kt | 15 ++++--- 3 files changed, 9 insertions(+), 52 deletions(-) delete mode 100644 quickstep/src/com/android/quickstep/KtR.java diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt index bbbc1e6b80..45e2b77f76 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt @@ -31,9 +31,9 @@ import android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION import com.android.launcher3.AbstractFloatingView import com.android.launcher3.AbstractFloatingView.TYPE_TASKBAR_ALL_APPS import com.android.launcher3.DeviceProfile +import com.android.launcher3.R import com.android.launcher3.anim.AlphaUpdateListener import com.android.launcher3.taskbar.TaskbarControllers.LoggableTaskbarController -import com.android.quickstep.KtR import java.io.PrintWriter /** @@ -42,8 +42,7 @@ import java.io.PrintWriter class TaskbarInsetsController(val context: TaskbarActivityContext): LoggableTaskbarController { /** The bottom insets taskbar provides to the IME when IME is visible. */ - val taskbarHeightForIme: Int = context.resources.getDimensionPixelSize( - KtR.dimen.taskbar_ime_size) + val taskbarHeightForIme: Int = context.resources.getDimensionPixelSize(R.dimen.taskbar_ime_size) private val touchableRegion: Region = Region() private val deviceProfileChangeListener = { _: DeviceProfile -> onTaskbarWindowHeightOrInsetsChanged() diff --git a/quickstep/src/com/android/quickstep/KtR.java b/quickstep/src/com/android/quickstep/KtR.java deleted file mode 100644 index 758c6e08ef..0000000000 --- a/quickstep/src/com/android/quickstep/KtR.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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.quickstep; - -import com.android.launcher3.R; - -/** - * Bridge class to allow using resources in Kotlin. - *
- * TODO(b/204069723) Can't use resources directly in Kotlin - */ -public class KtR { - public static final class id { - public static int menu_option_layout = R.id.menu_option_layout; - } - - public static final class dimen { - public static int task_menu_spacing = R.dimen.task_menu_spacing; - public static int task_menu_horizontal_padding = R.dimen.task_menu_horizontal_padding; - public static int taskbar_ime_size = R.dimen.taskbar_ime_size; - } - - public static final class layout { - public static int task_menu_with_arrow = R.layout.task_menu_with_arrow; - public static int task_view_menu_option = R.layout.task_view_menu_option; - } -} diff --git a/quickstep/src/com/android/quickstep/views/TaskMenuViewWithArrow.kt b/quickstep/src/com/android/quickstep/views/TaskMenuViewWithArrow.kt index b586ac37b0..bdc0585f83 100644 --- a/quickstep/src/com/android/quickstep/views/TaskMenuViewWithArrow.kt +++ b/quickstep/src/com/android/quickstep/views/TaskMenuViewWithArrow.kt @@ -37,7 +37,6 @@ import com.android.launcher3.popup.ArrowPopup import com.android.launcher3.popup.RoundedArrowDrawable import com.android.launcher3.popup.SystemShortcut import com.android.launcher3.util.Themes -import com.android.quickstep.KtR import com.android.quickstep.TaskOverlayFactory import com.android.quickstep.views.TaskView.TaskIdAttributeContainer @@ -53,9 +52,9 @@ class TaskMenuViewWithArrow : ArrowPopup { .fromContext(taskContainer.taskView.context) val taskMenuViewWithArrow = activity.layoutInflater .inflate( - KtR.layout.task_menu_with_arrow, - activity.dragLayer, - false + R.layout.task_menu_with_arrow, + activity.dragLayer, + false ) as TaskMenuViewWithArrow<*> return taskMenuViewWithArrow.populateAndShowForTask(taskContainer, alignSecondRow) @@ -93,7 +92,7 @@ class TaskMenuViewWithArrow : ArrowPopup { private var optionMeasuredHeight = 0 private val arrowHorizontalPadding: Int get() = if (taskView.isFocusedTask) - resources.getDimensionPixelSize(KtR.dimen.task_menu_horizontal_padding) + resources.getDimensionPixelSize(R.dimen.task_menu_horizontal_padding) else 0 @@ -119,7 +118,7 @@ class TaskMenuViewWithArrow : ArrowPopup { override fun onFinishInflate() { super.onFinishInflate() - optionLayout = findViewById(KtR.id.menu_option_layout) + optionLayout = findViewById(R.id.menu_option_layout) } private fun populateAndShowForTask( @@ -170,7 +169,7 @@ class TaskMenuViewWithArrow : ArrowPopup { // Add the spaces between items val divider = ShapeDrawable(RectShape()) divider.paint.color = resources.getColor(android.R.color.transparent) - val dividerSpacing = resources.getDimension(KtR.dimen.task_menu_spacing).toInt() + val dividerSpacing = resources.getDimension(R.dimen.task_menu_spacing).toInt() optionLayout.showDividers = SHOW_DIVIDER_MIDDLE // Set the orientation, which makes the menu show @@ -187,7 +186,7 @@ class TaskMenuViewWithArrow : ArrowPopup { private fun addMenuOption(menuOption: SystemShortcut<*>) { val menuOptionView = mActivityContext.layoutInflater.inflate( - KtR.layout.task_view_menu_option, this, false + R.layout.task_view_menu_option, this, false ) as LinearLayout menuOption.setIconAndLabelFor( menuOptionView.findViewById(R.id.icon),