From eb00d4afdd0e204bcb8379529bc9ef222dd28abe Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Wed, 14 Sep 2011 17:56:27 -0700 Subject: [PATCH] Fixing regression where scroll position would be offset when rotated. - Fixes the scrolling issue only in conjunction with framework measure fix - Updating the wallpaper gallery item background Change-Id: Id7ff602837dbe1d8a2aaec6ec49b667f11d01bc9 --- res/drawable-hdpi/grid_focused.9.png | Bin 0 -> 200 bytes res/drawable-hdpi/grid_pressed.9.png | Bin 0 -> 184 bytes res/drawable-hdpi/grid_selected.9.png | Bin 0 -> 202 bytes res/drawable-mdpi/grid_focused.9.png | Bin 0 -> 170 bytes res/drawable-mdpi/grid_pressed.9.png | Bin 0 -> 165 bytes res/drawable-mdpi/grid_selected.9.png | Bin 0 -> 165 bytes res/drawable-xhdpi/grid_focused.9.png | Bin 0 -> 193 bytes res/drawable-xhdpi/grid_pressed.9.png | Bin 0 -> 190 bytes res/drawable-xhdpi/grid_selected.9.png | Bin 0 -> 199 bytes res/drawable/wallpaper_gallery_item.xml | 22 ++++++++++++++++++++++ res/layout/wallpaper_item.xml | 1 + src/com/android/launcher2/PagedView.java | 19 ++++++++++--------- 12 files changed, 33 insertions(+), 9 deletions(-) create mode 100644 res/drawable-hdpi/grid_focused.9.png create mode 100644 res/drawable-hdpi/grid_pressed.9.png create mode 100644 res/drawable-hdpi/grid_selected.9.png create mode 100644 res/drawable-mdpi/grid_focused.9.png create mode 100644 res/drawable-mdpi/grid_pressed.9.png create mode 100644 res/drawable-mdpi/grid_selected.9.png create mode 100644 res/drawable-xhdpi/grid_focused.9.png create mode 100644 res/drawable-xhdpi/grid_pressed.9.png create mode 100644 res/drawable-xhdpi/grid_selected.9.png create mode 100644 res/drawable/wallpaper_gallery_item.xml diff --git a/res/drawable-hdpi/grid_focused.9.png b/res/drawable-hdpi/grid_focused.9.png new file mode 100644 index 0000000000000000000000000000000000000000..cb5aea89aaa9af7df366fe1bd00c9165a34fdb22 GIT binary patch literal 200 zcmeAS@N?(olHy`uVBq!ia0vp^+#t-s1|(OmDOUqhEX7WqAsj$Z!;#Vf2?p zbb>IW`N`93fr43{E{-7*Q|C@N$lGAR!+d_l<0;~o4HSh9IAa?v&oHwDYH}o=oc~1U z=s~loGBv!plT_L&_o_MxFnD?;Ze&<0c*22S;31O_Z-q@l`Pbb1SNodwC)BnkA3PJc qEG+Nf--qg++a{j#o@b|gJ0~$r>cgX73Y2?p zbb>IW`N`93fr3$HGMh}C>r7udal00HINpFyu({L;7m8$i(bl#);t_Cc*A~N^c|8)mX au$MOo$#y>fE`I}P3xlVtpUXO@geCxFi$FC1 literal 0 HcmV?d00001 diff --git a/res/drawable-hdpi/grid_selected.9.png b/res/drawable-hdpi/grid_selected.9.png new file mode 100644 index 0000000000000000000000000000000000000000..02ab90253406f667bef5dae196c4798c2a449716 GIT binary patch literal 202 zcmeAS@N?(olHy`uVBq!ia0vp^+#t-s1|(OmDOUqhEX7WqAsj$Z!;#Vf2?p zbb>IW`N`93fr2@nE{-7*Q|C@N$lIVGz*5c`8^Ol=VY^oMqkQIRj4nJ zaCd?*qxs3xYk`73o-U3d5>spYFLEAG5O5YQT>S20Vr$)O{Z@}`Qn*KOP*zQS|Slaq5#Y0hczcPPu4eW%MjQpbV$aI0i%Mfb-jpt%g5 Lu6{1-oD!M4nJ zaCd?*qxs3xYk`99o-U3d5>s3I5Aq&R;9)-B(JQfJ^S6T@XA4nJ zaCd?*qxs3xYk`99o-U3d5>spY4{{zb;5kyFC|&xk?~3IVcWDpbjt6qvT6+T{Kb(%% zu;sk|_s<$lRn7x`Gi-0~Dss2xT|Qy*h0|xfBJOQrnaWsoSHZZp>vc5HNCr<=KbLh* G2~7a9YBb6K literal 0 HcmV?d00001 diff --git a/res/drawable-xhdpi/grid_focused.9.png b/res/drawable-xhdpi/grid_focused.9.png new file mode 100644 index 0000000000000000000000000000000000000000..20d4647df110c03fbafd2b966bfa540135417701 GIT binary patch literal 193 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xamSQK*5Dp-y;YjHK@;M7UB8wRq zxI00Z(fs7;wLrmSPZ!4!jfs0F1#&eQ@Hl@?G5;hdSN33{jr$(~_G_n7py+SNk)ZumAk~an`7!zI!*abT6EB*C)@4*d^7Crf~|48D|pDxR^+~l)weLeQ$ kc|!Dsb8jlUN^E~}?r)KpZojpy2523Fr>mdKI;Vst0Fll`r~m)} literal 0 HcmV?d00001 diff --git a/res/drawable-xhdpi/grid_pressed.9.png b/res/drawable-xhdpi/grid_pressed.9.png new file mode 100644 index 0000000000000000000000000000000000000000..73a784b600adc633694aeae9f4938f378dfcdd13 GIT binary patch literal 190 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xamSQK*5Dp-y;YjHK@;M7UB8wRq zxI00Z(fs7;wLrlHPZ!4!jfqz$UF2*q;BmR{X;vhV{`K(0IgkHLT(r?qK(I!D!&dL@ z#e~^>ex+i$PC}12mEFw@aGumA?R@h4u?50%Gx(k}JzKJS*G1R+6}F4J_6hEuFn_Xf hEZhGV@|C-uNN;PB@4ZxgCl6>BgQu&X%Q~loCIDz8K}!Gt literal 0 HcmV?d00001 diff --git a/res/drawable-xhdpi/grid_selected.9.png b/res/drawable-xhdpi/grid_selected.9.png new file mode 100644 index 0000000000000000000000000000000000000000..eb0f3dc2f19bf4c03e6bb7ac9e11310aff900808 GIT binary patch literal 199 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xamSQK*5Dp-y;YjHK@;M7UB8wRq zxI00Z(fs7;wLrm4PZ!4!jfs1MZu2%M2xN0c8?+@`tWUORE1try%vi*1tvC5@ZHU99M5hYZHS*8rS!k`ZnjCF-K%#Eyi?BcQE$%#d-gQ=1 pT;|Jx_cC5gk;mp}3hnTn$M_{lcB8So&LyCw44$rjF6*2UngH6sK864Q literal 0 HcmV?d00001 diff --git a/res/drawable/wallpaper_gallery_item.xml b/res/drawable/wallpaper_gallery_item.xml new file mode 100644 index 0000000000..b7052bd39d --- /dev/null +++ b/res/drawable/wallpaper_gallery_item.xml @@ -0,0 +1,22 @@ + + + + + + + + + diff --git a/res/layout/wallpaper_item.xml b/res/layout/wallpaper_item.xml index 0834ce6802..bd3fa2bd32 100644 --- a/res/layout/wallpaper_item.xml +++ b/res/layout/wallpaper_item.xml @@ -18,5 +18,6 @@ android:id="@+id/wallpaper_image" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:background="@drawable/wallpaper_gallery_item" android:scaleType="fitXY" android:focusable="true" /> diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java index dca4d14487..9a105d1042 100644 --- a/src/com/android/launcher2/PagedView.java +++ b/src/com/android/launcher2/PagedView.java @@ -539,15 +539,6 @@ public abstract class PagedView extends ViewGroup { } if (DEBUG) Log.d(TAG, "PagedView.onLayout()"); - if (mFirstLayout && mCurrentPage >= 0 && mCurrentPage < getChildCount()) { - setHorizontalScrollBarEnabled(false); - int newX = getChildOffset(mCurrentPage) - getRelativeChildOffset(mCurrentPage); - scrollTo(newX, 0); - mScroller.setFinalX(newX); - setHorizontalScrollBarEnabled(true); - mFirstLayout = false; - } - final int verticalPadding = mPaddingTop + mPaddingBottom; final int childCount = getChildCount(); int childLeft = 0; @@ -578,6 +569,16 @@ public abstract class PagedView extends ViewGroup { childLeft += childWidth + mPageSpacing; } } + + if (mFirstLayout && mCurrentPage >= 0 && mCurrentPage < getChildCount()) { + setHorizontalScrollBarEnabled(false); + int newX = getChildOffset(mCurrentPage) - getRelativeChildOffset(mCurrentPage); + scrollTo(newX, 0); + mScroller.setFinalX(newX); + setHorizontalScrollBarEnabled(true); + mFirstLayout = false; + } + if (mFirstLayout && mCurrentPage >= 0 && mCurrentPage < getChildCount()) { mFirstLayout = false; }