Fix crash on illegal characters in URL. Fixed caret and error color on login form.
This commit is contained in:
parent
0fa0b5d212
commit
2d5e73dcd4
|
@ -49,8 +49,6 @@ class LoginActivity : AppCompatActivity() {
|
|||
else e.message
|
||||
|
||||
hostname_field.error = message
|
||||
|
||||
return@setOnClickListener
|
||||
}
|
||||
|
||||
hostname_field.error = ""
|
||||
|
@ -65,6 +63,7 @@ class LoginActivity : AppCompatActivity() {
|
|||
}
|
||||
|
||||
GlobalScope.launch(Main) {
|
||||
try {
|
||||
val result = Fuel.post("$hostname/api/v1/token", body)
|
||||
.awaitObjectResult(gsonDeserializerOf(FwCredentials::class.java))
|
||||
|
||||
|
@ -86,6 +85,15 @@ class LoginActivity : AppCompatActivity() {
|
|||
hostname_field.error = error.localizedMessage
|
||||
}
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
dialog.dismiss()
|
||||
|
||||
val message =
|
||||
if (e.message?.isEmpty() == true) getString(R.string.login_error_hostname)
|
||||
else e.message
|
||||
|
||||
hostname_field.error = message
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
android:hint="@string/login_hostname"
|
||||
android:textColorHint="@drawable/login_input"
|
||||
app:boxStrokeColor="@drawable/login_input"
|
||||
app:errorTextAppearance="@style/AppTheme.ErrorStyle"
|
||||
app:hintTextColor="@drawable/login_input">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
|
@ -42,7 +41,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:inputType="textUri"
|
||||
android:lines="1"
|
||||
android:textColor="@android:color/white" />
|
||||
android:textColor="@android:color/white"
|
||||
android:textCursorDrawable="@null" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
|
@ -55,7 +55,6 @@
|
|||
android:hint="@string/login_username"
|
||||
android:textColorHint="@drawable/login_input"
|
||||
app:boxStrokeColor="@drawable/login_input"
|
||||
app:errorTextAppearance="@style/AppTheme.ErrorStyle"
|
||||
app:hintTextColor="@drawable/login_input">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
|
@ -64,7 +63,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:inputType="textEmailAddress"
|
||||
android:lines="1"
|
||||
android:textColor="@android:color/white" />
|
||||
android:textColor="@android:color/white"
|
||||
android:textCursorDrawable="@null" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
|
@ -77,7 +77,6 @@
|
|||
android:hint="@string/login_password"
|
||||
android:textColorHint="@drawable/login_input"
|
||||
app:boxStrokeColor="@drawable/login_input"
|
||||
app:errorTextAppearance="@style/AppTheme.ErrorStyle"
|
||||
app:hintTextColor="@drawable/login_input"
|
||||
app:passwordToggleEnabled="true">
|
||||
|
||||
|
@ -87,7 +86,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:inputType="textPassword"
|
||||
android:lines="1"
|
||||
android:textColor="@android:color/white" />
|
||||
android:textColor="@android:color/white"
|
||||
android:textCursorDrawable="@null" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<color name="colorPrimary">#327eae</color>
|
||||
<color name="colorPrimaryDark">#3d3e40</color>
|
||||
<color name="colorAccent">#d35400</color>
|
||||
<color name="colorError">#b94705</color>
|
||||
<color name="colorError">#fdcfbb</color>
|
||||
|
||||
<color name="colorSelected">#dadada</color>
|
||||
<color name="colorFavorite">#e17055</color>
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
<item name="materialButtonStyle">@style/AppTheme.ButtonStyle</item>
|
||||
|
||||
<item name="preferenceTheme">@style/AppTheme.Preference</item>
|
||||
|
||||
<item name="colorError">@color/colorError</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Fragment">
|
||||
|
@ -76,8 +78,4 @@
|
|||
<item name="android:background">@android:color/transparent</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.ErrorStyle" parent="@android:style/TextAppearance">
|
||||
<item name="android:textColor">@color/colorError</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue