add kotlin support for launcher

Bug: 193432925
Test: click on the app icon and check logcat
Change-Id: I2ca4d57105fe4e1b1dfc6c968a7c1bbd3cbd2151
This commit is contained in:
Thales Lima 2021-10-21 15:34:28 +01:00
parent 75c97f534b
commit 26f44911a6
5 changed files with 35 additions and 3 deletions

View File

@ -152,9 +152,13 @@ android_app {
], ],
srcs: [ srcs: [
"src/**/*.java", "src/**/*.java",
"src/**/*.kt",
"src_shortcuts_overrides/**/*.java", "src_shortcuts_overrides/**/*.java",
"src_shortcuts_overrides/**/*.kt",
"src_ui_overrides/**/*.java", "src_ui_overrides/**/*.java",
"src_ui_overrides/**/*.kt",
"ext_tests/src/**/*.java", "ext_tests/src/**/*.java",
"ext_tests/src/**/*.kt",
], ],
resource_dirs: [ resource_dirs: [
"ext_tests/res", "ext_tests/res",
@ -211,7 +215,10 @@ android_library {
// Source code used for test helpers // Source code used for test helpers
filegroup { filegroup {
name: "launcher-src-ext-tests", name: "launcher-src-ext-tests",
srcs: ["ext_tests/src/**/*.java"], srcs: [
"ext_tests/src/**/*.java",
"ext_tests/src/**/*.kt",
],
} }
// Common source files used to build launcher // Common source files used to build launcher
@ -219,8 +226,11 @@ filegroup {
name: "launcher-src-no-build-config", name: "launcher-src-no-build-config",
srcs: [ srcs: [
"src/**/*.java", "src/**/*.java",
"src/**/*.kt",
"src_shortcuts_overrides/**/*.java", "src_shortcuts_overrides/**/*.java",
"src_shortcuts_overrides/**/*.kt",
"quickstep/src/**/*.java", "quickstep/src/**/*.java",
"quickstep/src/**/*.kt",
], ],
} }
@ -235,9 +245,13 @@ android_library {
name: "LauncherGoResLib", name: "LauncherGoResLib",
srcs: [ srcs: [
"src/**/*.java", "src/**/*.java",
"src/**/*.kt",
"quickstep/src/**/*.java", "quickstep/src/**/*.java",
"quickstep/src/**/*.kt",
"go/src/**/*.java", "go/src/**/*.java",
"go/src/**/*.kt",
"go/quickstep/src/**/*.java", "go/quickstep/src/**/*.java",
"go/quickstep/src/**/*.kt",
], ],
resource_dirs: [ resource_dirs: [
"go/res", "go/res",

View File

@ -105,7 +105,7 @@ else
LOCAL_SDK_VERSION := system_current LOCAL_SDK_VERSION := system_current
LOCAL_MIN_SDK_VERSION := 26 LOCAL_MIN_SDK_VERSION := 26
endif endif
LOCAL_STATIC_ANDROID_LIBRARIES := Launcher3CommonDepsLib LOCAL_STATIC_ANDROID_LIBRARIES := LauncherGoResLib
LOCAL_SRC_FILES := \ LOCAL_SRC_FILES := \
$(call all-java-files-under, src) \ $(call all-java-files-under, src) \

View File

@ -20,6 +20,7 @@ import android.util.Log;
import com.android.systemui.shared.recents.model.Task.TaskKey; import com.android.systemui.shared.recents.model.Task.TaskKey;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map;
import java.util.function.Predicate; import java.util.function.Predicate;
/** /**
@ -117,7 +118,7 @@ public class TaskKeyLruCache<V> {
} }
@Override @Override
protected boolean removeEldestEntry(Entry<Integer, TaskKeyLruCache.Entry<V>> eldest) { protected boolean removeEldestEntry(Map.Entry<Integer, TaskKeyLruCache.Entry<V>> eldest) {
return size() > mMaxSize; return size() > mMaxSize;
} }
} }

View File

@ -0,0 +1,14 @@
package com.android.quickstep.views
import android.util.Log
// TODO(http://b/193432925)
class TaskMenuViewWithArrow {
companion object {
const val TAG = "TaskMenuViewWithArrow"
fun logSomething() {
Log.d(TAG, "It worked!")
}
}
}

View File

@ -115,6 +115,7 @@ import java.util.stream.Stream;
public class TaskView extends FrameLayout implements Reusable { public class TaskView extends FrameLayout implements Reusable {
private static final String TAG = TaskView.class.getSimpleName(); private static final String TAG = TaskView.class.getSimpleName();
private static final boolean DEBUG = false;
public static final int FLAG_UPDATE_ICON = 1; public static final int FLAG_UPDATE_ICON = 1;
public static final int FLAG_UPDATE_THUMBNAIL = FLAG_UPDATE_ICON << 1; public static final int FLAG_UPDATE_THUMBNAIL = FLAG_UPDATE_ICON << 1;
@ -808,6 +809,8 @@ public class TaskView extends FrameLayout implements Reusable {
} }
protected boolean showTaskMenuWithContainer(IconView iconView) { protected boolean showTaskMenuWithContainer(IconView iconView) {
// TODO(http://b/193432925)
if (DEBUG) TaskMenuViewWithArrow.Companion.logSomething();
return TaskMenuView.showForTask(mTaskIdAttributeContainer[0]); return TaskMenuView.showForTask(mTaskIdAttributeContainer[0]);
} }