Permalink
Browse files

Merge branch 'master' of github.com:joey-mbk/MobileCityGuide

  • Loading branch information...
francgrim committed May 11, 2012
2 parents 0dd0a6f + 744462a commit 30be60d2b4aa067c54e87bdfd273b2693a280527
View
@@ -1,64 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/MainStyle"
android:orientation="vertical"
android:padding="20dip" >
style="@style/MainStyleNoBg" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="199dp"
android:layout_height="wrap_content"
android:orientation="vertical" >
<com.google.android.maps.MapView
android:id="@+id/myMapView1"
<TextView
android:id="@+id/textViewCity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="@string/city"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#ffffff" />
<TextView
android:id="@+id/textDescritpion"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_marginLeft="10dp"
android:layout_weight="0.52"
android:text="@string/pois_of_city"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#ffffff" />
</LinearLayout>
<Button
android:id="@+id/filtersbutton"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:background="@drawable/buttonroundedcorners2"
android:text="@string/filters"
android:textColor="#ffffff" />
</LinearLayout>
<ListView
android:id="@+id/list"
android:layout_width="wrap_content"
android:layout_height="200dp"
android:layout_marginTop="10dp"
android:background="@drawable/listroundedcorners"
android:cacheColorHint="#00ffffff" >
</ListView>
<Button
android:id="@+id/start"
android:layout_width="fill_parent"
android:layout_height="35dp"
android:layout_marginTop="10dp"
android:background="@drawable/buttonroundedcorners"
android:text="@string/start_label"
android:textColor="#ffffff" />
android:layout_height="fill_parent"
android:layout_x="0px"
android:layout_y="105px"
android:apiKey="06OP9wNxcE1Xo_YipWg5m6ounF-NrTVBcMwSh6w"
android:clickable="true"
android:enabled="true" >
</com.google.android.maps.MapView>
</LinearLayout>
View

This file was deleted.

