Use constants

This commit is contained in:
Mario Danic 2017-03-17 16:37:37 +01:00 committed by AndyScherzinger
parent d079808c6d
commit e73091a212
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B
2 changed files with 6 additions and 5 deletions

View file

@ -56,8 +56,8 @@ public class CustomEditText extends android.support.v7.widget.AppCompatEditText
}
public String getFullServerUrl() {
if (TextUtils.isEmpty(fixedText) || getText().toString().startsWith("http://")
|| getText().toString().startsWith("https://")) {
if (TextUtils.isEmpty(fixedText) || getText().toString().startsWith(AuthenticatorActivity.HTTP_PROTOCOL)
|| getText().toString().startsWith(AuthenticatorActivity.HTTPS_PROTOCOL)) {
return getText().toString();
} else if (isPrefixFixed) {
return (getResources().getString(R.string.server_url) + "/" + getText().toString());
@ -77,7 +77,8 @@ public class CustomEditText extends android.support.v7.widget.AppCompatEditText
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (!getText().toString().startsWith("http://") && !getText().toString().startsWith("https://")
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());

View file

@ -147,8 +147,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
private static final String KEY_ASYNC_TASK_IN_PROGRESS = "AUTH_IN_PROGRESS";
public static final String PROTOCOL_SUFFIX = "://";
public static final String LOGIN_URL_DATA_KEY_VALUE_SEPARATOR = ":";
private static final String HTTPS_PROTOCOL = "https://";
private static final String HTTP_PROTOCOL = "http://";
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";