From 03d49b2be3f60806c1fa1e1de61cf46a4fd81c86 Mon Sep 17 00:00:00 2001 From: "Andrzej J.R. Hunt" Date: Tue, 14 Aug 2012 21:00:06 +0200 Subject: [PATCH] Fixed resizing for landscape view. Change-Id: I5d0ce922efef1eea682e61c05eba3554f9263a8d --- .../res/drawable-hdpi/handle_vertical_light.9.png | Bin 202 -> 0 bytes .../handle_default.9.png} | Bin .../res/drawable-land-hdpi/handle_light.9.png | Bin 0 -> 201 bytes .../res/drawable-land-ldpi/handle_default.9.png | Bin 0 -> 263 bytes .../res/drawable-land-ldpi/handle_light.9.png | Bin 0 -> 201 bytes .../res/drawable-land-mdpi/handle_default.9.png | Bin 0 -> 263 bytes .../res/drawable-land-mdpi/handle_light.9.png | Bin 0 -> 201 bytes android/sdremote/res/drawable-land/handle.xml | 9 --------- .../impressremote/PresentationFragment.java | 10 ++++++---- 9 files changed, 6 insertions(+), 13 deletions(-) delete mode 100644 android/sdremote/res/drawable-hdpi/handle_vertical_light.9.png rename android/sdremote/res/{drawable-hdpi/handle_vertical_default.9.png => drawable-land-hdpi/handle_default.9.png} (100%) create mode 100644 android/sdremote/res/drawable-land-hdpi/handle_light.9.png create mode 100644 android/sdremote/res/drawable-land-ldpi/handle_default.9.png create mode 100644 android/sdremote/res/drawable-land-ldpi/handle_light.9.png create mode 100644 android/sdremote/res/drawable-land-mdpi/handle_default.9.png create mode 100644 android/sdremote/res/drawable-land-mdpi/handle_light.9.png delete mode 100644 android/sdremote/res/drawable-land/handle.xml diff --git a/android/sdremote/res/drawable-hdpi/handle_vertical_light.9.png b/android/sdremote/res/drawable-hdpi/handle_vertical_light.9.png deleted file mode 100644 index 8246c398347b150038b9ac9e69b4f9c23fa6006c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 202 zcmeAS@N?(olHy`uVBq!ia0vp^{6H+k!3HE-=Cy!0EX7WqAsj$Z!;#Vf4nJ z@ErkR#;MwT(m=r+PZ!4!i{87Fck>=l;Bn#QX8k75bZM669tS;9*GJApt28V-pPlUQ z*JWXFNm=Kix7FLT-Oc=u>lq#^k+f|!4nJ z@ErkR#;MwT(m=s%PZ!4!i{87Fz4;mpI9PATohbV69I*Y1NQ^_w3%5#@9Y$83=K4PN z6Q&g;il2>)+q`M!)SFAcI5`6W;UD4JvZ&;Lyw!W3?DLpVb;9bh?54wTxo~T>w sG`qnz!+NK_?5#k)lRd8v@A<4+&XH)^X0oG`6KE}ir>mdKI;Vst05|wWfB*mh literal 0 HcmV?d00001 diff --git a/android/sdremote/res/drawable-land-ldpi/handle_default.9.png b/android/sdremote/res/drawable-land-ldpi/handle_default.9.png new file mode 100644 index 0000000000000000000000000000000000000000..830493c1f90c040e03c113b2fc3d62f4608a060c GIT binary patch literal 263 zcmeAS@N?(olHy`uVBq!ia0vp^{6H+k!3HE-=Cy!0EX7WqAsj$Z!;#Vf4nJ z@ErkR#;MwT(m=tLo-U3d7QI&|Z{$6!AmYOB))CER+!V~DeI)ymwKhYl4U=BRT){uV zDz5u_RF{ZM^k4L#5!?)y*%BcT8cr_3HM*-T<$}d27_9k0vY? zX<2hlz==y^Xq?8KgxhmJ|Sh}-;ZepqSJ-{;=@7_>wjJ_zgCuLC-o!PC{xWt~$( F69B;~VL$)? literal 0 HcmV?d00001 diff --git a/android/sdremote/res/drawable-land-ldpi/handle_light.9.png b/android/sdremote/res/drawable-land-ldpi/handle_light.9.png new file mode 100644 index 0000000000000000000000000000000000000000..1db41c1256fadc16f95624ce9c21769e26d8bd65 GIT binary patch literal 201 zcmeAS@N?(olHy`uVBq!ia0vp^{6H+k!3HE-=Cy!0EX7WqAsj$Z!;#Vf4nJ z@ErkR#;MwT(m=s%PZ!4!i{87Fz4;mpI9PATohbV69I*Y1NQ^_w3%5#@9Y$83=K4PN z6Q&g;il2>)+q`M!)SFAcI5`6W;UD4JvZ&;Lyw!W3?DLpVb;9bh?54wTxo~T>w sG`qnz!+NK_?5#k)lRd8v@A<4+&XH)^X0oG`6KE}ir>mdKI;Vst05|wWfB*mh literal 0 HcmV?d00001 diff --git a/android/sdremote/res/drawable-land-mdpi/handle_default.9.png b/android/sdremote/res/drawable-land-mdpi/handle_default.9.png new file mode 100644 index 0000000000000000000000000000000000000000..830493c1f90c040e03c113b2fc3d62f4608a060c GIT binary patch literal 263 zcmeAS@N?(olHy`uVBq!ia0vp^{6H+k!3HE-=Cy!0EX7WqAsj$Z!;#Vf4nJ z@ErkR#;MwT(m=tLo-U3d7QI&|Z{$6!AmYOB))CER+!V~DeI)ymwKhYl4U=BRT){uV zDz5u_RF{ZM^k4L#5!?)y*%BcT8cr_3HM*-T<$}d27_9k0vY? zX<2hlz==y^Xq?8KgxhmJ|Sh}-;ZepqSJ-{;=@7_>wjJ_zgCuLC-o!PC{xWt~$( F69B;~VL$)? literal 0 HcmV?d00001 diff --git a/android/sdremote/res/drawable-land-mdpi/handle_light.9.png b/android/sdremote/res/drawable-land-mdpi/handle_light.9.png new file mode 100644 index 0000000000000000000000000000000000000000..1db41c1256fadc16f95624ce9c21769e26d8bd65 GIT binary patch literal 201 zcmeAS@N?(olHy`uVBq!ia0vp^{6H+k!3HE-=Cy!0EX7WqAsj$Z!;#Vf4nJ z@ErkR#;MwT(m=s%PZ!4!i{87Fz4;mpI9PATohbV69I*Y1NQ^_w3%5#@9Y$83=K4PN z6Q&g;il2>)+q`M!)SFAcI5`6W;UD4JvZ&;Lyw!W3?DLpVb;9bh?54wTxo~T>w sG`qnz!+NK_?5#k)lRd8v@A<4+&XH)^X0oG`6KE}ir>mdKI;Vst05|wWfB*mh literal 0 HcmV?d00001 diff --git a/android/sdremote/res/drawable-land/handle.xml b/android/sdremote/res/drawable-land/handle.xml deleted file mode 100644 index 3656e835035d..000000000000 --- a/android/sdremote/res/drawable-land/handle.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java index 1f9d3ddefb74..69201a1c0654 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java +++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java @@ -134,8 +134,10 @@ public class PresentationFragment extends Fragment { boolean aPortrait = (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT); - int aFlowSize = mTopView.getHeight(); - int aViewSize = mLayout.getHeight(); + int aFlowSize = aPortrait ? mTopView.getHeight() : mTopView + .getWidth(); + int aViewSize = aPortrait ? mLayout.getHeight() : mLayout + .getWidth(); // Calculate height change, taking limits into account int aDiff = (int) (aPortrait ? aEvent.getY() : aEvent.getX()); @@ -163,12 +165,12 @@ public class PresentationFragment extends Fragment { aDiff = (int) (aHeightNew - mTopView.getImageHeight()); } } else { - aWidthNew = mTopView.getImageWidth(); + aWidthNew = mTopView.getImageWidth() + aDiff; aHeightNew = (float) (aWidthNew / aRatio); // Too High -- so scale down if (aHeightNew > mLayout.getHeight() - 50) { aHeightNew = mLayout.getHeight() - 50; - aWidthNew = (float) (aHeightNew / aRatio); + aWidthNew = (float) (aHeightNew * aRatio); aDiff = (int) (aWidthNew - mTopView.getImageWidth()); } }