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

Commit 4dfd70a7 authored by Philip P. Moltmann's avatar Philip P. Moltmann Committed by android-build-merger
Browse files

Merge "Make sure to update the selected pages when needed in the right order."...

Merge "Make sure to update the selected pages when needed in the right order." into nyc-dev am: a97415b0
am: fb580c22

* commit 'fb580c22':
  Make sure to update the selected pages when needed in the right order.

Change-Id: I3d1c0d3c284453680ef1bc73f12a2cd4d90c4594
parents f8ff48d3 fb580c22
Loading
Loading
Loading
Loading
+20 −14
Original line number Diff line number Diff line
@@ -1169,6 +1169,18 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
        doFinish();
    }

    /**
     * Update the selected pages from the text field.
     */
    private void updateSelectedPagesFromTextField() {
        PageRange[] selectedPages = computeSelectedPages();
        if (!Arrays.equals(mSelectedPages, selectedPages)) {
            mSelectedPages = selectedPages;
            // Update preview.
            updatePrintPreviewController(false);
        }
    }

    private void confirmPrint() {
        setState(STATE_PRINT_CONFIRMED);

@@ -1178,14 +1190,10 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
        addCurrentPrinterToHistory();
        setUserPrinted();

        PageRange[] selectedPages = computeSelectedPages();
        if (!Arrays.equals(mSelectedPages, selectedPages)) {
            mSelectedPages = selectedPages;
            // Update preview.
            updatePrintPreviewController(false);
        }

        // updateSelectedPagesFromTextField migth update the preview, hence apply the preview first
        updateSelectedPagesFromPreview();
        updateSelectedPagesFromTextField();

        mPrintPreviewController.closeOptions();

        if (canUpdateDocument()) {
@@ -1485,6 +1493,10 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
                    cancelPrint();
                }
            } else if (view == mMoreOptionsButton) {
                // The selected pages is only applied once the user leaves the text field. A click
                // on this button, does not count as leaving.
                updateSelectedPagesFromTextField();

                if (mCurrentPrinter != null) {
                    startAdvancedPrintOptionsActivity(mCurrentPrinter);
                }
@@ -2774,13 +2786,7 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
            }

            if (view == mPageRangeEditText && !hasFocus) {
                PageRange[] selectedPages = computeSelectedPages();
                if (selectedPages != null && !Arrays.equals(mSelectedPages, selectedPages)) {
                    mSelectedPages = selectedPages;

                    // Update preview.
                    updatePrintPreviewController(false);
                }
                updateSelectedPagesFromTextField();
            }
        }
    }