[markww-foursquared] 7 new revisions pushed by markww on 2010-10-04 19:36 GMT

3 views
Skip to first unread message

markww-fo...@googlecode.com

unread,
Oct 4, 2010, 3:37:35 PM10/4/10
to foursqu...@googlegroups.com
7 new revisions:

Revision: 9b86a06fa1
Author: mar...@gmail.com
Date: Sat Oct 2 08:36:28 2010
Log: Few minor bug fixes to get around invalid old todo/tips still coming
d...
http://code.google.com/r/markww-foursquared/source/detail?r=9b86a06fa1

Revision: ce590422d3
Author: mar...@gmail.com
Date: Sat Oct 2 08:47:42 2010
Log: Removed static results observer because we are no longer using it.
http://code.google.com/r/markww-foursquared/source/detail?r=ce590422d3

Revision: 979f963e3c
Author: mar...@gmail.com
Date: Mon Oct 4 08:04:21 2010
Log: Updating changelog, nearbyvenuesmapactivity will be reformatted, not
b...
http://code.google.com/r/markww-foursquared/source/detail?r=979f963e3c

Revision: 4827f5e24f
Author: mar...@gmail.com
Date: Mon Oct 4 08:06:36 2010
Log: Updated changelog text.
http://code.google.com/r/markww-foursquared/source/detail?r=4827f5e24f

Revision: a1ab242376
Author: mar...@gmail.com
Date: Mon Oct 4 11:33:29 2010
Log: Fix for facebook connect / find facebook friends. Looks like one of
th...
http://code.google.com/r/markww-foursquared/source/detail?r=a1ab242376

Revision: 818286a3ad
Author: mar...@gmail.com
Date: Mon Oct 4 12:03:10 2010
Log: Fixed up nearby venues map activity, though we're not using it in
the ...
http://code.google.com/r/markww-foursquared/source/detail?r=818286a3ad

Revision: 7919b37115
Author: mar...@gmail.com
Date: Mon Oct 4 12:36:03 2010
Log: Updated comment notes in facebook rewrite.
http://code.google.com/r/markww-foursquared/source/detail?r=7919b37115

==============================================================================
Revision: 9b86a06fa1
Author: mar...@gmail.com
Date: Sat Oct 2 08:36:28 2010
Log: Few minor bug fixes to get around invalid old todo/tips still coming
down from the API.
http://code.google.com/r/markww-foursquared/source/detail?r=9b86a06fa1

Modified:
/main/assets/changelog-en.html
/main/src/com/joelapenna/foursquared/TodosActivity.java
/main/src/com/joelapenna/foursquared/VenueActivity.java

=======================================
--- /main/assets/changelog-en.html Fri Oct 1 09:25:42 2010
+++ /main/assets/changelog-en.html Sat Oct 2 08:36:28 2010
@@ -38,6 +38,15 @@

<body>

