From 6e2106cdfa83ed7d90dedd2c4f0f392d4865ab4f Mon Sep 17 00:00:00 2001 From: "Andrzej J.R. Hunt" Date: Thu, 26 Jul 2012 16:11:51 +0200 Subject: Coverflow resize saved when fragment hidden. Change-Id: I892d309b824ad607b073d44e9c864bc3f910c119 --- .../impressremote/PresentationFragment.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'android') diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java index ed6e86f699dc..1793696681a3 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java +++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java @@ -41,6 +41,9 @@ public class PresentationFragment extends Fragment { private float mOriginalCoverflowWidth; private float mOriginalCoverflowHeight; + private float mNewCoverflowWidth = 0; + private float mNewCoverflowHeight = 0; + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mContext = container.getContext(); @@ -72,6 +75,18 @@ public class PresentationFragment extends Fragment { // Save the height/width for future reference mOriginalCoverflowHeight = mTopView.getImageHeight(); mOriginalCoverflowWidth = mTopView.getImageWidth(); + + if (mNewCoverflowHeight != 0) { + ThumbnailAdapter aAdapter = (ThumbnailAdapter) mTopView + .getAdapter(); + aAdapter.setHeight(mNewCoverflowHeight); + mTopView.setImageHeight(mNewCoverflowHeight); + aAdapter.setWidth(mNewCoverflowWidth); + mTopView.setImageWidth(mNewCoverflowWidth); + + // We need to update the view now + aAdapter.notifyDataSetChanged(); + } return v; } @@ -127,6 +142,9 @@ public class PresentationFragment extends Fragment { // aParams.height += aDiff; // mTopView.setLayoutParams(aParams); + mNewCoverflowHeight = aHeightNew; + mNewCoverflowWidth = aWidthNew; + aAdapter.setHeight(aHeightNew); mTopView.setImageHeight(aHeightNew); aAdapter.setWidth(aWidthNew); -- cgit