Some test text!
Android / Guides / Overlay
You can visually compare pages. This resolution independent comparison allows you to quickly spot differences between pages.
There are two main ways to integrate the out-of-box UI components in your application:
The DiffActivity
is a standalone component that handles from picking two files to generating the comparison result.
<activity
android:name="com.pdftron.pdf.controls.DiffActivity"
android:configChanges="keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize"
android:theme="@style/PDFTronAppTheme"
android:windowSoftInputMode="adjustPan" />
DiffActivity.open(this);
If you have your own viewer already and only want to show the comparison options in your application, the DiffOptionsDialogFragment
can be used.
public void show(final Context context, FragmentManager fragmentManager, final ArrayList<Uri> files) {
DiffOptionsDialogFragment fragment = DiffOptionsDialogFragment.newInstance(
files.get(0), files.get(1)
);
fragment.setStyle(DialogFragment.STYLE_NORMAL, R.style.PDFTronAppTheme);
fragment.setDiffOptionsDialogListener(new DiffOptionsDialogFragment.DiffOptionsDialogListener() {
@Override
public void onDiffOptionsConfirmed(int color1, int color2, int blendMode) {
compareFiles(context, files, color1, color2, blendMode);
}
});
fragment.show(fragmentManager, DiffOptionsDialogFragment.TAG);
}
where compareFile
is:
private final CompositeDisposable mDisposable = new CompositeDisposable();
private void compareFiles(Context context, ArrayList<Uri> files, int color1, int color2, int blendMode) {
mDisposable.add(DiffUtils.compareFiles(context, files, color1, color2, blendMode)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<Uri>() {
@Override
public void accept(Uri uri) throws Exception {
// do something with the output
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
}
}));
}
AsyncTask
pattern can be used instead of Disposable
pattern if desired.Trial setup questions? Ask experts on Discord
Need other help? Contact Support
Pricing or product questions? Contact Sales