+ <h4><span>What's new in v2010-09-08</span></h4>
+ <ul>
+ <li>Post-checkin scores were not being displayed. Scores were still
being recorded
+ for users, just not being shown.</li>
+ <li>Venue shortcut-creation bug fixed.</li>
+ <li>Friend invite through address book bug fixed.</li>
+ <li>URLs now being linked in tip/to-do details screen.</li>
+ </ul>
+
<h4><span>What's new in v2010-09-30?</span></h4>
<ul>
<li>Redesign for most activity screens.</li>
=======================================
--- /main/src/com/joelapenna/foursquared/TodosActivity.java Thu Sep 30
13:00:32 2010
+++ /main/src/com/joelapenna/foursquared/TodosActivity.java Sat Oct 2
08:36:28 2010
@@ -552,19 +552,21 @@
private void updateTodoFromArray(Tip tip, Group<Todo> target) {
for (int i = 0, m = target.size(); i < m; i++) {
Todo todo = target.get(i);
- if (todo.getTip().getId().equals(tip.getId())) {
- if (mUserId == null) {
- // Activity is operating on logged-in user, only
removing todos
- // from the list, don't have to worry about
updating states.
- if (!TipUtils.isTodo(tip)) {
- target.remove(todo);
- }
- } else {
- // Activity is operating on another user, so just
update the status
- // of the tip within the todo.
- todo.getTip().setStatus(tip.getStatus());
- }
- break;
+ if (todo.getTip() != null) { // Fix for old garbage
todos/tips from the API.
+ if (todo.getTip().getId().equals(tip.getId())) {
+ if (mUserId == null) {
+ // Activity is operating on logged-in user,
only removing todos
+ // from the list, don't have to worry about
updating states.
+ if (!TipUtils.isTodo(tip)) {
+ target.remove(todo);
+ }
+ } else {
+ // Activity is operating on another user, so
just update the status
+ // of the tip within the todo.
+ todo.getTip().setStatus(tip.getStatus());
+ }
+ break;
+ }
}
}
}
=======================================
--- /main/src/com/joelapenna/foursquared/VenueActivity.java Wed Sep 29
12:59:38 2010
+++ /main/src/com/joelapenna/foursquared/VenueActivity.java Sat Oct 2
08:36:28 2010
@@ -123,6 +123,8 @@
setContentView(R.layout.venue_activity);
registerReceiver(mLoggedOutReceiver, new
IntentFilter(Foursquared.INTENT_ACTION_LOGGED_OUT));

+ mHandler = new Handler();
+
StateHolder holder = (StateHolder)
getLastNonConfigurationInstance();
if (holder != null) {
mStateHolder = holder;
@@ -148,7 +150,6 @@
}
}

- mHandler = new Handler();
mRrm = ((Foursquared) getApplication()).getRemoteResourceManager();
mResourcesObserver = new RemoteResourceManagerObserver();
mRrm.addObserver(mResourcesObserver);
@@ -162,7 +163,9 @@
unregisterReceiver(mLoggedOutReceiver);

mHandler.removeCallbacks(mRunnableMayorPhoto);
- mRrm.deleteObserver(mResourcesObserver);
+ if (mRrm != null) {
+ mRrm.deleteObserver(mResourcesObserver);
+ }
}

@Override

==============================================================================
Revision: ce590422d3
Author: mar...@gmail.com
Date: Sat Oct 2 08:47:42 2010
Log: Removed static results observer because we are no longer using it.
http://code.google.com/r/markww-foursquared/source/detail?r=ce590422d3

Modified:
/main/src/com/joelapenna/foursquared/NearbyVenuesActivity.java

=======================================
--- /main/src/com/joelapenna/foursquared/NearbyVenuesActivity.java Thu Sep
30 11:43:33 2010
+++ /main/src/com/joelapenna/foursquared/NearbyVenuesActivity.java Sat Oct
2 08:47:42 2010
@@ -73,8 +73,6 @@
private StateHolder mStateHolder = new StateHolder();
private SearchLocationObserver mSearchLocationObserver = new
SearchLocationObserver();

- public static SearchResultsObservable searchResultsObservable;
-
private ListView mListView;
private SeparatedListAdapter mListAdapter;
private LinearLayout mFooterView;
@@ -96,8 +94,6 @@
setDefaultKeyMode(Activity.DEFAULT_KEYS_SEARCH_LOCAL);
registerReceiver(mLoggedOutReceiver, new
IntentFilter(Foursquared.INTENT_ACTION_LOGGED_OUT));

- searchResultsObservable = new SearchResultsObservable();
-
mHandler = new Handler();
mListView = getListView();
mListAdapter = new SeparatedListAdapter(this);
@@ -298,19 +294,6 @@
return 2000L;
}
}
-
- class SearchResultsObservable extends Observable {
-
- @Override
- public void notifyObservers(Object data) {
- setChanged();
- super.notifyObservers(data);
- }
-
- public Group<Group<Venue>> getSearchResults() {
- return mStateHolder.getResults();
- }
- }

