summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/PrintSpooler/res/layout/print_activity.xml1
-rw-r--r--packages/PrintSpooler/res/layout/print_activity_controls.xml10
-rw-r--r--packages/PrintSpooler/res/layout/printer_dropdown_item.xml4
-rw-r--r--packages/PrintSpooler/res/layout/select_printer_activity.xml2
-rw-r--r--packages/PrintSpooler/res/layout/spinner_dropdown_item.xml52
-rw-r--r--packages/PrintSpooler/res/values-land/constants.xml4
-rw-r--r--packages/PrintSpooler/res/values/constants.xml5
-rw-r--r--packages/PrintSpooler/res/values/themes.xml5
-rw-r--r--packages/PrintSpooler/src/com/android/printspooler/ui/PageAdapter.java25
-rw-r--r--packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java14
-rw-r--r--packages/PrintSpooler/src/com/android/printspooler/widget/FirstFocusableEditText.java69
-rw-r--r--packages/PrintSpooler/src/com/android/printspooler/widget/PrintContentView.java22
12 files changed, 47 insertions, 166 deletions
diff --git a/packages/PrintSpooler/res/layout/print_activity.xml b/packages/PrintSpooler/res/layout/print_activity.xml
index ee5d42a..761d58a 100644
--- a/packages/PrintSpooler/res/layout/print_activity.xml
+++ b/packages/PrintSpooler/res/layout/print_activity.xml
@@ -27,6 +27,7 @@
android:id="@+id/static_content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
+ android:paddingStart="8dip"
android:elevation="@dimen/preview_controls_elevation"
android:background="?android:attr/colorPrimary">
diff --git a/packages/PrintSpooler/res/layout/print_activity_controls.xml b/packages/PrintSpooler/res/layout/print_activity_controls.xml
index 0629481..c2a0da9 100644
--- a/packages/PrintSpooler/res/layout/print_activity_controls.xml
+++ b/packages/PrintSpooler/res/layout/print_activity_controls.xml
@@ -55,8 +55,7 @@
android:text="@string/label_copies">
</TextView>
- <view
- class="com.android.printspooler.widget.FirstFocusableEditText"
+ <EditText
android:id="@+id/copies_edittext"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
@@ -64,7 +63,7 @@
android:singleLine="true"
android:ellipsize="end"
android:inputType="numberDecimal">
- </view>
+ </EditText>
</LinearLayout>
@@ -198,8 +197,7 @@
android:visibility="visible">
</TextView>
- <view
- class="com.android.printspooler.widget.FirstFocusableEditText"
+ <EditText
android:id="@+id/page_range_edittext"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
@@ -208,7 +206,7 @@
android:ellipsize="end"
android:visibility="visible"
android:inputType="textNoSuggestions">
- </view>
+ </EditText>
</LinearLayout>
diff --git a/packages/PrintSpooler/res/layout/printer_dropdown_item.xml b/packages/PrintSpooler/res/layout/printer_dropdown_item.xml
index 43d8aaf..4381a7a 100644
--- a/packages/PrintSpooler/res/layout/printer_dropdown_item.xml
+++ b/packages/PrintSpooler/res/layout/printer_dropdown_item.xml
@@ -17,8 +17,8 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:paddingStart="16dip"
- android:paddingEnd="16dip"
+ android:paddingStart="8dip"
+ android:paddingEnd="8dip"
android:minHeight="56dip"
android:orientation="horizontal"
android:gravity="start|center_vertical">
diff --git a/packages/PrintSpooler/res/layout/select_printer_activity.xml b/packages/PrintSpooler/res/layout/select_printer_activity.xml
index 173057b..77c500a 100644
--- a/packages/PrintSpooler/res/layout/select_printer_activity.xml
+++ b/packages/PrintSpooler/res/layout/select_printer_activity.xml
@@ -23,8 +23,6 @@
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
- android:paddingStart="@dimen/printer_list_view_padding_start"
- android:paddingEnd="@dimen/printer_list_view_padding_end"
android:scrollbarStyle="outsideOverlay"
android:cacheColorHint="@android:color/transparent"
android:scrollbarAlwaysDrawVerticalTrack="true" >
diff --git a/packages/PrintSpooler/res/layout/spinner_dropdown_item.xml b/packages/PrintSpooler/res/layout/spinner_dropdown_item.xml
deleted file mode 100644
index 14403a1..0000000
--- a/packages/PrintSpooler/res/layout/spinner_dropdown_item.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2013 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.
--->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:minHeight="?android:attr/listPreferredItemHeightSmall"
- android:orientation="vertical"
- android:gravity="start|center_vertical">
-
- <TextView
- android:id="@+id/title"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- style="?android:attr/spinnerDropDownItemStyle"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textColor="?android:attr/textColorPrimary"
- android:singleLine="true"
- android:ellipsize="end"
- android:textIsSelectable="false"
- android:gravity="top|left"
- android:duplicateParentState="true">
- </TextView>
-
- <TextView
- android:id="@+id/subtitle"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- style="?android:attr/spinnerDropDownItemStyle"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="?android:attr/textColorPrimary"
- android:singleLine="true"
- android:ellipsize="end"
- android:textIsSelectable="false"
- android:visibility="gone"
- android:duplicateParentState="true">
- </TextView>
-
-</LinearLayout>
diff --git a/packages/PrintSpooler/res/values-land/constants.xml b/packages/PrintSpooler/res/values-land/constants.xml
index a4666a5..6cf9754 100644
--- a/packages/PrintSpooler/res/values-land/constants.xml
+++ b/packages/PrintSpooler/res/values-land/constants.xml
@@ -16,10 +16,6 @@
<resources>
- <dimen name="printer_list_view_padding_start">48dip</dimen>
-
- <dimen name="printer_list_view_padding_end">48dip</dimen>
-
<integer name="preview_page_per_row_count">2</integer>
<integer name="print_option_column_count">3</integer>
diff --git a/packages/PrintSpooler/res/values/constants.xml b/packages/PrintSpooler/res/values/constants.xml
index b95703b..b4e4777 100644
--- a/packages/PrintSpooler/res/values/constants.xml
+++ b/packages/PrintSpooler/res/values/constants.xml
@@ -28,9 +28,6 @@
<dimen name="print_dialog_frame_max_width_dip">400dip</dimen>
- <dimen name="printer_list_view_padding_start">16dip</dimen>
- <dimen name="printer_list_view_padding_end">16dip</dimen>
-
<dimen name="selected_page_elevation">6dip</dimen>
<dimen name="unselected_page_elevation">2dip</dimen>
@@ -46,6 +43,6 @@
<fraction name="page_unselected_alpha">50%</fraction>
<dimen name="preview_page_footer_height">32dip</dimen>
- <dimen name="preview_page_min_width">130dip</dimen>
+ <dimen name="preview_page_min_width">128dip</dimen>
</resources>
diff --git a/packages/PrintSpooler/res/values/themes.xml b/packages/PrintSpooler/res/values/themes.xml
index db319e9..532b01f 100644
--- a/packages/PrintSpooler/res/values/themes.xml
+++ b/packages/PrintSpooler/res/values/themes.xml
@@ -16,7 +16,10 @@
<resources>
- <style name="PrintActivity" parent="@android:style/Theme.Material.Settings">
+ <style name="PrintActivity" parent="@android:style/Theme.Material">
+ <item name="android:colorPrimary">@*android:color/material_blue_grey_900</item>
+ <item name="android:colorPrimaryDark">@*android:color/material_blue_grey_950</item>
+ <item name="android:colorAccent">@*android:color/material_deep_teal_500</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
diff --git a/packages/PrintSpooler/src/com/android/printspooler/ui/PageAdapter.java b/packages/PrintSpooler/src/com/android/printspooler/ui/PageAdapter.java
index 5bcdb9f..d949673 100644
--- a/packages/PrintSpooler/src/com/android/printspooler/ui/PageAdapter.java
+++ b/packages/PrintSpooler/src/com/android/printspooler/ui/PageAdapter.java
@@ -289,15 +289,11 @@ public final class PageAdapter extends Adapter implements
+ " for position: " + position);
}
- final int pageCount = getItemCount();
MyViewHolder myHolder = (MyViewHolder) holder;
View page = holder.itemView;
- if (pageCount > 1) {
- page.setOnClickListener(mPageClickListener);
- } else {
- page.setOnClickListener(null);
- }
+ page.setOnClickListener(mPageClickListener);
+
page.setTag(holder);
myHolder.mPageInAdapter = position;
@@ -339,16 +335,9 @@ public final class PageAdapter extends Adapter implements
}
content.init(provider, mMediaSize, mMinMargins);
-
View pageSelector = page.findViewById(R.id.page_selector);
pageSelector.setTag(myHolder);
- if (pageCount > 1) {
- pageSelector.setOnClickListener(mPageClickListener);
- pageSelector.setVisibility(View.VISIBLE);
- } else {
- pageSelector.setOnClickListener(null);
- pageSelector.setVisibility(View.GONE);
- }
+ pageSelector.setOnClickListener(mPageClickListener);
if (mConfirmedPagesInDocument.indexOfKey(pageInDocument) >= 0) {
pageSelector.setSelected(true);
@@ -449,8 +438,9 @@ public final class PageAdapter extends Adapter implements
final int verticalPadding;
if (mPageContentHeight + mFooterHeight + mPreviewListPadding > availableHeight) {
- verticalPadding = Math.max(mPreviewPageMargin,
- (availableHeight - totalContentHeight) / 2);
+ verticalPadding = Math.max(0,
+ (availableHeight - mPageContentHeight - mFooterHeight) / 2
+ - mPreviewPageMargin);
} else {
verticalPadding = Math.max(mPreviewListPadding,
(availableHeight - totalContentHeight) / 2);
@@ -791,6 +781,9 @@ public final class PageAdapter extends Adapter implements
page.animate().translationZ(mSelectedPageElevation)
.alpha(mSelectedPageAlpha);
} else {
+ if (mConfirmedPagesInDocument.size() <= 1) {
+ return;
+ }
mConfirmedPagesInDocument.remove(pageInDocument);
pageSelector.setSelected(false);
page.animate().translationZ(mUnselectedPageElevation)
diff --git a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
index fe17516..01c9746 100644
--- a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
+++ b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
@@ -982,21 +982,21 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
// Media size.
mMediaSizeSpinnerAdapter = new ArrayAdapter<>(
- this, R.layout.spinner_dropdown_item, R.id.title);
+ this, android.R.layout.simple_spinner_dropdown_item, android.R.id.text1);
mMediaSizeSpinner = (Spinner) findViewById(R.id.paper_size_spinner);
mMediaSizeSpinner.setAdapter(mMediaSizeSpinnerAdapter);
mMediaSizeSpinner.setOnItemSelectedListener(itemSelectedListener);
// Color mode.
mColorModeSpinnerAdapter = new ArrayAdapter<>(
- this, R.layout.spinner_dropdown_item, R.id.title);
+ this, android.R.layout.simple_spinner_dropdown_item, android.R.id.text1);
mColorModeSpinner = (Spinner) findViewById(R.id.color_spinner);
mColorModeSpinner.setAdapter(mColorModeSpinnerAdapter);
mColorModeSpinner.setOnItemSelectedListener(itemSelectedListener);
// Orientation
mOrientationSpinnerAdapter = new ArrayAdapter<>(
- this, R.layout.spinner_dropdown_item, R.id.title);
+ this, android.R.layout.simple_spinner_dropdown_item, android.R.id.text1);
String[] orientationLabels = getResources().getStringArray(
R.array.orientation_labels);
mOrientationSpinnerAdapter.add(new SpinnerItem<>(
@@ -1008,8 +1008,8 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
mOrientationSpinner.setOnItemSelectedListener(itemSelectedListener);
// Range options
- ArrayAdapter<SpinnerItem<Integer>> rangeOptionsSpinnerAdapter =
- new ArrayAdapter<>(this, R.layout.spinner_dropdown_item, R.id.title);
+ ArrayAdapter<SpinnerItem<Integer>> rangeOptionsSpinnerAdapter = new ArrayAdapter<>(
+ this, android.R.layout.simple_spinner_dropdown_item, android.R.id.text1);
mRangeOptionsSpinner = (Spinner) findViewById(R.id.range_options_spinner);
mRangeOptionsSpinner.setAdapter(rangeOptionsSpinnerAdapter);
mRangeOptionsSpinner.setOnItemSelectedListener(itemSelectedListener);
@@ -1075,6 +1075,7 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
mDestinationSpinner.setEnabled(false);
}
mCopiesEditText.setEnabled(false);
+ mCopiesEditText.setFocusable(false);
mMediaSizeSpinner.setEnabled(false);
mColorModeSpinner.setEnabled(false);
mOrientationSpinner.setEnabled(false);
@@ -1089,6 +1090,7 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
// available, we disable all print options except the destination.
if (mCurrentPrinter == null || !canPrint(mCurrentPrinter)) {
mCopiesEditText.setEnabled(false);
+ mCopiesEditText.setFocusable(false);
mMediaSizeSpinner.setEnabled(false);
mColorModeSpinner.setEnabled(false);
mOrientationSpinner.setEnabled(false);
@@ -1316,8 +1318,10 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
// Copies
if (mDestinationSpinnerAdapter.getPdfPrinter() != mCurrentPrinter) {
mCopiesEditText.setEnabled(true);
+ mCopiesEditText.setFocusableInTouchMode(true);
} else {
mCopiesEditText.setEnabled(false);
+ mCopiesEditText.setFocusable(false);
}
if (mCopiesEditText.getError() == null
&& TextUtils.isEmpty(mCopiesEditText.getText())) {
diff --git a/packages/PrintSpooler/src/com/android/printspooler/widget/FirstFocusableEditText.java b/packages/PrintSpooler/src/com/android/printspooler/widget/FirstFocusableEditText.java
deleted file mode 100644
index d6bb7c8..0000000
--- a/packages/PrintSpooler/src/com/android/printspooler/widget/FirstFocusableEditText.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.printspooler.widget;
-
-import android.content.Context;
-import android.graphics.Rect;
-import android.graphics.drawable.Drawable;
-import android.util.AttributeSet;
-import android.widget.EditText;
-
-/**
- * An instance of this class class is intended to be the first focusable
- * in a layout to which the system automatically gives focus. It performs
- * some voodoo to avoid the first tap on it to start an edit mode, rather
- * to bring up the IME, i.e. to get the behavior as if the view was not
- * focused.
- */
-public final class FirstFocusableEditText extends EditText {
- private boolean mClickedBeforeFocus;
- private CharSequence mError;
-
- public FirstFocusableEditText(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- @Override
- public boolean performClick() {
- super.performClick();
- if (isFocused() && !mClickedBeforeFocus) {
- clearFocus();
- requestFocus();
- }
- mClickedBeforeFocus = true;
- return true;
- }
-
- @Override
- public CharSequence getError() {
- return mError;
- }
-
- @Override
- public void setError(CharSequence error, Drawable icon) {
- setCompoundDrawables(null, null, icon, null);
- mError = error;
- }
-
- protected void onFocusChanged(boolean gainFocus, int direction,
- Rect previouslyFocusedRect) {
- if (!gainFocus) {
- mClickedBeforeFocus = false;
- }
- super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
- }
-} \ No newline at end of file
diff --git a/packages/PrintSpooler/src/com/android/printspooler/widget/PrintContentView.java b/packages/PrintSpooler/src/com/android/printspooler/widget/PrintContentView.java
index e428948..c84b06a 100644
--- a/packages/PrintSpooler/src/com/android/printspooler/widget/PrintContentView.java
+++ b/packages/PrintSpooler/src/com/android/printspooler/widget/PrintContentView.java
@@ -152,6 +152,17 @@ public final class PrintContentView extends ViewGroup implements View.OnClickLis
// Make sure we start in a closed options state.
onDragProgress(1.0f);
+
+ // The framework gives focus to the frist focusable and we
+ // do not want that, hence we will take focus instead.
+ setFocusableInTouchMode(true);
+ }
+
+ @Override
+ public void focusableViewAvailable(View v) {
+ // The framework gives focus to the frist focusable and we
+ // do not want that, hence do not announce new focusables.
+ return;
}
@Override
@@ -309,6 +320,7 @@ public final class PrintContentView extends ViewGroup implements View.OnClickLis
mSummaryContent.setLayerType(View.LAYER_TYPE_NONE, null);
mDraggableContent.setLayerType(View.LAYER_TYPE_NONE, null);
mMoreOptionsButton.setLayerType(View.LAYER_TYPE_NONE, null);
+ mMoreOptionsButton.setLayerType(View.LAYER_TYPE_NONE, null);
}
mDragProgress = progress;
@@ -320,7 +332,6 @@ public final class PrintContentView extends ViewGroup implements View.OnClickLis
mMoreOptionsButton.setAlpha(inverseAlpha);
mEmbeddedContentScrim.setBackgroundColor(computeScrimColor());
-
if (progress == 0) {
if (mOptionsStateChangeListener != null) {
mOptionsStateChangeListener.onOptionsOpened();
@@ -354,14 +365,15 @@ public final class PrintContentView extends ViewGroup implements View.OnClickLis
}
private void ensureImeClosedAndInputFocusCleared() {
- View focus = findFocus();
- if (focus != null) {
+ View focused = findFocus();
+
+ if (focused != null && focused.isFocused()) {
InputMethodManager imm = (InputMethodManager) mContext.getSystemService(
Context.INPUT_METHOD_SERVICE);
- if (imm.isActive(focus)) {
+ if (imm.isActive(focused)) {
imm.hideSoftInputFromWindow(getWindowToken(), 0);
}
- focus.clearFocus();
+ focused.clearFocus();
}
}