首页 > 其他分享 >直播软件app开发,删除主页搜索框

直播软件app开发,删除主页搜索框

时间:2023-01-11 14:11:45浏览次数:47  
标签:src 主页 app apps 直播 launcher3 packages com android

直播软件app开发,删除主页搜索框

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();
         }
+
+        //AnsonCode hide search bar.
+        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)) {
+        //AnsonCode
+        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));
+        //AnsonCode
+        if(com.android.launcher3.R.id.qsb_container == mTargetView.getId() && com.android.launcher3.Launcher.isQsbDisabled()){
+            mTargetView.setVisibility(View.GONE);
+        }
     }
 
     /**

 以上就是直播软件app开发,删除主页搜索框, 更多内容欢迎关注之后的文章

 

标签:src,主页,app,apps,直播,launcher3,packages,com,android
From: https://www.cnblogs.com/yunbaomengnan/p/17043531.html

相关文章