/** If location changes, auto-start a nearby venues search. */
private class SearchLocationObserver implements Observer {
@@ -365,7 +348,6 @@
putSearchResultsInAdapter(mStateHolder.getResults());
setProgressBarIndeterminateVisibility(false);
ensureTitle(true);
- searchResultsObservable.notifyObservers();

mStateHolder.cancelAllTasks();
}

==============================================================================
Revision: 979f963e3c
Author: mar...@gmail.com
Date: Mon Oct 4 08:04:21 2010
Log: Updating changelog, nearbyvenuesmapactivity will be reformatted, not
being used at the moment.
http://code.google.com/r/markww-foursquared/source/detail?r=979f963e3c

Modified:
/main/assets/changelog-en.html
/main/src/com/joelapenna/foursquared/NearbyVenuesMapActivity.java

=======================================
--- /main/assets/changelog-en.html Sat Oct 2 08:36:28 2010
+++ /main/assets/changelog-en.html Mon Oct 4 08:04:21 2010
@@ -38,7 +38,7 @@

<body>

- <h4><span>What's new in v2010-09-08</span></h4>
+ <h4><span>What's new in v2010-10-04?</span></h4>
<ul>
<li>Post-checkin scores were not being displayed. Scores were still
being recorded
for users, just not being shown.</li>
@@ -47,7 +47,7 @@
<li>URLs now being linked in tip/to-do details screen.</li>
</ul>

- <h4><span>What's new in v2010-09-30?</span></h4>
+ <h4><span>What's new in v2010-09-30</span></h4>
<ul>
<li>Redesign for most activity screens.</li>
<li>Tips and To-do screens added as top-level tabs.</li>
=======================================
--- /main/src/com/joelapenna/foursquared/NearbyVenuesMapActivity.java Wed
Sep 22 11:57:13 2010
+++ /main/src/com/joelapenna/foursquared/NearbyVenuesMapActivity.java Mon
Oct 4 08:04:21 2010
@@ -40,7 +40,7 @@

private String mTappedVenueId;

- private Observer mSearchResultsObserver;
+ //private Observer mSearchResultsObserver;
private MapCalloutView mCallout;

private MapView mMapView;
@@ -71,6 +71,7 @@

initMap();

+ /*
mSearchResultsObserver = new Observer() {
@Override
public void update(Observable observable, Object data) {
@@ -80,6 +81,7 @@
recenterMap();
}
};
+ */
}

@Override
@@ -94,13 +96,13 @@
// immediately. If the results are already loaded, the observer
would not be called.
if (!mConstructedPinsOnce) {
clearMap();
-
loadSearchResults(NearbyVenuesActivity.searchResultsObservable.getSearchResults());
+
//loadSearchResults(NearbyVenuesActivity.searchResultsObservable.getSearchResults());
recenterMap();
mConstructedPinsOnce = true;
}

//NearbyVenuesActivity.
-
NearbyVenuesActivity.searchResultsObservable.addObserver(mSearchResultsObserver);
+
//NearbyVenuesActivity.searchResultsObservable.addObserver(mSearchResultsObserver);
}

@Override
@@ -109,7 +111,7 @@
if (DEBUG) Log.d(TAG, "onPause()");
mMyLocationOverlay.disableMyLocation();
mMyLocationOverlay.disableCompass();
-
NearbyVenuesActivity.searchResultsObservable.deleteObserver(mSearchResultsObserver);
+
//NearbyVenuesActivity.searchResultsObservable.deleteObserver(mSearchResultsObserver);
}

@Override

==============================================================================
Revision: 4827f5e24f
Author: mar...@gmail.com
Date: Mon Oct 4 08:06:36 2010
Log: Updated changelog text.
http://code.google.com/r/markww-foursquared/source/detail?r=4827f5e24f

Modified:
/main/assets/changelog-en.html

