Merge pull request #4626 from nextcloud/removeCustomEdit

remove CustomEditTextField
This commit is contained in:
Tobias Kaminsky 2019-10-10 17:07:26 +02:00 committed by GitHub
commit f1cf050a81
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 350 additions and 486 deletions

View file

@ -219,7 +219,7 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
final boolean isCrashReportingProcess = getAppProcessName().endsWith(":crash");
final boolean useExceptionHandler = !appInfo.isDebugBuild();
if (!isCrashReportingProcess && useExceptionHandler) {
if (!isCrashReportingProcess) {
Thread.UncaughtExceptionHandler defaultPlatformHandler = Thread.getDefaultUncaughtExceptionHandler();
final ExceptionHandler crashReporter = new ExceptionHandler(this,
defaultPlatformHandler);

View file

@ -83,6 +83,7 @@ import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;
@ -90,7 +91,6 @@ import android.widget.Toast;
import com.blikoon.qrcodescanner.QrCodeActivity;
import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.textfield.TextInputLayout;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.client.device.DeviceInfo;
import com.nextcloud.client.di.Injectable;
@ -120,7 +120,6 @@ import com.owncloud.android.operations.GetServerInfoOperation;
import com.owncloud.android.services.OperationsService;
import com.owncloud.android.services.OperationsService.OperationsServiceBinder;
import com.owncloud.android.ui.activity.FileDisplayActivity;
import com.owncloud.android.ui.components.CustomEditText;
import com.owncloud.android.ui.dialog.CredentialsDialogFragment;
import com.owncloud.android.ui.dialog.IndeterminateProgressDialog;
import com.owncloud.android.ui.dialog.SslUntrustedCertDialog;
@ -196,9 +195,6 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
public static final String HTTPS_PROTOCOL = "https://";
public static final String HTTP_PROTOCOL = "http://";
public static final String REGULAR_SERVER_INPUT_TYPE = "regular";
public static final String SUBDOMAIN_SERVER_INPUT_TYPE = "prefix";
public static final String DIRECTORY_SERVER_INPUT_TYPE = "suffix";
public static final int NO_ICON = 0;
public static final String EMPTY_STRING = "";
@ -217,9 +213,10 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
private AccountManager mAccountMgr;
/// Server PRE-Fragment elements
private CustomEditText mHostUrlInput;
private EditText mHostUrlInput;
private View mRefreshButton;
private TextView mServerStatusView;
private ImageView scanQR;
private TextWatcher mHostUrlInputWatcher;
private String mServerStatusText = EMPTY_STRING;
@ -255,8 +252,6 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
private boolean webViewLoginMethod;
private String webViewUser;
private String webViewPassword;
private TextInputLayout mUsernameInputLayout;
private TextInputLayout mPasswordInputLayout;
private boolean forceOldLoginMethod;
@Inject UserAccountManager accountManager;
@ -421,8 +416,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
// initialize general UI elements
initOverallUi();
mPasswordInputLayout.setVisibility(View.VISIBLE);
mUsernameInputLayout.setVisibility(View.VISIBLE);
mPasswordInput.setVisibility(View.VISIBLE);
mUsernameInput.setVisibility(View.VISIBLE);
mUsernameInput.requestFocus();
mAuthStatusView.setVisibility(View.INVISIBLE);
mServerStatusView.setVisibility(View.INVISIBLE);
@ -606,8 +601,6 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
*/
private void initOverallUi() {
mHostUrlInput = findViewById(R.id.hostUrlInput);
mUsernameInputLayout = findViewById(R.id.input_layout_account_username);
mPasswordInputLayout = findViewById(R.id.input_layout_account_password);
mPasswordInput = findViewById(R.id.account_password);
mUsernameInput = findViewById(R.id.account_username);
mAuthStatusView = findViewById(R.id.auth_status_text);
@ -617,7 +610,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
mOkButton = findViewById(R.id.buttonOK);
mOkButton.setOnClickListener(v -> onOkClick());
ImageButton scanQR = findViewById(R.id.scanQR);
scanQR = findViewById(R.id.scanQR);
if (deviceInfo.hasCamera(this)) {
scanQR.setOnClickListener(v -> onScan());
} else {
@ -1357,8 +1350,14 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
private void setOldLoginVisibility(int visible) {
mOkButton.setVisibility(visible);
mUsernameInputLayout.setVisibility(visible);
mPasswordInputLayout.setVisibility(visible);
mUsernameInput.setVisibility(visible);
mPasswordInput.setVisibility(visible);
if (View.VISIBLE == visible) {
scanQR.setVisibility(View.GONE);
} else {
scanQR.setVisibility(View.VISIBLE);
}
}
private boolean authSupported(AuthenticationMethod authMethod) {
@ -1576,7 +1575,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
initOverallUi();
CustomEditText serverAddressField = findViewById(R.id.hostUrlInput);
EditText serverAddressField = findViewById(R.id.hostUrlInput);
serverAddressField.setText(mServerInfo.mBaseUrl);
findViewById(R.id.server_status_text).setVisibility(View.GONE);
@ -1629,7 +1628,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
initOverallUi();
CustomEditText serverAddressField = findViewById(R.id.hostUrlInput);
EditText serverAddressField = findViewById(R.id.hostUrlInput);
serverAddressField.setText(mServerInfo.mBaseUrl);
findViewById(R.id.server_status_text).setVisibility(View.GONE);

View file

@ -1,95 +0,0 @@
/**
* Nextcloud Android client application
*
* @author Mario Danic
* Copyright (C) 2017 Mario Danic
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.owncloud.android.ui.components;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.text.TextUtils;
import android.util.AttributeSet;
import com.google.android.material.textfield.TextInputEditText;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AuthenticatorActivity;
import static com.owncloud.android.datamodel.OCFile.PATH_SEPARATOR;
/**
* Custom edit text to support fixed suffix or prefix
*/
public class CustomEditText extends TextInputEditText {
private Rect fixedRect = new Rect();
private String fixedText = "";
private boolean isPrefixFixed;
public CustomEditText(Context context, AttributeSet attrs) {
super(context, attrs);
String serverInputType = getResources().getString(R.string.server_input_type);
if (AuthenticatorActivity.DIRECTORY_SERVER_INPUT_TYPE.equals(serverInputType)) {
isPrefixFixed = true;
fixedText = getResources().getString(R.string.server_url) + PATH_SEPARATOR;
} else if (AuthenticatorActivity.SUBDOMAIN_SERVER_INPUT_TYPE.equals(serverInputType)) {
isPrefixFixed = false;
fixedText = "." + getResources().getString(R.string.server_url);
}
if (TextUtils.isEmpty(fixedText)) {
setHint(R.string.auth_host_url);
}
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if (!TextUtils.isEmpty(fixedText)) {
getPaint().getTextBounds(fixedText, 0, fixedText.length(), fixedRect);
}
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (!getText().toString().startsWith(AuthenticatorActivity.HTTP_PROTOCOL)
&& !getText().toString().startsWith(AuthenticatorActivity.HTTPS_PROTOCOL)
&& !TextUtils.isEmpty(fixedText)) {
if (isPrefixFixed) {
canvas.drawText(fixedText,
super.getCompoundPaddingLeft(),
getBaseline(),
getPaint());
} else {
canvas.drawText(fixedText, super.getCompoundPaddingLeft()
+ getPaint().measureText(getText().toString()), getBaseline(), getPaint());
}
}
}
@Override
public int getCompoundPaddingLeft() {
if (!TextUtils.isEmpty(fixedText) && isPrefixFixed) {
return super.getCompoundPaddingLeft() + fixedRect.width();
} else {
return super.getCompoundPaddingLeft();
}
}
}

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
ownCloud Android client application
Copyright (C) 2012 Bartek Przybylski
Copyright (C) 2012 Bartek Przybylski
Copyright (C) 2015-2016 ownCloud Inc.
Copyright (C) 2016 Nextcloud
Copyright (C) 2019 Tobias Kaminsky
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2,
@ -18,235 +18,208 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/standard_padding"
>
android:layout_alignParentTop="true"
android:orientation="horizontal"
android:padding="@dimen/standard_padding">
<LinearLayout
android:layout_width="match_parent"
<ImageView
android:id="@+id/thumbnail"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:contentDescription="@string/app_name"
android:src="@drawable/logo" />
<ScrollView
android:id="@+id/scroll"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_above="@+id/bottom_block"
android:layout_alignParentTop="true"
android:orientation="horizontal" >
android:layout_weight="1"
android:fillViewport="true"
android:orientation="vertical">
<ImageView
android:id="@+id/thumbnail"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:src="@drawable/logo"
android:contentDescription="@string/app_name"
/>
<LinearLayout
android:id="@+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:padding="@dimen/standard_half_padding">
<ScrollView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="@+id/scroll"
android:fillViewport="true"
android:orientation="vertical" >
<com.google.android.material.button.MaterialButton
android:id="@+id/centeredRefreshButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="@dimen/alternate_margin"
android:contentDescription="@string/auth_check_server"
android:text="@string/auth_check_server"
android:theme="@style/Button"
android:visibility="gone"
app:cornerRadius="@dimen/button_corner_radius" />
<LinearLayout
android:id="@+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:padding="@dimen/standard_half_padding" >
<TextView
android:id="@+id/instructions_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="fill_horizontal"
android:layout_marginBottom="@dimen/alternate_margin"
android:contentDescription="@string/auth_expired_basic_auth_toast"
android:text="@string/auth_expired_basic_auth_toast"
android:textColor="@color/login_text_color"
android:visibility="gone" />
<com.google.android.material.button.MaterialButton
android:id="@+id/centeredRefreshButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="@dimen/alternate_margin"
android:theme="@style/Button"
android:text="@string/auth_check_server"
android:visibility="gone"
android:contentDescription="@string/auth_check_server"
app:cornerRadius="@dimen/button_corner_radius"/>
<FrameLayout
android:id="@+id/hostUrlFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/zero">
<TextView
android:id="@+id/instructions_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="fill_horizontal"
android:text="@string/auth_expired_basic_auth_toast"
android:visibility="gone"
android:layout_marginBottom="@dimen/alternate_margin"
android:textColor="@color/login_text_color"
android:contentDescription="@string/auth_expired_basic_auth_toast"/>
<FrameLayout
android:id="@+id/hostUrlFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/zero">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/input_layout_hostUrl"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.owncloud.android.ui.components.CustomEditText
android:id="@+id/hostUrlInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:contentDescription="@string/auth_host_address"
android:drawablePadding="@dimen/alternate_half_padding"
android:inputType="textUri"
android:paddingRight="@dimen/alternate_padding_right"
android:paddingEnd="@dimen/alternate_padding_right"
android:paddingStart="@dimen/zero"
android:paddingLeft="@dimen/zero"
android:textColor="@color/login_text_color"
android:textColorHint="@color/login_text_hint_color">
<requestFocus/>
</com.owncloud.android.ui.components.CustomEditText>
</com.google.android.material.textfield.TextInputLayout>
<ImageButton
android:id="@+id/testServerButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:layout_marginRight="@dimen/alternate_half_padding"
android:layout_marginEnd="@dimen/alternate_half_padding"
android:padding="@dimen/zero"
android:scaleType="fitCenter"
android:src="@drawable/arrow_right"
android:tint="@color/white"
android:background="@android:color/transparent"
android:onClick="onTestServerConnectionClick"
android:contentDescription="@string/test_server_button"
/>
<ImageButton
android:id="@+id/embeddedRefreshButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:layout_marginRight="@dimen/alternate_half_margin"
android:layout_marginEnd="@dimen/alternate_half_margin"
android:padding="@dimen/zero"
android:scaleType="fitCenter"
android:src="@drawable/ic_action_refresh"
android:visibility="gone"
android:background="@android:color/transparent"
android:contentDescription="@string/auth_refresh_button"
/>
</FrameLayout>
<TextView
android:id="@+id/server_status_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/alternate_half_margin"
android:drawableLeft="@android:drawable/stat_notify_sync"
android:drawableStart="@android:drawable/stat_notify_sync"
android:drawablePadding="@dimen/alternate_half_padding"
android:gravity="center_vertical"
android:textColor="@color/login_text_color"
android:text="@string/auth_testing_connection"
android:minHeight="@dimen/display_text_min_height"
android:contentDescription="@string/auth_testing_connection"/>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/input_layout_account_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/account_username"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="@string/auth_username"
android:inputType="textNoSuggestions"
android:textColor="@color/login_text_color"
android:textColorHint="@color/login_text_hint_color"
android:autofillHints="username"/>
android:layout_height="match_parent"
android:orientation="vertical">
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/input_layout_account_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
app:passwordToggleDrawable="@drawable/password_visibility_selector"
app:passwordToggleTint="@color/white">
<TextView
android:id="@+id/editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:text="@string/auth_host_url"
android:textColor="@color/login_text_color" />
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/account_password"
android:id="@+id/hostUrlInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:contentDescription="@string/auth_host_address"
android:drawablePadding="@dimen/alternate_half_padding"
android:ems="10"
android:hint="@string/auth_password"
android:inputType="textPassword"
android:inputType="textUri"
android:paddingStart="@dimen/zero"
android:paddingLeft="@dimen/zero"
android:paddingEnd="@dimen/alternate_padding_right"
android:paddingRight="@dimen/alternate_padding_right"
android:textColor="@color/login_text_color"
android:textColorHint="@color/login_text_hint_color"
android:autofillHints="password"/>
android:textColorHint="@color/login_text_hint_color">
</com.google.android.material.textfield.TextInputLayout>
<requestFocus />
<TextView
android:id="@+id/auth_status_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:text="@string/auth_unauthorized"
android:drawableLeft="@android:drawable/stat_notify_sync"
android:drawableStart="@android:drawable/stat_notify_sync"
android:drawablePadding="@dimen/alternate_half_padding"
android:textColor="@color/login_text_color"
android:contentDescription="@string/auth_unauthorized"
/>
</com.google.android.material.textfield.TextInputEditText>
</LinearLayout>
</ScrollView>
</LinearLayout>
</LinearLayout>
<ImageButton
android:id="@+id/testServerButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:layout_marginEnd="@dimen/alternate_half_padding"
android:layout_marginRight="@dimen/alternate_half_padding"
android:background="@android:color/transparent"
android:contentDescription="@string/test_server_button"
android:onClick="onTestServerConnectionClick"
android:padding="@dimen/zero"
android:scaleType="fitCenter"
android:src="@drawable/arrow_right"
android:tint="@color/white" />
<LinearLayout
android:id="@id/bottom_block"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical"
android:paddingTop="@dimen/standard_half_padding">
<ImageButton
android:id="@+id/embeddedRefreshButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:layout_marginEnd="@dimen/alternate_half_margin"
android:layout_marginRight="@dimen/alternate_half_margin"
android:background="@android:color/transparent"
android:contentDescription="@string/auth_refresh_button"
android:padding="@dimen/zero"
android:scaleType="fitCenter"
android:src="@drawable/ic_action_refresh"
android:visibility="gone" />
</FrameLayout>
<com.google.android.material.button.MaterialButton
android:id="@+id/buttonOK"
android:theme="@style/Button.Login"
style="@style/Button.Login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/standard_padding"
android:layout_gravity="center_horizontal"
android:enabled="false"
android:text="@string/setup_btn_connect"
android:contentDescription="@string/setup_btn_connect"
android:visibility="visible"
app:cornerRadius="@dimen/button_corner_radius"/>
</LinearLayout>
<TextView
android:id="@+id/server_status_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/alternate_half_margin"
android:contentDescription="@string/auth_testing_connection"
android:drawableStart="@android:drawable/stat_notify_sync"
android:drawableLeft="@android:drawable/stat_notify_sync"
android:drawablePadding="@dimen/alternate_half_padding"
android:gravity="center_vertical"
android:minHeight="@dimen/display_text_min_height"
android:text="@string/auth_testing_connection"
android:textColor="@color/login_text_color" />
<ImageButton
android:id="@+id/scanQR"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/qrcode_scan"
android:theme="@style/Button.Login"
android:background="@color/transparent"
android:contentDescription="@string/scanQR_description" />
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/account_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="username"
android:ems="10"
android:hint="@string/auth_username"
android:inputType="textNoSuggestions"
android:textColor="@color/login_text_color"
android:textColorHint="@color/login_text_hint_color"
android:visibility="gone" />
</RelativeLayout>
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/account_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="password"
android:drawablePadding="@dimen/alternate_half_padding"
android:ems="10"
android:hint="@string/auth_password"
android:inputType="textPassword"
android:textColor="@color/login_text_color"
android:textColorHint="@color/login_text_hint_color"
android:visibility="gone" />
<TextView
android:id="@+id/auth_status_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:contentDescription="@string/auth_unauthorized"
android:drawableStart="@android:drawable/stat_notify_sync"
android:drawableLeft="@android:drawable/stat_notify_sync"
android:drawablePadding="@dimen/alternate_half_padding"
android:gravity="center_vertical"
android:text="@string/auth_unauthorized"
android:textColor="@color/login_text_color" />
<ImageButton
android:id="@+id/scanQR"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/transparent"
android:contentDescription="@string/scanQR_description"
android:src="@drawable/qrcode_scan"
android:theme="@style/Button.Login" />
<com.google.android.material.button.MaterialButton
android:id="@+id/buttonOK"
style="@style/Button.Login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:contentDescription="@string/setup_btn_connect"
android:enabled="false"
android:padding="@dimen/standard_padding"
android:text="@string/setup_btn_connect"
android:theme="@style/Button.Login"
android:visibility="gone"
app:cornerRadius="@dimen/button_corner_radius" />
</LinearLayout>
</ScrollView>
</LinearLayout>

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
ownCloud Android client application
Copyright (C) 2012 Bartek Przybylski
Copyright (C) 2012 Bartek Przybylski
Copyright (C) 2015-2016 ownCloud Inc.
Copyright (C) 2016 Nextcloud
Copyright (C) 2019 Tobias Kaminsky
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2,
@ -19,29 +19,28 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:fillViewport="true"
android:orientation="vertical"
android:id="@+id/scroll"
>
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:fillViewport="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:padding="@dimen/standard_padding" >
android:padding="@dimen/standard_padding">
<ImageView
android:id="@+id/thumbnail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/standard_padding"
android:src="@drawable/logo"
android:contentDescription="@string/app_name"/>
<ImageView
android:id="@+id/thumbnail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/standard_padding"
android:contentDescription="@string/app_name"
android:src="@drawable/logo" />
<LinearLayout
android:layout_width="match_parent"
@ -51,184 +50,175 @@
android:padding="@dimen/standard_half_padding">
<com.google.android.material.button.MaterialButton
android:id="@+id/centeredRefreshButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="@dimen/alternate_margin"
android:theme="@style/Button"
android:text="@string/auth_check_server"
android:visibility="gone"
android:contentDescription="@string/auth_check_server"
app:cornerRadius="@dimen/button_corner_radius"/>
android:id="@+id/centeredRefreshButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="@dimen/alternate_margin"
android:contentDescription="@string/auth_check_server"
android:text="@string/auth_check_server"
android:theme="@style/Button"
android:visibility="gone"
app:cornerRadius="@dimen/button_corner_radius" />
<TextView
android:id="@+id/instructions_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="fill_horizontal"
android:layout_marginBottom="@dimen/alternate_margin"
android:contentDescription="@string/auth_expired_basic_auth_toast"
android:text="@string/auth_expired_basic_auth_toast"
android:textColor="@color/login_text_color"
android:visibility="gone" />
<TextView
android:id="@+id/instructions_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="fill_horizontal"
android:text="@string/auth_expired_basic_auth_toast"
android:visibility="gone"
android:layout_marginBottom="@dimen/alternate_margin"
android:textColor="@color/login_text_color"
android:contentDescription="@string/auth_expired_basic_auth_toast"/>
<FrameLayout
android:id="@+id/hostUrlFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/zero">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/input_layout_hostUrl"
android:theme="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:id="@+id/hostUrlFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/zero">
<com.owncloud.android.ui.components.CustomEditText
android:id="@+id/hostUrlInput"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:text="@string/auth_host_url"
android:textColor="@color/login_text_color" />
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/hostUrlInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:contentDescription="@string/auth_host_address"
android:drawablePadding="@dimen/alternate_half_padding"
android:inputType="textUri"
android:paddingStart="@dimen/zero"
android:paddingLeft="@dimen/zero"
android:paddingEnd="@dimen/alternate_padding_right"
android:paddingRight="@dimen/alternate_padding_right"
android:textColor="@color/login_text_color"
android:textColorHint="@color/login_text_color">
<requestFocus />
</com.google.android.material.textfield.TextInputEditText>
</LinearLayout>
<ImageButton
android:id="@+id/testServerButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:contentDescription="@string/auth_host_address"
android:drawablePadding="@dimen/alternate_half_padding"
android:inputType="textUri"
android:paddingRight="@dimen/alternate_padding_right"
android:paddingEnd="@dimen/alternate_padding_right"
android:paddingStart="@dimen/zero"
android:paddingLeft="@dimen/zero"
android:textColor="@color/login_text_color"
android:textColorHint="@color/login_text_color">
android:layout_gravity="center_vertical|end"
android:layout_marginEnd="@dimen/alternate_half_padding"
android:layout_marginRight="@dimen/alternate_half_padding"
android:background="@android:color/transparent"
android:contentDescription="@string/test_server_button"
android:onClick="onTestServerConnectionClick"
android:padding="@dimen/zero"
android:scaleType="fitCenter"
android:src="@drawable/arrow_right"
android:tint="@color/login_text_color" />
<requestFocus/>
</com.owncloud.android.ui.components.CustomEditText>
<ImageButton
android:id="@+id/embeddedRefreshButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:layout_marginEnd="@dimen/alternate_half_padding"
android:layout_marginRight="@dimen/alternate_half_padding"
android:background="@android:color/transparent"
android:contentDescription="@string/auth_refresh_button"
android:padding="@dimen/zero"
android:scaleType="fitCenter"
android:src="@drawable/ic_action_refresh"
android:visibility="gone" />
</FrameLayout>
</com.google.android.material.textfield.TextInputLayout>
<ImageButton
android:id="@+id/testServerButton"
android:layout_width="wrap_content"
<TextView
android:id="@+id/server_status_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:layout_marginRight="@dimen/alternate_half_padding"
android:layout_marginEnd="@dimen/alternate_half_padding"
android:padding="@dimen/zero"
android:scaleType="fitCenter"
android:src="@drawable/arrow_right"
android:tint="@color/login_text_color"
android:background="@android:color/transparent"
android:onClick="onTestServerConnectionClick"
android:contentDescription="@string/test_server_button"
/>
<ImageButton
android:id="@+id/embeddedRefreshButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:layout_marginRight="@dimen/alternate_half_padding"
android:layout_marginEnd="@dimen/alternate_half_padding"
android:padding="@dimen/zero"
android:scaleType="fitCenter"
android:src="@drawable/ic_action_refresh"
android:visibility="gone"
android:background="@android:color/transparent"
android:contentDescription="@string/auth_refresh_button"
/>
</FrameLayout>
<TextView
android:id="@+id/server_status_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/alternate_margin"
android:drawableLeft="@android:drawable/stat_notify_sync"
android:drawableStart="@android:drawable/stat_notify_sync"
android:drawablePadding="@dimen/alternate_half_padding"
android:gravity="center_vertical"
android:textColor="@color/login_text_color"
android:text="@string/auth_testing_connection"
android:minHeight="@dimen/display_text_min_height"
android:contentDescription="@string/auth_testing_connection"/>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/input_layout_account_username"
android:theme="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone">
android:layout_marginBottom="@dimen/alternate_margin"
android:contentDescription="@string/auth_testing_connection"
android:drawableStart="@android:drawable/stat_notify_sync"
android:drawableLeft="@android:drawable/stat_notify_sync"
android:drawablePadding="@dimen/alternate_half_padding"
android:gravity="center_vertical"
android:minHeight="@dimen/display_text_min_height"
android:text="@string/auth_testing_connection"
android:textColor="@color/login_text_color" />
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/account_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="username"
android:ems="10"
android:hint="@string/auth_username"
android:inputType="textNoSuggestions"
android:textColor="@color/login_text_color"
android:textColorHint="@color/login_text_hint_color"
android:autofillHints="username"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/input_layout_account_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:visibility="gone"
app:passwordToggleDrawable="@drawable/password_visibility_selector"
app:passwordToggleTint="@color/login_text_hint_color">
android:visibility="gone" />
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/account_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="password"
android:drawablePadding="@dimen/alternate_half_padding"
android:ems="10"
android:hint="@string/auth_password"
android:inputType="textPassword"
android:textColor="@color/login_text_color"
android:textColorHint="@color/login_text_hint_color"
android:autofillHints="password"/>
</com.google.android.material.textfield.TextInputLayout>
android:visibility="gone" />
<TextView
android:id="@+id/auth_status_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/alternate_margin"
android:drawableLeft="@android:drawable/stat_notify_sync"
android:drawableStart="@android:drawable/stat_notify_sync"
android:drawablePadding="@dimen/alternate_half_padding"
android:gravity="center_vertical"
android:text="@string/auth_unauthorized"
android:textColor="@color/login_text_color"
android:contentDescription="@string/auth_unauthorized"/>
<TextView
android:id="@+id/auth_status_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/alternate_margin"
android:contentDescription="@string/auth_unauthorized"
android:drawableStart="@android:drawable/stat_notify_sync"
android:drawableLeft="@android:drawable/stat_notify_sync"
android:drawablePadding="@dimen/alternate_half_padding"
android:gravity="center_vertical"
android:text="@string/auth_unauthorized"
android:textColor="@color/login_text_color" />
<ImageButton
android:id="@+id/scanQR"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/transparent"
android:contentDescription="@string/scanQR_description"
android:src="@drawable/qrcode_scan"
android:theme="@style/Button.Login" />
<com.google.android.material.button.MaterialButton
android:id="@+id/buttonOK"
android:theme="@style/Button.Login"
style="@style/Button.Login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="@dimen/standard_padding"
android:enabled="false"
android:text="@string/setup_btn_connect"
android:contentDescription="@string/setup_btn_connect"
android:visibility="gone"
app:cornerRadius="@dimen/button_corner_radius"/>
android:id="@+id/buttonOK"
style="@style/Button.Login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:contentDescription="@string/setup_btn_connect"
android:enabled="false"
android:padding="@dimen/standard_padding"
android:text="@string/setup_btn_connect"
android:theme="@style/Button.Login"
android:visibility="gone"
app:cornerRadius="@dimen/button_corner_radius" />
</LinearLayout>
<ImageButton
android:id="@+id/scanQR"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/qrcode_scan"
android:theme="@style/Button.Login"
android:background="@color/transparent"
android:contentDescription="@string/scanQR_description" />
</LinearLayout>

View file

@ -22,9 +22,6 @@
<!-- URLs and flags related -->
<string name="server_url"></string>
<bool name="show_server_url_input">true</bool>
<!-- Can be regular (full input), prefix (subdomain input) and suffix (directory input) -->
<!-- Requires server url to be set -->
<string name="server_input_type">regular</string>
<bool name="show_provider_or_own_installation">true</bool>
<string name="provider_registration_server">https://www.nextcloud.com/register</string>