Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions app/src/main/java/fr/neamar/kiss/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,11 @@ public boolean onItemLongClick(AdapterView<?> parent, View v, int pos, long id)
}
});

// Display empty list view when having no results
this.adapter.registerDataSetObserver(new DataSetObserver() {
@Override
public void onChanged() {
super.onChanged();
// Display empty list view when having no results
if (adapter.isEmpty()) {
// Display help text when no results available
listContainer.setVisibility(View.GONE);
Expand All @@ -299,8 +299,12 @@ public void onChanged() {
emptyListView.setVisibility(View.GONE);
}

forwarderManager.onDataSetChanged();
// Open the first result if there is only a single result and the preference is set.
if (prefs.getBoolean("search_open_single_result", false) && adapter.getCount() == 1) {
adapter.onClick(0, searchEditText);
}

forwarderManager.onDataSetChanged();
}
});

Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<string name="ui_empty_3_sub">KISS launcher learns from your habits</string>
<string name="contacts_name">Contacts</string>
<string name="contacts_call_on_click">Click to call contacts</string>
<string name="search_open_single_result">Automatically open single result</string>
<string name="search_results_options">Search results</string>
<string name="search_name">Web search providers</string>
<string name="search_provider_toggle">Links to web search providers</string>
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,10 @@
android:title="@string/search_provider_reset" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/misc">
<fr.neamar.kiss.preference.SwitchPreference
android:defaultValue="false"
android:key="search_open_single_result"
android:title="@string/search_open_single_result" />
<fr.neamar.kiss.preference.SwitchPreference
android:defaultValue="false"
android:key="always-default-web-search-on-enter"
Expand Down