|
@@ -73,7 +73,6 @@ import android.webkit.WebResourceRequest;
|
|
|
import android.webkit.WebResourceResponse;
|
|
|
import android.webkit.WebView;
|
|
|
import android.webkit.WebViewClient;
|
|
|
-import android.widget.EditText;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.ProgressBar;
|
|
|
import android.widget.TextView;
|
|
@@ -91,6 +90,8 @@ import com.nextcloud.client.onboarding.OnboardingService;
|
|
|
import com.nextcloud.client.preferences.AppPreferences;
|
|
|
import com.owncloud.android.MainApp;
|
|
|
import com.owncloud.android.R;
|
|
|
+import com.owncloud.android.databinding.AccountSetupBinding;
|
|
|
+import com.owncloud.android.databinding.AccountSetupWebviewBinding;
|
|
|
import com.owncloud.android.lib.common.OwnCloudAccount;
|
|
|
import com.owncloud.android.lib.common.OwnCloudClient;
|
|
|
import com.owncloud.android.lib.common.OwnCloudClientFactory;
|
|
@@ -198,7 +199,6 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
private static final int REQUEST_CODE_QR_SCAN = 101;
|
|
|
public static final int REQUEST_CODE_FIRST_RUN = 102;
|
|
|
|
|
|
-
|
|
|
/// parameters from EXTRAs in starter Intent
|
|
|
private byte mAction;
|
|
|
private Account mAccount;
|
|
@@ -210,8 +210,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
private AccountManager mAccountMgr;
|
|
|
|
|
|
/// Server PRE-Fragment elements
|
|
|
- private EditText mHostUrlInput;
|
|
|
- private TextView mServerStatusView;
|
|
|
+ private AccountSetupBinding accountSetupBinding;
|
|
|
+ private AccountSetupWebviewBinding accountSetupWebviewBinding;
|
|
|
|
|
|
private String mServerStatusText = EMPTY_STRING;
|
|
|
private int mServerStatusIcon;
|
|
@@ -219,9 +219,6 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
private GetServerInfoOperation.ServerInfo mServerInfo = new GetServerInfoOperation.ServerInfo();
|
|
|
|
|
|
/// Authentication PRE-Fragment elements
|
|
|
- private TextView mAuthStatusView;
|
|
|
- private WebView mLoginWebView;
|
|
|
-
|
|
|
private WebViewFidoBridge webViewFidoU2fBridge;
|
|
|
private WebViewWebauthnBridge webViewWebauthnBridge;
|
|
|
|
|
@@ -308,11 +305,12 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
/// load user interface
|
|
|
if (webViewLoginMethod) {
|
|
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
|
|
- setContentView(R.layout.account_setup_webview);
|
|
|
- mLoginWebView = findViewById(R.id.login_webview);
|
|
|
+ accountSetupWebviewBinding = AccountSetupWebviewBinding.inflate(getLayoutInflater());
|
|
|
+ setContentView(accountSetupWebviewBinding.getRoot());
|
|
|
initWebViewLogin(webloginUrl, false);
|
|
|
} else {
|
|
|
- setContentView(R.layout.account_setup);
|
|
|
+ accountSetupBinding = AccountSetupBinding.inflate(getLayoutInflater());
|
|
|
+ setContentView(accountSetupBinding.getRoot());
|
|
|
|
|
|
/// initialize general UI elements
|
|
|
initOverallUi();
|
|
@@ -321,7 +319,6 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
|
|
|
/// initialize block to be moved to single Fragment to retrieve and validate credentials
|
|
|
initAuthorizationPreFragment(savedInstanceState);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
initServerPreFragment(savedInstanceState);
|
|
@@ -344,32 +341,32 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
@SuppressFBWarnings("ANDROID_WEB_VIEW_JAVASCRIPT")
|
|
|
@SuppressLint("SetJavaScriptEnabled")
|
|
|
private void initWebViewLogin(String baseURL, boolean useGenericUserAgent) {
|
|
|
- mLoginWebView.setVisibility(View.GONE);
|
|
|
-
|
|
|
- final ProgressBar progressBar = findViewById(R.id.login_webview_progress_bar);
|
|
|
+ accountSetupWebviewBinding.loginWebview.setVisibility(View.GONE);
|
|
|
|
|
|
- mLoginWebView.getSettings().setAllowFileAccess(false);
|
|
|
- mLoginWebView.getSettings().setJavaScriptEnabled(true);
|
|
|
- mLoginWebView.getSettings().setDomStorageEnabled(true);
|
|
|
+ accountSetupWebviewBinding.loginWebview.getSettings().setAllowFileAccess(false);
|
|
|
+ accountSetupWebviewBinding.loginWebview.getSettings().setJavaScriptEnabled(true);
|
|
|
+ accountSetupWebviewBinding.loginWebview.getSettings().setDomStorageEnabled(true);
|
|
|
|
|
|
if (useGenericUserAgent) {
|
|
|
- mLoginWebView.getSettings().setUserAgentString(MainApp.getUserAgent());
|
|
|
+ accountSetupWebviewBinding.loginWebview.getSettings().setUserAgentString(MainApp.getUserAgent());
|
|
|
} else {
|
|
|
- mLoginWebView.getSettings().setUserAgentString(getWebLoginUserAgent());
|
|
|
+ accountSetupWebviewBinding.loginWebview.getSettings().setUserAgentString(getWebLoginUserAgent());
|
|
|
}
|
|
|
- mLoginWebView.getSettings().setSaveFormData(false);
|
|
|
- mLoginWebView.getSettings().setSavePassword(false);
|
|
|
+ accountSetupWebviewBinding.loginWebview.getSettings().setSaveFormData(false);
|
|
|
+ accountSetupWebviewBinding.loginWebview.getSettings().setSavePassword(false);
|
|
|
|
|
|
FidoDialogOptions.Builder dialogOptionsBuilder = FidoDialogOptions.builder();
|
|
|
dialogOptionsBuilder.setShowSdkLogo(true);
|
|
|
dialogOptionsBuilder.setTheme(R.style.FidoDialog);
|
|
|
- webViewFidoU2fBridge = WebViewFidoBridge.createInstanceForWebView(this, mLoginWebView, dialogOptionsBuilder);
|
|
|
+ webViewFidoU2fBridge = WebViewFidoBridge.createInstanceForWebView(
|
|
|
+ this, accountSetupWebviewBinding.loginWebview, dialogOptionsBuilder);
|
|
|
|
|
|
WebauthnDialogOptions.Builder webauthnOptionsBuilder = WebauthnDialogOptions.builder();
|
|
|
webauthnOptionsBuilder.setShowSdkLogo(true);
|
|
|
webauthnOptionsBuilder.setAllowSkipPin(true);
|
|
|
webauthnOptionsBuilder.setTheme(R.style.FidoDialog);
|
|
|
- webViewWebauthnBridge = WebViewWebauthnBridge.createInstanceForWebView(this, mLoginWebView, webauthnOptionsBuilder);
|
|
|
+ webViewWebauthnBridge = WebViewWebauthnBridge.createInstanceForWebView(
|
|
|
+ this, accountSetupWebviewBinding.loginWebview, webauthnOptionsBuilder);
|
|
|
|
|
|
Map<String, String> headers = new HashMap<>();
|
|
|
headers.put(RemoteOperation.OCS_API_HEADER, RemoteOperation.OCS_API_HEADER_VALUE);
|
|
@@ -381,17 +378,17 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
url = getResources().getString(R.string.webview_login_url);
|
|
|
}
|
|
|
|
|
|
- mLoginWebView.loadUrl(url, headers);
|
|
|
+ accountSetupWebviewBinding.loginWebview.loadUrl(url, headers);
|
|
|
|
|
|
- setClient(progressBar);
|
|
|
+ setClient();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
|
|
- if (mLoginWebView != null && event.getAction() == KeyEvent.ACTION_DOWN &&
|
|
|
+ if (accountSetupWebviewBinding != null && event.getAction() == KeyEvent.ACTION_DOWN &&
|
|
|
keyCode == KeyEvent.KEYCODE_BACK) {
|
|
|
- if (mLoginWebView.canGoBack()) {
|
|
|
- mLoginWebView.goBack();
|
|
|
+ if (accountSetupWebviewBinding.loginWebview.canGoBack()) {
|
|
|
+ accountSetupWebviewBinding.loginWebview.goBack();
|
|
|
} else {
|
|
|
finish();
|
|
|
}
|
|
@@ -400,8 +397,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
return super.onKeyDown(keyCode, event);
|
|
|
}
|
|
|
|
|
|
- private void setClient(ProgressBar progressBar) {
|
|
|
- mLoginWebView.setWebViewClient(new WebViewClient() {
|
|
|
+ private void setClient() {
|
|
|
+ accountSetupWebviewBinding.loginWebview.setWebViewClient(new WebViewClient() {
|
|
|
@Override
|
|
|
public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {
|
|
|
webViewFidoU2fBridge.delegateShouldInterceptRequest(view, request);
|
|
@@ -429,8 +426,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
public void onPageFinished(WebView view, String url) {
|
|
|
super.onPageFinished(view, url);
|
|
|
|
|
|
- progressBar.setVisibility(View.GONE);
|
|
|
- mLoginWebView.setVisibility(View.VISIBLE);
|
|
|
+ accountSetupWebviewBinding.loginWebviewProgressBar.setVisibility(View.GONE);
|
|
|
+ accountSetupWebviewBinding.loginWebview.setVisibility(View.VISIBLE);
|
|
|
|
|
|
ThemeUtils.colorStatusBar(AuthenticatorActivity.this, primaryColor);
|
|
|
getWindow().setNavigationBarColor(primaryColor);
|
|
@@ -452,14 +449,14 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
}
|
|
|
|
|
|
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
|
|
|
- progressBar.setVisibility(View.GONE);
|
|
|
- mLoginWebView.setVisibility(View.VISIBLE);
|
|
|
+ accountSetupWebviewBinding.loginWebviewProgressBar.setVisibility(View.GONE);
|
|
|
+ accountSetupWebviewBinding.loginWebview.setVisibility(View.VISIBLE);
|
|
|
|
|
|
InputStream resources = getResources().openRawResource(R.raw.custom_error);
|
|
|
String customError = DisplayUtils.getData(resources);
|
|
|
|
|
|
if (!customError.isEmpty()) {
|
|
|
- mLoginWebView.loadData(customError, "text/html; charset=UTF-8", null);
|
|
|
+ accountSetupWebviewBinding.loginWebview.loadData(customError, "text/html; charset=UTF-8", null);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
@@ -470,8 +467,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
String prefix = getString(R.string.login_data_own_scheme) + PROTOCOL_SUFFIX + "login/";
|
|
|
LoginUrlInfo loginUrlInfo = parseLoginDataUrl(prefix, dataString);
|
|
|
|
|
|
- if (mHostUrlInput != null) {
|
|
|
- mHostUrlInput.setText("");
|
|
|
+ if (accountSetupBinding != null) {
|
|
|
+ accountSetupBinding.hostUrlInput.setText("");
|
|
|
}
|
|
|
mServerInfo.mBaseUrl = AuthenticatorUrlUtils.normalizeUrlSuffix(loginUrlInfo.serverAddress);
|
|
|
webViewUser = loginUrlInfo.username;
|
|
@@ -530,23 +527,20 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
* Configures elements in the user interface under direct control of the Activity.
|
|
|
*/
|
|
|
private void initOverallUi() {
|
|
|
- mHostUrlInput = findViewById(R.id.host_url_input);
|
|
|
- mAuthStatusView = findViewById(R.id.auth_status_text);
|
|
|
- mServerStatusView = findViewById(R.id.server_status_text);
|
|
|
+ accountSetupBinding.hostUrlContainer.setEndIconOnClickListener(v -> checkOcServer());
|
|
|
+
|
|
|
+ accountSetupBinding.hostUrlInputHelperText.setText(
|
|
|
+ String.format(getString(R.string.login_url_helper_text), getString(R.string.app_name)));
|
|
|
|
|
|
- ImageView scanQR = findViewById(R.id.scan_qr);
|
|
|
if (deviceInfo.hasCamera(this)) {
|
|
|
- scanQR.setOnClickListener(v -> onScan());
|
|
|
- ThemeUtils.tintDrawable(scanQR.getDrawable(), getResources().getColor(R.color.login_text_color));
|
|
|
+ accountSetupBinding.scanQr.setOnClickListener(v -> onScan());
|
|
|
+ ThemeUtils.tintDrawable(accountSetupBinding.scanQr.getDrawable(),
|
|
|
+ getResources().getColor(R.color.login_text_color));
|
|
|
} else {
|
|
|
- scanQR.setVisibility(View.GONE);
|
|
|
+ accountSetupBinding.scanQr.setVisibility(View.GONE);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void onTestServerConnectionClick(View v) {
|
|
|
- checkOcServer();
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* @param savedInstanceState Saved activity state, as in {{@link #onCreate(Bundle)}
|
|
|
*/
|
|
@@ -588,10 +582,6 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
* @param savedInstanceState Saved activity state, as in {{@link #onCreate(Bundle)}
|
|
|
*/
|
|
|
private void initAuthorizationPreFragment(Bundle savedInstanceState) {
|
|
|
-
|
|
|
- /// step 0 - get UI elements in layout
|
|
|
- mAuthStatusView = findViewById(R.id.auth_status_text);
|
|
|
-
|
|
|
/// step 1 - load and process relevant inputs (resources, intent, savedInstanceState)
|
|
|
if (savedInstanceState != null) {
|
|
|
mAuthStatusText = savedInstanceState.getString(KEY_AUTH_STATUS_TEXT);
|
|
@@ -601,8 +591,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
/// step 2 - set properties of UI elements (text, visibility, enabled...)
|
|
|
showAuthStatus();
|
|
|
|
|
|
- mHostUrlInput.setImeOptions(EditorInfo.IME_ACTION_NEXT);
|
|
|
- mHostUrlInput.setOnEditorActionListener(this);
|
|
|
+ accountSetupBinding.hostUrlInput.setImeOptions(EditorInfo.IME_ACTION_NEXT);
|
|
|
+ accountSetupBinding.hostUrlInput.setOnEditorActionListener(this);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -689,8 +679,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
}
|
|
|
|
|
|
if (intent.getBooleanExtra(EXTRA_USE_PROVIDER_AS_WEBLOGIN, false)) {
|
|
|
- setContentView(R.layout.account_setup_webview);
|
|
|
- mLoginWebView = findViewById(R.id.login_webview);
|
|
|
+ accountSetupWebviewBinding = AccountSetupWebviewBinding.inflate(getLayoutInflater());
|
|
|
+ setContentView(accountSetupWebviewBinding.getRoot());
|
|
|
initWebViewLogin(getString(R.string.provider_registration_server), true);
|
|
|
}
|
|
|
}
|
|
@@ -719,7 +709,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
if (!bindService(new Intent(this, OperationsService.class),
|
|
|
mOperationsServiceConnection,
|
|
|
Context.BIND_AUTO_CREATE)) {
|
|
|
- DisplayUtils.showSnackMessage(findViewById(R.id.scroll), R.string.error_cant_bind_to_operations_service);
|
|
|
+ DisplayUtils.showSnackMessage(accountSetupBinding.scroll, R.string.error_cant_bind_to_operations_service);
|
|
|
finish();
|
|
|
}
|
|
|
|
|
@@ -753,8 +743,9 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
|
|
|
private void checkOcServer() {
|
|
|
String uri;
|
|
|
- if (mHostUrlInput != null && !mHostUrlInput.getText().toString().isEmpty()) {
|
|
|
- uri = mHostUrlInput.getText().toString().trim();
|
|
|
+ if (accountSetupBinding != null && accountSetupBinding.hostUrlInput.getText()!= null &&
|
|
|
+ !accountSetupBinding.hostUrlInput.getText().toString().isEmpty()) {
|
|
|
+ uri = accountSetupBinding.hostUrlInput.getText().toString().trim();
|
|
|
} else {
|
|
|
uri = mServerInfo.mBaseUrl;
|
|
|
}
|
|
@@ -762,9 +753,9 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
mServerInfo = new GetServerInfoOperation.ServerInfo();
|
|
|
|
|
|
if (uri.length() != 0) {
|
|
|
- if (mHostUrlInput != null) {
|
|
|
+ if (accountSetupBinding != null) {
|
|
|
uri = AuthenticatorUrlUtils.stripIndexPhpOrAppsFiles(uri);
|
|
|
- mHostUrlInput.setText(uri);
|
|
|
+ accountSetupBinding.hostUrlInput.setText(uri);
|
|
|
}
|
|
|
|
|
|
// Handle internationalized domain names
|
|
@@ -775,7 +766,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
Log_OC.e(TAG, "Error converting internationalized domain name " + uri, ex);
|
|
|
}
|
|
|
|
|
|
- if (mHostUrlInput != null) {
|
|
|
+ if (accountSetupBinding != null) {
|
|
|
mServerStatusText = getResources().getString(R.string.auth_testing_connection);
|
|
|
mServerStatusIcon = R.drawable.progress_small;
|
|
|
showServerStatus();
|
|
@@ -852,7 +843,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
|
|
|
} catch (AccountNotFoundException e) {
|
|
|
Log_OC.e(TAG, "Account " + mAccount + " was removed!", e);
|
|
|
- DisplayUtils.showSnackMessage(findViewById(R.id.scroll), R.string.auth_account_does_not_exist);
|
|
|
+ DisplayUtils.showSnackMessage(accountSetupBinding.scroll, R.string.auth_account_does_not_exist);
|
|
|
finish();
|
|
|
}
|
|
|
}
|
|
@@ -915,8 +906,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
}
|
|
|
}).start();
|
|
|
|
|
|
- setContentView(R.layout.account_setup_webview);
|
|
|
- mLoginWebView = findViewById(R.id.login_webview);
|
|
|
+ accountSetupWebviewBinding = AccountSetupWebviewBinding.inflate(getLayoutInflater());
|
|
|
+ setContentView(accountSetupWebviewBinding.getRoot());
|
|
|
initWebViewLogin(mServerInfo.mBaseUrl + WEB_LOGIN, false);
|
|
|
}
|
|
|
} else {
|
|
@@ -946,7 +937,13 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
|
|
|
case OK_NO_SSL:
|
|
|
case OK:
|
|
|
- if (mHostUrlInput.getText().toString().trim().toLowerCase(Locale.ROOT).startsWith(HTTP_PROTOCOL)) {
|
|
|
+ if (accountSetupBinding.hostUrlInput.getText() != null &&
|
|
|
+ accountSetupBinding.hostUrlInput
|
|
|
+ .getText()
|
|
|
+ .toString()
|
|
|
+ .trim()
|
|
|
+ .toLowerCase(Locale.ROOT)
|
|
|
+ .startsWith(HTTP_PROTOCOL)) {
|
|
|
mServerStatusText = getResources().getString(R.string.auth_connection_established);
|
|
|
mServerStatusIcon = R.drawable.ic_ok;
|
|
|
} else {
|
|
@@ -1044,7 +1041,13 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
case OK_NO_SSL:
|
|
|
case OK:
|
|
|
if (showWebViewLoginUrl) {
|
|
|
- if (mHostUrlInput.getText().toString().trim().toLowerCase(Locale.ROOT).startsWith(HTTP_PROTOCOL)) {
|
|
|
+ if (accountSetupBinding.hostUrlInput.getText() != null &&
|
|
|
+ accountSetupBinding.hostUrlInput
|
|
|
+ .getText()
|
|
|
+ .toString()
|
|
|
+ .trim()
|
|
|
+ .toLowerCase(Locale.ROOT)
|
|
|
+ .startsWith(HTTP_PROTOCOL)) {
|
|
|
mAuthStatusText = getResources().getString(R.string.auth_connection_established);
|
|
|
mAuthStatusIcon = R.drawable.ic_ok;
|
|
|
} else {
|
|
@@ -1115,7 +1118,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
|
|
|
} catch (AccountNotFoundException e) {
|
|
|
Log_OC.e(TAG, "Account " + mAccount + " was removed!", e);
|
|
|
- DisplayUtils.showSnackMessage(findViewById(R.id.scroll), R.string.auth_account_does_not_exist);
|
|
|
+ DisplayUtils.showSnackMessage(accountSetupBinding.scroll, R.string.auth_account_does_not_exist);
|
|
|
finish();
|
|
|
}
|
|
|
}
|
|
@@ -1137,15 +1140,15 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
}
|
|
|
} else {
|
|
|
// init webView again
|
|
|
- if (mLoginWebView != null) {
|
|
|
- mLoginWebView.setVisibility(View.GONE);
|
|
|
+ if (accountSetupWebviewBinding != null) {
|
|
|
+ accountSetupWebviewBinding.loginWebview.setVisibility(View.GONE);
|
|
|
}
|
|
|
- setContentView(R.layout.account_setup);
|
|
|
+ accountSetupBinding = AccountSetupBinding.inflate(getLayoutInflater());
|
|
|
+ setContentView(accountSetupBinding.getRoot());
|
|
|
initOverallUi();
|
|
|
|
|
|
- mAuthStatusView = findViewById(R.id.auth_status_text);
|
|
|
- mHostUrlInput.setText(mServerInfo.mBaseUrl);
|
|
|
- mServerStatusView.setVisibility(View.GONE);
|
|
|
+ accountSetupBinding.hostUrlInput.setText(mServerInfo.mBaseUrl);
|
|
|
+ accountSetupBinding.serverStatusText.setVisibility(View.GONE);
|
|
|
showAuthStatus();
|
|
|
}
|
|
|
|
|
@@ -1165,17 +1168,15 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
}
|
|
|
|
|
|
} else { // authorization fail due to client side - probably wrong credentials
|
|
|
- mLoginWebView = findViewById(R.id.login_webview);
|
|
|
-
|
|
|
- if (mLoginWebView != null) {
|
|
|
+ if (accountSetupWebviewBinding != null) {
|
|
|
initWebViewLogin(mServerInfo.mBaseUrl + WEB_LOGIN, false);
|
|
|
- DisplayUtils.showSnackMessage(this, mLoginWebView, R.string.auth_access_failed,
|
|
|
+ DisplayUtils.showSnackMessage(this,
|
|
|
+ accountSetupWebviewBinding.loginWebview, R.string.auth_access_failed,
|
|
|
result.getLogMessage());
|
|
|
} else {
|
|
|
DisplayUtils.showSnackMessage(this, R.string.auth_access_failed, result.getLogMessage());
|
|
|
|
|
|
// init webView again
|
|
|
- mLoginWebView.setVisibility(View.GONE);
|
|
|
updateAuthStatusIconAndText(result);
|
|
|
}
|
|
|
|
|
@@ -1331,11 +1332,11 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
*/
|
|
|
private void showServerStatus() {
|
|
|
if (mServerStatusIcon == NO_ICON && EMPTY_STRING.equals(mServerStatusText)) {
|
|
|
- mServerStatusView.setVisibility(View.INVISIBLE);
|
|
|
+ accountSetupBinding.serverStatusText.setVisibility(View.INVISIBLE);
|
|
|
} else {
|
|
|
- mServerStatusView.setText(mServerStatusText);
|
|
|
- mServerStatusView.setCompoundDrawablesWithIntrinsicBounds(mServerStatusIcon, 0, 0, 0);
|
|
|
- mServerStatusView.setVisibility(View.VISIBLE);
|
|
|
+ accountSetupBinding.serverStatusText.setText(mServerStatusText);
|
|
|
+ accountSetupBinding.serverStatusText.setCompoundDrawablesWithIntrinsicBounds(mServerStatusIcon, 0, 0, 0);
|
|
|
+ accountSetupBinding.serverStatusText.setVisibility(View.VISIBLE);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1344,13 +1345,13 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
* authorization server.
|
|
|
*/
|
|
|
private void showAuthStatus() {
|
|
|
- if (mAuthStatusView != null) {
|
|
|
+ if (accountSetupBinding != null) {
|
|
|
if (mAuthStatusIcon == NO_ICON && EMPTY_STRING.equals(mAuthStatusText)) {
|
|
|
- mAuthStatusView.setVisibility(View.INVISIBLE);
|
|
|
+ accountSetupBinding.authStatusText.setVisibility(View.INVISIBLE);
|
|
|
} else {
|
|
|
- mAuthStatusView.setText(mAuthStatusText);
|
|
|
- mAuthStatusView.setCompoundDrawablesWithIntrinsicBounds(mAuthStatusIcon, 0, 0, 0);
|
|
|
- mAuthStatusView.setVisibility(View.VISIBLE);
|
|
|
+ accountSetupBinding.authStatusText.setText(mAuthStatusText);
|
|
|
+ accountSetupBinding.authStatusText.setCompoundDrawablesWithIntrinsicBounds(mAuthStatusIcon, 0, 0, 0);
|
|
|
+ accountSetupBinding.authStatusText.setVisibility(View.VISIBLE);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1364,7 +1365,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
@Override
|
|
|
public boolean onEditorAction(TextView inputField, int actionId, KeyEvent event) {
|
|
|
if ((actionId == EditorInfo.IME_ACTION_NEXT || actionId == EditorInfo.IME_NULL)
|
|
|
- && inputField != null && inputField.equals(mHostUrlInput)) {
|
|
|
+ && inputField != null && inputField.equals(accountSetupBinding.hostUrlInput)) {
|
|
|
checkOcServer();
|
|
|
}
|
|
|
return false; // always return false to grant that the software keyboard is hidden anyway
|
|
@@ -1469,13 +1470,6 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * For retrieving the clicking on authentication cancel button.
|
|
|
- */
|
|
|
- public void doNegativeAuthenticationDialogClick() {
|
|
|
- mIsFirstAuthAttempt = true;
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
|
|
super.onActivityResult(requestCode, resultCode, data);
|