// Path: src/com/suchagit/android2cloud/errors/OAuthWebviewNullIntentDialogFragment.java
// public class OAuthWebviewNullIntentDialogFragment extends DialogFragment {
// 	
//     public static OAuthWebviewNullIntentDialogFragment newInstance() {
//         OAuthWebviewNullIntentDialogFragment frag = new OAuthWebviewNullIntentDialogFragment();
//         return frag;
//     }
//     
//     @Override
//     public Dialog onCreateDialog(Bundle savedInstanceState) {
//         int title = R.string.default_error_title;
//         int body = R.string.oauthwebview_null_intent_error;
//         int yesButton = R.string.default_error_ok;
// 
//         return new AlertDialog.Builder(getActivity())
//     		.setCancelable(false)
//             .setTitle(title)
//             .setMessage(body)
//             .setPositiveButton(yesButton,
//                 new DialogInterface.OnClickListener() {
//                     public void onClick(DialogInterface dialog, int whichButton) {
//                     	dialog.cancel();
//                     	getActivity().finish();
//                     }
//                 }
//             )
//             .create();
//     }
// }
// 
// Path: src/com/suchagit/android2cloud/util/OAuth.java
// public class OAuth {
// 	
// 	private static OAuthProvider provider;
// 	private static OAuthConsumer consumer;
// 	
// 	private static final String REQUEST_TOKEN_URL = "_ah/OAuthGetRequestToken";
// 	private static final String ACCESS_TOKEN_URL = "_ah/OAuthGetAccessToken";
// 	private static final String AUTHORISE_TOKEN_URL = "_ah/OAuthAuthorizeToken?btmpl=mobile";
// 	
// 	public static final String CALLBACK = "callback/android/";
// 	public static final int INTENT_ID = 0x1234;
// 	
// 	
// 	public static OAuthConsumer makeConsumer() {
// 		return new CommonsHttpOAuthConsumer(HttpClient.CONSUMER_KEY, HttpClient.CONSUMER_SECRET);
// 	}
// 	
// 	public static OAuthProvider makeProvider(String host) {
// 		String request_token_url = host + REQUEST_TOKEN_URL;
// 		String access_token_url = host + ACCESS_TOKEN_URL;
// 		String authorise_token_url = host + AUTHORISE_TOKEN_URL;
//         return new CommonsHttpOAuthProvider(request_token_url, access_token_url, authorise_token_url);
// 	}
// 	
// 	public static String getRequestUrl(String host, String account) throws OAuthMessageSignerException, OAuthNotAuthorizedException, OAuthExpectationFailedException, OAuthCommunicationException {
// 		if(consumer == null) {
// 			consumer = makeConsumer();
// 		}
// 		
// 		if(provider == null) {
// 			provider = makeProvider(host);
// 		}
//     	account = Uri.encode(account);
// 		String target = provider.retrieveRequestToken(consumer, host+CALLBACK+"?account="+account);
// 		return target;
// 	}
// 	
// 	public static OAuthConsumer getAccessToken(String host, String verifier) throws OAuthMessageSignerException, OAuthNotAuthorizedException, OAuthExpectationFailedException, OAuthCommunicationException {
// 		if(provider == null) {
// 	        provider = makeProvider(host);
// 		}
// 		
// 		if(consumer == null) {
// 			consumer = makeConsumer();
// 		}
// 		provider.retrieveAccessToken(consumer, verifier);
// 		return consumer;
// 	}
// }


import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentActivity;
import android.view.Window;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.suchagit.android2cloud.errors.OAuthWebviewNullIntentDialogFragment;
import com.suchagit.android2cloud.util.OAuth;
package com.suchagit.android2cloud;



public class OAuthWebView extends FragmentActivity {
	
