├── FacebookPost.png ├── Jar ├── simple-social-sharing-1.0.1.jar └── simple-social-sharing-1.0.1-sources.jar ├── SimpleSocialSharingExample ├── res │ ├── drawable │ │ └── ic_app.png │ ├── menu │ │ └── menu_facebook_twitter.xml │ ├── layout │ │ ├── ac_home.xml │ │ ├── ac_twitter.xml │ │ └── ac_facebook.xml │ └── values │ │ └── strings.xml ├── .classpath ├── project.properties ├── AndroidManifest.xml └── src │ └── com │ └── nostra13 │ └── example │ └── socialsharing │ ├── Constants.java │ ├── HomeActivity.java │ ├── assist │ ├── TwitterEventObserver.java │ └── FacebookEventObserver.java │ ├── TwitterActivity.java │ └── FacebookActivity.java ├── SimpleSocialSharing ├── src │ └── com │ │ └── nostra13 │ │ └── socialsharing │ │ ├── twitter │ │ ├── TwitterListener.java │ │ ├── AuthRequestListener.java │ │ ├── extpack │ │ │ ├── oauth │ │ │ │ └── signpost │ │ │ │ │ ├── exception │ │ │ │ │ ├── OAuthException.java │ │ │ │ │ ├── OAuthExpectationFailedException.java │ │ │ │ │ ├── OAuthMessageSignerException.java │ │ │ │ │ ├── OAuthCommunicationException.java │ │ │ │ │ └── OAuthNotAuthorizedException.java │ │ │ │ │ ├── http │ │ │ │ │ ├── HttpResponse.java │ │ │ │ │ └── HttpRequest.java │ │ │ │ │ ├── commonshttp │ │ │ │ │ ├── HttpResponseAdapter.java │ │ │ │ │ ├── CommonsHttpOAuthConsumer.java │ │ │ │ │ ├── HttpRequestAdapter.java │ │ │ │ │ └── CommonsHttpOAuthProvider.java │ │ │ │ │ ├── basic │ │ │ │ │ ├── HttpURLConnectionResponseAdapter.java │ │ │ │ │ ├── UrlStringRequestAdapter.java │ │ │ │ │ ├── DefaultOAuthConsumer.java │ │ │ │ │ ├── HttpURLConnectionRequestAdapter.java │ │ │ │ │ └── DefaultOAuthProvider.java │ │ │ │ │ ├── signature │ │ │ │ │ ├── SigningStrategy.java │ │ │ │ │ ├── PlainTextMessageSigner.java │ │ │ │ │ ├── AuthorizationHeaderSigningStrategy.java │ │ │ │ │ ├── OAuthMessageSigner.java │ │ │ │ │ ├── QueryStringSigningStrategy.java │ │ │ │ │ ├── HmacSha1MessageSigner.java │ │ │ │ │ └── SignatureBaseString.java │ │ │ │ │ ├── OAuthProviderListener.java │ │ │ │ │ └── OAuthConsumer.java │ │ │ ├── winterwell │ │ │ │ ├── json │ │ │ │ │ ├── JSONString.java │ │ │ │ │ ├── JSONException.java │ │ │ │ │ └── JSONStringer.java │ │ │ │ └── jtwitter │ │ │ │ │ ├── ecosystem │ │ │ │ │ ├── Klout.java │ │ │ │ │ ├── PeerIndex.java │ │ │ │ │ ├── ThirdParty.java │ │ │ │ │ ├── PeerIndexProfile.java │ │ │ │ │ └── Topsy.java │ │ │ │ │ ├── RateLimit.java │ │ │ │ │ ├── Twitter_Geo.java │ │ │ │ │ ├── TwitterEvent.java │ │ │ │ │ ├── UserStream.java │ │ │ │ │ ├── Place.java │ │ │ │ │ ├── Message.java │ │ │ │ │ ├── TwitterStream.java │ │ │ │ │ └── Twitter_Account.java │ │ │ ├── com │ │ │ │ └── google │ │ │ │ │ └── gdata │ │ │ │ │ └── util │ │ │ │ │ └── common │ │ │ │ │ └── base │ │ │ │ │ └── Escaper.java │ │ │ └── lgpl │ │ │ │ └── haustein │ │ │ │ └── Base64Encoder.java │ │ ├── AccessToken.java │ │ ├── TwitterPostListener.java │ │ ├── TwitterFacade.java │ │ ├── TwitterSessionStore.java │ │ ├── AsyncTwitter.java │ │ ├── TaskExecutor.java │ │ ├── TwitterEvents.java │ │ ├── TwitterDialog.java │ │ └── CallbackTwitterDialog.java │ │ ├── common │ │ ├── LogoutListener.java │ │ ├── PostListener.java │ │ └── AuthListener.java │ │ ├── Constants.java │ │ └── facebook │ │ ├── FacebookAuthListener.java │ │ ├── FacebookLogoutListener.java │ │ ├── extpack │ │ └── com │ │ │ └── facebook │ │ │ └── android │ │ │ ├── FacebookError.java │ │ │ ├── DialogError.java │ │ │ └── FbDialog.java │ │ ├── FacebookSessionStore.java │ │ ├── FacebookPostListener.java │ │ ├── FacebookEvents.java │ │ └── FacebookFacade.java ├── AndroidManifest.xml ├── .classpath └── project.properties ├── .gitignore ├── LICENSE └── README.md /FacebookPost.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nostra13/Android-Simple-Social-Sharing/HEAD/FacebookPost.png -------------------------------------------------------------------------------- /Jar/simple-social-sharing-1.0.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nostra13/Android-Simple-Social-Sharing/HEAD/Jar/simple-social-sharing-1.0.1.jar -------------------------------------------------------------------------------- /Jar/simple-social-sharing-1.0.1-sources.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nostra13/Android-Simple-Social-Sharing/HEAD/Jar/simple-social-sharing-1.0.1-sources.jar -------------------------------------------------------------------------------- /SimpleSocialSharingExample/res/drawable/ic_app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nostra13/Android-Simple-Social-Sharing/HEAD/SimpleSocialSharingExample/res/drawable/ic_app.png -------------------------------------------------------------------------------- /SimpleSocialSharing/src/com/nostra13/socialsharing/twitter/TwitterListener.java: -------------------------------------------------------------------------------- 1 | package com.nostra13.socialsharing.twitter; 2 | 3 | /** 4 | * @author Sergey Tarasevich (nostra13[at]gmail[dot]com) 5 | */ 6 | interface TwitterListener { 7 | 8 | void onStatusUpdateComplete(); 9 | 10 | void onStatusUpdateFailed(Exception e); 11 | } 12 | -------------------------------------------------------------------------------- /SimpleSocialSharing/src/com/nostra13/socialsharing/common/LogoutListener.java: -------------------------------------------------------------------------------- 1 | package com.nostra13.socialsharing.common; 2 | 3 | /** 4 | * Callback interface for logout events. 5 | * 6 | * @author Sergey Tarasevich (nostra13[at]gmail[dot]com) 7 | */ 8 | public interface LogoutListener { 9 | 10 | public void onLogoutComplete(); 11 | } -------------------------------------------------------------------------------- /SimpleSocialSharing/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /SimpleSocialSharingExample/res/menu/menu_facebook_twitter.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /SimpleSocialSharing/src/com/nostra13/socialsharing/twitter/AuthRequestListener.java: -------------------------------------------------------------------------------- 1 | package com.nostra13.socialsharing.twitter; 2 | 3 | /** 4 | * @author Sergey Tarasevich (nostra13[at]gmail[dot]com) 5 | */ 6 | public interface AuthRequestListener { 7 | 8 | void onAuthRequestComplete(String requestUrl); 9 | 10 | void onAuthRequestFailed(Exception e); 11 | } 12 | -------------------------------------------------------------------------------- /SimpleSocialSharing/src/com/nostra13/socialsharing/common/PostListener.java: -------------------------------------------------------------------------------- 1 | package com.nostra13.socialsharing.common; 2 | 3 | /** 4 | * Callback interface for post events. 5 | * 6 | * @author Sergey Tarasevich (nostra13[at]gmail[dot]com) 7 | */ 8 | public interface PostListener { 9 | 10 | public void onPostPublished(); 11 | 12 | public void onPostPublishingFailed(); 13 | } -------------------------------------------------------------------------------- /SimpleSocialSharing/src/com/nostra13/socialsharing/common/AuthListener.java: -------------------------------------------------------------------------------- 1 | package com.nostra13.socialsharing.common; 2 | 3 | /** 4 | * Callback interface for authorization events. 5 | * 6 | * @author Sergey Tarasevich (nostra13[at]gmail[dot]com) 7 | */ 8 | public interface AuthListener { 9 | 10 | public void onAuthSucceed(); 11 | 12 | public void onAuthFail(String error); 13 | } 14 | -------------------------------------------------------------------------------- /SimpleSocialSharing/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SimpleSocialSharingExample/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SimpleSocialSharingExample/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system use, 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | 10 | # Project target. 11 | target=android-17 12 | -------------------------------------------------------------------------------- /SimpleSocialSharing/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system use, 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | 10 | # Project target. 11 | target=android-17 12 | android.library=true 13 | -------------------------------------------------------------------------------- /SimpleSocialSharing/src/com/nostra13/socialsharing/twitter/extpack/oauth/signpost/exception/OAuthException.java: -------------------------------------------------------------------------------- 1 | package com.nostra13.socialsharing.twitter.extpack.oauth.signpost.exception; 2 | 3 | @SuppressWarnings("serial") 4 | public abstract class OAuthException extends Exception { 5 | 6 | public OAuthException(String message) { 7 | super(message); 8 | } 9 | 10 | public OAuthException(Throwable cause) { 11 | super(cause); 12 | } 13 | 14 | public OAuthException(String message, Throwable cause) { 15 | super(message, cause); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /SimpleSocialSharing/src/com/nostra13/socialsharing/twitter/AccessToken.java: -------------------------------------------------------------------------------- 1 | package com.nostra13.socialsharing.twitter; 2 | 3 | /** 4 | * @author Sergey Tarasevich (nostra13[at]gmail[dot]com) 5 | */ 6 | class AccessToken { 7 | 8 | private String token; 9 | private String tokenSecret; 10 | 11 | AccessToken(String token, String tokenSecret) { 12 | this.token = token; 13 | this.tokenSecret = tokenSecret; 14 | } 15 | 16 | public String getToken() { 17 | return token; 18 | } 19 | 20 | public String getTokenSecret() { 21 | return tokenSecret; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | */bin 2 | */gen 3 | .project 4 | .classpath 5 | # built application files 6 | *.apk 7 | *.ap_ 8 | 9 | # files for the dex VM 10 | *.dex 11 | 12 | # Java class files 13 | *.class 14 | 15 | # generated files 16 | bin/ 17 | gen/ 18 | 19 | # Local configuration file (sdk path, etc) 20 | local.properties 21 | 22 | # Eclipse project files 23 | .classpath 24 | .project 25 | .settings 26 | 27 | # Proguard folder generated by Eclipse 28 | proguard/ 29 | 30 | # Intellij project files 31 | *.iml 32 | *.ipr 33 | *.iws 34 | .idea/ 35 | 36 | *.DS_Store 37 | 38 | # ButterKnife generated stuff 39 | .factorypath 40 | .apt_generated/ 41 | 42 | # Lint 43 | 44 | lint.xml 45 | -------------------------------------------------------------------------------- /SimpleSocialSharing/src/com/nostra13/socialsharing/twitter/TwitterPostListener.java: -------------------------------------------------------------------------------- 1 | package com.nostra13.socialsharing.twitter; 2 | 3 | import android.util.Log; 4 | 5 | /** 6 | * @author Sergey Tarasevich (nostra13[at]gmail[dot]com) 7 | */ 8 | class TwitterPostListener implements TwitterListener { 9 | 10 | private static final String TAG = TwitterPostListener.class.getSimpleName(); 11 | 12 | @Override 13 | public void onStatusUpdateComplete() { 14 | TwitterEvents.onPostPublished(); 15 | } 16 | 17 | @Override 18 | public void onStatusUpdateFailed(Exception e) { 19 | Log.e(TAG, e.getMessage(), e); 20 | TwitterEvents.onPostPublishingFailed(); 21 | } 22 | }; 23 | -------------------------------------------------------------------------------- /SimpleSocialSharing/src/com/nostra13/socialsharing/twitter/extpack/oauth/signpost/http/HttpResponse.java: -------------------------------------------------------------------------------- 1 | package com.nostra13.socialsharing.twitter.extpack.oauth.signpost.http; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | 6 | public interface HttpResponse { 7 | 8 | int getStatusCode() throws IOException; 9 | 10 | String getReasonPhrase() throws Exception; 11 | 12 | InputStream getContent() throws IOException; 13 | 14 | /** 15 | * Returns the underlying response object, in case you need to work on it 16 | * directly. 17 | * 18 | * @return the wrapped response object 19 | */ 20 | Object unwrap(); 21 | } 22 | -------------------------------------------------------------------------------- /SimpleSocialSharing/src/com/nostra13/socialsharing/Constants.java: -------------------------------------------------------------------------------- 1 | package com.nostra13.socialsharing; 2 | 3 | /** 4 | * @author Sergey Tarasevich (nostra13[at]gmail[dot]com) 5 | */ 6 | public final class Constants { 7 | private Constants() { 8 | } 9 | 10 | public static final String[] FACEBOOK_PERMISSIONS = new String[] {"publish_actions"}; 11 | 12 | public static final class Preferences { 13 | public static final String FACEBOOK_KEY = "facebook-session"; 14 | public static final String FACEBOOK_TOKEN = "access_token"; 15 | public static final String FACEBOOK_EXPIRES = "expires_in"; 16 | 17 | public static final String TWITTER_KEY = "twitter-session"; 18 | public static final String TWITTER_TOKEN = "twitter_token"; 19 | public static final String TWITTER_TOKEN_SECRET = "twitter_token_secret"; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SimpleSocialSharing/src/com/nostra13/socialsharing/twitter/extpack/winterwell/json/JSONString.java: -------------------------------------------------------------------------------- 1 | package com.nostra13.socialsharing.twitter.extpack.winterwell.json; 2 | /** 3 | * The JSONString interface allows a toJSONString() 4 | * method so that a class can change the behavior of 5 | * JSONObject.toString(), JSONArray.toString(), 6 | * and JSONWriter.value(Object). The 7 | * toJSONString method will be used instead of the default behavior 8 | * of using the Object's toString() method and quoting the result. 9 | */ 10 | public interface JSONString { 11 | /** 12 | * The toJSONString method allows a class to produce its own JSON 13 | * serialization. 14 | * 15 | * @return A strictly syntactically correct JSON text. 16 | */ 17 | public String toJSONString(); 18 | } 19 | -------------------------------------------------------------------------------- /SimpleSocialSharing/src/com/nostra13/socialsharing/twitter/extpack/winterwell/json/JSONException.java: -------------------------------------------------------------------------------- 1 | package com.nostra13.socialsharing.twitter.extpack.winterwell.json; 2 | 3 | /** 4 | * The JSONException is thrown by the JSON.org classes then things are amiss. 5 | * 6 | * Tweaked to be a RuntimeException so it's slightly less annoying -- DBW 7 | * @author JSON.org 8 | * @version 2 9 | */ 10 | public class JSONException extends RuntimeException { 11 | private Throwable cause; 12 | 13 | /** 14 | * Constructs a JSONException with an explanatory message. 15 | * @param message Detail about the reason for the exception. 16 | */ 17 | public JSONException(String message) { 18 | super(message); 19 | } 20 | 21 | public JSONException(Throwable t) { 22 | super(t.getMessage()); 23 | this.cause = t; 24 | } 25 | 26 | @Override 27 | public Throwable getCause() { 28 | return this.cause; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /SimpleSocialSharing/src/com/nostra13/socialsharing/twitter/extpack/oauth/signpost/exception/OAuthExpectationFailedException.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2009 Matthias Kaeppler 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.nostra13.socialsharing.twitter.extpack.oauth.signpost.exception; 16 | 17 | @SuppressWarnings("serial") 18 | public class OAuthExpectationFailedException extends OAuthException { 19 | 20 | public OAuthExpectationFailedException(String message) { 21 | super(message); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /SimpleSocialSharingExample/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 12 | 13 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /SimpleSocialSharing/src/com/nostra13/socialsharing/twitter/extpack/oauth/signpost/commonshttp/HttpResponseAdapter.java: -------------------------------------------------------------------------------- 1 | package com.nostra13.socialsharing.twitter.extpack.oauth.signpost.commonshttp; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | 6 | import com.nostra13.socialsharing.twitter.extpack.oauth.signpost.http.HttpResponse; 7 | 8 | 9 | public class HttpResponseAdapter implements HttpResponse { 10 | 11 | private org.apache.http.HttpResponse response; 12 | 13 | public HttpResponseAdapter(org.apache.http.HttpResponse response) { 14 | this.response = response; 15 | } 16 | 17 | public InputStream getContent() throws IOException { 18 | return response.getEntity().getContent(); 19 | } 20 | 21 | public int getStatusCode() throws IOException { 22 | return response.getStatusLine().getStatusCode(); 23 | } 24 | 25 | public String getReasonPhrase() throws Exception { 26 | return response.getStatusLine().getReasonPhrase(); 27 | } 28 | 29 | public Object unwrap() { 30 | return response; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /SimpleSocialSharing/src/com/nostra13/socialsharing/twitter/extpack/oauth/signpost/basic/HttpURLConnectionResponseAdapter.java: -------------------------------------------------------------------------------- 1 | package com.nostra13.socialsharing.twitter.extpack.oauth.signpost.basic; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import java.net.HttpURLConnection; 6 | 7 | import com.nostra13.socialsharing.twitter.extpack.oauth.signpost.http.HttpResponse; 8 | 9 | 10 | public class HttpURLConnectionResponseAdapter implements HttpResponse { 11 | 12 | private HttpURLConnection connection; 13 | 14 | public HttpURLConnectionResponseAdapter(HttpURLConnection connection) { 15 | this.connection = connection; 16 | } 17 | 18 | public InputStream getContent() throws IOException { 19 | return connection.getInputStream(); 20 | } 21 | 22 | public int getStatusCode() throws IOException { 23 | return connection.getResponseCode(); 24 | } 25 | 26 | public String getReasonPhrase() throws Exception { 27 | return connection.getResponseMessage(); 28 | } 29 | 30 | public Object unwrap() { 31 | return connection; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /SimpleSocialSharing/src/com/nostra13/socialsharing/twitter/extpack/oauth/signpost/exception/OAuthMessageSignerException.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2009 Matthias Kaeppler 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | package com.nostra13.socialsharing.twitter.extpack.oauth.signpost.exception; 16 | 17 | @SuppressWarnings("serial") 18 | public class OAuthMessageSignerException extends OAuthException { 19 | 20 | public OAuthMessageSignerException(String message) { 21 | super(message); 22 | } 23 | 24 | public OAuthMessageSignerException(Exception cause) { 25 | super(cause); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /SimpleSocialSharing/src/com/nostra13/socialsharing/facebook/FacebookAuthListener.java: -------------------------------------------------------------------------------- 1 | package com.nostra13.socialsharing.facebook; 2 | 3 | import android.os.Bundle; 4 | import android.util.Log; 5 | 6 | import com.nostra13.socialsharing.facebook.extpack.com.facebook.android.DialogError; 7 | import com.nostra13.socialsharing.facebook.extpack.com.facebook.android.FacebookError; 8 | import com.nostra13.socialsharing.facebook.extpack.com.facebook.android.Facebook.DialogListener; 9 | 10 | /** 11 | * @author Sergey Tarasevich (nostra13[at]gmail[dot]com) 12 | */ 13 | class FacebookAuthListener implements DialogListener { 14 | 15 | private static final String TAG = FacebookAuthListener.class.getSimpleName(); 16 | 17 | @Override 18 | public void onFacebookError(FacebookError e) { 19 | Log.e(TAG, e.getMessage(), e); 20 | FacebookEvents.onLoginError(e.getMessage()); 21 | } 22 | 23 | @Override 24 | public void onError(DialogError e) { 25 | Log.e(TAG, e.getMessage(), e); 26 | FacebookEvents.onLoginError(e.getMessage()); 27 | } 28 | 29 | @Override 30 | public void onComplete(Bundle values) { 31 | FacebookEvents.onLoginSuccess(); 32 | } 33 | 34 | @Override 35 | public void onCancel() { 36 | // Do nothing 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /SimpleSocialSharingExample/res/layout/ac_home.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 13 | 14 |