=======================================
--- /main/assets/changelog-en.html Mon Oct 4 08:04:21 2010
+++ /main/assets/changelog-en.html Mon Oct 4 08:06:36 2010
@@ -41,7 +41,7 @@
<h4><span>What's new in v2010-10-04?</span></h4>
<ul>
<li>Post-checkin scores were not being displayed. Scores were still
being recorded
- for users, just not being shown.</li>
+ for users on the foursquare servers, just not being shown in the
results dialog.</li>
<li>Venue shortcut-creation bug fixed.</li>
<li>Friend invite through address book bug fixed.</li>
<li>URLs now being linked in tip/to-do details screen.</li>

==============================================================================
Revision: a1ab242376
Author: mar...@gmail.com
Date: Mon Oct 4 11:33:29 2010
Log: Fix for facebook connect / find facebook friends. Looks like one of
the constants changed from the facebook project side.
http://code.google.com/r/markww-foursquared/source/detail?r=a1ab242376

Modified:
/main/src/com/facebook/android/Facebook.java
/main/src/com/facebook/android/FacebookUtil.java
/main/src/com/facebook/android/FacebookWebViewActivity.java
/main/src/com/joelapenna/foursquared/AddFriendsByUserInputActivity.java

=======================================
--- /main/src/com/facebook/android/Facebook.java Thu Aug 5 14:34:18 2010
+++ /main/src/com/facebook/android/Facebook.java Mon Oct 4 11:33:29 2010
@@ -17,12 +17,12 @@

package com.facebook.android;

-import java.io.IOException;
-import java.net.MalformedURLException;
-
import android.os.Bundle;
import android.text.TextUtils;