Oops, something went wrong.
View
@@ -18,8 +18,12 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="30dp"
android:layout_marginTop="50dp"
android:background="#CC0101"
android:padding="7dp"
android:paddingLeft="15dp"
android:text="@string/splash_screen_text"
android:textAppearance="?android:attr/textAppearanceMedium" />
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#FFFFFF" />
</LinearLayout>
View
@@ -54,7 +54,7 @@
android:id="@+id/add_poi"
android:layout_width="130dp"
android:layout_height="35dp"
android:background="@drawable/buttonroundedcorners"
android:background="@drawable/buttonroundedcorners2"
android:text="@string/add_poi_label"
android:textColor="#ffffff" />
@@ -63,7 +63,7 @@
android:layout_width="130dp"
android:layout_height="35dp"
android:layout_marginLeft="10dp"
android:background="@drawable/buttonroundedcorners"
android:background="@drawable/buttonroundedcorners3"
android:text="@string/delete_poi_label"
android:textColor="#ffffff" />
</LinearLayout>
View
@@ -88,6 +88,8 @@ you do not know well.
<string name="create_profile_interests_title">Choose your interests</string>
<string name="create_profile_languages_title">Select your languages in the order that suits you</string>
<string name="directions_error_gps">Error: no GPS signal.</string>
<string name="create_itinerary_label">Create new itinerary</string>
<string name="settings_title">Settings</string>
@@ -36,6 +36,8 @@ public void onCreate(Bundle savedInstanceState) {
private void setListeners() {
View enterButton = findViewById(R.id.contentLayout);
enterButton.setOnClickListener(this);
View logoButton = findViewById(R.id.logo);
logoButton.setOnClickListener(this);
}
public void onClick(View v) {
@@ -45,6 +47,10 @@ public void onClick(View v) {
intent = new Intent(this, Connect.class);
startActivity(intent);
break;
case R.id.logo:
intent = new Intent(this, Connect.class);
startActivity(intent);
break;
}
}
}
@@ -19,6 +19,7 @@
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import com.mobilecityguide.MobileCityGuideActivity;
import com.mobilecityguide.R;
@@ -81,6 +82,9 @@ public void onCreate(Bundle savedInstanceState) {
}
setContentView(R.layout.add_poi);
((TextView) findViewById(R.id.poi_title)).setText(UserController.city); // setting window title
setListeners();
}
@@ -106,7 +110,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
startActivity(intent);
return true;
case R.id.edit_profile:
intent = new Intent(this, MobileCityGuideActivity.class);
intent = new Intent(this, CreateProfile.class);
startActivity(intent);
return true;
}
@@ -68,7 +68,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
startActivity(intent);
return true;
case R.id.edit_profile:
intent = new Intent(this, MobileCityGuideActivity.class);
intent = new Intent(this, CreateProfile.class);
startActivity(intent);
return true;
@@ -14,6 +14,7 @@
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import com.mobilecityguide.MobileCityGuideActivity;
import com.mobilecityguide.R;
@@ -44,7 +45,7 @@
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// retrieve the variables from previous intent
Bundle extras = getIntent().getExtras();
try {
@@ -72,7 +72,7 @@ public void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.delete_itinerary);
//((TextView) findViewById(R.id.city_title)).setText(UserController.city); // setting window title
((TextView) findViewById(R.id.city_title)).setText(UserController.city); // setting window title
setListeners();
}
@@ -99,7 +99,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
startActivity(intent);
return true;
case R.id.edit_profile:
intent = new Intent(this, MobileCityGuideActivity.class);
intent = new Intent(this, CreateProfile.class);
startActivity(intent);
return true;
}
@@ -19,6 +19,7 @@
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import com.mobilecityguide.MobileCityGuideActivity;
import com.mobilecityguide.R;
@@ -77,6 +78,9 @@ public void onCreate(Bundle savedInstanceState) {
}
setContentView(R.layout.delete_poi);
((TextView) findViewById(R.id.poi_title_menu)).setText(UserController.city); // setting window title
setListeners();
}
@@ -102,7 +106,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
startActivity(intent);
return true;
case R.id.edit_profile:
intent = new Intent(this, MobileCityGuideActivity.class);
intent = new Intent(this, CreateProfile.class);
startActivity(intent);
return true;
}
@@ -31,24 +31,24 @@
import com.mobilecityguide.controllers.UserController;
public class Directions extends Activity implements LocationListener {
private Road mRoad;
private int step;
private POI poi;
private Location poiLocation;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle extras = getIntent().getExtras(); // retrieve the variables from previous intent
if (extras != null)
this.step = extras.getInt("step");
poi = UserController.selectedItinerary.getPOIList().get(new Integer(step)); // retrieve this step POI
poiLocation = new Location(LocationManager.GPS_PROVIDER);
poiLocation.setLatitude(poi.getLatitude());
poiLocation.setLongitude(poi.getLongitude());
/* Get user's location */
LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
Criteria criteria = new Criteria();
@@ -58,14 +58,26 @@ public void onCreate(Bundle savedInstanceState) {
/* Monitor position changes */
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this);
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this);
String url = GPSController.getUrl(userLocation, poiLocation);
InputStream is = getConnection(url);
mRoad = GPSController.getRoute(is);
setContentView(R.layout.directions);
addDirections();
if (userLocation != null) {
String url = GPSController.getUrl(userLocation, poiLocation);
InputStream is = getConnection(url);
mRoad = GPSController.getRoute(is);
addDirections();
}
else {
TextView poiTitle = new TextView(this);
String poiName = POIController.getPOIName(poi);
poiTitle.setText(poiName);
poiTitle.setTextAppearance(this, android.R.style.TextAppearance_Large);
TextView error = new TextView(this);
poiTitle.setText(R.string.directions_error_gps);
LinearLayout layout = (LinearLayout) findViewById(R.id.directions);
layout.addView(poiTitle);
layout.addView(error);
}
}
private void addDirections() {
@@ -75,7 +87,7 @@ private void addDirections() {
poiTitle.setTextAppearance(this, android.R.style.TextAppearance_Large);
LinearLayout layout = (LinearLayout) findViewById(R.id.directions);
layout.addView(poiTitle);
for (int i = 0; i < mRoad.mPoints.length-1; i++) {
TextView container = new TextView(this);
if (i == mRoad.mPoints.length-2) // if it's the last direction, no need to show distance
@@ -84,8 +96,8 @@ private void addDirections() {
container.setText(mRoad.mPoints[i].mName+" "+mRoad.mPoints[i].mDescription);
container.setId(i);
container.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.FILL_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT));
LinearLayout.LayoutParams.FILL_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT));
layout.addView(container);
}
}
@@ -96,7 +108,7 @@ public void onLocationChanged(Location arg0) {
System.out.println(arg0.getLatitude());
System.out.println(arg0.getLongitude());
System.out.println("Distance from POI: "+arg0.distanceTo(poiLocation));
/* if we're less than 50 meters away from the POI, show its informations */
if (arg0.distanceTo(poiLocation) <= 50) {
Intent intent = new Intent(this, PoiDetails.class);
@@ -121,7 +133,7 @@ public void onProviderEnabled(String arg0) {
public void onStatusChanged(String arg0, int arg1, Bundle arg2) {
System.out.println("Status changed: "+arg0);
}
private InputStream getConnection(String url) {
InputStream is = null;
try {
@@ -148,6 +160,18 @@ public boolean onOptionsItemSelected(MenuItem item) {
intent = new Intent(this, MobileCityGuideActivity.class);
startActivity(intent);
return true;
case R.id.change_user:
intent = new Intent(this, Connect.class);
startActivity(intent);
return true;
case R.id.change_city:
intent = new Intent(this, CitiesList.class);
startActivity(intent);
return true;
case R.id.edit_profile:
intent = new Intent(this, CreateProfile.class);
startActivity(intent);
return true;
}
return false;
}
Oops, something went wrong.

0 comments on commit 30be60d

Please sign in to comment.