-
public class SearchConfiguration
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classSearchConfiguration.SearchIndexItemAdds a given R.xml resource to the search index
-
Field Summary
Fields Modifier and Type Field Description private booleanhistoryEnabledprivate StringhistoryIdprivate booleanbreadcrumbsEnabledprivate booleanfuzzySearchEnabledprivate booleansearchBarEnabledprivate AppCompatActivityactivityprivate StringtextClearHistoryprivate StringtextNoResultsprivate StringtextHintprivate StringtextClearInputprivate StringtextMore
-
Constructor Summary
Constructors Constructor Description SearchConfiguration(AppCompatActivity activity)Creates a new search configuration
-
Method Summary
Modifier and Type Method Description voidsetHistoryEnabled(boolean historyEnabled)Show a history of recent search terms if nothing was typed yet. StringgetHistoryId()voidsetHistoryId(String historyId)Sets the id to use for saving the history. voidsetBreadcrumbsEnabled(boolean breadcrumbsEnabled)Show breadcrumbs in the list of search results, containing ofthe prefix given in addResourceFileToIndex, PreferenceCategory and PreferenceScreen. voidsetFuzzySearchEnabled(boolean fuzzySearchEnabled)Allow to enable and disable fuzzy searching. voidsetSearchBarEnabled(boolean searchBarEnabled)Show the search bar above the list. voidsetActivity(@NonNull() AppCompatActivity activity)Sets the current activity that also receives callbacks StringgetTextClearHistory()voidsetTextClearHistory(String textClearHistory)StringgetTextNoResults()voidsetTextNoResults(String textNoResults)StringgetTextHint()voidsetTextHint(String textHint)StringgetTextClearInput()voidsetTextClearInput(String textClearInput)StringgetTextMore()voidsetTextMore(String textMore)SearchPreferenceFragmentshowSearchFragment()Shows the fragment voidsetFragmentContainerViewId(@IdRes() int containerResId)Sets the container to use when loading the fragment voiduseAnimation(int centerX, int centerY, int width, int height, int colorAccent)Display a reveal animation SearchConfiguration.SearchIndexItemindex(@XmlRes() int resId)Adds a new file to the index PreferenceItemindexItem()Indexes a single preference PreferenceItemindexItem(@NonNull() Preference preference)Indexes a single android preference voidignorePreference(@NonNull() String key)-
-
Constructor Detail
-
SearchConfiguration
SearchConfiguration(AppCompatActivity activity)
Creates a new search configuration- Parameters:
activity- The Activity that receives callbacks.
-
-
Method Detail
-
setHistoryEnabled
void setHistoryEnabled(boolean historyEnabled)
Show a history of recent search terms if nothing was typed yet. Default is true
- Parameters:
historyEnabled- True if history should be enabled
-
getHistoryId
String getHistoryId()
-
setHistoryId
void setHistoryId(String historyId)
Sets the id to use for saving the history. Preference screens with the same history id will share the samehistory. The default id is null (no id).
- Parameters:
historyId- the history id
-
setBreadcrumbsEnabled
void setBreadcrumbsEnabled(boolean breadcrumbsEnabled)
Show breadcrumbs in the list of search results, containing ofthe prefix given in addResourceFileToIndex, PreferenceCategory and PreferenceScreen.Default is false
- Parameters:
breadcrumbsEnabled- True if breadcrumbs should be shown
-
setFuzzySearchEnabled
void setFuzzySearchEnabled(boolean fuzzySearchEnabled)
Allow to enable and disable fuzzy searching. Default is true
- Parameters:
fuzzySearchEnabled- True if search should be fuzzy
-
setSearchBarEnabled
void setSearchBarEnabled(boolean searchBarEnabled)
Show the search bar above the list. When setting this to false, you have to use {@see SearchPreferenceFragment#setSearchTerm(String) setSearchTerm} insteadDefault is true
- Parameters:
searchBarEnabled- True if search bar should be shown
-
setActivity
void setActivity(@NonNull() AppCompatActivity activity)
Sets the current activity that also receives callbacks
- Parameters:
activity- The Activity that receives callbacks.
-
getTextClearHistory
String getTextClearHistory()
-
setTextClearHistory
void setTextClearHistory(String textClearHistory)
-
getTextNoResults
String getTextNoResults()
-
setTextNoResults
void setTextNoResults(String textNoResults)
-
getTextHint
String getTextHint()
-
setTextHint
void setTextHint(String textHint)
-
getTextClearInput
String getTextClearInput()
-
setTextClearInput
void setTextClearInput(String textClearInput)
-
getTextMore
String getTextMore()
-
setTextMore
void setTextMore(String textMore)
-
showSearchFragment
SearchPreferenceFragment showSearchFragment()
Shows the fragment
-
setFragmentContainerViewId
void setFragmentContainerViewId(@IdRes() int containerResId)
Sets the container to use when loading the fragment
- Parameters:
containerResId- Resource id of the container
-
useAnimation
void useAnimation(int centerX, int centerY, int width, int height, int colorAccent)
Display a reveal animation
- Parameters:
centerX- Origin of the reveal animationcenterY- Origin of the reveal animationwidth- Size of the main containerheight- Size of the main containercolorAccent- Accent color to use
-
index
SearchConfiguration.SearchIndexItem index(@XmlRes() int resId)
Adds a new file to the index
- Parameters:
resId- The preference file to index
-
indexItem
PreferenceItem indexItem()
Indexes a single preference
-
indexItem
PreferenceItem indexItem(@NonNull() Preference preference)
Indexes a single android preference
- Parameters:
preference- to get its key, summary, title and entries
-
ignorePreference
void ignorePreference(@NonNull() String key)
- Parameters:
key- of the preference to be ignored
-
-
-
-