DocumentComparisonDialog

Dialog for visually comparing two versions of a document. This dialog offers a point selection wizard, that will guide users through the process of aligning two documents with each other, so that visual comparison can be performed. Show this dialog by calling show. To make sure the dialog is restored properly across configuration changes, call restore within your activity's onCreate() method.


class MyActivity : FragmentActivity(), ComparisonDialogListener {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        if(savedInstanceState != null) {
            // If this activity is recreated after a configuration change, calling restore() ensures that the document will have the
            // correct callback (this activity) if it was shown before the configuration change. If no dialog was shown, this call is a
            // no-op.
            DocumentComparisonDialogImpl.restore(this, this)
        }
    }

    fun showComparisonDialog() {
       val outputFile = filesDir.resolve("comparison-result.pdf")
       val oldDocument = ComparisonDocument(oldDocumentSource, 0, Color.GREEN)
       val newDocument = ComparisonDocument(newDocumentSource, 0, Color.RED)
       DocumentComparisonDialog.show(this, configuration, oldDocument, newDocument, outputFile, this)
    }

    // ...
}

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
open fun restore(@NonNull fragmentActivity: FragmentActivity, @NonNull listener: ComparisonDialogListener)
Restores the document comparison dialog after a configuration change.
Link copied to clipboard
open fun show(@NonNull fragmentActivity: FragmentActivity, @NonNull configuration: PdfActivityConfiguration, @NonNull oldComparisonDocument: ComparisonDocument, @NonNull newComparisonDocument: ComparisonDocument, @NonNull outputFile: File, @NonNull listener: ComparisonDialogListener)
Shows the document comparison dialog.