Skip to content

Commit

Permalink
bugfix in questions!
Browse files Browse the repository at this point in the history
  • Loading branch information
northOfThule committed May 17, 2011
1 parent af97992 commit 41dcf32
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions src/org/pathpal/GMapsActivity.java
Expand Up @@ -217,17 +217,16 @@ private void updatePath(){
}

/**
* Checks if the directionForm till has some unanswered question.
* Checks if the directionForm still has some unanswered question.
* If so, show a dialog where the user can answer a question
*/
public void questionHandler(){
// if there are questions then take care of them
if(directionForm.questions().size()>0){
System.out.println("QUESTIONS: " + directionForm.questions().size());
activeQuestion = directionForm.questions().get(0); // select a question as active
removeDialog(QUESTION_ID); // clean up the dialog first
showDialog(QUESTION_ID); // then show the dialog
}
}
}

@Override
Expand All @@ -242,18 +241,14 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {

// Get your current location and create a new SearchApi with your current location
AddressPlace l = new AddressPlace(myLocationOverlay.getGeoPoint(), "You are here");

api = new SearchApi(new Geocoder(getApplicationContext()), l);
api.geocoder = new Geocoder(getApplicationContext());

// create a new directionForm if needed
if(directionForm == null){
api = new SearchApi(new Geocoder(getApplicationContext()), l);
api.geocoder = new Geocoder(getApplicationContext());
directionForm = new DirectionsForm(api);
} else {
api.startLocation = l;
}


// The TranslatorApi update the directionForm
// the inputstring nlp is passed to the TranslatorApi
try {
Expand All @@ -268,12 +263,6 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
} catch (UnknownLanguageException e1) {
e1.printStackTrace();
}


// Test data to use as long as the TranslatorApi is not working properly
// directionForm.startAt("ullevi");
// directionForm.travelTo("gamla ullevi");
// directionForm.travelTo("brunnsparken");

// do all the overlay drawings on the map
updatePath();
Expand Down Expand Up @@ -329,8 +318,8 @@ public void onClick(DialogInterface dialog, int whichButton) {
FunApp abstractAnswer = (FunApp) TranslatorApi.parseString(value, getResources().openRawResource(R.raw.locator));
if(abstractAnswer != null){
activeQuestion.answerQuestion(abstractAnswer);
updatePath();
}
updatePath();
}catch (FileNotFoundException e1) {
e1.printStackTrace();
} catch (IOException e1) {
Expand Down

0 comments on commit 41dcf32

Please sign in to comment.