diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-06-02 06:58:36 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-06-02 06:58:36 +0000 |
commit | 93af1c6a6cc481b6204cd4d12e3d99ed7d419130 (patch) | |
tree | f4df00941ceca898cd048607383faac9457675b1 /sandbox/travelsample/scatours-android-ui/src/scatours/android/TripSearch.java | |
parent | 27dec0710cc7da2d2eda9b49178ca1334fc756d5 (diff) |
Adding new activity to display results
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@780958 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/travelsample/scatours-android-ui/src/scatours/android/TripSearch.java')
-rw-r--r-- | sandbox/travelsample/scatours-android-ui/src/scatours/android/TripSearch.java | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/sandbox/travelsample/scatours-android-ui/src/scatours/android/TripSearch.java b/sandbox/travelsample/scatours-android-ui/src/scatours/android/TripSearch.java index e2eb98625b..b64c14a583 100644 --- a/sandbox/travelsample/scatours-android-ui/src/scatours/android/TripSearch.java +++ b/sandbox/travelsample/scatours-android-ui/src/scatours/android/TripSearch.java @@ -5,6 +5,9 @@ import scatours.SCAToursSearchProxy; import scatours.common.TripItem; import scatours.common.TripLeg; import android.app.Activity; +import android.app.AlertDialog; +import android.content.DialogInterface; +import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; @@ -127,8 +130,57 @@ public class TripSearch extends Activity { tripLeg.setNoOfPeople("2"); TripItem[] tripsAvailable = searchProxy.search(tripLeg); - Log.i(getString(R.string.app_name),"Found " + tripsAvailable.length + " trips"); + + Log.i(getString(R.string.app_name),"Calling Results view..."); + + displayTripSearchResults(tripsAvailable); + + /* + try { + Intent resultView = new Intent(this, TripSearchResults.class); + resultView.putExtra("results", tripsAvailable); + startActivity(resultView); + } catch(Exception e) { + Log.e(getString(R.string.app_name), e.getMessage()); + } + */ + + //TripSearchResults searchResults = new TripSearchResults(tripsAvailable); + //searchResults.setContentView(R.layout.search_results); + + Log.i(getString(R.string.app_name),"Called..."); + + } + + private void displayTripSearchResults(TripItem[] tripsAvailable) { + + String result = ""; + for(TripItem item : tripsAvailable) { + Log.i(getString(R.string.app_name), "Item type:" + item.getType()); + if (item.getType().equals(TripItem.TRIP)) { + result += item.getDescription() + " (" + item.getCurrency() + " " + item.getPrice() + ")\n"; + } + } + + + //Search trips here + new AlertDialog.Builder(TripSearch.this) + .setTitle("SCATour") + .setMessage("Found:\n" + result) + .setIcon(R.drawable.icon) + .setCancelable(false) + .setPositiveButton(R.string.alert_yes, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int whichButton) { + + }}) + .setNegativeButton(R.string.alert_cancel, new DialogInterface.OnClickListener(){ + public void onClick(DialogInterface dialog, int which) { + + } + }) + .show(); + } }
\ No newline at end of file |