平台
RK3288 + Android 7.1 RK3368 + Android 7.1
需求
删除主界面顶部搜索框.
删除后
修改
packages/apps/Launcher3/src/com/android/launcher3/Launcher.java
增加函数isQsbDisabled, 用于判断是否删除搜索栏, 修改返回值即可设置是否删除.默认设置隐藏
diff
--git a
/packages
/apps
/Launcher3
/src
/com
/android
/launcher3
/Launcher
.java b
/packages
/apps
/Launcher3
/src
/com
/android
/launcher3
/Launcher
.java
index
8bb0133
..3e6ad5a
100755
--- a
/packages
/apps
/Launcher3
/src
/com
/android
/launcher3
/Launcher
.java
+++ b
/packages
/apps
/Launcher3
/src
/com
/android
/launcher3
/Launcher
.java
@@
-1059,6 +1059,13 @@
public class Launcher extends Activity
if (mLauncherCallbacks
!= null
) {
mLauncherCallbacks
.onResume();
}
+
+
+ if(isQsbDisabled())mQsbContainer
.setVisibility(View
.GONE
);
+ }
+
+ public static boolean isQsbDisabled(){
+ return true;
}
@Override
packages/apps/Launcher3/src/com/android/launcher3/Workspace.java
判断并去除首页添加搜索框, 否则, 隐藏后, APP图标在拖动过程中, 搜索框的位置依然被占用修改 isQsbContainerPage, 隐藏状态下无意义.
diff
--git a
/packages
/apps
/Launcher3
/src
/com
/android
/launcher3
/Workspace
.java b
/packages
/apps
/Launcher3
/src
/com
/android
/launcher3
/Workspace
.java
old mode
100644
new mode 100755
index
340177d..3c99137
--- a
/packages
/apps
/Launcher3
/src
/com
/android
/launcher3
/Workspace
.java
+++ b
/packages
/apps
/Launcher3
/src
/com
/android
/launcher3
/Workspace
.java
@@
-629,7 +629,8 @@
public class Workspace extends PagedView
CellLayout
.LayoutParams lp
= new CellLayout.LayoutParams(0, 0, firstPage
.getCountX(), 1);
lp
.canReorder
= false;
- if (!firstPage
.addViewToCellLayout(qsb
, 0, getEmbeddedQsbId(), lp
, true)) {
+
+ if (!Launcher
.isQsbDisabled() && !firstPage
.addViewToCellLayout(qsb
, 0, getEmbeddedQsbId(), lp
, true)) {
Log
.e(TAG
, "Failed to add to item at (0, 0) to CellLayout");
}
}
@@
-4360,6 +4361,6 @@
public class Workspace extends PagedView
}
public static final boolean isQsbContainerPage(int pageNo
) {
- return pageNo
== 0;
+ return !Launcher
.isQsbDisabled() && pageNo
== 0;
}
}
packages/apps/Launcher3/src/com/android/launcher3/util/MultiStateAlphaController.java
禁止在动画过程重新设置为可见(保持隐藏/删除)
diff
--git a
/packages
/apps
/Launcher3
/src
/com
/android
/launcher3
/util
/MultiStateAlphaController
.java b
/packages
/apps
/Launcher3
/src
/com
/android
/launcher3
/util
/MultiStateAlphaController
.java
old mode
100644
new mode 100755
index
956fc9e
..8317195
--- a
/packages
/apps
/Launcher3
/src
/com
/android
/launcher3
/util
/MultiStateAlphaController
.java
+++ b
/packages
/apps
/Launcher3
/src
/com
/android
/launcher3
/util
/MultiStateAlphaController
.java
@@
-61,6 +61,10 @@
public class MultiStateAlphaController {
mTargetView
.setAlpha(finalAlpha
);
mTargetView
.setVisibility(finalAlpha
> 0 ? View
.VISIBLE
: (mAm
.isEnabled() ? View
.GONE
: View
.INVISIBLE
));
+
+ if(com
.android
.launcher3
.R
.id
.qsb_container
== mTargetView
.getId() && com
.android
.launcher3
.Launcher
.isQsbDisabled()){
+ mTargetView
.setVisibility(View
.GONE
);
+ }
}
补丁下载
Launcher3_removeSearchBar.tar.gz