aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/twitter/TwitterAuthorizationActivity.java
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2012-12-18 22:22:35 +0100
committerSamuel Tardieu <sam@rfc1149.net>2012-12-18 22:54:15 +0100
commitefa9888edd99e722628136b576fd1f081a13d910 (patch)
treede4b7a96ffe70e07914664d4a176a239e837ee9c /main/src/cgeo/geocaching/twitter/TwitterAuthorizationActivity.java
parent6fe12bd37037dff96ac66a6fe903241f04c21497 (diff)
downloadcgeo-efa9888edd99e722628136b576fd1f081a13d910.zip
cgeo-efa9888edd99e722628136b576fd1f081a13d910.tar.gz
cgeo-efa9888edd99e722628136b576fd1f081a13d910.tar.bz2
Refactoring: narrow scope of variables
Diffstat (limited to 'main/src/cgeo/geocaching/twitter/TwitterAuthorizationActivity.java')
-rw-r--r--main/src/cgeo/geocaching/twitter/TwitterAuthorizationActivity.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/main/src/cgeo/geocaching/twitter/TwitterAuthorizationActivity.java b/main/src/cgeo/geocaching/twitter/TwitterAuthorizationActivity.java
index 36de104..d1242e8 100644
--- a/main/src/cgeo/geocaching/twitter/TwitterAuthorizationActivity.java
+++ b/main/src/cgeo/geocaching/twitter/TwitterAuthorizationActivity.java
@@ -130,14 +130,13 @@ public class TwitterAuthorizationActivity extends AbstractActivity {
}
private void requestToken() {
- final String host = "api.twitter.com";
- final String pathRequest = "/oauth/request_token";
- final String pathAuthorize = "/oauth/authorize";
- final String method = "GET";
int status = 0;
try {
final Parameters params = new Parameters();
+ final String method = "GET";
+ final String pathRequest = "/oauth/request_token";
+ final String host = "api.twitter.com";
OAuth.signOAuth(host, pathRequest, method, true, params, null, null);
final String line = Network.getResponseData(Network.getRequest("https://" + host + pathRequest, params));
@@ -157,6 +156,7 @@ public class TwitterAuthorizationActivity extends AbstractActivity {
try {
final Parameters paramsBrowser = new Parameters();
paramsBrowser.put("oauth_callback", "oob");
+ final String pathAuthorize = "/oauth/authorize";
OAuth.signOAuth(host, pathAuthorize, "GET", true, paramsBrowser, OAtoken, OAtokenSecret);
final String encodedParams = EntityUtils.toString(new UrlEncodedFormEntity(paramsBrowser));
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://" + host + pathAuthorize + "?" + encodedParams)));
@@ -174,15 +174,15 @@ public class TwitterAuthorizationActivity extends AbstractActivity {
}
private void changeToken() {
- final String host = "api.twitter.com";
- final String path = "/oauth/access_token";
- final String method = "POST";
int status = 0;
try {
final Parameters params = new Parameters("oauth_verifier", pinEntry.getText().toString());
+ final String method = "POST";
+ final String path = "/oauth/access_token";
+ final String host = "api.twitter.com";
OAuth.signOAuth(host, path, method, true, params, OAtoken, OAtokenSecret);
final String line = StringUtils.defaultString(Network.getResponseData(Network.postRequest("https://" + host + path, params)));