add tabs to QuickControls
Bug: 4084343
The final act in a 3 act drama.
Adds tab thumbnails to QuickControls menu and
removes the tab bar.
Change-Id: Id667e8020745c3d77920858fcd9dd7f510973dd9
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index 19ad40e..d02f05c 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -1956,17 +1956,17 @@
int thumbnailWidth = thumbnail.getWidth();
int thumbnailHeight = thumbnail.getHeight();
float scaleFactor = 1.0f;
- if (thumbnailWidth > 0) {
+ if (thumbnailWidth > 0 && thumbnailHeight > 0) {
scaleFactor = (float) width / (float)thumbnailWidth;
} else {
return null;
}
- if (view.getWidth() > view.getHeight() &&
- thumbnailHeight < view.getHeight() && thumbnailHeight > 0) {
- // If the device is in landscape and the page is shorter
- // than the height of the view, center the thumnail and crop the sides
- scaleFactor = (float) height / (float)thumbnailHeight;
+ float scaleFactorY = (float) height / (float)thumbnailHeight;
+ if (scaleFactorY > scaleFactor) {
+ // The picture is narrower than the requested AR
+ // Center the thumnail and crop the sides
+ scaleFactor = scaleFactorY;
float wx = (thumbnailWidth * scaleFactor) - width;
canvas.translate((int) -(wx / 2), 0);
}