Clear search history (#173)
* Long press on magnifying glass to clear search history * Long press on magnifying glass to clear search history * Long press on magnifying glass to clear search history * Long press on magnifying glass to clear search history * Long press on magnifying glass to clear search history * Long press on magnifying glass to clear search history
This commit is contained in:
parent
ceb2f44beb
commit
ee64df7fc9
@ -19,8 +19,10 @@
|
|||||||
package net.schueller.peertube.activity;
|
package net.schueller.peertube.activity;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
|
import android.app.AlertDialog;
|
||||||
import android.app.SearchManager;
|
import android.app.SearchManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
@ -146,6 +148,26 @@ public class VideoListActivity extends CommonActivity {
|
|||||||
searchView.setIconifiedByDefault(false); // Do not iconify the widget; expand it by default
|
searchView.setIconifiedByDefault(false); // Do not iconify the widget; expand it by default
|
||||||
searchView.setQueryRefinementEnabled(true);
|
searchView.setQueryRefinementEnabled(true);
|
||||||
|
|
||||||
|
searchMenuItem.getActionView().setOnLongClickListener(new View.OnLongClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onLongClick(View v) {
|
||||||
|
new AlertDialog.Builder(VideoListActivity.this)
|
||||||
|
.setTitle(getString(R.string.clear_search_history))
|
||||||
|
.setMessage(getString(R.string.clear_search_history_prompt))
|
||||||
|
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
SearchRecentSuggestions suggestions = new SearchRecentSuggestions(getApplicationContext(),
|
||||||
|
SearchSuggestionsProvider.AUTHORITY,
|
||||||
|
SearchSuggestionsProvider.MODE);
|
||||||
|
suggestions.clearHistory();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(android.R.string.no, null)
|
||||||
|
.setIcon(android.R.drawable.ic_dialog_alert)
|
||||||
|
.show();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
searchMenuItem.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
|
searchMenuItem.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemActionExpand(MenuItem menuItem) {
|
public boolean onMenuItemActionExpand(MenuItem menuItem) {
|
||||||
|
@ -65,6 +65,8 @@
|
|||||||
|
|
||||||
<string name="pref_language_app">Application Language</string>
|
<string name="pref_language_app">Application Language</string>
|
||||||
<string name="pref_description_language_app">Select language for application interface. Restart app for change to take effect.</string>
|
<string name="pref_description_language_app">Select language for application interface. Restart app for change to take effect.</string>
|
||||||
|
<string name="clear_search_history">Clear Search History</string>
|
||||||
|
<string name="clear_search_history_prompt">Do you want to permanently delete the search history?</string>
|
||||||
<!-- languages -->
|
<!-- languages -->
|
||||||
<string name="ab">Abkhazian</string>
|
<string name="ab">Abkhazian</string>
|
||||||
<string name="aa">Afar</string>
|
<string name="aa">Afar</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user