Class PdfSearchViewLazy

  • All Implemented Interfaces:
    android.graphics.drawable.Drawable.Callback , android.view.KeyEvent.Callback , android.view.ViewManager , android.view.ViewParent , android.view.accessibility.AccessibilityEventSource , com.pspdfkit.listeners.DocumentListener , com.pspdfkit.ui.PSPDFKitViews.PSPDFView , com.pspdfkit.ui.search.PdfSearchView

    
    public class PdfSearchViewLazy
    extends DocumentListenerFrameLayout implements PdfSearchView
                        

    Lazy implementation of the PdfSearchView interface. Initializes once shown or made visible.

    Override createSearchView to return different search implementation.

    • Constructor Detail

      • PdfSearchViewLazy

        PdfSearchViewLazy(Context context)
      • PdfSearchViewLazy

        PdfSearchViewLazy(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
    • Method Detail

      • clearSearch

         void clearSearch()

        Clears the search input field as well as any previously collected search results. This will also cancel any currently running search operation. Implementations of PdfSearchView need to call onSearchCleared on the current listener.

      • setInputFieldText

         void setInputFieldText(@NonNull() String text, boolean startSearch)

        Inserts text in search input field and optionally starts search.

        Parameters:
        text - Search text.
        startSearch - Hides keyboard and starts search if true
      • setSearchViewListener

         void setSearchViewListener(@Nullable() PdfSearchView.Listener searchViewListener)

        Sets a listener to be notified of search events on this view. May be null to remove any previously set listener.

        Parameters:
        searchViewListener - A Listener which should be notified of search events, or null to remove a previously registered listener.
      • setDocument

         void setDocument(@NonNull() PdfDocument document, @NonNull() PdfConfiguration configuration)

        Called when the document has been loaded and is going to be displayed. This has to be called on the main thread.

        Parameters:
        document - Loaded PdfDocument.
        configuration - Containing document and presentation settings.
      • show

         void show()

        Called by the activity when the view should make itself visible.

      • hide

         void hide()

        Called by the activity when the view should hide itself.

      • clearDocument

         void clearDocument()

        Called by the activity when the view should unbind the previously set document. This may be called in low-memory situations or prior to re-binding another document.

      • isDisplayed

         boolean isDisplayed()

        Called when the activity needs to know the visibility of this view. Returns true if this view is visible, otherwise returns false.

      • onPageChanged

         void onPageChanged(@NonNull() PdfDocument document, int pageIndex)

        Called when user scrolled to a new page.

        Parameters:
        document - Currently opened document.
        pageIndex - Page number of new page.
      • createSearchView

        @NonNull() PdfSearchView createSearchView()

        Factory method called when the search view is being prepared for display.

        Returns:

        New instance of the search view that is initialized by this lazy view.