Merge branch 'develop' into branding_configurable_URL_input_field
authorDavid A. Velasco <dvelasco@solidgear.es>
Fri, 5 Jul 2013 09:52:24 +0000 (11:52 +0200)
committerDavid A. Velasco <dvelasco@solidgear.es>
Fri, 5 Jul 2013 09:52:24 +0000 (11:52 +0200)
1  2 
res/layout-land/account_setup.xml
res/layout/account_setup.xml
res/values/strings.xml
src/com/owncloud/android/authentication/AuthenticatorActivity.java

                            android:gravity="center"\r
                            android:orientation="vertical"\r
                            android:padding="8dp" >\r
\r
++                          \r
 +                              <Button\r
-                                   android:id="@+id/checkServerButton"\r
++                                  android:id="@+id/centeredRefreshButton"\r
 +                                  android:layout_width="wrap_content"\r
 +                                  android:layout_height="wrap_content"\r
 +                                  android:layout_gravity="center_horizontal"\r
++                      android:onClick="onRefreshClick"\r
 +                                  android:text="@string/auth_check_server"\r
 +                                  android:visibility="gone" />\r
                \r
-                               <EditText\r
-                                       android:id="@+id/hostUrlInput"\r
+                           <FrameLayout \r
++                              android:id="@+id/hostUrlFrame"\r
                                        android:layout_width="match_parent"\r
                                        android:layout_height="wrap_content"\r
-                                       android:ems="10"\r
-                                       android:hint="@string/auth_host_url"\r
-                                       android:inputType="textUri"\r
-                                       android:drawablePadding="5dp"\r
-                                       >\r
-                                       <requestFocus />\r
-                               </EditText>\r
+                               >\r
+                                       <EditText\r
+                                               android:id="@+id/hostUrlInput"\r
+                                               android:layout_width="match_parent"\r
+                                               android:layout_height="wrap_content"\r
+                                               android:hint="@string/auth_host_url"\r
+                                               android:inputType="textUri"\r
+                                               android:drawablePadding="5dp"\r
+                                               android:paddingRight="55dp"\r
+                                               >\r
+                                               <requestFocus />\r
+                                       </EditText>\r
+                                       <ImageButton\r
 -                                          android:id="@+id/refeshButton"\r
++                                          android:id="@+id/embeddedRefreshButton"\r
+                                           android:layout_width="48dp"\r
+                                           android:layout_height="48dp"\r
+                                           android:layout_gravity="center_vertical|right"\r
+                                           android:layout_marginRight="5dp"\r
+                                           android:padding="0dp"\r
+                                           android:scaleType="fitCenter"\r
+                                           android:src="@drawable/ic_action_refresh_black"\r
+                               android:onClick="onRefreshClick"\r
+                                           android:visibility="gone"\r
+                                               android:background="@android:color/transparent"\r
+                                           />\r
+                               </FrameLayout>\r
                \r
                                <TextView\r
                                        android:id="@+id/server_status_text"\r
              android:layout_marginTop="10dp"\r
              android:src="@drawable/logo" />\r
  \r
-             android:id="@+id/checkServerButton"\r
 +        <Button\r
-               <EditText\r
-                       android:id="@+id/hostUrlInput"\r
++            android:id="@+id/centeredRefreshButton"\r
 +            android:layout_width="wrap_content"\r
 +            android:layout_height="wrap_content"\r
 +            android:layout_gravity="center_horizontal"\r
++            android:onClick="onRefreshClick"\r
 +            android:text="@string/auth_check_server"\r
 +            android:visibility="gone" />\r
 +\r
+           <FrameLayout \r
++              android:id="@+id/hostUrlFrame"\r
                        android:layout_width="match_parent"\r
                        android:layout_height="wrap_content"\r
-                       android:ems="10"\r
-                       android:hint="@string/auth_host_url"\r
-                       android:inputType="textUri"\r
-                       android:drawablePadding="5dp"\r
-                       >\r
-                       <requestFocus />\r
-               </EditText>\r
+               >\r
+                       <EditText\r
+                               android:id="@+id/hostUrlInput"\r
+                               android:layout_width="match_parent"\r
+                               android:layout_height="wrap_content"\r
+                               android:hint="@string/auth_host_url"\r
+                               android:inputType="textUri"\r
+                               android:drawablePadding="5dp"\r
+                               android:paddingRight="55dp"\r
+                               >\r
+                               <requestFocus />\r
+                       </EditText>\r
+                       <ImageButton\r
 -                          android:id="@+id/refeshButton"\r
