Merge pull request #4637 from nextcloud/fixSingleAccountMode
Enhance single account mode
This commit is contained in:
4 files changed
+38
-6
No files matched your search
@@ -86,6 +86,7 @@ import android.widget.ImageButton;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.TextView.OnEditorActionListener;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.blikoon.qrcodescanner.QrCodeActivity;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
@@ -898,7 +899,14 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
||||
Uri data = intent.getData();
|
||||
|
||||
if (data != null && data.toString().startsWith(getString(R.string.login_data_own_scheme))) {
|
||||
parseAndLoginFromWebView(data.toString());
|
||||
if (!getResources().getBoolean(R.bool.multiaccount_support) &&
|
||||
accountManager.getAccounts().length == 1) {
|
||||
Toast.makeText(this, R.string.no_mutliple_accounts_allowed, Toast.LENGTH_LONG).show();
|
||||
finish();
|
||||
return;
|
||||
} else {
|
||||
parseAndLoginFromWebView(data.toString());
|
||||
}
|
||||
}
|
||||
|
||||
if (intent.getBooleanExtra(EXTRA_USE_PROVIDER_AS_WEBLOGIN, false)) {
|
||||
@@ -926,7 +934,14 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
||||
String dataString = getIntent().getDataString();
|
||||
if (dataString != null) {
|
||||
try {
|
||||
populateLoginFields(dataString);
|
||||
if (!getResources().getBoolean(R.bool.multiaccount_support) &&
|
||||
accountManager.getAccounts().length == 1) {
|
||||
Toast.makeText(this, R.string.no_mutliple_accounts_allowed, Toast.LENGTH_LONG).show();
|
||||
finish();
|
||||
return;
|
||||
} else {
|
||||
populateLoginFields(dataString);
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
DisplayUtils.showSnackMessage(findViewById(R.id.scroll), R.string.auth_illegal_login_used);
|
||||
Log_OC.e(TAG, "Illegal login data URL used, no Login pre-fill!", e);
|
||||
@@ -2057,7 +2072,12 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
||||
return;
|
||||
}
|
||||
|
||||
parseAndLoginFromWebView(result);
|
||||
if (!getResources().getBoolean(R.bool.multiaccount_support) &&
|
||||
accountManager.getAccounts().length == 1) {
|
||||
Toast.makeText(this, R.string.no_mutliple_accounts_allowed, Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
parseAndLoginFromWebView(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.owncloud.android.authentication;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.utils.ThemeUtils;
|
||||
@@ -12,6 +13,12 @@ public class DeepLinkLoginActivity extends AuthenticatorActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if (!getResources().getBoolean(R.bool.multiaccount_support) &&
|
||||
accountManager.getAccounts().length == 1) {
|
||||
Toast.makeText(this, R.string.no_mutliple_accounts_allowed, Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
|
||||
setContentView(R.layout.deep_link_login);
|
||||
|
||||
Uri data = getIntent().getData();
|
||||
|
||||
@@ -104,6 +104,7 @@ public class ManageAccountsActivity extends FileActivity implements AccountListA
|
||||
private Drawable tintedCheck;
|
||||
|
||||
private ArbitraryDataProvider arbitraryDataProvider;
|
||||
private boolean multipleAccountsSupported;
|
||||
|
||||
@Inject UserAccountManager accountManager;
|
||||
|
||||
@@ -136,12 +137,14 @@ public class ManageAccountsActivity extends FileActivity implements AccountListA
|
||||
|
||||
arbitraryDataProvider = new ArbitraryDataProvider(getContentResolver());
|
||||
|
||||
multipleAccountsSupported = getResources().getBoolean(R.bool.multiaccount_support);
|
||||
|
||||
accountListAdapter = new AccountListAdapter(this,
|
||||
accountManager,
|
||||
getAccountListItems(),
|
||||
tintedCheck,
|
||||
this,
|
||||
true);
|
||||
multipleAccountsSupported);
|
||||
|
||||
recyclerView.setAdapter(accountListAdapter);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
@@ -284,7 +287,7 @@ public class ManageAccountsActivity extends FileActivity implements AccountListA
|
||||
getAccountListItems(),
|
||||
tintedCheck,
|
||||
this,
|
||||
true
|
||||
multipleAccountsSupported
|
||||
);
|
||||
recyclerView.setAdapter(accountListAdapter);
|
||||
runOnUiThread(() -> accountListAdapter.notifyDataSetChanged());
|
||||
@@ -336,7 +339,8 @@ public class ManageAccountsActivity extends FileActivity implements AccountListA
|
||||
accountListItemArray,
|
||||
tintedCheck,
|
||||
this,
|
||||
true);
|
||||
multipleAccountsSupported
|
||||
);
|
||||
recyclerView.setAdapter(accountListAdapter);
|
||||
} else {
|
||||
onBackPressed();
|
||||
|
||||
@@ -896,4 +896,5 @@
|
||||
<string name="changelog_dev_version">Changelog dev version</string>
|
||||
<string name="could_not_download_image">Could not download full image</string>
|
||||
<string name="file_detail_activity_error">Error retrieving activities for file</string>
|
||||
<string name="no_mutliple_accounts_allowed">Only one account allowed</string>
|
||||
</resources>
|
||||
Reference in new issue
Block a user