diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-05 20:14:21 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-05 20:14:21 +0000 |
commit | 26a2e18d46a5e8e6a6457e12afa6f191befcddfd (patch) | |
tree | 9eeb2bab043114ac4e18f7305a3dc21010306378 /sandbox/travelsample/scatours-android-ui/src/scatours/android | |
parent | 18d8aa3401326d927bbb0665e25dd0f2cdce92fd (diff) |
Move scatours-android-ui into contrib
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@833154 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/travelsample/scatours-android-ui/src/scatours/android')
-rw-r--r-- | sandbox/travelsample/scatours-android-ui/src/scatours/android/TripSearch.java | 186 | ||||
-rw-r--r-- | sandbox/travelsample/scatours-android-ui/src/scatours/android/TripSearchResults.java | 57 |
2 files changed, 0 insertions, 243 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 deleted file mode 100644 index b64c14a583..0000000000 --- a/sandbox/travelsample/scatours-android-ui/src/scatours/android/TripSearch.java +++ /dev/null @@ -1,186 +0,0 @@ -package scatours.android; - -import scatours.SCAToursSearch; -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; -import android.view.View.OnClickListener; -import android.widget.AdapterView; -import android.widget.ArrayAdapter; -import android.widget.AutoCompleteTextView; -import android.widget.Button; -import android.widget.AdapterView.OnItemClickListener; -import android.widget.AdapterView.OnItemSelectedListener; - -public class TripSearch extends Activity { - - static final String[] AIRPORT_CODES = new String[] { - "LGW - London Gatwick Airport", - "FLR - Luigi Ridolfi Airport", - "SFO - San Francisco Airport", - "GRU - Sao Paulo Airport", - "GIG - Rio de Janeiro Airport" - }; - - - private AutoCompleteTextView txtFromLocation, - txtToLocation, - txtDateStart, - txtDateEnd, - txtNumberOfPeople; - private Button btnSearch; - - - /** Called when the activity is first created. */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.search); - - - ArrayAdapter adapter = new ArrayAdapter(this,android.R.layout.simple_dropdown_item_1line, AIRPORT_CODES); - - txtFromLocation = (AutoCompleteTextView) findViewById(R.id.edit_fromLocation); - //ArrayAdapter adapterFrom = new ArrayAdapter(this,android.R.layout.simple_dropdown_item_1line, AIRPORT_CODES); - txtFromLocation.setAdapter(adapter); - - txtToLocation = (AutoCompleteTextView) findViewById(R.id.edit_toLocation); - //ArrayAdapter adapterTo = new ArrayAdapter(this,android.R.layout.simple_dropdown_item_1line, AIRPORT_CODES); - txtToLocation.setAdapter(adapter); - - txtDateStart = (AutoCompleteTextView) findViewById(R.id.edit_date_start); - txtDateEnd = (AutoCompleteTextView) findViewById(R.id.edit_date_end); - txtNumberOfPeople = (AutoCompleteTextView) findViewById(R.id.edit_NumberOfPeople); - - btnSearch = (Button) this.findViewById(R.id.btnSearch); - - doListen(); - } - - private void doListen() { - - txtFromLocation.setOnItemClickListener(new OnItemClickListener() { - public void onItemClick(AdapterView<?> parent, View view, int position, long id) { - Log.i(getString(R.string.app_name),">>Item Clicked: " +AIRPORT_CODES[position]); - } - - }); - - txtFromLocation.setOnItemSelectedListener(new OnItemSelectedListener() { - - public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { - Log.i(getString(R.string.app_name),">>Item Selected: " +AIRPORT_CODES[position]); - } - - public void onNothingSelected(AdapterView<?> parent) { - Log.i(getString(R.string.app_name),">>Selection cleared"); - } - - }); - - - //closeButton - btnSearch.setOnClickListener( new OnClickListener() { - public void onClick(View v) { - - doTripSearch(v); - /* - //Search trips here - new AlertDialog.Builder(TripSearch.this) - .setTitle("SCATour") - .setMessage("You're about to search for trips !") - .setIcon(R.drawable.icon) - .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();*/ - } - }); - - } - - - private void doTripSearch(View view) { - SCAToursSearch searchProxy = new SCAToursSearchProxy(); - TripLeg tripLeg = new TripLeg(); - - Log.i(getString(R.string.app_name),"From : " + txtFromLocation.getText().toString() ); - Log.i(getString(R.string.app_name),"To : " + txtToLocation.getText().toString() ); - Log.i(getString(R.string.app_name),"Start Date : " + txtDateStart.getText().toString() ); - Log.i(getString(R.string.app_name),"End Date : " + txtDateEnd.getText().toString() ); - Log.i(getString(R.string.app_name),"NumberOfPeople : " + txtNumberOfPeople.getText().toString() ); - - tripLeg.setFromLocation("LGW"); - tripLeg.setToLocation("FLR"); - tripLeg.setFromDate("06/12/09"); - tripLeg.setToDate("13/12/09"); - 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 diff --git a/sandbox/travelsample/scatours-android-ui/src/scatours/android/TripSearchResults.java b/sandbox/travelsample/scatours-android-ui/src/scatours/android/TripSearchResults.java deleted file mode 100644 index 002ef8def1..0000000000 --- a/sandbox/travelsample/scatours-android-ui/src/scatours/android/TripSearchResults.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package scatours.android; - -import scatours.common.TripItem; -import android.app.Activity; -import android.os.Bundle; -import android.util.Log; -import android.widget.ArrayAdapter; -import android.widget.ListView; - -public class TripSearchResults extends Activity { - private TripItem[] results; - - private ListView listResults; - - public TripSearchResults( ) { - super(); - } - - public void setResults(TripItem[] results) { - Log.i(getString(R.string.app_name),"Setting results : " + results.length); - this.results = results; - } - - /** Called when the activity is first created. */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.search_results); - - Log.i(getString(R.string.app_name),"Displaying " + results.length + " trips"); - - listResults = (ListView) findViewById(R.id.listPackages); - //listResults.setAdapter(new ArrayAdapter<TripItem>(this, R.id.listPackages, results)); - - - } - -} |