private static void failListener(int requestedAction, String message) { switch (requestedAction) { case ACTION_LOGIN: { RefLoginListener.fail("Login failed: " + message); break; } case ACTION_PUBLISH_STATUS: { RefSocialActionListener.fail("Publish status failed: " + message); break; } case ACTION_PUBLISH_STATUS_DIALOG: { RefSocialActionListener.fail("Publish status dialog failed: " + message); break; } case ACTION_PUBLISH_STORY: { RefSocialActionListener.fail("Publish story failed: " + message); break; } case ACTION_PUBLISH_STORY_DIALOG: { RefSocialActionListener.fail("Publish story dialog failed: " + message); break; } case ACTION_UPLOAD_IMAGE: { RefSocialActionListener.fail("Upload Image failed: " + message); break; } case ACTION_GET_FEED: { RefFeedListener.fail("Get feed failed: " + message); break; } case ACTION_GET_CONTACTS: { RefContactsListener.fail("Get contacts failed: " + message); break; } case ACTION_GET_USER_PROFILE: { RefUserProfileListener.fail("Get user profile failed: " + message); break; } default: { SoomlaUtils.LogWarning(TAG, "action unknown fail listener:" + requestedAction); break; } } clearListener(requestedAction); }
private static void clearListener(int requestedAction) { SoomlaUtils.LogDebug(TAG, "Clearing Listeners " + requestedAction); switch (requestedAction) { case ACTION_LOGIN: { RefLoginListener = null; break; } case ACTION_PUBLISH_STATUS: { RefSocialActionListener = null; break; } case ACTION_PUBLISH_STATUS_DIALOG: { RefSocialActionListener = null; break; } case ACTION_PUBLISH_STORY: { RefSocialActionListener = null; break; } case ACTION_PUBLISH_STORY_DIALOG: { RefSocialActionListener = null; break; } case ACTION_UPLOAD_IMAGE: { RefSocialActionListener = null; break; } case ACTION_GET_FEED: { RefFeedListener = null; break; } case ACTION_GET_CONTACTS: { RefContactsListener = null; break; } case ACTION_GET_USER_PROFILE: { RefUserProfileListener = null; break; } default: { SoomlaUtils.LogWarning(TAG, "action unknown clear listener:" + requestedAction); break; } } }
/** {@inheritDoc} */ @Override public void configure(Map<String, String> providerParams) { autoLogin = false; if (providerParams != null) { twitterConsumerKey = providerParams.get("consumerKey"); twitterConsumerSecret = providerParams.get("consumerSecret"); // extract autoLogin String autoLoginStr = providerParams.get("autoLogin"); autoLogin = autoLoginStr != null && Boolean.parseBoolean(autoLoginStr); } SoomlaUtils.LogDebug( TAG, String.format( "ConsumerKey:%s ConsumerSecret:%s", twitterConsumerKey, twitterConsumerSecret)); if (TextUtils.isEmpty(twitterConsumerKey) || TextUtils.isEmpty(twitterConsumerSecret)) { SoomlaUtils.LogError( TAG, "You must provide the Consumer Key and Secret in the SoomlaProfile initialization parameters"); isInitialized = false; } else { isInitialized = true; } oauthCallbackURL = "oauth://soomla_twitter" + twitterConsumerKey; ConfigurationBuilder configurationBuilder = new ConfigurationBuilder(); configurationBuilder.setOAuthConsumerKey(twitterConsumerKey); configurationBuilder.setOAuthConsumerSecret(twitterConsumerSecret); Configuration configuration = configurationBuilder.build(); twitter = new AsyncTwitterFactory(configuration).getInstance(); if (!actionsListenerAdded) { SoomlaUtils.LogWarning(TAG, "added action listener"); twitter.addListener(actionsListener); actionsListenerAdded = true; } }