summaryrefslogtreecommitdiffstats
path: root/packages/PrintSpooler/src
diff options
context:
space:
mode:
authorSvet Ganov <svetoslavganov@google.com>2014-08-12 00:57:07 -0700
committerSvetoslav Ganov <svetoslavganov@google.com>2014-08-13 04:07:21 +0000
commit38781bd2c2c61385651314098b4a615cb8e8efa1 (patch)
treed2802da8c15abdcf456e79db2123eb3ed7041ae1 /packages/PrintSpooler/src
parent79dea425af818c3fe1d4edb0af7ad301cdd621a4 (diff)
downloadframeworks_base-38781bd2c2c61385651314098b4a615cb8e8efa1.zip
frameworks_base-38781bd2c2c61385651314098b4a615cb8e8efa1.tar.gz
frameworks_base-38781bd2c2c61385651314098b4a615cb8e8efa1.tar.bz2
Fix some minor print UX bugs.
1. The last row of print options was not visible on a phone. 2. The preview page size on a phone in landscape unusably small. 3. Updated the Save to PDF icon. bug:16966145 Change-Id: I25ce1572758c62f34344683af2452fb045bb857e
Diffstat (limited to 'packages/PrintSpooler/src')
-rw-r--r--packages/PrintSpooler/src/com/android/printspooler/ui/PageAdapter.java32
-rw-r--r--packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java4
-rw-r--r--packages/PrintSpooler/src/com/android/printspooler/widget/PageContentView.java2
-rw-r--r--packages/PrintSpooler/src/com/android/printspooler/widget/PrintOptionsLayout.java2
4 files changed, 26 insertions, 14 deletions
diff --git a/packages/PrintSpooler/src/com/android/printspooler/ui/PageAdapter.java b/packages/PrintSpooler/src/com/android/printspooler/ui/PageAdapter.java
index e976936..5bcdb9f 100644
--- a/packages/PrintSpooler/src/com/android/printspooler/ui/PageAdapter.java
+++ b/packages/PrintSpooler/src/com/android/printspooler/ui/PageAdapter.java
@@ -96,6 +96,7 @@ public final class PageAdapter extends Adapter implements
private float mUnselectedPageAlpha;
private int mPreviewPageMargin;
+ private int mPreviewPageMinWidth;
private int mPreviewListPadding;
private int mFooterHeight;
@@ -141,17 +142,17 @@ public final class PageAdapter extends Adapter implements
mPreviewPageMargin = mContext.getResources().getDimensionPixelSize(
R.dimen.preview_page_margin);
+ mPreviewPageMinWidth = mContext.getResources().getDimensionPixelSize(
+ R.dimen.preview_page_min_width);
+
mPreviewListPadding = mContext.getResources().getDimensionPixelSize(
R.dimen.preview_list_padding);
mColumnCount = mContext.getResources().getInteger(
R.integer.preview_page_per_row_count);
- TypedValue outValue = new TypedValue();
- mContext.getTheme().resolveAttribute(
- com.android.internal.R.attr.listPreferredItemHeightSmall, outValue, true);
- mFooterHeight = TypedValue.complexToDimensionPixelSize(outValue.data,
- mContext.getResources().getDisplayMetrics());
+ mFooterHeight = mContext.getResources().getDimensionPixelSize(
+ R.dimen.preview_page_footer_height);
mPreviewArea = previewArea;
@@ -428,8 +429,12 @@ public final class PageAdapter extends Adapter implements
// Compute max page height.
final int pageContentDesiredHeight = (int) (((float) pageContentDesiredWidth
/ pageAspectRatio) + 0.5f);
- final int pageContentMaxHeight = availableHeight - 2 * (mPreviewListPadding
- + mPreviewPageMargin) - mFooterHeight;
+
+ // If the page does not fit entirely in a vertial direction,
+ // we shirk it but not less than the minimal page width.
+ final int pageContentMinHeight = (int) (mPreviewPageMinWidth / pageAspectRatio + 0.5f);
+ final int pageContentMaxHeight = Math.max(pageContentMinHeight,
+ availableHeight - 2 * (mPreviewListPadding + mPreviewPageMargin) - mFooterHeight);
mPageContentHeight = Math.min(pageContentDesiredHeight, pageContentMaxHeight);
mPageContentWidth = (int) ((mPageContentHeight * pageAspectRatio) + 0.5f);
@@ -439,10 +444,17 @@ public final class PageAdapter extends Adapter implements
final int rowCount = mSelectedPageCount / columnCount
+ ((mSelectedPageCount % columnCount) > 0 ? 1 : 0);
- final int totalContentHeight = rowCount* (mPageContentHeight + mFooterHeight + 2
+ final int totalContentHeight = rowCount * (mPageContentHeight + mFooterHeight + 2
* mPreviewPageMargin);
- final int verticalPadding = Math.max(mPreviewListPadding,
- (availableHeight - totalContentHeight) / 2);
+
+ final int verticalPadding;
+ if (mPageContentHeight + mFooterHeight + mPreviewListPadding > availableHeight) {
+ verticalPadding = Math.max(mPreviewPageMargin,
+ (availableHeight - totalContentHeight) / 2);
+ } else {
+ verticalPadding = Math.max(mPreviewListPadding,
+ (availableHeight - totalContentHeight) / 2);
+ }
mPreviewArea.setPadding(horizontalPadding, verticalPadding,
horizontalPadding, verticalPadding);
diff --git a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
index a1b1aec..6b29e5f 100644
--- a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
+++ b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
@@ -1704,7 +1704,7 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
if (position == 0 && getPdfPrinter() != null) {
PrinterHolder printerHolder = (PrinterHolder) getItem(position);
title = printerHolder.printer.getName();
- icon = getResources().getDrawable(com.android.internal.R.drawable.ic_menu_save);
+ icon = getResources().getDrawable(R.drawable.ic_savetopdf);
} else if (position == 1) {
title = getString(R.string.all_printers);
}
@@ -1712,7 +1712,7 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
if (position == 1 && getPdfPrinter() != null) {
PrinterHolder printerHolder = (PrinterHolder) getItem(position);
title = printerHolder.printer.getName();
- icon = getResources().getDrawable(com.android.internal.R.drawable.ic_menu_save);
+ icon = getResources().getDrawable(R.drawable.ic_savetopdf);
} else if (position == getCount() - 1) {
title = getString(R.string.all_printers);
} else {
diff --git a/packages/PrintSpooler/src/com/android/printspooler/widget/PageContentView.java b/packages/PrintSpooler/src/com/android/printspooler/widget/PageContentView.java
index 4d2cb6c..8365373 100644
--- a/packages/PrintSpooler/src/com/android/printspooler/widget/PageContentView.java
+++ b/packages/PrintSpooler/src/com/android/printspooler/widget/PageContentView.java
@@ -94,7 +94,7 @@ public class PageContentView extends View
mMinMargins = minMargins;
mContentRequested = false;
- // If there is not provider we want immediately to switch to
+ // If there is no provider we want immediately to switch to
// the empty state, so pages with no content appear blank.
if (mProvider == null && getBackground() != mEmptyState) {
setBackground(mEmptyState);
diff --git a/packages/PrintSpooler/src/com/android/printspooler/widget/PrintOptionsLayout.java b/packages/PrintSpooler/src/com/android/printspooler/widget/PrintOptionsLayout.java
index 01f4a04..71f4aa7 100644
--- a/packages/PrintSpooler/src/com/android/printspooler/widget/PrintOptionsLayout.java
+++ b/packages/PrintSpooler/src/com/android/printspooler/widget/PrintOptionsLayout.java
@@ -162,7 +162,7 @@ public final class PrintOptionsLayout extends ViewGroup {
}
cellStart = getPaddingStart();
- cellTop += cellTop + rowHeight;
+ cellTop += rowHeight;
}
}