Revision: f66689393e
Author: Joe LaPenna <j...@joelapenna.com>
Date: Fri Aug 28 23:50:50 2009
Log: Add labels to each tab in the venue activity....
http://code.google.com/p/foursquared/source/detail?r=f66689393e
Revision: 08aafb0b21
Author: Joe LaPenna <j...@joelapenna.com>
Date: Sat Aug 29 00:00:57 2009
Log: Send lat/long to 4sq when a user checks in. Fixes issue 58
http://code.google.com/p/foursquared/source/detail?r=08aafb0b21
==============================================================================
Revision: f66689393e
Author: Joe LaPenna <j...@joelapenna.com>
Date: Fri Aug 28 23:50:50 2009
Log: Add labels to each tab in the venue activity.
Fixes issue 57
http://code.google.com/p/foursquared/source/detail?r=f66689393e
Modified:
/main/res/values/strings.xml
/main/src/com/joelapenna/foursquared/VenueActivity.java
=======================================
--- /main/res/values/strings.xml Fri Aug 28 21:58:26 2009
+++ /main/res/values/strings.xml Fri Aug 28 23:50:50 2009
@@ -22,6 +22,12 @@
name="venue_search_activity_label">Foursquare Venues</string>
<string
name="venue_tips_activity_label">Foursquare Tips</string>
+ <string
+ name="venue_info_tab">Tips</string>
+ <string
+ name="venue_map_tab">Map</string>
+ <string
+ name="venue_checkins_tab">Checkins</string>
<string
name="preferences_label">Preferences</string>
@@ -32,7 +38,7 @@
name="add_venue_label">Add Venue</string>
<string
- name="add_venue_error_toast_venue_null">Unable to add venue!</string>
+ name="add_venue_error_toast_venue_null">Unable to add venue!</string>
<string
name="refresh_address_label">Refresh Address</string>
@@ -61,32 +67,32 @@
name="tip_add_spinner_prompt">Select a List</string>
<string
- name="friendsactivity_title_finished">Foursquare Friends</string>
+ name="friendsactivity_title_finished">Foursquare Friends</string>
<string
- name="friendsactivity_title_searching">Foursquare - Searching for
Friends</string>
+ name="friendsactivity_title_searching">Foursquare - Searching for
Friends</string>
<string
- name="login_dialog_title">Logging in</string>
+ name="login_dialog_title">Logging in</string>
<string
- name="login_dialog_message">Please wait while logging into
Foursquare...</string>
+ name="login_dialog_message">Please wait while logging into
Foursquare...</string>
<string
- name="login_welcome_toast">Welcome to %s!</string>
+ name="login_welcome_toast">Welcome to %s!</string>
<string
- name="login_failed_login_toast">Unable to log in. Please check your
phone number and password.</string>
+ name="login_failed_login_toast">Unable to log in. Please check your
phone number and password.</string>
<string
- name="search_already_in_progress_toast">A search is already in
progress.</string>
+ name="search_already_in_progress_toast">A search is already in
progress.</string>
<string
- name="no_search_results">No search results.</string>
+ name="no_search_results">No search results.</string>
<string
- name="title_search_finished_noquery">Nearby - Foursquare</string>
+ name="title_search_finished_noquery">Nearby - Foursquare</string>
<string
- name="title_search_finished">%s - Foursquare</string>
+ name="title_search_finished">%s - Foursquare</string>
<string
- name="title_search_inprogress_noquery">Searching Nearby -
Foursquare</string>
+ name="title_search_inprogress_noquery">Searching Nearby -
Foursquare</string>
<string
- name="title_search_inprogress">Searching "%s" - Foursquare</string>
+ name="title_search_inprogress">Searching "%s" - Foursquare</string>
</resources>
=======================================
--- /main/src/com/joelapenna/foursquared/VenueActivity.java Mon Aug 24
19:24:05 2009
+++ /main/src/com/joelapenna/foursquared/VenueActivity.java Fri Aug 28
23:50:50 2009
@@ -20,6 +20,7 @@
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
+import android.content.res.Resources;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
@@ -233,33 +234,30 @@
private void initTabHost() {
final TabHost tabHost = this.getTabHost();
+ Resources resources = getResources();
String tag;
Intent intent;
tag = (String)this.getText(R.string.venue_tips_activity_label);
intent = new Intent(this, VenueTipsActivity.class);
tabHost.addTab(tabHost.newTabSpec(tag)
- // Info Tab
- .setIndicator("",
-
getResources().getDrawable(R.drawable.venue_info_tab))
- .setContent(intent) // The contained activity
- );
+ // Info Tab
+ .setIndicator(resources.getString(R.string.venue_info_tab),
+
resources.getDrawable(R.drawable.venue_info_tab)).setContent(intent));
tag = (String)this.getText(R.string.venue_info_activity_label);
intent = new Intent(this, VenueMapActivity.class);
tabHost.addTab(tabHost.newTabSpec(tag)
- // Info Tab
- .setIndicator("",
getResources().getDrawable(R.drawable.map_tab))
- .setContent(intent) // The contained activity
- );
+ // Info Tab
+ .setIndicator(resources.getString(R.string.venue_map_tab),
+
resources.getDrawable(R.drawable.map_tab)).setContent(intent));
tag = (String)this.getText(R.string.venue_checkin_activity_label);
intent = new Intent(this, VenueCheckinsActivity.class);
tabHost.addTab(tabHost.newTabSpec(tag)
- // Checkin Tab
- .setIndicator("",
getResources().getDrawable(R.drawable.recent_checkins_tab))
- .setContent(intent) // The contained activity
- );
+ // Checkin Tab
+ .setIndicator(resources.getString(R.string.venue_checkins_tab),
+
resources.getDrawable(R.drawable.recent_checkins_tab)).setContent(intent));
}
@@ -362,7 +360,8 @@
assert params.length == 2;
String tip = params[0];
String type = params[1];
- return
((Foursquared)getApplication()).getFoursquare().addTip(mStateHolder.venueId,
tip, type);
+ return
((Foursquared)getApplication()).getFoursquare().addTip(mStateHolder.venueId,
+ tip, type);
} catch (Exception e) {
mReason = e;
}
==============================================================================
Revision: 08aafb0b21
Author: Joe LaPenna <j...@joelapenna.com>
Date: Sat Aug 29 00:00:57 2009
Log: Send lat/long to 4sq when a user checks in. Fixes issue 58
http://code.google.com/p/foursquared/source/detail?r=08aafb0b21
Modified:
/main/src/com/joelapenna/foursquare/Foursquare.java
/main/src/com/joelapenna/foursquare/FoursquareHttpApiV1.java
/main/src/com/joelapenna/foursquared/ShoutActivity.java
=======================================
--- /main/src/com/joelapenna/foursquare/Foursquare.java Sun Aug 23 18:50:18
2009
+++ /main/src/com/joelapenna/foursquare/Foursquare.java Sat Aug 29 00:00:57
2009
@@ -98,9 +98,10 @@
}
@V1
- public CheckinResult checkin(String venueId, String venueName, String
shout, boolean isPrivate,
- boolean twitter) throws FoursquareException, FoursquareError,
IOException {
- return mFoursquareV1.checkin(venueId, venueName, shout, isPrivate,
twitter);
+ public CheckinResult checkin(String venueId, String venueName, String
geolat, String geolong,
+ String shout, boolean isPrivate, boolean twitter) throws
FoursquareException,
+ FoursquareError, IOException {
+ return mFoursquareV1.checkin(venueId, venueName, geolat, geolong,
shout, isPrivate, twitter);
}
@V1
=======================================
--- /main/src/com/joelapenna/foursquare/FoursquareHttpApiV1.java Fri Aug 7
08:28:50 2009
+++ /main/src/com/joelapenna/foursquare/FoursquareHttpApiV1.java Sat Aug 29
00:00:57 2009
@@ -253,11 +253,14 @@
/*
*
/checkin?vid=1234&venue=Noc%20Noc&shout=Come%20here&private=0&twitter=1
*/
- CheckinResult checkin(String vid, String venue, String shout, boolean
isPrivate, boolean twitter)
- throws FoursquareException, FoursquareError, IOException {
+ CheckinResult checkin(String vid, String venue, String geolat, String
geolong, String shout,
+ boolean isPrivate, boolean twitter) throws
FoursquareException, FoursquareError,
+ IOException {
HttpPost httpPost =
mHttpApi.createHttpPost(fullUrl(URL_API_CHECKIN), //
new BasicNameValuePair("vid", vid), //
new BasicNameValuePair("venue", venue), //
+ new BasicNameValuePair("geolat", geolat), //
+ new BasicNameValuePair("geolong", geolong), //
new BasicNameValuePair("shout", shout), //
new BasicNameValuePair("private",
(isPrivate) ? "1" : "0"), //
new BasicNameValuePair("twitter", (twitter) ? "1" : "0"));
=======================================
--- /main/src/com/joelapenna/foursquared/ShoutActivity.java Mon Aug 24
09:53:22 2009
+++ /main/src/com/joelapenna/foursquared/ShoutActivity.java Sat Aug 29
00:00:57 2009
@@ -6,6 +6,7 @@
import com.joelapenna.foursquare.types.CheckinResult;
import com.joelapenna.foursquare.types.Venue;
+import com.joelapenna.foursquared.maps.BestLocationListener;
import com.joelapenna.foursquared.util.NotificationsUtil;
import com.joelapenna.foursquared.widget.VenueView;
@@ -21,6 +22,8 @@
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.DialogInterface.OnCancelListener;
+import android.location.Location;
+import android.location.LocationManager;
import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.PreferenceManager;
@@ -71,6 +74,9 @@
private EditText mShoutEditText;
private VenueView mVenueView;
+ private BestLocationListener mLocationListener;
+ private LocationManager mLocationManager;
+
private BroadcastReceiver mLoggedInReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
@@ -85,6 +91,9 @@
if (DEBUG) Log.d(TAG, "onCreate");
registerReceiver(mLoggedInReceiver, new
IntentFilter(Foursquared.INTENT_ACTION_LOGGED_OUT));
+ mLocationListener =
((Foursquared)getApplication()).getLocationListener();
+ mLocationManager =
(LocationManager)getSystemService(Context.LOCATION_SERVICE);
+
// Implies there is no UI.
if (getIntent().hasExtra(EXTRA_IMMEDIATE_CHECKIN)) {
mImmediateCheckin =
getIntent().getBooleanExtra(EXTRA_IMMEDIATE_CHECKIN, true);
@@ -137,6 +146,23 @@
initializeUi();
}
}
+
+ @Override
+ public void onResume() {
+ super.onResume();
+
mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,
+ BestLocationListener.LOCATION_UPDATE_MIN_TIME,
+ BestLocationListener.LOCATION_UPDATE_MIN_DISTANCE,
mLocationListener);
+
mLocationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,
+ BestLocationListener.LOCATION_UPDATE_MIN_TIME,
+ BestLocationListener.LOCATION_UPDATE_MIN_DISTANCE,
mLocationListener);
+ }
+
+ @Override
+ public void onPause() {
+ super.onPause();
+ mLocationManager.removeUpdates(mLocationListener);
+ }
@Override
public void onDestroy() {
@@ -318,8 +344,15 @@
boolean isPrivate = !mTellFriends;
try {
+ String geolat = null;
+ String geolong = null;
+ Location location =
((Foursquared)getApplication()).getLastKnownLocation();
+ if (location != null) {
+ geolat = String.valueOf(location.getLatitude());
+ geolong = String.valueOf(location.getLongitude());
+ }
return
((Foursquared)getApplication()).getFoursquare().checkin(venueId, null,
- mShout, isPrivate, mTellTwitter);
+ geolat, geolong, mShout, isPrivate, mTellTwitter);
} catch (Exception e) {
Log.d(TAG, "Storing reason: ", e);
mReason = e;