Pārlūkot izejas kodu

Merge pull request #1634 from owncloud/autocheck_default_url

Autocheck default url
Juan Carlos González Cabrero 9 gadi atpakaļ
vecāks
revīzija
a301ae667b

+ 6 - 2
src/com/owncloud/android/authentication/AuthenticatorActivity.java

@@ -366,9 +366,10 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
      * @param savedInstanceState        Saved activity state, as in {{@link #onCreate(Bundle)}
      * @param savedInstanceState        Saved activity state, as in {{@link #onCreate(Bundle)}
      */
      */
     private void initServerPreFragment(Bundle savedInstanceState) {
     private void initServerPreFragment(Bundle savedInstanceState) {
+        boolean checkHostUrl = true;
 
 
         /// step 1 - load and process relevant inputs (resources, intent, savedInstanceState)
         /// step 1 - load and process relevant inputs (resources, intent, savedInstanceState)
-        boolean isUrlInputAllowed = getResources().getBoolean(R.bool.show_server_url_input); 
+        boolean isUrlInputAllowed = getResources().getBoolean(R.bool.show_server_url_input);
         if (savedInstanceState == null) {
         if (savedInstanceState == null) {
             if (mAccount != null) {
             if (mAccount != null) {
                 mServerInfo.mBaseUrl = mAccountMgr.getUserData(mAccount, Constants.KEY_OC_BASE_URL);
                 mServerInfo.mBaseUrl = mAccountMgr.getUserData(mAccount, Constants.KEY_OC_BASE_URL);
@@ -408,6 +409,9 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             mHostUrlInput.setFocusable(false);
             mHostUrlInput.setFocusable(false);
         }
         }
         if (isUrlInputAllowed) {
         if (isUrlInputAllowed) {
+            if (mServerInfo.mBaseUrl.isEmpty()) {
+                checkHostUrl = false;
+            }
             mRefreshButton = findViewById(R.id.embeddedRefreshButton);
             mRefreshButton = findViewById(R.id.embeddedRefreshButton);
         } else {
         } else {
             findViewById(R.id.hostUrlFrame).setVisibility(View.GONE);
             findViewById(R.id.hostUrlFrame).setVisibility(View.GONE);
@@ -471,7 +475,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         
         
         /// step 4 - mark automatic check to be started when OperationsService is ready
         /// step 4 - mark automatic check to be started when OperationsService is ready
         mPendingAutoCheck = (savedInstanceState == null && 
         mPendingAutoCheck = (savedInstanceState == null && 
-                (mAction != ACTION_CREATE || !isUrlInputAllowed));
+                (mAction != ACTION_CREATE || checkHostUrl));
     }
     }