android:orientation="vertical"\r
android:padding="8dp" >\r
\r
- <EditText\r
- android:id="@+id/hostUrlInput"\r
+ <FrameLayout \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: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
- <EditText\r
- android:id="@+id/hostUrlInput"\r
+ <FrameLayout \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
- <TextView\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: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_width="match_parent"\r
android:layout_height="wrap_content"\r
\r
package com.owncloud.android.authentication;\r
\r
+import java.security.spec.MGF1ParameterSpec;\r
+\r
import com.owncloud.android.AccountUtils;\r
import com.owncloud.android.Log_OC;\r
import com.owncloud.android.ui.dialog.SslValidatorDialog;\r
import android.widget.CheckBox;\r
import android.widget.EditText;\r
import android.widget.Button;\r
+import android.widget.ImageButton;\r
import android.widget.TextView;\r
import android.widget.Toast;\r
import android.widget.TextView.OnEditorActionListener;\r
private Account mAccount;\r
\r
private EditText mHostUrlInput;\r
+ private ImageButton mRefreshButton;\r
private EditText mUsernameInput;\r
private EditText mPasswordInput;\r
private CheckBox mOAuth2Check;\r
/// set view and get references to view elements\r
setContentView(R.layout.account_setup);\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
+ boolean refreshButtonEnabled = false;\r
\r
if (savedInstanceState == null) {\r
/// connection state and info\r
mOAuth2Check.setChecked(oAuthRequired);\r
changeViewByOAuth2Check(oAuthRequired);\r
mJustCreated = true;\r
+ \r
+ if (mAction == ACTION_UPDATE_TOKEN) {\r
+ checkOcServer(); \r
+ }\r
\r
} else {\r
/// connection state and info\r
} \r
\r
// refresh button enabled\r
- mRefreshButtonEnabled = savedInstanceState.getBoolean(KEY_REFRESH_BUTTON_ENABLED);\r
+ refreshButtonEnabled = savedInstanceState.getBoolean(KEY_REFRESH_BUTTON_ENABLED);\r
+ \r
\r
}\r
\r
showServerStatus();\r
showAuthStatus();\r
- if (mServerIsChecked && !mServerIsValid && mRefreshButtonEnabled) showRefreshButton();\r
- mOkButton.setEnabled(mServerIsValid); // state not automatically recovered in configuration changes\r
-\r
- if (!OAUTH_MODE_OPTIONAL.equals(getString(R.string.oauth2_mode))) {\r
- mOAuth2Check.setVisibility(View.GONE);\r
- }\r
\r
if (mAction == ACTION_UPDATE_TOKEN) {\r
/// lock things that should not change\r
mUsernameInput.setEnabled(false);\r
mUsernameInput.setFocusable(false);\r
mOAuth2Check.setVisibility(View.GONE);\r
- if (!mServerIsValid && mOcServerChkOperation == null) {\r
- checkOcServer(); \r
- }\r
+ }\r
+ \r
+ //if (mServerIsChecked && !mServerIsValid && mRefreshButtonEnabled) showRefreshButton();\r
+ if (mServerIsChecked && !mServerIsValid && refreshButtonEnabled) showRefreshButton();\r
+ mOkButton.setEnabled(mServerIsValid); // state not automatically recovered in configuration changes\r
+\r
+ if (!OAUTH_MODE_OPTIONAL.equals(getString(R.string.oauth2_mode))) {\r
+ mOAuth2Check.setVisibility(View.GONE);\r
}\r
\r
mPasswordInput.setText(""); // clean password to avoid social hacking (disadvantage: password in removed if the device is turned aside)\r
\r
/// bind view elements to listeners\r
mHostUrlInput.setOnFocusChangeListener(this);\r
- mHostUrlInput.setOnTouchListener(new RightDrawableOnTouchListener() {\r
- @Override\r
- public boolean onDrawableTouch(final MotionEvent event) {\r
- if (event.getAction() == MotionEvent.ACTION_UP) {\r
- AuthenticatorActivity.this.onRefreshClick();\r
- }\r
- return true;\r
- }\r
- });\r
mHostUrlInput.addTextChangedListener(new TextWatcher() {\r
\r
@Override\r
}\r
\r
// refresh button enabled\r
- outState.putBoolean(KEY_REFRESH_BUTTON_ENABLED, mRefreshButtonEnabled);\r
+ //outState.putBoolean(KEY_REFRESH_BUTTON_ENABLED, mRefreshButtonEnabled);\r
+ outState.putBoolean(KEY_REFRESH_BUTTON_ENABLED, (mRefreshButton.getVisibility() == View.VISIBLE));\r
\r
}\r
\r
\r
\r
private void showRefreshButton() {\r
- mHostUrlInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_action_refresh_black, 0);\r
- mRefreshButtonEnabled = true;\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
+ /*mHostUrlInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);\r
+ mRefreshButtonEnabled = false;*/\r
+ mRefreshButton.setVisibility(View.GONE);\r
}\r
\r
/**\r
* \r
* @param view Refresh 'button'\r
*/\r
- public void onRefreshClick() {\r
+ public void onRefreshClick(View view) {\r
checkOcServer();\r
}\r
\r