java.lang.Object | |||||
↳ | android.view.View | ||||
↳ | android.view.ViewGroup | ||||
↳ | android.widget.FrameLayout | ||||
↳ | com.pspdfkit.internal.views.utils.DocumentListenerFrameLayout | ||||
↳ | com.pspdfkit.ui.search.PdfSearchViewInline |
Search view to be placed in the action bar of a AppCompatActivity.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | INLINE_SEARCH_SHOW_DELAY | Delay for showing the inline search after touching the action. | |||||||||
String | LOG_TAG | ||||||||||
int | SEARCH_DELAY | Delay waited after a call to performSearch(String) before starting the search. |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
protected int | currentPage | Tracks current page of the document. | |||||||||
protected PdfDocument | document | ||||||||||
protected EditText | inputField | ||||||||||
protected boolean | isDisplayed | ||||||||||
protected final OnVisibilityChangedListenerManager | listeners | ||||||||||
protected Disposable | searchInProgress |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
PdfSearchViewInline(Context context) | |||||||||||
PdfSearchViewInline(Context context, AttributeSet attrs) |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
addOnVisibilityChangedListener(OnVisibilityChangedListener listener)
Adds a new listener for visibility changes.
| ||||||||||
void |
clearDocument()
Called by the activity when the view should unbind the previously set document.
| ||||||||||
void |
clearOnVisibilityChangedListeners()
Removes all previously registered visibility change listeners.
| ||||||||||
final void |
clearSearch()
Clears the search input field as well as any previously collected search results.
| ||||||||||
int |
getBackIconColorTint()
Returns the icon color for the back icon.
| ||||||||||
int |
getHintTextColor()
Returns hint text color for the inline search text input field.
| ||||||||||
Integer |
getMaxSearchResults()
Returns the maximum count of search results,
null if not set, or SearchConfiguration#UNLIMITED_SEARCH_RESULTS if limiting is turned off. | ||||||||||
int |
getNavigationTextColor()
Returns the text color for the navigation text (that states the current displayed result).
| ||||||||||
int |
getNextIcon()
Returns next search result button icon.
| ||||||||||
int |
getNextIconColorTint()
Returns the icon color for the next search result icon.
| ||||||||||
PSPDFKitViews.Type |
getPSPDFViewType()
Returns the current type of this view.
| ||||||||||
int |
getPrevIcon()
Returns previous search result button icon.
| ||||||||||
int |
getPrevIconColorTint()
Returns the icon color for the previous search result icon.
| ||||||||||
final List<SearchResult> |
getSearchResults()
Returns the current list of search results (may be empty if there are no search hits or
search still in progress), or
null if no search was performed. | ||||||||||
int |
getSnippetLength()
Returns the number of preview characters extracted with every search result.
| ||||||||||
int |
getStartSearchChars()
Returns the number of characters that need to be entered for the search to start.
| ||||||||||
int |
getTextColor()
Returns text color for the inline search text input field.
| ||||||||||
void |
hide()
Hides the view in the parent.
| ||||||||||
boolean |
isDisplayed()
Called when the activity needs to know the visibility of this view.
| ||||||||||
boolean |
isStartSearchOnCurrentPage()
Returns whether the search should start on the current page or not.
| ||||||||||
void |
onMoreSearchResults(List<SearchResult> results)
Called when another chunk of search results is ready.
| ||||||||||
void |
onPageChanged(PdfDocument document, int pageIndex)
Called when user scrolled to a new page.
| ||||||||||
void |
onSearchCanceled()
Called when search has been cancelled.
| ||||||||||
void |
onSearchComplete()
Called when searching has finished.
| ||||||||||
void |
onSearchError(Throwable ex)
Called in case of an error that prevented searching the document.
| ||||||||||
void |
onSearchStarted(String query)
Called when a fresh search has been started.
| ||||||||||
boolean | onTouchEvent(MotionEvent event) | ||||||||||
final void |
performSearch(String searchQuery, EnumSet<CompareOptions> compareOptions)
Performs the search action using the provided extra compare options.
| ||||||||||
final void |
performSearch(String searchQuery)
Performs the search action.
| ||||||||||
void |
removeOnVisibilityChangedListener(OnVisibilityChangedListener listener)
Removes added listener for visibility changes.
| ||||||||||
void |
setBackIconColorTint(int backIconColorTint)
Sets the icon color for the back icon.
| ||||||||||
void |
setDocument(PdfDocument document, PdfConfiguration configuration)
Called when the
document has been loaded and is going to be displayed. | ||||||||||
void |
setHintTextColor(int hintTextColor)
Sets hint text color for the inline search text input field.
| ||||||||||
void |
setInputFieldText(String text, boolean startSearch)
Inserts text in the search input field and optionally starts search.
| ||||||||||
void |
setMaxSearchResults(Integer maxSearchResults)
Sets maximum number of search results.
| ||||||||||
void |
setNavigationTextColor(int navigationTextColor)
Sets the text color for the navigation text (that states the current displayed result).
| ||||||||||
void |
setNextIcon(int nextIcon)
Sets next search result button icon.
| ||||||||||
void |
setNextIconColorTint(int nextIconColorTint)
Sets the icon color for the next search result icon.
| ||||||||||
void |
setPrevIcon(int prevIcon)
Sets previous search result button icon.
| ||||||||||
void |
setPrevIconColorTint(int prevIconColorTint)
Sets the icon color for the previous search result icon.
| ||||||||||
void |
setSearchConfiguration(SearchConfiguration searchConfiguration)
Sets the search configuration to this search view.
| ||||||||||
final void |
setSearchViewListener(PdfSearchView.Listener searchViewListener)
Sets a listener to be notified of search events on this view.
| ||||||||||
void |
setSnippetLength(int snippetLength)
Sets the number of preview characters extracted with every search result.
| ||||||||||
void |
setStartSearchChars(int startSearchChars)
Sets the number of characters that need to be entered for the search to start.
| ||||||||||
void |
setStartSearchOnCurrentPage(boolean startSearchOnCurrentPage)
Sets whether the search should start on the current page or not.
| ||||||||||
void |
setTextColor(int textColor)
Sets text color for the inline search text input field.
| ||||||||||
void |
show()
Shows the view in the parent.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void | applyTheme() | ||||||||||
void |
clearSearchResults()
When called subclasses have to update their UI and remove any previously collected search
results from memory.
| ||||||||||
final void |
dispatchSearchResultSelected(SearchResult selectedSearchResult)
Subclasses may call this method providing a
selectedSearchResult (e.g. | ||||||||||
void | hideKeyboard() | ||||||||||
void | init() | ||||||||||
void | onDetachedFromWindow() | ||||||||||
void | onRestoreInstanceState(Parcelable state) | ||||||||||
Parcelable | onSaveInstanceState() | ||||||||||
void | showKeyboard() |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() |
Delay for showing the inline search after touching the action.
Delay waited after a call to performSearch(String)
before starting the search.
Tracks current page of the document.
Adds a new listener for visibility changes. If the listener has already been added
previously, this method will be a no-op. Adding null
is not allowed, and will result
in an exception.
listener | OnVisibilityChangedListener that should be notified. Must be non-null. |
---|
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.
Removes all previously registered visibility change listeners. To remove just one listener
use removeOnVisibilityChangedListener(OnVisibilityChangedListener)
. Upon calling this method no listeners will be
notified of any changes.
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.
Returns the icon color for the back icon.
Returns hint text color for the inline search text input field.
Returns the maximum count of search results, null
if not set, or SearchConfiguration#UNLIMITED_SEARCH_RESULTS if limiting is turned off.
Returns the text color for the navigation text (that states the current displayed result).
Returns next search result button icon.
Returns the icon color for the next search result icon.
Returns the current type of this view.
PSPDFKitViews.Type
.
Returns previous search result button icon.
Returns the icon color for the previous search result icon.
Returns the current list of search results (may be empty if there are no search hits or
search still in progress), or null
if no search was performed. Note that the returned
list is immutable.
null
.
Returns the number of preview characters extracted with every search result. This defaults to {@value com.pspdfkit.configuration.search.SearchConfiguration#DEFAULT_SNIPPET_LENGTH}.
Returns the number of characters that need to be entered for the search to start. This defaults to {@value com.pspdfkit.configuration.search.SearchConfiguration#DEFAULT_START_SEARCH_CHARS}.
Returns text color for the inline search text input field.
Hides the view in the parent.
Called when the activity needs to know the visibility of this view. Returns true
if this view is visible, otherwise returns false
.
Returns whether the search should start on the current page or not. This defaults to {@value com.pspdfkit.configuration.search.SearchConfiguration#DEFAULT_START_SEARCH_ON_CURRENT_PAGE}.
Called when another chunk of search results is ready.
results | List of search results. |
---|
Called when user scrolled to a new page.
document | Currently opened document. |
---|---|
pageIndex | Page number of new page. |
Called when search has been cancelled.
Called when searching has finished.
Called in case of an error that prevented searching the document.
ex | Throwable containing the search error reason.
|
---|
Called when a fresh search has been started.
query | Search term. |
---|
Performs the search action using the provided extra compare options.
searchQuery | String query to be searched. |
---|---|
compareOptions | Compare options used to perform the search action. When null it will default
the default options specified by SearchOptions.Builder.
|
Performs the search action.
searchQuery | String query to be searched. |
---|
Removes added listener for visibility changes. Upon calling this method the listener
will no longer be notified of any changes. If the listener has not been added, this method
will be a no-op. Adding null
is not allowed,and will result in an exception.
listener | OnVisibilityChangedListener that should be removed. Must be non-null. |
---|
Sets the icon color for the back icon.
backIconColorTint | Tint color for the back icon. |
---|
Called when the document
has been loaded and is going to be displayed. This has
to be called on the main thread.
document | Loaded PdfDocument. |
---|---|
configuration | Containing document and presentation settings. |
Sets hint text color for the inline search text input field.
hintTextColor | Input field hint text color. |
---|
Inserts text in the search input field and optionally starts search.
text | Search text. |
---|---|
startSearch | Hides keyboard and starts search if true .
|
Sets maximum number of search results. Defaults to {@value SearchOptions.Builder#MAX_SEARCH_RESULTS} or {@value SearchOptions.Builder#MAX_SEARCH_RESULTS_LOW_MEM} on devices with little of RAM.
maxSearchResults | Maximum count of search results, null to fallback to default
or SearchConfiguration#UNLIMITED_SEARCH_RESULTS to turn off limiting.
|
---|
Sets the text color for the navigation text (that states the current displayed result).
navigationTextColor | Text color for the navigation text. |
---|
Sets next search result button icon.
nextIcon | Next search result button resource drawable. |
---|
Sets the icon color for the next search result icon.
nextIconColorTint | Tint color for the next search result icon. |
---|
Sets previous search result button icon.
prevIcon | Previous search result button resource drawable. |
---|
Sets the icon color for the previous search result icon.
prevIconColorTint | Tint color for the previous search result icon. |
---|
Sets the search configuration to this search view.
searchConfiguration | Search configuration to be set for this AbstractPdfSearchView .
|
---|
Sets a listener to be notified of search events on this view. May be null
to remove
any previously set listener.
searchViewListener | A Listener which should be notified of search events, or
null to remove a previously registered listener.
|
---|
Sets the number of preview characters extracted with every search result.
snippetLength | Number of characters, defaults to {@value com.pspdfkit.configuration.search.SearchConfiguration#DEFAULT_SNIPPET_LENGTH}. |
---|
Sets the number of characters that need to be entered for the search to start.
startSearchChars | Number of characters needed to trigger the search, defaults to {@value com.pspdfkit.configuration.search.SearchConfiguration#DEFAULT_START_SEARCH_CHARS}. |
---|
Sets whether the search should start on the current page or not. This defaults to {@value com.pspdfkit.configuration.search.SearchConfiguration#DEFAULT_START_SEARCH_ON_CURRENT_PAGE}.
startSearchOnCurrentPage | true to start search on the current page, false to start from the beginning of the document. |
---|
Sets text color for the inline search text input field.
textColor | Input field text color. |
---|
Shows the view in the parent.
When called subclasses have to update their UI and remove any previously collected search results from memory.
Subclasses may call this method providing a selectedSearchResult
(e.g. from user
interaction) so that any registered listener may be notified of this event. May also receive
null
in case the previous selection was cleared.