From e3cfbec7045220294c172d55122daf55ab6cb058 Mon Sep 17 00:00:00 2001 From: Martijn Coenen Date: Thu, 3 Nov 2011 17:04:41 -0700 Subject: Check for navigation bar when cropping Beam screenshot. This fixes the Beam animation on crespo. Change-Id: I1bc374dc532a4e83622c62b31ee5b4de2b5fa3ba --- src/com/android/nfc/SendUi.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/com/android/nfc/SendUi.java b/src/com/android/nfc/SendUi.java index 37c8cfc..f755c8c 100644 --- a/src/com/android/nfc/SendUi.java +++ b/src/com/android/nfc/SendUi.java @@ -394,16 +394,19 @@ public class SendUi implements Animator.AnimatorListener, View.OnTouchListener, // take screenshots only in the natural orientation of the device :!) mDisplay.getRealMetrics(mDisplayMetrics); + boolean hasNavBar = mContext.getResources().getBoolean( + com.android.internal.R.bool.config_showNavigationBar); float[] dims = {mDisplayMetrics.widthPixels, mDisplayMetrics.heightPixels}; float degrees = getDegreesForRotation(mDisplay.getRotation()); final int statusBarHeight = mContext.getResources().getDimensionPixelSize( com.android.internal.R.dimen.status_bar_height); + // Navbar has different sizes, depending on orientation - final int navBarHeight = mContext.getResources().getDimensionPixelSize( - com.android.internal.R.dimen.navigation_bar_height); - final int navBarWidth = mContext.getResources().getDimensionPixelSize( - com.android.internal.R.dimen.navigation_bar_width); + final int navBarHeight = hasNavBar ? mContext.getResources().getDimensionPixelSize( + com.android.internal.R.dimen.navigation_bar_height) : 0; + final int navBarWidth = hasNavBar ? mContext.getResources().getDimensionPixelSize( + com.android.internal.R.dimen.navigation_bar_width) : 0; boolean requiresRotation = (degrees > 0); if (requiresRotation) { -- cgit v1.1