+import java.io.IOException;
+import java.net.MalformedURLException;
+
/**
* Main Facebook object for storing session token and session expiration
date
* in memory, as well as generating urls to access different facebook
endpoints.
@@ -227,7 +227,7 @@
params.putString("client_id", appId);
if (permissions != null && permissions.length > 0) {
params.putString("scope", TextUtils.join(",",
permissions));
- }
+ }
endpoint = OAUTH_ENDPOINT;
params.putString("type", "user_agent");
params.putString("redirect_uri", REDIRECT_URI);
@@ -237,6 +237,7 @@
params.putString("next", REDIRECT_URI);
}
params.putString("display", "touch");
+ params.putString("sdk", "android");
if (isSessionValid()) {
params.putString(TOKEN, getAccessToken());
}
=======================================
--- /main/src/com/facebook/android/FacebookUtil.java Thu Jun 24 18:16:22
2010
+++ /main/src/com/facebook/android/FacebookUtil.java Mon Oct 4 11:33:29
2010
@@ -17,6 +17,12 @@

package com.facebook.android;

+import org.json.JSONException;
+import org.json.JSONObject;
+
+import android.os.Bundle;
+import android.util.Log;
+
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -25,12 +31,7 @@
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import android.os.Bundle;
-import android.util.Log;
+import java.util.Set;


/**
@@ -45,7 +46,10 @@
public final class FacebookUtil {

public static String encodeUrl(Bundle parameters) {
- if (parameters == null) return "";
+ if (parameters == null) {
+ return "";
+ }
+
StringBuilder sb = new StringBuilder();
boolean first = true;
for (String key : parameters.keySet()) {
@@ -190,4 +194,23 @@
}
return json;
}
-}
+
+ public static String printBundle(Bundle bundle) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("Bundle: ");
+ if (bundle != null) {
+ sb.append(bundle.toString()); sb.append("\n");
+ Set<String> keys = bundle.keySet();
+ for (String it : keys) {
+ sb.append(" ");
+ sb.append(it);
+ sb.append(": ");
+ sb.append(bundle.get(it).toString());
+ sb.append("\n");
+ }
+ } else {
+ sb.append("(null)");
+ }
+ return sb.toString();
+ }
+}
=======================================
--- /main/src/com/facebook/android/FacebookWebViewActivity.java Fri Aug 6
14:46:18 2010
+++ /main/src/com/facebook/android/FacebookWebViewActivity.java Mon Oct 4
11:33:29 2010
@@ -96,7 +96,7 @@
public static final String INTENT_RESULT_KEY_RESULT_BUNDLE = "bundle";
public static final String INTENT_RESULT_KEY_ERROR = "error";

- private static final String DISPLAY_STRING = "display=touch";
+ private static final String DISPLAY_STRING = "touch";
private static final int FB_BLUE = 0xFF6D84B4;
private static final int MARGIN = 4;
private static final int PADDING = 2;
@@ -171,8 +171,8 @@
// If the user supplied a pre-authenticated info,
use it
// here.
Facebook facebook = new Facebook();
- if
(extras.containsKey(INTENT_EXTRA_AUTHENTICATED_TOKEN)
- &&
extras.containsKey(INTENT_EXTRA_AUTHENTICATED_EXPIRES)) {
+ if
(extras.containsKey(INTENT_EXTRA_AUTHENTICATED_TOKEN) &&
+
extras.containsKey(INTENT_EXTRA_AUTHENTICATED_EXPIRES)) {
facebook.setAccessToken(extras
.getString(INTENT_EXTRA_AUTHENTICATED_TOKEN));
facebook.setAccessExpires(extras
@@ -240,7 +240,7 @@
super.onPause();

CookieSyncManager.getInstance().stopSync();
- }
+ }

private class WebViewClientFacebook extends WebViewClient {
@Override
@@ -257,6 +257,7 @@
Intent result = new Intent();
result.putExtra(INTENT_RESULT_KEY_SUPPLIED_ACTION,
mAction);
if (error == null) {
+
CookieSyncManager.getInstance().sync();

result.putExtra(INTENT_RESULT_KEY_RESULT_STATUS, true);
@@ -289,7 +290,7 @@
super.onReceivedError(view, errorCode, description,
failingUrl);

if (mDebug) {
- Log.d(TAG, "WebViewClientFacebook:onReceivedError(): " +
errorCode + ", "
+ Log.e(TAG, "WebViewClientFacebook:onReceivedError(): " +
errorCode + ", "
+ description + ", " + failingUrl);
}

=======================================
--- /main/src/com/joelapenna/foursquared/AddFriendsByUserInputActivity.java
Wed Sep 15 09:23:40 2010
+++ /main/src/com/joelapenna/foursquared/AddFriendsByUserInputActivity.java
Mon Oct 4 11:33:29 2010
@@ -298,7 +298,7 @@
intent.putExtra(FacebookWebViewActivity.INTENT_EXTRA_KEY_APP_ID,
getResources().getString(R.string.facebook_api_key));

intent.putExtra(FacebookWebViewActivity.INTENT_EXTRA_KEY_PERMISSIONS,
- new String[]
{});//"publish_stream", "read_stream", "offline_access"});
+ new String[] {});
//{"publish_stream", "read_stream", "offline_access"});
intent.putExtra(FacebookWebViewActivity.INTENT_EXTRA_KEY_DEBUG,
false);

intent.putExtra(FacebookWebViewActivity.INTENT_EXTRA_KEY_CLEAR_COOKIES,
true);
startActivityForResult(intent,
ACTIVITY_RESULT_FACEBOOK_WEBVIEW_ACTIVITY);
@@ -545,6 +545,8 @@
break;
case INPUT_TYPE_FACEBOOK:
// For facebook, we need to first get all friend
uids, then use that with the foursquare api.
+ //Log.e(TAG, "Umm yeah so we got da id back [" +
params[0] + "]..");
+
String facebookFriendIds =
getFacebookFriendIds(params[0]);
if (TextUtils.isEmpty(facebookFriendIds)) {
result.setUsersOnFoursquare(new Group<User>());

==============================================================================
Revision: 818286a3ad
Author: mar...@gmail.com
Date: Mon Oct 4 12:03:10 2010
Log: Fixed up nearby venues map activity, though we're not using it in the
project yet. Would be nice to add a better centering method which centers
the map to the center of all venue pins, and zooms to their total span.
http://code.google.com/r/markww-foursquared/source/detail?r=818286a3ad

Modified:
/main/src/com/joelapenna/foursquared/NearbyVenuesMapActivity.java

=======================================
--- /main/src/com/joelapenna/foursquared/NearbyVenuesMapActivity.java Mon
Oct 4 08:04:21 2010
+++ /main/src/com/joelapenna/foursquared/NearbyVenuesMapActivity.java Mon
Oct 4 12:03:10 2010
@@ -16,46 +16,80 @@
import com.joelapenna.foursquared.maps.VenueItemizedOverlayWithIcons;
import
com.joelapenna.foursquared.maps.VenueItemizedOverlayWithIcons.VenueItemizedOverlayTapListener;
import com.joelapenna.foursquared.util.GeoUtils;
+import com.joelapenna.foursquared.util.UiUtil;
import com.joelapenna.foursquared.widget.MapCalloutView;

import android.content.Intent;
import android.location.Location;
import android.os.Bundle;
+import android.os.Parcelable;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Toast;

import java.util.ArrayList;
-import java.util.Observable;
-import java.util.Observer;

/**
+ * Takes an array of venues and shows them on a map.
+ *
* @date June 30, 2010
* @author Mark Wyszomierski (mar...@gmail.com)
*/
public class NearbyVenuesMapActivity extends MapActivity {
- public static final String TAG = "PlacesMapActivity";
+ public static final String TAG = "NearbyVenuesMapActivity";
public static final boolean DEBUG = FoursquaredSettings.DEBUG;
-
+
+ public static final String INTENT_EXTRA_VENUES =
Foursquared.PACKAGE_NAME
+ + ".NearbyVenuesMapActivity.INTENT_EXTRA_VENUES";
+
+ private StateHolder mStateHolder;
+
private String mTappedVenueId;
-
- //private Observer mSearchResultsObserver;
private MapCalloutView mCallout;
-
private MapView mMapView;
private MapController mMapController;
private ArrayList<VenueItemizedOverlayWithIcons> mVenueGroupOverlays =
new ArrayList<VenueItemizedOverlayWithIcons>();
private MyLocationOverlay mMyLocationOverlay;
- private boolean mConstructedPinsOnce;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.search_map_activity);

