8541E Android10-Launcher3 去掉hotseat

diff --git a/res/layout/launcher.xml b/res/layout/launcher.xml
old mode 100644
new mode 100755
index 7d3f09adbc..85573ae818
--- a/res/layout/launcher.xml
+++ b/res/layout/launcher.xml
@@ -43,7 +43,8 @@
         <!-- DO NOT CHANGE THE ID -->
         <include
             android:id="@+id/hotseat"
-            layout="@layout/hotseat" />
+            layout="@layout/hotseat" 
+           android:visibility="gone" />
 
         <include
             android:id="@+id/overview_panel"
diff --git a/res/xml/device_profiles.xml b/res/xml/device_profiles.xml
old mode 100644
new mode 100755
index c05c442259..53e176e25a
--- a/res/xml/device_profiles.xml
+++ b/res/xml/device_profiles.xml
@@ -23,7 +23,7 @@
         launcher:numColumns="3"
         launcher:numFolderRows="2"
         launcher:numFolderColumns="3"
-        launcher:numHotseatIcons="3"
+        launcher:numHotseatIcons="0"
         launcher:defaultLayoutId="@xml/default_workspace_3x3" >
 
         <display-option
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
old mode 100644
new mode 100755
index ce32dc80e4..068a2d6752
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -108,11 +108,11 @@ public class DeviceProfile {
     public int hotseatCellHeightPx;
     // In portrait: size = height, in landscape: size = width
     public int hotseatBarSizePx;
-    public final int hotseatBarTopPaddingPx;
-    public int hotseatBarBottomPaddingPx;
+    public final int hotseatBarTopPaddingPx = 0;
+    public int hotseatBarBottomPaddingPx = 0;
     // Start is the side next to the nav bar, end is the side next to the workspace
-    public final int hotseatBarSidePaddingStartPx;
-    public final int hotseatBarSidePaddingEndPx;
+    public final int hotseatBarSidePaddingStartPx = 0;
+    public final int hotseatBarSidePaddingEndPx = 0;
 
     // All apps
     public int allAppsCellHeightPx;
@@ -205,19 +205,19 @@ public class DeviceProfile {
 
         workspaceCellPaddingXPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_cell_padding_x);
 
-        hotseatBarTopPaddingPx =
-                res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_top_padding);
-        hotseatBarBottomPaddingPx = (isTallDevice ? 0
-                : res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_bottom_non_tall_padding))
-                + res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_bottom_padding);
-        hotseatBarSidePaddingEndPx =
-                res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_side_padding);
+//        hotseatBarTopPaddingPx =
+//                res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_top_padding);
+//        hotseatBarBottomPaddingPx = (isTallDevice ? 0
+//                : res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_bottom_non_tall_padding))
+//                + res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_bottom_padding);
+//        hotseatBarSidePaddingEndPx =
+//                res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_side_padding);
         // Add a bit of space between nav bar and hotseat in vertical bar layout.
-        hotseatBarSidePaddingStartPx = isVerticalBarLayout() ? verticalDragHandleSizePx : 0;
-        hotseatBarSizePx = ResourceUtils.pxFromDp(inv.iconSize, dm) + (isVerticalBarLayout()
-                ? (hotseatBarSidePaddingStartPx + hotseatBarSidePaddingEndPx)
-                : (res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_extra_vertical_size)
-                        + hotseatBarTopPaddingPx + hotseatBarBottomPaddingPx));
+//        hotseatBarSidePaddingStartPx = isVerticalBarLayout() ? verticalDragHandleSizePx : 0;
+//        hotseatBarSizePx = ResourceUtils.pxFromDp(inv.iconSize, dm) + (isVerticalBarLayout()
+//                ? (hotseatBarSidePaddingStartPx + hotseatBarSidePaddingEndPx)
+//                : (res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_extra_vertical_size)
+//                        + hotseatBarTopPaddingPx + hotseatBarBottomPaddingPx));
 
         // Calculate all of the remaining variables.
         updateAvailableDimensions(dm, res);
