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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interface
PdfSearchViewLazy.OnViewReadyListener
Listener notified once the lazy view is initialized.
-
Constructor Summary
Constructors Constructor Description PdfSearchViewLazy(Context context)
PdfSearchViewLazy(Context context, AttributeSet attrs)
PdfSearchViewLazy(Context context, AttributeSet attrs, int defStyleAttr)
PdfSearchViewLazy(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
-
Method Summary
Modifier and Type Method Description void
clearSearch()
Clears the search input field as well as any previously collected search results. void
setInputFieldText(@NonNull() String text, boolean startSearch)
Inserts text in search input field and optionally starts search. void
setSearchViewListener(@Nullable() PdfSearchView.Listener searchViewListener)
Sets a listener to be notified of search events on this view. void
setSearchConfiguration(@NonNull() SearchConfiguration searchConfiguration)
Config options for search SearchConfiguration
getSearchConfiguration()
Config options for search void
setDocument(@NonNull() PdfDocument document, @NonNull() PdfConfiguration configuration)
Called when the document
has been loaded and is going to be displayed.void
addOnVisibilityChangedListener(@NonNull() OnVisibilityChangedListener listener)
Register a listener
that would like to receive visibility change events.void
removeOnVisibilityChangedListener(@NonNull() OnVisibilityChangedListener listener)
Unregister a previously registered listener
that no longer wants to receive visibility change events.void
show()
Called by the activity when the view should make itself visible. void
hide()
Called by the activity when the view should hide itself. void
clearDocument()
Called by the activity when the view should unbind the previously set document. boolean
isDisplayed()
Called when the activity needs to know the visibility of this view. boolean
isShown()
PSPDFKitViews.Type
getPSPDFViewType()
Returns the current type of this view. void
onPageChanged(@NonNull() PdfDocument document, int pageIndex)
Called when user scrolled to a new page. void
setVisibility(int visibility)
void
setOnViewReadyListener(@Nullable() PdfSearchViewLazy.OnViewReadyListener listener)
Sets listener that will get notified once the lazy view is ready. synchronized PdfSearchView
prepareForDisplay()
Prepares the lazy initialized search view for display. PdfSearchView
createSearchView()
Factory method called when the search view is being prepared for display. PdfSearchView
getSearchView()
Returns the active search view (if initialized). -
-
Constructor Detail
-
PdfSearchViewLazy
PdfSearchViewLazy(Context context)
-
PdfSearchViewLazy
PdfSearchViewLazy(Context context, AttributeSet attrs)
-
PdfSearchViewLazy
PdfSearchViewLazy(Context context, AttributeSet attrs, int defStyleAttr)
-
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 Listener.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 iftrue
-
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, ornull
to remove a previously registered listener.
-
setSearchConfiguration
void setSearchConfiguration(@NonNull() SearchConfiguration searchConfiguration)
Config options for search
-
getSearchConfiguration
@NonNull() SearchConfiguration getSearchConfiguration()
Config options for search
-
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.
-
addOnVisibilityChangedListener
void addOnVisibilityChangedListener(@NonNull() OnVisibilityChangedListener listener)
Register a
listener
that would like to receive visibility change events. Whenever the visibility of a managed PSPDFView changes, all registered listeners will be notified.- Parameters:
listener
- Listener to be added.
-
removeOnVisibilityChangedListener
void removeOnVisibilityChangedListener(@NonNull() OnVisibilityChangedListener listener)
Unregister a previously registered
listener
that no longer wants to receive visibility change events.- Parameters:
listener
- Listener to be removed.
-
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 returnsfalse
.
-
isShown
boolean isShown()
-
getPSPDFViewType
@NonNull() PSPDFKitViews.Type getPSPDFViewType()
Returns the current type of this view.
- Returns:
Any of Type.
-
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.
-
setVisibility
void setVisibility(int visibility)
-
setOnViewReadyListener
void setOnViewReadyListener(@Nullable() PdfSearchViewLazy.OnViewReadyListener listener)
Sets listener that will get notified once the lazy view is ready.
- Parameters:
listener
- Listener to register ornull
to unregister existing listener.
-
prepareForDisplay
@NonNull() synchronized PdfSearchView prepareForDisplay()
Prepares the lazy initialized search view for display.
- Returns:
The created instance of PdfSearchView.
-
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.
-
getSearchView
@NonNull() PdfSearchView getSearchView()
Returns the active search view (if initialized).
-
-
-
-