am 89db6504: am f9372016: am b130ba2b: Fix some minor print UX bugs.

* commit '89db6504f960f52e84bcce3368a34c843f71eddc':
  Fix some minor print UX bugs.
This commit is contained in:
Svet Ganov
2014-08-13 05:29:04 +00:00
committed by Android Git Automerger
9 changed files with 52 additions and 22 deletions

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/ic_menu_savetopdf"
android:tint="@color/promoted_action_background_color" />

View File

@@ -31,7 +31,7 @@
<RelativeLayout
android:id="@+id/page_footer"
android:layout_width="fill_parent"
android:layout_height="32dip"
android:layout_height="@dimen/preview_page_footer_height"
android:background="@*android:color/material_grey_500"
android:orientation="horizontal">

View File

@@ -27,7 +27,6 @@
android:id="@+id/static_content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="16dip"
android:elevation="@dimen/preview_controls_elevation"
android:background="?android:attr/colorPrimary">
@@ -35,6 +34,7 @@
android:id="@+id/destination_spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dip"
android:dropDownWidth="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeightSmall">
</Spinner>
@@ -56,7 +56,6 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dip"
android:layout_marginStart="12dip"
android:textAppearance="?android:attr/textAppearanceSmall"
android:labelFor="@+id/copies_count_summary"
@@ -67,7 +66,6 @@
android:id="@+id/copies_count_summary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dip"
android:layout_marginStart="16dip"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?android:attr/textColorPrimary">
@@ -76,7 +74,6 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dip"
android:layout_marginStart="32dip"
android:textAppearance="?android:attr/textAppearanceSmall"
android:labelFor="@+id/paper_size_summary"
@@ -87,7 +84,6 @@
android:id="@+id/paper_size_summary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dip"
android:layout_marginStart="16dip"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?android:attr/textColorPrimary">

View File

@@ -267,8 +267,8 @@
android:id="@+id/expand_collapse_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dip"
android:layout_marginBottom="8dip"
android:layout_marginTop="4dip"
android:layout_marginBottom="4dip"
android:layout_gravity="center"
android:background="@drawable/ic_expand_more">
</ImageView>

View File

@@ -45,4 +45,7 @@
<fraction name="page_selected_alpha">100%</fraction>
<fraction name="page_unselected_alpha">50%</fraction>
<dimen name="preview_page_footer_height">32dip</dimen>
<dimen name="preview_page_min_width">130dip</dimen>
</resources>

View File

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

View File

@@ -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 {

View File

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

View File

@@ -162,7 +162,7 @@ public final class PrintOptionsLayout extends ViewGroup {
}
cellStart = getPaddingStart();
cellTop += cellTop + rowHeight;
cellTop += rowHeight;
}
}