From 892c74d460ad98c6306420e1127c9aa3e505ba25 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Thu, 22 Aug 2013 16:15:50 -0700 Subject: [PATCH] Fixing folders to always show in view, removing old assets and references to LauncherModel count. --- res/drawable-hdpi/divider_launcher_holo.9.png | Bin 131 -> 0 bytes res/drawable-hdpi/hotseat_scrubber_holo.9.png | Bin 162 -> 0 bytes res/drawable-hdpi/hotseat_track_holo.9.png | Bin 211 -> 0 bytes res/drawable-hdpi/page_hover_left_holo.9.png | Bin 255 -> 1404 bytes .../divider_launcher_holo.9.png | Bin 133 -> 0 bytes .../hotseat_track_holo.9.png | Bin 211 -> 0 bytes .../divider_launcher_holo.9.png | Bin 225 -> 0 bytes .../hotseat_track_holo.9.png | Bin 159 -> 0 bytes .../divider_launcher_holo.9.png | Bin 312 -> 0 bytes .../hotseat_track_holo.9.png | Bin 229 -> 0 bytes res/drawable-mdpi/divider_launcher_holo.9.png | Bin 129 -> 0 bytes res/drawable-mdpi/hotseat_scrubber_holo.9.png | Bin 144 -> 0 bytes res/drawable-mdpi/hotseat_track_holo.9.png | Bin 159 -> 0 bytes res/drawable-mdpi/page_hover_left_holo.9.png | Bin 206 -> 2884 bytes .../divider_launcher_holo.9.png | Bin 199 -> 0 bytes .../divider_launcher_holo.9.png | Bin 235 -> 0 bytes .../divider_launcher_holo.9.png | Bin 225 -> 0 bytes .../divider_launcher_holo.9.png | Bin 1078 -> 0 bytes .../divider_launcher_holo.9.png | Bin 199 -> 0 bytes .../divider_launcher_holo.9.png | Bin 1078 -> 0 bytes .../divider_launcher_holo.9.png | Bin 310 -> 0 bytes .../hotseat_scrubber_holo.9.png | Bin 166 -> 0 bytes res/drawable-xhdpi/hotseat_track_holo.9.png | Bin 229 -> 0 bytes res/drawable-xhdpi/page_hover_left_holo.9.png | Bin 304 -> 2961 bytes res/layout/scroll_indicator.xml | 21 ------ .../launcher3/AppsCustomizePagedView.java | 7 +- src/com/android/launcher3/CellLayout.java | 13 +++- src/com/android/launcher3/DynamicGrid.java | 71 +++++++++++++----- src/com/android/launcher3/Folder.java | 48 ++++++------ .../launcher3/InstallShortcutReceiver.java | 4 +- src/com/android/launcher3/Launcher.java | 6 +- .../android/launcher3/LauncherAppState.java | 15 ++-- src/com/android/launcher3/LauncherModel.java | 57 +++++++------- .../launcher3/PagedViewCellLayout.java | 4 +- .../android/launcher3/PagedViewWidget.java | 7 +- src/com/android/launcher3/Workspace.java | 6 +- 36 files changed, 143 insertions(+), 116 deletions(-) delete mode 100644 res/drawable-hdpi/divider_launcher_holo.9.png delete mode 100644 res/drawable-hdpi/hotseat_scrubber_holo.9.png delete mode 100644 res/drawable-hdpi/hotseat_track_holo.9.png delete mode 100644 res/drawable-land-hdpi/divider_launcher_holo.9.png delete mode 100644 res/drawable-land-hdpi/hotseat_track_holo.9.png delete mode 100644 res/drawable-land-mdpi/divider_launcher_holo.9.png delete mode 100644 res/drawable-land-mdpi/hotseat_track_holo.9.png delete mode 100644 res/drawable-land-xhdpi/divider_launcher_holo.9.png delete mode 100644 res/drawable-land-xhdpi/hotseat_track_holo.9.png delete mode 100644 res/drawable-mdpi/divider_launcher_holo.9.png delete mode 100644 res/drawable-mdpi/hotseat_scrubber_holo.9.png delete mode 100644 res/drawable-mdpi/hotseat_track_holo.9.png delete mode 100644 res/drawable-sw600dp-hdpi/divider_launcher_holo.9.png delete mode 100644 res/drawable-sw600dp-land-hdpi/divider_launcher_holo.9.png delete mode 100644 res/drawable-sw600dp-land-mdpi/divider_launcher_holo.9.png delete mode 100644 res/drawable-sw600dp-mdpi/divider_launcher_holo.9.png delete mode 100644 res/drawable-sw720dp-land-hdpi/divider_launcher_holo.9.png delete mode 100644 res/drawable-sw720dp-land-mdpi/divider_launcher_holo.9.png delete mode 100644 res/drawable-xhdpi/divider_launcher_holo.9.png delete mode 100644 res/drawable-xhdpi/hotseat_scrubber_holo.9.png delete mode 100644 res/drawable-xhdpi/hotseat_track_holo.9.png delete mode 100644 res/layout/scroll_indicator.xml diff --git a/res/drawable-hdpi/divider_launcher_holo.9.png b/res/drawable-hdpi/divider_launcher_holo.9.png deleted file mode 100644 index 3b7f0007ed6b6b52bb2fa9e3ac7ab5b82cc5d73a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 131 zcmeAS@N?(olHy`uVBq!ia0vp^JV0!~!3HE%&(1akQeK`ejv*e$lYjjGZ_mv4LB30n zX~)$`Y(Ex6$aMW&v5s+#z>7F*0k%!O7yp>9N(?!?g3Zh1&+?sZ7b_&L8mvmZk+Hz< gs9&l>)@OExi|@S4w-|m(2Aay?>FVdQ&MBb@0Ea&>?EnA( diff --git a/res/drawable-hdpi/hotseat_scrubber_holo.9.png b/res/drawable-hdpi/hotseat_scrubber_holo.9.png deleted file mode 100644 index 00645c4e9a73e5784e9a076dd387c19f6ae03e0a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 162 zcmeAS@N?(olHy`uVBq!ia0vp^+#t-s1|(OmDOUqhEX7WqAsj$Z!;#Vf2?p zbb>IW`N`93fr2icE{-7*Q2?p zbb>IW`N`93fr6!;E{-7*Q>RWm$kk%N;}Tz*-xcov??&B%|Ib2SxlZ{w>0O(K6T4I9 zjF~>cDuN2(|DVnM-uI;-|E);DFV0*Az5^*&8QC|8A38qeXyKGEe^&<2YCP+b)l@8> z^wn;aI`@gjIkjp34@{~wInJYVAc`gQ_6p~-{BgxgwE}OqPT>GLfWgz%&t;ucLK6Uj C_)Lue diff --git a/res/drawable-hdpi/page_hover_left_holo.9.png b/res/drawable-hdpi/page_hover_left_holo.9.png index 2ac2c39b66409fb99fb1fc7ce6cd8c4f878323cb..c3243a9d2aebee445f3518721520ab8e1f69dc8b 100644 GIT binary patch delta 1399 zcmV--1&I3p0sIPoiBL{Q4GJ0x0000DNk~Le000080000Q2nGNE0E!VE8vpd-#s*1~rR_=< zrRmrzB;-0biK!b0+v&EdPkVtk2K)g)*#i$qJRuDRVtd(t_Q14BQ-><5Nl1I>#1A1R z?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2(|DVnM-uI;-|E);DFV0*Az5^*&8QC|8A38qeXyKGEe^&<2YCP+b)l@8> z^wn;aI`@gjIkjp34@{~wInJYVAc`gQ_6p~-{BgxgwE}OqPT>GLfWgz%&t;ucLK6Uj C_)Lue diff --git a/res/drawable-land-mdpi/divider_launcher_holo.9.png b/res/drawable-land-mdpi/divider_launcher_holo.9.png deleted file mode 100644 index e4c0c4025161d19b2aa642298d77aefefd545f92..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 225 zcmeAS@N?(olHy`uVBq!ia0vp^3P8-k!3HE}wEkTWq!^2X+?^QKos)S9l8 zY3cGMvzA!rlzVC&IJ4o_KBFs*Y$cw0iia8RMDp#~{^t>U(o!Rr^>bP0l+XkK2LVeU diff --git a/res/drawable-land-mdpi/hotseat_track_holo.9.png b/res/drawable-land-mdpi/hotseat_track_holo.9.png deleted file mode 100644 index 168f092080c4df3fc50df4beab295e9d65bf4311..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 159 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1|*O0@9PFqEX7WqAsj$Z!;#Vf4nJ zaCd?*qxs3xYk`7}o-U3d5>uD<8*(uy@G$$U*FX4Ov(LW3nq5|lgHKLGC@QGQ>wxX) zIlHYjUoc%+Yi+<#)UhTjINHLbet*U1RhEoF2W0Mtw(~^*4P)?h^>bP0l+XkK6Dun} diff --git a/res/drawable-land-xhdpi/divider_launcher_holo.9.png b/res/drawable-land-xhdpi/divider_launcher_holo.9.png deleted file mode 100644 index 0b2956dd0713e5d27c81adb9f76c3a99be4cf7ca..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 312 zcmeAS@N?(olHy`uVBq!ia0vp^_CUd6k~CayA#8@b22Z19JVBHcNd2L zAh=-f^2tCE&H|6fVg?58P7r1^KY4mBP>{XE)7O>#4l@%YvrJX~LJ^?Q4o?@y5Rc<; zr~2|W83?rQSNf;YQo(Y!fcxG4*OFfZ)E04^KRY3$Rk!8V^b*6%p0o02RW_@LO?z|Z z_lr+=JUu;)PuCume!%eNjo(BAu8OEXOmYlAJsyhP=r>6_%Vq9mukyL`kX=%RQw8gS z$k5Q%@Bd<^J=J@2scWjK@8xTywIA=5AFF1cqI&qZ$sXl`O*`K!C+0M+o*A2M|DV}j zA}+DFTipi;QhuO!`NN0eKaKhJKe@{l W4MY>!TUvomV(@hJb6Mw<&;$TbJ5oLX diff --git a/res/drawable-mdpi/divider_launcher_holo.9.png b/res/drawable-mdpi/divider_launcher_holo.9.png deleted file mode 100644 index 7bdf32381c1e65e906458cfbe3555e25a1e13495..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 129 zcmeAS@N?(olHy`uVBq!ia0vp^96+qV!3HGtKUiJ>QXZZzjv*GOlYjjGZ_jMR#>Bz+ zI63e@LolPj2gZ#S9mkeB$avgl%uL=4nJ zaCd?*qxs3xYk`7Bo-U3d5>u0Z{QqyyEcAo_r~uz88CHh8zR&NT|DRiK?{44nJ zaCd?*qxs3xYk`7}o-U3d5>uD<8*(uy@G$$U*FX4Ov(LW3nq5|lgHKLGC@QGQ>wxX) zIlHYjUoc%+Yi+<#)UhTjINHLbet*U1RhEoF2W0Mtw(~^*4P)?h^>bP0l+XkK6Dun} diff --git a/res/drawable-mdpi/page_hover_left_holo.9.png b/res/drawable-mdpi/page_hover_left_holo.9.png index e1e84c93432bb8500223b5a99b1d37a61effdcaf..f436fe7322cb54f6a2358eac7efcc402bf9ec6b3 100644 GIT binary patch literal 2884 zcmV-K3%m4*P)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0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ez($cbNx%9JL($8YWLQ>~lNO25RQkMyMJZbKQgr_x+pPya-Bfco~-=sb12k)(( qDQ0eSLEm$S(y`AUjjLYY^iLI#KN#K16$*3>gD1PIpUXO@geCxPBt?h- diff --git a/res/drawable-sw600dp-hdpi/divider_launcher_holo.9.png b/res/drawable-sw600dp-hdpi/divider_launcher_holo.9.png deleted file mode 100644 index 0a1bd2a26b71b9828d48f730728b07a20a17417b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 199 zcmeAS@N?(olHy`uVBq!ia0vp^JV0!~!3HE%&(1akQY^(zo*^7SP{WbZ0pxQQctjR6 zFmQK*Fr)d&(`$i(nVv3=As(G?rx|iJIPkEjCl&YJ|L~vxqj6KjI$xKT7{Q6FHwiG! z=DFRf(AoFotHj^C`*c2ty+8Y#^Ue2yQ)*`#uQRBuWk@Syn0d)rh5*rL~6V` r^p5Z6WEBZGpm5;Q`~wWB_vdpjnImoae1Gj6prs6+u6{1-oD!M`sf9cCs*cBUshAbEytPZ!4!kK=Er z9^`5;;BglIxT$;p!~gYt`xQ_0oj={8Xl-@#7}L@(K}?xJjH`HpYWMH3``-ES;q^V9 zT)oA8E9Xzz@@3tDSwfEjl^Ciot0&9PWa3%q@UA)I_p2k!s{Hl{=Ihe(VGaC3?CzhFF|F zJK2!yfB_G4sjBz1y2bzN{q_lJNM6-ES{&q)|0yX&h5L3CgTe~DWM4fVL40M diff --git a/res/drawable-sw600dp-mdpi/divider_launcher_holo.9.png b/res/drawable-sw600dp-mdpi/divider_launcher_holo.9.png deleted file mode 100644 index 6d101f4ce2304b1d4b6a7aa6197063e98246128b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1078 zcmbVLJ8aWH7&d)CTd5-|uyArVMB+Q=;fESp*N$l<(v~DDS&-`3m)2_SGxn9FS!h`h z8w*H0hDZ!BAqIv@3`nR#LLdZ4EQ}R9uvaSQG${;K2Q1n5@b`WH`|iTrQ6;G070gXv3#gE9pmxzJh@xJ9Go;5+B5hR-LTVJkLBm2*C?Vr9)vq>LrS$OlVnw zfKpKKyg05dI-+I#*Nr35QFSB0LK#P7J+xUp8i_uco6 zEgE^A{Yg2lqe3J@grp3VM3|EiQf6jk1EEYNqi1InUF&Nc#m&g+Gy`Q!9cl;}re;c6 zSy5097Bt0_^**=gN7V9d+_&p8yFG6DSgxvv*rFt?60+9sfQ1!8Nwh)&pjWb>WZAAC zpX2fzL~G#Cy@?$&Bp&GIS9OoDpOp%VUNB8r6Ekt#vX(Ox(KOPUD8sZ=;Co!>e{v=; zXN0&p{%Mx}73;uwd)WHya5y~JXA={$(OB9VKE=kWQ8ct_>wA4~e}8IFTymVDQTTS} z;Td=$A>J7-N$2nF4(9`egd)x2;zfKB{Yroz1Jm)e1L8z`NCfL}Bq|=h^cw y+nxIZ=8ul~sXhIBzEf-LOia{Hcb0E$a)aF0?ZkuYA0DakBo_;F#*3My+kXJ)no@ZH diff --git a/res/drawable-sw720dp-land-hdpi/divider_launcher_holo.9.png b/res/drawable-sw720dp-land-hdpi/divider_launcher_holo.9.png deleted file mode 100644 index 0a1bd2a26b71b9828d48f730728b07a20a17417b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 199 zcmeAS@N?(olHy`uVBq!ia0vp^JV0!~!3HE%&(1akQY^(zo*^7SP{WbZ0pxQQctjR6 zFmQK*Fr)d&(`$i(nVv3=As(G?rx|iJIPkEjCl&YJ|L~vxqj6KjI$xKT7{Q6FHwiG! z=DFRf(AoFotHj^C`*c2ty+8Y#^Ue2yQ)*`#uQRBuWk@Syn0d)rh5*rL~6V` r^p5Z6WEBZGpm5;Q`~wWB_vdpjnImoae1Gj6prs6+u6{1-oD!MQ6;G070gXv3#gE9pmxzJh@xJ9Go;5+B5hR-LTVJkLBm2*C?Vr9)vq>LrS$OlVnw zfKpKKyg05dI-+I#*Nr35QFSB0LK#P7J+xUp8i_uco6 zEgE^A{Yg2lqe3J@grp3VM3|EiQf6jk1EEYNqi1InUF&Nc#m&g+Gy`Q!9cl;}re;c6 zSy5097Bt0_^**=gN7V9d+_&p8yFG6DSgxvv*rFt?60+9sfQ1!8Nwh)&pjWb>WZAAC zpX2fzL~G#Cy@?$&Bp&GIS9OoDpOp%VUNB8r6Ekt#vX(Ox(KOPUD8sZ=;Co!>e{v=; zXN0&p{%Mx}73;uwd)WHya5y~JXA={$(OB9VKE=kWQ8ct_>wA4~e}8IFTymVDQTTS} z;Td=$A>J7-N$2nF4(9`egd)x2;zfKB{Yroz1Jm)e1L8z`NCfL}Bq|=h^cw y+nxIZ=8ul~sXhIBzEf-LOia{Hcb0E$a)aF0?ZkuYA0DakBo_;F#*3My+kXJ)no@ZH diff --git a/res/drawable-xhdpi/divider_launcher_holo.9.png b/res/drawable-xhdpi/divider_launcher_holo.9.png deleted file mode 100644 index e226ae71eb6cd36d3e974d280799c69c075dd9c2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 310 zcmeAS@N?(olHy`uVBq!ia0vp^{6K8a!3HANOnMHaSc;uILpXq-h9ji|$mcBZh%9Dc z;O+!rM)Q-W*8&A^c)B=-cyzvlMg7I!{sXcWjnYZ0IIgs=74zxt znlqWC+8hgOBrHok#@1Na>czT9^>6HJ^`hM4Y9OJv5$g$_*ubz8f zRTipi;QhuO!`NN0eKaKhJKe@{l W4MY>!TUvomV(@hJb6Mw<&;$TbJ5oLX diff --git a/res/drawable-xhdpi/page_hover_left_holo.9.png b/res/drawable-xhdpi/page_hover_left_holo.9.png index b00d367eeabdada164938ae4375c4fa423e08f00..6833a59af3673d927b018aa6eec322b540d1b1d7 100644 GIT binary patch literal 2961 zcmV;C3vTp@P)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY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ukS=z6a*o51&A{W^e}o1a`);-|e*n@+L_t(IjqTOFN&`U@hT&)PBT+#twA#x^d0= zOI+a`3(ODfjnE}7aEg=YpjfWAtx&=}9`J-~oJGrf+ijC6Y0n~TlMHHXFVEcHj~N6_ zyDV)`Z$@Z@Mrbhf<#&t?hN=MnWqQL$mu==}7Tn+!FWBKdpndKRA$Y`R7^-;Jn^oCr pg6FJOcL6z6WwqXQb6k#DYTvXLKN*s;c6k5*002ovPDHLkV1jSMd_e#J diff --git a/res/layout/scroll_indicator.xml b/res/layout/scroll_indicator.xml deleted file mode 100644 index 4ea312b6dd..0000000000 --- a/res/layout/scroll_indicator.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - diff --git a/src/com/android/launcher3/AppsCustomizePagedView.java b/src/com/android/launcher3/AppsCustomizePagedView.java index 245d7eaf9a..899b1f2249 100644 --- a/src/com/android/launcher3/AppsCustomizePagedView.java +++ b/src/com/android/launcher3/AppsCustomizePagedView.java @@ -438,6 +438,9 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen } public void onPackagesUpdated(ArrayList widgetsAndShortcuts) { + LauncherAppState app = LauncherAppState.getInstance(); + DeviceProfile grid = app.getDynamicGrid().getDeviceProfile(); + // Get the list of widgets and shortcuts mWidgets.clear(); for (Object o : widgetsAndShortcuts) { @@ -450,8 +453,8 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen int[] minSpanXY = Launcher.getMinSpanForWidget(mLauncher, widget); int minSpanX = Math.min(spanXY[0], minSpanXY[0]); int minSpanY = Math.min(spanXY[1], minSpanXY[1]); - if (minSpanX <= LauncherModel.getCellCountX() && - minSpanY <= LauncherModel.getCellCountY()) { + if (minSpanX <= (int) grid.numColumns && + minSpanY <= (int) grid.numRows) { mWidgets.add(widget); } else { Log.e(TAG, "Widget " + widget.provider + " can not fit on this device (" + diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java index 52b76b8ce5..3c41804646 100644 --- a/src/com/android/launcher3/CellLayout.java +++ b/src/com/android/launcher3/CellLayout.java @@ -189,6 +189,8 @@ public class CellLayout extends ViewGroup { setClipToPadding(false); mLauncher = (Launcher) context; + LauncherAppState app = LauncherAppState.getInstance(); + DeviceProfile grid = app.getDynamicGrid().getDeviceProfile(); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CellLayout, defStyle, 0); mCellWidth = -1; @@ -196,8 +198,8 @@ public class CellLayout extends ViewGroup { mWidthGap = mOriginalWidthGap = 0; mHeightGap = mOriginalHeightGap = 0; mMaxGap = Integer.MAX_VALUE; - mCountX = LauncherModel.getCellCountX(); - mCountY = LauncherModel.getCellCountY(); + mCountX = (int) grid.numColumns; + mCountY = (int) grid.numRows; mOccupied = new boolean[mCountX][mCountY]; mTmpOccupied = new boolean[mCountX][mCountY]; mPreviousReorderDirection[0] = INVALID_DIRECTION; @@ -208,8 +210,6 @@ public class CellLayout extends ViewGroup { setAlwaysDrawnWithCacheEnabled(false); final Resources res = getResources(); - LauncherAppState app = LauncherAppState.getInstance(); - DeviceProfile grid = app.getDynamicGrid().getDeviceProfile(); mHotseatScale = (float) grid.hotseatIconSize / grid.iconSize; mNormalBackground = res.getDrawable(R.drawable.homescreen_blue_normal_holo); @@ -1204,6 +1204,11 @@ public class CellLayout extends ViewGroup { int left = topLeft[0]; int top = topLeft[1]; + // Offset icons by their padding + if (v instanceof BubbleTextView) { + top += v.getPaddingTop(); + } + if (v != null && dragOffset == null) { // When drawing the drag outline, it did not account for margin offsets // added by the view's parent. diff --git a/src/com/android/launcher3/DynamicGrid.java b/src/com/android/launcher3/DynamicGrid.java index 37cccfbd30..16af648141 100644 --- a/src/com/android/launcher3/DynamicGrid.java +++ b/src/com/android/launcher3/DynamicGrid.java @@ -68,6 +68,8 @@ class DeviceProfile { int widthPx; int heightPx; + int availableWidthPx; + int availableHeightPx; int iconSizePx; int iconTextSizePx; int cellWidthPx; @@ -100,16 +102,15 @@ class DeviceProfile { } DeviceProfile(ArrayList profiles, - float minWidth, int minWidthPx, - float minHeight, int minHeightPx, + float minWidth, float minHeight, int wPx, int hPx, + int awPx, int ahPx, Resources resources) { DisplayMetrics dm = resources.getDisplayMetrics(); ArrayList points = new ArrayList(); transposeLayoutWithOrientation = resources.getBoolean(R.bool.hotseat_transpose_layout_with_orientation); - updateFromConfiguration(resources, wPx, hPx); minWidthDps = minWidth; minHeightDps = minHeight; @@ -133,16 +134,16 @@ class DeviceProfile { points.add(new DeviceProfileQuery(p.minWidthDps, p.minHeightDps, p.iconSize)); } iconSize = invDistWeightedInterpolate(minWidth, minHeight, points); - iconSizePx = (int) Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, - iconSize, dm)); + iconSizePx = DynamicGrid.pxFromDp(iconSize, dm); + // Interpolate the icon text size points.clear(); for (DeviceProfile p : profiles) { points.add(new DeviceProfileQuery(p.minWidthDps, p.minHeightDps, p.iconTextSize)); } iconTextSize = invDistWeightedInterpolate(minWidth, minHeight, points); - iconTextSizePx = (int) Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, - iconTextSize, dm)); + iconTextSizePx = DynamicGrid.pxFromSp(iconTextSize, dm); + // Interpolate the hotseat size points.clear(); for (DeviceProfile p : profiles) { @@ -154,14 +155,12 @@ class DeviceProfile { for (DeviceProfile p : profiles) { points.add(new DeviceProfileQuery(p.minWidthDps, p.minHeightDps, p.hotseatIconSize)); } - // Hotseat hotseatIconSize = invDistWeightedInterpolate(minWidth, minHeight, points); - hotseatIconSizePx = (int) Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, - hotseatIconSize, dm)); - hotseatBarHeightPx = iconSizePx + 4 * edgeMarginPx; - hotseatCellWidthPx = iconSizePx; - hotseatCellHeightPx = iconSizePx; + hotseatIconSizePx = DynamicGrid.pxFromDp(hotseatIconSize, dm); + + // Calculate other vars based on Configuration + updateFromConfiguration(resources, wPx, hPx, awPx, ahPx); // Search Bar searchBarSpaceMaxWidthPx = resources.getDimensionPixelSize(R.dimen.dynamic_grid_search_bar_max_width); @@ -176,6 +175,27 @@ class DeviceProfile { cellWidthPx = iconSizePx; cellHeightPx = iconSizePx + (int) Math.ceil(fm.bottom - fm.top); + // At this point, if the cells do not fit into the available height, then we need + // to shrink the icon size + /* + Rect padding = getWorkspacePadding(isLandscape ? + CellLayout.LANDSCAPE : CellLayout.PORTRAIT); + int h = (int) (numRows * cellHeightPx) + padding.top + padding.bottom; + if (h > availableHeightPx) { + float delta = h - availableHeightPx; + int deltaPx = (int) Math.ceil(delta / numRows); + iconSizePx -= deltaPx; + iconSize = DynamicGrid.dpiFromPx(iconSizePx, dm); + cellWidthPx = iconSizePx; + cellHeightPx = iconSizePx + (int) Math.ceil(fm.bottom - fm.top); + } + */ + + // Hotseat + hotseatBarHeightPx = iconSizePx + 4 * edgeMarginPx; + hotseatCellWidthPx = iconSizePx; + hotseatCellHeightPx = iconSizePx; + // Folder folderCellWidthPx = cellWidthPx + 3 * edgeMarginPx; folderCellHeightPx = cellHeightPx + edgeMarginPx; @@ -183,13 +203,17 @@ class DeviceProfile { folderIconSizePx = iconSizePx + 2 * -folderBackgroundOffset; } - void updateFromConfiguration(Resources resources, int wPx, int hPx) { + void updateFromConfiguration(Resources resources, int wPx, int hPx, + int awPx, int ahPx) { + DisplayMetrics dm = resources.getDisplayMetrics(); isLandscape = (resources.getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE); isTablet = resources.getBoolean(R.bool.is_tablet); isLargeTablet = resources.getBoolean(R.bool.is_large_tablet); widthPx = wPx; heightPx = hPx; + availableWidthPx = awPx; + availableHeightPx = ahPx; } private float dist(PointF p0, PointF p1) { @@ -415,13 +439,22 @@ public class DynamicGrid { private float mMinWidth; private float mMinHeight; - public static int dpiFromPx(int size, DisplayMetrics metrics){ + public static float dpiFromPx(int size, DisplayMetrics metrics){ float densityRatio = (float) metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT; - return (int) Math.round(size / densityRatio); + return (size / densityRatio); + } + public static int pxFromDp(float size, DisplayMetrics metrics) { + return (int) Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, + size, metrics)); + } + public static int pxFromSp(float size, DisplayMetrics metrics) { + return (int) Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, + size, metrics)); } public DynamicGrid(Resources resources, int minWidthPx, int minHeightPx, - int widthPx, int heightPx) { + int widthPx, int heightPx, + int awPx, int ahPx) { DisplayMetrics dm = resources.getDisplayMetrics(); ArrayList deviceProfiles = new ArrayList(); @@ -456,9 +489,9 @@ public class DynamicGrid { mMinWidth = dpiFromPx(minWidthPx, dm); mMinHeight = dpiFromPx(minHeightPx, dm); mProfile = new DeviceProfile(deviceProfiles, - mMinWidth, minWidthPx, - mMinHeight, minHeightPx, + mMinWidth, mMinHeight, widthPx, heightPx, + awPx, ahPx, resources); } diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java index d428abc2ce..6308bb7929 100644 --- a/src/com/android/launcher3/Folder.java +++ b/src/com/android/launcher3/Folder.java @@ -29,7 +29,9 @@ import android.text.InputType; import android.text.Selection; import android.text.Spannable; import android.util.AttributeSet; +import android.util.DisplayMetrics; import android.util.Log; +import android.util.TypedValue; import android.view.ActionMode; import android.view.KeyEvent; import android.view.LayoutInflater; @@ -85,7 +87,6 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList private int mMaxCountY; private int mMaxVisibleX; private int mMaxVisibleY; - private int mMaxContentAreaHeight = 0; private int mMaxNumItems; private ArrayList mItemsInReadingOrder = new ArrayList(); private Drawable mIconDrawable; @@ -108,8 +109,6 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList private float mFolderIconPivotX; private float mFolderIconPivotY; - private static final int SCROLL_CUT_OFF_AMOUNT = 60; - private static final float MAX_SCROLL_VELOCITY = 1500f; private boolean mIsEditingName = false; @@ -146,7 +145,8 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList mIconCache = app.getIconCache(); Resources res = getResources(); - mMaxCountX = mMaxVisibleX = mMaxVisibleY = (int) (grid.numColumns); + mMaxCountX = mMaxVisibleX = (int) grid.numColumns; + mMaxVisibleY = (int) grid.numRows; mMaxCountY = mMaxNumItems = Integer.MAX_VALUE; mInputMethodManager = (InputMethodManager) @@ -175,11 +175,11 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList LauncherAppState app = LauncherAppState.getInstance(); DeviceProfile grid = app.getDynamicGrid().getDeviceProfile(); + Rect padding = grid.getWorkspacePadding(grid.isLandscape ? + CellLayout.LANDSCAPE : CellLayout.PORTRAIT); + DisplayMetrics dm = getResources().getDisplayMetrics(); - // Beyond this height, the area scrolls mContent.setCellDimensions(grid.folderCellWidthPx, grid.folderCellHeightPx); - mContent.setGridSize(mMaxVisibleX, mMaxVisibleY); - mMaxContentAreaHeight = mContent.getDesiredHeight() - SCROLL_CUT_OFF_AMOUNT; mContent.setGridSize(0, 0); mContent.getShortcutsAndWidgets().setMotionEventSplittingEnabled(false); mContent.setInvertIfRtl(true); @@ -875,9 +875,9 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList private void centerAboutIcon() { DragLayer.LayoutParams lp = (DragLayer.LayoutParams) getLayoutParams(); + DragLayer parent = (DragLayer) mLauncher.findViewById(R.id.drag_layer); int width = getPaddingLeft() + getPaddingRight() + mContent.getDesiredWidth(); int height = getFolderHeight(); - DragLayer parent = (DragLayer) mLauncher.findViewById(R.id.drag_layer); float scale = parent.getDescendantRectRelativeToSelf(mFolderIcon, mTempRect); @@ -945,31 +945,33 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList centerAboutIcon(); } + private int getContentAreaHeight() { + LauncherAppState app = LauncherAppState.getInstance(); + DeviceProfile grid = app.getDynamicGrid().getDeviceProfile(); + Rect workspacePadding = grid.getWorkspacePadding(grid.isLandscape ? + CellLayout.LANDSCAPE : CellLayout.PORTRAIT); + int maxContentAreaHeight = grid.availableHeightPx - + 4 * grid.edgeMarginPx - + workspacePadding.top - workspacePadding.bottom - + getPaddingTop() - getPaddingBottom() - + mFolderNameHeight; + return Math.min(maxContentAreaHeight, + mContent.getDesiredHeight()); + } + private int getFolderHeight() { - int contentAreaHeight = mContent.getDesiredHeight(); - if (contentAreaHeight >= mMaxContentAreaHeight) { - // Subtract a bit so the user can see that it's scrollable. - contentAreaHeight = mMaxContentAreaHeight; - } - int height = getPaddingTop() + getPaddingBottom() + contentAreaHeight - + mFolderNameHeight; + int height = getPaddingTop() + getPaddingBottom() + + getContentAreaHeight() + mFolderNameHeight; return height; } protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - int contentAreaHeight = mContent.getDesiredHeight(); - if (contentAreaHeight >= mMaxContentAreaHeight) { - // Subtract a bit so the user can see that it's scrollable. - contentAreaHeight = mMaxContentAreaHeight; - } - int width = getPaddingLeft() + getPaddingRight() + mContent.getDesiredWidth(); int height = getFolderHeight(); int contentAreaWidthSpec = MeasureSpec.makeMeasureSpec(mContent.getDesiredWidth(), MeasureSpec.EXACTLY); - int contentAreaHeightSpec = MeasureSpec.makeMeasureSpec(contentAreaHeight, + int contentAreaHeightSpec = MeasureSpec.makeMeasureSpec(getContentAreaHeight(), MeasureSpec.EXACTLY); - mContent.setFixedSize(mContent.getDesiredWidth(), mContent.getDesiredHeight()); mScrollView.measure(contentAreaWidthSpec, contentAreaHeightSpec); mFolderName.measure(contentAreaWidthSpec, diff --git a/src/com/android/launcher3/InstallShortcutReceiver.java b/src/com/android/launcher3/InstallShortcutReceiver.java index 244b3db88c..5cfecb7ed6 100644 --- a/src/com/android/launcher3/InstallShortcutReceiver.java +++ b/src/com/android/launcher3/InstallShortcutReceiver.java @@ -192,8 +192,8 @@ public class InstallShortcutReceiver extends BroadcastReceiver { data.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE); // Queue the item up for adding if launcher has not loaded properly yet - boolean launcherNotLoaded = LauncherModel.getCellCountX() <= 0 || - LauncherModel.getCellCountY() <= 0; + LauncherAppState app = LauncherAppState.getInstance(); + boolean launcherNotLoaded = (app.getDynamicGrid() == null); PendingInstallShortcutInfo info = new PendingInstallShortcutInfo(data, name, intent); info.icon = icon; diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index d5fafac56a..7fc7033fc4 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -68,6 +68,7 @@ import android.text.Selection; import android.text.SpannableStringBuilder; import android.text.TextUtils; import android.text.method.TextKeyListener; +import android.util.DisplayMetrics; import android.util.Log; import android.view.Display; import android.view.Gravity; @@ -376,11 +377,14 @@ public class Launcher extends Activity Display display = getWindowManager().getDefaultDisplay(); display.getCurrentSizeRange(smallestSize, largestSize); display.getRealSize(realSize); + DisplayMetrics dm = new DisplayMetrics(); + display.getMetrics(dm); // Lazy-initialize the dynamic grid DeviceProfile grid = app.initDynamicGrid(this, Math.min(smallestSize.x, smallestSize.y), Math.min(largestSize.x, largestSize.y), - realSize.x, realSize.y); + realSize.x, realSize.y, + dm.widthPixels, dm.heightPixels); // the LauncherApplication should call this, but in case of Instrumentation it might not be present yet mSharedPrefs = getSharedPreferences(LauncherAppState.getSharedPreferencesKey(), diff --git a/src/com/android/launcher3/LauncherAppState.java b/src/com/android/launcher3/LauncherAppState.java index 53d2ec50f8..c8b208b288 100644 --- a/src/com/android/launcher3/LauncherAppState.java +++ b/src/com/android/launcher3/LauncherAppState.java @@ -164,21 +164,22 @@ public class LauncherAppState { return SHARED_PREFERENCES_KEY; } - DeviceProfile initDynamicGrid(Context context, int minWidth, int minHeight, int width, int height) { + DeviceProfile initDynamicGrid(Context context, int minWidth, int minHeight, + int width, int height, + int availableWidth, int availableHeight) { boolean created = false; if (mDynamicGrid == null) { mDynamicGrid = new DynamicGrid(context.getResources(), - minWidth, minHeight, width, height); + minWidth, minHeight, width, height, + availableWidth, availableHeight); created = true; } - DeviceProfile grid = mDynamicGrid.getDeviceProfile(); - if (created) { - LauncherModel.updateWorkspaceLayoutCells((int) grid.numColumns, (int) grid.numRows); - } // Update the icon size + DeviceProfile grid = mDynamicGrid.getDeviceProfile(); Utilities.setIconSize(grid.iconSizePx); - grid.updateFromConfiguration(context.getResources(), width, height); + grid.updateFromConfiguration(context.getResources(), width, height, + availableWidth, availableHeight); return grid; } DynamicGrid getDynamicGrid() { diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java index d80c2ac7c5..8676b09157 100644 --- a/src/com/android/launcher3/LauncherModel.java +++ b/src/com/android/launcher3/LauncherModel.java @@ -143,9 +143,6 @@ public class LauncherModel extends BroadcastReceiver { private IconCache mIconCache; private Bitmap mDefaultIcon; - private static int mCellCountX; - private static int mCellCountY; - protected int mPreviousConfigMcc; public interface Callbacks { @@ -219,8 +216,10 @@ public class LauncherModel extends BroadcastReceiver { static boolean findNextAvailableIconSpaceInScreen(ArrayList items, int[] xy, long screen) { - final int xCount = LauncherModel.getCellCountX(); - final int yCount = LauncherModel.getCellCountY(); + LauncherAppState app = LauncherAppState.getInstance(); + DeviceProfile grid = app.getDynamicGrid().getDeviceProfile(); + final int xCount = (int) grid.numColumns; + final int yCount = (int) grid.numRows; boolean[][] occupied = new boolean[xCount][yCount]; int cellX, cellY, spanX, spanY; @@ -923,23 +922,6 @@ public class LauncherModel extends BroadcastReceiver { | ((int) screen & 0xFF) << 16 | (localCellX & 0xFF) << 8 | (localCellY & 0xFF); } - static int getCellCountX() { - return mCellCountX; - } - - static int getCellCountY() { - return mCellCountY; - } - - /** - * Updates the model orientation helper to take into account the current layout dimensions - * when performing local/canonical coordinate transformations. - */ - static void updateWorkspaceLayoutCells(int shortAxisCellCount, int longAxisCellCount) { - mCellCountX = shortAxisCellCount; - mCellCountY = longAxisCellCount; - } - /** * Removes the specified item from the database * @param context @@ -1558,12 +1540,19 @@ public class LauncherModel extends BroadcastReceiver { } private boolean checkItemDimensions(ItemInfo info) { - return (info.cellX + info.spanX) > mCellCountX || - (info.cellY + info.spanY) > mCellCountY; + LauncherAppState app = LauncherAppState.getInstance(); + DeviceProfile grid = app.getDynamicGrid().getDeviceProfile(); + return (info.cellX + info.spanX) > (int) grid.numColumns || + (info.cellY + info.spanY) > (int) grid.numRows; } // check & update map of what's occupied; used to discard overlapping/invalid items private boolean checkItemPlacement(HashMap occupied, ItemInfo item) { + LauncherAppState app = LauncherAppState.getInstance(); + DeviceProfile grid = app.getDynamicGrid().getDeviceProfile(); + int countX = (int) grid.numColumns; + int countY = (int) grid.numRows; + long containerIndex = item.screenId; if (item.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) { if (occupied.containsKey(LauncherSettings.Favorites.CONTAINER_HOTSEAT)) { @@ -1577,7 +1566,7 @@ public class LauncherModel extends BroadcastReceiver { return false; } } else { - ItemInfo[][] items = new ItemInfo[mCellCountX + 1][mCellCountY + 1]; + ItemInfo[][] items = new ItemInfo[countX + 1][countY + 1]; items[(int) item.screenId][0] = item; occupied.put((long) LauncherSettings.Favorites.CONTAINER_HOTSEAT, items); return true; @@ -1588,7 +1577,7 @@ public class LauncherModel extends BroadcastReceiver { } if (!occupied.containsKey(item.screenId)) { - ItemInfo[][] items = new ItemInfo[mCellCountX + 1][mCellCountY + 1]; + ItemInfo[][] items = new ItemInfo[countX + 1][countY + 1]; occupied.put(item.screenId, items); } @@ -1625,6 +1614,11 @@ public class LauncherModel extends BroadcastReceiver { final AppWidgetManager widgets = AppWidgetManager.getInstance(context); final boolean isSafeMode = manager.isSafeMode(); + LauncherAppState app = LauncherAppState.getInstance(); + DeviceProfile grid = app.getDynamicGrid().getDeviceProfile(); + int countX = (int) grid.numColumns; + int countY = (int) grid.numRows; + // Make sure the default workspace is loaded, if needed mApp.getLauncherProvider().loadDefaultFavoritesIfNecessary(0); @@ -1930,7 +1924,6 @@ public class LauncherModel extends BroadcastReceiver { for (ItemInfo item: sBgItemsIdMap.values()) { maxItemId = Math.max(maxItemId, item.id); } - LauncherAppState app = LauncherAppState.getInstance(); app.getLauncherProvider().updateMaxItemId(maxItemId); } else { Log.w(TAG, "10249126 - loadWorkspace - !loadedOldDb"); @@ -1963,7 +1956,7 @@ public class LauncherModel extends BroadcastReceiver { Log.d(TAG, "loaded workspace in " + (SystemClock.uptimeMillis()-t) + "ms"); Log.d(TAG, "workspace layout: "); int nScreens = occupied.size(); - for (int y = 0; y < mCellCountY; y++) { + for (int y = 0; y < countY; y++) { String line = ""; Iterator iter = occupied.keySet().iterator(); @@ -1972,7 +1965,7 @@ public class LauncherModel extends BroadcastReceiver { if (screenId > 0) { line += " | "; } - for (int x = 0; x < mCellCountX; x++) { + for (int x = 0; x < countX; x++) { line += ((occupied.get(screenId)[x][y] != null) ? "#" : "."); } } @@ -2086,12 +2079,14 @@ public class LauncherModel extends BroadcastReceiver { /** Sorts the set of items by hotseat, workspace (spatially from top to bottom, left to * right) */ private void sortWorkspaceItemsSpatially(ArrayList workspaceItems) { + final LauncherAppState app = LauncherAppState.getInstance(); + final DeviceProfile grid = app.getDynamicGrid().getDeviceProfile(); // XXX: review this Collections.sort(workspaceItems, new Comparator() { @Override public int compare(ItemInfo lhs, ItemInfo rhs) { - int cellCountX = LauncherModel.getCellCountX(); - int cellCountY = LauncherModel.getCellCountY(); + int cellCountX = (int) grid.numColumns; + int cellCountY = (int) grid.numRows; int screenOffset = cellCountX * cellCountY; int containerOffset = screenOffset * (Launcher.SCREEN_COUNT + 1); // +1 hotseat long lr = (lhs.container * containerOffset + lhs.screenId * screenOffset + diff --git a/src/com/android/launcher3/PagedViewCellLayout.java b/src/com/android/launcher3/PagedViewCellLayout.java index 38fd1ed007..51699e9ac3 100644 --- a/src/com/android/launcher3/PagedViewCellLayout.java +++ b/src/com/android/launcher3/PagedViewCellLayout.java @@ -64,8 +64,8 @@ public class PagedViewCellLayout extends ViewGroup implements Page { Resources resources = context.getResources(); mOriginalCellWidth = mCellWidth = grid.cellWidthPx; mOriginalCellHeight = mCellHeight = grid.cellHeightPx; - mCellCountX = LauncherModel.getCellCountX(); - mCellCountY = LauncherModel.getCellCountY(); + mCellCountX = (int) grid.numColumns; + mCellCountY = (int) grid.numRows; mOriginalWidthGap = mOriginalHeightGap = mWidthGap = mHeightGap = -1; mMaxGap = resources.getDimensionPixelSize(R.dimen.apps_customize_max_gap); diff --git a/src/com/android/launcher3/PagedViewWidget.java b/src/com/android/launcher3/PagedViewWidget.java index bd40c5cf59..220a9f75f1 100644 --- a/src/com/android/launcher3/PagedViewWidget.java +++ b/src/com/android/launcher3/PagedViewWidget.java @@ -106,6 +106,9 @@ public class PagedViewWidget extends LinearLayout { public void applyFromAppWidgetProviderInfo(AppWidgetProviderInfo info, int maxWidth, int[] cellSpan, WidgetPreviewLoader loader) { + LauncherAppState app = LauncherAppState.getInstance(); + DeviceProfile grid = app.getDynamicGrid().getDeviceProfile(); + mIsAppWidget = true; mInfo = info; final ImageView image = (ImageView) findViewById(R.id.widget_preview); @@ -116,8 +119,8 @@ public class PagedViewWidget extends LinearLayout { name.setText(info.label); final TextView dims = (TextView) findViewById(R.id.widget_dims); if (dims != null) { - int hSpan = Math.min(cellSpan[0], LauncherModel.getCellCountX()); - int vSpan = Math.min(cellSpan[1], LauncherModel.getCellCountY()); + int hSpan = Math.min(cellSpan[0], (int) grid.numColumns); + int vSpan = Math.min(cellSpan[1], (int) grid.numRows); dims.setText(String.format(mDimensionsFormatString, hSpan, vSpan)); } mWidgetPreviewLoader = loader; diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 2298c53924..ba18b8de7e 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -2580,6 +2580,8 @@ public class Workspace extends SmoothPagedView Point smallestSize = new Point(); Point largestSize = new Point(); display.getCurrentSizeRange(smallestSize, largestSize); + int countX = (int) grid.numColumns; + int countY = (int) grid.numRows; if (orientation == CellLayout.LANDSCAPE) { if (mLandscapeCellLayoutMetrics == null) { Rect padding = grid.getWorkspacePadding(CellLayout.LANDSCAPE); @@ -2587,7 +2589,7 @@ public class Workspace extends SmoothPagedView int height = smallestSize.y - padding.top - padding.bottom; mLandscapeCellLayoutMetrics = new Rect(); CellLayout.getMetrics(mLandscapeCellLayoutMetrics, width, height, - LauncherModel.getCellCountX(), LauncherModel.getCellCountY()); + countX, countY); } return mLandscapeCellLayoutMetrics; } else if (orientation == CellLayout.PORTRAIT) { @@ -2597,7 +2599,7 @@ public class Workspace extends SmoothPagedView int height = largestSize.y - padding.top - padding.bottom; mPortraitCellLayoutMetrics = new Rect(); CellLayout.getMetrics(mPortraitCellLayoutMetrics, width, height, - LauncherModel.getCellCountX(), LauncherModel.getCellCountY()); + countX, countY); } return mPortraitCellLayoutMetrics; }