	@Override
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		getWindow().requestFeature(Window.FEATURE_PROGRESS);
		String request_url = "";
		if(this.getIntent() != null && this.getIntent().getDataString() != null){
			request_url = this.getIntent().getDataString();
		} else {
			showDialog(R.string.oauthwebview_null_intent_error);
// Path: src/com/suchagit/android2cloud/errors/OAuthWebviewNullIntentDialogFragment.java
// public class OAuthWebviewNullIntentDialogFragment extends DialogFragment {
// 	
//     public static OAuthWebviewNullIntentDialogFragment newInstance() {
//         OAuthWebviewNullIntentDialogFragment frag = new OAuthWebviewNullIntentDialogFragment();
//         return frag;
//     }
//     
//     @Override
//     public Dialog onCreateDialog(Bundle savedInstanceState) {
//         int title = R.string.default_error_title;
//         int body = R.string.oauthwebview_null_intent_error;
//         int yesButton = R.string.default_error_ok;
// 
//         return new AlertDialog.Builder(getActivity())
//     		.setCancelable(false)
//             .setTitle(title)
//             .setMessage(body)
//             .setPositiveButton(yesButton,
//                 new DialogInterface.OnClickListener() {
//                     public void onClick(DialogInterface dialog, int whichButton) {
//                     	dialog.cancel();
//                     	getActivity().finish();
//                     }
//                 }
//             )
//             .create();
//     }
// }
// 
// Path: src/com/suchagit/android2cloud/util/OAuth.java
// public class OAuth {
// 	
// 	private static OAuthProvider provider;
// 	private static OAuthConsumer consumer;
// 	
// 	private static final String REQUEST_TOKEN_URL = "_ah/OAuthGetRequestToken";
// 	private static final String ACCESS_TOKEN_URL = "_ah/OAuthGetAccessToken";
// 	private static final String AUTHORISE_TOKEN_URL = "_ah/OAuthAuthorizeToken?btmpl=mobile";
// 	
// 	public static final String CALLBACK = "callback/android/";
// 	public static final int INTENT_ID = 0x1234;
// 	
// 	
// 	public static OAuthConsumer makeConsumer() {
// 		return new CommonsHttpOAuthConsumer(HttpClient.CONSUMER_KEY, HttpClient.CONSUMER_SECRET);
// 	}
// 	
// 	public static OAuthProvider makeProvider(String host) {
// 		String request_token_url = host + REQUEST_TOKEN_URL;
// 		String access_token_url = host + ACCESS_TOKEN_URL;
// 		String authorise_token_url = host + AUTHORISE_TOKEN_URL;
//         return new CommonsHttpOAuthProvider(request_token_url, access_token_url, authorise_token_url);
// 	}
// 	
// 	public static String getRequestUrl(String host, String account) throws OAuthMessageSignerException, OAuthNotAuthorizedException, OAuthExpectationFailedException, OAuthCommunicationException {
// 		if(consumer == null) {
// 			consumer = makeConsumer();
// 		}
// 		
// 		if(provider == null) {
// 			provider = makeProvider(host);
// 		}
//     	account = Uri.encode(account);
// 		String target = provider.retrieveRequestToken(consumer, host+CALLBACK+"?account="+account);
// 		return target;
// 	}
// 	
// 	public static OAuthConsumer getAccessToken(String host, String verifier) throws OAuthMessageSignerException, OAuthNotAuthorizedException, OAuthExpectationFailedException, OAuthCommunicationException {
// 		if(provider == null) {
// 	        provider = makeProvider(host);
// 		}
// 		
// 		if(consumer == null) {
// 			consumer = makeConsumer();
// 		}
// 		provider.retrieveAccessToken(consumer, verifier);
// 		return consumer;
// 	}
// }


// Path: src/com/suchagit/android2cloud/OAuthWebView.java
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentActivity;
import android.view.Window;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.suchagit.android2cloud.errors.OAuthWebviewNullIntentDialogFragment;
import com.suchagit.android2cloud.util.OAuth;

package com.suchagit.android2cloud;



public class OAuthWebView extends FragmentActivity {
	
	@Override
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		getWindow().requestFeature(Window.FEATURE_PROGRESS);
		String request_url = "";
		if(this.getIntent() != null && this.getIntent().getDataString() != null){
			request_url = this.getIntent().getDataString();
		} else {
			showDialog(R.string.oauthwebview_null_intent_error);
    	    DialogFragment errorFragment = OAuthWebviewNullIntentDialogFragment.newInstance();