mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-10 07:48:30 -04:00
Default and remove preference for fulltext search
This commit is contained in:
parent
b9c009a2e0
commit
45d9e2a730
@ -76,22 +76,8 @@ public class AutoCompleteAdapter extends ArrayAdapter<String> implements Filtera
|
|||||||
|
|
||||||
if (constraint != null) {
|
if (constraint != null) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
/* Get search request */
|
|
||||||
final String query = constraint.toString();
|
final String query = constraint.toString();
|
||||||
|
|
||||||
/* Fulltex search */
|
|
||||||
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
|
||||||
if (sharedPreferences.getBoolean(KiwixMobileActivity.PREF_FULL_TEXT_SEARCH, false)) {
|
|
||||||
String[] results = jniKiwix.indexedQuery(query, 200).split("\n");
|
|
||||||
for (String result : results) {
|
|
||||||
if (!result.trim().isEmpty())
|
|
||||||
data.add(result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Suggestion search if no fulltext results */
|
|
||||||
if (data.size() == 0) {
|
|
||||||
ZimContentProvider.searchSuggestions(query, 200);
|
ZimContentProvider.searchSuggestions(query, 200);
|
||||||
String suggestion;
|
String suggestion;
|
||||||
String suggestionUrl;
|
String suggestionUrl;
|
||||||
@ -103,7 +89,6 @@ public class AutoCompleteAdapter extends ArrayAdapter<String> implements Filtera
|
|||||||
data.add(suggestion);
|
data.add(suggestion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -46,12 +46,6 @@
|
|||||||
android:title="@string/pref_newtab_background_title"
|
android:title="@string/pref_newtab_background_title"
|
||||||
android:summary="@string/pref_newtab_background_summary"/>
|
android:summary="@string/pref_newtab_background_summary"/>
|
||||||
|
|
||||||
<org.kiwix.kiwixmobile.settings.CustomSwitchPreference
|
|
||||||
android:defaultValue="false"
|
|
||||||
android:key="pref_full_text_search"
|
|
||||||
android:title="@string/pref_full_text_search_title"
|
|
||||||
android:summary="@string/pref_full_text_search_summary"/>
|
|
||||||
|
|
||||||
<org.kiwix.kiwixmobile.settings.CustomSwitchPreference
|
<org.kiwix.kiwixmobile.settings.CustomSwitchPreference
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="pref_wifi_only"
|
android:key="pref_wifi_only"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user