fix to show error message on server selection screen

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2023-06-07 09:31:54 +02:00
parent 2ff5be1294
commit deb512af91
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B
2 changed files with 31 additions and 21 deletions

View File

@ -203,7 +203,6 @@ class ServerSelectionController :
private fun checkServerAndProceed() { private fun checkServerAndProceed() {
dispose() dispose()
var url: String = binding?.serverEntryTextInputEditText?.text.toString().trim { it <= ' ' } var url: String = binding?.serverEntryTextInputEditText?.text.toString().trim { it <= ' ' }
binding?.serverEntryTextInputEditText?.isEnabled = false
showserverEntryProgressBar() showserverEntryProgressBar()
if (binding?.importOrChooseProviderText?.visibility != View.INVISIBLE) { if (binding?.importOrChooseProviderText?.visibility != View.INVISIBLE) {
binding?.importOrChooseProviderText?.visibility = View.INVISIBLE binding?.importOrChooseProviderText?.visibility = View.INVISIBLE
@ -281,8 +280,6 @@ class ServerSelectionController :
hideserverEntryProgressBar() hideserverEntryProgressBar()
} }
binding?.serverEntryTextInputEditText?.isEnabled = true
if (binding?.importOrChooseProviderText?.visibility != View.INVISIBLE) { if (binding?.importOrChooseProviderText?.visibility != View.INVISIBLE) {
binding?.importOrChooseProviderText?.visibility = View.VISIBLE binding?.importOrChooseProviderText?.visibility = View.VISIBLE
binding?.certTextView?.visibility = View.VISIBLE binding?.certTextView?.visibility = View.VISIBLE
@ -304,18 +301,17 @@ class ServerSelectionController :
} }
private fun setErrorText(text: String) { private fun setErrorText(text: String) {
binding?.errorWrapper?.visibility = View.VISIBLE
binding?.errorText?.text = text binding?.errorText?.text = text
binding?.errorText?.visibility = View.VISIBLE hideserverEntryProgressBar()
binding?.serverEntryProgressBar?.visibility = View.GONE
} }
private fun showserverEntryProgressBar() { private fun showserverEntryProgressBar() {
binding?.errorText?.visibility = View.GONE binding?.errorWrapper?.visibility = View.INVISIBLE
binding?.serverEntryProgressBar?.visibility = View.VISIBLE binding?.serverEntryProgressBar?.visibility = View.VISIBLE
} }
private fun hideserverEntryProgressBar() { private fun hideserverEntryProgressBar() {
binding?.errorText?.visibility = View.GONE
binding?.serverEntryProgressBar?.visibility = View.INVISIBLE binding?.serverEntryProgressBar?.visibility = View.INVISIBLE
} }

View File

@ -133,6 +133,22 @@
</LinearLayout> </LinearLayout>
<LinearLayout
android:id="@+id/error_wrapper"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingStart="16dp"
android:paddingEnd="2dp"
android:visibility="invisible"
android:orientation="horizontal"
tools:visibility="visible">
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@android:drawable/stat_sys_warning">
</ImageView>
<TextView <TextView
android:id="@+id/error_text" android:id="@+id/error_text"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -142,14 +158,12 @@
android:gravity="start|center_vertical" android:gravity="start|center_vertical"
android:lineSpacingMultiplier="1.2" android:lineSpacingMultiplier="1.2"
android:lines="2" android:lines="2"
android:paddingStart="16dp" android:paddingStart="5dp"
android:paddingEnd="8dp" android:paddingEnd="8dp"
android:text="@string/nc_server_unsupported"
android:textAlignment="viewStart" android:textAlignment="viewStart"
android:textColor="@color/white" android:textColor="@color/white"
android:visibility="invisible" tools:text="@string/nc_server_unsupported" />
app:drawableStartCompat="@android:drawable/stat_sys_warning" </LinearLayout>
tools:visibility="visible" />
<TextView <TextView
android:id="@+id/import_or_choose_provider_text" android:id="@+id/import_or_choose_provider_text"