- mConstructedPinsOnce = false;
+ Object retained = getLastNonConfigurationInstance();
+ if (retained != null && retained instanceof StateHolder) {
+ mStateHolder = (StateHolder) retained;
+ } else {
+ if (getIntent().hasExtra(INTENT_EXTRA_VENUES)) {
+ Parcelable[] parcelables =
getIntent().getParcelableArrayExtra(
+ INTENT_EXTRA_VENUES);
+
+ Group<Venue> venues = new Group<Venue>();
+ for (int i = 0; i < parcelables.length; i++) {
+ venues.add((Venue)parcelables[i]);
+ }
+
+ mStateHolder = new StateHolder(venues);
+ } else {
+ Log.e(TAG, TAG + " requires venue array in intent
extras.");
+ finish();
+ return;
+ }
+ }
+
+ ensureUi();
+ }
+
+ private void ensureUi() {
+
+ mMapView = (MapView) findViewById(R.id.mapView);
+ mMapView.setBuiltInZoomControls(true);
+ mMapController = mMapView.getController();
+
+ mMyLocationOverlay = new CrashFixMyLocationOverlay(this, mMapView);
+ mMapView.getOverlays().add(mMyLocationOverlay);

mCallout = (MapCalloutView) findViewById(R.id.map_callout);
mCallout.setVisibility(View.GONE);
@@ -69,107 +103,59 @@
}
});

