Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 597945fd authored by Svetoslav's avatar Svetoslav Committed by Svetoslav Ganov
Browse files

First pass of the print dialog UX

Change-Id: I315a16d7f68c73ca180c76e722847b4b1bdea55b
parent 7a5480d6
Loading
Loading
Loading
Loading
+0 −15
Original line number Diff line number Diff line
@@ -245,13 +245,10 @@ public abstract class PrintService extends Service {
     * @see #removeDiscoveredPrinters(List)
     * @see #onStartPrinterDiscovery()
     * @see #onStopPrinterDiscovery()
     *
     * @throws IllegalStateException If this service is not connected.
     */
    public final void addDiscoveredPrinters(List<PrinterInfo> printers) {
        final IPrinterDiscoveryObserver observer;
        synchronized (mLock) {
            throwIfNotConnectedLocked();
            observer = mDiscoveryObserver;
        }
        if (observer != null) {
@@ -284,13 +281,10 @@ public abstract class PrintService extends Service {
     * @see #addDiscoveredPrinters(List)
     * @see #onStartPrinterDiscovery()
     * @see #onStopPrinterDiscovery()
     *
     * @throws IllegalStateException If this service is not connected.
     */
    public final void removeDiscoveredPrinters(List<PrinterId> printerIds) {
        final IPrinterDiscoveryObserver observer;
        synchronized (mLock) {
            throwIfNotConnectedLocked();
            observer = mDiscoveryObserver;
        }
        if (observer != null) {
@@ -334,13 +328,10 @@ public abstract class PrintService extends Service {
     * Gets the print jobs for the printers managed by this service.
     *
     * @return The print jobs.
     *
     * @throws IllegalStateException If this service is not connected.
     */
    public final List<PrintJob> getPrintJobs() {
        final IPrintServiceClient client;
        synchronized (mLock) {
            throwIfNotConnectedLocked();
            client = mClient;
        }
        if (client == null) {
@@ -410,12 +401,6 @@ public abstract class PrintService extends Service {
        };
    }

    private void throwIfNotConnectedLocked() {
        if (mClient == null) {
            throw new IllegalStateException("Print serivice not connected");
        }
    }

    private final class MyHandler extends Handler {
        public static final int MESSAGE_START_PRINTER_DISCOVERY = 1;
        public static final int MESSAGE_STOP_PRINTER_DISCOVERY = 2;
+2 −1
Original line number Diff line number Diff line
@@ -46,7 +46,8 @@

        <activity
            android:name=".PrintJobConfigActivity"
            android:exported="true">
            android:exported="true"
            android:theme="@android:style/Theme.Holo.Light.Dialog.NoActionBar">
        </activity>

    </application>
+187 −238
Original line number Diff line number Diff line
@@ -14,248 +14,197 @@
     limitations under the License.
-->

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">

    <GridLayout
        android:layout_width="wrap_content"
    android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:orientation="vertical"
        android:columnCount="2">
    android:orientation="vertical">

        <EditText
            android:id="@+id/copies_edittext"
    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
            android:layout_marginLeft="12dip"
            android:layout_marginRight="12dip"
            android:layout_row="0"
            android:layout_column="1"
            android:minWidth="150dip"
            android:inputType="number"
            android:selectAllOnFocus="true">
        </EditText>
        android:background="@*android:color/bright_foreground_disabled_holo_light">

        <TextView
        <GridLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="12dip"
            android:layout_marginRight="12dip"
            android:layout_row="0"
            android:layout_column="0"
            android:text="@string/label_copies"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:labelFor="@id/copies_edittext">
        </TextView>
            android:layout_margin="32dip"
            android:orientation="vertical"
            android:columnCount="2">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="12dip"
            android:layout_marginRight="12dip"
            android:layout_row="1"
            android:layout_column="0"
            android:text="@string/label_destination"
            android:textAppearance="?android:attr/textAppearanceMedium">
        </TextView>
            <!-- Destination -->

            <Spinner
                android:id="@+id/destination_spinner"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
            android:layout_marginLeft="12dip"
            android:layout_marginRight="12dip"
            android:layout_row="1"
            android:layout_column="1"
            android:minWidth="150dip">
                android:layout_marginBottom="12dip"
                android:layout_row="0"
                android:layout_column="0"
                android:layout_columnSpan="2"
                android:minWidth="324dip"
                android:minHeight="?android:attr/listPreferredItemHeightSmall">
            </Spinner>

            <!-- Copies -->

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="12dip"
            android:layout_marginRight="12dip"
            android:layout_row="2"
            android:layout_column="0"
            android:text="@string/label_media_size"
            android:textAppearance="?android:attr/textAppearanceMedium">
        </TextView>

        <Spinner
            android:id="@+id/media_size_spinner"
            <view
                class="com.android.printspooler.PrintJobConfigActivity$CustomEditText"
                android:id="@+id/copies_edittext"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
            android:layout_marginLeft="12dip"
                android:layout_marginRight="12dip"
                android:layout_marginBottom="12dip"
                android:layout_row="2"
            android:layout_column="1"
                android:layout_column="0"
                android:layout_gravity="bottom"
                android:inputType="numberDecimal"
                android:selectAllOnFocus="true"
                android:minWidth="150dip">
        </Spinner>

            </view>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
            android:layout_marginLeft="12dip"
                android:layout_marginTop="12dip"
                android:layout_marginRight="12dip"
            android:layout_row="3"
                android:layout_row="1"
                android:layout_column="0"
            android:text="@string/label_resolution"
            android:textAppearance="?android:attr/textAppearanceMedium">
                android:layout_gravity="left|bottom"
                android:text="@string/label_copies"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:textStyle="bold"
                android:labelFor="@id/copies_edittext">
            </TextView>

            <!-- Paper size -->

            <Spinner
            android:id="@+id/resolution_spinner"
                android:id="@+id/paper_size_spinner"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="12dip"
            android:layout_marginRight="12dip"
            android:layout_row="3"
                android:layout_marginBottom="12dip"
                android:layout_row="2"
                android:layout_column="1"
                android:minWidth="150dip">
            </Spinner>


            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="12dip"
            android:layout_marginRight="12dip"
            android:layout_row="4"
            android:layout_column="0"
            android:text="@string/label_input_tray"
            android:textAppearance="?android:attr/textAppearanceMedium">
                android:layout_marginTop="12dip"
                android:layout_row="1"
                android:layout_column="1"
                android:text="@string/label_paper_size"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:textStyle="bold"
                android:labelFor="@id/paper_size_spinner">
            </TextView>

            <!-- Color -->

            <Spinner
            android:id="@+id/input_tray_spinner"
                android:id="@+id/color_spinner"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
            android:layout_marginLeft="12dip"
                android:layout_marginRight="12dip"
                android:layout_marginBottom="12dip"
                android:layout_row="4"
            android:layout_column="1"
                android:layout_column="0"
                android:minWidth="150dip">
            </Spinner>


            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
            android:layout_marginLeft="12dip"
                android:layout_marginTop="12dip"
                android:layout_marginRight="12dip"
            android:layout_row="5"
                android:layout_row="3"
                android:layout_column="0"
            android:text="@string/label_output_tray"
            android:textAppearance="?android:attr/textAppearanceMedium">
                android:text="@string/label_color"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:textStyle="bold"
                android:labelFor="@id/color_spinner">
            </TextView>

            <!-- Orientation -->

            <Spinner
            android:id="@+id/output_tray_spinner"
                android:id="@+id/orientation_spinner"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="12dip"
            android:layout_marginRight="12dip"
            android:layout_row="5"
                android:layout_marginBottom="12dip"
                android:layout_row="4"
                android:layout_column="1"
                android:minWidth="150dip">
            </Spinner>


            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="12dip"
            android:layout_marginRight="12dip"
            android:layout_row="6"
            android:layout_column="0"
            android:text="@string/label_duplex_mode"
            android:textAppearance="?android:attr/textAppearanceMedium">
                android:layout_marginTop="12dip"
                android:layout_row="3"
                android:layout_column="1"
                android:text="@string/label_orientation"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:textStyle="bold"
                android:labelFor="@id/orientation_spinner">
            </TextView>

            <!-- Pages -->

            <Spinner
            android:id="@+id/duplex_mode_spinner"
                android:id="@+id/range_options_spinner"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
            android:layout_marginLeft="12dip"
                android:layout_marginRight="12dip"
                android:layout_row="6"
            android:layout_column="1"
                android:layout_column="0"
                android:minWidth="150dip">
            </Spinner>


        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="12dip"
            android:layout_marginRight="12dip"
            android:layout_row="7"
            android:layout_column="0"
            android:text="@string/label_color_mode"
            android:textAppearance="?android:attr/textAppearanceMedium">
        </TextView>

        <Spinner
            android:id="@+id/color_mode_spinner"
            <EditText
                android:id="@+id/page_range_edittext"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="12dip"
            android:layout_marginRight="12dip"
            android:layout_row="7"
                android:layout_row="6"
                android:layout_column="1"
            android:minWidth="150dip">
        </Spinner>

                android:layout_gravity="bottom"
                android:selectAllOnFocus="true"
                android:minWidth="150dip"
                android:hint="@string/pages_range_example"
                android:inputType="textNoSuggestions"
                android:visibility="gone">
            </EditText>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
            android:layout_marginLeft="12dip"
                android:layout_marginTop="12dip"
                android:layout_marginRight="12dip"
            android:layout_row="8"
                android:layout_row="5"
                android:layout_column="0"
            android:text="@string/label_fitting_mode"
            android:textAppearance="?android:attr/textAppearanceMedium">
                android:text="@string/label_pages"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:textStyle="bold"
                android:labelFor="@id/range_options_spinner">
            </TextView>

        <Spinner
            android:id="@+id/fitting_mode_spinner"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="12dip"
            android:layout_marginRight="12dip"
            android:layout_row="8"
            android:layout_column="1"
            android:minWidth="150dip">
        </Spinner>

        </GridLayout>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="12dip"
            android:layout_marginRight="12dip"
            android:layout_row="9"
            android:layout_column="0"
            android:text="@string/label_orientation"
            android:textAppearance="?android:attr/textAppearanceMedium">
        </TextView>
    </ScrollView>

        <Spinner
            android:id="@+id/orientation_spinner"
    <Button
        android:id="@+id/print_button"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
            android:layout_marginLeft="12dip"
            android:layout_marginRight="12dip"
            android:layout_row="9"
            android:layout_column="1"
            android:minWidth="150dip">
        </Spinner>

    </GridLayout>
        android:padding="0dip"
        android:text="@string/print_button"
        android:background="?android:attr/selectableItemBackground">
    </Button>

</ScrollView>
</LinearLayout>
+48 −0
Original line number Diff line number Diff line
<?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="match_parent"
    android:layout_height="wrap_content"
    android:paddingLeft="8dip"
    android:paddingRight="8dip"
    android:minHeight="?android:attr/listPreferredItemHeightSmall"
    android:orientation="vertical"
    android:gravity="center_vertical">

    <TextView
        android:id="@+id/title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:singleLine="true"
        android:ellipsize="end"
        android:textIsSelectable="false">
    </TextView>

    <TextView
        android:id="@+id/subtitle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:singleLine="true"
        android:ellipsize="end"
        android:textIsSelectable="false"
        android:visibility="gone">

    </TextView>

</LinearLayout>
+12 −6
Original line number Diff line number Diff line
@@ -13,9 +13,15 @@
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@+id/print_button"
          android:title="@string/print_button"
          android:showAsAction="ifRoom">
    </item>
</menu>

<resources>

    <integer name="page_option_value_all">1</integer>
    <integer name="page_option_value_page_range">2</integer>

    <integer-array name="page_options_values" translatable="false">
        <item>@integer/page_option_value_all</item>
        <item>@integer/page_option_value_page_range</item>
    </integer-array>

</resources>
 No newline at end of file
Loading