aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/twitter/TwitterAuthorizationActivity.java
blob: 6df417bb7dde41f957bd5c72e811041f03cab0dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package cgeo.geocaching.twitter;

import cgeo.geocaching.R;
import cgeo.geocaching.activity.OAuthAuthorizationActivity;
import cgeo.geocaching.settings.Settings;

import org.apache.commons.lang3.tuple.ImmutablePair;
import org.eclipse.jdt.annotation.Nullable;

public class TwitterAuthorizationActivity extends OAuthAuthorizationActivity {

    public static final OAuthParameters TWITTER_OAUTH_PARAMS = new OAuthParameters(
            "api.twitter.com",
            "/oauth/request_token",
            "/oauth/authorize",
            "/oauth/access_token",
            true,
            Settings.getTwitterKeyConsumerPublic(),
            Settings.getTwitterKeyConsumerSecret(),
            "callback://www.cgeo.org/twitter/");

    @Override
    protected final ImmutablePair<String, String> getTempTokens() {
        return Settings.getTempToken();
    }

    @Override
    protected final void setTempTokens(@Nullable final String tokenPublic, @Nullable final String tokenSecret) {
        Settings.setTwitterTempTokens(tokenPublic, tokenSecret);
    }

    @Override
    protected final void setTokens(@Nullable final String tokenPublic, @Nullable final String tokenSecret, final boolean enable) {
        Settings.setTwitterTokens(tokenPublic, tokenSecret, enable);
    }

    @Override
    protected final String getAuthTitle() {
        return res.getString(R.string.auth_twitter);
    }

    @Override
    protected final String getAuthDialogCompleted() {
        return res.getString(R.string.auth_dialog_completed_twitter);
    }

}