@@ -21,6 +21,7 @@ public class SearchConfiguration {
2121 private static final String ARGUMENT_INDEX_INDIVIDUAL_PREFERENCES = "individual_prefs" ;
2222 private static final String ARGUMENT_FUZZY_ENABLED = "fuzzy" ;
2323 private static final String ARGUMENT_HISTORY_ENABLED = "history_enabled" ;
24+ private static final String ARGUMENT_HISTORY_ID = "history_id" ;
2425 private static final String ARGUMENT_SEARCH_BAR_ENABLED = "search_bar_enabled" ;
2526 private static final String ARGUMENT_BREADCRUMBS_ENABLED = "breadcrumbs_enabled" ;
2627 private static final String ARGUMENT_REVEAL_ANIMATION_SETTING = "reveal_anim_setting" ;
@@ -32,6 +33,7 @@ public class SearchConfiguration {
3233 private ArrayList <PreferenceItem > preferencesToIndex = new ArrayList <>();
3334 private ArrayList <String > bannedKeys = new ArrayList <>();
3435 private boolean historyEnabled = true ;
36+ private String historyId = null ;
3537 private boolean breadcrumbsEnabled = false ;
3638 private boolean fuzzySearchEnabled = true ;
3739 private boolean searchBarEnabled = true ;
@@ -85,6 +87,7 @@ private Bundle toBundle() {
8587 arguments .putString (ARGUMENT_TEXT_HINT , textHint );
8688 arguments .putString (ARGUMENT_TEXT_CLEAR_HISTORY , textClearHistory );
8789 arguments .putString (ARGUMENT_TEXT_NO_RESULTS , textNoResults );
90+ arguments .putString (ARGUMENT_HISTORY_ID , historyId );
8891 return arguments ;
8992 }
9093
@@ -100,6 +103,7 @@ static SearchConfiguration fromBundle(Bundle bundle) {
100103 config .textHint = bundle .getString (ARGUMENT_TEXT_HINT );
101104 config .textClearHistory = bundle .getString (ARGUMENT_TEXT_CLEAR_HISTORY );
102105 config .textNoResults = bundle .getString (ARGUMENT_TEXT_NO_RESULTS );
106+ config .historyId = bundle .getString (ARGUMENT_HISTORY_ID );
103107 return config ;
104108 }
105109
@@ -122,6 +126,15 @@ public void setHistoryEnabled(boolean historyEnabled) {
122126 this .historyEnabled = historyEnabled ;
123127 }
124128
129+ /**
130+ * Sets the id to use for saving the history. Preference screens with the same history id will share the same
131+ * history. The default id is null (no id).
132+ * @param historyId the history id
133+ */
134+ public void setHistoryId (String historyId ) {
135+ this .historyId = historyId ;
136+ }
137+
125138 /**
126139 * Allow to enable and disable fuzzy searching. Default is true
127140 * @param fuzzySearchEnabled True if search should be fuzzy
@@ -241,6 +254,10 @@ boolean isHistoryEnabled() {
241254 return historyEnabled ;
242255 }
243256
257+ String getHistoryId () {
258+ return historyId ;
259+ }
260+
244261 boolean isBreadcrumbsEnabled () {
245262 return breadcrumbsEnabled ;
246263 }
0 commit comments