- initMap();
-
- /*
- mSearchResultsObserver = new Observer() {
- @Override
- public void update(Observable observable, Object data) {
- if (DEBUG) Log.d(TAG, "Observed search results change.");
- clearMap();
-
loadSearchResults(NearbyVenuesActivity.searchResultsObservable.getSearchResults());
- recenterMap();
- }
- };
- */
+ // One CheckinItemizedOverlay per group!
+ VenueItemizedOverlayWithIcons mappableVenuesOverlay =
createMappableVenuesOverlay(
+ mStateHolder.getVenues());
+
+ if (mappableVenuesOverlay != null) {
+ mVenueGroupOverlays.add(mappableVenuesOverlay);
+ }
+
+ if (mVenueGroupOverlays.size() > 0) {
+ mMapView.getOverlays().addAll(mVenueGroupOverlays);
+
+ recenterMap();
+ } else {
+ Toast.makeText(this, getResources().getString(
+ R.string.friendsmapactivity_no_checkins),
Toast.LENGTH_LONG).show();
+ finish();
+ }
}

@Override
public void onResume() {
super.onResume();
- if (DEBUG) Log.d(TAG, "onResume()");
+
mMyLocationOverlay.enableMyLocation();
- //mMyLocationOverlay.enableCompass(); // Disabled due to a sdk 1.5
- // emulator bug
-
- // If this is the first time we're showing the activity, try
generating the overlay
- // immediately. If the results are already loaded, the observer
would not be called.
- if (!mConstructedPinsOnce) {
- clearMap();
-
//loadSearchResults(NearbyVenuesActivity.searchResultsObservable.getSearchResults());
- recenterMap();
- mConstructedPinsOnce = true;
- }
-
- //NearbyVenuesActivity.
-
//NearbyVenuesActivity.searchResultsObservable.addObserver(mSearchResultsObserver);
+ if (UiUtil.sdkVersion() > 3) {
+ mMyLocationOverlay.enableCompass();
+ }
}

@Override
public void onPause() {
super.onPause();
- if (DEBUG) Log.d(TAG, "onPause()");
+
mMyLocationOverlay.disableMyLocation();
- mMyLocationOverlay.disableCompass();
-
//NearbyVenuesActivity.searchResultsObservable.deleteObserver(mSearchResultsObserver);
+ if (UiUtil.sdkVersion() > 3) {
+ mMyLocationOverlay.disableCompass();
+ }
}

@Override
protected boolean isRouteDisplayed() {
return false;
}
-
- private void initMap() {
- mMapView = (MapView) findViewById(R.id.mapView);
- mMapView.setBuiltInZoomControls(true);
- mMapController = mMapView.getController();
-
- mMyLocationOverlay = new CrashFixMyLocationOverlay(this, mMapView);
- mMapView.getOverlays().add(mMyLocationOverlay);
- }
-
- private void loadSearchResults(Group<Group<Venue>> venues) {
- if (venues == null) {
- if (DEBUG) Log.d(TAG, "no search results. Not loading.");
- return;
- }
- if (DEBUG) Log.d(TAG, "Loading search results");
-
- // One CheckinItemizedOverlay per group!
- VenueItemizedOverlayWithIcons mappableVenuesOverlay =
createMappableVenuesOverlay(venues);
-
- if (mappableVenuesOverlay != null) {
- mVenueGroupOverlays.add(mappableVenuesOverlay);
- }
- // Only add the list of checkin group overlays if it contains any
- // overlays.
- if (mVenueGroupOverlays.size() > 0) {
- mMapView.getOverlays().addAll(mVenueGroupOverlays);
- } else {
- Toast.makeText(this, getResources().getString(
- R.string.friendsmapactivity_no_checkins),
Toast.LENGTH_LONG).show();
- }
- }
-
- private void clearMap() {
- if (DEBUG) Log.d(TAG, "clearMap()");
- mVenueGroupOverlays.clear();
- mMapView.getOverlays().clear();
- mMapView.getOverlays().add(mMyLocationOverlay);
- mMapView.postInvalidate();
- }

