Merge pull request #2 from DevHugo/verifie_formulaire_recherche

La fenetre ne se ferme plus si on affiche rien
This commit is contained in:
Amine Bou 2015-06-13 17:18:36 +02:00
commit 21ed783c6e

View File

@ -34,15 +34,16 @@ public class ShopSearch extends OptionsActivity {
loading = (RelativeLayout) findViewById(R.id.loading); loading = (RelativeLayout) findViewById(R.id.loading);
Button searchButton = (Button) findViewById(R.id.searchAction); Button searchButton = (Button) findViewById(R.id.searchAction);
// @todo form validation (empty ...)
searchButton.setOnClickListener(new View.OnClickListener() { searchButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (name.getText().toString().trim().length() > 0 && location.getText().toString().trim().length() > 0) {
loading.setVisibility(View.VISIBLE); loading.setVisibility(View.VISIBLE);
SearchTask s = new SearchTask(); SearchTask s = new SearchTask();
s.execute(Utils.generateUrlForTextLocation(name.getText().toString(), location.getText().toString())); s.execute(Utils.generateUrlForTextLocation(name.getText().toString(), location.getText().toString()));
} }
}
}); });
findViewById(R.id.gpsAction).setOnClickListener(new View.OnClickListener() { findViewById(R.id.gpsAction).setOnClickListener(new View.OnClickListener() {