limit search to API level 2

This commit is contained in:
Andrew Dolgov 2012-01-19 13:14:54 +03:00
parent 60128ffe2f
commit 2a6fbbb9a3

View File

@ -1208,15 +1208,15 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
MenuItem search = m_menu.findItem(R.id.search); MenuItem search = m_menu.findItem(R.id.search);
if (search != null && !m_compatMode) { search.setEnabled(m_apiLevel >= 2);
if (!m_compatMode) {
SearchView searchView = (SearchView) search.getActionView(); SearchView searchView = (SearchView) search.getActionView();
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
private String query = ""; private String query = "";
@Override @Override
public boolean onQueryTextSubmit(String query) { public boolean onQueryTextSubmit(String query) {
Log.d(TAG, "Search/onQueryTextSubmit");
HeadlinesFragment frag = (HeadlinesFragment) getSupportFragmentManager() HeadlinesFragment frag = (HeadlinesFragment) getSupportFragmentManager()
.findFragmentById(R.id.headlines_fragment); .findFragmentById(R.id.headlines_fragment);
@ -1230,10 +1230,6 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
@Override @Override
public boolean onQueryTextChange(String newText) { public boolean onQueryTextChange(String newText) {
// TODO Auto-generated method stub
Log.d(TAG, "Search/onQueryTextChange: " + newText);
if (newText.equals("") && !newText.equals(this.query)) { if (newText.equals("") && !newText.equals(this.query)) {
HeadlinesFragment frag = (HeadlinesFragment) getSupportFragmentManager() HeadlinesFragment frag = (HeadlinesFragment) getSupportFragmentManager()
.findFragmentById(R.id.headlines_fragment); .findFragmentById(R.id.headlines_fragment);