@@ -228,13 +228,13 @@ public class DeviceProfile {
             // ie. For a display with a large aspect ratio, we can keep the icons on the workspace
             // in portrait mode closer together by adding more height to the hotseat.
             // Note: This calculation was created after noticing a pattern in the design spec.
-            int extraSpace = getCellSize().y - iconSizePx - iconDrawablePaddingPx * 2
-                    - verticalDragHandleSizePx;
-            hotseatBarSizePx += extraSpace;
-            hotseatBarBottomPaddingPx += extraSpace;
+//            int extraSpace = getCellSize().y - iconSizePx - iconDrawablePaddingPx * 2
+//                   - verticalDragHandleSizePx;
+//            hotseatBarSizePx += extraSpace;
+//            hotseatBarBottomPaddingPx += extraSpace;
 
             // Recalculate the available dimensions using the new hotseat size.
-            updateAvailableDimensions(dm, res);
+//            updateAvailableDimensions(dm, res);
         }
         updateWorkspacePadding();
 
@@ -369,10 +369,11 @@ public class DeviceProfile {
 
         // Hotseat
         if (isVerticalLayout) {
-            hotseatBarSizePx = iconSizePx + hotseatBarSidePaddingStartPx
-                    + hotseatBarSidePaddingEndPx;
+//            hotseatBarSizePx = iconSizePx + hotseatBarSidePaddingStartPx
+//                    + hotseatBarSidePaddingEndPx;
         }
-        hotseatCellHeightPx = iconSizePx;
+//        hotseatCellHeightPx = iconSizePx;
+               hotseatCellHeightPx = 0;
 
         if (!isVerticalLayout) {
             int expectedWorkspaceHeight = availableHeightPx - hotseatBarSizePx
@@ -472,7 +473,7 @@ public class DeviceProfile {
         Rect padding = workspacePadding;
         if (isVerticalBarLayout()) {
             padding.top = 0;
-            padding.bottom = edgeMarginPx;
+//            padding.bottom = edgeMarginPx;
 
             int offset = 0;
             if (isMultiWindowMode) {
@@ -485,11 +486,11 @@ public class DeviceProfile {
                 }
             }
             if (isSeascape()) {
-                padding.left = hotseatBarSizePx;
-                padding.right = verticalDragHandleSizePx + offset;
+//                padding.left = hotseatBarSizePx;
+//                padding.right = verticalDragHandleSizePx + offset;
             } else {
-                padding.left = verticalDragHandleSizePx + offset;
-                padding.right = hotseatBarSizePx;
+//                padding.left = verticalDragHandleSizePx + offset;
+//                padding.right = hotseatBarSizePx;
             }
         } else {
             int paddingBottom = hotseatBarSizePx + verticalDragHandleSizePx
@@ -498,21 +499,21 @@ public class DeviceProfile {
                 // Pad the left and right of the workspace to ensure consistent spacing
                 // between all icons
                 // The amount of screen space available for left/right padding.
-                int availablePaddingX = Math.max(0, widthPx - ((inv.numColumns * cellWidthPx) +
-                        ((inv.numColumns - 1) * cellWidthPx)));
-                availablePaddingX = (int) Math.min(availablePaddingX,
-                        widthPx * MAX_HORIZONTAL_PADDING_PERCENT);
-                int availablePaddingY = Math.max(0, heightPx - edgeMarginPx - paddingBottom
-                        - (2 * inv.numRows * cellHeightPx) - hotseatBarTopPaddingPx
-                        - hotseatBarBottomPaddingPx);
-                padding.set(availablePaddingX / 2, edgeMarginPx + availablePaddingY / 2,
-                        availablePaddingX / 2, paddingBottom + availablePaddingY / 2);
+//                int availablePaddingX = Math.max(0, widthPx - ((inv.numColumns * cellWidthPx) +
+//                        ((inv.numColumns - 1) * cellWidthPx)));
+//                availablePaddingX = (int) Math.min(availablePaddingX,
+//                        widthPx * MAX_HORIZONTAL_PADDING_PERCENT);
+//                int availablePaddingY = Math.max(0, heightPx - edgeMarginPx - paddingBottom
+//                        - (2 * inv.numRows * cellHeightPx) - hotseatBarTopPaddingPx
+//                        - hotseatBarBottomPaddingPx);
+//                padding.set(availablePaddingX / 2, edgeMarginPx + availablePaddingY / 2,
+//                        availablePaddingX / 2, paddingBottom + availablePaddingY / 2);
             } else {
                 // Pad the top and bottom of the workspace with search/hotseat bar sizes
-                padding.set(desiredWorkspaceLeftRightMarginPx,
-                        edgeMarginPx,
-                        desiredWorkspaceLeftRightMarginPx,
-                        paddingBottom);
+//                padding.set(desiredWorkspaceLeftRightMarginPx,
+//                        edgeMarginPx,
+//                        desiredWorkspaceLeftRightMarginPx,
+//                        paddingBottom);
             }
         }
     }
@@ -520,11 +521,11 @@ public class DeviceProfile {
     public Rect getHotseatLayoutPadding() {
         if (isVerticalBarLayout()) {
             if (isSeascape()) {
-                mHotseatPadding.set(mInsets.left + hotseatBarSidePaddingStartPx,
-                        mInsets.top, hotseatBarSidePaddingEndPx, mInsets.bottom);
+//                mHotseatPadding.set(mInsets.left + hotseatBarSidePaddingStartPx,
+//                        mInsets.top, hotseatBarSidePaddingEndPx, mInsets.bottom);
             } else {
-                mHotseatPadding.set(hotseatBarSidePaddingEndPx, mInsets.top,
-                        mInsets.right + hotseatBarSidePaddingStartPx, mInsets.bottom);
+//               mHotseatPadding.set(hotseatBarSidePaddingEndPx, mInsets.top,
+//                        mInsets.right + hotseatBarSidePaddingStartPx, mInsets.bottom);
             }
         } else {
 
@@ -532,14 +533,14 @@ public class DeviceProfile {
             // icons in the hotseat are a different size, and so don't line up perfectly. To account
             // for this, we pad the left and right of the hotseat with half of the difference of a
             // workspace cell vs a hotseat cell.
-            float workspaceCellWidth = (float) widthPx / inv.numColumns;
-            float hotseatCellWidth = (float) widthPx / inv.numHotseatIcons;
-            int hotseatAdjustment = Math.round((workspaceCellWidth - hotseatCellWidth) / 2);
-            mHotseatPadding.set(
-                    hotseatAdjustment + workspacePadding.left + cellLayoutPaddingLeftRightPx,
-                    hotseatBarTopPaddingPx,
-                    hotseatAdjustment + workspacePadding.right + cellLayoutPaddingLeftRightPx,
-                    hotseatBarBottomPaddingPx + mInsets.bottom + cellLayoutBottomPaddingPx);
+//            float workspaceCellWidth = (float) widthPx / inv.numColumns;
+//            float hotseatCellWidth = (float) widthPx / inv.numHotseatIcons;
+//            int hotseatAdjustment = Math.round((workspaceCellWidth - hotseatCellWidth) / 2);
+//            mHotseatPadding.set(
+//                    hotseatAdjustment + workspacePadding.left + cellLayoutPaddingLeftRightPx,
+//                    hotseatBarTopPaddingPx,
+//                    hotseatAdjustment + workspacePadding.right + cellLayoutPaddingLeftRightPx,
+//                    hotseatBarBottomPaddingPx + mInsets.bottom + cellLayoutBottomPaddingPx);
         }
         return mHotseatPadding;
     }
@@ -565,10 +566,12 @@ public class DeviceProfile {
     }
 
     public static int calculateCellWidth(int width, int countX) {
-        return width / countX;
+               if(countX==0) return 0;
+       return width / countX;
     }
     public static int calculateCellHeight(int height, int countY) {
-        return height / countY;
+               if(countY==0) return 0;
+       return height / countY;
     }
 
     /**
@@ -609,7 +612,7 @@ public class DeviceProfile {
             case CellLayout.FOLDER:
                 return folderCellHeightPx;
             case CellLayout.HOTSEAT:
-                return hotseatCellHeightPx;
+                return 0;
             default:
                 // ??
                 return 0;
diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java
old mode 100644
new mode 100755
index b58d7ef4c6..5e3c0f5021
--- a/src/com/android/launcher3/Hotseat.java
+++ b/src/com/android/launcher3/Hotseat.java
@@ -71,9 +71,9 @@ public class Hotseat extends CellLayout implements LogContainerProvider, Insetta
         mHasVerticalHotseat = hasVerticalHotseat;
         InvariantDeviceProfile idp = mActivity.getDeviceProfile().inv;
         if (hasVerticalHotseat) {
-            setGridSize(1, idp.numHotseatIcons);
+//            setGridSize(1, idp.numHotseatIcons);
         } else {
-            setGridSize(idp.numHotseatIcons, 1);
+//            setGridSize(idp.numHotseatIcons, 1);
         }
     }
 
@@ -104,11 +104,11 @@ public class Hotseat extends CellLayout implements LogContainerProvider, Insetta
             lp.width = ViewGroup.LayoutParams.MATCH_PARENT;
             lp.height = grid.hotseatBarSizePx + insets.bottom;
         }
-        Rect padding = grid.getHotseatLayoutPadding();
-        setPadding(padding.left, padding.top, padding.right, padding.bottom);
+//        Rect padding = grid.getHotseatLayoutPadding();
+//        setPadding(padding.left, padding.top, padding.right, padding.bottom);
 
-        setLayoutParams(lp);
-        InsettableFrameLayout.dispatchInsets(this, insets);
+//        setLayoutParams(lp);
+//        InsettableFrameLayout.dispatchInsets(this, insets);
     }
 
     @Override
diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java
old mode 100644
new mode 100755
index 2c40aeb532..75efa827d7
--- a/src/com/android/launcher3/InvariantDeviceProfile.java
+++ b/src/com/android/launcher3/InvariantDeviceProfile.java
@@ -146,7 +146,7 @@ public class InvariantDeviceProfile {
         iconShapePath = p.iconShapePath;
         landscapeIconSize = p.landscapeIconSize;
         iconTextSize = p.iconTextSize;
-        numHotseatIcons = p.numHotseatIcons;
+        numHotseatIcons = 0;
         defaultLayoutId = p.defaultLayoutId;
         demoModeLayoutId = p.demoModeLayoutId;
         mExtraAttrs = p.mExtraAttrs;
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
old mode 100644
new mode 100755
index e66fad67d9..1049f5be7c
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -1945,7 +1945,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
 
     boolean isHotseatLayout(View layout) {
         // TODO: Remove this method
-        return mHotseat != null && (layout == mHotseat);
+        return false;
     }
 
     /**
@@ -2045,9 +2045,9 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
         mWorkspace.removeAllWorkspaceScreens();
         mAppWidgetHost.clearViews();
 
-        if (mHotseat != null) {
-            mHotseat.resetLayout(getWallpaperDeviceProfile().isVerticalBarLayout());
-        }
+//        if (mHotseat != null) {
+//            mHotseat.resetLayout(getWallpaperDeviceProfile().isVerticalBarLayout());
+//        }
         TraceHelper.endSection("startBinding");
     }


©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 159,569评论 4 363
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 67,499评论 1 294
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 109,271评论 0 244
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 44,087评论 0 209
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 52,474评论 3 287
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,670评论 1 222
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,911评论 2 313
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,636评论 0 202
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,397评论 1 246
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,607评论 2 246
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 32,093评论 1 261
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,418评论 2 254
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 33,074评论 3 237
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,092评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,865评论 0 196
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,726评论 2 276
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,627评论 2 270

推荐阅读更多精彩内容