Browse files

before revert

  • Loading branch information...
1 parent bf3c231 commit c177c5b8335b766fee03889a03c6d6c12e899acd @aknoxx committed Jun 15, 2011
Showing with 67 additions and 22 deletions.
  1. +49 −4 src/at/tuwien/dsg/activities/TweetflowActivity.java
  2. +18 −18 src/at/tuwien/dsg/common/ConnManager.java
View
53 src/at/tuwien/dsg/activities/TweetflowActivity.java
@@ -113,14 +113,18 @@ public void onCreate(Bundle icicle) {
mBloa.setLoggedIn(true);
startActivity(new Intent(this, OAuthActivity.class));
}
+ else {
+ mBloa.lookupSavedUserKeys();
+ new GetCredentialsTask().execute();
+ }
}
@Override
public void onResume() {
super.onResume();
- mBloa.lookupSavedUserKeys();
- new GetCredentialsTask().execute();
+ //mBloa.lookupSavedUserKeys();
+ //new GetCredentialsTask().execute();
}
protected void onFinish() {
@@ -158,6 +162,44 @@ protected void onPostExecute(JSONObject jso) {
}
}
+ private class GetTimelineWithProgressTask extends AsyncTask<ConnManager.TimelineSelector, Void, JSONArray> {
+ ProgressDialog authDialog;
+
+ @Override
+ protected void onPreExecute() {
+ authDialog = ProgressDialog.show(TweetflowActivity.this,
+ getText(R.string.auth_progress_title),
+ getText(R.string.auth_progress_text),
+ true, // indeterminate duration
+ false); // not cancel-able
+ }
+
+ @Override
+ protected JSONArray doInBackground(ConnManager.TimelineSelector... params) {
+ return mBloa.getTimeline(params[0]);
+ }
+
+ // This is in the UI thread, so we can mess with the UI
+ protected void onPostExecute(JSONArray array) {
+ if(array != null) {
+ try {
+ for(int i = 0; i < array.length(); ++i) {
+ JSONObject status = array.getJSONObject(i);
+ ConnManager.UserStatus s = mBloa.new UserStatus(status);
+ tfm.addBloa(s);
+ }
+ adapter.notifyDataSetChanged();
+ authDialog.dismiss();
+
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ } else {
+ }
+ }
+ }
+
+
private class GetTimelineTask extends AsyncTask<ConnManager.TimelineSelector, Void, JSONArray> {
@Override
@@ -192,8 +234,11 @@ public RefreshAction() {
@Override
public void performAction(View view) {
- tfm.downloadNewTweets();
- adapter.notifyDataSetChanged();
+// tfm.downloadNewTweets();
+ ConnManager.TimelineSelector ss = mBloa.new TimelineSelector(ConnManager.HOME_TIMELINE_URL_STRING);
+ new GetTimelineWithProgressTask().execute(ss);
+
+// adapter.notifyDataSetChanged();
}
}
View
36 src/at/tuwien/dsg/common/ConnManager.java
@@ -42,12 +42,12 @@
public class ConnManager {
public static final String TAG = "ConnManager";
-// public static final String VERIFY_URL_STRING = "http://twitter.com/account/verify_credentials.json";
-// public static final String PUBLIC_TIMELINE_URL_STRING = "http://twitter.com/statuses/public_timeline.json";
-// public static final String USER_TIMELINE_URL_STRING = "http://twitter.com/statuses/user_timeline.json";
-// public static final String HOME_TIMELINE_URL_STRING = "http://api.twitter.com/1/statuses/home_timeline.json";
-// public static final String FRIENDS_TIMELINE_URL_STRING = "http://api.twitter.com/1/statuses/friends_timeline.json";
-// public static final String STATUSES_URL_STRING = "http://twitter.com/statuses/update.json";
+ public static final String VERIFY_URL_STRING = "http://twitter.com/account/verify_credentials.json";
+ public static final String PUBLIC_TIMELINE_URL_STRING = "http://twitter.com/statuses/public_timeline.json";
+ public static final String USER_TIMELINE_URL_STRING = "http://twitter.com/statuses/user_timeline.json";
+ public static final String HOME_TIMELINE_URL_STRING = "http://api.twitter.com/1/statuses/home_timeline.json";
+ public static final String FRIENDS_TIMELINE_URL_STRING = "http://api.twitter.com/1/statuses/friends_timeline.json";
+ public static final String STATUSES_URL_STRING = "http://twitter.com/statuses/update.json";
/*
public static final String VERIFY_URL_STRING = "http://identi.ca/api/account/verify_credentials.json";
@@ -58,26 +58,26 @@
public static final String STATUSES_URL_STRING = "http://identi.ca/api/statuses/update.json";
*/
- public static final String VERIFY_URL_STRING = "http://192.168.0.10/statusnet/index.php/api/account/verify_credentials.json";
- public static final String PUBLIC_TIMELINE_URL_STRING = "http://192.168.0.10/statusnet/index.php/api/statuses/public_timeline.json";
- public static final String USER_TIMELINE_URL_STRING = "http://192.168.0.10/statusnet/index.php/api/statuses/user_timeline.json";
- public static final String HOME_TIMELINE_URL_STRING = "http://192.168.0.10/statusnet/index.php/api/statuses/home_timeline.json";
- public static final String FRIENDS_TIMELINE_URL_STRING = "http://192.168.0.10/statusnet/index.php/api/statuses/friends_timeline.json";
- public static final String STATUSES_URL_STRING = "http://192.168.0.10/statusnet/index.php/api/statuses/update.json";
+// public static final String VERIFY_URL_STRING = "http://192.168.0.10/statusnet/index.php/api/account/verify_credentials.json";
+// public static final String PUBLIC_TIMELINE_URL_STRING = "http://192.168.0.10/statusnet/index.php/api/statuses/public_timeline.json";
+// public static final String USER_TIMELINE_URL_STRING = "http://192.168.0.10/statusnet/index.php/api/statuses/user_timeline.json";
+// public static final String HOME_TIMELINE_URL_STRING = "http://192.168.0.10/statusnet/index.php/api/statuses/home_timeline.json";
+// public static final String FRIENDS_TIMELINE_URL_STRING = "http://192.168.0.10/statusnet/index.php/api/statuses/friends_timeline.json";
+// public static final String STATUSES_URL_STRING = "http://192.168.0.10/statusnet/index.php/api/statuses/update.json";
ProgressDialog postDialog = null;
-// public static final String TWITTER_REQUEST_TOKEN_URL = "http://twitter.com/oauth/request_token";
-// public static final String TWITTER_ACCESS_TOKEN_URL = "http://twitter.com/oauth/access_token";
-// public static final String TWITTER_AUTHORIZE_URL = "http://twitter.com/oauth/authorize";
+ public static final String TWITTER_REQUEST_TOKEN_URL = "http://twitter.com/oauth/request_token";
+ public static final String TWITTER_ACCESS_TOKEN_URL = "http://twitter.com/oauth/access_token";
+ public static final String TWITTER_AUTHORIZE_URL = "http://twitter.com/oauth/authorize";
/*
public static final String TWITTER_REQUEST_TOKEN_URL = "https://identi.ca/api/oauth/request_token";
public static final String TWITTER_ACCESS_TOKEN_URL = "https://identi.ca/api/oauth/access_token";
public static final String TWITTER_AUTHORIZE_URL = "https://identi.ca/api/oauth/authorize";
*/
- public static final String TWITTER_REQUEST_TOKEN_URL = "http://192.168.0.10/statusnet/index.php/api/oauth/request_token";
- public static final String TWITTER_ACCESS_TOKEN_URL = "http://192.168.0.10/statusnet/index.php/api/oauth/access_token";
- public static final String TWITTER_AUTHORIZE_URL = "http://192.168.0.10/statusnet/index.php/api/oauth/authorize";
+// public static final String TWITTER_REQUEST_TOKEN_URL = "http://192.168.0.10/statusnet/index.php/api/oauth/request_token";
+// public static final String TWITTER_ACCESS_TOKEN_URL = "http://192.168.0.10/statusnet/index.php/api/oauth/access_token";
+// public static final String TWITTER_AUTHORIZE_URL = "http://192.168.0.10/statusnet/index.php/api/oauth/authorize";
private Context ctx;

0 comments on commit c177c5b

Please sign in to comment.