AI2 Component
(Version nb184)
|
Public Member Functions | |
Twitter (ComponentContainer container) | |
void | Login (String username, String password) |
String | Username () |
String | ConsumerKey () |
void | ConsumerKey (String consumerKey) |
String | ConsumerSecret () |
void | ConsumerSecret (String consumerSecret) |
String | TwitPic_API_Key () |
void | TwitPic_API_Key (String TwitPic_API_Key) |
void | IsAuthorized () |
void | Authorize () |
void | CheckAuthorized () |
void | resultReturned (int requestCode, int resultCode, Intent data) |
void | DeAuthorize () |
void | Tweet (final String status) |
void | TweetWithImage (final String status, final String imagePath) |
void | RequestMentions () |
void | MentionsReceived (final List< String > mentions) |
List< String > | Mentions () |
void | RequestFollowers () |
void | FollowersReceived (final List< String > followers2) |
List< String > | Followers () |
void | RequestDirectMessages () |
void | DirectMessagesReceived (final List< String > messages) |
List< String > | DirectMessages () |
void | DirectMessage (final String user, final String message) |
void | Follow (final String user) |
void | StopFollowing (final String user) |
void | RequestFriendTimeline () |
void | FriendTimelineReceived (final List< List< String >> timeline) |
List< List< String > > | FriendTimeline () |
void | SearchTwitter (final String query) |
void | SearchSuccessful (final List< String > searchResults) |
List< String > | SearchResults () |
Public Member Functions inherited from com.google.appinventor.components.runtime.AndroidNonvisibleComponent | |
HandlesEventDispatching | getDispatchDelegate () |
Additional Inherited Members | |
Static Public Attributes inherited from com.google.appinventor.components.runtime.Component | |
static final String | ASSET_DIRECTORY = "component" |
static final int | ALIGNMENT_NORMAL = 0 |
static final int | ALIGNMENT_CENTER = 1 |
static final int | ALIGNMENT_OPPOSITE = 2 |
static final int | ACCELEROMETER_SENSITIVITY_WEAK = 1 |
static final int | ACCELEROMETER_SENSITIVITY_MODERATE = 2 |
static final int | ACCELEROMETER_SENSITIVITY_STRONG = 3 |
static final int | BUTTON_SHAPE_DEFAULT = 0 |
static final int | BUTTON_SHAPE_ROUNDED = 1 |
static final int | BUTTON_SHAPE_RECT = 2 |
static final int | BUTTON_SHAPE_OVAL = 3 |
static final int | COLOR_NONE = 0x00FFFFFF |
static final int | COLOR_BLACK = 0xFF000000 |
static final int | COLOR_BLUE = 0xFF0000FF |
static final int | COLOR_CYAN = 0xFF00FFFF |
static final int | COLOR_DKGRAY = 0xFF444444 |
static final int | COLOR_GRAY = 0xFF888888 |
static final int | COLOR_GREEN = 0xFF00FF00 |
static final int | COLOR_LTGRAY = 0xFFCCCCCC |
static final int | COLOR_MAGENTA = 0xFFFF00FF |
static final int | COLOR_ORANGE = 0xFFFFC800 |
static final int | COLOR_PINK = 0xFFFFAFAF |
static final int | COLOR_RED = 0xFFFF0000 |
static final int | COLOR_WHITE = 0xFFFFFFFF |
static final int | COLOR_YELLOW = 0xFFFFFF00 |
static final int | COLOR_DEFAULT = 0x00000000 |
static final String | DEFAULT_VALUE_COLOR_NONE = "&H00FFFFFF" |
static final String | DEFAULT_VALUE_COLOR_BLACK = "&HFF000000" |
static final String | DEFAULT_VALUE_COLOR_BLUE = "&HFF0000FF" |
static final String | DEFAULT_VALUE_COLOR_CYAN = "&HFF00FFFF" |
static final String | DEFAULT_VALUE_COLOR_DKGRAY = "&HFF444444" |
static final String | DEFAULT_VALUE_COLOR_GRAY = "&HFF888888" |
static final String | DEFAULT_VALUE_COLOR_GREEN = "&HFF00FF00" |
static final String | DEFAULT_VALUE_COLOR_LTGRAY = "&HFFCCCCCC" |
static final String | DEFAULT_VALUE_COLOR_MAGENTA = "&HFFFF00FF" |
static final String | DEFAULT_VALUE_COLOR_ORANGE = "&HFFFFC800" |
static final String | DEFAULT_VALUE_COLOR_PINK = "&HFFFFAFAF" |
static final String | DEFAULT_VALUE_COLOR_RED = "&HFFFF0000" |
static final String | DEFAULT_VALUE_COLOR_WHITE = "&HFFFFFFFF" |
static final String | DEFAULT_VALUE_COLOR_YELLOW = "&HFFFFFF00" |
static final String | DEFAULT_VALUE_COLOR_DEFAULT = "&H00000000" |
static final float | FONT_DEFAULT_SIZE = 14 |
static final int | LAYOUT_ORIENTATION_HORIZONTAL = ComponentConstants.LAYOUT_ORIENTATION_HORIZONTAL |
static final int | LAYOUT_ORIENTATION_VERTICAL = ComponentConstants.LAYOUT_ORIENTATION_VERTICAL |
static final int | SCALING_SCALE_PROPORTIONALLY = 0 |
static final int | SCALING_SCALE_TO_FIT = 1 |
static final int | TYPEFACE_DEFAULT = 0 |
static final int | TYPEFACE_SANSSERIF = 1 |
static final int | TYPEFACE_SERIF = 2 |
static final int | TYPEFACE_MONOSPACE = 3 |
static final int | LENGTH_PREFERRED = -1 |
static final int | LENGTH_FILL_PARENT = -2 |
static final int | LENGTH_UNKNOWN = -3 |
static final int | LENGTH_PERCENT_TAG = -1000 |
static final int | TOAST_LENGTH_SHORT = 0 |
static final int | TOAST_LENGTH_LONG = 1 |
static final int | DIRECTION_NORTH = 1 |
static final int | DIRECTION_NORTHEAST = 2 |
static final int | DIRECTION_EAST = 3 |
static final int | DIRECTION_SOUTHEAST = 4 |
static final int | DIRECTION_SOUTH = -1 |
static final int | DIRECTION_SOUTHWEST = -2 |
static final int | DIRECTION_WEST = -3 |
static final int | DIRECTION_NORTHWEST = -4 |
static final int | DIRECTION_NONE = 0 |
static final int | DIRECTION_MIN = -4 |
static final int | DIRECTION_MAX = 4 |
static float | SLIDER_MIN_VALUE = 10 |
static float | SLIDER_MAX_VALUE = 50 |
static float | SLIDER_THUMB_VALUE = (SLIDER_MIN_VALUE + SLIDER_MAX_VALUE) / 2.0f |
static final String | DEFAULT_VALUE_TEXT_TO_SPEECH_COUNTRY = "" |
static final String | DEFAULT_VALUE_TEXT_TO_SPEECH_LANGUAGE = "" |
Protected Member Functions inherited from com.google.appinventor.components.runtime.AndroidNonvisibleComponent | |
AndroidNonvisibleComponent (Form form) | |
Protected Attributes inherited from com.google.appinventor.components.runtime.AndroidNonvisibleComponent | |
final Form | form |
A non-visible component that enables communication with Twitter. Once a user has logged into their Twitter account (and the authorization has been confirmed successful by the IsAuthorized() event), many more operations are available:
You must obtain a Consumer Key and Consumer Secret for Twitter authorization specific to your app from http://twitter.com/oauth_clients/new
Definition at line 111 of file Twitter.java.
com.google.appinventor.components.runtime.Twitter.Twitter | ( | ComponentContainer | container | ) |
Definition at line 170 of file Twitter.java.
void com.google.appinventor.components.runtime.Twitter.Authorize | ( | ) |
Authenticate to Twitter using OAuth @suppressdoc
Definition at line 300 of file Twitter.java.
void com.google.appinventor.components.runtime.Twitter.CheckAuthorized | ( | ) |
Check whether we already have access, and if so, causes the IsAuthorized() event handler to be called.
Definition at line 362 of file Twitter.java.
String com.google.appinventor.components.runtime.Twitter.ConsumerKey | ( | ) |
ConsumerKey property getter method.
Definition at line 215 of file Twitter.java.
void com.google.appinventor.components.runtime.Twitter.ConsumerKey | ( | String | consumerKey | ) |
The consumer key to be used when authorizing with Twitter via OAuth.
consumerKey | the key for use in Twitter OAuth |
Definition at line 227 of file Twitter.java.
String com.google.appinventor.components.runtime.Twitter.ConsumerSecret | ( | ) |
ConsumerSecret property getter method.
Definition at line 235 of file Twitter.java.
void com.google.appinventor.components.runtime.Twitter.ConsumerSecret | ( | String | consumerSecret | ) |
The consumer secret to be used when authorizing with Twitter via OAuth.
consumerSecret | the secret for use in Twitter OAuth |
Definition at line 247 of file Twitter.java.
void com.google.appinventor.components.runtime.Twitter.DeAuthorize | ( | ) |
Removes Twitter authorization from this running app instance.
Definition at line 465 of file Twitter.java.
void com.google.appinventor.components.runtime.Twitter.DirectMessage | ( | final String | user, |
final String | message | ||
) |
This sends a direct (private) message to the specified user. The message will be trimmed if it exceeds 160 characters.
Requirements: This should only be called after the IsAuthorized() event has been raised, indicating that the user has successfully logged in to Twitter.
Definition at line 851 of file Twitter.java.
List<String> com.google.appinventor.components.runtime.Twitter.DirectMessages | ( | ) |
This property contains a list of the most recent messages mentioning the logged-in user. Initially, the list is empty. To set it, the program must:
The value of this property will then be set to the list of direct messages retrieved (and maintain that value until any subsequent call to RequestDirectMessages()).
Definition at line 833 of file Twitter.java.
void com.google.appinventor.components.runtime.Twitter.DirectMessagesReceived | ( | final List< String > | messages | ) |
This event is raised when the recent messages requested through RequestDirectMessages() have been retrieved. A list of the messages can then be found in the messages
{:.variable.block} parameter or the DirectMessages() property.
Definition at line 806 of file Twitter.java.
void com.google.appinventor.components.runtime.Twitter.Follow | ( | final String | user | ) |
Starts following a user.
Definition at line 873 of file Twitter.java.
List<String> com.google.appinventor.components.runtime.Twitter.Followers | ( | ) |
This property contains a list of the followers of the logged-in user. Initially, the list is empty. To set it, the program must:
The value of this property will then be set to the list of followers (and maintain its value until any subsequent call to RequestFollowers()).
Definition at line 738 of file Twitter.java.
void com.google.appinventor.components.runtime.Twitter.FollowersReceived | ( | final List< String > | followers2 | ) |
This event is raised when all of the followers of the logged-in user requested through RequestFollowers() have been retrieved. A list of the followers can then be found in the followers
{:.variable.block} parameter or the Followers() property.
Definition at line 712 of file Twitter.java.
List<List<String> > com.google.appinventor.components.runtime.Twitter.FriendTimeline | ( | ) |
This property contains the 20 most recent messages of users being followed. Initially, the list is empty. To set it, the program must:
The value of this property will then be set to the list of messages (and maintain its value until any subsequent call to RequestFriendTimeline().
Definition at line 994 of file Twitter.java.
void com.google.appinventor.components.runtime.Twitter.FriendTimelineReceived | ( | final List< List< String >> | timeline | ) |
This event is raised when the messages requested through RequestFriendTimeline() have been retrieved. The timeline
{:.variable.block} parameter and the FriendTimeline() property will contain a list of lists, where each sub-list contains a status update of the form (username message).
Definition at line 964 of file Twitter.java.
void com.google.appinventor.components.runtime.Twitter.IsAuthorized | ( | ) |
This event is raised after the program calls Authorize() if the authorization was successful. It is also called after a call to CheckAuthorized() if we already have a valid access token. After this event has been raised, any other method for this component can be called.
Definition at line 290 of file Twitter.java.
void com.google.appinventor.components.runtime.Twitter.Login | ( | String | username, |
String | password | ||
) |
Logs in to Twitter with a username and password.
Definition at line 200 of file Twitter.java.
List<String> com.google.appinventor.components.runtime.Twitter.Mentions | ( | ) |
This property contains a list of mentions of the logged-in user. Initially, the list is empty. To set it, the program must:
The value of this property will then be set to the list of mentions (and will maintain its value until any subsequent calls to RequestMentions()).
Definition at line 658 of file Twitter.java.
void com.google.appinventor.components.runtime.Twitter.MentionsReceived | ( | final List< String > | mentions | ) |
This event is raised when the mentions of the logged-in user requested through RequestMentions() have been retrieved. A list of the mentions can then be found in the mentions
{:.variable.block} parameter or the Mentions() property.
Definition at line 632 of file Twitter.java.
void com.google.appinventor.components.runtime.Twitter.RequestDirectMessages | ( | ) |
Requests the 20 most recent direct messages sent to the logged-in user. When the messages have been retrieved, the system will raise the DirectMessagesReceived(List) event and set the DirectMessages() property to the list of messages.
Requirements: This should only be called after the IsAuthorized() event has been raised, indicating that the user has successfully logged in to Twitter.
Definition at line 759 of file Twitter.java.
void com.google.appinventor.components.runtime.Twitter.RequestFollowers | ( | ) |
Gets who is following you.
Definition at line 666 of file Twitter.java.
void com.google.appinventor.components.runtime.Twitter.RequestFriendTimeline | ( | ) |
Gets the most recent 20 messages in the user's timeline.
Definition at line 917 of file Twitter.java.
void com.google.appinventor.components.runtime.Twitter.RequestMentions | ( | ) |
Requests the 20 most recent mentions of the logged-in user. When the mentions have been retrieved, the system will raise the MentionsReceived(List) event and set the Mentions() property to the list of mentions.
Requirements: This should only be called after the IsAuthorized() event has been raised, indicating that the user has successfully logged in to Twitter.
Definition at line 591 of file Twitter.java.
void com.google.appinventor.components.runtime.Twitter.resultReturned | ( | int | requestCode, |
int | resultCode, | ||
Intent | data | ||
) |
The callback method used to report Activity results back to the caller.
requestCode | the originally passed in request code. Used to identify the call. |
resultCode | the returned result code: android.app.Activity#RESULT_OK or android.app.Activity#RESULT_CANCELED |
data | the returned data, encapsulated as an Intent. |
Implements com.google.appinventor.components.runtime.ActivityResultListener.
Definition at line 383 of file Twitter.java.
List<String> com.google.appinventor.components.runtime.Twitter.SearchResults | ( | ) |
This property, which is initially empty, is set to a list of search results after the program:
The value of the property will then be the same as the parameter to SearchSuccessful(List). Note that it is not necessary to call the Authorize() method before calling SearchTwitter(String).
Definition at line 1070 of file Twitter.java.
void com.google.appinventor.components.runtime.Twitter.SearchSuccessful | ( | final List< String > | searchResults | ) |
This event is raised when the results of the search requested through SearchTwitter(String) have been retrieved. A list of the results can then be found in the results
{:.variable.block} parameter or the SearchResults() property.
Definition at line 1048 of file Twitter.java.
void com.google.appinventor.components.runtime.Twitter.SearchTwitter | ( | final String | query | ) |
This searches Twitter for the given String query.
Requirements: This should only be called after the IsAuthorized() event has been raised, indicating that the user has successfully logged in to Twitter.
Definition at line 1008 of file Twitter.java.
void com.google.appinventor.components.runtime.Twitter.StopFollowing | ( | final String | user | ) |
Stops following a user.
Definition at line 895 of file Twitter.java.
void com.google.appinventor.components.runtime.Twitter.Tweet | ( | final String | status | ) |
This sends a tweet as the logged-in user with the specified Text, which will be trimmed if it exceeds 160 characters.
Requirements: This should only be called after the IsAuthorized() event has been raised, indicating that the user has successfully logged in to Twitter.
Definition at line 500 of file Twitter.java.
void com.google.appinventor.components.runtime.Twitter.TweetWithImage | ( | final String | status, |
final String | imagePath | ||
) |
This sends a tweet as the logged-in user with the specified Text and a path to the image to be uploaded, which will be trimmed if it exceeds 160 characters. If an image is not found or invalid, the update will not be sent.
Requirements: This should only be called after the IsAuthorized() event has been raised, indicating that the user has successfully logged in to Twitter.
Definition at line 540 of file Twitter.java.
String com.google.appinventor.components.runtime.Twitter.TwitPic_API_Key | ( | ) |
TwitPicAPIkey property getter method.
Definition at line 257 of file Twitter.java.
void com.google.appinventor.components.runtime.Twitter.TwitPic_API_Key | ( | String | TwitPic_API_Key | ) |
TwitPicAPIkey property setter method: sets the TwitPicAPIkey to be used for image uploading with twitter.
TwitPic_API_Key | the API Key for image uploading, given by TwitPic |
Definition at line 274 of file Twitter.java.
String com.google.appinventor.components.runtime.Twitter.Username | ( | ) |
Definition at line 207 of file Twitter.java.