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

Commit 4959caf1 authored by Philip P. Moltmann's avatar Philip P. Moltmann
Browse files

Allow the PDF Printer to "print" non-locale-default paper sizes.

The MediaSizeComparator already sorts the media sizes correctly.

Bug: 12675943
Change-Id: I6fa4b1a8885a60704bc175ec849ea483ffb4bcd8
parent 17fefe5b
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.Log;

import com.android.internal.R;
@@ -872,6 +873,23 @@ public final class PrintAttributes implements Parcelable {
            mPackageName = null;
        }

        /**
         * Get the Id of all predefined media sizes beside the {@link #UNKNOWN_PORTRAIT} and
         * {@link #UNKNOWN_LANDSCAPE}.
         *
         * @return List of all predefined media sizes
         *
         * @hide
         */
        public static @NonNull ArraySet<MediaSize> getAllPredefinedSizes() {
            ArraySet<MediaSize> definedMediaSizes = new ArraySet<>(sIdToMediaSizeMap.values());

            definedMediaSizes.remove(UNKNOWN_PORTRAIT);
            definedMediaSizes.remove(UNKNOWN_LANDSCAPE);

            return definedMediaSizes;
        }

        /** @hide */
        public MediaSize(String id, String label, String packageName,
                int widthMils, int heightMils, int labelResId) {
+0 −33
Original line number Diff line number Diff line
<?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.
-->
<resources>

    <string-array name="pdf_printer_media_sizes" translatable="false">
        <item>NA_LETTER</item>
        <item>NA_GOVT_LETTER</item>
        <item>NA_LEGAL</item>
        <item>NA_JUNIOR_LEGAL</item>
        <item>NA_LEDGER</item>
        <item>NA_TABLOID</item>
        <item>NA_INDEX_3X5</item>
        <item>NA_INDEX_4X6</item>
        <item>NA_INDEX_5X8</item>
        <item>NA_MONARCH</item>
        <item>NA_QUARTO</item>
        <item>NA_FOOLSCAP</item>
    </string-array>

</resources>
+0 −33
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.
-->
<resources>

    <string-array name="pdf_printer_media_sizes" translatable="false">
        <item>NA_LETTER</item>
        <item>NA_GOVT_LETTER</item>
        <item>NA_LEGAL</item>
        <item>NA_JUNIOR_LEGAL</item>
        <item>NA_LEDGER</item>
        <item>NA_TABLOID</item>
        <item>NA_INDEX_3X5</item>
        <item>NA_INDEX_4X6</item>
        <item>NA_INDEX_5X8</item>
        <item>NA_MONARCH</item>
        <item>NA_QUARTO</item>
        <item>NA_FOOLSCAP</item>
    </string-array>

</resources>
+0 −33
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.
-->
<resources>

    <string-array name="pdf_printer_media_sizes" translatable="false">
        <item>NA_LETTER</item>
        <item>NA_GOVT_LETTER</item>
        <item>NA_LEGAL</item>
        <item>NA_JUNIOR_LEGAL</item>
        <item>NA_LEDGER</item>
        <item>NA_TABLOID</item>
        <item>NA_INDEX_3X5</item>
        <item>NA_INDEX_4X6</item>
        <item>NA_INDEX_5X8</item>
        <item>NA_MONARCH</item>
        <item>NA_QUARTO</item>
        <item>NA_FOOLSCAP</item>
    </string-array>

</resources>
+0 −33
Original line number Diff line number Diff line
<?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.
-->
<resources>

    <string-array name="pdf_printer_media_sizes" translatable="false">
        <item>NA_LETTER</item>
        <item>NA_GOVT_LETTER</item>
        <item>NA_LEGAL</item>
        <item>NA_JUNIOR_LEGAL</item>
        <item>NA_LEDGER</item>
        <item>NA_TABLOID</item>
        <item>NA_INDEX_3X5</item>
        <item>NA_INDEX_4X6</item>
        <item>NA_INDEX_5X8</item>
        <item>NA_MONARCH</item>
        <item>NA_QUARTO</item>
        <item>NA_FOOLSCAP</item>
    </string-array>

</resources>
Loading