mirror of
https://github.com/element-hq/element-android
synced 2024-11-25 02:45:37 +03:00
BugReport screen: improve UX when description is too short (reported by Matthew)
This commit is contained in:
parent
1ceddd9607
commit
65faedb06b
3 changed files with 13 additions and 6 deletions
|
@ -77,8 +77,7 @@ class BugReportActivity : VectorBaseActivity() {
|
|||
|
||||
override fun onPrepareOptionsMenu(menu: Menu): Boolean {
|
||||
menu.findItem(R.id.ic_action_send_bug_report)?.let {
|
||||
val isValid = bug_report_edit_text.text.toString().trim().length > 10
|
||||
&& !bug_report_mask_view.isVisible
|
||||
val isValid = !bug_report_mask_view.isVisible
|
||||
|
||||
it.isEnabled = isValid
|
||||
it.icon.alpha = if (isValid) 255 else 100
|
||||
|
@ -90,7 +89,11 @@ class BugReportActivity : VectorBaseActivity() {
|
|||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
R.id.ic_action_send_bug_report -> {
|
||||
sendBugReport()
|
||||
if (bug_report_edit_text.text.toString().trim().length >= 10) {
|
||||
sendBugReport()
|
||||
} else {
|
||||
bug_report_text_input_layout.error = getString(R.string.bug_report_error_too_short)
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
@ -150,7 +153,7 @@ class BugReportActivity : VectorBaseActivity() {
|
|||
val myProgress = progress.coerceIn(0, 100)
|
||||
|
||||
bug_report_progress_view.progress = myProgress
|
||||
bug_report_progress_text_view.text = getString(R.string.send_bug_report_progress, "$myProgress")
|
||||
bug_report_progress_text_view.text = getString(R.string.send_bug_report_progress, myProgress.toString())
|
||||
}
|
||||
|
||||
override fun onUploadSucceed() {
|
||||
|
@ -179,7 +182,7 @@ class BugReportActivity : VectorBaseActivity() {
|
|||
|
||||
@OnTextChanged(R.id.bug_report_edit_text)
|
||||
internal fun textChanged() {
|
||||
invalidateOptionsMenu()
|
||||
bug_report_text_input_layout.error = null
|
||||
}
|
||||
|
||||
@OnCheckedChanged(R.id.bug_report_button_include_screenshot)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -82,7 +83,9 @@
|
|||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:hint="@string/send_bug_report_placeholder"
|
||||
android:textColorHint="?attr/vctr_default_text_hint_color">
|
||||
android:textColorHint="?attr/vctr_default_text_hint_color"
|
||||
app:counterEnabled="true"
|
||||
app:counterMaxLength="500">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/bug_report_edit_text"
|
||||
|
|
|
@ -162,4 +162,5 @@
|
|||
<string name="soft_logout_sso_not_same_user_error">The current session is for user %1$s and you provide credentials for user %2$s. This is not supported by RiotX.\nPlease first clear data, then sign in again on another account.</string>
|
||||
|
||||
<string name="permalink_malformed">Your matrix.to link was malformed</string>
|
||||
<string name="bug_report_error_too_short">The description is too short</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue