logo资料库

7.1 Launcher3 去掉应用抽屉.docx

第1页 / 共6页
第2页 / 共6页
第3页 / 共6页
第4页 / 共6页
第5页 / 共6页
第6页 / 共6页
资料共6页,全文预览结束
1 去除 all_apps_handle 键,调整 HotSeat 布局 2 去掉 searchBox bar 3 将所有应用摆在 launcher 第一层 4 去掉长按时删除选项 5 重复图标和异常 Launcher3 加载流程:进入 LauncherApplication -> LauncherAppState -> 进行初始化环境(通 过传递 sContext)。进行事件监听&&初始化一些环境。例如:横竖屏、当局语言、像素密度、 小部件和快捷图标数据库操作对象、应用图标缓存对象、初始化 LauncherMode 等。在初始 化过,从 Launcher 的 Oncreate 方法入手。mModel.startLoader(mWorkspace.getRestorePage()); 里加载数据 。在加载完成所有快捷方式后将其余为加载完的应用布局在第一层。 1、去掉向上滑动的箭头提示 all_apps_handle packages/apps/Launcher3/src/com/android/launcher3/pageindicators/PageIndicatorLineCaret.ja va mAllAppsHandle.setOnClickListener(mLauncher); mAllAppsHandle.setOnLongClickListener(mLauncher); mAllAppsHandle.setOnFocusChangeListener(mLauncher.mFocusHandler); mAllAppsHandle.setVisibility(GONE);//modify by luoyalong for 20180315 mLauncher.setAllAppsButton(mAllAppsHandle); + 2、去掉第一屏 firstPage packages/apps/Launcher3/src/com/android/launcher3/Workspace.java public void removeAllWorkspaceScreens() { ………………. removeAllViews(); mScreenOrder.clear(); mWorkspaceScreens.clear(); // Ensure that the first page is always present //bindAndInitFirstWorkspaceScreen(qsb); ;//modify by luoyalong for 20180315 // Re-enable the layout transitions enableLayoutTransitions(); } 3、去掉 searchBox bar packages/apps/Launcher3/res/layout/qsb_default_view.xml 屏蔽掉 FrameLayout 中 布局 packages/apps/Launcher3/src/com/android/launcher3/QsbContainerView.java public void onClick(View view) { - + /*if (view.getId() == R.id.btn_qsb_search) { if (view.getId() == R.id.btn_qsb_search) { getActivity().startSearch("", false, null, true); } else if (view.getId() == R.id.btn_qsb_setup) { // Allocate a new widget id for QSB @@ -181,7 +181,7 @@ public class QsbContainerView extends FrameLayout { intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,
sSavedWidgetId); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_PROVIDER, mWidgetInfo.provider); startActivityForResult(intent, REQUEST_BIND_QSB); - + - + - + } }*/ private View getDefaultView(LayoutInflater inflater, ViewGroup parent, boolean showSetup) { View v = inflater.inflate(R.layout.qsb_default_view, parent, false); if (showSetup) { /*if (showSetup) { View setupButton = v.findViewById(R.id.btn_qsb_setup); setupButton.setVisibility(View.VISIBLE); setupButton.setOnClickListener(this); } v.findViewById(R.id.btn_qsb_search).setOnClickListener(this); v.findViewById(R.id.btn_qsb_search).setOnClickListener(this);*/ return v; packages/apps/Launcher3/src/com/android/launcher3/Workspace.java CellLayout.LayoutParams lp = new CellLayout.LayoutParams(0, 0, firstPage.getCountX(), - 1); + firstPage.getCountX(), 1); /*CellLayout.LayoutParams lp = new CellLayout.LayoutParams(0, 0, lp.canReorder = false; if (!firstPage.addViewToCellLayout(qsb, 0, getEmbeddedQsbId(), lp, true)) { Log.e(TAG, "Failed to add to item at (0, 0) to CellLayout"); - + } }*/ 4、去掉向上滑动的动画效果 packages/apps/Launcher3/src/com/android/launcher3/Launcher.java public void showOverviewMode(boolean animated) { showOverviewMode(animated, false); //showOverviewMode(animated, false);//modify by luoyalong for 20180315 } 5、去掉长按时的删除选项 长按时,不该有删除选项 。DeleteDropTarget.java: 中更改长按时的监听 packages/apps/Launcher3/src/com/android/launcher3/DeleteDropTarget.java protected boolean supportsDrop(DragSource source, ItemInfo info) {
//modify by luoyalong for 20180315 begin if (LauncherAppState.isDisableAllApps()) { if (info instanceof ShortcutInfo) { ShortcutInfo item = (ShortcutInfo) info; return item.itemType != LauncherSettings.BaseLauncherColumns.ITEM_TYPE_APPLICATION; } return info instanceof LauncherAppWidgetInfo; } return (info instanceof ShortcutInfo) || (info instanceof LauncherAppWidgetInfo) || (info instanceof FolderInfo); //modify by luoyalong for 20180315 end } 6、去掉 hotseat 去掉 hotseat 布局文件 packages/apps/Launcher3/res/xml/default_workspace_5x6.xml - + packages/apps/Launcher3/src/com/android/launcher3/DeviceProfile.java lp.bottomMargin = workspacePadding.bottom;//hotseatBarHeightPx + mInsets.bottom; packages/apps/Launcher3/src/com/android/launcher3/Workspace.java @Override protected void enableAccessibleDrag(boolean enable) { - + this super.enableAccessibleDrag(enable); setEnableForLayout(mLauncher.getHotseat().getLayout(),enable); //setEnableForLayout(mLauncher.getHotseat().getLayout(),enable); // We need to allow our individual children to become click handlers in // case, so temporarily unset the click handlers. ……………………….. if (mLauncher.getHotseat() != null) { - + layouts.add(mLauncher.getHotseat().getLayout()); //layouts.add(mLauncher.getHotseat().getLayout()); } if (mLauncher.getHotseat() != null && !isDragWidget(d)) { if (isPointInSelfOverHotseat(d.x, d.y)) { layout = mLauncher.getHotseat().getLayout(); //layout = mLauncher.getHotseat().getLayout();//modify by luoyalong for - + 20180523 packages/apps/Launcher3/src/com/android/launcher3/Launcher.java
//mHotseat.updateColor(mExtractedColors, !mPaused);//modify by luoyalong for 20180523 mWorkspace.getPageIndicator().updateColor(mExtractedColors); 图标快速拖动异常 packages/apps/Launcher3/src/com/android/launcher3/dragndrop/DragController.java private PointF isFlingingToDelete(DragSource source) { - + if (mFlingToDeleteDropTarget == null) return null; if (true) return null;//modify by luoyalong for 20180606 7、当安装新应用时,安装的应用添加在第一层上。 packages/apps/Launcher3/src/com/android/launcher3/LauncherModel.java auncherModel$PackageUpdatedTask –> run(): ………….. final HashMap addedOrUpdatedApps = new HashMap<>(); //modify by luoyalong for 20180315 begin if (added != null) { final ArrayList addedInfos = new ArrayList(added); addAndBindAddedWorkspaceItems(context, addedInfos); //addAppsToAllApps(context, added); //modify by luoyalong for 20180315 end for (AppInfo ai : added) { addedOrUpdatedApps.put(ai.componentName, ai); } } 8、安装某些三方 apk 会出现重复图标,禁止已有快捷图标的在后台自动创建快捷方式 因为有的第三方应用会发送一个安装快捷方式的广播,接收到广播后就会在 Launcher 的 workspace 上创建快捷方式 解决方法: android 中后台自动创建快捷方式主要是通过发送 Action 为”android.intent.action.CREATE_SHORTCUT“的 broadcast,当然还会带有一些包含 icon,name 等 data frameworks/base/services/core/java/com/android/server/am/BroadcastQueue.java if (recIdx == 0) { r.dispatchTime = r.receiverTime; r.dispatchClockTime = System.currentTimeMillis(); if (DEBUG_BROADCAST_LIGHT) Slog.v(TAG_BROADCAST, "Processing ordered broadcast ["+ mQueueName + "] " + r); //modify by luoyalong for 20180315 begin if("background".equals(mQueueName)&& "com.android.launcher.action.INSTALL_SHORTCUT".equals(r.intent.getAction())){ return;
} //modify by luoyalong for 20180315 end } 9、无抽屉时的异常 packages/apps/Launcher3/src/com/android/launcher3/allapps/AllAppsTransitionController.ja va mDiscoBounceAnimation.setTarget(this); + + //modify by luoyalong for 20180312 begin if(mAppsView != null){ mAppsView.post(new Runnable() { @Override public void run() { @@ -425,6 +427,8 @@ public class AllAppsTransitionController implements TouchController, VerticalPul mDiscoBounceAnimation.start(); } }); } //modify by luoyalong for 20180312 end + + } 去掉桌面长按和捏动画 packages/apps/Launcher3/src/com/android/launcher3/Launcher.java public void showOverviewMode(boolean animated) { showOverviewMode(animated, false);//modify by luoyalong for 20180315 //showOverviewMode(animated, false);//modify by luoyalong for 20180315 - + } packages/apps/Launcher3/src/com/android/launcher3/PinchAnimationManager.java public void setAnimationProgress(float interpolatedProgress) { float interpolatedScale = interpolatedProgress * (1f - mOverviewScale) + mOverviewScale; float interpolatedTranslationY = (1f - interpolatedProgress) * mOverviewTranslationY; - - - - + + + + mWorkspace.setScaleX(interpolatedScale); mWorkspace.setScaleY(interpolatedScale); mWorkspace.setTranslationY(interpolatedTranslationY); setOverviewPanelsAlpha(1f - interpolatedProgress, 0); //mWorkspace.setScaleX(interpolatedScale); //mWorkspace.setScaleY(interpolatedScale); //mWorkspace.setTranslationY(interpolatedTranslationY); // setOverviewPanelsAlpha(1f - interpolatedProgress, 0);
} - + public void animateThreshold(float threshold, Workspace.State startState, Workspace.State goingTowards) { if (threshold == PinchThresholdManager.THRESHOLD_ONE) { /*if (threshold == PinchThresholdManager.THRESHOLD_ONE) { if (startState == OVERVIEW) { animateOverviewPanelButtons(goingTowards == OVERVIEW); } else if (startState == NORMAL) { @@ -169,7 +169,7 @@ public class PinchAnimationManager { } } else { Log.e(TAG, "Received unknown threshold to animate: " + threshold); } }*/ - + }
分享到:
收藏