/**
* We can do something more fun here like create an overlay per
category, so the user
* can hide parks and show only bars, for example.
*/
- private VenueItemizedOverlayWithIcons
createMappableVenuesOverlay(Group<Group<Venue>> group) {
+ private VenueItemizedOverlayWithIcons
createMappableVenuesOverlay(Group<Venue> venues) {

Group<Venue> mappableVenues = new Group<Venue>();
- for (Group<Venue> it : group) {
- for (Venue jt : it) {
- mappableVenues.add(jt);
- }
+ for (Venue it : venues) {
+ mappableVenues.add(it);
}

if (mappableVenues.size() > 0) {
@@ -190,26 +176,29 @@
// so falling back to zoom at a fixed level.
GeoPoint center = mMyLocationOverlay.getMyLocation();
if (center != null) {
- if (DEBUG) Log.d(TAG, "Using MyLocaionOverlay as center point
for recenterMap().");
mMapController.animateTo(center);
- mMapController.setZoom(16);
+ mMapController.setZoom(14);
} else {
// Location overlay wasn't ready yet, try using last known
geolocation from manager.
Location bestLocation = GeoUtils.getBestLastGeolocation(this);
if (bestLocation != null) {
- if (DEBUG) Log.d(TAG, "Using last known location as center
point for recenterMap().");

mMapController.animateTo(GeoUtils.locationToGeoPoint(bestLocation));
- mMapController.setZoom(16);
+ mMapController.setZoom(14);
} else {
// We have no location information at all, so we'll just
show the map at a high
// zoom level and the user can zoom in as they wish.
- if (DEBUG) Log.d(TAG, "No location info available for
recenterMap().");
+ Venue venue = mStateHolder.getVenues().get(0);
+ mMapController.animateTo(new GeoPoint(
+ (int)(Float.valueOf(venue.getGeolat()) * 1E6),
+ (int)(Float.valueOf(venue.getGeolong()) * 1E6)));
mMapController.setZoom(8);
}
}
}

- /** Handle taps on one of the pins. */
+ /**
+ * Handle taps on one of the pins.
+ */
private VenueItemizedOverlayTapListener mVenueOverlayTapListener =
new VenueItemizedOverlayTapListener() {
@Override
@@ -228,4 +217,16 @@
mCallout.setVisibility(View.GONE);
}
};
-}
+
+ private class StateHolder {
+ private Group<Venue> mVenues;
+
+ public StateHolder(Group<Venue> venues) {
+ mVenues = venues;
+ }
+
+ public Group<Venue> getVenues() {
+ return mVenues;
+ }
+ }
+}

==============================================================================
Revision: 7919b37115
Author: mar...@gmail.com
Date: Mon Oct 4 12:36:03 2010
Log: Updated comment notes in facebook rewrite.
http://code.google.com/r/markww-foursquared/source/detail?r=7919b37115

Modified:
/main/src/com/facebook/android/FacebookWebViewActivity.java

=======================================
--- /main/src/com/facebook/android/FacebookWebViewActivity.java Mon Oct 4
11:33:29 2010
+++ /main/src/com/facebook/android/FacebookWebViewActivity.java Mon Oct 4
12:36:03 2010
@@ -73,9 +73,20 @@
* <code>android.permission.INTERNET</code> permission added to your
manifest.
* You need to add this activity definition to your manifest. You can
prevent
* this activity from restarting on rotation so the network operations are
- * preserved like so: <activity
- * android:name="com.facebook.android.FacebookWebViewActivity"
- * android:configChanges="orientation|keyboardHidden" />
+ * preserved within the WebView like so:
+ *
+ * <activity
+ * android:name="com.facebook.android.FacebookWebViewActivity"
+ * android:configChanges="orientation|keyboardHidden" />
+ *
+ * This class and the rest of the facebook classes within this package are
from
+ * the facebook android library project:
+ *
+ * http://github.com/facebook/facebook-android-sdk
+ *
+ * The project implementation had several problems with it which made it
unusable
+ * in a production application. It has been rewritten here for use with the
+ * Foursquare project.
*
* @date June 14, 2010
* @author Mark Wyszomierski (mar...@gmail.com)

Reply all
Reply to author
Forward
0 new messages