++                          android:id="@+id/embeddedRefreshButton"\r
+                           android:layout_width="48dp"\r
+                           android:layout_height="48dp"\r
+                           android:layout_gravity="center_vertical|right"\r
+                           android:layout_marginRight="5dp"\r
+                           android:padding="0dp"\r
+                           android:scaleType="fitCenter"\r
+                           android:src="@drawable/ic_action_refresh_black"\r
+               android:onClick="onRefreshClick"\r
+                               android:visibility="gone"\r
+                               android:background="@android:color/transparent"\r
+                           />\r
+               </FrameLayout>\r
  \r
-         <TextView\r
+               <TextView\r
              android:id="@+id/server_status_text"\r
              android:layout_width="match_parent"\r
              android:layout_height="wrap_content"\r
Simple merge
@@@ -132,8 -132,8 +131,8 @@@ implements  OnRemoteOperationListener, 
      private byte mAction;\r
      private Account mAccount;\r
  \r
-     private Button mCheckServerButton;\r
      private EditText mHostUrlInput;\r
 -    private ImageButton mRefreshButton;\r
++    private View mRefreshButton;\r
      private EditText mUsernameInput;\r
      private EditText mPasswordInput;\r
      private CheckBox mOAuth2Check;\r
  \r
          /// set view and get references to view elements\r
          setContentView(R.layout.account_setup);\r
-         mCheckServerButton = (Button) findViewById(R.id.checkServerButton);\r
          mHostUrlInput = (EditText) findViewById(R.id.hostUrlInput);\r
 -        mRefreshButton = (ImageButton) findViewById(R.id.refeshButton);\r
          mUsernameInput = (EditText) findViewById(R.id.account_username);\r
          mPasswordInput = (EditText) findViewById(R.id.account_password);\r
          mOAuthAuthEndpointText = (TextView)findViewById(R.id.oAuthEntryPoint_1);\r
          mAction = getIntent().getByteExtra(EXTRA_ACTION, ACTION_CREATE); \r
          mAccount = null;\r
          mHostBaseUrl = "";\r
-         // URL Branding\r
+         boolean refreshButtonEnabled = false;\r
 +        \r
-             mHostUrlInput.setVisibility(View.GONE);\r
-             \r
-             mCheckServerButton.setVisibility(View.VISIBLE);\r
-             mCheckServerButton.setOnClickListener(new OnClickListener() {\r
-                 \r
-                 @Override\r
-                 public void onClick(View v) {\r
-                     checkOcServer();\r
-                     \r
-                 }\r
-             });\r
++        // URL input configuration applied\r
 +        if (!mHostUrlInputEnabled)\r
 +        {\r
 +            mHostUrlInput.setText(getString(R.string.server_url));\r
-             checkOcServer();\r
++            findViewById(R.id.hostUrlFrame).setVisibility(View.GONE);\r
 +            \r
++            mRefreshButton = findViewById(R.id.centeredRefreshButton);\r
++\r
++        } else {\r
++            mRefreshButton = findViewById(R.id.embeddedRefreshButton);\r
 +        }\r
  \r
          if (savedInstanceState == null) {\r
              /// connection state and info\r
              }\r
              mOAuth2Check.setChecked(oAuthRequired);\r
              changeViewByOAuth2Check(oAuthRequired);\r
\r
+             mJustCreated = true;\r
+             \r
 -            if (mAction == ACTION_UPDATE_TOKEN) {\r
++            if (mAction == ACTION_UPDATE_TOKEN || !mHostUrlInputEnabled) {\r
+                 checkOcServer(); \r
+             }\r
  \r
          } else {\r
              /// connection state and info\r
  \r
  \r
      private void showRefreshButton() {\r
-         mHostUrlInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_action_refresh_black, 0);\r
-         mRefreshButtonEnabled = true;\r
-         \r
-         if (!mHostUrlInputEnabled){\r
-            mCheckServerButton.setVisibility(View.VISIBLE); \r
-         }\r
 -        /*mHostUrlInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_action_refresh_black, 0);\r
 -        mRefreshButtonEnabled = true;*/\r
+         mRefreshButton.setVisibility(View.VISIBLE);\r
      }\r
  \r
      private void hideRefreshButton() {\r
-         mHostUrlInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);\r
-         mRefreshButtonEnabled = false;\r
-         \r
-         if (!mHostUrlInputEnabled){\r
-             mCheckServerButton.setVisibility(View.INVISIBLE); \r
-         }\r
 -        /*mHostUrlInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);\r
 -        mRefreshButtonEnabled = false;*/\r
+         mRefreshButton.setVisibility(View.GONE);\r
      }\r
  \r
      /**\r