1.将home界面的search bar 移除
/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java
// Add first page QSBif (FeatureFlags.QSB_ON_FIRST_SCREEN) {CellLayout firstScreen = mWorkspaceScreens.get(FIRST_SCREEN_ID);View qsb = mHomeElementInflater.inflate(R.layout.qsb_preview, firstScreen,false);CellLayout.LayoutParams lp =new CellLayout.LayoutParams(0, 0, firstScreen.getCountX(), 1);lp.canReorder = false;// firstScreen.addViewToCellLayout(qsb, 0, R.id.search_container_workspace, lp, true);}
/src/com/android/launcher3/Workspace.java
/*** Initializes and binds the first page*/public void bindAndInitFirstWorkspaceScreen() {if (!FeatureFlags.QSB_ON_FIRST_SCREEN) {return;}// Add the first pageCellLayout firstPage = insertNewWorkspaceScreen(Workspace.FIRST_SCREEN_ID, getChildCount());// Always add a QSB on the first screen./*if (mQsb == null) {// In transposed layout, we add the QSB in the Grid. As workspace does not touch the// edges, we do not need a full width QSB.mQsb = LayoutInflater.from(getContext()).inflate(R.layout.search_container_workspace, firstPage, false);}*/int cellVSpan = FeatureFlags.EXPANDED_SMARTSPACE.get()? EXPANDED_SMARTSPACE_HEIGHT : DEFAULT_SMARTSPACE_HEIGHT;int cellHSpan = mLauncher.getDeviceProfile().inv.numSearchContainerColumns;CellLayout.LayoutParams lp = new CellLayout.LayoutParams(0, 0, cellHSpan, cellVSpan);lp.canReorder = false;/*if (!firstPage.addViewToCellLayout(mQsb, 0, R.id.search_container_workspace, lp, true)) {Log.e(TAG, "Failed to add to item at (0, 0) to CellLayout");mQsb = null;}*/}
如果只修改了上面的话,serach bar可以消失,但是会引入一个新问题:
还需要将Qsb的属性值QSB_ON_FIRST_SCREEN做一个更新
src_build_config/com/android/launcher3/BuildConfig.java
public final class BuildConfig {public static final String APPLICATION_ID = "com.android.launcher3";public static final boolean DEBUG = false;/*** Flag to state if the QSB is on the first screen and placed on the top,* this can be overwritten in other launchers with a different value, if needed.*/public static final boolean QSB_ON_FIRST_SCREEN = false;
}
未完待续...