Merge pull request #152 from owncloud/oauth_login
[pub/Android/ownCloud.git] / src / com / owncloud / android / authentication / AuthenticatorActivity.java
index cc1b648..ef5c21b 100644 (file)
@@ -3,9 +3,8 @@
  *   Copyright (C) 2012-2013 ownCloud Inc.\r
  *\r
  *   This program is free software: you can redistribute it and/or modify\r
- *   it under the terms of the GNU General Public License as published by\r
- *   the Free Software Foundation, either version 2 of the License, or\r
- *   (at your option) any later version.\r
+ *   it under the terms of the GNU General Public License version 2,\r
+ *   as published by the Free Software Foundation.\r
  *\r
  *   This program is distributed in the hope that it will be useful,\r
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of\r
@@ -20,6 +19,7 @@
 package com.owncloud.android.authentication;\r
 \r
 import com.owncloud.android.AccountUtils;\r
+import com.owncloud.android.Log_OC;\r
 import com.owncloud.android.ui.dialog.SslValidatorDialog;\r
 import com.owncloud.android.ui.dialog.SslValidatorDialog.OnSslValidatorListener;\r
 import com.owncloud.android.utils.OwnCloudVersion;\r
@@ -47,7 +47,6 @@ import android.os.Bundle;
 import android.os.Handler;\r
 import android.preference.PreferenceManager;\r
 import android.text.InputType;\r
-import android.util.Log;\r
 import android.view.View;\r
 import android.view.View.OnFocusChangeListener;\r
 import android.view.Window;\r
@@ -302,7 +301,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
      */\r
     @Override\r
     protected void onNewIntent (Intent intent) {\r
-        Log.d(TAG, "onNewIntent()");\r
+        Log_OC.d(TAG, "onNewIntent()");\r
         Uri data = intent.getData();\r
         if (data != null && data.toString().startsWith(getString(R.string.oauth2_redirect_uri))) {\r
             mNewCapturedUriFromOAuth2Redirection = data;\r
@@ -477,7 +476,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             mStatusText = R.string.auth_wtf_reenter_URL;\r
             updateConnStatus();\r
             mOkButton.setEnabled(false);\r
-            Log.wtf(TAG,  "The user was allowed to click 'connect' to an unchecked server!!");\r
+            Log_OC.wtf(TAG,  "The user was allowed to click 'connect' to an unchecked server!!");\r
             return;\r
         }\r
         \r
@@ -533,7 +532,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         uriBuilder.appendQueryParameter(OAuth2Constants.KEY_SCOPE, getString(R.string.oauth2_scope));\r
         //uriBuilder.appendQueryParameter(OAuth2Constants.KEY_STATE, whateverwewant);\r
         uri = uriBuilder.build();\r
-        Log.d(TAG, "Starting browser to view " + uri.toString());\r
+        Log_OC.d(TAG, "Starting browser to view " + uri.toString());\r
         Intent i = new Intent(Intent.ACTION_VIEW, uri);\r
         startActivity(i);\r
     }\r
@@ -722,7 +721,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             \r
             /// time to test the retrieved access token on the ownCloud server\r
             mOAuthAccessToken = ((OAuth2GetAccessToken)operation).getResultTokenMap().get(OAuth2Constants.KEY_ACCESS_TOKEN);\r
-            Log.d(TAG, "Got ACCESS TOKEN: " + mOAuthAccessToken);\r
+            Log_OC.d(TAG, "Got ACCESS TOKEN: " + mOAuthAccessToken);\r
             mAuthCheckOperation = new ExistenceCheckOperation("", this, false);\r
             WebdavClient client = OwnCloudClientUtils.createOwnCloudClient(Uri.parse(mHostBaseUrl + webdav_path), this);\r
             client.setBearerCredentials(mOAuthAccessToken);\r
@@ -731,7 +730,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         } else {\r
             updateStatusIconAndText(result);\r
             updateAuthStatus();\r
-            Log.d(TAG, "Access failed: " + result.getLogMessage());\r
+            Log_OC.d(TAG, "Access failed: " + result.getLogMessage());\r
         }\r
     }\r
 \r
@@ -752,7 +751,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         }\r
         \r
         if (result.isSuccess()) {\r
-            Log.d(TAG, "Successful access - time to save the account");\r
+            Log_OC.d(TAG, "Successful access - time to save the account");\r
 \r
             if (mAction == ACTION_CREATE) {\r
                 createAccount();\r
@@ -766,7 +765,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         } else {\r
             updateStatusIconAndText(result);\r
             updateAuthStatus();\r
-            Log.d(TAG, "Access failed: " + result.getLogMessage());\r
+            Log_OC.d(TAG, "Access failed: " + result.getLogMessage());\r
         }\r
     }\r
 \r
@@ -874,7 +873,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             break;\r
         }\r
         default:\r
-            Log.e(TAG, "Incorrect dialog called with id = " + id);\r
+            Log_OC.e(TAG, "Incorrect dialog called with id = " + id);\r
         }\r
     }\r
 \r
@@ -897,7 +896,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
                         @Override\r
                         public void onCancel(DialogInterface dialog) {\r
                             /// TODO study if this is enough\r
-                            Log.i(TAG, "Login canceled");\r
+                            Log_OC.i(TAG, "Login canceled");\r
                             if (mOperationThread != null) {\r
                                 mOperationThread.interrupt();\r
                                 finish();\r
@@ -916,7 +915,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             .setOnCancelListener(new DialogInterface.OnCancelListener() {\r
                 @Override\r
                 public void onCancel(DialogInterface dialog) {\r
-                    Log.i(TAG, "Login canceled");\r
+                    Log_OC.i(TAG, "Login canceled");\r
                     finish();\r
                 }\r
             });\r
@@ -942,7 +941,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             break;\r
         }\r
         default:\r
-            Log.e(TAG, "Incorrect dialog called with id = " + id);\r
+            Log_OC.e(TAG, "Incorrect dialog called with id = " + id);\r
         }\r
         return dialog;\r
     }\r