Android8.1 Launcher3 去掉抽屉(二)
上篇博客是如何把allapp放到workspace中,但是遗留了几个问题:
a.有app变化时,更新workspace;
b.隐藏allapp;
c.去掉长按时的删除选项。
这篇博客会解决这几个问题:
1:有app变化时,更新workspace
src/com/android/launcher3/model/PackageUpdatedTask.java -> execute():
......
final ArrayList<AppInfo> addedOrModified = new ArrayList<>();
addedOrModified.addAll(appsList.added);
appsList.added.clear();
addedOrModified.addAll(appsList.modified);
appsList.modified.clear();
//更新begin
ArrayList<InstallShortcutReceiver.PendingInstallShortcutInfo> items = new ArrayList<>();
synchronized (this) {
for (AppInfo ai : addedOrModified) {
Intent data = ai.getIntent();
data.putExtra(Intent.EXTRA_SHORTCUT_INTENT, data);
data.putExtra(Intent.EXTRA_SHORTCUT_ICON, ai.iconBitmap);
data.putExtra(Intent.EXTRA_SHORTCUT_NAME, ai.title);
InstallShortcutReceiver.PendingInstallShortcutInfo info = new InstallShortcutReceiver.PendingInstallShortcutInfo(
data, ai.user, context)