set focus on search field and enable keyboard

This commit is contained in:
Koen Rabaey 2014-05-25 11:58:46 +02:00
parent ecc07567d1
commit fd7aa56587

View file

@ -261,6 +261,14 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
public void onTextChanged(CharSequence s, int start, int before, int count) { public void onTextChanged(CharSequence s, int start, int before, int count) {
} }
}); });
searchFilter.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
}
}
});
addFooterView(); addFooterView();
amenityAdapter = new AmenityAdapter(new ArrayList<Amenity>()); amenityAdapter = new AmenityAdapter(new ArrayList<Amenity>());
setListAdapter(amenityAdapter); setListAdapter(amenityAdapter);
@ -364,6 +372,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
} }
app.getLocationProvider().addCompassListener(this); app.getLocationProvider().addCompassListener(this);
app.getLocationProvider().registerOrUnregisterCompassListener(true); app.getLocationProvider().registerOrUnregisterCompassListener(true);
searchFilter.requestFocus();
} }