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
<string name="prefs_log_summary_history">This shows the recorded logs</string>
<string name="prefs_log_delete_history_button">Delete History</string>
+ <string name="auth_check_server">Check Server</string>
<string name="auth_host_url">Server address</string>
<string name="auth_username">Username</string>
<string name="auth_password">Password</string>
- <string name="auth_register">I am new to %1$s</string>
+ <string name="auth_register">New to %1$s?</string>
<string name="new_session_uri_error">Incorrect address given</string>
<string name="new_session_session_name_error">Incorrect session name</string>
<string name="sync_string_files">Files</string>
<string name="common_loading">Loading …</string>
<string name="common_error_unknown">Unknown error</string>
<string name="about_title">About</string>
+ <string name="change_password">Change password</string>
<string name="delete_account">Delete account</string>
<string name="create_account">Create account</string>
<string name="upload_chooser_title">Upload from …</string>
<string name="sync_string_contacts">Contacts</string>
<string name="sync_fail_ticker">Synchronization failed</string>
<string name="sync_fail_content">Synchronization of %1$s could not be completed</string>
- <string name="sync_fail_content_unauthorized">Invalid credentials for %1$s</string>
+ <string name="sync_fail_content_unauthorized">Invalid password for %1$s</string>
<string name="sync_conflicts_in_favourites_ticker">Conflicts found</string>
<string name="sync_conflicts_in_favourites_content">%1$d kept-in-sync files could not be sync\'ed</string>
<string name="sync_fail_in_favourites_ticker">Kept-in-sync files failed</string>
<string name="sync_fail_in_favourites_content">Contents of %1$d files could not be sync\'ed (%2$d conflicts)</string>
<string name="sync_foreign_files_forgotten_ticker">Some local files were forgotten</string>
<string name="sync_foreign_files_forgotten_content">%1$d files out of the %2$s directory could not be copied into</string>
- <string name="sync_foreign_files_forgotten_explanation">"As of version 1.3.16, files uploaded from this device are copied into the local %1$s folder to prevent data loss when a single file is synced with multiple accounts.\n\nDue to this change, all files uploaded in previous versions of this app were copied into the %2$s folder. However, an error prevented the completion of this operation during account synchronization. You may either leave the file(s) as is and remove the link to %3$s, or move the file(s) into the %1$s directory and retain the link to %4$s.\n\nListed below are the local file(s), and the the remote file(s) in %5$s they were linked to.</string>
+ <string name="sync_foreign_files_forgotten_explanation">As of version 1.3.16, files uploaded from this device are copied into the local %1$s folder to prevent data loss when a single file is synced with multiple accounts.\n\nDue to this change, all files uploaded in previous versions of this app were copied into the %2$s folder. However, an error prevented the completion of this operation during account synchronization. You may either leave the file(s) as is and remove the link to %3$s, or move the file(s) into the %1$s directory and retain the link to %4$s.\n\nListed below are the local file(s), and the the remote file(s) in %5$s they were linked to.</string>
<string name="foreign_files_move">"Move all"</string>
<string name="foreign_files_success">"All files were moved"</string>
<string name="foreign_files_fail">"Some files could not be moved"</string>
<item>60</item>
</string-array>
- <string name="auth_trying_to_login">Trying to login...</string>
+ <string name="auth_trying_to_login">Trying to login…</string>
<string name="auth_no_net_conn_title">No network connection</string>
<string name="auth_no_net_conn_message">No network connection has been detected, check your Internet connection and try again.</string>
<string name="auth_connect_anyway">Connect anyway</string>
<string name="auth_nossl_plain_ok_title">Secure connection unavailable.</string>
<string name="auth_nossl_plain_ok_message">The Application cannot establish a secure connection to the server. A non secure connection is available. You may continue or cancel.</string>
<string name="auth_connection_established">Connection established</string>
- <string name="auth_testing_connection">Testing connection...</string>
+ <string name="auth_testing_connection">Testing connection…</string>
<string name="auth_not_configured_title">Malformed server configuration</string>
<string name="auth_not_configured_message">It seems that your server instance is not correctly configured. Contact your administrator for more details.</string>
<string name="auth_unknown_error_title">Unknown error occurred!</string>
<string name="auth_bad_oc_version_title">Unrecognized server version</string>
<string name="auth_wrong_connection_title">Couldn\'t establish connection</string>
<string name="auth_secure_connection">Secure connection established</string>
- <string name="auth_unauthorized">Invalid credentials</string>
+ <string name="auth_unauthorized">Wrong username or password</string>
<string name="auth_oauth_error">Unsuccessful authorization</string>
<string name="auth_oauth_error_access_denied">Access denied by authorization server</string>
<string name="auth_not_found">Wrong path given</string>
<string name="auth_internal">Internal server error, code %1$d</string>
<string name="auth_wtf_reenter_URL">Unexpected state; please, enter the server URL again</string>
<string name="auth_expired_oauth_token_toast">Your authorization expired.\nPlease, authorize again</string>
- <string name="auth_expired_basic_auth_toast">Your saved credentials are invalid.\nPlease, enter the current credentials</string>
+ <string name="auth_expired_basic_auth_toast">Please, enter the current password</string>
<string name="crashlog_message">Application terminated unexpectedly. Would you like to submit a crash report?</string>
<string name="crashlog_send_report">Send report</string>
\r
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 android.view.KeyEvent;\r
import android.view.MotionEvent;\r
import android.view.View;\r
- import android.view.View.OnClickListener;\r
import android.view.View.OnFocusChangeListener;\r
import android.view.View.OnTouchListener;\r
import android.view.Window;\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
public static final String EXTRA_USER_NAME = "USER_NAME";\r
public static final String EXTRA_HOST_NAME = "HOST_NAME";\r
public static final String EXTRA_ACTION = "ACTION";\r
+ public static final String EXTRA_ENFORCED_UPDATE = "ENFORCE_UPDATE";\r
\r
private static final String KEY_HOST_URL_TEXT = "HOST_URL_TEXT";\r
private static final String KEY_OC_VERSION = "OC_VERSION";\r
\r
public static final byte ACTION_CREATE = 0;\r
public static final byte ACTION_UPDATE_TOKEN = 1;\r
- \r
+ \r
private String mHostBaseUrl;\r
private OwnCloudVersion mDiscoveredVersion;\r
\r
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
private TextView mOAuthTokenEndpointText;\r
\r
private boolean mRefreshButtonEnabled;\r
+ \r
+ private boolean mHostUrlInputEnabled;\r
\r
\r
/**\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
mOAuth2Check = (CheckBox) findViewById(R.id.oauth_onOff_check);\r
mOkButton = findViewById(R.id.buttonOK);\r
mAuthStatusLayout = (TextView) findViewById(R.id.auth_status_text); \r
+ \r
+ /// set Host Url Input Enabled\r
+ mHostUrlInputEnabled = getResources().getBoolean(R.bool.show_server_url_input);\r
+ \r
\r
/// complete label for 'register account' button\r
Button b = (Button) findViewById(R.id.account_register);\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
// 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
mHostUrlInput.setEnabled(false);\r
+ mHostUrlInput.setFocusable(false);\r
mUsernameInput.setEnabled(false);\r
+ mUsernameInput.setFocusable(false);\r
+ mOAuth2Check.setVisibility(View.GONE);\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
- if (!mServerIsValid && mOcServerChkOperation == null) {\r
- checkOcServer(); \r
- }\r
}\r
\r
mPasswordInput.setText(""); // clean password to avoid social hacking (disadvantage: password in removed if the device is turned aside)\r
- mJustCreated = true;\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
super.onResume();\r
// the state of mOAuth2Check is automatically recovered between configuration changes, but not before onCreate() finishes; so keep the next lines here\r
changeViewByOAuth2Check(mOAuth2Check.isChecked()); \r
- if (mAction == ACTION_UPDATE_TOKEN && mJustCreated) {\r
+ if (mAction == ACTION_UPDATE_TOKEN && mJustCreated && getIntent().getBooleanExtra(EXTRA_ENFORCED_UPDATE, false)) {\r
if (mOAuth2Check.isChecked())\r
Toast.makeText(this, R.string.auth_expired_oauth_token_toast, Toast.LENGTH_LONG).show();\r
else\r
\r
private void checkOcServer() {\r
String uri = trimUrlWebdav(mHostUrlInput.getText().toString().trim());\r
+ \r
+ if (!mHostUrlInputEnabled){\r
+ uri = getString(R.string.server_url);\r
+ }\r
+ \r
mServerIsValid = false;\r
mServerIsChecked = false;\r
mOkButton.setEnabled(false);\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
* \r
* @param view Refresh 'button'\r
*/\r
- public void onRefreshClick() {\r
+ public void onRefreshClick(View view) {\r
checkOcServer();\r
}\r
\r
* Called from SslValidatorDialog when a new server certificate was correctly saved.\r
*/\r
public void onSavedCertificate() {\r
- mOperationThread = mOcServerChkOperation.retry(this, mHandler); \r
+ checkOcServer();\r
}\r
\r
/**\r