Android 13.0 blocks the long press function of Launcher3 desktop app icon

1 Overview

In the product customization development of 13.0, the system default Launcher3 usually displays the app list on the second screen of the workspace. Click to enter the app list page. Long pressing the app icon will pop up the application information pop-up window and other information. However, product development needs
, There is no need to pop up this information, so we ask to remove the long press function of the app icon.

2. Core class that blocks the long press function of Launcher3 desktop app icon

packages\apps\Launcher3\src\com\android\launcher3\allapps\BaseAllAppsAdapter.java
packages/apps/Launcher3/src/com/android/launcher3/WorkspaceLayoutManager.java

3. Core function analysis and implementation of shielding long-press function of Launcher3 desktop app icon
3.1 AllAppsGridAdapter.java partially blocks long-press events


The outer layer of AllAppsRecyclerView is LauncherAllAppsContainerView, which is a subclass of AllAppsContainerView.
Setting the Adapter for AllAppsRecyclerView is encapsulated into AllAppsContainerView

It is mainly responsible for laying out the app list.
The BaseAllAppsAdapter in the workspace is the adapter that binds the app, so onCreateViewHolder(ViewGroup parent, int viewType) in the BaseAllAppsAdapter
calls different layout files according to different types.
VIEW_TYPE_ICON is the icon layout of the app. It
is set for AllAppsRecyclerView in AllAppsContainerView. BaseAllAppsAdapter and then in BaseAllAppsAda

Guess you like

Origin blog.csdn.net/baidu_41666295/article/details/132915218