public static Object newOnCloseListener(final OnCloseListenerCompatBridge listener) { return new OnCloseListener() { public boolean onClose() { return listener.onClose(); } }; }
public static Object newOnCloseListener(final OnCloseListenerCompatBridge listener) { return new OnCloseListener() { @Override public boolean onClose() { return listener.onClose(); } }; }
@Override public MenuItem makeSearchMenuEntry(Menu menu) { MenuItem item = menu.add("Search"); searchView = new SearchView(diskusage); origSearchBackground = searchView.getBackground(); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); item.setIcon(android.R.drawable.ic_search_category_default); item.setActionView(searchView); if (searchPattern != null) { searchView.setIconified(false); searchView.setQuery(searchPattern, false); } searchView.setOnCloseListener(new OnCloseListener() { @Override public boolean onClose() { Log.d("diskusage", "search closed"); searchPattern = null; diskusage.applyPatternNewRoot(masterRoot, null); return false; } }); searchView.setOnQueryTextListener(new OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { onQueryTextChange(query); return false; } @Override public boolean onQueryTextChange(String newText) { Log.d("diskusage", "search query changed to: " + newText); searchPattern = newText; applyPattern(searchPattern); return true; } }); return item; }
public static void setOnCloseListener(Object searchView, Object listener) { ((SearchView) searchView).setOnCloseListener((OnCloseListener) listener); }