From: David A. Velasco Date: Tue, 2 Jul 2013 11:08:27 +0000 (+0200) Subject: Merge branch 'develop' into modify_password X-Git-Tag: oc-android-1.4.3~10^2 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/e8239f434aeb23f598080033ec5f15e0b1971f31?ds=inline;hp=-c Merge branch 'develop' into modify_password --- e8239f434aeb23f598080033ec5f15e0b1971f31 diff --combined res/values/strings.xml index f74806f5,4ea31574..7e4ec936 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@@ -51,7 -51,7 +51,7 @@@ Server address Username Password - I am new to %1$s + New to %1$s? Incorrect address given Incorrect session name Files @@@ -95,7 -95,6 +95,7 @@@ Loading … Unknown error About + Change password Delete account Create account Upload from … @@@ -119,14 -118,14 +119,14 @@@ Contacts Synchronization failed Synchronization of %1$s could not be completed - Invalid credentials for %1$s + Invalid password for %1$s Conflicts found %1$d kept-in-sync files could not be sync\'ed Kept-in-sync files failed Contents of %1$d files could not be sync\'ed (%2$d conflicts) Some local files were forgotten %1$d files out of the %2$s directory could not be copied into - "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. + 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. "Move all" "All files were moved" "Some files could not be moved" @@@ -178,14 -177,14 +178,14 @@@ 60 - Trying to login... + Trying to login… No network connection No network connection has been detected, check your Internet connection and try again. Connect anyway Secure connection unavailable. The Application cannot establish a secure connection to the server. A non secure connection is available. You may continue or cancel. Connection established - Testing connection... + Testing connection… Malformed server configuration It seems that your server instance is not correctly configured. Contact your administrator for more details. Unknown error occurred! @@@ -201,14 -200,14 +201,14 @@@ Unrecognized server version Couldn\'t establish connection Secure connection established - Invalid credentials + Wrong username or password Unsuccessful authorization Access denied by authorization server Wrong path given Internal server error, code %1$d Unexpected state; please, enter the server URL again Your authorization expired.\nPlease, authorize again - Your saved credentials are invalid.\nPlease, enter the current credentials + Please, enter the current password Application terminated unexpectedly. Would you like to submit a crash report? Send report diff --combined src/com/owncloud/android/authentication/AuthenticatorActivity.java index cfafc241,6eae48f0..dabe98e8 --- a/src/com/owncloud/android/authentication/AuthenticatorActivity.java +++ b/src/com/owncloud/android/authentication/AuthenticatorActivity.java @@@ -18,9 -18,6 +18,6 @@@ package com.owncloud.android.authentication; - import java.security.spec.MGF1ParameterSpec; - - import com.owncloud.android.AccountUtils; import com.owncloud.android.Log_OC; import com.owncloud.android.ui.dialog.SslValidatorDialog; import com.owncloud.android.ui.dialog.SslValidatorDialog.OnSslValidatorListener; @@@ -63,7 -60,6 +60,7 @@@ import android.view.inputmethod.EditorI import android.widget.CheckBox; import android.widget.EditText; import android.widget.Button; +import android.widget.ImageButton; import android.widget.TextView; import android.widget.Toast; import android.widget.TextView.OnEditorActionListener; @@@ -87,7 -83,6 +84,7 @@@ implements OnRemoteOperationListener, public static final String EXTRA_USER_NAME = "USER_NAME"; public static final String EXTRA_HOST_NAME = "HOST_NAME"; public static final String EXTRA_ACTION = "ACTION"; + public static final String EXTRA_ENFORCED_UPDATE = "ENFORCE_UPDATE"; private static final String KEY_HOST_URL_TEXT = "HOST_URL_TEXT"; private static final String KEY_OC_VERSION = "OC_VERSION"; @@@ -114,7 -109,7 +111,7 @@@ public static final byte ACTION_CREATE = 0; public static final byte ACTION_UPDATE_TOKEN = 1; - + private String mHostBaseUrl; private OwnCloudVersion mDiscoveredVersion; @@@ -136,7 -131,6 +133,7 @@@ private Account mAccount; private EditText mHostUrlInput; + private ImageButton mRefreshButton; private EditText mUsernameInput; private EditText mPasswordInput; private CheckBox mOAuth2Check; @@@ -163,7 -157,6 +160,7 @@@ /// set view and get references to view elements setContentView(R.layout.account_setup); mHostUrlInput = (EditText) findViewById(R.id.hostUrlInput); + mRefreshButton = (ImageButton) findViewById(R.id.refeshButton); mUsernameInput = (EditText) findViewById(R.id.account_username); mPasswordInput = (EditText) findViewById(R.id.account_password); mOAuthAuthEndpointText = (TextView)findViewById(R.id.oAuthEntryPoint_1); @@@ -184,7 -177,6 +181,7 @@@ mAction = getIntent().getByteExtra(EXTRA_ACTION, ACTION_CREATE); mAccount = null; mHostBaseUrl = ""; + boolean refreshButtonEnabled = false; if (savedInstanceState == null) { /// connection state and info @@@ -212,11 -204,7 +209,11 @@@ } mOAuth2Check.setChecked(oAuthRequired); changeViewByOAuth2Check(oAuthRequired); - + mJustCreated = true; + + if (mAction == ACTION_UPDATE_TOKEN) { + checkOcServer(); + } } else { /// connection state and info @@@ -247,35 -235,43 +244,35 @@@ } // refresh button enabled - mRefreshButtonEnabled = savedInstanceState.getBoolean(KEY_REFRESH_BUTTON_ENABLED); + refreshButtonEnabled = savedInstanceState.getBoolean(KEY_REFRESH_BUTTON_ENABLED); + } showServerStatus(); showAuthStatus(); - if (mServerIsChecked && !mServerIsValid && mRefreshButtonEnabled) showRefreshButton(); - mOkButton.setEnabled(mServerIsValid); // state not automatically recovered in configuration changes - - if (!OAUTH_MODE_OPTIONAL.equals(getString(R.string.oauth2_mode))) { - mOAuth2Check.setVisibility(View.GONE); - } if (mAction == ACTION_UPDATE_TOKEN) { /// lock things that should not change mHostUrlInput.setEnabled(false); + mHostUrlInput.setFocusable(false); mUsernameInput.setEnabled(false); + mUsernameInput.setFocusable(false); + mOAuth2Check.setVisibility(View.GONE); + } + + //if (mServerIsChecked && !mServerIsValid && mRefreshButtonEnabled) showRefreshButton(); + if (mServerIsChecked && !mServerIsValid && refreshButtonEnabled) showRefreshButton(); + mOkButton.setEnabled(mServerIsValid); // state not automatically recovered in configuration changes + + if (!OAUTH_MODE_OPTIONAL.equals(getString(R.string.oauth2_mode))) { mOAuth2Check.setVisibility(View.GONE); - if (!mServerIsValid && mOcServerChkOperation == null) { - checkOcServer(); - } } mPasswordInput.setText(""); // clean password to avoid social hacking (disadvantage: password in removed if the device is turned aside) - mJustCreated = true; /// bind view elements to listeners mHostUrlInput.setOnFocusChangeListener(this); - mHostUrlInput.setOnTouchListener(new RightDrawableOnTouchListener() { - @Override - public boolean onDrawableTouch(final MotionEvent event) { - if (event.getAction() == MotionEvent.ACTION_UP) { - AuthenticatorActivity.this.onRefreshClick(); - } - return true; - } - }); mHostUrlInput.addTextChangedListener(new TextWatcher() { @Override @@@ -341,8 -337,7 +338,8 @@@ } // refresh button enabled - outState.putBoolean(KEY_REFRESH_BUTTON_ENABLED, mRefreshButtonEnabled); + //outState.putBoolean(KEY_REFRESH_BUTTON_ENABLED, mRefreshButtonEnabled); + outState.putBoolean(KEY_REFRESH_BUTTON_ENABLED, (mRefreshButton.getVisibility() == View.VISIBLE)); } @@@ -373,7 -368,7 +370,7 @@@ super.onResume(); // the state of mOAuth2Check is automatically recovered between configuration changes, but not before onCreate() finishes; so keep the next lines here changeViewByOAuth2Check(mOAuth2Check.isChecked()); - if (mAction == ACTION_UPDATE_TOKEN && mJustCreated) { + if (mAction == ACTION_UPDATE_TOKEN && mJustCreated && getIntent().getBooleanExtra(EXTRA_ENFORCED_UPDATE, false)) { if (mOAuth2Check.isChecked()) Toast.makeText(this, R.string.auth_expired_oauth_token_toast, Toast.LENGTH_LONG).show(); else @@@ -1198,15 -1193,13 +1195,15 @@@ private void showRefreshButton() { - mHostUrlInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_action_refresh_black, 0); - mRefreshButtonEnabled = true; + /*mHostUrlInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_action_refresh_black, 0); + mRefreshButtonEnabled = true;*/ + mRefreshButton.setVisibility(View.VISIBLE); } private void hideRefreshButton() { - mHostUrlInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); - mRefreshButtonEnabled = false; + /*mHostUrlInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); + mRefreshButtonEnabled = false;*/ + mRefreshButton.setVisibility(View.GONE); } /** @@@ -1216,7 -1209,7 +1213,7 @@@ * * @param view Refresh 'button' */ - public void onRefreshClick() { + public void onRefreshClick(View view) { checkOcServer(); } @@@ -1277,7 -1270,7 +1274,7 @@@ * Called from SslValidatorDialog when a new server certificate was correctly saved. */ public void onSavedCertificate() { - mOperationThread = mOcServerChkOperation.retry(this, mHandler); + checkOcServer(); } /** diff --combined src/com/owncloud/android/ui/activity/AccountSelectActivity.java index 948c4d2b,7428f506..1a1cd51b --- a/src/com/owncloud/android/ui/activity/AccountSelectActivity.java +++ b/src/com/owncloud/android/ui/activity/AccountSelectActivity.java @@@ -47,9 -47,8 +47,9 @@@ import com.actionbarsherlock.app.Sherlo import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuItem; - import com.owncloud.android.AccountUtils; import com.owncloud.android.authentication.AccountAuthenticator; +import com.owncloud.android.authentication.AuthenticatorActivity; + import com.owncloud.android.authentication.AccountUtils; import com.owncloud.android.Log_OC; import com.owncloud.android.R; @@@ -143,17 -142,11 +143,17 @@@ public class AccountSelectActivity exte return false; } + /** + * Called when the user clicked on an item into the context menu created at + * {@link #onCreateContextMenu(ContextMenu, View, ContextMenuInfo)} for every + * ownCloud {@link Account} , containing 'secondary actions' for them. + * + * {@inheritDoc}} + */ @SuppressWarnings("unchecked") @Override public boolean onContextItemSelected(android.view.MenuItem item) { - AdapterContextMenuInfo info = (AdapterContextMenuInfo) item - .getMenuInfo(); + AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); int index = info.position; HashMap map = null; try { @@@ -165,18 -158,11 +165,18 @@@ String accountName = map.get("NAME"); AccountManager am = (AccountManager) getSystemService(ACCOUNT_SERVICE); - Account accounts[] = am - .getAccountsByType(AccountAuthenticator.ACCOUNT_TYPE); + Account accounts[] = am.getAccountsByType(AccountAuthenticator.ACCOUNT_TYPE); for (Account a : accounts) { if (a.name.equals(accountName)) { - am.removeAccount(a, this, mHandler); + if (item.getItemId() == R.id.change_password) { + Intent updateAccountCredentials = new Intent(this, AuthenticatorActivity.class); + updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, a); + updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACTION, AuthenticatorActivity.ACTION_UPDATE_TOKEN); + startActivity(updateAccountCredentials); + + } else if (item.getItemId() == R.id.delete_account) { + am.removeAccount(a, this, mHandler); + } } }