Redirect app to login screen when operations in file details view fail due to bad...
[pub/Android/ownCloud.git] / src / com / owncloud / android / ui / activity / AuthenticatorActivity.java
index ecf71e0..fb5c711 100644 (file)
@@ -112,6 +112,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
     private boolean mStatusCorrect, mIsSslConn;\r
     private RemoteOperationResult mLastSslUntrustedServerResult;\r
 \r
+    public static final String PARAM_ACCOUNTNAME = "param_Accountname";\r
+    \r
     public static final String PARAM_USERNAME = "param_Username";\r
     public static final String PARAM_HOSTNAME = "param_Hostname";\r
 \r
@@ -196,6 +198,19 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             mStatusText = mStatusIcon = 0;\r
             mStatusCorrect = false;\r
             mIsSslConn = false;\r
+            \r
+            String accountName = getIntent().getExtras().getString(PARAM_ACCOUNTNAME);\r
+            String tokenType = getIntent().getExtras().getString(AccountAuthenticator.KEY_AUTH_TOKEN_TYPE);\r
+            if (AccountAuthenticator.AUTH_TOKEN_TYPE_ACCESS_TOKEN.equals(tokenType)) {\r
+                CheckBox oAuth2Check = (CheckBox) findViewById(R.id.oauth_onOff_check);\r
+                oAuth2Check.setChecked(true);\r
+                changeViewByOAuth2Check(true);\r
+            } \r
+            \r
+            if (accountName != null) {\r
+                ((TextView) findViewById(R.id.account_username)).setText(accountName.substring(0, accountName.lastIndexOf('@')));\r
+                tv.setText(accountName.substring(accountName.lastIndexOf('@') + 1));\r
+            }\r
         }\r
         iv.setOnClickListener(this);\r
         iv2.setOnClickListener(this);\r