Fixed resizing for landscape view.

Change-Id: I5d0ce922efef1eea682e61c05eba3554f9263a8d
This commit is contained in:
Andrzej J.R. Hunt
2012-08-14 21:00:06 +02:00
parent e6ac2ad7ac
commit 03d49b2be3
9 changed files with 6 additions and 13 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 202 B

View File

Before

Width:  |  Height:  |  Size: 263 B

After

Width:  |  Height:  |  Size: 263 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 263 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 263 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/handle_vertical_light" android:state_activated="true"/>
<item android:drawable="@drawable/handle_vertical_light" android:state_pressed="true"/>
<item android:drawable="@drawable/handle_vertical_light" android:state_focused="true"/>
<item android:drawable="@drawable/handle_vertical_default"/>
</selector>

View File

@@ -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());
}
}