Skip to content

Commit

Permalink
Change default of Search In to BOTH
Browse files Browse the repository at this point in the history
Signed-off-by: Marcus Nilsson <[email protected]>
  • Loading branch information
mkanilsson committed Sep 22, 2023
1 parent b5b2e38 commit afc04e7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private static String getFeedSQLStatement(final long idFeed,
final DatabaseConnectionOrm dbConn,
final SharedPreferences mPrefs) {
String sql = "";
String searchIn = mPrefs.getString(SettingsActivity.SP_SEARCH_IN,"0");
String searchIn = mPrefs.getString(SettingsActivity.SP_SEARCH_IN, SEARCH_IN_BOTH);
if(searchIn.equals(SEARCH_IN_TITLE)) {
sql = dbConn.getAllItemsIdsForFeedSQLFilteredByTitle(idFeed, false, false, sortDirection, searchString);
} else if(searchIn.equals(SEARCH_IN_BODY)) {
Expand All @@ -63,7 +63,7 @@ private static String getFolderSQLStatement(final long ID_FOLDER,
final DatabaseConnectionOrm dbConn,
final SharedPreferences mPrefs) {
String sql = "";
String searchIn = mPrefs.getString(SettingsActivity.SP_SEARCH_IN,"0");
String searchIn = mPrefs.getString(SettingsActivity.SP_SEARCH_IN, SEARCH_IN_BOTH);
if(searchIn.equals(SEARCH_IN_TITLE)) {
sql = dbConn.getAllItemsIdsForFolderSQLSearch(ID_FOLDER, sortDirection, Collections.singletonList(RssItemDao.Properties.Title.columnName), searchString);
} else if(searchIn.equals(SEARCH_IN_BODY)) {
Expand Down
5 changes: 3 additions & 2 deletions News-Android-App/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,15 @@
<string name="pref_general_search_in_both">Both</string>

<string-array name="pref_general_search_in" translatable="false">
<item>@string/pref_general_search_in_both</item>
<item>@string/pref_general_search_in_title</item>
<item>@string/pref_general_search_in_body</item>
<item>@string/pref_general_search_in_both</item>
</string-array>
<string-array name="pref_general_search_in_values" translatable="false">
<!-- The ordering here is weird as to not break users current setting -->
<item>2</item>
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>


Expand Down
7 changes: 4 additions & 3 deletions News-Android-App/src/main/res/xml/pref_general.xml
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,10 @@
android:key="sp_sort_order"
android:title="@string/pref_title_general_sort_order"
app:iconSpaceReserved="false"/>


<!-- Default is BOTH(2) -->
<ListPreference
android:defaultValue="0"
android:defaultValue="2"
android:entries="@array/pref_general_search_in"
android:entryValues="@array/pref_general_search_in_values"
android:key="sp_search_in"
Expand All @@ -140,4 +141,4 @@

</PreferenceCategory>

</androidx.preference.PreferenceScreen>
</androidx.preference.PreferenceScreen>

0 comments on commit afc04e7

Please sign in to comment.