summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartijn Coenen <maco@google.com>2012-10-23 11:43:02 -0700
committerMartijn Coenen <maco@google.com>2012-10-23 11:43:26 -0700
commitb340c6cb76ce38a28d0a775dfaeb027b364fe884 (patch)
tree37ab3e413df021dfdefc41d9c9d9d8e2862b2a82
parentce3c183c9b8f3e36ba841d15b91d855854552321 (diff)
downloadpackages_apps_nfc-b340c6cb76ce38a28d0a775dfaeb027b364fe884.zip
packages_apps_nfc-b340c6cb76ce38a28d0a775dfaeb027b364fe884.tar.gz
packages_apps_nfc-b340c6cb76ce38a28d0a775dfaeb027b364fe884.tar.bz2
Fix wrong Beam image scaling on sw600 and larger devices.
On sw600 and larger, the navbar is at the bottom, not to the side. Bug: 7399926 Change-Id: I825a1156995ec6e84faef16866dea4bf240a11c2
-rw-r--r--src/com/android/nfc/SendUi.java16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/com/android/nfc/SendUi.java b/src/com/android/nfc/SendUi.java
index a12aabb..5b5c234 100644
--- a/src/com/android/nfc/SendUi.java
+++ b/src/com/android/nfc/SendUi.java
@@ -445,6 +445,9 @@ public class SendUi implements Animator.AnimatorListener, View.OnTouchListener,
// Navbar has different sizes, depending on orientation
final int navBarHeight = hasNavBar ? mContext.getResources().getDimensionPixelSize(
com.android.internal.R.dimen.navigation_bar_height) : 0;
+ final int navBarHeightLandscape = hasNavBar ? mContext.getResources().getDimensionPixelSize(
+ com.android.internal.R.dimen.navigation_bar_height_landscape) : 0;
+
final int navBarWidth = hasNavBar ? mContext.getResources().getDimensionPixelSize(
com.android.internal.R.dimen.navigation_bar_width) : 0;
@@ -485,13 +488,20 @@ public class SendUi implements Animator.AnimatorListener, View.OnTouchListener,
int newTop = statusBarHeight;
int newWidth = bitmap.getWidth();
int newHeight = bitmap.getHeight();
+ float smallestWidth = (float)Math.min(newWidth, newHeight);
+ float smallestWidthDp = smallestWidth / (mDisplayMetrics.densityDpi / 160f);
if (bitmap.getWidth() < bitmap.getHeight()) {
// Portrait mode: status bar is at the top, navbar bottom, width unchanged
newHeight = bitmap.getHeight() - statusBarHeight - navBarHeight;
} else {
- // Landscape mode: status bar is at the top, navbar right
- newHeight = bitmap.getHeight() - statusBarHeight;
- newWidth = bitmap.getWidth() - navBarWidth;
+ // Landscape mode: status bar is at the top
+ // Navbar: bottom on >599dp width devices, otherwise to the side
+ if (smallestWidthDp > 599) {
+ newHeight = bitmap.getHeight() - statusBarHeight - navBarHeightLandscape;
+ } else {
+ newHeight = bitmap.getHeight() - statusBarHeight;
+ newWidth = bitmap.getWidth() - navBarWidth;
+ }
}
bitmap = Bitmap.createBitmap(bitmap, newLeft, newTop, newWidth, newHeight);